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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569
  1. /*3:*/
  2. #line 522 "./typica.w"
  3. #define PROGRAM_NAME "Typica"
  4. /*5:*/
  5. #line 616 "./typica.w"
  6. #include <QtCore>
  7. #include <QtGui>
  8. #include <QtScript>
  9. #include <QtScriptTools>
  10. #include <QtXml>
  11. #include <QtSql>
  12. #include <QtDebug>
  13. #include <QtXmlPatterns>
  14. #include <QtWebKit>
  15. /*:5*//*6:*/
  16. #line 631 "./typica.w"
  17. #include "helpmenu.h"
  18. /*:6*//*270:*/
  19. #line 6005 "./typica.w"
  20. #include "units.h"
  21. #line 1 "./measurement.w"
  22. /*:270*//*539:*/
  23. #line 197 "./webview.w"
  24. #include "webview.h"
  25. /*:539*//*552:*/
  26. #line 375 "./webview.w"
  27. #include "webelement.h"
  28. #line 11934 "./typica.w"
  29. /*:552*//*663:*/
  30. #line 476 "./daterangeselector.w"
  31. #include "daterangeselector.h"
  32. #line 13650 "./typica.w"
  33. /*:663*//*771:*/
  34. #line 16151 "./typica.w"
  35. #include "qextserialport.h"
  36. #include "qextserialenumerator.h"
  37. /*:771*//*898:*/
  38. #line 124 "./dataqsdk.w"
  39. #ifdef Q_OS_WIN32
  40. #include <windef.h>
  41. #else
  42. #define PASCAL
  43. #endif
  44. /*:898*//*922:*/
  45. #line 862 "./dataqsdk.w"
  46. #include <limits>
  47. /*:922*//*937:*/
  48. #line 62 "./scales.w"
  49. #include "draglabel.h"
  50. /*:937*//*952:*/
  51. #line 335 "./scales.w"
  52. #include "scale.h"
  53. /*:952*/
  54. #line 525 "./typica.w"
  55. /*20:*/
  56. #line 946 "./typica.w"
  57. class ScriptQMainWindow:public QMainWindow
  58. {
  59. Q_OBJECT
  60. Q_PROPERTY(QString closePrompt READ closePrompt WRITE setClosePrompt)
  61. public:
  62. ScriptQMainWindow();
  63. QString closePrompt();
  64. public slots:
  65. void show();
  66. void saveSizeAndPosition(const QString&key);
  67. void restoreSizeAndPosition(const QString&key);
  68. void displayStatus(const QString&message= QString());
  69. void setClosePrompt(QString prompt);
  70. protected:
  71. void closeEvent(QCloseEvent*event);
  72. void showEvent(QShowEvent*event);
  73. signals:
  74. void aboutToClose(void);
  75. private:
  76. QString cprompt;
  77. };
  78. /*:20*//*148:*/
  79. #line 3435 "./typica.w"
  80. class SqlQueryConnection:public QSqlQuery
  81. {
  82. public:
  83. SqlQueryConnection(const QString&query= QString());
  84. ~SqlQueryConnection();
  85. QSqlQuery*operator->()const;
  86. private:
  87. QString connection;
  88. QSqlQuery*q;
  89. };
  90. /*:148*//*224:*/
  91. #line 5284 "./typica.w"
  92. class NumericDelegate:public QItemDelegate
  93. {
  94. Q_OBJECT
  95. public:
  96. NumericDelegate(QObject*parent= NULL);
  97. QWidget*createEditor(QWidget*parent,
  98. const QStyleOptionViewItem&option,
  99. const QModelIndex&index)const;
  100. void setEditorData(QWidget*editor,const QModelIndex&index)const;
  101. void setModelData(QWidget*editor,QAbstractItemModel*model,
  102. const QModelIndex&index)const;
  103. void updateEditorGeometry(QWidget*editor,
  104. const QStyleOptionViewItem&option,
  105. const QModelIndex&index)const;
  106. };
  107. /*:224*//*266:*/
  108. #line 425 "./units.w"
  109. Q_DECLARE_METATYPE(Units::Unit)
  110. /*:266*//*271:*/
  111. #line 19 "./measurement.w"
  112. class Measurement:public QVariantMap
  113. {
  114. public:
  115. Measurement(double temperature= 0,QTime time= QTime(),
  116. Units::Unit sc= Units::Fahrenheit);
  117. Measurement(double temperature);
  118. double temperature()const;
  119. QTime time()const;
  120. void setTemperature(double temperature);
  121. void setTime(QTime time);
  122. void setUnit(Units::Unit scale);
  123. Units::Unit scale()const;
  124. Measurement toFahrenheit();
  125. Measurement toCelsius();
  126. Measurement toKelvin();
  127. Measurement toRankine();
  128. };
  129. /*:271*//*275:*/
  130. #line 128 "./measurement.w"
  131. Q_DECLARE_METATYPE(Measurement)
  132. /*:275*//*282:*/
  133. #line 6069 "./typica.w"
  134. class Channel;
  135. class DAQImplementation;
  136. class DAQ:public QObject
  137. {
  138. Q_OBJECT
  139. Q_ENUMS(ThermocoupleType)
  140. DAQImplementation*imp;
  141. private slots:
  142. void threadFinished();
  143. public:
  144. DAQ(QString device,const QString&driver= QString("nidaqmxbase"));
  145. ~DAQ();
  146. Channel*newChannel(int units,int thermocouple);
  147. Q_INVOKABLE void setClockRate(double Hz);
  148. Q_INVOKABLE void start();
  149. Q_INVOKABLE void stop();
  150. enum ThermocoupleType
  151. {
  152. TypeJ= 10072,
  153. TypeK= 10073,
  154. TypeN= 10077,
  155. TypeR= 10082,
  156. TypeS= 10085,
  157. TypeT= 10086,
  158. TypeB= 10047,
  159. TypeE= 10055
  160. };
  161. };
  162. /*:282*//*283:*/
  163. #line 6107 "./typica.w"
  164. class DAQImplementation:public QThread
  165. {
  166. Q_OBJECT
  167. public:
  168. DAQImplementation(const QString&driverinfo);
  169. ~DAQImplementation();
  170. void run();
  171. void measure();
  172. /*284:*/
  173. #line 6127 "./typica.w"
  174. typedef int(*daqfp)(...);
  175. daqfp read;
  176. daqfp errorInfo;
  177. daqfp startTask;
  178. daqfp createTask;
  179. daqfp createChannel;
  180. daqfp setClock;
  181. daqfp stopTask;
  182. daqfp clearTask;
  183. daqfp resetDevice;
  184. daqfp waitForMeasurement;
  185. /*:284*/
  186. #line 6116 "./typica.w"
  187. /*285:*/
  188. #line 6143 "./typica.w"
  189. bool useBase;
  190. QString device;
  191. QVector<Channel*> channelMap;
  192. unsigned int handle;
  193. int error;
  194. int channels;
  195. bool ready;
  196. QLibrary driver;
  197. QVector<Units::Unit> unitMap;
  198. /*:285*/
  199. #line 6117 "./typica.w"
  200. };
  201. /*:283*//*301:*/
  202. #line 6647 "./typica.w"
  203. class FakeDAQImplementation:public QThread
  204. {
  205. Q_OBJECT
  206. public:
  207. FakeDAQImplementation();
  208. ~FakeDAQImplementation();
  209. void run();
  210. void measure();
  211. QVector<Channel*> channelMap;
  212. int channels;
  213. bool ready;
  214. double clockRate;
  215. };
  216. class FakeDAQ:public QObject
  217. {
  218. Q_OBJECT
  219. FakeDAQImplementation*imp;
  220. public:
  221. FakeDAQ(QString device);
  222. ~FakeDAQ();
  223. Channel*newChannel(int units,int thermocouple);
  224. Q_INVOKABLE void setClockRate(double Hz);
  225. Q_INVOKABLE void start();
  226. };
  227. /*:301*//*308:*/
  228. #line 6834 "./typica.w"
  229. class Channel:public QObject
  230. {
  231. Q_OBJECT
  232. public:
  233. Channel();
  234. ~Channel();
  235. public slots:
  236. void input(Measurement measurement);
  237. signals:
  238. void newData(Measurement);
  239. };
  240. /*:308*//*312:*/
  241. #line 6901 "./typica.w"
  242. class LinearCalibrator:public QObject
  243. {
  244. Q_OBJECT
  245. Q_PROPERTY(double measuredLower READ measuredLower
  246. WRITE setMeasuredLower)
  247. Q_PROPERTY(double measuredUpper READ measuredUpper
  248. WRITE setMeasuredUpper)
  249. Q_PROPERTY(double mappedLower READ mappedLower WRITE setMappedLower)
  250. Q_PROPERTY(double mappedUpper READ mappedUpper WRITE setMappedUpper)
  251. Q_PROPERTY(bool closedRange READ isClosedRange WRITE setClosedRange)
  252. Q_PROPERTY(double sensitivity READ sensitivity WRITE setSensitivity)
  253. public:
  254. LinearCalibrator(QObject*parent= NULL);
  255. double measuredLower();
  256. double measuredUpper();
  257. double mappedLower();
  258. double mappedUpper();
  259. bool isClosedRange();
  260. double sensitivity();
  261. public slots:
  262. void setMeasuredLower(double lower);
  263. void setMeasuredUpper(double upper);
  264. void setMappedLower(double lower);
  265. void setMappedUpper(double upper);
  266. void setClosedRange(bool closed);
  267. void setSensitivity(double sensitivity);
  268. Measurement newMeasurement(Measurement measure);
  269. signals:
  270. void measurement(Measurement measure);
  271. void newData(Measurement measure);
  272. private:
  273. double Lo1;
  274. double Lo2;
  275. double Up1;
  276. double Up2;
  277. double sensitivitySetting;
  278. bool clamp;
  279. };
  280. /*:312*//*319:*/
  281. #line 7097 "./typica.w"
  282. class LinearSplineInterpolator:public QObject
  283. {
  284. Q_OBJECT
  285. public:
  286. LinearSplineInterpolator(QObject*parent= NULL);
  287. Q_INVOKABLE void add_pair(double source,double destination);
  288. public slots:
  289. Measurement newMeasurement(Measurement measure);
  290. signals:
  291. void newData(Measurement measure);
  292. private:
  293. void make_interpolators();
  294. QMap<double,double> *pairs;
  295. QList<LinearCalibrator*> *interpolators;
  296. };
  297. /*:319*//*324:*/
  298. #line 7233 "./typica.w"
  299. class TemperatureDisplay:public QLCDNumber
  300. {
  301. Q_OBJECT
  302. int unit;
  303. bool r;
  304. public:
  305. TemperatureDisplay(QWidget*parent= NULL);
  306. ~TemperatureDisplay();
  307. public slots:
  308. void setValue(Measurement temperature);
  309. void invalidate();
  310. void setDisplayUnits(Units::Unit scale);
  311. void setRelativeMode(bool relative);
  312. };
  313. /*:324*//*335:*/
  314. #line 7449 "./typica.w"
  315. class MeasurementTimeOffset:public QObject
  316. {
  317. Q_OBJECT
  318. QTime epoch;
  319. QTime previous;
  320. bool hasPrevious;
  321. public:
  322. MeasurementTimeOffset(QTime zero);
  323. QTime zeroTime();
  324. public slots:
  325. void newMeasurement(Measurement measure);
  326. void setZeroTime(QTime zero);
  327. signals:
  328. void measurement(Measurement measure);
  329. };
  330. /*:335*//*342:*/
  331. #line 7601 "./typica.w"
  332. class ThresholdDetector:public QObject
  333. {
  334. Q_OBJECT
  335. Q_ENUMS(EdgeDirection)
  336. public:
  337. enum EdgeDirection{
  338. Ascending,Descending
  339. };
  340. ThresholdDetector(double value);
  341. public slots:
  342. void newMeasurement(Measurement measure);
  343. void setThreshold(double value);
  344. void setEdgeDirection(EdgeDirection direction);
  345. signals:
  346. void timeForValue(double);
  347. private:
  348. double previousValue;
  349. double threshold;
  350. EdgeDirection currentDirection;
  351. };
  352. /*:342*//*347:*/
  353. #line 7707 "./typica.w"
  354. class ZeroEmitter:public QObject
  355. {
  356. Q_OBJECT
  357. Q_PROPERTY(int column READ column WRITE setColumn)
  358. Measurement cache;
  359. int col;
  360. public:
  361. ZeroEmitter(int tempcolumn= 1);
  362. int column();
  363. double lastTemperature();
  364. public slots:
  365. void newMeasurement(Measurement measure);
  366. void setColumn(int column);
  367. void emitZero();
  368. signals:
  369. void measurement(Measurement measure,int tempcolumn);
  370. };
  371. /*:347*//*352:*/
  372. #line 7801 "./typica.w"
  373. class MeasurementAdapter:public QObject
  374. {
  375. Q_OBJECT
  376. int col;
  377. public:
  378. MeasurementAdapter(int tempcolumn);
  379. int column();
  380. public slots:
  381. void newMeasurement(Measurement measure);
  382. void setColumn(int column);
  383. signals:
  384. void measurement(Measurement measure,int tempcolumn);
  385. };
  386. /*:352*//*357:*/
  387. #line 7890 "./typica.w"
  388. class GraphView:public QGraphicsView
  389. {
  390. Q_OBJECT
  391. QGraphicsScene*theScene;
  392. QMap<int,QList<QGraphicsLineItem*> *> *graphLines;
  393. QMap<int,QPointF> *prevPoints;
  394. QMap<int,double> *translations;
  395. QList<QGraphicsItem*> *gridLinesF;
  396. QList<QGraphicsItem*> *gridLinesC;
  397. QList<QGraphicsItem*> *relativeGridLines;
  398. bool relativeEnabled;
  399. bool timeIndicatorEnabled;
  400. QGraphicsLineItem*timeLine;
  401. LinearSplineInterpolator*relativeAdjuster;
  402. public:
  403. GraphView(QWidget*parent= NULL);
  404. void removeSeries(int column);
  405. protected:
  406. void resizeEvent(QResizeEvent*event);
  407. public slots:
  408. void newMeasurement(Measurement measure,int tempcolumn);
  409. void setSeriesTranslation(int column,double offset);
  410. void setTimeIndicatorEnabled(bool enabled);
  411. void clear();
  412. void showF();
  413. void showC();
  414. };
  415. /*:357*//*374:*/
  416. #line 8355 "./typica.w"
  417. class MeasurementModel;
  418. class ZoomLog:public QTableView
  419. {
  420. Q_OBJECT
  421. /*375:*/
  422. #line 8404 "./typica.w"
  423. MeasurementModel*model_ms;
  424. MeasurementModel*model_1s;
  425. MeasurementModel*model_5s;
  426. MeasurementModel*model_10s;
  427. MeasurementModel*model_15s;
  428. MeasurementModel*model_30s;
  429. MeasurementModel*model_1m;
  430. QList<MeasurementModel*> modelSet;
  431. QHash<int,Measurement> lastMeasurement;
  432. MeasurementModel*currentModel;
  433. QList<int> saveTempCols;
  434. QList<int> saveControlCols;
  435. QList<int> saveNoteCols;
  436. QList<int> currentColumnSet;
  437. /*:375*/
  438. #line 8360 "./typica.w"
  439. void switchLOD(MeasurementModel*m);
  440. private slots:
  441. void centerOn(int row);
  442. void persistColumnResize(int column,int oldsize,int newsize);
  443. void restoreColumnWidths();
  444. public:
  445. ZoomLog();
  446. QVariant data(int row,int column)const;
  447. int rowCount();
  448. bool saveXML(QIODevice*device);
  449. bool saveCSV(QIODevice*device);
  450. QString lastTime(int series);
  451. Q_INVOKABLE Units::Unit displayUnits();
  452. public slots:
  453. void setVisible(bool visibility);
  454. void setHeaderData(int section,QString text);
  455. void LOD_ms();
  456. void LOD_1s();
  457. void LOD_5s();
  458. void LOD_10s();
  459. void LOD_15s();
  460. void LOD_30s();
  461. void LOD_1m();
  462. void newMeasurement(Measurement measure,int tempcolumn);
  463. void newAnnotation(QString annotation,int tempcolumn,
  464. int annotationcolumn);
  465. void clear();
  466. void addOutputTemperatureColumn(int column);
  467. void addOutputControlColumn(int column);
  468. void addOutputAnnotationColumn(int column);
  469. void clearOutputColumns();
  470. void setDisplayUnits(Units::Unit scale);
  471. void addToCurrentColumnSet(int column);
  472. void clearCurrentColumnSet();
  473. protected:
  474. virtual void showEvent(QShowEvent*event);
  475. };
  476. /*:374*//*400:*/
  477. #line 9100 "./typica.w"
  478. class MeasurementList;
  479. class MeasurementModel:public QAbstractItemModel
  480. {
  481. Q_OBJECT
  482. Units::Unit unit;
  483. QList<MeasurementList*> *entries;
  484. QStringList*hData;
  485. int colcount;
  486. QHash<int,int> *lastTemperature;
  487. QList<MeasurementList*> ::iterator lastInsertion;
  488. QHash<int,bool> *controlColumns;
  489. public:
  490. MeasurementModel(QObject*parent= NULL);
  491. ~MeasurementModel();
  492. int rowCount(const QModelIndex&parent= QModelIndex())const;
  493. int columnCount(const QModelIndex&parent= QModelIndex())const;
  494. bool setHeaderData(int section,Qt::Orientation orientation,
  495. const QVariant&value,int role= Qt::DisplayRole);
  496. QVariant data(const QModelIndex&index,int role)const;
  497. bool setData(const QModelIndex&index,const QVariant&value,
  498. int role= Qt::EditRole);
  499. Qt::ItemFlags flags(const QModelIndex&index)const;
  500. QVariant headerData(int section,Qt::Orientation orientation,
  501. int role= Qt::DisplayRole)const;
  502. QModelIndex index(int row,int column,
  503. const QModelIndex&parent= QModelIndex())const;
  504. QModelIndex parent(const QModelIndex&index)const;
  505. Units::Unit displayUnits();
  506. public slots:
  507. void newMeasurement(Measurement measure,int tempcolumn);
  508. void newAnnotation(QString annotation,int tempcolumn,
  509. int annotationColumn);
  510. void clear();
  511. void setDisplayUnits(Units::Unit scale);
  512. signals:
  513. void rowChanged(int);
  514. };
  515. /*:400*//*401:*/
  516. #line 9144 "./typica.w"
  517. class MeasurementList:public QVariantList
  518. {
  519. public:
  520. bool operator<(const MeasurementList&other)const;
  521. bool operator==(const MeasurementList&other)const;
  522. };
  523. /*:401*//*427:*/
  524. #line 9802 "./typica.w"
  525. class AnnotationButton:public QPushButton
  526. {
  527. Q_OBJECT
  528. QString note;
  529. int tc;
  530. int ac;
  531. int count;
  532. public:
  533. AnnotationButton(const QString&text,QWidget*parent= NULL);
  534. public slots:
  535. void setAnnotation(const QString&annotation);
  536. void setTemperatureColumn(int tempcolumn);
  537. void setAnnotationColumn(int annotationcolumn);
  538. void annotate();
  539. void resetCount();
  540. signals:
  541. void annotation(QString annotation,int tempcolumn,
  542. int notecolumn);
  543. };
  544. /*:427*//*435:*/
  545. #line 9927 "./typica.w"
  546. class AnnotationSpinBox:public QDoubleSpinBox
  547. {
  548. Q_OBJECT
  549. QString pretext;
  550. QString posttext;
  551. int tc;
  552. int ac;
  553. bool change;
  554. public:
  555. AnnotationSpinBox(const QString&pret,const QString&postt,
  556. QWidget*parent= NULL);
  557. public slots:
  558. void setPretext(const QString&pret);
  559. void setPosttext(const QString&postt);
  560. void setTemperatureColumn(int tempcolumn);
  561. void setAnnotationColumn(int annotationcolumn);
  562. void annotate();
  563. void resetChange();
  564. signals:
  565. void annotation(QString annotation,int tempcolumn,
  566. int notecolumn);
  567. };
  568. /*:435*//*443:*/
  569. #line 10086 "./typica.w"
  570. class TimerDisplay:public QLCDNumber
  571. {
  572. Q_OBJECT
  573. /*444:*/
  574. #line 10136 "./typica.w"
  575. Q_PROPERTY(QTime seconds READ seconds WRITE setTimer)
  576. Q_PROPERTY(TimerMode mode READ mode WRITE setMode)
  577. Q_PROPERTY(bool running READ isRunning)
  578. Q_PROPERTY(QTime resetValue READ resetValue WRITE setResetValue)
  579. Q_PROPERTY(QString displayFormat READ displayFormat WRITE setDisplayFormat)
  580. Q_PROPERTY(bool autoReset READ autoReset WRITE setAutoReset)
  581. /*:444*/
  582. #line 10090 "./typica.w"
  583. private slots:
  584. void updateTime();
  585. void setCountUpMode();
  586. void setCountDownMode();
  587. void setClockMode();
  588. public:
  589. TimerDisplay(QWidget*parent= NULL);
  590. ~TimerDisplay();
  591. enum TimerMode
  592. {
  593. CountUp,
  594. CountDown,
  595. Clock
  596. };
  597. QString value();
  598. QTime seconds();
  599. TimerMode mode();
  600. bool isRunning();
  601. QTime resetValue();
  602. QString displayFormat();
  603. bool autoReset();
  604. public slots:
  605. void setTimer(QTime value= QTime(0,0,0));
  606. void setMode(TimerMode mode);
  607. void startTimer();
  608. void stopTimer();
  609. void copyTimer();
  610. void setResetValue(QTime value= QTime(0,0,0));
  611. void reset();
  612. void setDisplayFormat(QString format);
  613. void setAutoReset(bool reset);
  614. void updateDisplay();
  615. signals:
  616. void valueChanged(QTime);
  617. void runStateChanged(bool);
  618. private:
  619. /*445:*/
  620. #line 10146 "./typica.w"
  621. QTime s;
  622. QTime r;
  623. QTimer clock;
  624. TimerDisplay::TimerMode m;
  625. bool running;
  626. bool ar;
  627. QAction*startAction;
  628. QAction*stopAction;
  629. QAction*resetAction;
  630. QString f;
  631. QTime relative;
  632. QTime base;
  633. /*:445*/
  634. #line 10127 "./typica.w"
  635. };
  636. /*:443*//*465:*/
  637. #line 10505 "./typica.w"
  638. class PackLayout:public QLayout
  639. {
  640. int doLayout(const QRect&rect,bool testOnly)const;
  641. QList<QLayoutItem*> itemList;
  642. Qt::Orientations orientation;
  643. public:
  644. PackLayout(QWidget*parent,int margin= 0,int spacing= -1);
  645. PackLayout(int spacing= -1);
  646. ~PackLayout();
  647. void addItem(QLayoutItem*item);
  648. Qt::Orientations expandingDirections()const;
  649. bool hasHeightForWidth()const;
  650. int heightForWidth(int width)const;
  651. int count()const;
  652. QLayoutItem*itemAt(int index)const;
  653. QSize minimumSize()const;
  654. void setGeometry(const QRect&rect);
  655. void setOrientation(Qt::Orientations direction);
  656. QSize sizeHint()const;
  657. QLayoutItem*takeAt(int index);
  658. };
  659. /*:465*//*478:*/
  660. #line 10783 "./typica.w"
  661. class SceneButton:public QGraphicsScene
  662. {
  663. Q_OBJECT
  664. public:
  665. SceneButton();
  666. ~SceneButton();
  667. protected:
  668. void mousePressEvent(QGraphicsSceneMouseEvent*mouseEvent);
  669. signals:
  670. void clicked(QPoint pos);
  671. };
  672. /*:478*//*480:*/
  673. #line 10825 "./typica.w"
  674. class WidgetDecorator:public QWidget
  675. {
  676. Q_OBJECT
  677. PackLayout*layout;
  678. QGraphicsView*label;
  679. QGraphicsTextItem*text;
  680. SceneButton*scene;
  681. public:
  682. WidgetDecorator(QWidget*widget,const QString&labeltext,
  683. Qt::Orientations orientation= Qt::Horizontal,
  684. QWidget*parent= NULL,Qt::WindowFlags f= 0);
  685. ~WidgetDecorator();
  686. void setBackgroundBrush(QBrush background);
  687. void setTextColor(QColor color);
  688. };
  689. /*:480*//*491:*/
  690. #line 11000 "./typica.w"
  691. class LogEditWindow:public QMainWindow
  692. {
  693. Q_OBJECT
  694. QWidget*centralWidget;
  695. PackLayout*mainLayout;
  696. QHBoxLayout*addRowsLayout;
  697. QLabel*startTimeLabel;
  698. QTimeEdit*startTime;
  699. QLabel*endTimeLabel;
  700. QTimeEdit*endTime;
  701. QLabel*intervalLabel;
  702. QSpinBox*interval;
  703. QPushButton*addRows;
  704. QAction*saveXml;
  705. QAction*saveCsv;
  706. QAction*openXml;
  707. MeasurementModel*model;
  708. QTableView*log;
  709. private slots:
  710. void addTheRows();
  711. void saveXML();
  712. void saveCSV();
  713. void openXML();
  714. protected:
  715. void closeEvent(QCloseEvent*event);
  716. public:
  717. LogEditWindow();
  718. };
  719. /*:491*//*505:*/
  720. #line 11308 "./typica.w"
  721. class XMLOutput:public QObject
  722. {
  723. Q_OBJECT
  724. MeasurementModel*data;
  725. QIODevice*out;
  726. int time;
  727. QMap<int,QString> temperatureColumns;
  728. QMap<int,QString> controlColumns;
  729. QMap<int,QString> annotationColumns;
  730. public:
  731. XMLOutput(MeasurementModel*model,QIODevice*device,int timec= 0);
  732. void addTemperatureColumn(const QString&series,int column);
  733. void addControlColumn(const QString&series,int column);
  734. void addAnnotationColumn(const QString&series,int column);
  735. void setModel(MeasurementModel*model);
  736. void setTimeColumn(int column);
  737. void setDevice(QIODevice*device);
  738. bool output();
  739. };
  740. /*:505*//*512:*/
  741. #line 11544 "./typica.w"
  742. class XMLInput:public QObject
  743. {
  744. Q_OBJECT
  745. int firstc;
  746. QIODevice*in;
  747. public:
  748. XMLInput(QIODevice*input,int c);
  749. void setFirstColumn(int column);
  750. void setDevice(QIODevice*device);
  751. bool input();
  752. signals:
  753. void measure(Measurement,int);
  754. void annotation(QString,int,int);
  755. void newTemperatureColumn(int,QString);
  756. void newAnnotationColumn(int,QString);
  757. void lastColumn(int);
  758. };
  759. /*:512*//*523:*/
  760. #line 11799 "./typica.w"
  761. class CSVOutput
  762. {
  763. MeasurementModel*data;
  764. QIODevice*out;
  765. int time;
  766. QMap<int,QString> temperatureColumns;
  767. QMap<int,QString> controlColumns;
  768. QMap<int,QString> annotationColumns;
  769. public:
  770. CSVOutput(MeasurementModel*model,QIODevice*device,int timec= 0);
  771. void addTemperatureColumn(const QString&series,int column);
  772. void addControlColumn(const QString&series,int column);
  773. void addAnnotationColumn(const QString&series,int column);
  774. void setModel(MeasurementModel*model);
  775. void setTimeColumn(int column);
  776. void setDevice(QIODevice*device);
  777. bool output();
  778. };
  779. /*:523*//*553:*/
  780. #line 11942 "./typica.w"
  781. #define AppInstance (qobject_cast<Application *> (qApp))
  782. class NodeInserter;
  783. class DeviceTreeModel;
  784. class Application:public QApplication
  785. {
  786. Q_OBJECT
  787. public:
  788. Application(int&argc,char**argv);
  789. QDomDocument*configuration();
  790. /*695:*/
  791. #line 14496 "./typica.w"
  792. QDomDocument deviceConfiguration();
  793. /*:695*//*728:*/
  794. #line 15169 "./typica.w"
  795. void registerDeviceConfigurationWidget(QString driver,QMetaObject widget);
  796. QWidget*deviceConfigurationWidget(DeviceTreeModel*model,
  797. const QModelIndex&index);
  798. /*:728*//*733:*/
  799. #line 15273 "./typica.w"
  800. QList<NodeInserter*> topLevelNodeInserters;
  801. /*:733*/
  802. #line 11953 "./typica.w"
  803. QSqlDatabase database();
  804. QScriptEngine*engine;
  805. public slots:
  806. /*696:*/
  807. #line 14503 "./typica.w"
  808. void saveDeviceConfiguration();
  809. /*:696*/
  810. #line 11957 "./typica.w"
  811. private:
  812. /*694:*/
  813. #line 14487 "./typica.w"
  814. QDomDocument deviceConfigurationDocument;
  815. /*:694*//*727:*/
  816. #line 15163 "./typica.w"
  817. QHash<QString,QMetaObject> deviceConfigurationWidgets;
  818. /*:727*/
  819. #line 11959 "./typica.w"
  820. QDomDocument conf;
  821. };
  822. /*:553*//*561:*/
  823. #line 12084 "./typica.w"
  824. class SaltModel:public QAbstractItemModel
  825. {
  826. Q_OBJECT
  827. QList<QList<QMap<int,QVariant> > > modelData;
  828. QStringList hData;
  829. int colcount;
  830. public:
  831. SaltModel(int columns);
  832. ~SaltModel();
  833. int rowCount(const QModelIndex&parent= QModelIndex())const;
  834. int columnCount(const QModelIndex&parent= QModelIndex())const;
  835. bool setHeaderData(int section,Qt::Orientation orientation,
  836. const QVariant&value,int role= Qt::DisplayRole);
  837. QVariant data(const QModelIndex&index,int role)const;
  838. bool setData(const QModelIndex&index,const QVariant&value,
  839. int role= Qt::EditRole);
  840. Qt::ItemFlags flags(const QModelIndex&index)const;
  841. QVariant headerData(int section,Qt::Orientation orientation,
  842. int role= Qt::DisplayRole)const;
  843. QModelIndex index(int row,int column,
  844. const QModelIndex&parent= QModelIndex())const;
  845. QModelIndex parent(const QModelIndex&index)const;
  846. QString arrayLiteral(int column,int role)const;
  847. QString quotedArrayLiteral(int column,int role)const;
  848. void clear();
  849. bool removeRows(int row,int count,
  850. const QModelIndex&parent= QModelIndex());
  851. int findData(const QVariant&value,int column,int role= Qt::UserRole);
  852. };
  853. /*:561*//*577:*/
  854. #line 12469 "./typica.w"
  855. class SqlComboBox:public QComboBox
  856. {
  857. Q_OBJECT
  858. int dataColumn;
  859. int displayColumn;
  860. bool dataColumnShown;
  861. QString specialNullText;
  862. QVariant specialNullData;
  863. public:
  864. SqlComboBox();
  865. ~SqlComboBox();
  866. SqlComboBox*clone(QWidget*parent);
  867. public slots:
  868. void addNullOption();
  869. void addSqlOptions(QString query);
  870. void setDataColumn(int column);
  871. void setDisplayColumn(int column);
  872. void showData(bool show);
  873. void setNullText(QString nullText);
  874. void setNullData(QVariant nullData);
  875. };
  876. /*:577*//*584:*/
  877. #line 12616 "./typica.w"
  878. class SqlComboBoxDelegate:public QItemDelegate
  879. {
  880. Q_OBJECT
  881. SqlComboBox*delegate;
  882. public:
  883. SqlComboBoxDelegate(QObject*parent= NULL);
  884. QWidget*createEditor(QWidget*parent,
  885. const QStyleOptionViewItem&option,
  886. const QModelIndex&index)const;
  887. void setEditorData(QWidget*editor,const QModelIndex&index)const;
  888. void setModelData(QWidget*editor,QAbstractItemModel*model,
  889. const QModelIndex&index)const;
  890. void setWidget(SqlComboBox*widget);
  891. virtual QSize sizeHint()const;
  892. void updateEditorGeometry(QWidget*editor,
  893. const QStyleOptionViewItem&option,
  894. const QModelIndex&index)const;
  895. };
  896. /*:584*//*599:*/
  897. #line 12827 "./typica.w"
  898. class SqlConnectionSetup:public QDialog
  899. {
  900. Q_OBJECT
  901. public:
  902. SqlConnectionSetup();
  903. ~SqlConnectionSetup();
  904. public slots:
  905. void testConnection();
  906. private:
  907. QFormLayout*formLayout;
  908. QComboBox*driver;
  909. QLineEdit*hostname;
  910. QLineEdit*dbname;
  911. QLineEdit*user;
  912. QLineEdit*password;
  913. QVBoxLayout*layout;
  914. QHBoxLayout*buttons;
  915. QPushButton*cancelButton;
  916. QPushButton*connectButton;
  917. };
  918. /*:599*//*604:*/
  919. #line 12962 "./typica.w"
  920. class SqlQueryView:public QTableView
  921. {
  922. Q_OBJECT
  923. public:
  924. SqlQueryView(QWidget*parent= NULL);
  925. void setQuery(const QString&query);
  926. bool setHeaderData(int section,Qt::Orientation orientation,
  927. const QVariant&value,int role);
  928. Q_INVOKABLE QVariant data(int row,int column,
  929. int role= Qt::DisplayRole);
  930. signals:
  931. void openEntry(QString key);
  932. void openEntryRow(int row);
  933. protected:
  934. virtual void showEvent(QShowEvent*event);
  935. private slots:
  936. void openRow(const QModelIndex&index);
  937. void persistColumnResize(int column,int oldsize,int newsize);
  938. };
  939. /*:604*//*619:*/
  940. #line 13217 "./typica.w"
  941. class ReportAction:public QAction
  942. {
  943. Q_OBJECT
  944. public:
  945. ReportAction(const QString&fileName,const QString&reportName,
  946. QObject*parent= NULL);
  947. private slots:
  948. void createReport();
  949. private:
  950. QString reportFile;
  951. };
  952. /*:619*//*631:*/
  953. #line 13426 "./typica.w"
  954. class ReportTable:public QObject
  955. {
  956. Q_OBJECT
  957. QTextFrame*area;
  958. QDomElement configuration;
  959. QMap<QString,QVariant> bindings;
  960. public:
  961. ReportTable(QTextFrame*frame,QDomElement description);
  962. ~ReportTable();
  963. Q_INVOKABLE void bind(QString placeholder,QVariant value);
  964. public slots:
  965. void refresh();
  966. };
  967. /*:631*//*664:*/
  968. #line 13665 "./typica.w"
  969. class FormArray:public QScrollArea
  970. {
  971. Q_OBJECT
  972. QDomElement configuration;
  973. QWidget itemContainer;
  974. QVBoxLayout itemLayout;
  975. int maxwidth;
  976. int maxheight;
  977. public:
  978. FormArray(QDomElement description);
  979. Q_INVOKABLE QWidget*elementAt(int index);
  980. Q_INVOKABLE int elements();
  981. public slots:
  982. void addElements(int copies= 1);
  983. void removeAllElements();
  984. void setMaximumElementWidth(int width);
  985. void setMaximumElementHeight(int height);
  986. };
  987. /*:664*//*674:*/
  988. #line 13881 "./typica.w"
  989. class ScaleControl:public QGraphicsView
  990. {
  991. Q_OBJECT
  992. Q_PROPERTY(double initialValue READ initialValue WRITE setInitialValue)
  993. Q_PROPERTY(double finalValue READ finalValue WRITE setFinalValue)
  994. /*675:*/
  995. #line 13907 "./typica.w"
  996. QGraphicsScene scene;
  997. QGraphicsPolygonItem initialDecrement;
  998. QGraphicsPolygonItem initialIncrement;
  999. QGraphicsPolygonItem finalDecrement;
  1000. QGraphicsPolygonItem finalIncrement;
  1001. QGraphicsPolygonItem initialIndicator;
  1002. QGraphicsPolygonItem finalIndicator;
  1003. QGraphicsPathItem scaleLine;
  1004. QPolygonF left;
  1005. QPolygonF right;
  1006. QPolygonF down;
  1007. QPolygonF up;
  1008. QPainterPath scalePath;
  1009. QBrush initialBrush;
  1010. QBrush finalBrush;
  1011. double nonScoredValue;
  1012. double scoredValue;
  1013. bool initialSet;
  1014. bool finalSet;
  1015. bool scaleDown;
  1016. /*:675*/
  1017. #line 13887 "./typica.w"
  1018. public:
  1019. ScaleControl();
  1020. double initialValue(void);
  1021. double finalValue(void);
  1022. virtual QSize sizeHint()const;
  1023. public slots:
  1024. void setInitialValue(double value);
  1025. void setFinalValue(double value);
  1026. signals:
  1027. void initialChanged(double);
  1028. void finalChanged(double);
  1029. protected:
  1030. virtual void mousePressEvent(QMouseEvent*event);
  1031. virtual void mouseReleaseEvent(QMouseEvent*event);
  1032. };
  1033. /*:674*//*686:*/
  1034. #line 14204 "./typica.w"
  1035. class IntensityControl:public QGraphicsView
  1036. {
  1037. Q_OBJECT
  1038. Q_PROPERTY(double value READ value WRITE setValue)
  1039. QGraphicsScene scene;
  1040. QGraphicsPolygonItem decrement;
  1041. QGraphicsPolygonItem increment;
  1042. QGraphicsPolygonItem indicator;
  1043. QGraphicsPathItem scaleLine;
  1044. QPolygonF left;
  1045. QPolygonF up;
  1046. QPolygonF down;
  1047. QPainterPath scalePath;
  1048. QBrush theBrush;
  1049. double theValue;
  1050. bool valueSet;
  1051. bool scaleDown;
  1052. public:
  1053. IntensityControl();
  1054. double value();
  1055. virtual QSize sizeHint()const;
  1056. public slots:
  1057. void setValue(double val);
  1058. signals:
  1059. void valueChanged(double);
  1060. protected:
  1061. virtual void mousePressEvent(QMouseEvent*event);
  1062. virtual void mouseReleaseEvent(QMouseEvent*event);
  1063. };
  1064. /*:686*//*702:*/
  1065. #line 14592 "./typica.w"
  1066. class DeviceTreeModelNode
  1067. {
  1068. public:
  1069. DeviceTreeModelNode(QDomNode&node,int row,
  1070. DeviceTreeModelNode*parent= NULL);
  1071. ~DeviceTreeModelNode();
  1072. DeviceTreeModelNode*child(int index);
  1073. DeviceTreeModelNode*parent();
  1074. QDomNode node()const;
  1075. int row();
  1076. private:
  1077. QDomNode domNode;
  1078. QHash<int,DeviceTreeModelNode*> children;
  1079. int rowNumber;
  1080. DeviceTreeModelNode*parentItem;
  1081. };
  1082. /*:702*//*704:*/
  1083. #line 14667 "./typica.w"
  1084. class DeviceTreeModel:public QAbstractItemModel
  1085. {
  1086. Q_OBJECT
  1087. public:
  1088. DeviceTreeModel(QObject*parent= NULL);
  1089. ~DeviceTreeModel();
  1090. QVariant data(const QModelIndex&index,int role)const;
  1091. Qt::ItemFlags flags(const QModelIndex&index)const;
  1092. QVariant headerData(int section,Qt::Orientation orientation,
  1093. int role= Qt::DisplayRole)const;
  1094. QModelIndex index(int row,int column,
  1095. const QModelIndex&parent= QModelIndex())const;
  1096. QModelIndex parent(const QModelIndex&child)const;
  1097. int rowCount(const QModelIndex&parent= QModelIndex())const;
  1098. int columnCount(const QModelIndex&parent= QModelIndex())const;
  1099. bool setData(const QModelIndex&index,const QVariant&value,
  1100. int role);
  1101. bool removeRows(int row,int count,const QModelIndex&parent);
  1102. QDomElement referenceElement(const QString&id);
  1103. public slots:
  1104. void newNode(const QString&name,const QString&driver,
  1105. const QModelIndex&parent);
  1106. private:
  1107. QDomDocument document;
  1108. DeviceTreeModelNode*root;
  1109. QDomNode referenceSection;
  1110. QDomNode treeRoot;
  1111. };
  1112. /*:704*//*723:*/
  1113. #line 15121 "./typica.w"
  1114. Q_DECLARE_METATYPE(QModelIndex)
  1115. /*:723*//*731:*/
  1116. #line 15228 "./typica.w"
  1117. class NodeInserter:public QAction
  1118. {
  1119. Q_OBJECT
  1120. public:
  1121. NodeInserter(const QString&title,const QString&name,
  1122. const QString&driver,QObject*parent= NULL);
  1123. signals:
  1124. void triggered(QString name,QString driver);
  1125. private slots:
  1126. void onTriggered();
  1127. private:
  1128. QString defaultNodeName;
  1129. QString driverString;
  1130. };
  1131. /*:731*//*734:*/
  1132. #line 15283 "./typica.w"
  1133. class DeviceConfigurationWindow:public QWidget
  1134. {
  1135. Q_OBJECT
  1136. public:
  1137. DeviceConfigurationWindow();
  1138. public slots:
  1139. void addDevice();
  1140. void removeNode();
  1141. void newSelection(const QModelIndex&index);
  1142. private slots:
  1143. void resizeColumn();
  1144. private:
  1145. QDomDocument document;
  1146. DeviceTreeModel*model;
  1147. QTreeView*view;
  1148. QScrollArea*configArea;
  1149. };
  1150. /*:734*//*743:*/
  1151. #line 15453 "./typica.w"
  1152. class BasicDeviceConfigurationWidget:public QWidget
  1153. {
  1154. Q_OBJECT
  1155. public:
  1156. BasicDeviceConfigurationWidget(DeviceTreeModel*model,
  1157. const QModelIndex&index);
  1158. public slots:
  1159. void insertChildNode(const QString&name,const QString&driver);
  1160. void updateAttribute(const QString&name,const QString&value);
  1161. protected:
  1162. DeviceTreeModel*deviceModel;
  1163. QModelIndex currentNode;
  1164. };
  1165. /*:743*//*747:*/
  1166. #line 15538 "./typica.w"
  1167. class RoasterConfWidget:public BasicDeviceConfigurationWidget
  1168. {
  1169. Q_OBJECT
  1170. public:
  1171. Q_INVOKABLE RoasterConfWidget(DeviceTreeModel*model,
  1172. const QModelIndex&index);
  1173. private slots:
  1174. void updateRoasterId(int id);
  1175. };
  1176. /*:747*//*752:*/
  1177. #line 15673 "./typica.w"
  1178. class NiDaqMxBaseDriverConfWidget:public BasicDeviceConfigurationWidget
  1179. {
  1180. Q_OBJECT
  1181. public:
  1182. Q_INVOKABLE NiDaqMxBaseDriverConfWidget(DeviceTreeModel*model,
  1183. const QModelIndex&index);
  1184. };
  1185. /*:752*//*754:*/
  1186. #line 15719 "./typica.w"
  1187. class NiDaqMxBase9211ConfWidget:public BasicDeviceConfigurationWidget
  1188. {
  1189. Q_OBJECT
  1190. public:
  1191. Q_INVOKABLE NiDaqMxBase9211ConfWidget(DeviceTreeModel*device,
  1192. const QModelIndex&index);
  1193. private slots:
  1194. void addChannel();
  1195. void updateDeviceId(const QString&newId);
  1196. };
  1197. /*:754*//*758:*/
  1198. #line 15805 "./typica.w"
  1199. class Ni9211TcConfWidget:public BasicDeviceConfigurationWidget
  1200. {
  1201. Q_OBJECT
  1202. public:
  1203. Q_INVOKABLE Ni9211TcConfWidget(DeviceTreeModel*device,
  1204. const QModelIndex&index);
  1205. private slots:
  1206. void updateThermocoupleType(const QString&type);
  1207. void updateColumnName(const QString&name);
  1208. void updateHidden(bool hidden);
  1209. };
  1210. /*:758*//*763:*/
  1211. #line 15921 "./typica.w"
  1212. class NiDaqMxDriverConfWidget:public BasicDeviceConfigurationWidget
  1213. {
  1214. Q_OBJECT
  1215. public:
  1216. Q_INVOKABLE NiDaqMxDriverConfWidget(DeviceTreeModel*model,
  1217. const QModelIndex&index);
  1218. };
  1219. /*:763*//*765:*/
  1220. #line 15962 "./typica.w"
  1221. class NiDaqMx9211ConfWidget:public BasicDeviceConfigurationWidget
  1222. {
  1223. Q_OBJECT
  1224. public:
  1225. Q_INVOKABLE NiDaqMx9211ConfWidget(DeviceTreeModel*model,
  1226. const QModelIndex&index);
  1227. private slots:
  1228. void addChannel();
  1229. void updateDeviceId(const QString&newId);
  1230. };
  1231. /*:765*//*767:*/
  1232. #line 16031 "./typica.w"
  1233. class NiDaqMxTc01ConfWidget:public BasicDeviceConfigurationWidget
  1234. {
  1235. Q_OBJECT
  1236. public:
  1237. Q_INVOKABLE NiDaqMxTc01ConfWidget(DeviceTreeModel*model,
  1238. const QModelIndex&index);
  1239. private slots:
  1240. void updateDeviceId(const QString&newId);
  1241. void updateThermocoupleType(const QString&type);
  1242. void updateColumnName(const QString&name);
  1243. void updateHidden(bool hidden);
  1244. };
  1245. /*:767*//*772:*/
  1246. #line 16162 "./typica.w"
  1247. class PortSelector:public QComboBox
  1248. {
  1249. Q_OBJECT
  1250. public:
  1251. PortSelector(QWidget*parent= NULL);
  1252. private slots:
  1253. void addDevice(QextPortInfo port);
  1254. private:
  1255. QextSerialEnumerator*lister;
  1256. };
  1257. /*:772*//*774:*/
  1258. #line 16210 "./typica.w"
  1259. class BaudSelector:public QComboBox
  1260. {
  1261. Q_OBJECT
  1262. Q_ENUMS(BaudRateType)
  1263. public:
  1264. BaudSelector(QWidget*parent= NULL);
  1265. enum BaudRateType
  1266. {
  1267. #if defined(Q_OS_UNIX) || defined(qdoc)
  1268. BAUD50= 50,
  1269. BAUD75= 75,
  1270. BAUD134= 134,
  1271. BAUD150= 150,
  1272. BAUD200= 200,
  1273. BAUD1800= 1800,
  1274. #if defined(B76800) || defined(qdoc)
  1275. BAUD76800= 76800,
  1276. #endif
  1277. #if (defined(B230400) && defined(B4000000)) || defined(qdoc)
  1278. BAUD230400= 230400,
  1279. BAUD460800= 460800,
  1280. BAUD500000= 500000,
  1281. BAUD576000= 576000,
  1282. BAUD921600= 921600,
  1283. BAUD1000000= 1000000,
  1284. BAUD1152000= 1152000,
  1285. BAUD1500000= 1500000,
  1286. BAUD2000000= 2000000,
  1287. BAUD2500000= 2500000,
  1288. BAUD3000000= 3000000,
  1289. BAUD3500000= 3500000,
  1290. BAUD4000000= 4000000,
  1291. #endif
  1292. #endif
  1293. #if defined(Q_OS_WIN) || defined(qdoc)
  1294. BAUD14400= 14400,
  1295. BAUD56000= 56000,
  1296. BAUD128000= 128000,
  1297. BAUD256000= 256000,
  1298. #endif
  1299. BAUD110= 110,
  1300. BAUD300= 300,
  1301. BAUD600= 600,
  1302. BAUD1200= 1200,
  1303. BAUD2400= 2400,
  1304. BAUD4800= 4800,
  1305. BAUD9600= 9600,
  1306. BAUD19200= 19200,
  1307. BAUD38400= 38400,
  1308. BAUD57600= 57600,
  1309. BAUD115200= 115200
  1310. };
  1311. };
  1312. /*:774*//*776:*/
  1313. #line 16281 "./typica.w"
  1314. class ParitySelector:public QComboBox
  1315. {
  1316. Q_OBJECT
  1317. Q_ENUMS(ParityType)
  1318. public:
  1319. ParitySelector(QWidget*parent= NULL);
  1320. enum ParityType
  1321. {
  1322. PAR_NONE,
  1323. PAR_ODD,
  1324. PAR_EVEN,
  1325. #if defined(Q_OS_WIN) || defined(qdoc)
  1326. PAR_MARK,
  1327. #endif
  1328. PAR_SPACE
  1329. };
  1330. };
  1331. /*:776*//*778:*/
  1332. #line 16319 "./typica.w"
  1333. class FlowSelector:public QComboBox
  1334. {
  1335. Q_OBJECT
  1336. Q_ENUMS(FlowType)
  1337. public:
  1338. FlowSelector(QWidget*parent= NULL);
  1339. enum FlowType
  1340. {
  1341. FLOW_OFF,
  1342. FLOW_HARDWARE,
  1343. FLOW_XONXOFF
  1344. };
  1345. };
  1346. /*:778*//*780:*/
  1347. #line 16352 "./typica.w"
  1348. class StopSelector:public QComboBox
  1349. {
  1350. Q_OBJECT
  1351. Q_ENUMS(StopBitsType)
  1352. public:
  1353. StopSelector(QWidget*parent= NULL);
  1354. enum StopBitsType
  1355. {
  1356. STOP_1,
  1357. #if defined(Q_OS_WIN) || defined(qdoc)
  1358. STOP_1_5,
  1359. #endif
  1360. STOP_2
  1361. };
  1362. };
  1363. /*:780*//*783:*/
  1364. #line 16405 "./typica.w"
  1365. class ShortHexSpinBox:public QSpinBox
  1366. {
  1367. Q_OBJECT
  1368. public:
  1369. ShortHexSpinBox(QWidget*parent= NULL);
  1370. virtual QValidator::State validate(QString&input,int&pos)const;
  1371. protected:
  1372. virtual int valueFromText(const QString&text)const;
  1373. virtual QString textFromValue(int value)const;
  1374. };
  1375. /*:783*//*785:*/
  1376. #line 16467 "./typica.w"
  1377. class ModbusRtuPortConfWidget:public BasicDeviceConfigurationWidget
  1378. {
  1379. Q_OBJECT
  1380. public:
  1381. Q_INVOKABLE ModbusRtuPortConfWidget(DeviceTreeModel*model,
  1382. const QModelIndex&index);
  1383. private slots:
  1384. void updatePort(const QString&newPort);
  1385. void updateBaudRate(const QString&newRate);
  1386. void updateParity(const QString&newParity);
  1387. void updateFlowControl(const QString&newFlow);
  1388. void updateStopBits(const QString&newStopBits);
  1389. };
  1390. /*:785*//*787:*/
  1391. #line 16618 "./typica.w"
  1392. class ModbusRtuDeviceConfWidget:public BasicDeviceConfigurationWidget
  1393. {
  1394. Q_OBJECT
  1395. public:
  1396. Q_INVOKABLE ModbusRtuDeviceConfWidget(DeviceTreeModel*model,
  1397. const QModelIndex&index);
  1398. private slots:
  1399. void updateStationNumber(int newStation);
  1400. void updateFixedUnit(bool newFixed);
  1401. void updateFixedDecimal(bool newFixed);
  1402. void updateUnit(const QString&newUnit);
  1403. void updateUnitAddress(int newAddress);
  1404. void updateValueF(int newValue);
  1405. void updateValueC(int newValue);
  1406. void updatePrecisionAddress(int newAddress);
  1407. void updatePrecisionValue(int newValue);
  1408. private:
  1409. QStackedLayout*unitSpecificationLayout;
  1410. QStackedLayout*decimalSpecificationLayout;
  1411. };
  1412. /*:787*//*789:*/
  1413. #line 16877 "./typica.w"
  1414. class ModbusRtuDeviceTPvConfWidget:public BasicDeviceConfigurationWidget
  1415. {
  1416. Q_OBJECT
  1417. public:
  1418. Q_INVOKABLE ModbusRtuDeviceTPvConfWidget(DeviceTreeModel*model,
  1419. const QModelIndex&index);
  1420. private slots:
  1421. void updateAddress(int newAddress);
  1422. };
  1423. /*:789*//*791:*/
  1424. #line 16923 "./typica.w"
  1425. class ModbusRtuDeviceTSvConfWidget:public BasicDeviceConfigurationWidget
  1426. {
  1427. Q_OBJECT
  1428. public:
  1429. Q_INVOKABLE ModbusRtuDeviceTSvConfWidget(DeviceTreeModel*model,
  1430. const QModelIndex&index);
  1431. private slots:
  1432. void updateReadAddress(int newAddress);
  1433. void updateWriteAddress(int newAddress);
  1434. void updateFixedRange(bool fixed);
  1435. void updateLower(const QString&lower);
  1436. void updateUpper(const QString&upper);
  1437. void updateLowerAddress(int newAddress);
  1438. void updateUpperAddress(int newAddress);
  1439. private:
  1440. QStackedLayout*boundsLayout;
  1441. };
  1442. /*:791*//*795:*/
  1443. #line 17117 "./typica.w"
  1444. class AnnotationButtonConfWidget:public BasicDeviceConfigurationWidget
  1445. {
  1446. Q_OBJECT
  1447. public:
  1448. Q_INVOKABLE AnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1449. private slots:
  1450. void updateButtonText(const QString&text);
  1451. void updateAnnotationText(const QString&text);
  1452. };
  1453. /*:795*//*799:*/
  1454. #line 17185 "./typica.w"
  1455. class ReconfigurableAnnotationButtonConfWidget:public BasicDeviceConfigurationWidget
  1456. {
  1457. Q_OBJECT
  1458. public:
  1459. Q_INVOKABLE ReconfigurableAnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1460. private slots:
  1461. void updateButtonText(const QString&text);
  1462. void updateAnnotationText(const QString&text);
  1463. };
  1464. /*:799*//*802:*/
  1465. #line 17259 "./typica.w"
  1466. class NoteSpinConfWidget:public BasicDeviceConfigurationWidget
  1467. {
  1468. Q_OBJECT
  1469. public:
  1470. Q_INVOKABLE NoteSpinConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1471. private slots:
  1472. void updateLabel(const QString&text);
  1473. void updateMinimum(const QString&minimum);
  1474. void updateMaximum(const QString&maximum);
  1475. void updatePrecision(int precision);
  1476. void updatePretext(const QString&text);
  1477. void updatePosttext(const QString&text);
  1478. };
  1479. /*:802*//*805:*/
  1480. #line 12 "./freeannotation.w"
  1481. class FreeAnnotationConfWidget:public BasicDeviceConfigurationWidget
  1482. {
  1483. Q_OBJECT
  1484. public:
  1485. Q_INVOKABLE FreeAnnotationConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1486. private slots:
  1487. void updateLabel(const QString&text);
  1488. };
  1489. /*:805*//*809:*/
  1490. #line 11 "./settings.w"
  1491. class SettingsWindow:public QMainWindow
  1492. {
  1493. Q_OBJECT
  1494. public:
  1495. SettingsWindow();
  1496. };
  1497. /*:809*//*814:*/
  1498. #line 8 "./graphsettings.w"
  1499. class GraphSettingsWidget:public QWidget
  1500. {
  1501. Q_OBJECT
  1502. public:
  1503. GraphSettingsWidget();
  1504. };
  1505. /*:814*//*816:*/
  1506. #line 46 "./graphsettings.w"
  1507. class GraphSettingsRelativeTab:public QWidget
  1508. {
  1509. Q_OBJECT
  1510. public:
  1511. GraphSettingsRelativeTab();
  1512. public slots:
  1513. void updateEnableSetting(bool enable);
  1514. void updateColorSetting(const QString&color);
  1515. void updateAxisSetting(const QString&gridList);
  1516. void updateUnit(int unit);
  1517. void showColorPicker();
  1518. private:
  1519. QLineEdit*colorEdit;
  1520. };
  1521. /*:816*//*820:*/
  1522. #line 17384 "./typica.w"
  1523. class ModbusRTUDevice:public QObject
  1524. {
  1525. Q_OBJECT
  1526. public:
  1527. ModbusRTUDevice(DeviceTreeModel*model,const QModelIndex&index);
  1528. ~ModbusRTUDevice();
  1529. void queueMessage(QByteArray request,QObject*object,const char*callback);
  1530. Q_INVOKABLE double SVLower();
  1531. Q_INVOKABLE double SVUpper();
  1532. Q_INVOKABLE int decimals();
  1533. QList<Channel*> channels;
  1534. public slots:
  1535. void outputSV(double sv);
  1536. signals:
  1537. void SVLowerChanged(double);
  1538. void SVUpperChanged(double);
  1539. void SVDecimalChanged(int);
  1540. void queueEmpty();
  1541. private slots:
  1542. void dataAvailable();
  1543. void sendNextMessage();
  1544. void decimalResponse(QByteArray response);
  1545. void unitResponse(QByteArray response);
  1546. void svlResponse(QByteArray response);
  1547. void svuResponse(QByteArray response);
  1548. void requestMeasurement();
  1549. void mResponse(QByteArray response);
  1550. void ignore(QByteArray response);
  1551. private:
  1552. QextSerialPort*port;
  1553. QByteArray responseBuffer;
  1554. QList<QByteArray> messageQueue;
  1555. QList<QObject*> retObjQueue;
  1556. QList<char*> callbackQueue;
  1557. quint16 calculateCRC(QByteArray data);
  1558. QTimer*messageDelayTimer;
  1559. int delayTime;
  1560. char station;
  1561. int decimalPosition;
  1562. int valueF;
  1563. int valueC;
  1564. bool unitIsF;
  1565. double outputSVLower;
  1566. double outputSVUpper;
  1567. QByteArray outputSVStub;
  1568. QByteArray pvStub;
  1569. QByteArray svStub;
  1570. QByteArray mStub;
  1571. quint16 pvaddress;
  1572. quint16 svaddress;
  1573. bool svenabled;
  1574. bool readingsv;
  1575. double savedpv;
  1576. bool waiting;
  1577. };
  1578. /*:820*//*835:*/
  1579. #line 18056 "./typica.w"
  1580. class ModbusConfigurator:public BasicDeviceConfigurationWidget
  1581. {
  1582. Q_OBJECT
  1583. public:
  1584. Q_INVOKABLE ModbusConfigurator(DeviceTreeModel*model,const QModelIndex&index);
  1585. private slots:
  1586. void updatePort(const QString&newPort);
  1587. void updateBaudRate(const QString&newRate);
  1588. void updateParity(const QString&newParity);
  1589. void updateFlowControl(const QString&newFlow);
  1590. void updateStopBits(const QString&newStopBits);
  1591. void updateStation(int station);
  1592. void updateFixedDecimal(bool fixed);
  1593. void updateDecimalAddress(int address);
  1594. void updateDecimalPosition(int position);
  1595. void updateFixedUnit(bool fixed);
  1596. void updateUnitAddress(int address);
  1597. void updateValueForF(int value);
  1598. void updateValueForC(int value);
  1599. void updateUnit(const QString&newUnit);
  1600. void updatePVAddress(int address);
  1601. void updateSVEnabled(bool enabled);
  1602. void updateSVReadAddress(int address);
  1603. void updateDeviceLimit(bool query);
  1604. void updateSVLowerAddress(int address);
  1605. void updateSVUpperAddress(int address);
  1606. void updateSVLower(double value);
  1607. void updateSVUpper(double value);
  1608. void updateSVWritable(bool canWriteSV);
  1609. void updateSVWriteAddress(int address);
  1610. void updatePVColumnName(const QString&name);
  1611. void updateSVColumnName(const QString&name);
  1612. void updatePVHidden(bool hidden);
  1613. void updateSVHidden(bool hidden);
  1614. private:
  1615. PortSelector*port;
  1616. BaudSelector*baud;
  1617. ParitySelector*parity;
  1618. FlowSelector*flow;
  1619. StopSelector*stop;
  1620. QSpinBox*station;
  1621. QCheckBox*decimalQuery;
  1622. ShortHexSpinBox*decimalAddress;
  1623. QSpinBox*decimalPosition;
  1624. QCheckBox*unitQuery;
  1625. ShortHexSpinBox*unitAddress;
  1626. QSpinBox*valueF;
  1627. QSpinBox*valueC;
  1628. QComboBox*fixedUnit;
  1629. ShortHexSpinBox*pVAddress;
  1630. QCheckBox*sVEnabled;
  1631. ShortHexSpinBox*sVReadAddress;
  1632. QCheckBox*deviceLimit;
  1633. ShortHexSpinBox*sVLowerAddr;
  1634. ShortHexSpinBox*sVUpperAddr;
  1635. QDoubleSpinBox*sVLower;
  1636. QDoubleSpinBox*sVUpper;
  1637. QCheckBox*sVWritable;
  1638. ShortHexSpinBox*sVOutputAddr;
  1639. QLineEdit*pVColumnName;
  1640. QLineEdit*sVColumnName;
  1641. };
  1642. /*:835*//*839:*/
  1643. #line 36 "./unsupportedserial.w"
  1644. class UnsupportedSerialDeviceConfWidget:public BasicDeviceConfigurationWidget
  1645. {
  1646. Q_OBJECT
  1647. public:
  1648. Q_INVOKABLE UnsupportedSerialDeviceConfWidget(DeviceTreeModel*model,
  1649. const QModelIndex&index);
  1650. private slots:
  1651. void updateConfiguration();
  1652. void saveScript();
  1653. void addChannel();
  1654. private:
  1655. SaltModel*deviceSettingsModel;
  1656. QTextEdit*scriptEditor;
  1657. };
  1658. /*:839*//*844:*/
  1659. #line 166 "./unsupportedserial.w"
  1660. class UnsupportedDeviceChannelConfWidget:public BasicDeviceConfigurationWidget
  1661. {
  1662. Q_OBJECT
  1663. public:
  1664. Q_INVOKABLE UnsupportedDeviceChannelConfWidget(DeviceTreeModel*model,
  1665. const QModelIndex&index);
  1666. private slots:
  1667. void updateColumnName(const QString&value);
  1668. void updateHidden(bool hidden);
  1669. void updateConfiguration();
  1670. private:
  1671. SaltModel*channelSettingsModel;
  1672. };
  1673. /*:844*//*849:*/
  1674. #line 298 "./unsupportedserial.w"
  1675. class JavaScriptDevice:public QObject
  1676. {
  1677. Q_OBJECT
  1678. public:
  1679. Q_INVOKABLE JavaScriptDevice(const QModelIndex&deviceIndex,
  1680. QScriptEngine*engine);
  1681. Q_INVOKABLE int channelCount();
  1682. Channel*getChannel(int channel);
  1683. Q_INVOKABLE bool isChannelHidden(int channel);
  1684. Q_INVOKABLE Units::Unit expectedChannelUnit(int channel);
  1685. Q_INVOKABLE QString channelColumnName(int channel);
  1686. Q_INVOKABLE QString channelIndicatorText(int channel);
  1687. public slots:
  1688. void setTemperatureColumn(int tcol);
  1689. void setAnnotationColumn(int ncol);
  1690. void start();
  1691. void stop();
  1692. signals:
  1693. void annotation(QString note,int tcol,int ncol);
  1694. void triggerStartBatch();
  1695. void triggerStopBatch();
  1696. void deviceStopRequested();
  1697. private:
  1698. QVariantMap deviceSettings;
  1699. QString deviceScript;
  1700. QList<Channel*> channelList;
  1701. QList<bool> hiddenState;
  1702. QList<Units::Unit> channelUnits;
  1703. QList<QString> columnNames;
  1704. QList<QString> indicatorTexts;
  1705. QList<QVariantMap> channelSettings;
  1706. int annotationTemperatureColumn;
  1707. int annotationNoteColumn;
  1708. QScriptEngine*scriptengine;
  1709. };
  1710. /*:849*//*871:*/
  1711. #line 18592 "./typica.w"
  1712. class LinearSplineInterpolationConfWidget:public BasicDeviceConfigurationWidget
  1713. {
  1714. Q_OBJECT
  1715. public:
  1716. Q_INVOKABLE LinearSplineInterpolationConfWidget(DeviceTreeModel*model,
  1717. const QModelIndex&index);
  1718. private slots:
  1719. void updateSourceColumn(const QString&source);
  1720. void updateDestinationColumn(const QString&dest);
  1721. void updateKnots();
  1722. private:
  1723. SaltModel*tablemodel;
  1724. };
  1725. /*:871*//*877:*/
  1726. #line 18716 "./typica.w"
  1727. class TranslationConfWidget:public BasicDeviceConfigurationWidget
  1728. {
  1729. Q_OBJECT
  1730. public:
  1731. Q_INVOKABLE TranslationConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1732. private slots:
  1733. void updateMatchingColumn(const QString&column);
  1734. void updateTemperature();
  1735. private:
  1736. QDoubleSpinBox*temperatureValue;
  1737. QComboBox*unitSelector;
  1738. };
  1739. /*:877*//*881:*/
  1740. #line 16 "./rate.w"
  1741. class RateOfChange:public QObject
  1742. {
  1743. Q_OBJECT
  1744. public:
  1745. RateOfChange(int cachetime= 1,int scaletime= 1);
  1746. public slots:
  1747. void newMeasurement(Measurement measure);
  1748. void setCacheTime(int seconds);
  1749. void setScaleTime(int seconds);
  1750. signals:
  1751. void newData(Measurement measure);
  1752. private:
  1753. int ct;
  1754. int st;
  1755. QList<Measurement> cache;
  1756. };
  1757. /*:881*//*889:*/
  1758. #line 177 "./rate.w"
  1759. class RateOfChangeConfWidget:public BasicDeviceConfigurationWidget
  1760. {
  1761. Q_OBJECT
  1762. public:
  1763. Q_INVOKABLE RateOfChangeConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1764. private slots:
  1765. void updateColumn(const QString&column);
  1766. void updateCacheTime(const QString&seconds);
  1767. void updateScaleTime(const QString&seconds);
  1768. };
  1769. /*:889*//*895:*/
  1770. #line 19 "./dataqsdk.w"
  1771. class DataqSdkDeviceImplementation;
  1772. class DataqSdkDevice:public QObject
  1773. {
  1774. Q_OBJECT
  1775. DataqSdkDeviceImplementation*imp;
  1776. private slots:
  1777. void threadFinished();
  1778. public:
  1779. DataqSdkDevice(QString device);
  1780. ~DataqSdkDevice();
  1781. Channel*newChannel(Units::Unit scale);
  1782. Q_INVOKABLE void setClockRate(double Hz);
  1783. Q_INVOKABLE void start();
  1784. static QStringList detectPorts();
  1785. static QStringList detectHardware();
  1786. };
  1787. /*:895*//*896:*/
  1788. #line 49 "./dataqsdk.w"
  1789. class DataqSdkDeviceImplementation:public QThread
  1790. {
  1791. Q_OBJECT
  1792. public:
  1793. DataqSdkDeviceImplementation();
  1794. ~DataqSdkDeviceImplementation();
  1795. void run();
  1796. /*897:*/
  1797. #line 70 "./dataqsdk.w"
  1798. typedef struct di_inlist_struct{
  1799. unsigned short chan;
  1800. unsigned short diff;
  1801. unsigned short gain;
  1802. unsigned short unipolar;
  1803. unsigned short dig_out_enable;
  1804. unsigned short dig_out;
  1805. unsigned short ave;
  1806. unsigned short counter;
  1807. }DI_INLIST_STRUCT;
  1808. typedef int(PASCAL*FPDIOPEN)(unsigned);
  1809. typedef int(PASCAL*FPDICLOSE)(void);
  1810. typedef double(PASCAL*FPDISAMPLERATE)(double,long*,long*);
  1811. typedef double(PASCAL*FPDIMAXIMUMRATE)(double);
  1812. typedef int(PASCAL*FPDILISTLENGTH)(unsigned,unsigned);
  1813. typedef int(PASCAL*FPDIINLIST)(di_inlist_struct*);
  1814. typedef int*(PASCAL*FPDIBUFFERALLOC)(unsigned,unsigned);
  1815. typedef int(PASCAL*FPDISTARTSCAN)(void);
  1816. typedef unsigned(PASCAL*FPDISTATUSREAD)(short*,unsigned);
  1817. typedef unsigned(PASCAL*FPDIBUFFERSTATUS)(unsigned);
  1818. typedef int(PASCAL*FPDIBURSTRATE)(unsigned);
  1819. typedef int(PASCAL*FPDISTOPSCAN)(void);
  1820. FPDIOPEN di_open;
  1821. FPDICLOSE di_close;
  1822. FPDISAMPLERATE di_sample_rate;
  1823. FPDIMAXIMUMRATE di_maximum_rate;
  1824. FPDILISTLENGTH di_list_length;
  1825. FPDIINLIST di_inlist;
  1826. FPDIBUFFERALLOC di_buffer_alloc;
  1827. FPDISTARTSCAN di_start_scan;
  1828. FPDISTATUSREAD di_status_read;
  1829. FPDIBUFFERSTATUS di_buffer_status;
  1830. FPDIBURSTRATE di_burst_rate;
  1831. FPDISTOPSCAN di_stop_scan;
  1832. /*:897*/
  1833. #line 57 "./dataqsdk.w"
  1834. /*899:*/
  1835. #line 134 "./dataqsdk.w"
  1836. bool isOpen;
  1837. double sampleRate;
  1838. long oversample;
  1839. long burstDivisor;
  1840. QString device;
  1841. unsigned deviceNumber;
  1842. QVector<Channel*> channelMap;
  1843. int error;
  1844. int channels;
  1845. bool ready;
  1846. QLibrary*driver;
  1847. QVector<Units::Unit> unitMap;
  1848. int*input_buffer;
  1849. QTimer*eventClock;
  1850. QMultiMap<int,double> smoother;
  1851. /*:899*/
  1852. #line 58 "./dataqsdk.w"
  1853. public slots:
  1854. void measure();
  1855. private:
  1856. qint16*buffer;
  1857. };
  1858. /*:896*//*916:*/
  1859. #line 663 "./dataqsdk.w"
  1860. class DataqSdkDeviceConfWidget:public BasicDeviceConfigurationWidget
  1861. {
  1862. Q_OBJECT
  1863. public:
  1864. Q_INVOKABLE DataqSdkDeviceConfWidget(DeviceTreeModel*model,
  1865. const QModelIndex&index);
  1866. private slots:
  1867. void updateAutoSelect(bool automatic);
  1868. void updateDeviceNumber(int deviceNumber);
  1869. void updatePort(QString portId);
  1870. void addChannel();
  1871. private:
  1872. QStackedWidget*deviceIdStack;
  1873. };
  1874. /*:916*//*921:*/
  1875. #line 808 "./dataqsdk.w"
  1876. class DataqSdkChannelConfWidget:public BasicDeviceConfigurationWidget
  1877. {
  1878. Q_OBJECT
  1879. public:
  1880. Q_INVOKABLE DataqSdkChannelConfWidget(DeviceTreeModel*model,
  1881. const QModelIndex&index);
  1882. private slots:
  1883. void updateUnits(const QString&unit);
  1884. void updateColumnName(const QString&value);
  1885. void updateMeasuredLower(const QString&value);
  1886. void updateMeasuredUpper(const QString&value);
  1887. void updateMappedLower(const QString&value);
  1888. void updateMappedUpper(const QString&value);
  1889. void updateClosedInterval(bool closed);
  1890. void updateSmoothingEnabled(bool enabled);
  1891. void updateSensitivity(const QString&value);
  1892. void startCalibration();
  1893. void stopCalibration();
  1894. void resetCalibration();
  1895. void updateInput(Measurement measure);
  1896. void updateOutput(Measurement measure);
  1897. void updateHidden(bool hidden);
  1898. private:
  1899. QPushButton*startButton;
  1900. QPushButton*resetButton;
  1901. QPushButton*stopButton;
  1902. /*926:*/
  1903. #line 1098 "./dataqsdk.w"
  1904. bool autoSelect;
  1905. QString deviceID;
  1906. unsigned int channelOfInterest;
  1907. /*:926*/
  1908. #line 835 "./dataqsdk.w"
  1909. DataqSdkDevice*calibrationDevice;
  1910. LinearCalibrator*calibrator;
  1911. QLineEdit*currentMeasurement;
  1912. QLineEdit*minimumMeasurement;
  1913. QLineEdit*maximumMeasurement;
  1914. QLineEdit*averageMeasurement;
  1915. QLineEdit*currentMapped;
  1916. QLineEdit*minimumMapped;
  1917. QLineEdit*maximumMapped;
  1918. QLineEdit*averageMapped;
  1919. int rmCount;
  1920. int cmCount;
  1921. double rmin;
  1922. double rmax;
  1923. double rmean;
  1924. double cmin;
  1925. double cmax;
  1926. double cmean;
  1927. };
  1928. /*:921*//*948:*/
  1929. #line 247 "./scales.w"
  1930. Q_DECLARE_METATYPE(BaudRateType)
  1931. Q_DECLARE_METATYPE(DataBitsType)
  1932. Q_DECLARE_METATYPE(ParityType)
  1933. Q_DECLARE_METATYPE(StopBitsType)
  1934. Q_DECLARE_METATYPE(FlowType)
  1935. /*:948*//*955:*/
  1936. #line 370 "./scales.w"
  1937. class SerialScaleConfWidget:public BasicDeviceConfigurationWidget
  1938. {
  1939. Q_OBJECT
  1940. public:
  1941. Q_INVOKABLE SerialScaleConfWidget(DeviceTreeModel*model,
  1942. const QModelIndex&index);
  1943. private slots:
  1944. void updatePort(const QString&newPort);
  1945. void updateBaudRate(const QString&rate);
  1946. void updateParity(int index);
  1947. void updateFlowControl(int index);
  1948. void updateStopBits(int index);
  1949. private:
  1950. PortSelector*port;
  1951. BaudSelector*baud;
  1952. ParitySelector*parity;
  1953. FlowSelector*flow;
  1954. StopSelector*stop;
  1955. };
  1956. /*:955*//*960:*/
  1957. #line 14 "./valueannotation.w"
  1958. class ValueAnnotationConfWidget:public BasicDeviceConfigurationWidget
  1959. {
  1960. Q_OBJECT
  1961. public:
  1962. Q_INVOKABLE ValueAnnotationConfWidget(DeviceTreeModel*model,
  1963. const QModelIndex&index);
  1964. private slots:
  1965. void updateSourceColumn(const QString&source);
  1966. void updateAnnotations();
  1967. void updateStart(bool noteOnStart);
  1968. private:
  1969. SaltModel*tablemodel;
  1970. };
  1971. /*:960*//*968:*/
  1972. #line 165 "./valueannotation.w"
  1973. class ValueAnnotation:public QObject
  1974. {
  1975. Q_OBJECT
  1976. public:
  1977. ValueAnnotation();
  1978. Q_INVOKABLE void setAnnotation(double value,const QString&annotation);
  1979. public slots:
  1980. void newMeasurement(Measurement measure);
  1981. void annotate();
  1982. void setAnnotationColumn(int column);
  1983. void setTemperatureColumn(int column);
  1984. void setTolerance(double epsilon);
  1985. signals:
  1986. void annotation(QString annotation,int tempcolumn,int notecolumn);
  1987. private:
  1988. int lastIndex;
  1989. int annotationColumn;
  1990. int measurementColumn;
  1991. QList<double> values;
  1992. QStringList annotations;
  1993. double tolerance;
  1994. };
  1995. /*:968*/
  1996. #line 526 "./typica.w"
  1997. /*12:*/
  1998. #line 807 "./typica.w"
  1999. void setQObjectProperties(QScriptValue value,QScriptEngine*engine);
  2000. /*:12*//*14:*/
  2001. #line 822 "./typica.w"
  2002. void setQPaintDeviceProperties(QScriptValue value,QScriptEngine*engine);
  2003. void setQLayoutItemProperties(QScriptValue value,QScriptEngine*engine);
  2004. /*:14*//*16:*/
  2005. #line 847 "./typica.w"
  2006. void setQWidgetProperties(QScriptValue value,QScriptEngine*engine);
  2007. QScriptValue constructQWidget(QScriptContext*context,QScriptEngine*engine);
  2008. QScriptValue QWidget_setLayout(QScriptContext*context,QScriptEngine*engine);
  2009. QScriptValue QWidget_activateWindow(QScriptContext*context,
  2010. QScriptEngine*engine);
  2011. /*:16*//*27:*/
  2012. #line 1091 "./typica.w"
  2013. QScriptValue constructQMainWindow(QScriptContext*context,
  2014. QScriptEngine*engine);
  2015. QScriptValue QMainWindow_setCentralWidget(QScriptContext*context,
  2016. QScriptEngine*engine);
  2017. QScriptValue QMainWindow_menuBar(QScriptContext*context,
  2018. QScriptEngine*engine);
  2019. void setQMainWindowProperties(QScriptValue value,QScriptEngine*engine);
  2020. /*:27*//*32:*/
  2021. #line 1190 "./typica.w"
  2022. void setQMenuBarProperties(QScriptValue value,QScriptEngine*engine);
  2023. QScriptValue QMenuBar_addMenu(QScriptContext*context,QScriptEngine*engine);
  2024. /*:32*//*35:*/
  2025. #line 1235 "./typica.w"
  2026. void setQMenuProperties(QScriptValue value,QScriptEngine*engine);
  2027. QScriptValue QMenu_addAction(QScriptContext*context,QScriptEngine*engine);
  2028. QScriptValue QMenu_addSeparator(QScriptContext*context,QScriptEngine*engine);
  2029. /*:35*//*38:*/
  2030. #line 1301 "./typica.w"
  2031. void setQFrameProperties(QScriptValue value,QScriptEngine*engine);
  2032. QScriptValue constructQFrame(QScriptContext*context,QScriptEngine*engine);
  2033. /*:38*//*41:*/
  2034. #line 1334 "./typica.w"
  2035. void setQLabelProperties(QScriptValue value,QScriptEngine*engine);
  2036. QScriptValue constructQLabel(QScriptContext*context,QScriptEngine*engine);
  2037. /*:41*//*44:*/
  2038. #line 1372 "./typica.w"
  2039. void setQLineEditProperties(QScriptValue value,QScriptEngine*engine);
  2040. QScriptValue constructQLineEdit(QScriptContext*context,QScriptEngine*engine);
  2041. /*:44*//*48:*/
  2042. #line 1411 "./typica.w"
  2043. QScriptValue constructQSplitter(QScriptContext*context,QScriptEngine*engine);
  2044. QScriptValue QSplitter_addWidget(QScriptContext*context,
  2045. QScriptEngine*engine);
  2046. QScriptValue QSplitter_saveState(QScriptContext*context,
  2047. QScriptEngine*engine);
  2048. QScriptValue QSplitter_restoreState(QScriptContext*context,
  2049. QScriptEngine*engine);
  2050. QScriptValue QSplitter_count(QScriptContext*context,
  2051. QScriptEngine*engine);
  2052. void setQSplitterProperties(QScriptValue value,QScriptEngine*engine);
  2053. /*:48*//*54:*/
  2054. #line 1550 "./typica.w"
  2055. void setQLayoutProperties(QScriptValue value,QScriptEngine*engine);
  2056. QScriptValue QLayout_addWidget(QScriptContext*context,QScriptEngine*engine);
  2057. /*:54*//*56:*/
  2058. #line 1605 "./typica.w"
  2059. QScriptValue constructQBoxLayout(QScriptContext*context,
  2060. QScriptEngine*engine);
  2061. void setQBoxLayoutProperties(QScriptValue value,QScriptEngine*engine);
  2062. QScriptValue QBoxLayout_addLayout(QScriptContext*context,QScriptEngine*engine);
  2063. QScriptValue QBoxLayout_addWidget(QScriptContext*context,QScriptEngine*engine);
  2064. /*:56*//*60:*/
  2065. #line 1718 "./typica.w"
  2066. QScriptValue constructQAction(QScriptContext*context,QScriptEngine*engine);
  2067. QScriptValue QAction_setShortcut(QScriptContext*context,
  2068. QScriptEngine*engine);
  2069. void setQActionProperties(QScriptValue value,QScriptEngine*engine);
  2070. /*:60*//*63:*/
  2071. #line 1774 "./typica.w"
  2072. QScriptValue QFileDialog_getOpenFileName(QScriptContext*context,
  2073. QScriptEngine*engine);
  2074. QScriptValue QFileDialog_getSaveFileName(QScriptContext*context,
  2075. QScriptEngine*engine);
  2076. void setQFileDialogProperties(QScriptValue value,QScriptEngine*engine);
  2077. void setQDialogProperties(QScriptValue value,QScriptEngine*engine);
  2078. /*:63*//*68:*/
  2079. #line 1885 "./typica.w"
  2080. QScriptValue constructQFile(QScriptContext*context,QScriptEngine*engine);
  2081. void setQFileProperties(QScriptValue value,QScriptEngine*engine);
  2082. QScriptValue QFile_remove(QScriptContext*context,QScriptEngine*engine);
  2083. void setQIODeviceProperties(QScriptValue value,QScriptEngine*engine);
  2084. QScriptValue QIODevice_open(QScriptContext*context,QScriptEngine*engine);
  2085. QScriptValue QIODevice_close(QScriptContext*context,QScriptEngine*engine);
  2086. QScriptValue QIODevice_readToString(QScriptContext*context,
  2087. QScriptEngine*engine);
  2088. QScriptValue QIODevice_putChar(QScriptContext*context,QScriptEngine*engine);
  2089. QScriptValue QIODevice_writeString(QScriptContext*context,QScriptEngine*engine);
  2090. QScriptValue QIODevice_writeBytes(QScriptContext*context,QScriptEngine*engine);
  2091. /*:68*//*77:*/
  2092. #line 2072 "./typica.w"
  2093. QScriptValue constructQProcess(QScriptContext*context,QScriptEngine*engine);
  2094. void setQProcessProperties(QScriptValue value,QScriptEngine*engine);
  2095. QScriptValue QProcess_execute(QScriptContext*context,QScriptEngine*engine);
  2096. QScriptValue QProcess_startDetached(QScriptContext*context,QScriptEngine*engine);
  2097. QScriptValue QProcess_setWorkingDirectory(QScriptContext*context,QScriptEngine*engine);
  2098. QScriptValue QProcess_start(QScriptContext*context,QScriptEngine*engine);
  2099. /*:77*//*85:*/
  2100. #line 2190 "./typica.w"
  2101. QScriptValue QByteArray_toScriptValue(QScriptEngine*engine,const QByteArray&bytes);
  2102. void QByteArray_fromScriptValue(const QScriptValue&value,QByteArray&bytes);
  2103. QScriptValue constructQByteArray(QScriptContext*context,QScriptEngine*engine);
  2104. void setQByteArrayProperties(QScriptValue value,QScriptEngine*engine);
  2105. QScriptValue QByteArray_fromHex(QScriptContext*context,QScriptEngine*engine);
  2106. /*:85*//*91:*/
  2107. #line 2260 "./typica.w"
  2108. QScriptValue constructQBuffer(QScriptContext*context,QScriptEngine*engine);
  2109. void setQBufferProperties(QScriptValue value,QScriptEngine*engine);
  2110. QScriptValue QBuffer_setData(QScriptContext*context,QScriptEngine*engine);
  2111. /*:91*//*94:*/
  2112. #line 2305 "./typica.w"
  2113. QScriptValue constructXQuery(QScriptContext*context,QScriptEngine*engine);
  2114. QScriptValue XQuery_bind(QScriptContext*context,QScriptEngine*engine);
  2115. QScriptValue XQuery_exec(QScriptContext*context,QScriptEngine*engine);
  2116. QScriptValue XQuery_setQuery(QScriptContext*context,QScriptEngine*engine);
  2117. QScriptValue XQuery_invalidate(QScriptContext*context,QScriptEngine*engine);
  2118. void setXQueryProperties(QScriptValue value,QScriptEngine*engine);
  2119. /*:94*//*100:*/
  2120. #line 2387 "./typica.w"
  2121. QScriptValue constructXmlWriter(QScriptContext*context,QScriptEngine*engine);
  2122. QScriptValue XmlWriter_setDevice(QScriptContext*context,
  2123. QScriptEngine*engine);
  2124. QScriptValue XmlWriter_writeAttribute(QScriptContext*context,
  2125. QScriptEngine*engine);
  2126. QScriptValue XmlWriter_writeCDATA(QScriptContext*context,
  2127. QScriptEngine*engine);
  2128. QScriptValue XmlWriter_writeCharacters(QScriptContext*context,
  2129. QScriptEngine*engine);
  2130. QScriptValue XmlWriter_writeDTD(QScriptContext*context,QScriptEngine*engine);
  2131. QScriptValue XmlWriter_writeEmptyElement(QScriptContext*context,
  2132. QScriptEngine*engine);
  2133. QScriptValue XmlWriter_writeEndDocument(QScriptContext*context,
  2134. QScriptEngine*engine);
  2135. QScriptValue XmlWriter_writeEndElement(QScriptContext*context,
  2136. QScriptEngine*engine);
  2137. QScriptValue XmlWriter_writeEntityReference(QScriptContext*context,
  2138. QScriptEngine*engine);
  2139. QScriptValue XmlWriter_writeProcessingInstruction(QScriptContext*context,
  2140. QScriptEngine*engine);
  2141. QScriptValue XmlWriter_writeStartDocument(QScriptContext*context,
  2142. QScriptEngine*engine);
  2143. QScriptValue XmlWriter_writeStartElement(QScriptContext*context,
  2144. QScriptEngine*engine);
  2145. QScriptValue XmlWriter_writeTextElement(QScriptContext*context,
  2146. QScriptEngine*engine);
  2147. void setXmlWriterProperties(QScriptValue value,QScriptEngine*engine);
  2148. /*:100*//*109:*/
  2149. #line 2605 "./typica.w"
  2150. QScriptValue constructXmlReader(QScriptContext*context,QScriptEngine*engine);
  2151. QScriptValue XmlReader_atEnd(QScriptContext*context,QScriptEngine*engine);
  2152. QScriptValue XmlReader_attribute(QScriptContext*context,
  2153. QScriptEngine*engine);
  2154. QScriptValue XmlReader_hasAttribute(QScriptContext*context,
  2155. QScriptEngine*engine);
  2156. QScriptValue XmlReader_isDTD(QScriptContext*context,QScriptEngine*engine);
  2157. QScriptValue XmlReader_isStartElement(QScriptContext*context,
  2158. QScriptEngine*engine);
  2159. QScriptValue XmlReader_name(QScriptContext*context,QScriptEngine*engine);
  2160. QScriptValue XmlReader_readElementText(QScriptContext*context,
  2161. QScriptEngine*engine);
  2162. QScriptValue XmlReader_readNext(QScriptContext*context,QScriptEngine*engine);
  2163. QScriptValue XmlReader_text(QScriptContext*context,QScriptEngine*engine);
  2164. void setXmlReaderProperties(QScriptValue value,QScriptEngine*engine);
  2165. /*:109*//*116:*/
  2166. #line 2740 "./typica.w"
  2167. QScriptValue QSettings_value(QScriptContext*context,QScriptEngine*engine);
  2168. QScriptValue QSettings_setValue(QScriptContext*context,QScriptEngine*engine);
  2169. void setQSettingsProperties(QScriptValue value,QScriptEngine*engine);
  2170. /*:116*//*120:*/
  2171. #line 2822 "./typica.w"
  2172. QScriptValue constructQLCDNumber(QScriptContext*context,
  2173. QScriptEngine*engine);
  2174. void setQLCDNumberProperties(QScriptValue value,QScriptEngine*engine);
  2175. /*:120*//*123:*/
  2176. #line 2860 "./typica.w"
  2177. QScriptValue constructQTime(QScriptContext*context,QScriptEngine*engine);
  2178. QScriptValue QTime_addMSecs(QScriptContext*context,QScriptEngine*engine);
  2179. QScriptValue QTime_addSecs(QScriptContext*context,QScriptEngine*engine);
  2180. QScriptValue QTime_elapsed(QScriptContext*context,QScriptEngine*engine);
  2181. QScriptValue QTime_hour(QScriptContext*context,QScriptEngine*engine);
  2182. QScriptValue QTime_isNull(QScriptContext*context,QScriptEngine*engine);
  2183. QScriptValue QTime_isValid(QScriptContext*context,QScriptEngine*engine);
  2184. QScriptValue QTime_minute(QScriptContext*context,QScriptEngine*engine);
  2185. QScriptValue QTime_msec(QScriptContext*context,QScriptEngine*engine);
  2186. QScriptValue QTime_msecsTo(QScriptContext*context,QScriptEngine*engine);
  2187. QScriptValue QTime_restart(QScriptContext*context,QScriptEngine*engine);
  2188. QScriptValue QTime_second(QScriptContext*context,QScriptEngine*engine);
  2189. QScriptValue QTime_secsTo(QScriptContext*context,QScriptEngine*engine);
  2190. QScriptValue QTime_setHMS(QScriptContext*context,QScriptEngine*engine);
  2191. QScriptValue QTime_start(QScriptContext*context,QScriptEngine*engine);
  2192. QScriptValue QTime_toString(QScriptContext*context,QScriptEngine*engine);
  2193. QScriptValue QTime_currentTime(QScriptContext*context,QScriptEngine*engine);
  2194. QScriptValue QTime_fromString(QScriptContext*context,QScriptEngine*engine);
  2195. QScriptValue QTime_valueOf(QScriptContext*context,QScriptEngine*engine);
  2196. void setQTimeProperties(QScriptValue value,QScriptEngine*engine);
  2197. /*:123*//*139:*/
  2198. #line 3338 "./typica.w"
  2199. void setQAbstractScrollAreaProperties(QScriptValue value,
  2200. QScriptEngine*engine);
  2201. /*:139*//*141:*/
  2202. #line 3353 "./typica.w"
  2203. void setQAbstractItemViewProperties(QScriptValue value,QScriptEngine*engine);
  2204. /*:141*//*143:*/
  2205. #line 3366 "./typica.w"
  2206. void setQGraphicsViewProperties(QScriptValue value,QScriptEngine*engine);
  2207. void setQTableViewProperties(QScriptValue value,QScriptEngine*engine);
  2208. /*:143*//*145:*/
  2209. #line 3390 "./typica.w"
  2210. void setQAbstractButtonProperties(QScriptValue value,QScriptEngine*engine);
  2211. void setQPushButtonProperties(QScriptValue value,QScriptEngine*engine);
  2212. QScriptValue constructQPushButton(QScriptContext*context,
  2213. QScriptEngine*engine);
  2214. /*:145*//*152:*/
  2215. #line 3489 "./typica.w"
  2216. void setQSqlQueryProperties(QScriptValue value,QScriptEngine*engine);
  2217. QScriptValue constructQSqlQuery(QScriptContext*context,QScriptEngine*engine);
  2218. QScriptValue QSqlQuery_bind(QScriptContext*context,QScriptEngine*engine);
  2219. QScriptValue QSqlQuery_bindDeviceData(QScriptContext*context,
  2220. QScriptEngine*engine);
  2221. QScriptValue QSqlQuery_bindFileData(QScriptContext*context,
  2222. QScriptEngine*engine);
  2223. QScriptValue QSqlQuery_exec(QScriptContext*context,
  2224. QScriptEngine*engine);
  2225. QScriptValue QSqlQuery_executedQuery(QScriptContext*context,
  2226. QScriptEngine*engine);
  2227. QScriptValue QSqlQuery_invalidate(QScriptContext*context,QScriptEngine*engine);
  2228. QScriptValue QSqlQuery_next(QScriptContext*context,QScriptEngine*engine);
  2229. QScriptValue QSqlQuery_prepare(QScriptContext*context,QScriptEngine*engine);
  2230. QScriptValue QSqlQuery_value(QScriptContext*context,QScriptEngine*engine);
  2231. /*:152*//*159:*/
  2232. #line 3660 "./typica.w"
  2233. QScriptValue baseName(QScriptContext*context,QScriptEngine*engine);
  2234. QScriptValue dir(QScriptContext*context,QScriptEngine*engine);
  2235. QScriptValue sqlToArray(QScriptContext*context,QScriptEngine*engine);
  2236. QScriptValue setFont(QScriptContext*context,QScriptEngine*engine);
  2237. QScriptValue annotationFromRecord(QScriptContext*context,
  2238. QScriptEngine*engine);
  2239. QScriptValue setTabOrder(QScriptContext*context,QScriptEngine*engine);
  2240. QScriptValue saveFileFromDatabase(QScriptContext*context,QScriptEngine*engine);
  2241. /*:159*//*171:*/
  2242. #line 3972 "./typica.w"
  2243. QScriptValue createWindow(QScriptContext*context,QScriptEngine*engine);
  2244. QScriptValue createReport(QScriptContext*context,QScriptEngine*engine);
  2245. void addLayoutToWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  2246. QStack<QLayout*> *layoutStack);
  2247. void addLayoutToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2248. QStack<QLayout*> *layoutStack);
  2249. void addSplitterToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2250. QStack<QLayout*> *layoutStack);
  2251. void addSplitterToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2252. QStack<QLayout*> *layoutStack);
  2253. void populateGridLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2254. QStack<QLayout*> *layoutStack);
  2255. void populateBoxLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2256. QStack<QLayout*> *layoutStack);
  2257. void populateSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2258. QStack<QLayout*> *layoutStack);
  2259. void populateWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  2260. QStack<QLayout*> *layoutStack);
  2261. void populateStackedLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2262. QStack<QLayout*> *layoutStack);
  2263. void addTemperatureDisplayToSplitter(QDomElement element,
  2264. QStack<QWidget*> *widgetStack,
  2265. QStack<QLayout*> *layoutStack);
  2266. void addTemperatureDisplayToLayout(QDomElement element,
  2267. QStack<QWidget*> *widgetStack,
  2268. QStack<QLayout*> *layoutStack);
  2269. void addTimerDisplayToSplitter(QDomElement element,
  2270. QStack<QWidget*> *widgetStack,
  2271. QStack<QLayout*> *layoutStack);
  2272. void addTimerDisplayToLayout(QDomElement element,
  2273. QStack<QWidget*> *widgetStack,
  2274. QStack<QLayout*> *layoutStack);
  2275. void addDecorationToSplitter(QDomElement element,
  2276. QStack<QWidget*> *widgetStack,
  2277. QStack<QLayout*> *layoutStack);
  2278. void addDecorationToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2279. QStack<QLayout*> *layoutStack);
  2280. void addWidgetToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2281. QStack<QLayout*> *layoutStack);
  2282. void addButtonToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2283. QStack<QLayout*> *layoutStack);
  2284. void addZoomLogToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2285. QStack<QLayout*> *layoutStack);
  2286. void addGraphToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2287. QStack<QLayout*> *layoutStack);
  2288. void addSqlDropToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2289. QStack<QLayout*> *layoutStack);
  2290. void addSaltToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2291. QStack<QLayout*> *layoutStack);
  2292. void addLineToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2293. QStack<QLayout*> *layoutStack);
  2294. void addTextToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2295. QStack<QLayout*> *layoutStack);
  2296. void addSqlQueryViewToLayout(QDomElement element,
  2297. QStack<QWidget*> *widgetStack,
  2298. QStack<QLayout*> *layoutStack);
  2299. void addCalendarToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2300. QStack<QLayout*> *layoutStack);
  2301. void addSpinBoxToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2302. QStack<QLayout*> *layoutStack);
  2303. /*:171*//*236:*/
  2304. #line 5562 "./typica.w"
  2305. void setQDateEditProperties(QScriptValue value,QScriptEngine*engine);
  2306. void setQDateTimeEditProperties(QScriptValue value,QScriptEngine*engine);
  2307. QScriptValue QDateTimeEdit_setDate(QScriptContext*context,
  2308. QScriptEngine*engine);
  2309. QScriptValue QDateTimeEdit_day(QScriptContext*context,QScriptEngine*engine);
  2310. QScriptValue QDateTimeEdit_month(QScriptContext*context,
  2311. QScriptEngine*engine);
  2312. QScriptValue QDateTimeEdit_year(QScriptContext*context,QScriptEngine*engine);
  2313. /*:236*//*237:*/
  2314. #line 5577 "./typica.w"
  2315. QScriptValue findChildObject(QScriptContext*context,QScriptEngine*engine);
  2316. /*:237*//*241:*/
  2317. #line 5712 "./typica.w"
  2318. void setSaltTableProperties(QScriptValue value,QScriptEngine*engine);
  2319. QScriptValue SaltTable_bindableColumnArray(QScriptContext*context,
  2320. QScriptEngine*engine);
  2321. QScriptValue SaltTable_bindableQuotedColumnArray(QScriptContext*context,
  2322. QScriptEngine*engine);
  2323. QScriptValue SaltTable_columnSum(QScriptContext*context,
  2324. QScriptEngine*engine);
  2325. QScriptValue SaltTable_columnArray(QScriptContext*context,
  2326. QScriptEngine*engine);
  2327. QScriptValue SaltTable_data(QScriptContext*context,QScriptEngine*engine);
  2328. QScriptValue SaltTable_model(QScriptContext*context,QScriptEngine*engine);
  2329. QScriptValue SaltTable_quotedColumnArray(QScriptContext*context,
  2330. QScriptEngine*engine);
  2331. QScriptValue SaltTable_setData(QScriptContext*context,QScriptEngine*engine);
  2332. QScriptValue SaltTable_clear(QScriptContext*context,QScriptEngine*engine);
  2333. QScriptValue SaltTable_removeRow(QScriptContext*context,QScriptEngine*engine);
  2334. QScriptValue SaltTable_findData(QScriptContext*context,QScriptEngine*engine);
  2335. /*:241*//*251:*/
  2336. #line 5928 "./typica.w"
  2337. void setSqlComboBoxProperties(QScriptValue value,QScriptEngine*engine);
  2338. void setQComboBoxProperties(QScriptValue value,QScriptEngine*engine);
  2339. QScriptValue QComboBox_currentData(QScriptContext*context,
  2340. QScriptEngine*engine);
  2341. QScriptValue QComboBox_addItem(QScriptContext*context,QScriptEngine*engine);
  2342. QScriptValue QComboBox_setModel(QScriptContext*context,QScriptEngine*engine);
  2343. QScriptValue QComboBox_findText(QScriptContext*context,QScriptEngine*engine);
  2344. QScriptValue QComboBox_findData(QScriptContext*context,QScriptEngine*engine);
  2345. /*:251*//*263:*/
  2346. #line 366 "./units.w"
  2347. QScriptValue Units_convertTemperature(QScriptContext*context,QScriptEngine*engine);
  2348. QScriptValue Units_convertRelativeTemperature(QScriptContext*context,
  2349. QScriptEngine*engine);
  2350. QScriptValue Units_isTemperatureUnit(QScriptContext*context,QScriptEngine*engine);
  2351. QScriptValue Units_convertWeight(QScriptContext*context,QScriptEngine*engine);
  2352. QScriptValue Units_isWeightUnit(QScriptContext*context,QScriptEngine*engine);
  2353. /*:263*//*267:*/
  2354. #line 430 "./units.w"
  2355. QScriptValue Unit_toScriptValue(QScriptEngine*engine,const Units::Unit&value);
  2356. void Unit_fromScriptValue(const QScriptValue&sv,Units::Unit&value);
  2357. /*:267*//*276:*/
  2358. #line 133 "./measurement.w"
  2359. QScriptValue constructMeasurement(QScriptContext*context,QScriptEngine*engine);
  2360. void setMeasurementProperties(QScriptValue value,QScriptEngine*engine);
  2361. QScriptValue Measurement_toScriptValue(QScriptEngine*engine,const Measurement&measurement);
  2362. void Measurement_fromScriptValue(const QScriptValue&value,Measurement&measurement);
  2363. /*:276*//*296:*/
  2364. #line 6562 "./typica.w"
  2365. QScriptValue constructDAQ(QScriptContext*context,QScriptEngine*engine);
  2366. QScriptValue DAQ_newChannel(QScriptContext*context,QScriptEngine*engine);
  2367. void setDAQProperties(QScriptValue value,QScriptEngine*engine);
  2368. /*:296*//*305:*/
  2369. #line 6767 "./typica.w"
  2370. QScriptValue constructFakeDAQ(QScriptContext*context,QScriptEngine*engine);
  2371. QScriptValue FakeDAQ_newChannel(QScriptContext*context,QScriptEngine*engine);
  2372. void setFakeDAQProperties(QScriptValue value,QScriptEngine*engine);
  2373. /*:305*//*310:*/
  2374. #line 6868 "./typica.w"
  2375. void setChannelProperties(QScriptValue value,QScriptEngine*engine);
  2376. /*:310*//*316:*/
  2377. #line 7050 "./typica.w"
  2378. QScriptValue constructLinearCalibrator(QScriptContext*context,
  2379. QScriptEngine*engine);
  2380. void setLinearCalibratorProperties(QScriptValue value,QScriptEngine*engine);
  2381. /*:316*//*321:*/
  2382. #line 7190 "./typica.w"
  2383. QScriptValue constructLinearSplineInterpolator(QScriptContext*context,QScriptEngine*engine);
  2384. void setLinearSplineInterpolatorProperties(QScriptValue value,QScriptEngine*engine);
  2385. /*:321*//*331:*/
  2386. #line 7392 "./typica.w"
  2387. QScriptValue constructTemperatureDisplay(QScriptContext*context,
  2388. QScriptEngine*engine);
  2389. void setTemperatureDisplayProperties(QScriptValue value,QScriptEngine*engine);
  2390. QScriptValue TemperatureDisplay_setDisplayUnits(QScriptContext*context,
  2391. QScriptEngine*engine);
  2392. /*:331*//*339:*/
  2393. #line 7551 "./typica.w"
  2394. QScriptValue constructMeasurementTimeOffset(QScriptContext*context,
  2395. QScriptEngine*engine);
  2396. void setMeasurementTimeOffsetProperties(QScriptValue value,
  2397. QScriptEngine*engine);
  2398. /*:339*//*344:*/
  2399. #line 7664 "./typica.w"
  2400. QScriptValue constructThresholdDetector(QScriptContext*context,QScriptEngine*engine);
  2401. void setThresholdDetectorProperties(QScriptValue value,QScriptEngine*engine);
  2402. /*:344*//*349:*/
  2403. #line 7762 "./typica.w"
  2404. QScriptValue constructZeroEmitter(QScriptContext*context,
  2405. QScriptEngine*engine);
  2406. void setZeroEmitterProperties(QScriptValue value,QScriptEngine*engine);
  2407. /*:349*//*354:*/
  2408. #line 7841 "./typica.w"
  2409. QScriptValue constructMeasurementAdapter(QScriptContext*context,
  2410. QScriptEngine*engine);
  2411. void setMeasurementAdapterProperties(QScriptValue value,QScriptEngine*engine);
  2412. /*:354*//*371:*/
  2413. #line 8305 "./typica.w"
  2414. void setGraphViewProperties(QScriptValue value,QScriptEngine*engine);
  2415. QScriptValue constructGraphView(QScriptContext*context,QScriptEngine*engine);
  2416. /*:371*//*394:*/
  2417. #line 8932 "./typica.w"
  2418. void setZoomLogProperties(QScriptValue value,QScriptEngine*engine);
  2419. QScriptValue constructZoomLog(QScriptContext*context,QScriptEngine*engine);
  2420. QScriptValue ZoomLog_saveXML(QScriptContext*context,QScriptEngine*engine);
  2421. QScriptValue ZoomLog_saveCSV(QScriptContext*context,QScriptEngine*engine);
  2422. QScriptValue ZoomLog_saveState(QScriptContext*context,QScriptEngine*engine);
  2423. QScriptValue ZoomLog_restoreState(QScriptContext*context,
  2424. QScriptEngine*engine);
  2425. QScriptValue ZoomLog_lastTime(QScriptContext*context,QScriptEngine*engine);
  2426. QScriptValue ZoomLog_saveTemporary(QScriptContext*context,
  2427. QScriptEngine*engnie);
  2428. QScriptValue ZoomLog_setDisplayUnits(QScriptContext*context,
  2429. QScriptEngine*engine);
  2430. /*:394*//*432:*/
  2431. #line 9889 "./typica.w"
  2432. QScriptValue constructAnnotationButton(QScriptContext*context,
  2433. QScriptEngine*engine);
  2434. void setAnnotationButtonProperties(QScriptValue value,QScriptEngine*engine);
  2435. /*:432*//*440:*/
  2436. #line 10029 "./typica.w"
  2437. QScriptValue constructAnnotationSpinBox(QScriptContext*context,
  2438. QScriptEngine*engine);
  2439. void setAnnotationSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  2440. void setQDoubleSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  2441. void setQAbstractSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  2442. /*:440*//*461:*/
  2443. #line 10452 "./typica.w"
  2444. QScriptValue constructTimerDisplay(QScriptContext*context,
  2445. QScriptEngine*engine);
  2446. void setTimerDisplayProperties(QScriptValue value,QScriptEngine*engine);
  2447. /*:461*//*488:*/
  2448. #line 10946 "./typica.w"
  2449. void setWidgetDecoratorProperties(QScriptValue value,QScriptEngine*engine);
  2450. QScriptValue constructWidgetDecorator(QScriptContext*context,
  2451. QScriptEngine*engine);
  2452. /*:488*//*501:*/
  2453. #line 11229 "./typica.w"
  2454. QScriptValue constructLogEditWindow(QScriptContext*context,
  2455. QScriptEngine*engine);
  2456. /*:501*//*520:*/
  2457. #line 11757 "./typica.w"
  2458. QScriptValue constructXMLInput(QScriptContext*context,QScriptEngine*engine);
  2459. QScriptValue XMLInput_input(QScriptContext*context,QScriptEngine*engine);
  2460. /*:520*//*538:*/
  2461. #line 189 "./webview.w"
  2462. QScriptValue constructWebView(QScriptContext*context,QScriptEngine*engine);
  2463. void setQWebViewProperties(QScriptValue value,QScriptEngine*engine);
  2464. void addWebViewToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2465. QStack<QLayout*> *layoutStack);
  2466. /*:538*//*541:*/
  2467. #line 219 "./webview.w"
  2468. QScriptValue QWebElement_toScriptValue(QScriptEngine*engine,const QWebElement&element);
  2469. void QWebElement_fromScriptValue(const QScriptValue&value,QWebElement&element);
  2470. /*:541*//*545:*/
  2471. #line 277 "./webview.w"
  2472. QScriptValue constructWebElement(QScriptContext*context,
  2473. QScriptEngine*engine);
  2474. /*:545*//*614:*/
  2475. #line 13096 "./typica.w"
  2476. void setSqlQueryViewProperties(QScriptValue value,QScriptEngine*engine);
  2477. QScriptValue constructSqlQueryView(QScriptContext*context,
  2478. QScriptEngine*engine);
  2479. QScriptValue SqlQueryView_setQuery(QScriptContext*context,
  2480. QScriptEngine*engine);
  2481. QScriptValue SqlQueryView_setHeaderData(QScriptContext*context,
  2482. QScriptEngine*engine);
  2483. /*:614*//*624:*/
  2484. #line 13333 "./typica.w"
  2485. void addReportToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2486. QStack<QLayout*> *layoutStack);
  2487. /*:624*//*640:*/
  2488. #line 13618 "./typica.w"
  2489. void setQTextEditProperties(QScriptValue value,QScriptEngine*engine);
  2490. QScriptValue QTextEdit_print(QScriptContext*context,QScriptEngine*engine);
  2491. /*:640*//*662:*/
  2492. #line 469 "./daterangeselector.w"
  2493. void addDateRangeToLayout(QDomElement element,
  2494. QStack<QWidget*> *widgetStack,
  2495. QStack<QLayout*> *layoutStack);
  2496. /*:662*//*671:*/
  2497. #line 13815 "./typica.w"
  2498. void addFormArrayToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2499. QStack<QLayout*> *layoutStack);
  2500. /*:671*//*692:*/
  2501. #line 14399 "./typica.w"
  2502. void addScaleControlToLayout(QDomElement element,
  2503. QStack<QWidget*> *widgetStack,
  2504. QStack<QLayout*> *layoutStack);
  2505. void addIntensityControlToLayout(QDomElement element,
  2506. QStack<QWidget*> *widgetStack,
  2507. QStack<QLayout*> *layoutStack);
  2508. /*:692*//*718:*/
  2509. #line 14985 "./typica.w"
  2510. QScriptValue constructDeviceTreeModel(QScriptContext*context,
  2511. QScriptEngine*engine);
  2512. void setDeviceTreeModelProperties(QScriptValue value,QScriptEngine*engine);
  2513. void setQAbstractItemModelProperties(QScriptValue value,QScriptEngine*engine);
  2514. QScriptValue DeviceTreeModel_referenceElement(QScriptContext*context,
  2515. QScriptEngine*engine);
  2516. QScriptValue QAbstractItemModel_data(QScriptContext*context,QScriptEngine*engine);
  2517. QScriptValue QAbstractItemModel_index(QScriptContext*context,QScriptEngine*engine);
  2518. QScriptValue QAbstractItemModel_rowCount(QScriptContext*context,QScriptEngine*engine);
  2519. QScriptValue QAbstractItemModel_hasChildren(QScriptContext*context,QScriptEngine*engine);
  2520. /*:718*//*724:*/
  2521. #line 15127 "./typica.w"
  2522. QScriptValue QModelIndex_toScriptValue(QScriptEngine*engine,const QModelIndex&index);
  2523. void QModelIndex_fromScriptValue(const QScriptValue&value,QModelIndex&index);
  2524. /*:724*//*740:*/
  2525. #line 15425 "./typica.w"
  2526. QScriptValue constructDeviceConfigurationWindow(QScriptContext*context,
  2527. QScriptEngine*engine);
  2528. /*:740*//*811:*/
  2529. #line 40 "./settings.w"
  2530. QScriptValue constructSettingsWindow(QScriptContext*context,QScriptEngine*engine);
  2531. /*:811*//*830:*/
  2532. #line 17963 "./typica.w"
  2533. QScriptValue constructModbusRTUDevice(QScriptContext*context,QScriptEngine*engine);
  2534. QScriptValue ModbusRTUDevice_pVChannel(QScriptContext*context,QScriptEngine*engine);
  2535. QScriptValue ModbusRTUDevice_sVChannel(QScriptContext*context,QScriptEngine*engine);
  2536. void setModbusRTUDeviceProperties(QScriptValue value,QScriptEngine*engine);
  2537. /*:830*//*850:*/
  2538. #line 345 "./unsupportedserial.w"
  2539. QScriptValue createDevice(QScriptContext*context,QScriptEngine*engine);
  2540. /*:850*//*856:*/
  2541. #line 425 "./unsupportedserial.w"
  2542. QScriptValue JavaScriptDevice_getChannel(QScriptContext*context,QScriptEngine*engine);
  2543. /*:856*//*862:*/
  2544. #line 617 "./unsupportedserial.w"
  2545. QScriptValue getMeasurementTimestamp(QScriptContext*context,QScriptEngine*engine);
  2546. /*:862*//*866:*/
  2547. #line 651 "./unsupportedserial.w"
  2548. QScriptValue constructSerialPort(QScriptContext*context,QScriptEngine*engine);
  2549. void setSerialPortProperties(QScriptValue value,QScriptEngine*engine);
  2550. QScriptValue SerialPort_flush(QScriptContext*context,QScriptEngine*engine);
  2551. /*:866*//*886:*/
  2552. #line 138 "./rate.w"
  2553. QScriptValue constructRateOfChange(QScriptContext*context,QScriptEngine*engine);
  2554. void setRateOfChangeProperties(QScriptValue value,QScriptEngine*engine);
  2555. /*:886*//*911:*/
  2556. #line 597 "./dataqsdk.w"
  2557. QScriptValue constructDataqSdkDevice(QScriptContext*context,QScriptEngine*engine);
  2558. QScriptValue DataqSdkDevice_newChannel(QScriptContext*context,QScriptEngine*engine);
  2559. void setDataqSdkDeviceProperties(QScriptValue value,QScriptEngine*engine);
  2560. /*:911*//*938:*/
  2561. #line 67 "./scales.w"
  2562. QScriptValue constructDragLabel(QScriptContext*context,QScriptEngine*engine);
  2563. void setDragLabelProperties(QScriptValue value,QScriptEngine*engine);
  2564. /*:938*//*946:*/
  2565. #line 233 "./scales.w"
  2566. QScriptValue constructSerialScale(QScriptContext*context,QScriptEngine*engine);
  2567. void setSerialScaleProperties(QScriptValue value,QScriptEngine*engine);
  2568. /*:946*//*949:*/
  2569. #line 258 "./scales.w"
  2570. QScriptValue BaudRateType_toScriptValue(QScriptEngine*engine,const BaudRateType&value);
  2571. void BaudRateType_fromScriptValue(const QScriptValue&sv,BaudRateType&value);
  2572. QScriptValue DataBitsType_toScriptValue(QScriptEngine*engine,const DataBitsType&value);
  2573. void DataBitsType_fromScriptValue(const QScriptValue&sv,DataBitsType&value);
  2574. QScriptValue ParityType_toScriptValue(QScriptEngine*engine,const ParityType&value);
  2575. void ParityType_fromScriptValue(const QScriptValue&sv,ParityType&value);
  2576. QScriptValue StopBitsType_toScriptValue(QScriptEngine*engine,const StopBitsType&value);
  2577. void StopBitsType_fromScriptValue(const QScriptValue&sv,StopBitsType&value);
  2578. QScriptValue FlowType_toScriptValue(QScriptEngine*engine,const FlowType&value);
  2579. void FlowType_fromScriptValue(const QScriptValue&sv,FlowType&value);
  2580. /*:949*//*974:*/
  2581. #line 265 "./valueannotation.w"
  2582. QScriptValue constructValueAnnotation(QScriptContext*context,QScriptEngine*engine);
  2583. void setValueAnnotationProperties(QScriptValue value,QScriptEngine*engine);
  2584. /*:974*/
  2585. #line 527 "./typica.w"
  2586. /*594:*/
  2587. #line 12753 "./typica.w"
  2588. void messageFileOutput(QtMsgType type,const char*msg);
  2589. /*:594*/
  2590. #line 528 "./typica.w"
  2591. /*4:*/
  2592. #line 537 "./typica.w"
  2593. /*732:*/
  2594. #line 15248 "./typica.w"
  2595. NodeInserter::NodeInserter(const QString&title,const QString&name,
  2596. const QString&driver,QObject*parent):
  2597. QAction(title,parent),defaultNodeName(name),driverString(driver)
  2598. {
  2599. connect(this,SIGNAL(triggered()),this,SLOT(onTriggered()));
  2600. }
  2601. void NodeInserter::onTriggered()
  2602. {
  2603. emit triggered(defaultNodeName,driverString);
  2604. }
  2605. /*:732*/
  2606. #line 538 "./typica.w"
  2607. /*272:*/
  2608. #line 40 "./measurement.w"
  2609. Measurement::Measurement(double temperature,QTime time,Units::Unit sc)
  2610. {
  2611. insert("measurement",temperature);
  2612. insert("time",time);
  2613. insert("unit",sc);
  2614. }
  2615. Measurement::Measurement(double temperature)
  2616. {
  2617. insert("measurement",temperature);
  2618. insert("time",QTime::currentTime());
  2619. insert("unit",Units::Fahrenheit);
  2620. }
  2621. void Measurement::setTemperature(double temperature)
  2622. {
  2623. insert("measurement",temperature);
  2624. }
  2625. void Measurement::setTime(QTime time)
  2626. {
  2627. insert("time",time);
  2628. }
  2629. void Measurement::setUnit(Units::Unit scale)
  2630. {
  2631. insert("unit",scale);
  2632. }
  2633. double Measurement::temperature()const
  2634. {
  2635. return value("measurement").toDouble();
  2636. }
  2637. QTime Measurement::time()const
  2638. {
  2639. return value("time").toTime();
  2640. }
  2641. Units::Unit Measurement::scale()const
  2642. {
  2643. return(Units::Unit)(value("unit").toInt());
  2644. }
  2645. /*:272*//*273:*/
  2646. #line 88 "./measurement.w"
  2647. Measurement Measurement::toFahrenheit()
  2648. {
  2649. return Measurement(Units::convertTemperature(this->temperature(),
  2650. this->scale(),Units::Fahrenheit),
  2651. this->time(),Units::Fahrenheit);
  2652. }
  2653. Measurement Measurement::toCelsius()
  2654. {
  2655. return Measurement(Units::convertTemperature(this->temperature(),
  2656. this->scale(),Units::Celsius),
  2657. this->time(),Units::Celsius);
  2658. }
  2659. Measurement Measurement::toKelvin()
  2660. {
  2661. return Measurement(Units::convertTemperature(this->temperature(),
  2662. this->scale(),Units::Kelvin),
  2663. this->time(),Units::Kelvin);
  2664. }
  2665. Measurement Measurement::toRankine()
  2666. {
  2667. return Measurement(Units::convertTemperature(this->temperature(),
  2668. this->scale(),Units::Rankine),
  2669. this->time(),Units::Rankine);
  2670. }
  2671. /*:273*/
  2672. #line 539 "./typica.w"
  2673. /*286:*/
  2674. #line 6168 "./typica.w"
  2675. void DAQImplementation::measure()
  2676. {
  2677. int samplesRead= 0;
  2678. double buffer[channels];
  2679. error= read((unsigned int)(handle),(signed long)(1),(double)(10.0),
  2680. (unsigned long)(0),buffer,(unsigned long)(channels),
  2681. &samplesRead,(signed long)(0));
  2682. if(error)
  2683. {
  2684. ready= false;
  2685. }
  2686. else
  2687. {
  2688. if(samplesRead)
  2689. {
  2690. QTime time= QTime::currentTime();
  2691. for(int i= 0;i<samplesRead;i++)
  2692. {
  2693. for(int j= 0;j<channels;j++)
  2694. {
  2695. Measurement measure(buffer[j+(i*channels)],time,
  2696. unitMap[j]);
  2697. channelMap[j]->input(measure);
  2698. }
  2699. }
  2700. }
  2701. }
  2702. }
  2703. /*:286*//*287:*/
  2704. #line 6210 "./typica.w"
  2705. void DAQImplementation::run()
  2706. {
  2707. setPriority(QThread::TimeCriticalPriority);
  2708. while(ready)
  2709. {
  2710. measure();
  2711. }
  2712. }
  2713. /*:287*//*288:*/
  2714. #line 6226 "./typica.w"
  2715. void DAQ::threadFinished()
  2716. {
  2717. if(imp->error)
  2718. {
  2719. /*289:*/
  2720. #line 6277 "./typica.w"
  2721. imp->ready= false;
  2722. QMessageBox warning;
  2723. warning.setStandardButtons(QMessageBox::Cancel);
  2724. warning.setIcon(QMessageBox::Warning);
  2725. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2726. unsigned long bytes= imp->errorInfo(NULL,0);
  2727. char string[bytes];
  2728. imp->errorInfo(string,bytes);
  2729. warning.setInformativeText(QString(string));
  2730. warning.setWindowTitle(QString(PROGRAM_NAME));
  2731. warning.exec();
  2732. /*:289*/
  2733. #line 6231 "./typica.w"
  2734. }
  2735. }
  2736. /*:288*//*290:*/
  2737. #line 6302 "./typica.w"
  2738. void DAQ::start()
  2739. {
  2740. if(imp->ready)
  2741. {
  2742. imp->error= imp->startTask(imp->handle);
  2743. if(imp->error)
  2744. {
  2745. /*289:*/
  2746. #line 6277 "./typica.w"
  2747. imp->ready= false;
  2748. QMessageBox warning;
  2749. warning.setStandardButtons(QMessageBox::Cancel);
  2750. warning.setIcon(QMessageBox::Warning);
  2751. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2752. unsigned long bytes= imp->errorInfo(NULL,0);
  2753. char string[bytes];
  2754. imp->errorInfo(string,bytes);
  2755. warning.setInformativeText(QString(string));
  2756. warning.setWindowTitle(QString(PROGRAM_NAME));
  2757. warning.exec();
  2758. /*:289*/
  2759. #line 6310 "./typica.w"
  2760. }
  2761. else
  2762. {
  2763. connect(imp,SIGNAL(finished()),this,SLOT(threadFinished()));
  2764. imp->start();
  2765. }
  2766. }
  2767. }
  2768. void DAQ::stop()
  2769. {
  2770. if(imp->useBase)
  2771. {
  2772. imp->ready= false;
  2773. imp->wait(ULONG_MAX);
  2774. imp->stopTask(imp->handle);
  2775. }
  2776. else
  2777. {
  2778. imp->ready= false;
  2779. imp->error= imp->stopTask(imp->handle);
  2780. if(imp->error)
  2781. {
  2782. /*289:*/
  2783. #line 6277 "./typica.w"
  2784. imp->ready= false;
  2785. QMessageBox warning;
  2786. warning.setStandardButtons(QMessageBox::Cancel);
  2787. warning.setIcon(QMessageBox::Warning);
  2788. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2789. unsigned long bytes= imp->errorInfo(NULL,0);
  2790. char string[bytes];
  2791. imp->errorInfo(string,bytes);
  2792. warning.setInformativeText(QString(string));
  2793. warning.setWindowTitle(QString(PROGRAM_NAME));
  2794. warning.exec();
  2795. /*:289*/
  2796. #line 6334 "./typica.w"
  2797. }
  2798. imp->error= imp->clearTask(imp->handle);
  2799. if(imp->error)
  2800. {
  2801. /*289:*/
  2802. #line 6277 "./typica.w"
  2803. imp->ready= false;
  2804. QMessageBox warning;
  2805. warning.setStandardButtons(QMessageBox::Cancel);
  2806. warning.setIcon(QMessageBox::Warning);
  2807. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2808. unsigned long bytes= imp->errorInfo(NULL,0);
  2809. char string[bytes];
  2810. imp->errorInfo(string,bytes);
  2811. warning.setInformativeText(QString(string));
  2812. warning.setWindowTitle(QString(PROGRAM_NAME));
  2813. warning.exec();
  2814. /*:289*/
  2815. #line 6339 "./typica.w"
  2816. }
  2817. }
  2818. }
  2819. /*:290*//*291:*/
  2820. #line 6349 "./typica.w"
  2821. DAQ::DAQ(QString device,const QString&driver):imp(new DAQImplementation(driver))
  2822. {
  2823. imp->device= device;
  2824. imp->error= imp->createTask(device.toAscii().data(),&(imp->handle));
  2825. if(imp->error)
  2826. {
  2827. /*289:*/
  2828. #line 6277 "./typica.w"
  2829. imp->ready= false;
  2830. QMessageBox warning;
  2831. warning.setStandardButtons(QMessageBox::Cancel);
  2832. warning.setIcon(QMessageBox::Warning);
  2833. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2834. unsigned long bytes= imp->errorInfo(NULL,0);
  2835. char string[bytes];
  2836. imp->errorInfo(string,bytes);
  2837. warning.setInformativeText(QString(string));
  2838. warning.setWindowTitle(QString(PROGRAM_NAME));
  2839. warning.exec();
  2840. /*:289*/
  2841. #line 6356 "./typica.w"
  2842. }
  2843. else
  2844. {
  2845. imp->ready= true;
  2846. }
  2847. }
  2848. /*:291*//*292:*/
  2849. #line 6370 "./typica.w"
  2850. Channel*DAQ::newChannel(int units,int thermocouple)
  2851. {
  2852. Channel*retval= new Channel();
  2853. imp->channelMap[imp->channels]= retval;
  2854. imp->unitMap[imp->channels]= (Units::Unit)units;
  2855. imp->channels++;
  2856. if(imp->ready)
  2857. {
  2858. if(imp->useBase)
  2859. {
  2860. imp->error= imp->createChannel(imp->handle,
  2861. QString("%1/ai%2").arg(imp->device).
  2862. arg(imp->channels-1).
  2863. toAscii().data(),
  2864. "",(double)(-1.0),(double)(100.0),
  2865. (signed long)(units),
  2866. (signed long)(thermocouple),
  2867. (signed long)(10200),(double)(0),
  2868. "");
  2869. }
  2870. else
  2871. {
  2872. imp->error= imp->createChannel(imp->handle,
  2873. QString("%1/ai%2").arg(imp->device).
  2874. arg(imp->channels-1).
  2875. toAscii().data(),
  2876. "",(double)(50.0),(double)(500.0),
  2877. (signed long)(units),
  2878. (signed long)(thermocouple),
  2879. (signed long)(10200),(double)(0),
  2880. "");
  2881. }
  2882. if(imp->error)
  2883. {
  2884. /*289:*/
  2885. #line 6277 "./typica.w"
  2886. imp->ready= false;
  2887. QMessageBox warning;
  2888. warning.setStandardButtons(QMessageBox::Cancel);
  2889. warning.setIcon(QMessageBox::Warning);
  2890. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2891. unsigned long bytes= imp->errorInfo(NULL,0);
  2892. char string[bytes];
  2893. imp->errorInfo(string,bytes);
  2894. warning.setInformativeText(QString(string));
  2895. warning.setWindowTitle(QString(PROGRAM_NAME));
  2896. warning.exec();
  2897. /*:289*/
  2898. #line 6405 "./typica.w"
  2899. }
  2900. }
  2901. return retval;
  2902. }
  2903. /*:292*//*293:*/
  2904. #line 6419 "./typica.w"
  2905. void DAQ::setClockRate(double Hz)
  2906. {
  2907. if(imp->ready)
  2908. {
  2909. imp->error= imp->setClock(imp->handle,"OnboardClock",Hz,
  2910. (signed long)(10280),(signed long)(10123),
  2911. (unsigned long long)(1));
  2912. if(imp->error)
  2913. {
  2914. /*289:*/
  2915. #line 6277 "./typica.w"
  2916. imp->ready= false;
  2917. QMessageBox warning;
  2918. warning.setStandardButtons(QMessageBox::Cancel);
  2919. warning.setIcon(QMessageBox::Warning);
  2920. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2921. unsigned long bytes= imp->errorInfo(NULL,0);
  2922. char string[bytes];
  2923. imp->errorInfo(string,bytes);
  2924. warning.setInformativeText(QString(string));
  2925. warning.setWindowTitle(QString(PROGRAM_NAME));
  2926. warning.exec();
  2927. /*:289*/
  2928. #line 6429 "./typica.w"
  2929. }
  2930. }
  2931. }
  2932. /*:293*//*294:*/
  2933. #line 6439 "./typica.w"
  2934. DAQ::~DAQ()
  2935. {
  2936. if(imp->useBase)
  2937. {
  2938. imp->resetDevice(imp->device.toAscii().data());
  2939. imp->clearTask(imp->handle);
  2940. }
  2941. else
  2942. {
  2943. if(imp->ready)
  2944. {
  2945. imp->ready= false;
  2946. imp->wait(ULONG_MAX);
  2947. imp->stopTask(imp->handle);
  2948. imp->resetDevice(imp->device.toAscii().data());
  2949. imp->clearTask(imp->handle);
  2950. }
  2951. }
  2952. delete imp;
  2953. }
  2954. /*:294*//*295:*/
  2955. #line 6470 "./typica.w"
  2956. DAQImplementation::DAQImplementation(const QString&driverinfo)
  2957. :QThread(NULL),channelMap(4),handle(0),error(0),channels(0),ready(false),
  2958. unitMap(4)
  2959. {
  2960. if(driverinfo=="nidaqmxbase")
  2961. {
  2962. useBase= true;
  2963. }
  2964. else
  2965. {
  2966. useBase= false;
  2967. }
  2968. if(useBase)
  2969. {
  2970. driver.setFileName("nidaqmxbase.framework/nidaqmxbase");
  2971. if(!driver.load())
  2972. {
  2973. driver.setFileName("nidaqmxbase");
  2974. if(!driver.load())
  2975. {
  2976. QMessageBox::critical(NULL,tr("Typica: Driver not found"),
  2977. tr("Failed to find nidaqmxbase. Please install it."));
  2978. QApplication::quit();
  2979. }
  2980. }
  2981. }
  2982. else
  2983. {
  2984. driver.setFileName("nicaiu");
  2985. if(!driver.load())
  2986. {
  2987. QMessageBox::critical(NULL,tr("Typica: Driver not found"),
  2988. tr("Failed to find nidaqmx. Please install it."));
  2989. QApplication::quit();
  2990. }
  2991. }
  2992. if(useBase)
  2993. {
  2994. if((createTask= (daqfp)driver.resolve("DAQmxBaseCreateTask"))==0||
  2995. (startTask= (daqfp)driver.resolve("DAQmxBaseStartTask"))==0||
  2996. (stopTask= (daqfp)driver.resolve("DAQmxBaseStopTask"))==0||
  2997. (clearTask= (daqfp)driver.resolve("DAQmxBaseClearTask"))==0||
  2998. (createChannel= (daqfp)driver.resolve("DAQmxBaseCreateAIThrmcplChan"))
  2999. ==0||
  3000. (setClock= (daqfp)driver.resolve("DAQmxBaseCfgSampClkTiming"))==
  3001. 0||
  3002. (read= (daqfp)driver.resolve("DAQmxBaseReadAnalogF64"))==0||
  3003. (errorInfo= (daqfp)driver.resolve("DAQmxBaseGetExtendedErrorInfo"))==
  3004. 0||
  3005. (resetDevice= (daqfp)driver.resolve("DAQmxBaseResetDevice"))==0)
  3006. {
  3007. waitForMeasurement= NULL;
  3008. QMessageBox::critical(NULL,tr("Typica: Link error"),
  3009. tr("Failed to link a required symbol in NI-DAQmxBase."));
  3010. QApplication::quit();
  3011. }
  3012. }
  3013. else
  3014. {
  3015. if((createTask= (daqfp)driver.resolve("DAQmxCreateTask"))==0||
  3016. (startTask= (daqfp)driver.resolve("DAQmxStartTask"))==0||
  3017. (stopTask= (daqfp)driver.resolve("DAQmxStopTask"))==0||
  3018. (clearTask= (daqfp)driver.resolve("DAQmxClearTask"))==0||
  3019. (createChannel= (daqfp)driver.resolve("DAQmxCreateAIThrmcplChan"))
  3020. ==0||
  3021. (setClock= (daqfp)driver.resolve("DAQmxCfgSampClkTiming"))==0||
  3022. (read= (daqfp)driver.resolve("DAQmxReadAnalogF64"))==0||
  3023. (errorInfo= (daqfp)driver.resolve("DAQmxGetExtendedErrorInfo"))==
  3024. 0||
  3025. (resetDevice= (daqfp)driver.resolve("DAQmxResetDevice"))==0||
  3026. (waitForMeasurement= (daqfp)driver.resolve("DAQmxWaitUntilTaskDone"))==0)
  3027. {
  3028. QMessageBox::critical(NULL,tr("Typica: Link error"),
  3029. tr("Failed to link a required symbol in NI-DAQmx."));
  3030. QApplication::quit();
  3031. }
  3032. }
  3033. }
  3034. DAQImplementation::~DAQImplementation()
  3035. {
  3036. driver.unload();
  3037. }
  3038. /*:295*/
  3039. #line 540 "./typica.w"
  3040. /*900:*/
  3041. #line 197 "./dataqsdk.w"
  3042. void DataqSdkDeviceImplementation::measure()
  3043. {
  3044. unsigned count= channels*40;
  3045. di_status_read(buffer,count);
  3046. QTime time= QTime::currentTime();
  3047. for(unsigned int i= 0;i<count;i++)
  3048. {
  3049. buffer[i]= buffer[i]&0xFFFC;
  3050. }
  3051. QList<int> countList;
  3052. for(unsigned int i= 0;i<(unsigned)channels;i++)
  3053. {
  3054. QList<double> channelBuffer;
  3055. for(unsigned int j= 0;j<40;j++)
  3056. {
  3057. channelBuffer<<((double)buffer[i+(channels*j)]*10.0)/32768.0;
  3058. if(i==0)
  3059. {
  3060. countList<<buffer[i+(channels*j)];
  3061. }
  3062. }
  3063. double value= 0.0;
  3064. for(unsigned int j= 0;j<40;j++)
  3065. {
  3066. value+= channelBuffer[j];
  3067. }
  3068. value/= 40.0;
  3069. if(i==0)
  3070. {
  3071. QList<double> smoothingList;
  3072. smoothingList<<value;
  3073. QList<int> smoothingKeys= smoother.uniqueKeys();
  3074. for(int j= 0;j<smoothingKeys.size();j++)
  3075. {
  3076. if(countList.contains(smoothingKeys[j]))
  3077. {
  3078. QList<double> keyValues= smoother.values(smoothingKeys[j]);
  3079. for(int k= 0;k<keyValues.size();k++)
  3080. {
  3081. smoothingList<<keyValues[k];
  3082. }
  3083. }
  3084. else
  3085. {
  3086. smoother.remove(smoothingKeys[j]);
  3087. }
  3088. }
  3089. qSort(countList);
  3090. int lastCount= 0;
  3091. for(int j= 0;j<countList.size();j++)
  3092. {
  3093. if(j==0||countList[j]!=lastCount)
  3094. {
  3095. smoother.insert(countList[j],value);
  3096. lastCount= countList[j];
  3097. }
  3098. }
  3099. value= 0.0;
  3100. for(int j= 0;j<smoothingList.size();j++)
  3101. {
  3102. value+= smoothingList[j];
  3103. }
  3104. value/= smoothingList.size();
  3105. }
  3106. Measurement measure(value,time,unitMap[i]);
  3107. channelMap[i]->input(measure);
  3108. }
  3109. }
  3110. /*:900*//*901:*/
  3111. #line 290 "./dataqsdk.w"
  3112. void DataqSdkDeviceImplementation::run()
  3113. {
  3114. if(!ready)
  3115. {
  3116. error= 9;
  3117. return;
  3118. }
  3119. driver= new QLibrary(device);
  3120. if(!driver->load())
  3121. {
  3122. error= 1;
  3123. qDebug()<<"Failed to load driver: "<<device;
  3124. return;
  3125. }
  3126. di_open= (FPDIOPEN)driver->resolve("di_open");
  3127. di_close= (FPDICLOSE)driver->resolve("di_close");
  3128. di_sample_rate= (FPDISAMPLERATE)driver->resolve("di_sample_rate");
  3129. di_maximum_rate= (FPDIMAXIMUMRATE)driver->resolve("di_maximum_rate");
  3130. di_list_length= (FPDILISTLENGTH)driver->resolve("di_list_length");
  3131. di_inlist= (FPDIINLIST)driver->resolve("di_inlist");
  3132. di_buffer_alloc= (FPDIBUFFERALLOC)driver->resolve("di_buffer_alloc");
  3133. di_start_scan= (FPDISTARTSCAN)driver->resolve("di_start_scan");
  3134. di_status_read= (FPDISTATUSREAD)driver->resolve("di_status_read");
  3135. di_buffer_status= (FPDIBUFFERSTATUS)driver->resolve("di_buffer_status");
  3136. di_burst_rate= (FPDIBURSTRATE)driver->resolve("di_burst_rate");
  3137. di_stop_scan= (FPDISTOPSCAN)driver->resolve("di_stop_scan");
  3138. if((!di_open)||(!di_close)||(!di_sample_rate)||(!di_maximum_rate)||
  3139. (!di_list_length)||(!di_inlist)||(!di_buffer_alloc)||
  3140. (!di_start_scan)||(!di_status_read)||(!di_buffer_status)||
  3141. (!di_burst_rate)||(!di_stop_scan))
  3142. {
  3143. error= 2;
  3144. return;
  3145. }
  3146. error= di_open(deviceNumber);
  3147. if(error)
  3148. {
  3149. di_close();
  3150. error= di_open(deviceNumber);
  3151. if(error)
  3152. {
  3153. error= 3;
  3154. di_close();
  3155. return;
  3156. }
  3157. }
  3158. isOpen= true;
  3159. di_maximum_rate(240.0);
  3160. sampleRate= di_sample_rate(sampleRate*channels*40,&oversample,
  3161. &burstDivisor);
  3162. buffer= new qint16[(int)sampleRate];
  3163. di_inlist_struct inlist[16]= {{0,0,0,0,0,0,0,0}};
  3164. for(unsigned short i= 0;i<channels;i++)
  3165. {
  3166. inlist[i].chan= i;
  3167. inlist[i].gain= 0;
  3168. inlist[i].ave= 1;
  3169. inlist[i].counter= (oversample-1);
  3170. }
  3171. error= di_list_length(channels,0);
  3172. if(error)
  3173. {
  3174. error= 4;
  3175. return;
  3176. }
  3177. error= di_inlist(inlist);
  3178. if(error)
  3179. {
  3180. error= 5;
  3181. return;
  3182. }
  3183. input_buffer= di_buffer_alloc(0,4096);
  3184. if(input_buffer==NULL)
  3185. {
  3186. error= 6;
  3187. return;
  3188. }
  3189. error= di_start_scan();
  3190. if(error)
  3191. {
  3192. error= 7;
  3193. return;
  3194. }
  3195. while(ready)
  3196. {
  3197. measure();
  3198. }
  3199. }
  3200. /*:901*//*902:*/
  3201. #line 386 "./dataqsdk.w"
  3202. void DataqSdkDevice::threadFinished()
  3203. {
  3204. if(imp->error)
  3205. {
  3206. /*903:*/
  3207. #line 400 "./dataqsdk.w"
  3208. imp->ready= false;
  3209. QMessageBox warning;
  3210. warning.setStandardButtons(QMessageBox::Cancel);
  3211. warning.setIcon(QMessageBox::Warning);
  3212. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  3213. warning.setInformativeText(tr("An error occurred"));
  3214. warning.setWindowTitle(QString(PROGRAM_NAME));
  3215. warning.exec();
  3216. /*:903*/
  3217. #line 391 "./dataqsdk.w"
  3218. }
  3219. }
  3220. /*:902*//*904:*/
  3221. #line 417 "./dataqsdk.w"
  3222. void DataqSdkDevice::start()
  3223. {
  3224. connect(imp,SIGNAL(finished()),this,SLOT(threadFinished()));
  3225. imp->start();
  3226. }
  3227. /*:904*//*905:*/
  3228. #line 428 "./dataqsdk.w"
  3229. QStringList DataqSdkDevice::detectHardware()
  3230. {
  3231. QSettings deviceLookup("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\services\\usbser\\Enum",
  3232. QSettings::NativeFormat);
  3233. QStringList keys= deviceLookup.childKeys();
  3234. QStringList devices;
  3235. for(int i= 0;i<keys.size();i++)
  3236. {
  3237. QString value= deviceLookup.value(keys.at(i)).toString();
  3238. if(value.startsWith("USB\\VID_0683&PID_1450\\"))
  3239. {
  3240. devices.append(value.split("\\").at(2));
  3241. }
  3242. }
  3243. QStringList portList;
  3244. foreach(QString device,devices)
  3245. {
  3246. QString deviceKey= QString("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\USB\\VID_0683&PID_1450\\%1").arg(device);
  3247. QSettings deviceEntry(deviceKey,QSettings::NativeFormat);
  3248. portList.append(deviceEntry.value("FriendlyName").toString());
  3249. }
  3250. return portList;
  3251. }
  3252. QStringList DataqSdkDevice::detectPorts()
  3253. {
  3254. QStringList friendlyNames= detectHardware();
  3255. QStringList portList;
  3256. foreach(QString name,friendlyNames)
  3257. {
  3258. name.remove(0,name.indexOf("COM"));
  3259. name.chop(1);
  3260. portList.append(name);
  3261. }
  3262. return portList;
  3263. }
  3264. /*:905*//*906:*/
  3265. #line 473 "./dataqsdk.w"
  3266. DataqSdkDevice::DataqSdkDevice(QString device):imp(new DataqSdkDeviceImplementation)
  3267. {
  3268. bool usesAuto= false;
  3269. int autoIndex= device.toInt(&usesAuto);
  3270. QString finalizedPort;
  3271. if(usesAuto)
  3272. {
  3273. QStringList portList= detectPorts();
  3274. if(autoIndex> 0&&autoIndex<=portList.size())
  3275. {
  3276. finalizedPort= portList.at(autoIndex-1);
  3277. }
  3278. else
  3279. {
  3280. imp->error= 8;
  3281. qDebug()<<"Failed to detect port.";
  3282. }
  3283. }
  3284. else
  3285. {
  3286. finalizedPort= device;
  3287. }
  3288. int rstart= finalizedPort.indexOf("COM");
  3289. finalizedPort.remove(0,rstart+3);
  3290. bool chopFinished= false;
  3291. int finalizedPortNumber= 0;
  3292. while(finalizedPort.size()> 0&&!chopFinished)
  3293. {
  3294. finalizedPortNumber= finalizedPort.toInt(&chopFinished);
  3295. if(!chopFinished)
  3296. {
  3297. finalizedPort.chop(1);
  3298. }
  3299. }
  3300. if(finalizedPortNumber<10)
  3301. {
  3302. imp->device= QString("DI10%1NT.DLL").arg(finalizedPort);
  3303. }
  3304. else
  3305. {
  3306. imp->device= QString("DI1%1NT.DLL").arg(finalizedPort);
  3307. }
  3308. imp->deviceNumber= 0x12C02D00;
  3309. imp->deviceNumber+= finalizedPortNumber;
  3310. imp->ready= true;
  3311. }
  3312. /*:906*//*907:*/
  3313. #line 523 "./dataqsdk.w"
  3314. Channel*DataqSdkDevice::newChannel(Units::Unit scale)
  3315. {
  3316. Channel*retval= NULL;
  3317. if(imp->ready)
  3318. {
  3319. retval= new Channel();
  3320. imp->channelMap[imp->channels]= retval;
  3321. imp->unitMap[imp->channels]= scale;
  3322. imp->channels++;
  3323. }
  3324. return retval;
  3325. }
  3326. /*:907*//*908:*/
  3327. #line 547 "./dataqsdk.w"
  3328. void DataqSdkDevice::setClockRate(double Hz)
  3329. {
  3330. imp->sampleRate= Hz;
  3331. }
  3332. /*:908*//*909:*/
  3333. #line 557 "./dataqsdk.w"
  3334. DataqSdkDevice::~DataqSdkDevice()
  3335. {
  3336. if(imp->ready)
  3337. {
  3338. imp->ready= false;
  3339. }
  3340. imp->wait(ULONG_MAX);
  3341. delete imp;
  3342. }
  3343. /*:909*//*910:*/
  3344. #line 575 "./dataqsdk.w"
  3345. DataqSdkDeviceImplementation::DataqSdkDeviceImplementation():QThread(NULL),
  3346. channelMap(4),error(0),channels(0),ready(false),unitMap(4)
  3347. {
  3348. }
  3349. DataqSdkDeviceImplementation::~DataqSdkDeviceImplementation()
  3350. {
  3351. if(isOpen)
  3352. {
  3353. di_stop_scan();
  3354. di_close();
  3355. }
  3356. if(driver->isLoaded())
  3357. {
  3358. driver->unload();
  3359. }
  3360. }
  3361. /*:910*/
  3362. #line 541 "./typica.w"
  3363. /*302:*/
  3364. #line 6679 "./typica.w"
  3365. void FakeDAQImplementation::measure()
  3366. {
  3367. msleep((int)(1000/clockRate));
  3368. QTime time= QTime::currentTime();
  3369. for(int i= 0;i<channels;i++)
  3370. {
  3371. Measurement measure(qrand()%500,time);
  3372. channelMap[i]->input(measure);
  3373. }
  3374. }
  3375. /*:302*//*303:*/
  3376. #line 6693 "./typica.w"
  3377. void FakeDAQImplementation::run()
  3378. {
  3379. setPriority(QThread::TimeCriticalPriority);
  3380. while(ready)
  3381. {
  3382. measure();
  3383. }
  3384. }
  3385. FakeDAQImplementation::FakeDAQImplementation():QThread(NULL),channelMap(4),
  3386. channels(0),ready(false),clockRate(1)
  3387. {
  3388. }
  3389. FakeDAQImplementation::~FakeDAQImplementation()
  3390. {
  3391. }
  3392. /*:303*//*304:*/
  3393. #line 6718 "./typica.w"
  3394. void FakeDAQ::start()
  3395. {
  3396. if(imp->ready)
  3397. {
  3398. imp->start();
  3399. }
  3400. }
  3401. FakeDAQ::FakeDAQ(QString):imp(new FakeDAQImplementation())
  3402. {
  3403. imp->ready= true;
  3404. }
  3405. Channel*FakeDAQ::newChannel(int,int)
  3406. {
  3407. Channel*retval;
  3408. if(imp->ready)
  3409. {
  3410. retval= new Channel();
  3411. imp->channelMap[imp->channels]= retval;
  3412. imp->channels++;
  3413. }
  3414. else
  3415. {
  3416. return NULL;
  3417. }
  3418. return retval;
  3419. }
  3420. void FakeDAQ::setClockRate(double Hz)
  3421. {
  3422. if(imp->ready)
  3423. {
  3424. imp->clockRate= Hz;
  3425. }
  3426. }
  3427. FakeDAQ::~FakeDAQ()
  3428. {
  3429. imp->ready= false;
  3430. imp->wait(ULONG_MAX);
  3431. delete imp;
  3432. }
  3433. /*:304*/
  3434. #line 542 "./typica.w"
  3435. /*309:*/
  3436. #line 6849 "./typica.w"
  3437. Channel::Channel():QObject(NULL)
  3438. {
  3439. }
  3440. Channel::~Channel()
  3441. {
  3442. }
  3443. void Channel::input(Measurement measurement)
  3444. {
  3445. emit newData(measurement);
  3446. }
  3447. /*:309*/
  3448. #line 543 "./typica.w"
  3449. /*325:*/
  3450. #line 7254 "./typica.w"
  3451. void TemperatureDisplay::setRelativeMode(bool relative)
  3452. {
  3453. r= relative;
  3454. }
  3455. /*:325*//*326:*/
  3456. #line 7271 "./typica.w"
  3457. void TemperatureDisplay::setValue(Measurement temperature)
  3458. {
  3459. QString number;
  3460. switch(unit)
  3461. {
  3462. case Units::Fahrenheit:
  3463. display(QString("%1'F").
  3464. arg(number.setNum(temperature.toFahrenheit().temperature(),'f',
  3465. 2)));
  3466. break;
  3467. case Units::Celsius:
  3468. if(!r){
  3469. display(QString("%1'C").
  3470. arg(number.setNum(temperature.toCelsius().temperature(),'f',
  3471. 2)));
  3472. }else{
  3473. number.setNum(temperature.temperature()*(5.0/9.0),'f',2);
  3474. display(QString("%1'C").arg(number));
  3475. }
  3476. break;
  3477. case Units::Kelvin:
  3478. if(!r){
  3479. display(QString("%1").
  3480. arg(number.setNum(temperature.toKelvin().temperature(),'f',
  3481. 2)));
  3482. }else{
  3483. number.setNum(temperature.temperature()*(5.0/9.0),'f',2);
  3484. display(QString("%1").arg(number));
  3485. }
  3486. break;
  3487. case Units::Rankine:
  3488. display(QString("%1'r").
  3489. arg(number.setNum(temperature.toRankine().temperature(),'f',
  3490. 2)));
  3491. break;
  3492. case Units::Unitless:
  3493. display(QString("%1").arg(number.setNum(temperature.temperature(),'f',0)));
  3494. break;
  3495. default:
  3496. switch(temperature.scale())
  3497. {
  3498. case Units::Fahrenheit:
  3499. display(QString("%1'F").
  3500. arg(number.setNum(temperature.temperature(),'f',2)));
  3501. break;
  3502. case Units::Celsius:
  3503. display(QString("%1'C").
  3504. arg(number.setNum(temperature.temperature(),'f',2)));
  3505. break;
  3506. case Units::Kelvin:
  3507. display(QString("%1").
  3508. arg(number.setNum(temperature.temperature(),'f',2)));
  3509. break;
  3510. case Units::Rankine:
  3511. display(QString("%1'r").
  3512. arg(number.setNum(temperature.temperature(),'f',2)));
  3513. break;
  3514. case Units::Unitless:
  3515. display(QString("%1").arg(number.setNum(temperature.temperature(),'f',0)));
  3516. break;
  3517. }
  3518. break;
  3519. }
  3520. }
  3521. /*:326*//*327:*/
  3522. #line 7347 "./typica.w"
  3523. TemperatureDisplay::TemperatureDisplay(QWidget*parent):
  3524. QLCDNumber(8,parent),unit(Units::Fahrenheit),r(false)
  3525. {
  3526. setSegmentStyle(Filled);
  3527. display("---.--'F");
  3528. }
  3529. /*:327*//*328:*/
  3530. #line 7363 "./typica.w"
  3531. void TemperatureDisplay::invalidate()
  3532. {
  3533. display("---.--'F");
  3534. }
  3535. /*:328*//*329:*/
  3536. #line 7375 "./typica.w"
  3537. void TemperatureDisplay::setDisplayUnits(Units::Unit scale)
  3538. {
  3539. unit= scale;
  3540. }
  3541. /*:329*//*330:*/
  3542. #line 7383 "./typica.w"
  3543. TemperatureDisplay::~TemperatureDisplay()
  3544. {
  3545. }
  3546. /*:330*/
  3547. #line 544 "./typica.w"
  3548. /*336:*/
  3549. #line 7483 "./typica.w"
  3550. void MeasurementTimeOffset::newMeasurement(Measurement measure)
  3551. {
  3552. if(measure.time()<epoch)
  3553. {
  3554. if(hasPrevious)
  3555. {
  3556. QTime jitBase(epoch.hour()-1,epoch.minute(),epoch.second(),
  3557. epoch.msec());
  3558. QTime jitComp(epoch.hour(),measure.time().minute(),
  3559. measure.time().second(),measure.time().msec());
  3560. int relTime= jitBase.msecsTo(jitComp);
  3561. /*337:*/
  3562. #line 7517 "./typica.w"
  3563. QTime newTime(0,0,0,0);
  3564. newTime= newTime.addMSecs(relTime);
  3565. if(newTime.hour()> 0)
  3566. {
  3567. newTime.setHMS(0,newTime.minute(),newTime.second(),newTime.msec());
  3568. }
  3569. Measurement rel= measure;
  3570. rel.setTime(newTime);
  3571. emit measurement(rel);
  3572. /*:337*/
  3573. #line 7495 "./typica.w"
  3574. }
  3575. else
  3576. {
  3577. Measurement rel= measure;
  3578. rel.setTime(QTime(0,0,0,0));
  3579. emit measurement(rel);
  3580. }
  3581. }
  3582. else
  3583. {
  3584. int relTime= epoch.msecsTo(measure.time());
  3585. /*337:*/
  3586. #line 7517 "./typica.w"
  3587. QTime newTime(0,0,0,0);
  3588. newTime= newTime.addMSecs(relTime);
  3589. if(newTime.hour()> 0)
  3590. {
  3591. newTime.setHMS(0,newTime.minute(),newTime.second(),newTime.msec());
  3592. }
  3593. Measurement rel= measure;
  3594. rel.setTime(newTime);
  3595. emit measurement(rel);
  3596. /*:337*/
  3597. #line 7507 "./typica.w"
  3598. }
  3599. hasPrevious= true;
  3600. previous= measure.time();
  3601. }
  3602. /*:336*//*338:*/
  3603. #line 7530 "./typica.w"
  3604. MeasurementTimeOffset::MeasurementTimeOffset(QTime zero):epoch(zero),
  3605. previous(0,0,0,0),hasPrevious(false)
  3606. {
  3607. }
  3608. QTime MeasurementTimeOffset::zeroTime()
  3609. {
  3610. return epoch;
  3611. }
  3612. void MeasurementTimeOffset::setZeroTime(QTime zero)
  3613. {
  3614. epoch= zero;
  3615. hasPrevious= false;
  3616. }
  3617. /*:338*/
  3618. #line 545 "./typica.w"
  3619. /*348:*/
  3620. #line 7728 "./typica.w"
  3621. ZeroEmitter::ZeroEmitter(int tempcolumn):QObject(NULL),col(tempcolumn)
  3622. {
  3623. }
  3624. int ZeroEmitter::column()
  3625. {
  3626. return col;
  3627. }
  3628. double ZeroEmitter::lastTemperature()
  3629. {
  3630. return cache.temperature();
  3631. }
  3632. void ZeroEmitter::newMeasurement(Measurement measure)
  3633. {
  3634. cache= measure;
  3635. }
  3636. void ZeroEmitter::setColumn(int column)
  3637. {
  3638. col= column;
  3639. }
  3640. void ZeroEmitter::emitZero()
  3641. {
  3642. cache.setTime(QTime(0,0,0,0));
  3643. emit measurement(cache,col);
  3644. }
  3645. /*:348*/
  3646. #line 546 "./typica.w"
  3647. /*353:*/
  3648. #line 7818 "./typica.w"
  3649. MeasurementAdapter::MeasurementAdapter(int tempcolumn):col(tempcolumn)
  3650. {
  3651. }
  3652. int MeasurementAdapter::column()
  3653. {
  3654. return col;
  3655. }
  3656. void MeasurementAdapter::newMeasurement(Measurement measure)
  3657. {
  3658. emit measurement(measure,col);
  3659. }
  3660. void MeasurementAdapter::setColumn(int column)
  3661. {
  3662. col= column;
  3663. }
  3664. /*:353*/
  3665. #line 547 "./typica.w"
  3666. /*358:*/
  3667. #line 7940 "./typica.w"
  3668. GraphView::GraphView(QWidget*parent):QGraphicsView(parent),
  3669. theScene(new QGraphicsScene),
  3670. graphLines(new QMap<int,QList<QGraphicsLineItem*> *> ),
  3671. prevPoints(new QMap<int,QPointF> ),
  3672. translations(new QMap<int,double> ),
  3673. gridLinesF(new QList<QGraphicsItem*> ),
  3674. gridLinesC(new QList<QGraphicsItem*> ),
  3675. relativeGridLines(new QList<QGraphicsItem*> ),
  3676. relativeEnabled(false),
  3677. timeIndicatorEnabled(false),
  3678. timeLine(new QGraphicsLineItem),
  3679. relativeAdjuster(new LinearSplineInterpolator)
  3680. {
  3681. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  3682. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  3683. setScene(theScene);
  3684. setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
  3685. QPen timePen;
  3686. timePen.setColor(QColor(160,160,164,127));
  3687. timeLine->setPen(timePen);
  3688. timeLine->setLine(0,0,0,-500);
  3689. timeLine->hide();
  3690. theScene->addItem(timeLine);
  3691. /*359:*/
  3692. #line 7980 "./typica.w"
  3693. QGraphicsLineItem*tempaxis= new QGraphicsLineItem;
  3694. tempaxis->setLine(-10,-500,-10,0);
  3695. theScene->addItem(tempaxis);
  3696. QGraphicsLineItem*gridLine;
  3697. QGraphicsTextItem*label;
  3698. for(int y= -100;y> -600;y-= 100)
  3699. {
  3700. gridLine= new QGraphicsLineItem;
  3701. gridLine->setLine(0,y,1200,y);
  3702. theScene->addItem(gridLine);
  3703. label= new QGraphicsTextItem;
  3704. label->setHtml(QString("%1&deg;F").arg(-y));
  3705. label->setPos(-55,y-(label->boundingRect().height()/2));
  3706. theScene->addItem(label);
  3707. gridLinesF->append(gridLine);
  3708. gridLinesF->append(label);
  3709. }
  3710. for(int degC= 50;degC<=250;degC+= 50)
  3711. {
  3712. gridLine= new QGraphicsLineItem;
  3713. int y= -(degC*(9.0/5.0)+32);
  3714. gridLine->setLine(0,y,1200,y);
  3715. gridLine->hide();
  3716. theScene->addItem(gridLine);
  3717. gridLinesC->append(gridLine);
  3718. label= new QGraphicsTextItem;
  3719. label->setHtml(QString("%1&deg;C").arg(degC));
  3720. label->setPos(-55,y-(label->boundingRect().height()/2));
  3721. label->hide();
  3722. theScene->addItem(label);
  3723. gridLinesC->append(label);
  3724. }
  3725. /*:359*/
  3726. #line 7964 "./typica.w"
  3727. ;
  3728. /*360:*/
  3729. #line 8021 "./typica.w"
  3730. QSettings settings;
  3731. if(settings.contains("settings/graph/relative/enable"))
  3732. {
  3733. if(settings.value("settings/graph/relative/enable").toBool())
  3734. {
  3735. relativeEnabled= true;
  3736. QColor relativeColor= QColor(settings.value("settings/graph/relative/color").toString());
  3737. QString unit= QString(settings.value("settings/graph/relative/unit").toInt()==0?"F":"C");
  3738. QMap<double,QString> relativeAxisPairs;
  3739. QStringList relativeAxisLabels= settings.value("settings/graph/relative/grid").toString().split(QRegExp("[\\s,]+"),QString::SkipEmptyParts);
  3740. foreach(QString item,relativeAxisLabels)
  3741. {
  3742. relativeAxisPairs.insert(item.toDouble(),item);
  3743. }
  3744. if(relativeAxisPairs.size()> 1)
  3745. {
  3746. double skip= 500.0/(relativeAxisPairs.size()-1);
  3747. double y= 0;
  3748. foreach(double key,relativeAxisPairs.keys())
  3749. {
  3750. gridLine= new QGraphicsLineItem;
  3751. gridLine->setLine(0,y,1205,y);
  3752. gridLine->setPen(QPen(relativeColor));
  3753. theScene->addItem(gridLine);
  3754. relativeGridLines->append(gridLine);
  3755. label= new QGraphicsTextItem;
  3756. label->setHtml(QString("%1&deg;%2").arg(relativeAxisPairs.value(key)).arg(unit));
  3757. label->setPos(1210,y-(label->boundingRect().height()/2));
  3758. theScene->addItem(label);
  3759. relativeGridLines->append(label);
  3760. if(unit=="F")
  3761. {
  3762. relativeAdjuster->add_pair(key,-y);
  3763. }
  3764. else
  3765. {
  3766. relativeAdjuster->add_pair(key*(9.0/5.0),-y);
  3767. }
  3768. y-= skip;
  3769. }
  3770. }
  3771. }
  3772. }
  3773. /*:360*/
  3774. #line 7965 "./typica.w"
  3775. /*362:*/
  3776. #line 8098 "./typica.w"
  3777. QGraphicsLineItem*timeaxis= new QGraphicsLineItem;
  3778. timeaxis->setLine(0,10,1200,10);
  3779. theScene->addItem(timeaxis);
  3780. for(int x= 0;x<1201;x+= 120)
  3781. {
  3782. QGraphicsLineItem*tick= new QGraphicsLineItem;
  3783. tick->setLine(x,0,x,20);
  3784. theScene->addItem(tick);
  3785. QGraphicsTextItem*label= new QGraphicsTextItem;
  3786. label->setPlainText(QString("%1").arg(x/60));
  3787. label->setPos(x-(label->boundingRect().width()/2),20);
  3788. theScene->addItem(label);
  3789. }
  3790. /*:362*/
  3791. #line 7966 "./typica.w"
  3792. ;
  3793. fitInView(theScene->sceneRect().adjusted(-50,-50,50,50));
  3794. }
  3795. /*:358*//*361:*/
  3796. #line 8068 "./typica.w"
  3797. void GraphView::showF()
  3798. {
  3799. for(int i= 0;i<gridLinesF->size();i++)
  3800. {
  3801. gridLinesF->at(i)->show();
  3802. }
  3803. for(int i= 0;i<gridLinesC->size();i++)
  3804. {
  3805. gridLinesC->at(i)->hide();
  3806. }
  3807. }
  3808. void GraphView::showC()
  3809. {
  3810. for(int i= 0;i<gridLinesF->size();i++)
  3811. {
  3812. gridLinesF->at(i)->hide();
  3813. }
  3814. for(int i= 0;i<gridLinesC->size();i++)
  3815. {
  3816. gridLinesC->at(i)->show();
  3817. }
  3818. }
  3819. /*:361*//*363:*/
  3820. #line 8117 "./typica.w"
  3821. void GraphView::resizeEvent(QResizeEvent*)
  3822. {
  3823. fitInView(theScene->sceneRect().adjusted(-50,-50,50,50));
  3824. }
  3825. /*:363*//*364:*/
  3826. #line 8131 "./typica.w"
  3827. #define FULLTIMETOINT(t) (t.msec() + (t.second() * 1000) + (t.minute() * 60 * 1000))
  3828. void GraphView::newMeasurement(Measurement measure,int tempcolumn)
  3829. {
  3830. double offset= 0;
  3831. if(measure.contains("relative"))
  3832. {
  3833. if(measure.value("relative").toBool())
  3834. {
  3835. if(relativeEnabled)
  3836. {
  3837. measure.setTemperature(relativeAdjuster->newMeasurement(measure).temperature());
  3838. }
  3839. else
  3840. {
  3841. return;
  3842. }
  3843. }
  3844. }
  3845. if(translations->contains(tempcolumn))
  3846. {
  3847. offset= translations->value(tempcolumn);
  3848. }
  3849. if(prevPoints->contains(tempcolumn))
  3850. {
  3851. /*366:*/
  3852. #line 8208 "./typica.w"
  3853. QGraphicsLineItem*segment= new QGraphicsLineItem;
  3854. QPointF nextPoint(FULLTIMETOINT(measure.time())/1000,measure.temperature());
  3855. segment->setLine(prevPoints->value(tempcolumn).x()+offset,
  3856. -(prevPoints->value(tempcolumn).y()),
  3857. nextPoint.x()+offset,-(nextPoint.y()));
  3858. static QColor p[12]= {Qt::yellow,Qt::blue,Qt::cyan,Qt::red,Qt::magenta,
  3859. Qt::green,Qt::darkGreen,Qt::darkMagenta,
  3860. Qt::darkRed,Qt::darkCyan,Qt::darkBlue,
  3861. Qt::darkYellow};
  3862. segment->setPen(p[tempcolumn%12]);
  3863. theScene->addItem(segment);
  3864. prevPoints->insert(tempcolumn,nextPoint);
  3865. if(timeIndicatorEnabled)
  3866. {
  3867. timeLine->setLine(nextPoint.x()+offset,0,nextPoint.x()+offset,-500);
  3868. }
  3869. /*:366*/
  3870. #line 8157 "./typica.w"
  3871. if(graphLines->contains(tempcolumn))
  3872. {
  3873. graphLines->value(tempcolumn)->append(segment);
  3874. }
  3875. else
  3876. {
  3877. QList<QGraphicsLineItem*> *newLine=
  3878. new QList<QGraphicsLineItem*> ;
  3879. newLine->append(segment);
  3880. graphLines->insert(tempcolumn,newLine);
  3881. }
  3882. }
  3883. else
  3884. {
  3885. /*365:*/
  3886. #line 8193 "./typica.w"
  3887. int x= FULLTIMETOINT(measure.time())/1000;
  3888. prevPoints->insert(tempcolumn,QPointF(x,measure.temperature()));
  3889. if(timeIndicatorEnabled)
  3890. {
  3891. timeLine->setLine(x,0,x,-500);
  3892. }
  3893. /*:365*/
  3894. #line 8174 "./typica.w"
  3895. }
  3896. }
  3897. /*:364*//*367:*/
  3898. #line 8229 "./typica.w"
  3899. void GraphView::clear()
  3900. {
  3901. int i;
  3902. foreach(i,prevPoints->keys())
  3903. {
  3904. removeSeries(i);
  3905. }
  3906. translations->clear();
  3907. }
  3908. /*:367*//*368:*/
  3909. #line 8243 "./typica.w"
  3910. void GraphView::removeSeries(int column)
  3911. {
  3912. if(graphLines->contains(column))
  3913. {
  3914. QList<QGraphicsLineItem*> *series= graphLines->value(column);
  3915. QGraphicsLineItem*segment;
  3916. foreach(segment,*series)
  3917. {
  3918. theScene->removeItem(segment);
  3919. }
  3920. qDeleteAll(*series);
  3921. }
  3922. graphLines->remove(column);
  3923. prevPoints->remove(column);
  3924. }
  3925. /*:368*//*369:*/
  3926. #line 8262 "./typica.w"
  3927. void GraphView::setSeriesTranslation(int column,double offset)
  3928. {
  3929. if(graphLines->contains(column))
  3930. {
  3931. QList<QGraphicsLineItem*> *series= graphLines->value(column);
  3932. QGraphicsLineItem*segment;
  3933. foreach(segment,*series)
  3934. {
  3935. segment->setPos(segment->pos().x()+offset,segment->pos().y());
  3936. }
  3937. }
  3938. if(translations->contains(column))
  3939. {
  3940. translations->insert(column,offset+translations->value(column));
  3941. }
  3942. else
  3943. {
  3944. translations->insert(column,offset);
  3945. }
  3946. }
  3947. /*:369*//*370:*/
  3948. #line 8289 "./typica.w"
  3949. void GraphView::setTimeIndicatorEnabled(bool enabled)
  3950. {
  3951. timeIndicatorEnabled= enabled;
  3952. if(enabled)
  3953. {
  3954. timeLine->show();
  3955. }
  3956. else
  3957. {
  3958. timeLine->hide();
  3959. }
  3960. }
  3961. /*:370*/
  3962. #line 548 "./typica.w"
  3963. /*376:*/
  3964. #line 8433 "./typica.w"
  3965. void ZoomLog::newMeasurement(Measurement measure,int tempcolumn)
  3966. {
  3967. if(measure.time()!=QTime(0,0,0,0))
  3968. {
  3969. /*378:*/
  3970. #line 8507 "./typica.w"
  3971. if(lastMeasurement.contains(tempcolumn))
  3972. {
  3973. if(lastMeasurement[tempcolumn].time()<measure.time())
  3974. {
  3975. QList<QTime> timelist;
  3976. for(QTime i= lastMeasurement.value(tempcolumn).time().addSecs(1);i<measure.time();i= i.addSecs(1))
  3977. {
  3978. timelist.append(i);
  3979. }
  3980. for(int i= 0;i<timelist.size();i++)
  3981. {
  3982. Measurement synthesized= measure;
  3983. synthesized.setTime(timelist[i]);
  3984. newMeasurement(synthesized,tempcolumn);
  3985. }
  3986. }
  3987. }
  3988. /*:378*/
  3989. #line 8438 "./typica.w"
  3990. }
  3991. model_ms->newMeasurement(measure,tempcolumn);
  3992. if(lastMeasurement.contains(tempcolumn))
  3993. {
  3994. if(measure.time().second()!=
  3995. lastMeasurement.value(tempcolumn).time().second())
  3996. {
  3997. Measurement adjusted= measure;
  3998. QTime adjtime(0,measure.time().minute(),measure.time().second(),0);
  3999. adjusted.setTime(adjtime);
  4000. model_1s->newMeasurement(adjusted,tempcolumn);
  4001. if(adjusted.time().second()%5==0)
  4002. {
  4003. model_5s->newMeasurement(adjusted,tempcolumn);
  4004. if(adjusted.time().second()%10==0)
  4005. {
  4006. model_10s->newMeasurement(adjusted,tempcolumn);
  4007. }
  4008. if(adjusted.time().second()%15==0)
  4009. {
  4010. model_15s->newMeasurement(adjusted,tempcolumn);
  4011. if(adjusted.time().second()%30==0)
  4012. {
  4013. model_30s->newMeasurement(adjusted,tempcolumn);
  4014. if(adjusted.time().second()==0)
  4015. {
  4016. model_1m->newMeasurement(adjusted,tempcolumn);
  4017. }
  4018. }
  4019. }
  4020. }
  4021. }
  4022. /*380:*/
  4023. #line 8551 "./typica.w"
  4024. if(currentColumnSet.contains(tempcolumn))
  4025. {
  4026. int replicationcolumn;
  4027. foreach(replicationcolumn,currentColumnSet)
  4028. {
  4029. if(replicationcolumn!=tempcolumn)
  4030. {
  4031. if(lastMeasurement.contains(replicationcolumn))
  4032. {
  4033. if(measure.time()> lastMeasurement.value(replicationcolumn).time())
  4034. {
  4035. Measurement synthetic= lastMeasurement.value(replicationcolumn);
  4036. synthetic.setTime(measure.time());
  4037. model_ms->newMeasurement(synthetic,replicationcolumn);
  4038. if(synthetic.time().second()!=lastMeasurement.value(replicationcolumn).time().second())
  4039. {
  4040. Measurement adjusted= synthetic;
  4041. adjusted.setTime(QTime(0,synthetic.time().minute(),synthetic.time().second(),0));
  4042. model_1s->newMeasurement(adjusted,replicationcolumn);
  4043. if(adjusted.time().second()%5==0)
  4044. {
  4045. model_5s->newMeasurement(adjusted,replicationcolumn);
  4046. if(adjusted.time().second()%10==0)
  4047. {
  4048. model_10s->newMeasurement(adjusted,replicationcolumn);
  4049. }
  4050. if(adjusted.time().second()%15==0)
  4051. {
  4052. model_15s->newMeasurement(adjusted,replicationcolumn);
  4053. if(adjusted.time().second()%30==0)
  4054. {
  4055. model_30s->newMeasurement(adjusted,replicationcolumn);
  4056. if(adjusted.time().second()==0)
  4057. {
  4058. model_1m->newMeasurement(adjusted,replicationcolumn);
  4059. }
  4060. }
  4061. }
  4062. }
  4063. }
  4064. lastMeasurement[replicationcolumn]= synthetic;
  4065. }
  4066. }
  4067. }
  4068. }
  4069. }
  4070. /*:380*/
  4071. #line 8471 "./typica.w"
  4072. }
  4073. else
  4074. {
  4075. /*377:*/
  4076. #line 8483 "./typica.w"
  4077. MeasurementModel*m;
  4078. foreach(m,modelSet)
  4079. {
  4080. m->newMeasurement(measure,tempcolumn);
  4081. }
  4082. /*:377*/
  4083. #line 8475 "./typica.w"
  4084. }
  4085. lastMeasurement.insert(tempcolumn,measure);
  4086. }
  4087. /*:376*//*379:*/
  4088. #line 8537 "./typica.w"
  4089. void ZoomLog::addToCurrentColumnSet(int column)
  4090. {
  4091. currentColumnSet.append(column);
  4092. }
  4093. void ZoomLog::clearCurrentColumnSet()
  4094. {
  4095. currentColumnSet.clear();
  4096. }
  4097. /*:379*//*381:*/
  4098. #line 8621 "./typica.w"
  4099. void ZoomLog::newAnnotation(QString annotation,int tempcolumn,
  4100. int annotationcolumn)
  4101. {
  4102. model_ms->newAnnotation(annotation,tempcolumn,annotationcolumn);
  4103. MeasurementModel*m;
  4104. if(lastMeasurement.contains(tempcolumn))
  4105. {
  4106. foreach(m,modelSet)
  4107. {
  4108. m->newMeasurement(lastMeasurement.value(tempcolumn),tempcolumn);
  4109. }
  4110. }
  4111. foreach(m,modelSet)
  4112. {
  4113. m->newAnnotation(annotation,tempcolumn,annotationcolumn);
  4114. }
  4115. }
  4116. /*:381*//*382:*/
  4117. #line 8645 "./typica.w"
  4118. void ZoomLog::centerOn(int row)
  4119. {
  4120. scrollTo(currentModel->index(row,0),QAbstractItemView::PositionAtCenter);
  4121. }
  4122. /*:382*//*383:*/
  4123. #line 8655 "./typica.w"
  4124. void ZoomLog::clear()
  4125. {
  4126. MeasurementModel*m;
  4127. foreach(m,modelSet)
  4128. {
  4129. m->clear();
  4130. }
  4131. lastMeasurement.clear();
  4132. saveTempCols.clear();
  4133. saveControlCols.clear();
  4134. saveNoteCols.clear();
  4135. }
  4136. /*:383*//*384:*/
  4137. #line 8673 "./typica.w"
  4138. QVariant ZoomLog::data(int row,int column)const
  4139. {
  4140. return model_ms->data(model_ms->index(row,column,QModelIndex()),
  4141. Qt::DisplayRole);
  4142. }
  4143. int ZoomLog::rowCount()
  4144. {
  4145. return model_ms->rowCount();
  4146. }
  4147. /*:384*//*385:*/
  4148. #line 8696 "./typica.w"
  4149. bool ZoomLog::saveXML(QIODevice*device)
  4150. {
  4151. Units::Unit prevUnits= model_ms->displayUnits();
  4152. if(prevUnits!=Units::Fahrenheit)
  4153. {
  4154. model_ms->setDisplayUnits(Units::Fahrenheit);
  4155. }
  4156. XMLOutput writer(model_ms,device,0);
  4157. int c;
  4158. foreach(c,saveTempCols)
  4159. {
  4160. writer.addTemperatureColumn(model_ms->headerData(c,Qt::Horizontal).
  4161. toString(),c);
  4162. }
  4163. foreach(c,saveControlCols)
  4164. {
  4165. writer.addControlColumn(model_ms->headerData(c,Qt::Horizontal).
  4166. toString(),c);
  4167. }
  4168. foreach(c,saveNoteCols)
  4169. {
  4170. writer.addAnnotationColumn(model_ms->headerData(c,Qt::Horizontal).
  4171. toString(),c);
  4172. }
  4173. bool retval= writer.output();
  4174. if(prevUnits!=Units::Fahrenheit)
  4175. {
  4176. model_ms->setDisplayUnits(prevUnits);
  4177. }
  4178. return retval;
  4179. }
  4180. /*:385*//*386:*/
  4181. #line 8732 "./typica.w"
  4182. bool ZoomLog::saveCSV(QIODevice*device)
  4183. {
  4184. CSVOutput writer(currentModel,device,0);
  4185. int c;
  4186. foreach(c,saveTempCols)
  4187. {
  4188. writer.addTemperatureColumn(model_ms->headerData(c,Qt::Horizontal).
  4189. toString(),c);
  4190. }
  4191. foreach(c,saveControlCols)
  4192. {
  4193. writer.addControlColumn(model_ms->headerData(c,Qt::Horizontal).
  4194. toString(),c);
  4195. }
  4196. foreach(c,saveNoteCols)
  4197. {
  4198. writer.addAnnotationColumn(model_ms->headerData(c,Qt::Horizontal).
  4199. toString(),c);
  4200. }
  4201. return writer.output();
  4202. }
  4203. /*:386*//*387:*/
  4204. #line 8761 "./typica.w"
  4205. void ZoomLog::switchLOD(MeasurementModel*m)
  4206. {
  4207. disconnect(currentModel,SIGNAL(rowChanged(int)),this,0);
  4208. setModel(m);
  4209. currentModel= m;
  4210. connect(currentModel,SIGNAL(rowChanged(int)),this,SLOT(centerOn(int)));
  4211. }
  4212. void ZoomLog::LOD_ms()
  4213. {
  4214. switchLOD(model_ms);
  4215. }
  4216. void ZoomLog::LOD_1s()
  4217. {
  4218. switchLOD(model_1s);
  4219. }
  4220. void ZoomLog::LOD_5s()
  4221. {
  4222. switchLOD(model_5s);
  4223. }
  4224. void ZoomLog::LOD_10s()
  4225. {
  4226. switchLOD(model_10s);
  4227. }
  4228. void ZoomLog::LOD_15s()
  4229. {
  4230. switchLOD(model_15s);
  4231. }
  4232. void ZoomLog::LOD_30s()
  4233. {
  4234. switchLOD(model_30s);
  4235. }
  4236. void ZoomLog::LOD_1m()
  4237. {
  4238. switchLOD(model_1m);
  4239. }
  4240. /*:387*//*388:*/
  4241. #line 8809 "./typica.w"
  4242. void ZoomLog::setDisplayUnits(Units::Unit scale)
  4243. {
  4244. model_ms->setDisplayUnits(scale);
  4245. model_1s->setDisplayUnits(scale);
  4246. model_5s->setDisplayUnits(scale);
  4247. model_10s->setDisplayUnits(scale);
  4248. model_15s->setDisplayUnits(scale);
  4249. model_30s->setDisplayUnits(scale);
  4250. model_1m->setDisplayUnits(scale);
  4251. }
  4252. Units::Unit ZoomLog::displayUnits()
  4253. {
  4254. return model_ms->displayUnits();
  4255. }
  4256. /*:388*//*389:*/
  4257. #line 8829 "./typica.w"
  4258. QString ZoomLog::lastTime(int series)
  4259. {
  4260. Measurement measure= lastMeasurement.value(series);
  4261. QTime time= measure.time();
  4262. return time.toString("h:mm:ss.zzz");
  4263. }
  4264. /*:389*//*390:*/
  4265. #line 8839 "./typica.w"
  4266. ZoomLog::ZoomLog():QTableView(NULL),model_ms(new MeasurementModel(this)),
  4267. model_1s(new MeasurementModel(this)),model_5s(new MeasurementModel(this)),
  4268. model_10s(new MeasurementModel(this)),model_15s(new MeasurementModel(this)),
  4269. model_30s(new MeasurementModel(this)),model_1m(new MeasurementModel(this))
  4270. {
  4271. setEditTriggers(QAbstractItemView::NoEditTriggers);
  4272. setSelectionMode(QAbstractItemView::NoSelection);
  4273. modelSet<<model_ms<<model_1s<<model_5s<<model_10s<<model_15s<<
  4274. model_30s<<model_1m;
  4275. currentModel= model_30s;
  4276. setModel(currentModel);
  4277. connect(currentModel,SIGNAL(rowChanged(int)),this,SLOT(centerOn(int)));
  4278. connect(horizontalHeader(),SIGNAL(sectionResized(int,int,int)),
  4279. this,SLOT(persistColumnResize(int,int,int)));
  4280. connect(horizontalHeader(),SIGNAL(sectionCountChanged(int,int)),
  4281. this,SLOT(restoreColumnWidths()));
  4282. }
  4283. /*:390*//*391:*/
  4284. #line 8862 "./typica.w"
  4285. void ZoomLog::setHeaderData(int section,QString text)
  4286. {
  4287. MeasurementModel*m;
  4288. foreach(m,modelSet)
  4289. {
  4290. m->setHeaderData(section,Qt::Horizontal,QVariant(text));
  4291. }
  4292. }
  4293. /*:391*//*392:*/
  4294. #line 8880 "./typica.w"
  4295. void ZoomLog::addOutputTemperatureColumn(int column)
  4296. {
  4297. saveTempCols.append(column);
  4298. }
  4299. void ZoomLog::addOutputControlColumn(int column)
  4300. {
  4301. saveControlCols.append(column);
  4302. }
  4303. void ZoomLog::addOutputAnnotationColumn(int column)
  4304. {
  4305. saveNoteCols.append(column);
  4306. }
  4307. void ZoomLog::clearOutputColumns()
  4308. {
  4309. saveTempCols.clear();
  4310. saveControlCols.clear();
  4311. saveNoteCols.clear();
  4312. }
  4313. /*:392*//*393:*/
  4314. #line 8906 "./typica.w"
  4315. void ZoomLog::persistColumnResize(int column,int,int newsize)
  4316. {
  4317. /*607:*/
  4318. #line 13011 "./typica.w"
  4319. QSettings settings;
  4320. /*608:*/
  4321. #line 13024 "./typica.w"
  4322. QWidget*topLevelWidget= this;
  4323. while(topLevelWidget->parentWidget())
  4324. {
  4325. topLevelWidget= topLevelWidget->parentWidget();
  4326. }
  4327. /*:608*/
  4328. #line 13013 "./typica.w"
  4329. settings.setValue(QString("columnWidths/%1/%2/%3").
  4330. arg(topLevelWidget->objectName()).
  4331. arg(objectName()).arg(column),
  4332. QVariant(newsize));
  4333. /*:607*/
  4334. #line 8909 "./typica.w"
  4335. }
  4336. void ZoomLog::restoreColumnWidths()
  4337. {
  4338. /*610:*/
  4339. #line 13044 "./typica.w"
  4340. QSettings settings;
  4341. /*608:*/
  4342. #line 13024 "./typica.w"
  4343. QWidget*topLevelWidget= this;
  4344. while(topLevelWidget->parentWidget())
  4345. {
  4346. topLevelWidget= topLevelWidget->parentWidget();
  4347. }
  4348. /*:608*/
  4349. #line 13046 "./typica.w"
  4350. QString baseKey=
  4351. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  4352. arg(objectName());
  4353. for(int i= 0;i<model()->columnCount();i++)
  4354. {
  4355. QString key= QString("%1/%2").arg(baseKey).arg(i);
  4356. if(settings.contains(key))
  4357. {
  4358. setColumnWidth(i,settings.value(key).toInt());
  4359. }
  4360. }
  4361. /*:610*/
  4362. #line 8914 "./typica.w"
  4363. }
  4364. void ZoomLog::setVisible(bool visibility)
  4365. {
  4366. QTableView::setVisible(visibility);
  4367. }
  4368. void ZoomLog::showEvent(QShowEvent*)
  4369. {
  4370. /*610:*/
  4371. #line 13044 "./typica.w"
  4372. QSettings settings;
  4373. /*608:*/
  4374. #line 13024 "./typica.w"
  4375. QWidget*topLevelWidget= this;
  4376. while(topLevelWidget->parentWidget())
  4377. {
  4378. topLevelWidget= topLevelWidget->parentWidget();
  4379. }
  4380. /*:608*/
  4381. #line 13046 "./typica.w"
  4382. QString baseKey=
  4383. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  4384. arg(objectName());
  4385. for(int i= 0;i<model()->columnCount();i++)
  4386. {
  4387. QString key= QString("%1/%2").arg(baseKey).arg(i);
  4388. if(settings.contains(key))
  4389. {
  4390. setColumnWidth(i,settings.value(key).toInt());
  4391. }
  4392. }
  4393. /*:610*/
  4394. #line 8924 "./typica.w"
  4395. }
  4396. /*:393*/
  4397. #line 549 "./typica.w"
  4398. /*402:*/
  4399. #line 9157 "./typica.w"
  4400. bool MeasurementList::operator<(const MeasurementList&other)const
  4401. {
  4402. return this->first().toTime()<other.first().toTime();
  4403. }
  4404. bool MeasurementList::operator==(const MeasurementList&other)const
  4405. {
  4406. return this->first().toTime()==other.first().toTime();
  4407. }
  4408. /*:402*//*403:*/
  4409. #line 9173 "./typica.w"
  4410. QModelIndex MeasurementModel::parent(const QModelIndex&)const
  4411. {
  4412. return QModelIndex();
  4413. }
  4414. /*:403*//*404:*/
  4415. #line 9183 "./typica.w"
  4416. void MeasurementModel::newMeasurement(Measurement measure,int tempcolumn)
  4417. {
  4418. if(measure.scale()==Units::Unitless)
  4419. {
  4420. controlColumns->insert(tempcolumn,true);
  4421. }
  4422. else
  4423. {
  4424. controlColumns->insert(tempcolumn,false);
  4425. }
  4426. MeasurementList*temp;
  4427. temp= new MeasurementList;
  4428. temp->append(QVariant(measure.time()));
  4429. /*405:*/
  4430. #line 9242 "./typica.w"
  4431. /*406:*/
  4432. #line 9287 "./typica.w"
  4433. QList<MeasurementList*> ::iterator i= lastInsertion;
  4434. bool quickscan= false;
  4435. if(entries->size()> 5)
  4436. {
  4437. if(**i<*temp)
  4438. {
  4439. i+= 1;
  4440. for(int j= 10;j> 0;j--)
  4441. {
  4442. if(i!=entries->end())
  4443. {
  4444. if(**i<*temp)
  4445. {
  4446. i+= 1;
  4447. }
  4448. else
  4449. {
  4450. quickscan= true;
  4451. break;
  4452. }
  4453. }
  4454. else
  4455. {
  4456. quickscan= true;
  4457. break;
  4458. }
  4459. }
  4460. }
  4461. else
  4462. {
  4463. if(**i==*temp)
  4464. {
  4465. quickscan= true;
  4466. }
  4467. }
  4468. }
  4469. /*:406*/
  4470. #line 9243 "./typica.w"
  4471. if(quickscan==false)
  4472. {
  4473. i= entries->begin();
  4474. QList<MeasurementList*> ::iterator u= entries->end();
  4475. QList<MeasurementList*> ::iterator midpoint;
  4476. int n= u-i;
  4477. int rA;
  4478. while(n> 0)
  4479. {
  4480. rA= n>>1;
  4481. midpoint= i+rA;
  4482. if(**midpoint<*temp)
  4483. {
  4484. i= midpoint+1;
  4485. n-= rA+1;
  4486. }
  4487. else
  4488. {
  4489. n= rA;
  4490. }
  4491. }
  4492. }
  4493. /*:405*/
  4494. #line 9197 "./typica.w"
  4495. MeasurementList*newEntry;
  4496. int insertion;
  4497. if(i!=entries->end())
  4498. {
  4499. insertion= entries->indexOf(*i);
  4500. if((*i)->first().toTime()==measure.time())
  4501. {
  4502. /*407:*/
  4503. #line 9329 "./typica.w"
  4504. if((*i)->size()<tempcolumn+1)
  4505. {
  4506. for(int j= (*i)->size()-1;j<tempcolumn+1;j++)
  4507. {
  4508. (*i)->append(QVariant());
  4509. }
  4510. }
  4511. (*i)->replace(tempcolumn,measure);
  4512. lastInsertion= i;
  4513. emit dataChanged(createIndex(insertion,tempcolumn),
  4514. createIndex(insertion,tempcolumn));
  4515. lastTemperature->insert(tempcolumn,insertion);
  4516. /*:407*/
  4517. #line 9205 "./typica.w"
  4518. }
  4519. else
  4520. {
  4521. /*408:*/
  4522. #line 9347 "./typica.w"
  4523. beginInsertRows(QModelIndex(),insertion,insertion);
  4524. newEntry= new MeasurementList;
  4525. newEntry->append(QVariant(measure.time()));
  4526. for(int j= 0;j<tempcolumn+1;j++)
  4527. {
  4528. newEntry->append(QVariant());
  4529. }
  4530. newEntry->replace(tempcolumn,measure);
  4531. lastInsertion= entries->insert(i,newEntry);
  4532. endInsertRows();
  4533. lastTemperature->insert(tempcolumn,insertion);
  4534. /*:408*/
  4535. #line 9209 "./typica.w"
  4536. }
  4537. }
  4538. else
  4539. {
  4540. /*409:*/
  4541. #line 9365 "./typica.w"
  4542. insertion= entries->size();
  4543. /*408:*/
  4544. #line 9347 "./typica.w"
  4545. beginInsertRows(QModelIndex(),insertion,insertion);
  4546. newEntry= new MeasurementList;
  4547. newEntry->append(QVariant(measure.time()));
  4548. for(int j= 0;j<tempcolumn+1;j++)
  4549. {
  4550. newEntry->append(QVariant());
  4551. }
  4552. newEntry->replace(tempcolumn,measure);
  4553. lastInsertion= entries->insert(i,newEntry);
  4554. endInsertRows();
  4555. lastTemperature->insert(tempcolumn,insertion);
  4556. /*:408*/
  4557. #line 9367 "./typica.w"
  4558. /*:409*/
  4559. #line 9214 "./typica.w"
  4560. }
  4561. if(tempcolumn>=colcount)
  4562. {
  4563. colcount= tempcolumn+1;
  4564. }
  4565. emit rowChanged(insertion);
  4566. delete temp;
  4567. }
  4568. /*:404*//*410:*/
  4569. #line 9377 "./typica.w"
  4570. void MeasurementModel::newAnnotation(QString annotation,int tempcolumn,
  4571. int annotationColumn)
  4572. {
  4573. int r;
  4574. if(lastTemperature->contains(tempcolumn))
  4575. {
  4576. r= lastTemperature->value(tempcolumn);
  4577. }
  4578. else
  4579. {
  4580. r= 0;
  4581. }
  4582. if(r==0&&entries->size()==0)
  4583. {
  4584. /*411:*/
  4585. #line 9415 "./typica.w"
  4586. beginInsertRows(QModelIndex(),0,0);
  4587. MeasurementList*newEntry= new MeasurementList;
  4588. newEntry->append(QVariant(QTime(0,0,0,0)));
  4589. entries->append(newEntry);
  4590. endInsertRows();
  4591. /*:411*/
  4592. #line 9392 "./typica.w"
  4593. }
  4594. MeasurementList*row= entries->at(r);
  4595. if(row->size()<=annotationColumn)
  4596. {
  4597. for(int i= row->size()-1;i<annotationColumn+1;i++)
  4598. {
  4599. row->append(QVariant());
  4600. }
  4601. }
  4602. row->replace(annotationColumn,annotation);
  4603. emit dataChanged(createIndex(r,annotationColumn),
  4604. createIndex(r,annotationColumn));
  4605. emit rowChanged(r);
  4606. if(annotationColumn> colcount-1)
  4607. {
  4608. colcount= annotationColumn+1;
  4609. }
  4610. }
  4611. /*:410*//*412:*/
  4612. #line 9426 "./typica.w"
  4613. void MeasurementModel::clear()
  4614. {
  4615. beginRemoveRows(QModelIndex(),0,entries->size());
  4616. while(entries->size()!=0)
  4617. {
  4618. MeasurementList*row= entries->takeFirst();
  4619. delete row;
  4620. }
  4621. endRemoveRows();
  4622. colcount= hData->size();
  4623. lastTemperature->clear();
  4624. reset();
  4625. }
  4626. /*:412*//*413:*/
  4627. #line 9459 "./typica.w"
  4628. bool MeasurementModel::setData(const QModelIndex&index,
  4629. const QVariant&value,int role)
  4630. {
  4631. if(role!=Qt::EditRole&&role!=Qt::DisplayRole)
  4632. {
  4633. return false;
  4634. }
  4635. /*414:*/
  4636. #line 9491 "./typica.w"
  4637. bool valid= false;
  4638. if(index.isValid())
  4639. {
  4640. if(index.row()<entries->size())
  4641. {
  4642. if(index.column()<colcount)
  4643. {
  4644. valid= true;
  4645. }
  4646. }
  4647. }
  4648. /*:414*/
  4649. #line 9467 "./typica.w"
  4650. if(!valid)
  4651. {
  4652. return false;
  4653. }
  4654. MeasurementList*row= entries->at(index.row());
  4655. if(index.column()>=row->size())
  4656. {
  4657. /*415:*/
  4658. #line 9508 "./typica.w"
  4659. for(int i= row->size()-1;i<index.column();i++)
  4660. {
  4661. row->append(QVariant());
  4662. }
  4663. /*:415*/
  4664. #line 9475 "./typica.w"
  4665. }
  4666. if(index.column()==0)
  4667. {
  4668. /*416:*/
  4669. #line 9523 "./typica.w"
  4670. QTime time;
  4671. if(!(time= QTime::fromString(value.toString(),"m:s.z")).isValid())
  4672. {
  4673. if(!(time= QTime::fromString(value.toString(),"m:s")).isValid())
  4674. {
  4675. return false;
  4676. }
  4677. }
  4678. row= entries->takeAt(index.row());
  4679. row->replace(index.column(),QVariant(time));
  4680. MeasurementList*temp= row;
  4681. /*405:*/
  4682. #line 9242 "./typica.w"
  4683. /*406:*/
  4684. #line 9287 "./typica.w"
  4685. QList<MeasurementList*> ::iterator i= lastInsertion;
  4686. bool quickscan= false;
  4687. if(entries->size()> 5)
  4688. {
  4689. if(**i<*temp)
  4690. {
  4691. i+= 1;
  4692. for(int j= 10;j> 0;j--)
  4693. {
  4694. if(i!=entries->end())
  4695. {
  4696. if(**i<*temp)
  4697. {
  4698. i+= 1;
  4699. }
  4700. else
  4701. {
  4702. quickscan= true;
  4703. break;
  4704. }
  4705. }
  4706. else
  4707. {
  4708. quickscan= true;
  4709. break;
  4710. }
  4711. }
  4712. }
  4713. else
  4714. {
  4715. if(**i==*temp)
  4716. {
  4717. quickscan= true;
  4718. }
  4719. }
  4720. }
  4721. /*:406*/
  4722. #line 9243 "./typica.w"
  4723. if(quickscan==false)
  4724. {
  4725. i= entries->begin();
  4726. QList<MeasurementList*> ::iterator u= entries->end();
  4727. QList<MeasurementList*> ::iterator midpoint;
  4728. int n= u-i;
  4729. int rA;
  4730. while(n> 0)
  4731. {
  4732. rA= n>>1;
  4733. midpoint= i+rA;
  4734. if(**midpoint<*temp)
  4735. {
  4736. i= midpoint+1;
  4737. n-= rA+1;
  4738. }
  4739. else
  4740. {
  4741. n= rA;
  4742. }
  4743. }
  4744. }
  4745. /*:405*/
  4746. #line 9535 "./typica.w"
  4747. entries->insert(i,row);
  4748. int newRow= entries->indexOf(*i);
  4749. if(newRow<index.row())
  4750. {
  4751. emit dataChanged(createIndex(newRow,index.column()),index);
  4752. }
  4753. else
  4754. {
  4755. emit dataChanged(index,createIndex(newRow,index.column()));
  4756. }
  4757. /*:416*/
  4758. #line 9479 "./typica.w"
  4759. }
  4760. else
  4761. {
  4762. /*417:*/
  4763. #line 9549 "./typica.w"
  4764. row->replace(index.column(),value);
  4765. emit dataChanged(index,index);
  4766. /*:417*/
  4767. #line 9483 "./typica.w"
  4768. }
  4769. return true;
  4770. }
  4771. /*:413*//*418:*/
  4772. #line 9557 "./typica.w"
  4773. MeasurementModel::MeasurementModel(QObject*parent):QAbstractItemModel(parent),
  4774. unit(Units::Fahrenheit),hData(new QStringList),
  4775. lastTemperature(new QHash<int,int> ),
  4776. controlColumns(new QHash<int,bool> )
  4777. {
  4778. colcount= 1;
  4779. entries= new QList<MeasurementList*> ;
  4780. lastInsertion= entries->begin();
  4781. hData->append(tr("Time"));
  4782. }
  4783. /*:418*//*419:*/
  4784. #line 9571 "./typica.w"
  4785. MeasurementModel::~MeasurementModel()
  4786. {
  4787. clear();
  4788. delete entries;
  4789. delete hData;
  4790. }
  4791. /*:419*//*420:*/
  4792. #line 9583 "./typica.w"
  4793. int MeasurementModel::rowCount(const QModelIndex&parent)const
  4794. {
  4795. if(parent==QModelIndex())
  4796. {
  4797. return entries->size();
  4798. }
  4799. return 0;
  4800. }
  4801. int MeasurementModel::columnCount(const QModelIndex&parent)const
  4802. {
  4803. if(parent==QModelIndex())
  4804. {
  4805. return colcount;
  4806. }
  4807. return 0;
  4808. }
  4809. /*:420*//*421:*/
  4810. #line 9610 "./typica.w"
  4811. bool MeasurementModel::setHeaderData(int section,Qt::Orientation orientation,
  4812. const QVariant&value,int)
  4813. {
  4814. if(orientation==Qt::Horizontal)
  4815. {
  4816. if(hData->size()<section+1)
  4817. {
  4818. for(int i= hData->size();i<section+1;i++)
  4819. {
  4820. if(colcount<i)
  4821. {
  4822. beginInsertColumns(QModelIndex(),i,i);
  4823. }
  4824. hData->append(QString());
  4825. if(colcount<i)
  4826. {
  4827. endInsertColumns();
  4828. }
  4829. }
  4830. }
  4831. hData->replace(section,value.toString());
  4832. emit headerDataChanged(orientation,section,section);
  4833. if(colcount<section+1)
  4834. {
  4835. colcount= section+1;
  4836. }
  4837. return true;
  4838. }
  4839. return false;
  4840. }
  4841. /*:421*//*422:*/
  4842. #line 9650 "./typica.w"
  4843. void MeasurementModel::setDisplayUnits(Units::Unit scale)
  4844. {
  4845. beginResetModel();
  4846. unit= scale;
  4847. endResetModel();
  4848. }
  4849. Units::Unit MeasurementModel::displayUnits()
  4850. {
  4851. return unit;
  4852. }
  4853. /*:422*//*423:*/
  4854. #line 9676 "./typica.w"
  4855. QVariant MeasurementModel::data(const QModelIndex&index,int role)const
  4856. {
  4857. /*414:*/
  4858. #line 9491 "./typica.w"
  4859. bool valid= false;
  4860. if(index.isValid())
  4861. {
  4862. if(index.row()<entries->size())
  4863. {
  4864. if(index.column()<colcount)
  4865. {
  4866. valid= true;
  4867. }
  4868. }
  4869. }
  4870. /*:414*/
  4871. #line 9679 "./typica.w"
  4872. if(!valid)
  4873. {
  4874. return QVariant();
  4875. }
  4876. MeasurementList*row= entries->at(index.row());
  4877. if(role==Qt::UserRole)
  4878. {
  4879. return QVariant(row->at(index.column()));
  4880. }
  4881. if(role==Qt::DisplayRole||role==Qt::EditRole)
  4882. {
  4883. if(index.column()> row->size())
  4884. {
  4885. return QVariant();
  4886. }
  4887. else
  4888. {
  4889. if(index.column()==0)
  4890. {
  4891. return QVariant(row->at(0).toTime().toString("mm:ss.zzz"));
  4892. }
  4893. else if(lastTemperature->contains(index.column()))
  4894. {
  4895. QVariantMap v= row->at(index.column()).toMap();
  4896. if(!v.contains("measurement"))
  4897. {
  4898. return QVariant();
  4899. }
  4900. if((Units::Unit)(v.value("unit").toInt())==Units::Unitless)
  4901. {
  4902. return v.value("measurement");
  4903. }
  4904. else
  4905. {
  4906. if(v.contains("relative"))
  4907. {
  4908. if(v.value("relative").toBool())
  4909. {
  4910. return QVariant(QString("%1").arg(Units::convertRelativeTemperature(v.value("measurement").
  4911. toDouble(),(Units::Unit)(v.value("unit").toInt()),unit)));
  4912. }
  4913. }
  4914. return QVariant(QString("%1").
  4915. arg(Units::convertTemperature(v.value("measurement").toDouble(),
  4916. (Units::Unit)(v.value("unit").toInt()),unit)));
  4917. }
  4918. }
  4919. return QVariant(row->at(index.column()).toString());
  4920. }
  4921. }
  4922. return QVariant();
  4923. }
  4924. /*:423*//*424:*/
  4925. #line 9735 "./typica.w"
  4926. QVariant MeasurementModel::headerData(int section,Qt::Orientation orientation,
  4927. int role)const
  4928. {
  4929. if(orientation==Qt::Horizontal)
  4930. {
  4931. if(role==Qt::DisplayRole)
  4932. {
  4933. if(section<hData->size())
  4934. {
  4935. return QVariant(hData->at(section));
  4936. }
  4937. }
  4938. }
  4939. return QVariant();
  4940. }
  4941. /*:424*//*425:*/
  4942. #line 9762 "./typica.w"
  4943. Qt::ItemFlags MeasurementModel::flags(const QModelIndex&index)const
  4944. {
  4945. /*414:*/
  4946. #line 9491 "./typica.w"
  4947. bool valid= false;
  4948. if(index.isValid())
  4949. {
  4950. if(index.row()<entries->size())
  4951. {
  4952. if(index.column()<colcount)
  4953. {
  4954. valid= true;
  4955. }
  4956. }
  4957. }
  4958. /*:414*/
  4959. #line 9765 "./typica.w"
  4960. if(valid)
  4961. {
  4962. return Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable;
  4963. }
  4964. return 0;
  4965. }
  4966. /*:425*//*426:*/
  4967. #line 9777 "./typica.w"
  4968. QModelIndex MeasurementModel::index(int row,int column,
  4969. const QModelIndex&parent)const
  4970. {
  4971. if(parent==QModelIndex())
  4972. {
  4973. if(row<entries->size()&&entries->isEmpty()==false)
  4974. {
  4975. if(column<entries->at(row)->size())
  4976. {
  4977. return createIndex(row,column);
  4978. }
  4979. }
  4980. }
  4981. return QModelIndex();
  4982. }
  4983. /*:426*/
  4984. #line 550 "./typica.w"
  4985. /*428:*/
  4986. #line 9828 "./typica.w"
  4987. AnnotationButton::AnnotationButton(const QString&text,QWidget*parent):
  4988. QPushButton(text,parent),note(""),tc(0),ac(0),count(0)
  4989. {
  4990. connect(this,SIGNAL(clicked()),this,SLOT(annotate()));
  4991. }
  4992. /*:428*//*429:*/
  4993. #line 9843 "./typica.w"
  4994. void AnnotationButton::annotate()
  4995. {
  4996. if(note.contains("%1"))
  4997. {
  4998. count++;
  4999. emit annotation(note.arg(count),tc,ac);
  5000. }
  5001. else
  5002. {
  5003. emit annotation(note,tc,ac);
  5004. }
  5005. }
  5006. /*:429*//*430:*/
  5007. #line 9861 "./typica.w"
  5008. void AnnotationButton::setTemperatureColumn(int tempcolumn)
  5009. {
  5010. tc= tempcolumn;
  5011. }
  5012. void AnnotationButton::setAnnotationColumn(int annotationcolumn)
  5013. {
  5014. ac= annotationcolumn;
  5015. }
  5016. void AnnotationButton::setAnnotation(const QString&annotation)
  5017. {
  5018. note= annotation;
  5019. }
  5020. /*:430*//*431:*/
  5021. #line 9880 "./typica.w"
  5022. void AnnotationButton::resetCount()
  5023. {
  5024. count= 0;
  5025. }
  5026. /*:431*/
  5027. #line 551 "./typica.w"
  5028. /*436:*/
  5029. #line 9963 "./typica.w"
  5030. AnnotationSpinBox::AnnotationSpinBox(const QString&pret,
  5031. const QString&postt,
  5032. QWidget*parent)
  5033. :QDoubleSpinBox(parent),pretext(pret),posttext(postt)
  5034. {
  5035. resetChange();
  5036. connect(this,SIGNAL(editingFinished()),this,SLOT(annotate()));
  5037. connect(this,SIGNAL(valueChanged(double)),this,SLOT(resetChange()));
  5038. }
  5039. /*:436*//*437:*/
  5040. #line 9980 "./typica.w"
  5041. void AnnotationSpinBox::resetChange()
  5042. {
  5043. change= true;
  5044. }
  5045. /*:437*//*438:*/
  5046. #line 9991 "./typica.w"
  5047. void AnnotationSpinBox::annotate()
  5048. {
  5049. if(change)
  5050. {
  5051. change= false;
  5052. emit annotation(QString("%1%2%3").arg(pretext).
  5053. arg(value()).arg(posttext),tc,ac);
  5054. }
  5055. }
  5056. /*:438*//*439:*/
  5057. #line 10004 "./typica.w"
  5058. void AnnotationSpinBox::setTemperatureColumn(int tempcolumn)
  5059. {
  5060. tc= tempcolumn;
  5061. }
  5062. void AnnotationSpinBox::setAnnotationColumn(int annotationcolumn)
  5063. {
  5064. ac= annotationcolumn;
  5065. }
  5066. void AnnotationSpinBox::setPretext(const QString&pret)
  5067. {
  5068. pretext= pret;
  5069. }
  5070. void AnnotationSpinBox::setPosttext(const QString&postt)
  5071. {
  5072. posttext= postt;
  5073. }
  5074. /*:439*/
  5075. #line 552 "./typica.w"
  5076. /*446:*/
  5077. #line 10172 "./typica.w"
  5078. TimerDisplay::TimerDisplay(QWidget*parent):QLCDNumber(8,parent),
  5079. s(QTime(0,0,0)),r(QTime(0,0,0)),clock(NULL),m(TimerDisplay::CountUp),
  5080. running(false),ar(false),startAction(new QAction(tr("Start"),NULL)),
  5081. stopAction(new QAction(tr("Stop"),NULL)),
  5082. resetAction(new QAction(tr("Reset"),NULL)),f(QString("hh:mm:ss")),
  5083. relative(QTime::currentTime()),base(QTime(0,0,0))
  5084. {
  5085. connect(startAction,SIGNAL(triggered(bool)),this,SLOT(startTimer()));
  5086. connect(stopAction,SIGNAL(triggered(bool)),this,SLOT(stopTimer()));
  5087. connect(resetAction,SIGNAL(triggered(bool)),this,SLOT(reset()));
  5088. clock.setInterval(500);
  5089. clock.setSingleShot(false);
  5090. connect(&clock,SIGNAL(timeout()),this,SLOT(updateTime()));
  5091. setSegmentStyle(Filled);
  5092. updateDisplay();
  5093. }
  5094. /*:446*//*447:*/
  5095. #line 10193 "./typica.w"
  5096. void TimerDisplay::updateTime()
  5097. {
  5098. QTime time;
  5099. int cseconds= 0;
  5100. int oseconds= 0;
  5101. int r= 0;
  5102. QTime nt= QTime(0,0,0);
  5103. int n= 0;
  5104. int bseconds= 0;
  5105. switch(m)
  5106. {
  5107. case TimerDisplay::CountUp:
  5108. /*448:*/
  5109. #line 10225 "./typica.w"
  5110. /*449:*/
  5111. #line 10238 "./typica.w"
  5112. #define TIMETOINT(t) ((t.hour() * 60 * 60) + (t.minute() * 60) + (t.second()))
  5113. time= QTime::currentTime();
  5114. cseconds= TIMETOINT(time);
  5115. oseconds= TIMETOINT(relative);
  5116. r= cseconds-oseconds;
  5117. /*:449*/
  5118. #line 10226 "./typica.w"
  5119. nt= nt.addSecs(r);
  5120. if(nt!=s)
  5121. {
  5122. s= nt;
  5123. emit valueChanged(s);
  5124. }
  5125. /*:448*/
  5126. #line 10206 "./typica.w"
  5127. ;
  5128. break;
  5129. case TimerDisplay::CountDown:
  5130. /*450:*/
  5131. #line 10250 "./typica.w"
  5132. if(s> QTime(0,0,0))
  5133. {
  5134. /*449:*/
  5135. #line 10238 "./typica.w"
  5136. #define TIMETOINT(t) ((t.hour() * 60 * 60) + (t.minute() * 60) + (t.second()))
  5137. time= QTime::currentTime();
  5138. cseconds= TIMETOINT(time);
  5139. oseconds= TIMETOINT(relative);
  5140. r= cseconds-oseconds;
  5141. /*:449*/
  5142. #line 10253 "./typica.w"
  5143. bseconds= TIMETOINT(base);
  5144. n= bseconds-r;
  5145. nt= nt.addSecs(n);
  5146. if(nt!=s)
  5147. {
  5148. s= nt;
  5149. emit valueChanged(s);
  5150. }
  5151. }
  5152. /*:450*/
  5153. #line 10209 "./typica.w"
  5154. ;
  5155. break;
  5156. case TimerDisplay::Clock:
  5157. /*451:*/
  5158. #line 10267 "./typica.w"
  5159. time= QTime::currentTime();
  5160. if(time!=s)
  5161. {
  5162. s= time;
  5163. emit valueChanged(s);
  5164. }
  5165. /*:451*/
  5166. #line 10212 "./typica.w"
  5167. ;
  5168. break;
  5169. default:
  5170. Q_ASSERT_X(false,"updateTime","invalid timer mode");
  5171. break;
  5172. }
  5173. updateDisplay();
  5174. }
  5175. /*:447*//*452:*/
  5176. #line 10279 "./typica.w"
  5177. #define TIMESUBTRACT(t1, t2) (t1.addSecs(-(TIMETOINT(t2))).addSecs(-t2.msec()))
  5178. void TimerDisplay::startTimer()
  5179. {
  5180. if(!running)
  5181. {
  5182. relative= QTime::currentTime();
  5183. if(ar)
  5184. {
  5185. reset();
  5186. }
  5187. else
  5188. {
  5189. relative= TIMESUBTRACT(relative,s);
  5190. }
  5191. if(m==Clock)
  5192. {
  5193. updateTime();
  5194. }
  5195. base= s;
  5196. clock.start();
  5197. running= true;
  5198. emit runStateChanged(true);
  5199. }
  5200. }
  5201. /*:452*//*453:*/
  5202. #line 10309 "./typica.w"
  5203. void TimerDisplay::stopTimer()
  5204. {
  5205. if(running)
  5206. {
  5207. clock.stop();
  5208. running= false;
  5209. emit runStateChanged(false);
  5210. }
  5211. }
  5212. /*:453*//*454:*/
  5213. #line 10322 "./typica.w"
  5214. TimerDisplay::~TimerDisplay()
  5215. {
  5216. clock.stop();
  5217. }
  5218. /*:454*//*455:*/
  5219. #line 10331 "./typica.w"
  5220. void TimerDisplay::setCountUpMode()
  5221. {
  5222. m= TimerDisplay::CountUp;
  5223. }
  5224. void TimerDisplay::setCountDownMode()
  5225. {
  5226. m= TimerDisplay::CountDown;
  5227. }
  5228. void TimerDisplay::setClockMode()
  5229. {
  5230. m= TimerDisplay::Clock;
  5231. }
  5232. /*:455*//*456:*/
  5233. #line 10349 "./typica.w"
  5234. QString TimerDisplay::value()
  5235. {
  5236. return s.toString(f);
  5237. }
  5238. QTime TimerDisplay::seconds()
  5239. {
  5240. return s;
  5241. }
  5242. TimerDisplay::TimerMode TimerDisplay::mode()
  5243. {
  5244. return m;
  5245. }
  5246. bool TimerDisplay::isRunning()
  5247. {
  5248. return running;
  5249. }
  5250. QTime TimerDisplay::resetValue()
  5251. {
  5252. return r;
  5253. }
  5254. QString TimerDisplay::displayFormat()
  5255. {
  5256. return f;
  5257. }
  5258. bool TimerDisplay::autoReset()
  5259. {
  5260. return ar;
  5261. }
  5262. /*:456*//*457:*/
  5263. #line 10387 "./typica.w"
  5264. void TimerDisplay::setTimer(QTime value)
  5265. {
  5266. if(value.isValid())
  5267. {
  5268. s= value;
  5269. updateDisplay();
  5270. emit valueChanged(value);
  5271. }
  5272. }
  5273. void TimerDisplay::setMode(TimerDisplay::TimerMode mode)
  5274. {
  5275. m= mode;
  5276. }
  5277. void TimerDisplay::setResetValue(QTime value)
  5278. {
  5279. r= value;
  5280. }
  5281. void TimerDisplay::setDisplayFormat(QString format)
  5282. {
  5283. f= format;
  5284. setNumDigits(format.length());
  5285. }
  5286. void TimerDisplay::setAutoReset(bool reset)
  5287. {
  5288. ar= reset;
  5289. }
  5290. /*:457*//*458:*/
  5291. #line 10422 "./typica.w"
  5292. void TimerDisplay::copyTimer()
  5293. {
  5294. QApplication::clipboard()->setText(value());
  5295. }
  5296. /*:458*//*459:*/
  5297. #line 10431 "./typica.w"
  5298. void TimerDisplay::reset()
  5299. {
  5300. if(!running)
  5301. {
  5302. s= r;
  5303. updateDisplay();
  5304. }
  5305. }
  5306. /*:459*//*460:*/
  5307. #line 10444 "./typica.w"
  5308. void TimerDisplay::updateDisplay()
  5309. {
  5310. display(value());
  5311. }
  5312. /*:460*/
  5313. #line 553 "./typica.w"
  5314. /*466:*/
  5315. #line 10538 "./typica.w"
  5316. int PackLayout::doLayout(const QRect&rect,bool testOnly)const
  5317. {
  5318. int x= rect.x();
  5319. int y= rect.y();
  5320. QLayoutItem*item;
  5321. if(orientation==Qt::Horizontal)
  5322. {
  5323. /*467:*/
  5324. #line 10562 "./typica.w"
  5325. foreach(item,itemList)
  5326. {
  5327. int nextX= x+item->sizeHint().width()+spacing();
  5328. int right= x+item->sizeHint().width();
  5329. if(item==itemList.last())
  5330. {
  5331. right= rect.right();
  5332. }
  5333. int bottom= rect.bottom();
  5334. if(!testOnly)
  5335. {
  5336. item->setGeometry(QRect(QPoint(x,y),QPoint(right,bottom)));
  5337. }
  5338. x= nextX;
  5339. }
  5340. /*:467*/
  5341. #line 10546 "./typica.w"
  5342. }
  5343. else
  5344. {
  5345. /*468:*/
  5346. #line 10581 "./typica.w"
  5347. foreach(item,itemList)
  5348. {
  5349. int nextY= y+item->sizeHint().height()+spacing();
  5350. int bottom= y+item->sizeHint().height();
  5351. if(item==itemList.last())
  5352. {
  5353. bottom= rect.bottom();
  5354. }
  5355. int right= rect.right();
  5356. if(!testOnly)
  5357. {
  5358. item->setGeometry(QRect(QPoint(x,y),QPoint(right,bottom)));
  5359. }
  5360. y= nextY;
  5361. }
  5362. /*:468*/
  5363. #line 10550 "./typica.w"
  5364. }
  5365. return y;
  5366. }
  5367. /*:466*//*469:*/
  5368. #line 10605 "./typica.w"
  5369. QSize PackLayout::minimumSize()const
  5370. {
  5371. QSize size;
  5372. QLayoutItem*item;
  5373. foreach(item,itemList)
  5374. {
  5375. if(orientation==Qt::Horizontal)
  5376. {
  5377. size+= QSize(item->minimumSize().width(),0);
  5378. if(size.height()<item->minimumSize().height())
  5379. {
  5380. size.setHeight(item->minimumSize().height());
  5381. }
  5382. }
  5383. else
  5384. {
  5385. size+= QSize(0,item->minimumSize().height());
  5386. if(size.width()<item->minimumSize().width())
  5387. {
  5388. size.setWidth(item->minimumSize().width());
  5389. }
  5390. }
  5391. }
  5392. size+= QSize(2*margin(),2*margin());
  5393. return size;
  5394. }
  5395. /*:469*//*470:*/
  5396. #line 10637 "./typica.w"
  5397. PackLayout::PackLayout(QWidget*parent,int margin,int spacing):
  5398. QLayout(parent)
  5399. {
  5400. setMargin(margin);
  5401. setSpacing(spacing);
  5402. setOrientation(Qt::Horizontal);
  5403. }
  5404. PackLayout::PackLayout(int spacing)
  5405. {
  5406. setSpacing(spacing);
  5407. setOrientation(Qt::Horizontal);
  5408. }
  5409. /*:470*//*471:*/
  5410. #line 10655 "./typica.w"
  5411. PackLayout::~PackLayout()
  5412. {
  5413. QLayoutItem*item;
  5414. while((item= takeAt(0)))
  5415. {
  5416. delete item;
  5417. }
  5418. }
  5419. /*:471*//*472:*/
  5420. #line 10669 "./typica.w"
  5421. QLayoutItem*PackLayout::takeAt(int index)
  5422. {
  5423. if(index>=0&&index<itemList.size())
  5424. {
  5425. return itemList.takeAt(index);
  5426. }
  5427. else
  5428. {
  5429. return NULL;
  5430. }
  5431. }
  5432. /*:472*//*473:*/
  5433. #line 10685 "./typica.w"
  5434. QLayoutItem*PackLayout::itemAt(int index)const
  5435. {
  5436. if(index>=0&&index<itemList.size())
  5437. {
  5438. return itemList.at(index);
  5439. }
  5440. else
  5441. {
  5442. return NULL;
  5443. }
  5444. }
  5445. /*:473*//*474:*/
  5446. #line 10708 "./typica.w"
  5447. void PackLayout::addItem(QLayoutItem*item)
  5448. {
  5449. itemList.append(item);
  5450. }
  5451. /*:474*//*475:*/
  5452. #line 10716 "./typica.w"
  5453. int PackLayout::count()const
  5454. {
  5455. return itemList.size();
  5456. }
  5457. /*:475*//*476:*/
  5458. #line 10728 "./typica.w"
  5459. Qt::Orientations PackLayout::expandingDirections()const
  5460. {
  5461. return Qt::Vertical|Qt::Horizontal;
  5462. }
  5463. bool PackLayout::hasHeightForWidth()const
  5464. {
  5465. return false;
  5466. }
  5467. int PackLayout::heightForWidth(int width)const
  5468. {
  5469. return doLayout(QRect(0,0,width,0),true);
  5470. }
  5471. void PackLayout::setGeometry(const QRect&rect)
  5472. {
  5473. QLayout::setGeometry(rect);
  5474. doLayout(rect,false);
  5475. }
  5476. QSize PackLayout::sizeHint()const
  5477. {
  5478. return minimumSize();
  5479. }
  5480. /*:476*//*477:*/
  5481. #line 10759 "./typica.w"
  5482. void PackLayout::setOrientation(Qt::Orientations direction)
  5483. {
  5484. orientation= direction;
  5485. doLayout(geometry(),false);
  5486. }
  5487. /*:477*/
  5488. #line 554 "./typica.w"
  5489. /*479:*/
  5490. #line 10798 "./typica.w"
  5491. SceneButton::SceneButton():QGraphicsScene()
  5492. {
  5493. }
  5494. SceneButton::~SceneButton()
  5495. {
  5496. }
  5497. void SceneButton::mousePressEvent(QGraphicsSceneMouseEvent*mouseEvent)
  5498. {
  5499. emit clicked(mouseEvent->buttonDownScreenPos(mouseEvent->button()));
  5500. }
  5501. /*:479*/
  5502. #line 555 "./typica.w"
  5503. /*481:*/
  5504. #line 10844 "./typica.w"
  5505. WidgetDecorator::WidgetDecorator(QWidget*widget,const QString&labeltext,
  5506. Qt::Orientations orientation,
  5507. QWidget*parent,Qt::WindowFlags f):
  5508. QWidget(parent,f),label(new QGraphicsView()),
  5509. scene(new SceneButton())
  5510. {
  5511. layout= new PackLayout(this);
  5512. layout->setOrientation(orientation);
  5513. /*482:*/
  5514. #line 10864 "./typica.w"
  5515. label->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  5516. label->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  5517. label->setFrameShape(QFrame::NoFrame);
  5518. label->setInteractive(true);
  5519. /*:482*/
  5520. #line 10853 "./typica.w"
  5521. /*483:*/
  5522. #line 10875 "./typica.w"
  5523. scene->setBackgroundBrush(Qt::cyan);
  5524. text= scene->addText(labeltext);
  5525. if(orientation==Qt::Horizontal)
  5526. {
  5527. text->rotate(270.0);
  5528. }
  5529. label->setScene(scene);
  5530. /*:483*/
  5531. #line 10854 "./typica.w"
  5532. /*484:*/
  5533. #line 10893 "./typica.w"
  5534. if(orientation==Qt::Horizontal)
  5535. {
  5536. label->setMaximumWidth((int)(text->boundingRect().height()+1));
  5537. }
  5538. else
  5539. {
  5540. label->setMaximumHeight((int)(text->boundingRect().height()+1));
  5541. }
  5542. label->centerOn(text);
  5543. /*:484*/
  5544. #line 10855 "./typica.w"
  5545. /*485:*/
  5546. #line 10908 "./typica.w"
  5547. layout->addWidget(label);
  5548. layout->addWidget(widget);
  5549. if(orientation==Qt::Horizontal)
  5550. {
  5551. setMinimumSize(widget->sizeHint().width()+label->sizeHint().width(),
  5552. widget->sizeHint().height());
  5553. }
  5554. else
  5555. {
  5556. setMinimumSize(widget->sizeHint().width(),
  5557. widget->sizeHint().height()+label->sizeHint().height());
  5558. }
  5559. /*:485*/
  5560. #line 10856 "./typica.w"
  5561. }
  5562. /*:481*//*486:*/
  5563. #line 10925 "./typica.w"
  5564. void WidgetDecorator::setBackgroundBrush(QBrush background)
  5565. {
  5566. scene->setBackgroundBrush(background);
  5567. }
  5568. void WidgetDecorator::setTextColor(QColor color)
  5569. {
  5570. text->setDefaultTextColor(color);
  5571. }
  5572. /*:486*//*487:*/
  5573. #line 10938 "./typica.w"
  5574. WidgetDecorator::~WidgetDecorator()
  5575. {
  5576. }
  5577. /*:487*/
  5578. #line 556 "./typica.w"
  5579. /*492:*/
  5580. #line 11037 "./typica.w"
  5581. void LogEditWindow::addTheRows()
  5582. {
  5583. QTime s= startTime->time();
  5584. while(s<endTime->time())
  5585. {
  5586. model->newMeasurement(Measurement(0,s),1);
  5587. s= s.addSecs(interval->value());
  5588. }
  5589. model->newMeasurement(Measurement(0,endTime->time()),1);
  5590. }
  5591. /*:492*//*493:*/
  5592. #line 11051 "./typica.w"
  5593. LogEditWindow::LogEditWindow():QMainWindow(NULL),
  5594. centralWidget(new QWidget(NULL)),mainLayout(new PackLayout(0)),
  5595. addRowsLayout(new QHBoxLayout(NULL)),
  5596. startTimeLabel(new QLabel("Start Time")),
  5597. startTime(new QTimeEdit(QTime(0,0,0,0))),
  5598. endTimeLabel(new QLabel("End Time")),
  5599. endTime(new QTimeEdit(QTime(0,20,0,0))),
  5600. intervalLabel(new QLabel("Interval (seconds)")),
  5601. interval(new QSpinBox()),
  5602. addRows(new QPushButton("Add Rows")),
  5603. saveXml(new QAction(tr("Save Profile As..."),NULL)),
  5604. saveCsv(new QAction(tr("Export CSV"),NULL)),
  5605. openXml(new QAction(tr("Load Target Profile..."),NULL)),
  5606. model(new MeasurementModel()),
  5607. log(new QTableView())
  5608. {
  5609. /*494:*/
  5610. #line 11088 "./typica.w"
  5611. QSettings settings;
  5612. resize(settings.value("logSize",QSize(620,400)).toSize());
  5613. move(settings.value("logPos",QPoint(200,60)).toPoint());
  5614. /*:494*/
  5615. #line 11068 "./typica.w"
  5616. /*495:*/
  5617. #line 11101 "./typica.w"
  5618. mainLayout->setOrientation(Qt::Vertical);
  5619. addRowsLayout->addSpacing(10);
  5620. addRowsLayout->addWidget(startTimeLabel);
  5621. addRowsLayout->addWidget(startTime);
  5622. addRowsLayout->addSpacing(10);
  5623. startTime->setDisplayFormat("mm:ss");
  5624. addRowsLayout->addWidget(endTimeLabel);
  5625. addRowsLayout->addWidget(endTime);
  5626. addRowsLayout->addSpacing(10);
  5627. endTime->setDisplayFormat("mm:ss");
  5628. addRowsLayout->addWidget(intervalLabel);
  5629. addRowsLayout->addWidget(interval);
  5630. addRowsLayout->addSpacing(10);
  5631. interval->setRange(0,60);
  5632. interval->setValue(30);
  5633. addRowsLayout->addWidget(addRows);
  5634. addRowsLayout->addSpacing(10);
  5635. connect(addRows,SIGNAL(clicked()),this,SLOT(addTheRows()));
  5636. /*:495*/
  5637. #line 11069 "./typica.w"
  5638. /*496:*/
  5639. #line 11124 "./typica.w"
  5640. model->setHeaderData(0,Qt::Horizontal,"Time");
  5641. model->setHeaderData(1,Qt::Horizontal,"Temperature");
  5642. model->setHeaderData(2,Qt::Horizontal,"Annotation");
  5643. model->clear();
  5644. /*:496*/
  5645. #line 11070 "./typica.w"
  5646. /*497:*/
  5647. #line 11133 "./typica.w"
  5648. log->setModel(model);
  5649. log->setColumnWidth(0,100);
  5650. log->setColumnWidth(1,100);
  5651. log->setColumnWidth(2,100);
  5652. /*:497*/
  5653. #line 11071 "./typica.w"
  5654. mainLayout->addItem(addRowsLayout);
  5655. mainLayout->addWidget(log);
  5656. centralWidget->setLayout(mainLayout);
  5657. setCentralWidget(centralWidget);
  5658. QMenu*fileMenu= menuBar()->addMenu(tr("&File"));
  5659. fileMenu->addAction(openXml);
  5660. connect(openXml,SIGNAL(triggered()),this,SLOT(openXML()));
  5661. fileMenu->addAction(saveXml);
  5662. connect(saveXml,SIGNAL(triggered()),this,SLOT(saveXML()));
  5663. fileMenu->addAction(saveCsv);
  5664. connect(saveCsv,SIGNAL(triggered()),this,SLOT(saveCSV()));
  5665. }
  5666. /*:493*//*498:*/
  5667. #line 11144 "./typica.w"
  5668. void LogEditWindow::saveXML()
  5669. {
  5670. QSettings settings;
  5671. QString lastDir= settings.value("lastDirectory").toString();
  5672. QString filename= QFileDialog::getSaveFileName(this,tr("Save Log As..."),
  5673. lastDir,"",0);
  5674. QFile file(filename);
  5675. XMLOutput writer(model,&file,0);
  5676. writer.addTemperatureColumn("Temperature",1);
  5677. writer.addAnnotationColumn("Annotation",2);
  5678. if(writer.output())
  5679. {
  5680. QFileInfo info(filename);
  5681. QDir directory= info.dir();
  5682. lastDir= directory.path();
  5683. settings.setValue("lastDirectory",lastDir);
  5684. }
  5685. }
  5686. void LogEditWindow::saveCSV()
  5687. {
  5688. QSettings settings;
  5689. QString lastDir= settings.value("lastDirectory").toString();
  5690. QString filename= QFileDialog::getSaveFileName(this,tr("Export As..."),
  5691. lastDir,"",0);
  5692. QFile file(filename);
  5693. CSVOutput writer(model,&file,0);
  5694. writer.addTemperatureColumn("Temperature",1);
  5695. writer.addAnnotationColumn("Annotation",2);
  5696. if(writer.output())
  5697. {
  5698. QFileInfo info(filename);
  5699. QDir directory= info.dir();
  5700. lastDir= directory.path();
  5701. settings.setValue("lastDirectory",lastDir);
  5702. }
  5703. }
  5704. /*:498*//*499:*/
  5705. #line 11187 "./typica.w"
  5706. void LogEditWindow::openXML()
  5707. {
  5708. QSettings settings;
  5709. QString lastDir= settings.value("lastDirectory").toString();
  5710. QString filename= QFileDialog::getOpenFileName(this,tr("Open XML Log..."),
  5711. lastDir,"",0);
  5712. if(filename.isNull())
  5713. {
  5714. return;
  5715. }
  5716. QFile file(filename);
  5717. XMLInput reader(&file,1);
  5718. connect(&reader,SIGNAL(measure(Measurement,int)),
  5719. model,SLOT(newMeasurement(Measurement,int)));
  5720. connect(&reader,SIGNAL(annotation(QString,int,int)),
  5721. model,SLOT(newAnnotation(QString,int,int)));
  5722. if(reader.input())
  5723. {
  5724. QFileInfo info(filename);
  5725. setWindowTitle(QString(tr("%1 - %2")).
  5726. arg(QCoreApplication::applicationName()).arg(info.baseName()));
  5727. QDir directory= info.dir();
  5728. lastDir= directory.path();
  5729. settings.setValue("lastDirectory",lastDir);
  5730. }
  5731. }
  5732. /*:499*//*500:*/
  5733. #line 11218 "./typica.w"
  5734. void LogEditWindow::closeEvent(QCloseEvent*event)
  5735. {
  5736. QSettings settings;
  5737. settings.setValue("logSize",size());
  5738. settings.setValue("logPos",pos());
  5739. event->accept();
  5740. }
  5741. /*:500*/
  5742. #line 557 "./typica.w"
  5743. /*506:*/
  5744. #line 11333 "./typica.w"
  5745. bool XMLOutput::output()
  5746. {
  5747. if(!out->open(QIODevice::WriteOnly|QIODevice::Text))
  5748. {
  5749. return false;
  5750. }
  5751. QXmlStreamWriter xmlout(out);
  5752. xmlout.writeStartDocument("1.0");
  5753. xmlout.writeDTD("<!DOCTYPE roastlog3.0>");
  5754. xmlout.writeStartElement("roastlog");
  5755. /*507:*/
  5756. #line 11366 "./typica.w"
  5757. foreach(int c,temperatureColumns.keys())
  5758. {
  5759. xmlout.writeStartElement("tempseries");
  5760. xmlout.writeAttribute("name",temperatureColumns.value(c));
  5761. xmlout.writeEndElement();
  5762. }
  5763. foreach(int c,controlColumns.keys())
  5764. {
  5765. xmlout.writeStartElement("controlseries");
  5766. xmlout.writeAttribute("name",controlColumns.value(c));
  5767. xmlout.writeEndElement();
  5768. }
  5769. foreach(int c,annotationColumns.keys())
  5770. {
  5771. xmlout.writeStartElement("noteseries");
  5772. xmlout.writeAttribute("name",annotationColumns.value(c));
  5773. xmlout.writeEndElement();
  5774. }
  5775. /*:507*/
  5776. #line 11344 "./typica.w"
  5777. xmlout.writeStartElement("roast");
  5778. bool oresult;
  5779. for(int i= 0;i<data->rowCount();i++)
  5780. {
  5781. /*508:*/
  5782. #line 11391 "./typica.w"
  5783. oresult= false;
  5784. foreach(int c,temperatureColumns.keys())
  5785. {
  5786. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5787. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  5788. {
  5789. oresult= true;
  5790. break;
  5791. }
  5792. }
  5793. foreach(int c,controlColumns.keys())
  5794. {
  5795. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5796. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  5797. {
  5798. oresult= true;
  5799. break;
  5800. }
  5801. }
  5802. if(oresult==false)
  5803. {
  5804. foreach(int c,annotationColumns.keys())
  5805. {
  5806. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5807. !(data->data(data->index(i,c),Qt::DisplayRole).toString().
  5808. isEmpty()))
  5809. {
  5810. oresult= true;
  5811. break;
  5812. }
  5813. }
  5814. }
  5815. /*:508*/
  5816. #line 11349 "./typica.w"
  5817. if(oresult)
  5818. {
  5819. /*509:*/
  5820. #line 11430 "./typica.w"
  5821. xmlout.writeStartElement("tuple");
  5822. xmlout.writeTextElement("time",data->data(data->index(i,time),
  5823. Qt::DisplayRole).toString());
  5824. foreach(int c,temperatureColumns.keys())
  5825. {
  5826. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5827. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  5828. {
  5829. xmlout.writeStartElement("temperature");
  5830. xmlout.writeAttribute("series",temperatureColumns.value(c));
  5831. if(data->data(data->index(i,c),Qt::UserRole).toMap().contains("relative"))
  5832. {
  5833. if(data->data(data->index(i,c),Qt::UserRole).toMap().value("relative").toBool())
  5834. {
  5835. xmlout.writeAttribute("relative","true");
  5836. }
  5837. }
  5838. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).
  5839. toString());
  5840. xmlout.writeEndElement();
  5841. }
  5842. }
  5843. foreach(int c,controlColumns.keys())
  5844. {
  5845. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5846. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  5847. {
  5848. xmlout.writeStartElement("control");
  5849. xmlout.writeAttribute("series",controlColumns.value(c));
  5850. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).toString());
  5851. xmlout.writeEndElement();
  5852. }
  5853. }
  5854. foreach(int c,annotationColumns.keys())
  5855. {
  5856. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5857. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  5858. {
  5859. xmlout.writeStartElement("annotation");
  5860. xmlout.writeAttribute("series",annotationColumns.value(c));
  5861. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).
  5862. toString());
  5863. xmlout.writeEndElement();
  5864. }
  5865. }
  5866. xmlout.writeEndElement();
  5867. /*:509*/
  5868. #line 11352 "./typica.w"
  5869. }
  5870. }
  5871. xmlout.writeEndElement();
  5872. xmlout.writeEndElement();
  5873. xmlout.writeEndDocument();
  5874. out->close();
  5875. return true;
  5876. }
  5877. /*:506*//*510:*/
  5878. #line 11480 "./typica.w"
  5879. XMLOutput::XMLOutput(MeasurementModel*model,QIODevice*device,int timec)
  5880. :QObject(NULL),data(model),out(device),time(timec)
  5881. {
  5882. }
  5883. void XMLOutput::setModel(MeasurementModel*model)
  5884. {
  5885. data= model;
  5886. }
  5887. void XMLOutput::setTimeColumn(int column)
  5888. {
  5889. time= column;
  5890. }
  5891. void XMLOutput::setDevice(QIODevice*device)
  5892. {
  5893. out= device;
  5894. }
  5895. /*:510*//*511:*/
  5896. #line 11509 "./typica.w"
  5897. void XMLOutput::addTemperatureColumn(const QString&series,int column)
  5898. {
  5899. temperatureColumns.insert(column,series);
  5900. }
  5901. void XMLOutput::addControlColumn(const QString&series,int column)
  5902. {
  5903. controlColumns.insert(column,series);
  5904. }
  5905. void XMLOutput::addAnnotationColumn(const QString&series,int column)
  5906. {
  5907. annotationColumns.insert(column,series);
  5908. }
  5909. /*:511*/
  5910. #line 558 "./typica.w"
  5911. /*513:*/
  5912. #line 11566 "./typica.w"
  5913. bool XMLInput::input()
  5914. {
  5915. if(!in->open(QIODevice::ReadOnly|QIODevice::Text))
  5916. {
  5917. return false;
  5918. }
  5919. QXmlStreamReader xmlin(in);
  5920. QMap<QString,int> temperatureColumns;
  5921. QMap<QString,int> annotationColumns;
  5922. int nextColumn= firstc;
  5923. /*514:*/
  5924. #line 11597 "./typica.w"
  5925. while(!xmlin.isDTD())
  5926. {
  5927. xmlin.readNext();
  5928. }
  5929. if(xmlin.isDTD())
  5930. {
  5931. if(xmlin.text()=="<!DOCTYPE roastlog>")
  5932. {
  5933. /*515:*/
  5934. #line 11619 "./typica.w"
  5935. emit newTemperatureColumn(firstc,"Bean");
  5936. emit newAnnotationColumn(firstc+1,"Note");
  5937. emit lastColumn(firstc+1);
  5938. /*:515*/
  5939. #line 11606 "./typica.w"
  5940. }
  5941. else
  5942. {
  5943. xmlin.readNext();
  5944. /*516:*/
  5945. #line 11628 "./typica.w"
  5946. while(xmlin.name()!="roast")
  5947. {
  5948. if(xmlin.isStartElement())
  5949. {
  5950. if((xmlin.name()=="tempseries")||(xmlin.name()=="controlseries"))
  5951. {
  5952. temperatureColumns.insert(xmlin.attributes().value("name").
  5953. toString(),
  5954. nextColumn);
  5955. emit newTemperatureColumn(nextColumn,
  5956. xmlin.attributes().value("name").
  5957. toString());
  5958. nextColumn++;
  5959. }
  5960. else if(xmlin.name()=="noteseries")
  5961. {
  5962. annotationColumns.insert(xmlin.attributes().value("name").
  5963. toString(),nextColumn);
  5964. emit newAnnotationColumn(nextColumn,
  5965. xmlin.attributes().value("name").
  5966. toString());
  5967. nextColumn++;
  5968. }
  5969. }
  5970. xmlin.readNext();
  5971. }
  5972. emit lastColumn(nextColumn-1);
  5973. /*:516*/
  5974. #line 11611 "./typica.w"
  5975. }
  5976. }
  5977. /*:514*/
  5978. #line 11577 "./typica.w"
  5979. QTime timeval= QTime();
  5980. double tempval= 0;
  5981. QString noteval= QString();
  5982. int column;
  5983. int counter= 0;
  5984. while(!xmlin.atEnd())
  5985. {
  5986. /*517:*/
  5987. #line 11669 "./typica.w"
  5988. xmlin.readNext();
  5989. if(xmlin.isStartElement())
  5990. {
  5991. /*518:*/
  5992. #line 11695 "./typica.w"
  5993. if(xmlin.name()=="time")
  5994. {
  5995. timeval= QTime::fromString(xmlin.readElementText(),"mm:ss.zzz");
  5996. }
  5997. else if(xmlin.name()=="temperature")
  5998. {
  5999. column= xmlin.attributes().value("series").toString().isEmpty()?
  6000. firstc:temperatureColumns.value(xmlin.attributes().
  6001. value("series").toString());
  6002. bool relative= (xmlin.attributes().value("relative")=="true");
  6003. tempval= xmlin.readElementText().toDouble();
  6004. Measurement measurement(tempval,timeval);
  6005. if(relative)
  6006. {
  6007. measurement.insert("relative",true);
  6008. }
  6009. emit measure(measurement,column);
  6010. }
  6011. else if(xmlin.name()=="control")
  6012. {
  6013. column= xmlin.attributes().value("series").toString().isEmpty()?
  6014. firstc:temperatureColumns.value(xmlin.attributes().
  6015. value("series").toString());
  6016. tempval= xmlin.readElementText().toDouble();
  6017. Measurement measurement(tempval,timeval,Units::Unitless);
  6018. emit measure(measurement,column);
  6019. }
  6020. else if(xmlin.name()=="annotation")
  6021. {
  6022. column= xmlin.attributes().value("series").toString().isEmpty()?
  6023. firstc+1:annotationColumns.value(xmlin.attributes().
  6024. value("series").toString());
  6025. noteval= xmlin.readElementText();
  6026. if(!noteval.isEmpty())
  6027. {
  6028. emit annotation(noteval,firstc,column);
  6029. }
  6030. }
  6031. /*:518*/
  6032. #line 11673 "./typica.w"
  6033. }
  6034. counter++;
  6035. if(counter%100==0)
  6036. {
  6037. QCoreApplication::processEvents();
  6038. }
  6039. /*:517*/
  6040. #line 11585 "./typica.w"
  6041. }
  6042. return true;
  6043. }
  6044. /*:513*//*519:*/
  6045. #line 11737 "./typica.w"
  6046. XMLInput::XMLInput(QIODevice*input,int c):
  6047. firstc(c),in(input)
  6048. {
  6049. }
  6050. void XMLInput::setFirstColumn(int column)
  6051. {
  6052. firstc= column;
  6053. }
  6054. void XMLInput::setDevice(QIODevice*device)
  6055. {
  6056. in= device;
  6057. }
  6058. /*:519*/
  6059. #line 559 "./typica.w"
  6060. /*524:*/
  6061. #line 11828 "./typica.w"
  6062. bool CSVOutput::output()
  6063. {
  6064. if(!out->open(QIODevice::WriteOnly|QIODevice::Text))
  6065. {
  6066. return false;
  6067. }
  6068. QTextStream output(out);
  6069. /*525:*/
  6070. #line 11852 "./typica.w"
  6071. output<<"Time";
  6072. foreach(int c,temperatureColumns.keys())
  6073. {
  6074. output<<','<<temperatureColumns.value(c);
  6075. }
  6076. foreach(int c,controlColumns.keys())
  6077. {
  6078. output<<','<<controlColumns.value(c);
  6079. }
  6080. foreach(int c,annotationColumns.keys())
  6081. {
  6082. output<<','<<annotationColumns.value(c);
  6083. }
  6084. output<<'\n';
  6085. /*:525*/
  6086. #line 11836 "./typica.w"
  6087. bool oresult;
  6088. for(int i= 0;i<data->rowCount();i++)
  6089. {
  6090. /*508:*/
  6091. #line 11391 "./typica.w"
  6092. oresult= false;
  6093. foreach(int c,temperatureColumns.keys())
  6094. {
  6095. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6096. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  6097. {
  6098. oresult= true;
  6099. break;
  6100. }
  6101. }
  6102. foreach(int c,controlColumns.keys())
  6103. {
  6104. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6105. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  6106. {
  6107. oresult= true;
  6108. break;
  6109. }
  6110. }
  6111. if(oresult==false)
  6112. {
  6113. foreach(int c,annotationColumns.keys())
  6114. {
  6115. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6116. !(data->data(data->index(i,c),Qt::DisplayRole).toString().
  6117. isEmpty()))
  6118. {
  6119. oresult= true;
  6120. break;
  6121. }
  6122. }
  6123. }
  6124. /*:508*/
  6125. #line 11840 "./typica.w"
  6126. if(oresult)
  6127. {
  6128. /*526:*/
  6129. #line 11877 "./typica.w"
  6130. output<<data->data(data->index(i,time),Qt::DisplayRole).toString();
  6131. foreach(int c,temperatureColumns.keys())
  6132. {
  6133. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  6134. }
  6135. foreach(int c,controlColumns.keys())
  6136. {
  6137. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  6138. }
  6139. foreach(int c,annotationColumns.keys())
  6140. {
  6141. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  6142. }
  6143. output<<'\n';
  6144. /*:526*/
  6145. #line 11843 "./typica.w"
  6146. }
  6147. }
  6148. out->close();
  6149. return true;
  6150. }
  6151. /*:524*//*527:*/
  6152. #line 11896 "./typica.w"
  6153. CSVOutput::CSVOutput(MeasurementModel*model,QIODevice*device,int timec):
  6154. data(model),out(device),time(timec)
  6155. {
  6156. }
  6157. void CSVOutput::setModel(MeasurementModel*model)
  6158. {
  6159. data= model;
  6160. }
  6161. void CSVOutput::setTimeColumn(int column)
  6162. {
  6163. time= column;
  6164. }
  6165. void CSVOutput::addTemperatureColumn(const QString&series,int column)
  6166. {
  6167. temperatureColumns.insert(column,series);
  6168. }
  6169. void CSVOutput::addControlColumn(const QString&series,int column)
  6170. {
  6171. controlColumns.insert(column,series);
  6172. }
  6173. void CSVOutput::addAnnotationColumn(const QString&series,int column)
  6174. {
  6175. annotationColumns.insert(column,series);
  6176. }
  6177. void CSVOutput::setDevice(QIODevice*device)
  6178. {
  6179. out= device;
  6180. }
  6181. #line 1 "./webview.w"
  6182. /*:527*/
  6183. #line 560 "./typica.w"
  6184. /*562:*/
  6185. #line 12157 "./typica.w"
  6186. QString SaltModel::arrayLiteral(int column,int role)const
  6187. {
  6188. QString literal= "'{";
  6189. for(int i= 0;i<rowCount();i++)
  6190. {
  6191. QString datum= data(index(i,column),role).toString();
  6192. if(!datum.isEmpty())
  6193. {
  6194. literal.append(datum);
  6195. literal.append(", ");
  6196. }
  6197. }
  6198. if(literal.size()> 2)
  6199. {
  6200. literal.chop(2);
  6201. }
  6202. literal.append("}'");
  6203. return literal;
  6204. }
  6205. QString SaltModel::quotedArrayLiteral(int column,int role)const
  6206. {
  6207. QString literal= "'{";
  6208. for(int i= 0;i<rowCount();i++)
  6209. {
  6210. QString datum= data(index(i,column),role).toString();
  6211. if(!datum.isEmpty())
  6212. {
  6213. literal.append("\"");
  6214. literal.append(datum);
  6215. literal.append("\", ");
  6216. }
  6217. }
  6218. if(literal.size()> 2)
  6219. {
  6220. literal.chop(2);
  6221. }
  6222. literal.append("}'");
  6223. return literal;
  6224. }
  6225. /*:562*//*563:*/
  6226. #line 12201 "./typica.w"
  6227. QModelIndex SaltModel::parent(const QModelIndex&)const
  6228. {
  6229. return QModelIndex();
  6230. }
  6231. /*:563*//*564:*/
  6232. #line 12220 "./typica.w"
  6233. bool SaltModel::setData(const QModelIndex&index,const QVariant&value,
  6234. int role)
  6235. {
  6236. /*565:*/
  6237. #line 12251 "./typica.w"
  6238. bool valid= false;
  6239. if(index.isValid())
  6240. {
  6241. if(index.row()<modelData.size())
  6242. {
  6243. if(index.column()<colcount)
  6244. {
  6245. valid= true;
  6246. }
  6247. }
  6248. }
  6249. /*:565*/
  6250. #line 12224 "./typica.w"
  6251. if(!valid)
  6252. {
  6253. return false;
  6254. }
  6255. if(index.row()==modelData.size()-1)
  6256. {
  6257. beginInsertRows(QModelIndex(),modelData.size(),modelData.size());
  6258. /*566:*/
  6259. #line 12267 "./typica.w"
  6260. QList<QMap<int,QVariant> > newRow;
  6261. QMap<int,QVariant> defaults;
  6262. for(int i= 0;i<colcount;i++)
  6263. {
  6264. newRow.append(defaults);
  6265. }
  6266. modelData.append(newRow);
  6267. /*:566*/
  6268. #line 12232 "./typica.w"
  6269. endInsertRows();
  6270. }
  6271. QList<QMap<int,QVariant> > row= modelData.at(index.row());
  6272. QMap<int,QVariant> cell= row.at(index.column());
  6273. cell.insert(role,value);
  6274. if(role==Qt::EditRole)
  6275. {
  6276. cell.insert(Qt::DisplayRole,value);
  6277. }
  6278. row.replace(index.column(),cell);
  6279. modelData.replace(index.row(),row);
  6280. emit dataChanged(index,index);
  6281. return true;
  6282. }
  6283. /*:564*//*567:*/
  6284. #line 12278 "./typica.w"
  6285. SaltModel::SaltModel(int columns):QAbstractItemModel(),colcount(columns)
  6286. {
  6287. for(int i= 0;i<columns;i++)
  6288. {
  6289. hData<<"";
  6290. }
  6291. /*566:*/
  6292. #line 12267 "./typica.w"
  6293. QList<QMap<int,QVariant> > newRow;
  6294. QMap<int,QVariant> defaults;
  6295. for(int i= 0;i<colcount;i++)
  6296. {
  6297. newRow.append(defaults);
  6298. }
  6299. modelData.append(newRow);
  6300. /*:566*/
  6301. #line 12285 "./typica.w"
  6302. }
  6303. /*:567*//*568:*/
  6304. #line 12290 "./typica.w"
  6305. SaltModel::~SaltModel()
  6306. {
  6307. }
  6308. /*:568*//*569:*/
  6309. #line 12300 "./typica.w"
  6310. int SaltModel::rowCount(const QModelIndex&parent)const
  6311. {
  6312. return(parent==QModelIndex()?modelData.size():0);
  6313. }
  6314. int SaltModel::columnCount(const QModelIndex&parent)const
  6315. {
  6316. return(parent==QModelIndex()?colcount:0);
  6317. }
  6318. /*:569*//*570:*/
  6319. #line 12313 "./typica.w"
  6320. bool SaltModel::setHeaderData(int section,Qt::Orientation orientation,
  6321. const QVariant&value,int)
  6322. {
  6323. if(orientation==Qt::Horizontal&&section<colcount)
  6324. {
  6325. hData.replace(section,value.toString());
  6326. emit headerDataChanged(orientation,section,section);
  6327. return true;
  6328. }
  6329. return false;
  6330. }
  6331. /*:570*//*571:*/
  6332. #line 12328 "./typica.w"
  6333. QVariant SaltModel::data(const QModelIndex&index,int role)const
  6334. {
  6335. /*565:*/
  6336. #line 12251 "./typica.w"
  6337. bool valid= false;
  6338. if(index.isValid())
  6339. {
  6340. if(index.row()<modelData.size())
  6341. {
  6342. if(index.column()<colcount)
  6343. {
  6344. valid= true;
  6345. }
  6346. }
  6347. }
  6348. /*:565*/
  6349. #line 12331 "./typica.w"
  6350. if(!valid)
  6351. {
  6352. return QVariant();
  6353. }
  6354. QList<QMap<int,QVariant> > row= modelData.at(index.row());
  6355. QMap<int,QVariant> cell= row.at(index.column());
  6356. return cell.value(role,QVariant());
  6357. }
  6358. QVariant SaltModel::headerData(int section,Qt::Orientation orientation,
  6359. int role)const
  6360. {
  6361. if(orientation==Qt::Horizontal&&role==Qt::DisplayRole&&
  6362. section<colcount)
  6363. {
  6364. return QVariant(hData.at(section));
  6365. }
  6366. return QVariant();
  6367. }
  6368. /*:571*//*572:*/
  6369. #line 12355 "./typica.w"
  6370. Qt::ItemFlags SaltModel::flags(const QModelIndex&index)const
  6371. {
  6372. /*565:*/
  6373. #line 12251 "./typica.w"
  6374. bool valid= false;
  6375. if(index.isValid())
  6376. {
  6377. if(index.row()<modelData.size())
  6378. {
  6379. if(index.column()<colcount)
  6380. {
  6381. valid= true;
  6382. }
  6383. }
  6384. }
  6385. /*:565*/
  6386. #line 12358 "./typica.w"
  6387. if(valid)
  6388. {
  6389. return Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable|Qt::ItemIsDropEnabled;
  6390. }
  6391. return 0;
  6392. }
  6393. /*:572*//*573:*/
  6394. #line 12369 "./typica.w"
  6395. QModelIndex SaltModel::index(int row,int column,
  6396. const QModelIndex&parent)const
  6397. {
  6398. if(parent==QModelIndex())
  6399. {
  6400. if(row<modelData.size()&&column<colcount)
  6401. {
  6402. return createIndex(row,column);
  6403. }
  6404. }
  6405. return QModelIndex();
  6406. }
  6407. /*:573*//*574:*/
  6408. #line 12387 "./typica.w"
  6409. void SaltModel::clear()
  6410. {
  6411. beginResetModel();
  6412. modelData.clear();
  6413. /*566:*/
  6414. #line 12267 "./typica.w"
  6415. QList<QMap<int,QVariant> > newRow;
  6416. QMap<int,QVariant> defaults;
  6417. for(int i= 0;i<colcount;i++)
  6418. {
  6419. newRow.append(defaults);
  6420. }
  6421. modelData.append(newRow);
  6422. /*:566*/
  6423. #line 12392 "./typica.w"
  6424. endResetModel();
  6425. }
  6426. /*:574*//*575:*/
  6427. #line 12401 "./typica.w"
  6428. bool SaltModel::removeRows(int row,int count,
  6429. const QModelIndex&parent)
  6430. {
  6431. if(parent==QModelIndex())
  6432. {
  6433. if(row>=0&&count> 0&&(row+count-1)<modelData.size())
  6434. {
  6435. beginRemoveRows(parent,row,row+count-1);
  6436. for(int i= 0;i<count;i++)
  6437. {
  6438. modelData.removeAt(row);
  6439. }
  6440. endRemoveRows();
  6441. if(modelData.size()==0)
  6442. {
  6443. beginInsertRows(parent,0,0);
  6444. /*566:*/
  6445. #line 12267 "./typica.w"
  6446. QList<QMap<int,QVariant> > newRow;
  6447. QMap<int,QVariant> defaults;
  6448. for(int i= 0;i<colcount;i++)
  6449. {
  6450. newRow.append(defaults);
  6451. }
  6452. modelData.append(newRow);
  6453. /*:566*/
  6454. #line 12418 "./typica.w"
  6455. endInsertRows();
  6456. }
  6457. return true;
  6458. }
  6459. }
  6460. return false;
  6461. }
  6462. /*:575*//*576:*/
  6463. #line 12432 "./typica.w"
  6464. int SaltModel::findData(const QVariant&value,int column,int role)
  6465. {
  6466. for(int i= 0;i<modelData.size();i++)
  6467. {
  6468. if(modelData.at(i).size()> column)
  6469. {
  6470. if(modelData.at(i).at(column).contains(role))
  6471. {
  6472. if(modelData.at(i).at(column).value(role)==value)
  6473. {
  6474. return i;
  6475. }
  6476. }
  6477. }
  6478. }
  6479. return-1;
  6480. }
  6481. /*:576*/
  6482. #line 561 "./typica.w"
  6483. /*578:*/
  6484. #line 12496 "./typica.w"
  6485. SqlComboBox*SqlComboBox::clone(QWidget*parent)
  6486. {
  6487. SqlComboBox*widget= new SqlComboBox();
  6488. widget->setParent(parent);
  6489. for(int i= 0;i<count();i++)
  6490. {
  6491. widget->addItem(itemText(i),itemData(i));
  6492. }
  6493. return widget;
  6494. }
  6495. /*:578*//*579:*/
  6496. #line 12513 "./typica.w"
  6497. void SqlComboBox::showData(bool show)
  6498. {
  6499. dataColumnShown= show;
  6500. }
  6501. /*:579*//*580:*/
  6502. #line 12527 "./typica.w"
  6503. void SqlComboBox::addNullOption()
  6504. {
  6505. addItem(specialNullText,specialNullData);
  6506. }
  6507. void SqlComboBox::setNullText(QString nullText)
  6508. {
  6509. specialNullText= nullText;
  6510. }
  6511. void SqlComboBox::setNullData(QVariant nullData)
  6512. {
  6513. specialNullData= nullData;
  6514. }
  6515. /*:580*//*581:*/
  6516. #line 12550 "./typica.w"
  6517. void SqlComboBox::setDataColumn(int column)
  6518. {
  6519. dataColumn= column;
  6520. }
  6521. void SqlComboBox::setDisplayColumn(int column)
  6522. {
  6523. displayColumn= column;
  6524. }
  6525. /*:581*//*582:*/
  6526. #line 12564 "./typica.w"
  6527. void SqlComboBox::addSqlOptions(QString query)
  6528. {
  6529. SqlQueryConnection h;
  6530. QSqlQuery*dbquery= h.operator->();
  6531. if(!dbquery->exec(query))
  6532. {
  6533. QSqlError error= dbquery->lastError();
  6534. qDebug()<<error.databaseText();
  6535. qDebug()<<error.driverText();
  6536. qDebug()<<error.text();
  6537. qDebug()<<dbquery->lastQuery();
  6538. }
  6539. while(dbquery->next())
  6540. {
  6541. QString displayValue(dbquery->value(displayColumn).toString());
  6542. QString dataValue(dbquery->value(dataColumn).toString());
  6543. if(dataColumnShown)
  6544. {
  6545. displayValue.append(QString(" (%1)").arg(dataValue));
  6546. }
  6547. addItem(displayValue,dataValue);
  6548. }
  6549. }
  6550. /*:582*//*583:*/
  6551. #line 12600 "./typica.w"
  6552. SqlComboBox::SqlComboBox():
  6553. dataColumn(0),displayColumn(0),dataColumnShown(false),
  6554. specialNullText(tr("Unknown")),specialNullData(QVariant::String)
  6555. {
  6556. view()->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
  6557. }
  6558. SqlComboBox::~SqlComboBox()
  6559. {
  6560. }
  6561. /*:583*/
  6562. #line 562 "./typica.w"
  6563. /*585:*/
  6564. #line 12639 "./typica.w"
  6565. void SqlComboBoxDelegate::setWidget(SqlComboBox*widget)
  6566. {
  6567. delegate= widget;
  6568. }
  6569. /*:585*//*586:*/
  6570. #line 12648 "./typica.w"
  6571. QWidget*SqlComboBoxDelegate::createEditor(QWidget*parent,
  6572. const QStyleOptionViewItem&,
  6573. const QModelIndex&)const
  6574. {
  6575. return delegate->clone(parent);
  6576. }
  6577. /*:586*//*587:*/
  6578. #line 12659 "./typica.w"
  6579. void SqlComboBoxDelegate::setEditorData(QWidget*editor,
  6580. const QModelIndex&index)const
  6581. {
  6582. SqlComboBox*self= qobject_cast<SqlComboBox*> (editor);
  6583. self->setCurrentIndex(self->findData(
  6584. index.model()->data(index,
  6585. Qt::UserRole).toString()));
  6586. }
  6587. /*:587*//*588:*/
  6588. #line 12672 "./typica.w"
  6589. void SqlComboBoxDelegate::setModelData(QWidget*editor,
  6590. QAbstractItemModel*model,
  6591. const QModelIndex&index)const
  6592. {
  6593. SqlComboBox*self= qobject_cast<SqlComboBox*> (editor);
  6594. model->setData(index,self->itemData(self->currentIndex(),Qt::UserRole),
  6595. Qt::UserRole);
  6596. model->setData(index,self->currentText(),Qt::DisplayRole);
  6597. }
  6598. /*:588*//*589:*/
  6599. #line 12685 "./typica.w"
  6600. void SqlComboBoxDelegate::updateEditorGeometry(QWidget*editor,
  6601. const QStyleOptionViewItem&option,
  6602. const QModelIndex&)const
  6603. {
  6604. editor->setGeometry(option.rect);
  6605. }
  6606. /*:589*//*590:*/
  6607. #line 12696 "./typica.w"
  6608. QSize SqlComboBoxDelegate::sizeHint()const
  6609. {
  6610. return delegate->sizeHint();
  6611. }
  6612. /*:590*//*591:*/
  6613. #line 12704 "./typica.w"
  6614. SqlComboBoxDelegate::SqlComboBoxDelegate(QObject*parent)
  6615. :QItemDelegate(parent)
  6616. {
  6617. }
  6618. /*:591*/
  6619. #line 563 "./typica.w"
  6620. /*554:*/
  6621. #line 11966 "./typica.w"
  6622. Application::Application(int&argc,char**argv):QApplication(argc,argv)
  6623. {
  6624. /*555:*/
  6625. #line 11981 "./typica.w"
  6626. setOrganizationName("Wilson's Coffee & Tea");
  6627. setOrganizationDomain("wilsonscoffee.com");
  6628. setApplicationName(PROGRAM_NAME);
  6629. /*:555*/
  6630. #line 11969 "./typica.w"
  6631. /*556:*/
  6632. #line 11990 "./typica.w"
  6633. QTranslator base;
  6634. if(base.load(QString("qt_%1").arg(QLocale::system().name())))
  6635. {
  6636. installTranslator(&base);
  6637. }
  6638. QTranslator app;
  6639. if(app.load(QString("%1_%2").arg("Typica").arg(QLocale::system().name())))
  6640. {
  6641. installTranslator(&app);
  6642. }
  6643. /*:556*/
  6644. #line 11970 "./typica.w"
  6645. /*274:*/
  6646. #line 123 "./measurement.w"
  6647. qRegisterMetaType<Measurement> ("Measurement");
  6648. /*:274*/
  6649. #line 11971 "./typica.w"
  6650. /*762:*/
  6651. #line 15905 "./typica.w"
  6652. NodeInserter*inserter= new NodeInserter(tr("NI DAQmx Base Device"),
  6653. tr("NI DAQmx Base"),
  6654. "nidaqmxbase",NULL);
  6655. topLevelNodeInserters.append(inserter);
  6656. /*:762*//*770:*/
  6657. #line 16136 "./typica.w"
  6658. #ifdef Q_OS_WIN32
  6659. inserter= new NodeInserter(tr("NI DAQmx Device"),tr("NI DAQmx"),"nidaqmx",NULL);
  6660. topLevelNodeInserters.append(inserter);
  6661. #endif
  6662. /*:770*//*794:*/
  6663. #line 17099 "./typica.w"
  6664. #if 0
  6665. inserter= new NodeInserter(tr("Modbus RTU Port"),tr("Modbus RTU Port"),"modbusrtuport",NULL);
  6666. topLevelNodeInserters.append(inserter);
  6667. #endif
  6668. /*:794*//*838:*/
  6669. #line 18581 "./typica.w"
  6670. inserter= new NodeInserter(tr("Modbus RTU Device"),tr("Modbus RTU Device"),"modbusrtu",NULL);
  6671. topLevelNodeInserters.append(inserter);
  6672. #line 1 "./unsupportedserial.w"
  6673. /*:838*//*848:*/
  6674. #line 272 "./unsupportedserial.w"
  6675. inserter= new NodeInserter(tr("Other Device"),tr("Other Device"),
  6676. "unsupporteddevice",NULL);
  6677. topLevelNodeInserters.append(inserter);
  6678. /*:848*//*934:*/
  6679. #line 1241 "./dataqsdk.w"
  6680. #ifdef Q_OS_WIN32
  6681. inserter= new NodeInserter(tr("DATAQ SDK Device"),tr("DATAQ Device"),
  6682. "dataqsdk",NULL);
  6683. topLevelNodeInserters.append(inserter);
  6684. #endif
  6685. #line 18803 "./typica.w"
  6686. #line 1 "./scales.w"
  6687. /*:934*//*959:*/
  6688. #line 495 "./scales.w"
  6689. inserter= new NodeInserter(tr("Serial Scale"),tr("Scale"),"scale",NULL);
  6690. topLevelNodeInserters.append(inserter);
  6691. #line 18805 "./typica.w"
  6692. #line 1 "./valueannotation.w"
  6693. /*:959*/
  6694. #line 11972 "./typica.w"
  6695. }
  6696. /*:554*//*558:*/
  6697. #line 12013 "./typica.w"
  6698. QDomDocument*Application::configuration()
  6699. {
  6700. return&conf;
  6701. }
  6702. /*:558*//*559:*/
  6703. #line 12022 "./typica.w"
  6704. QSqlDatabase Application::database()
  6705. {
  6706. QString connectionName;
  6707. QSqlDatabase connection=
  6708. QSqlDatabase::database(QLatin1String(QSqlDatabase::defaultConnection),false);
  6709. do
  6710. {
  6711. connectionName= QUuid::createUuid().toString();
  6712. }while(QSqlDatabase::connectionNames().contains(connectionName));
  6713. return QSqlDatabase::cloneDatabase(connection,QString(connectionName));
  6714. }
  6715. /*:559*//*697:*/
  6716. #line 14508 "./typica.w"
  6717. void Application::saveDeviceConfiguration()
  6718. {
  6719. QSettings settings;
  6720. settings.setValue("DeviceConfiguration",
  6721. QVariant(deviceConfigurationDocument.toByteArray()));
  6722. }
  6723. /*:697*//*698:*/
  6724. #line 14520 "./typica.w"
  6725. QDomDocument Application::deviceConfiguration()
  6726. {
  6727. if(deviceConfigurationDocument.isNull())
  6728. {
  6729. /*699:*/
  6730. #line 14534 "./typica.w"
  6731. QSettings settings;
  6732. QByteArray document= settings.value("DeviceConfiguration").toByteArray();
  6733. QString etext;
  6734. int eline;
  6735. int ecol;
  6736. if(document.length()==0)
  6737. {
  6738. qDebug()<<"Loaded settings length is 0. Creating new configuration.";
  6739. /*700:*/
  6740. #line 14558 "./typica.w"
  6741. QFile emptyDocument(":/resources/xml/EmptyDeviceConfiguration.xml");
  6742. emptyDocument.open(QIODevice::ReadOnly);
  6743. if(!deviceConfigurationDocument.setContent(&emptyDocument,false,
  6744. &etext,&eline,&ecol))
  6745. {
  6746. /*701:*/
  6747. #line 14575 "./typica.w"
  6748. qDebug()<<QString(tr("An error occurred loading device configuration."));
  6749. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  6750. qDebug()<<etext;
  6751. /*:701*/
  6752. #line 14564 "./typica.w"
  6753. }
  6754. else
  6755. {
  6756. saveDeviceConfiguration();
  6757. }
  6758. /*:700*/
  6759. #line 14543 "./typica.w"
  6760. }
  6761. else
  6762. {
  6763. if(!deviceConfigurationDocument.setContent(document,false,
  6764. &etext,&eline,&ecol))
  6765. {
  6766. /*701:*/
  6767. #line 14575 "./typica.w"
  6768. qDebug()<<QString(tr("An error occurred loading device configuration."));
  6769. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  6770. qDebug()<<etext;
  6771. /*:701*/
  6772. #line 14550 "./typica.w"
  6773. /*700:*/
  6774. #line 14558 "./typica.w"
  6775. QFile emptyDocument(":/resources/xml/EmptyDeviceConfiguration.xml");
  6776. emptyDocument.open(QIODevice::ReadOnly);
  6777. if(!deviceConfigurationDocument.setContent(&emptyDocument,false,
  6778. &etext,&eline,&ecol))
  6779. {
  6780. /*701:*/
  6781. #line 14575 "./typica.w"
  6782. qDebug()<<QString(tr("An error occurred loading device configuration."));
  6783. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  6784. qDebug()<<etext;
  6785. /*:701*/
  6786. #line 14564 "./typica.w"
  6787. }
  6788. else
  6789. {
  6790. saveDeviceConfiguration();
  6791. }
  6792. /*:700*/
  6793. #line 14551 "./typica.w"
  6794. }
  6795. }
  6796. /*:699*/
  6797. #line 14525 "./typica.w"
  6798. }
  6799. return deviceConfigurationDocument;
  6800. }
  6801. /*:698*//*729:*/
  6802. #line 15176 "./typica.w"
  6803. void Application::registerDeviceConfigurationWidget(QString driver,
  6804. QMetaObject widget)
  6805. {
  6806. deviceConfigurationWidgets.insert(driver,widget);
  6807. }
  6808. /*:729*//*730:*/
  6809. #line 15192 "./typica.w"
  6810. QWidget*Application::deviceConfigurationWidget(DeviceTreeModel*model,
  6811. const QModelIndex&index)
  6812. {
  6813. QVariant nodeReference= index.data(Qt::UserRole);
  6814. QDomElement referenceElement= model->referenceElement(
  6815. model->data(index,Qt::UserRole).toString());
  6816. QMetaObject metaObject=
  6817. deviceConfigurationWidgets.value(referenceElement.attribute("driver"),
  6818. QWidget::staticMetaObject);
  6819. QWidget*editor;
  6820. if(metaObject.className()==QWidget::staticMetaObject.className())
  6821. {
  6822. editor= NULL;
  6823. }
  6824. else
  6825. {
  6826. editor= qobject_cast<QWidget*> (
  6827. metaObject.newInstance(Q_ARG(DeviceTreeModel*,model),
  6828. Q_ARG(QModelIndex,index)));
  6829. }
  6830. return editor;
  6831. }
  6832. /*:730*/
  6833. #line 564 "./typica.w"
  6834. /*600:*/
  6835. #line 12851 "./typica.w"
  6836. SqlConnectionSetup::SqlConnectionSetup():
  6837. formLayout(new QFormLayout),driver(new QComboBox),hostname(new QLineEdit),
  6838. dbname(new QLineEdit),user(new QLineEdit),password(new QLineEdit),
  6839. layout(new QVBoxLayout),buttons(new QHBoxLayout),
  6840. cancelButton(new QPushButton(tr("Cancel"))),
  6841. connectButton(new QPushButton(tr("Connect")))
  6842. {
  6843. driver->addItem("PostgreSQL","QPSQL");
  6844. formLayout->addRow(tr("Database driver:"),driver);
  6845. formLayout->addRow(tr("Host name:"),hostname);
  6846. formLayout->addRow(tr("Database name:"),dbname);
  6847. formLayout->addRow(tr("User name:"),user);
  6848. password->setEchoMode(QLineEdit::Password);
  6849. formLayout->addRow(tr("Password:"),password);
  6850. layout->addLayout(formLayout);
  6851. buttons->addStretch(1);
  6852. buttons->addWidget(cancelButton);
  6853. connect(cancelButton,SIGNAL(clicked(bool)),this,SLOT(reject()));
  6854. buttons->addWidget(connectButton);
  6855. layout->addLayout(buttons);
  6856. connect(connectButton,SIGNAL(clicked(bool)),this,SLOT(testConnection()));
  6857. setLayout(layout);
  6858. setModal(true);
  6859. }
  6860. SqlConnectionSetup::~SqlConnectionSetup()
  6861. {
  6862. }
  6863. /*:600*//*601:*/
  6864. #line 12885 "./typica.w"
  6865. void SqlConnectionSetup::testConnection()
  6866. {
  6867. QSqlDatabase database=
  6868. QSqlDatabase::addDatabase(driver->itemData(driver->currentIndex()).
  6869. toString());
  6870. database.setConnectOptions("application_name=Typica");
  6871. database.setHostName(hostname->text());
  6872. database.setDatabaseName(dbname->text());
  6873. database.setUserName(user->text());
  6874. database.setPassword(password->text());
  6875. if(database.open())
  6876. {
  6877. QSettings settings;
  6878. settings.setValue("database/exists","true");
  6879. settings.setValue("database/driver",
  6880. driver->itemData(driver->currentIndex()).toString());
  6881. settings.setValue("database/hostname",hostname->text());
  6882. settings.setValue("database/dbname",dbname->text());
  6883. settings.setValue("database/user",user->text());
  6884. settings.setValue("database/password",password->text());
  6885. database.close();
  6886. accept();
  6887. }
  6888. else
  6889. {
  6890. QMessageBox::information(this,tr("Database connection failed"),
  6891. tr("Failed to connect to database."));
  6892. }
  6893. }
  6894. /*:601*/
  6895. #line 565 "./typica.w"
  6896. /*605:*/
  6897. #line 12987 "./typica.w"
  6898. SqlQueryView::SqlQueryView(QWidget*parent):QTableView(parent)
  6899. {
  6900. setModel(new QSqlQueryModel);
  6901. connect(this,SIGNAL(doubleClicked(QModelIndex)),
  6902. this,SLOT(openRow(QModelIndex)));
  6903. connect(horizontalHeader(),SIGNAL(sectionResized(int,int,int)),
  6904. this,SLOT(persistColumnResize(int,int,int)));
  6905. }
  6906. /*:605*//*606:*/
  6907. #line 13002 "./typica.w"
  6908. void SqlQueryView::persistColumnResize(int column,int,int newsize)
  6909. {
  6910. /*607:*/
  6911. #line 13011 "./typica.w"
  6912. QSettings settings;
  6913. /*608:*/
  6914. #line 13024 "./typica.w"
  6915. QWidget*topLevelWidget= this;
  6916. while(topLevelWidget->parentWidget())
  6917. {
  6918. topLevelWidget= topLevelWidget->parentWidget();
  6919. }
  6920. /*:608*/
  6921. #line 13013 "./typica.w"
  6922. settings.setValue(QString("columnWidths/%1/%2/%3").
  6923. arg(topLevelWidget->objectName()).
  6924. arg(objectName()).arg(column),
  6925. QVariant(newsize));
  6926. /*:607*/
  6927. #line 13005 "./typica.w"
  6928. }
  6929. /*:606*//*609:*/
  6930. #line 13034 "./typica.w"
  6931. void SqlQueryView::showEvent(QShowEvent*event)
  6932. {
  6933. /*610:*/
  6934. #line 13044 "./typica.w"
  6935. QSettings settings;
  6936. /*608:*/
  6937. #line 13024 "./typica.w"
  6938. QWidget*topLevelWidget= this;
  6939. while(topLevelWidget->parentWidget())
  6940. {
  6941. topLevelWidget= topLevelWidget->parentWidget();
  6942. }
  6943. /*:608*/
  6944. #line 13046 "./typica.w"
  6945. QString baseKey=
  6946. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  6947. arg(objectName());
  6948. for(int i= 0;i<model()->columnCount();i++)
  6949. {
  6950. QString key= QString("%1/%2").arg(baseKey).arg(i);
  6951. if(settings.contains(key))
  6952. {
  6953. setColumnWidth(i,settings.value(key).toInt());
  6954. }
  6955. }
  6956. /*:610*/
  6957. #line 13037 "./typica.w"
  6958. event->accept();
  6959. }
  6960. /*:609*//*611:*/
  6961. #line 13061 "./typica.w"
  6962. void SqlQueryView::openRow(const QModelIndex&index)
  6963. {
  6964. emit openEntry(((QSqlQueryModel*)model())->record(index.row()).value(0).toString());
  6965. emit openEntryRow(index.row());
  6966. }
  6967. /*:611*//*612:*/
  6968. #line 13070 "./typica.w"
  6969. void SqlQueryView::setQuery(const QString&query)
  6970. {
  6971. QSqlDatabase database= AppInstance->database();
  6972. database.open();
  6973. QSqlQuery q(query,database);
  6974. ((QSqlQueryModel*)model())->setQuery(q);
  6975. database.close();
  6976. }
  6977. bool SqlQueryView::setHeaderData(int section,Qt::Orientation orientation,
  6978. const QVariant&value,int role)
  6979. {
  6980. return model()->setHeaderData(section,orientation,value,role);
  6981. }
  6982. /*:612*//*613:*/
  6983. #line 13088 "./typica.w"
  6984. QVariant SqlQueryView::data(int row,int column,int role)
  6985. {
  6986. return model()->data(model()->index(row,column),role);
  6987. }
  6988. /*:613*/
  6989. #line 566 "./typica.w"
  6990. /*149:*/
  6991. #line 3453 "./typica.w"
  6992. SqlQueryConnection::SqlQueryConnection(const QString&query)
  6993. {
  6994. QSqlDatabase database= AppInstance->database();
  6995. database.open();
  6996. q= new QSqlQuery(query,database);
  6997. connection= database.connectionName();
  6998. }
  6999. /*:149*//*150:*/
  7000. #line 3466 "./typica.w"
  7001. SqlQueryConnection::~SqlQueryConnection()
  7002. {
  7003. delete q;
  7004. {
  7005. QSqlDatabase database= QSqlDatabase::database(connection);
  7006. database.close();
  7007. }
  7008. QSqlDatabase::removeDatabase(connection);
  7009. }
  7010. /*:150*//*151:*/
  7011. #line 3480 "./typica.w"
  7012. QSqlQuery*SqlQueryConnection::operator->()const
  7013. {
  7014. return q;
  7015. }
  7016. /*:151*/
  7017. #line 567 "./typica.w"
  7018. /*632:*/
  7019. #line 13445 "./typica.w"
  7020. ReportTable::ReportTable(QTextFrame*frame,QDomElement description):
  7021. area(frame),configuration(description)
  7022. {
  7023. refresh();
  7024. }
  7025. ReportTable::~ReportTable()
  7026. {
  7027. }
  7028. /*:632*//*633:*/
  7029. #line 13461 "./typica.w"
  7030. void ReportTable::bind(QString placeholder,QVariant value)
  7031. {
  7032. bindings.insert(placeholder,value);
  7033. }
  7034. /*:633*//*634:*/
  7035. #line 13471 "./typica.w"
  7036. void ReportTable::refresh()
  7037. {
  7038. /*635:*/
  7039. #line 13492 "./typica.w"
  7040. QTextCursor cursor= area->firstCursorPosition();
  7041. while(cursor<area->lastCursorPosition())
  7042. {
  7043. cursor.movePosition(QTextCursor::Right,QTextCursor::KeepAnchor);
  7044. }
  7045. cursor.removeSelectedText();
  7046. /*:635*/
  7047. #line 13474 "./typica.w"
  7048. int rows= 1;
  7049. int columns= 1;
  7050. int currentRow= 0;
  7051. QTextTable*table= cursor.insertTable(rows,columns);
  7052. /*636:*/
  7053. #line 13505 "./typica.w"
  7054. QTextTableFormat format= table->format();
  7055. format.setBorderStyle(QTextFrameFormat::BorderStyle_None);
  7056. if(configuration.hasAttribute("align"))
  7057. {
  7058. if(configuration.attribute("align")=="center")
  7059. {
  7060. format.setAlignment(Qt::AlignHCenter);
  7061. }
  7062. }
  7063. table->setFormat(format);
  7064. /*:636*/
  7065. #line 13479 "./typica.w"
  7066. /*637:*/
  7067. #line 13519 "./typica.w"
  7068. QDomNodeList children= configuration.childNodes();
  7069. for(int i= 0;i<children.count();i++)
  7070. {
  7071. QDomNode current;
  7072. QDomElement currentElement;
  7073. current= children.at(i);
  7074. if(current.isElement())
  7075. {
  7076. currentElement= current.toElement();
  7077. if(currentElement.tagName()=="query")
  7078. {
  7079. /*638:*/
  7080. #line 13546 "./typica.w"
  7081. SqlQueryConnection h;
  7082. QSqlQuery*query= h.operator->();
  7083. query->prepare(currentElement.text());
  7084. foreach(QString key,bindings.uniqueKeys())
  7085. {
  7086. if(currentElement.text().contains(key))
  7087. {
  7088. query->bindValue(key,bindings.value(key));
  7089. }
  7090. }
  7091. query->exec();
  7092. if(!query->next())
  7093. {
  7094. continue;
  7095. }
  7096. if(query->record().count()> columns)
  7097. {
  7098. table->appendColumns(query->record().count()-columns);
  7099. }
  7100. do
  7101. {
  7102. table->appendRows(1);
  7103. rows++;
  7104. currentRow++;
  7105. for(int j= 0;j<query->record().count();j++)
  7106. {
  7107. QTextTableCell cell= table->cellAt(currentRow,j);
  7108. cursor= cell.firstCursorPosition();
  7109. cursor.insertText(query->value(j).toString());
  7110. }
  7111. }while(query->next());
  7112. /*:638*/
  7113. #line 13531 "./typica.w"
  7114. }
  7115. else if(currentElement.tagName()=="row")
  7116. {
  7117. /*639:*/
  7118. #line 13586 "./typica.w"
  7119. table->appendRows(1);
  7120. currentRow++;
  7121. rows++;
  7122. QDomNodeList rowChildren= currentElement.childNodes();
  7123. int currentColumn= 0;
  7124. for(int j= 0;j<rowChildren.count();j++)
  7125. {
  7126. QDomNode node;
  7127. QDomElement nodeElement;
  7128. node= rowChildren.at(j);
  7129. if(node.isElement())
  7130. {
  7131. nodeElement= node.toElement();
  7132. if(nodeElement.tagName()=="cell")
  7133. {
  7134. if(currentColumn==columns)
  7135. {
  7136. table->appendColumns(1);
  7137. columns++;
  7138. }
  7139. QTextTableCell cell= table->cellAt(currentRow,currentColumn);
  7140. cursor= cell.firstCursorPosition();
  7141. cursor.insertText(nodeElement.text());
  7142. currentColumn++;
  7143. }
  7144. }
  7145. }
  7146. /*:639*/
  7147. #line 13535 "./typica.w"
  7148. }
  7149. }
  7150. }
  7151. /*:637*/
  7152. #line 13480 "./typica.w"
  7153. if(rows> 1)
  7154. {
  7155. table->removeRows(0,1);
  7156. }
  7157. }
  7158. /*:634*/
  7159. #line 568 "./typica.w"
  7160. /*665:*/
  7161. #line 13690 "./typica.w"
  7162. FormArray::FormArray(QDomElement description):configuration(description),
  7163. maxwidth(-1),maxheight(-1)
  7164. {
  7165. setWidget(&itemContainer);
  7166. itemContainer.setLayout(&itemLayout);
  7167. }
  7168. /*:665*//*666:*/
  7169. #line 13707 "./typica.w"
  7170. void FormArray::addElements(int copies)
  7171. {
  7172. QStack<QWidget*> *widgetStack= new QStack<QWidget*> ;
  7173. QStack<QLayout*> *layoutStack= new QStack<QLayout*> ;
  7174. QWidget*widget;
  7175. for(int i= 0;i<copies;i++)
  7176. {
  7177. widget= new QWidget;
  7178. if(maxwidth> -1)
  7179. {
  7180. widget->setMaximumWidth(maxwidth);
  7181. }
  7182. if(maxheight> -1)
  7183. {
  7184. widget->setMaximumHeight(maxheight);
  7185. }
  7186. if(configuration.hasChildNodes())
  7187. {
  7188. widgetStack->push(widget);
  7189. populateWidget(configuration,widgetStack,layoutStack);
  7190. widgetStack->pop();
  7191. widget->setMinimumHeight(widget->sizeHint().height());
  7192. itemLayout.addWidget(widget);
  7193. if(widget->sizeHint().height()> maxheight&&maxheight> -1)
  7194. {
  7195. itemContainer.setMinimumHeight(maxheight*elements()+50);
  7196. }
  7197. else
  7198. {
  7199. itemContainer.setMinimumHeight(itemContainer.sizeHint().height()
  7200. +widget->sizeHint().height());
  7201. }
  7202. if(maxwidth> -1)
  7203. {
  7204. itemContainer.setMinimumWidth(maxwidth+50);
  7205. }
  7206. else
  7207. {
  7208. itemContainer.setMinimumWidth(widget->sizeHint().width()+50);
  7209. }
  7210. }
  7211. }
  7212. }
  7213. /*:666*//*667:*/
  7214. #line 13757 "./typica.w"
  7215. QWidget*FormArray::elementAt(int index)
  7216. {
  7217. if(index<itemLayout.count())
  7218. {
  7219. QLayoutItem*item= itemLayout.itemAt(index);
  7220. return item->widget();
  7221. }
  7222. else
  7223. {
  7224. return NULL;
  7225. }
  7226. }
  7227. /*:667*//*668:*/
  7228. #line 13774 "./typica.w"
  7229. void FormArray::removeAllElements()
  7230. {
  7231. while(itemLayout.count()> 0)
  7232. {
  7233. QLayoutItem*item;
  7234. item= itemLayout.itemAt(0);
  7235. item->widget()->hide();
  7236. itemLayout.removeWidget(item->widget());
  7237. }
  7238. itemContainer.setMinimumHeight(0);
  7239. }
  7240. /*:668*//*669:*/
  7241. #line 13790 "./typica.w"
  7242. int FormArray::elements()
  7243. {
  7244. return itemLayout.count();
  7245. }
  7246. /*:669*//*670:*/
  7247. #line 13801 "./typica.w"
  7248. void FormArray::setMaximumElementWidth(int width)
  7249. {
  7250. maxwidth= width;
  7251. }
  7252. void FormArray::setMaximumElementHeight(int height)
  7253. {
  7254. maxheight= height;
  7255. }
  7256. /*:670*/
  7257. #line 569 "./typica.w"
  7258. /*676:*/
  7259. #line 13932 "./typica.w"
  7260. ScaleControl::ScaleControl():QGraphicsView(NULL,NULL),nonScoredValue(-1),
  7261. scoredValue(-1),initialSet(false),finalSet(false),scaleDown(false)
  7262. {
  7263. left<<QPointF(0,5)<<QPointF(10,0)<<QPointF(10,10)<<
  7264. QPointF(0,5);
  7265. right<<QPointF(10,5)<<QPointF(0,0)<<QPointF(0,10)<<
  7266. QPointF(10,5);
  7267. down<<QPointF(0,0)<<QPointF(-5,-10)<<QPointF(5,-10)<<
  7268. QPointF(0,0);
  7269. up<<QPointF(0,0)<<QPointF(-5,10)<<QPointF(4,10)<<QPointF(0,0);
  7270. initialBrush.setColor(QColor(170,170,255));
  7271. initialBrush.setStyle(Qt::SolidPattern);
  7272. finalBrush.setColor(Qt::blue);
  7273. finalBrush.setStyle(Qt::SolidPattern);
  7274. initialDecrement.setPolygon(left);
  7275. initialDecrement.setBrush(initialBrush);
  7276. initialDecrement.setPos(0,0);
  7277. scene.addItem(&initialDecrement);
  7278. initialIncrement.setPolygon(right);
  7279. initialIncrement.setBrush(initialBrush);
  7280. initialIncrement.setPos(122,0);
  7281. scene.addItem(&initialIncrement);
  7282. finalDecrement.setPolygon(left);
  7283. finalDecrement.setBrush(finalBrush);
  7284. finalDecrement.setPos(0,12);
  7285. scene.addItem(&finalDecrement);
  7286. finalIncrement.setPolygon(right);
  7287. finalIncrement.setBrush(finalBrush);
  7288. finalIncrement.setPos(122,12);
  7289. scene.addItem(&finalIncrement);
  7290. scalePath.moveTo(0,10);
  7291. scalePath.lineTo(100,10);
  7292. scalePath.moveTo(0,0);
  7293. scalePath.lineTo(0,20);
  7294. scalePath.moveTo(10,5);
  7295. scalePath.lineTo(10,15);
  7296. scalePath.moveTo(20,5);
  7297. scalePath.lineTo(20,15);
  7298. scalePath.moveTo(30,5);
  7299. scalePath.lineTo(30,15);
  7300. scalePath.moveTo(40,5);
  7301. scalePath.lineTo(40,15);
  7302. scalePath.moveTo(50,0);
  7303. scalePath.lineTo(50,20);
  7304. scalePath.moveTo(60,5);
  7305. scalePath.lineTo(60,15);
  7306. scalePath.moveTo(70,5);
  7307. scalePath.lineTo(70,15);
  7308. scalePath.moveTo(80,5);
  7309. scalePath.lineTo(80,15);
  7310. scalePath.moveTo(90,5);
  7311. scalePath.lineTo(90,15);
  7312. scalePath.moveTo(100,0);
  7313. scalePath.lineTo(100,20);
  7314. scaleLine.setPath(scalePath);
  7315. scaleLine.setPos(16,1);
  7316. scene.addItem(&scaleLine);
  7317. setScene(&scene);
  7318. initialIndicator.setPolygon(down);
  7319. initialIndicator.setBrush(initialBrush);
  7320. finalIndicator.setPolygon(up);
  7321. finalIndicator.setBrush(finalBrush);
  7322. setMinimumSize(sizeHint());
  7323. setMaximumSize(sizeHint());
  7324. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  7325. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  7326. setMinimumSize(sizeHint());
  7327. }
  7328. /*:676*//*677:*/
  7329. #line 14005 "./typica.w"
  7330. QSize ScaleControl::sizeHint()const
  7331. {
  7332. return QSize(140,30);
  7333. }
  7334. /*:677*//*678:*/
  7335. #line 14014 "./typica.w"
  7336. void ScaleControl::setInitialValue(double value)
  7337. {
  7338. if(value>=0&&value<=10)
  7339. {
  7340. nonScoredValue= value;
  7341. if(!initialSet)
  7342. {
  7343. scene.addItem(&initialIndicator);
  7344. }
  7345. initialSet= true;
  7346. initialIndicator.setPos(value*10+16,10);
  7347. emit initialChanged(value);
  7348. if(!finalSet)
  7349. {
  7350. setFinalValue(value);
  7351. }
  7352. }
  7353. }
  7354. void ScaleControl::setFinalValue(double value)
  7355. {
  7356. if(value>=0&&value<=10)
  7357. {
  7358. scoredValue= value;
  7359. if(!finalSet)
  7360. {
  7361. scene.addItem(&finalIndicator);
  7362. }
  7363. finalSet= true;
  7364. finalIndicator.setPos(value*10+16,11);
  7365. emit finalChanged(value);
  7366. }
  7367. }
  7368. /*:678*//*679:*/
  7369. #line 14051 "./typica.w"
  7370. double ScaleControl::initialValue(void)
  7371. {
  7372. return nonScoredValue;
  7373. }
  7374. double ScaleControl::finalValue(void)
  7375. {
  7376. return scoredValue;
  7377. }
  7378. /*:679*//*680:*/
  7379. #line 14072 "./typica.w"
  7380. void ScaleControl::mousePressEvent(QMouseEvent*event)
  7381. {
  7382. /*681:*/
  7383. #line 14084 "./typica.w"
  7384. if(event->button()!=Qt::LeftButton)
  7385. {
  7386. event->ignore();
  7387. return;
  7388. }
  7389. /*:681*/
  7390. #line 14075 "./typica.w"
  7391. scaleDown= true;
  7392. event->accept();
  7393. }
  7394. /*:680*//*682:*/
  7395. #line 14095 "./typica.w"
  7396. void ScaleControl::mouseReleaseEvent(QMouseEvent*event)
  7397. {
  7398. /*681:*/
  7399. #line 14084 "./typica.w"
  7400. if(event->button()!=Qt::LeftButton)
  7401. {
  7402. event->ignore();
  7403. return;
  7404. }
  7405. /*:681*/
  7406. #line 14098 "./typica.w"
  7407. if(!scaleDown)
  7408. {
  7409. event->ignore();
  7410. return;
  7411. }
  7412. scaleDown= false;
  7413. QPointF sceneCoordinate= mapToScene(event->x(),event->y());
  7414. /*683:*/
  7415. #line 14120 "./typica.w"
  7416. if(sceneCoordinate.x()>=0&&sceneCoordinate.x()<=10)
  7417. {
  7418. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  7419. {
  7420. if(initialSet)
  7421. {
  7422. setInitialValue(nonScoredValue-0.05);
  7423. }
  7424. event->accept();
  7425. return;
  7426. }
  7427. else if(sceneCoordinate.y()>=12&&sceneCoordinate.y()<=22)
  7428. {
  7429. if(finalSet)
  7430. {
  7431. setFinalValue(scoredValue-0.05);
  7432. event->accept();
  7433. return;
  7434. }
  7435. }
  7436. }
  7437. /*:683*/
  7438. #line 14106 "./typica.w"
  7439. /*684:*/
  7440. #line 14146 "./typica.w"
  7441. else if(sceneCoordinate.x()>=122&&sceneCoordinate.x()<=132)
  7442. {
  7443. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  7444. {
  7445. if(initialSet)
  7446. {
  7447. setInitialValue(nonScoredValue+0.05);
  7448. event->accept();
  7449. return;
  7450. }
  7451. }
  7452. else if(sceneCoordinate.y()>=12&&sceneCoordinate.y()<=22)
  7453. {
  7454. if(finalSet)
  7455. {
  7456. setFinalValue(scoredValue+0.05);
  7457. event->accept();
  7458. return;
  7459. }
  7460. }
  7461. }
  7462. /*:684*/
  7463. #line 14107 "./typica.w"
  7464. /*685:*/
  7465. #line 14172 "./typica.w"
  7466. double relativeX= sceneCoordinate.x()-16;
  7467. if(initialSet)
  7468. {
  7469. if(relativeX>=0&&relativeX<=100)
  7470. {
  7471. setFinalValue(relativeX/10.0);
  7472. event->accept();
  7473. return;
  7474. }
  7475. }
  7476. else
  7477. {
  7478. if(relativeX>=0&&relativeX<=100)
  7479. {
  7480. setInitialValue(relativeX/10.0);
  7481. event->accept();
  7482. return;
  7483. }
  7484. }
  7485. /*:685*/
  7486. #line 14108 "./typica.w"
  7487. event->ignore();
  7488. return;
  7489. }
  7490. /*:682*/
  7491. #line 570 "./typica.w"
  7492. /*687:*/
  7493. #line 14238 "./typica.w"
  7494. IntensityControl::IntensityControl():QGraphicsView(NULL,NULL),theValue(-1),
  7495. valueSet(false),scaleDown(false)
  7496. {
  7497. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  7498. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  7499. left<<QPointF(0,0)<<QPointF(10,-5)<<QPointF(10,5)<<QPointF(0,0);
  7500. down<<QPointF(0,0)<<QPointF(10,0)<<QPointF(5,10)<<QPointF(0,0);
  7501. up<<QPointF(0,10)<<QPointF(10,10)<<QPointF(5,0)<<QPointF(0,10);
  7502. theBrush.setColor(Qt::blue);
  7503. theBrush.setStyle(Qt::SolidPattern);
  7504. increment.setPolygon(up);
  7505. increment.setBrush(theBrush);
  7506. increment.setPos(0,0);
  7507. scene.addItem(&increment);
  7508. decrement.setPolygon(down);
  7509. decrement.setBrush(theBrush);
  7510. decrement.setPos(0,122);
  7511. scene.addItem(&decrement);
  7512. scalePath.moveTo(5,0);
  7513. scalePath.lineTo(5,100);
  7514. scalePath.moveTo(0,0);
  7515. scalePath.lineTo(10,0);
  7516. scalePath.moveTo(0,10);
  7517. scalePath.lineTo(10,10);
  7518. scalePath.moveTo(0,20);
  7519. scalePath.lineTo(10,20);
  7520. scalePath.moveTo(0,30);
  7521. scalePath.lineTo(10,30);
  7522. scalePath.moveTo(0,40);
  7523. scalePath.lineTo(10,40);
  7524. scalePath.moveTo(0,50);
  7525. scalePath.lineTo(10,50);
  7526. scalePath.moveTo(0,60);
  7527. scalePath.lineTo(10,60);
  7528. scalePath.moveTo(0,70);
  7529. scalePath.lineTo(10,70);
  7530. scalePath.moveTo(0,80);
  7531. scalePath.lineTo(10,80);
  7532. scalePath.moveTo(0,90);
  7533. scalePath.lineTo(10,90);
  7534. scalePath.moveTo(0,100);
  7535. scalePath.lineTo(10,100);
  7536. scaleLine.setPath(scalePath);
  7537. scaleLine.setPos(0,16);
  7538. scene.addItem(&scaleLine);
  7539. setScene(&scene);
  7540. indicator.setPolygon(left);
  7541. indicator.setBrush(theBrush);
  7542. setMinimumSize(sizeHint());
  7543. setMaximumSize(sizeHint());
  7544. }
  7545. /*:687*//*688:*/
  7546. #line 14293 "./typica.w"
  7547. QSize IntensityControl::sizeHint()const
  7548. {
  7549. return QSize(25,160);
  7550. }
  7551. /*:688*//*689:*/
  7552. #line 14308 "./typica.w"
  7553. void IntensityControl::setValue(double val)
  7554. {
  7555. if(val>=0&&val<=10)
  7556. {
  7557. theValue= val;
  7558. if(!valueSet)
  7559. {
  7560. scene.addItem(&indicator);
  7561. }
  7562. valueSet= true;
  7563. indicator.setPos(6,(100-(val*10))+16);
  7564. emit(valueChanged(val));
  7565. }
  7566. else if(val<1)
  7567. {
  7568. setValue(0);
  7569. }
  7570. else
  7571. {
  7572. setValue(10);
  7573. }
  7574. }
  7575. double IntensityControl::value()
  7576. {
  7577. return theValue;
  7578. }
  7579. /*:689*//*690:*/
  7580. #line 14340 "./typica.w"
  7581. void IntensityControl::mousePressEvent(QMouseEvent*event)
  7582. {
  7583. /*681:*/
  7584. #line 14084 "./typica.w"
  7585. if(event->button()!=Qt::LeftButton)
  7586. {
  7587. event->ignore();
  7588. return;
  7589. }
  7590. /*:681*/
  7591. #line 14343 "./typica.w"
  7592. scaleDown= true;
  7593. event->accept();
  7594. }
  7595. /*:690*//*691:*/
  7596. #line 14354 "./typica.w"
  7597. void IntensityControl::mouseReleaseEvent(QMouseEvent*event)
  7598. {
  7599. /*681:*/
  7600. #line 14084 "./typica.w"
  7601. if(event->button()!=Qt::LeftButton)
  7602. {
  7603. event->ignore();
  7604. return;
  7605. }
  7606. /*:681*/
  7607. #line 14357 "./typica.w"
  7608. if(!scaleDown)
  7609. {
  7610. event->ignore();
  7611. return;
  7612. }
  7613. scaleDown= false;
  7614. QPointF sceneCoordinate= mapToScene(event->x(),event->y());
  7615. if(sceneCoordinate.x()>=0&&sceneCoordinate.x()<=16)
  7616. {
  7617. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  7618. {
  7619. if(valueSet)
  7620. {
  7621. setValue(theValue+0.05);
  7622. }
  7623. event->accept();
  7624. return;
  7625. }
  7626. else if(sceneCoordinate.y()>=122&&sceneCoordinate.y()<=132)
  7627. {
  7628. if(valueSet)
  7629. {
  7630. setValue(theValue-0.05);
  7631. }
  7632. event->accept();
  7633. return;
  7634. }
  7635. else if(sceneCoordinate.y()>=16&&sceneCoordinate.y()<=116)
  7636. {
  7637. setValue(10-((sceneCoordinate.y()-16)/10.0));
  7638. event->accept();
  7639. return;
  7640. }
  7641. }
  7642. }
  7643. /*:691*/
  7644. #line 571 "./typica.w"
  7645. /*343:*/
  7646. #line 7626 "./typica.w"
  7647. void ThresholdDetector::newMeasurement(Measurement measure)
  7648. {
  7649. if((currentDirection==Ascending&&previousValue<threshold&&
  7650. previousValue>=0)||(currentDirection==Descending&&
  7651. previousValue> threshold&&previousValue>=0))
  7652. {
  7653. if((currentDirection==Ascending&&measure.temperature()>=threshold)||
  7654. (currentDirection==Descending&&measure.temperature()<=threshold))
  7655. {
  7656. double offset= measure.time().hour()*60*60;
  7657. offset+= measure.time().minute()*60;
  7658. offset+= measure.time().second();
  7659. offset+= measure.time().msec()/1000;
  7660. emit timeForValue(offset);
  7661. }
  7662. }
  7663. previousValue= measure.temperature();
  7664. }
  7665. ThresholdDetector::ThresholdDetector(double value):QObject(NULL),
  7666. previousValue(-1),threshold(value),currentDirection(Ascending)
  7667. {
  7668. }
  7669. void ThresholdDetector::setThreshold(double value)
  7670. {
  7671. threshold= value;
  7672. }
  7673. void ThresholdDetector::setEdgeDirection(EdgeDirection direction)
  7674. {
  7675. currentDirection= direction;
  7676. }
  7677. /*:343*/
  7678. #line 572 "./typica.w"
  7679. /*773:*/
  7680. #line 16176 "./typica.w"
  7681. PortSelector::PortSelector(QWidget*parent):QComboBox(parent),
  7682. lister(new QextSerialEnumerator)
  7683. {
  7684. QList<QextPortInfo> ports= QextSerialEnumerator::getPorts();
  7685. QextPortInfo port;
  7686. foreach(port,ports)
  7687. {
  7688. #ifdef Q_OS_WIN32
  7689. addItem(port.portName);
  7690. #else
  7691. addItem(port.physName);
  7692. #endif
  7693. }
  7694. lister->setUpNotifications();
  7695. connect(lister,SIGNAL(deviceDiscovered(QextPortInfo)),
  7696. this,SLOT(addDevice(QextPortInfo)));
  7697. setEditable(true);
  7698. }
  7699. void PortSelector::addDevice(QextPortInfo port)
  7700. {
  7701. addItem(port.portName);
  7702. }
  7703. /*:773*/
  7704. #line 573 "./typica.w"
  7705. /*775:*/
  7706. #line 16268 "./typica.w"
  7707. BaudSelector::BaudSelector(QWidget*parent):QComboBox(parent)
  7708. {
  7709. QMetaObject meta= BaudSelector::staticMetaObject;
  7710. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("BaudRateType"));
  7711. for(int i= 0;i<type.keyCount();i++)
  7712. {
  7713. addItem(QString("%1").arg(type.value(i)));
  7714. }
  7715. }
  7716. /*:775*/
  7717. #line 574 "./typica.w"
  7718. /*777:*/
  7719. #line 16306 "./typica.w"
  7720. ParitySelector::ParitySelector(QWidget*parent):QComboBox(parent)
  7721. {
  7722. QMetaObject meta= ParitySelector::staticMetaObject;
  7723. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("ParityType"));
  7724. for(int i= 0;i<type.keyCount();i++)
  7725. {
  7726. addItem(QString(type.key(i)),QVariant(type.value(i)));
  7727. }
  7728. }
  7729. /*:777*/
  7730. #line 575 "./typica.w"
  7731. /*779:*/
  7732. #line 16336 "./typica.w"
  7733. FlowSelector::FlowSelector(QWidget*parent):QComboBox(parent)
  7734. {
  7735. QMetaObject meta= FlowSelector::staticMetaObject;
  7736. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("FlowType"));
  7737. for(int i= 0;i<type.keyCount();i++)
  7738. {
  7739. addItem(QString(type.key(i)),QVariant(type.value(i)));
  7740. }
  7741. }
  7742. /*:779*/
  7743. #line 576 "./typica.w"
  7744. /*781:*/
  7745. #line 16371 "./typica.w"
  7746. StopSelector::StopSelector(QWidget*parent):QComboBox(parent)
  7747. {
  7748. QMetaObject meta= StopSelector::staticMetaObject;
  7749. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("StopBitsType"));
  7750. for(int i= 0;i<type.keyCount();i++)
  7751. {
  7752. addItem(QString(type.key(i)),QVariant(type.value(i)));
  7753. }
  7754. }
  7755. /*:781*/
  7756. #line 577 "./typica.w"
  7757. /*836:*/
  7758. #line 18122 "./typica.w"
  7759. ModbusConfigurator::ModbusConfigurator(DeviceTreeModel*model,const QModelIndex&index)
  7760. :BasicDeviceConfigurationWidget(model,index),
  7761. port(new PortSelector),baud(new BaudSelector),parity(new ParitySelector),
  7762. flow(new FlowSelector),stop(new StopSelector),station(new QSpinBox),
  7763. decimalQuery(new QCheckBox(tr("Enable"))),
  7764. decimalAddress(new ShortHexSpinBox),decimalPosition(new QSpinBox),
  7765. unitQuery(new QCheckBox(tr("Enable"))),
  7766. unitAddress(new ShortHexSpinBox),valueF(new QSpinBox),
  7767. valueC(new QSpinBox),fixedUnit(new QComboBox),
  7768. pVAddress(new ShortHexSpinBox),
  7769. sVEnabled(new QCheckBox(tr("Enable"))),
  7770. sVReadAddress(new ShortHexSpinBox),
  7771. deviceLimit(new QCheckBox(tr("Enable"))),
  7772. sVLowerAddr(new ShortHexSpinBox),sVUpperAddr(new ShortHexSpinBox),
  7773. sVLower(new QDoubleSpinBox),sVUpper(new QDoubleSpinBox),
  7774. sVWritable(new QCheckBox(tr("Enable"))),
  7775. sVOutputAddr(new ShortHexSpinBox),
  7776. pVColumnName(new QLineEdit),sVColumnName(new QLineEdit)
  7777. {
  7778. QHBoxLayout*layout= new QHBoxLayout;
  7779. QWidget*form= new QWidget;
  7780. QHBoxLayout*masterLayout= new QHBoxLayout;
  7781. QVBoxLayout*portAndDeviceLayout= new QVBoxLayout;
  7782. QVBoxLayout*seriesLayout= new QVBoxLayout;
  7783. QFormLayout*serialSection= new QFormLayout;
  7784. serialSection->addRow(QString(tr("Port:")),port);
  7785. serialSection->addRow(QString(tr("Baud rate:")),baud);
  7786. serialSection->addRow(QString(tr("Parity:")),parity);
  7787. serialSection->addRow(QString(tr("Flow control:")),flow);
  7788. serialSection->addRow(QString(tr("Stop bits:")),stop);
  7789. QGroupBox*serialSectionBox= new QGroupBox(tr("Serial Port Configuration"));
  7790. serialSectionBox->setLayout(serialSection);
  7791. portAndDeviceLayout->addWidget(serialSectionBox);
  7792. QFormLayout*deviceSection= new QFormLayout;
  7793. station->setMinimum(1);
  7794. station->setMaximum(255);
  7795. decimalPosition->setMinimum(0);
  7796. decimalPosition->setMaximum(9);
  7797. valueF->setMinimum(0);
  7798. valueF->setMaximum(0xFFFF);
  7799. valueC->setMinimum(0);
  7800. valueC->setMaximum(0xFFFF);
  7801. fixedUnit->addItem(tr("Fahrenheit"),QVariant(QString("F")));
  7802. fixedUnit->addItem(tr("Celsius"),QVariant(QString("C")));
  7803. deviceSection->addRow(tr("Station:"),station);
  7804. deviceSection->addRow(tr("Decimal position from device:"),decimalQuery);
  7805. deviceSection->addRow(tr("Decimal position relative address:"),decimalAddress);
  7806. deviceSection->addRow(tr("Fixed decimal position:"),decimalPosition);
  7807. deviceSection->addRow(tr("Measurement unit from device:"),unitQuery);
  7808. deviceSection->addRow(tr("Current unit relative address:"),unitAddress);
  7809. deviceSection->addRow(tr("Value for Fahrenheit:"),valueF);
  7810. deviceSection->addRow(tr("Value for Celsius:"),valueC);
  7811. deviceSection->addRow(tr("Fixed unit:"),fixedUnit);
  7812. QGroupBox*deviceSectionBox= new QGroupBox(tr("Device Configuration"));
  7813. deviceSectionBox->setLayout(deviceSection);
  7814. portAndDeviceLayout->addWidget(deviceSectionBox);
  7815. QFormLayout*pVSection= new QFormLayout;
  7816. pVSection->addRow(tr("Value relative address:"),pVAddress);
  7817. pVSection->addRow(tr("PV column name:"),pVColumnName);
  7818. QCheckBox*pVHideBox= new QCheckBox(tr("Hide this channel"));
  7819. pVSection->addRow(pVHideBox);
  7820. QGroupBox*processValueBox= new QGroupBox(tr("Process Value"));
  7821. processValueBox->setLayout(pVSection);
  7822. seriesLayout->addWidget(processValueBox);
  7823. QFormLayout*sVSection= new QFormLayout;
  7824. sVLower->setDecimals(1);
  7825. sVLower->setMinimum(0.0);
  7826. sVLower->setMaximum(999.9);
  7827. sVUpper->setDecimals(1);
  7828. sVUpper->setMinimum(0.0);
  7829. sVUpper->setMaximum(999.9);
  7830. sVSection->addRow(tr("Set value:"),sVEnabled);
  7831. sVSection->addRow(tr("Read relative address:"),sVReadAddress);
  7832. sVSection->addRow(tr("SV column name:"),sVColumnName);
  7833. sVSection->addRow(tr("Limits from device:"),deviceLimit);
  7834. sVSection->addRow(tr("Lower limit relative address:"),sVLowerAddr);
  7835. sVSection->addRow(tr("Upper limit relative address:"),sVUpperAddr);
  7836. sVSection->addRow(tr("Lower limit:"),sVLower);
  7837. sVSection->addRow(tr("Upper limit:"),sVUpper);
  7838. sVSection->addRow(tr("Output set value:"),sVWritable);
  7839. sVSection->addRow(tr("Output relative address:"),sVOutputAddr);
  7840. QCheckBox*sVHideBox= new QCheckBox(tr("Hide this channel"));
  7841. sVSection->addRow(sVHideBox);
  7842. QGroupBox*setValueBox= new QGroupBox(tr("Set Value"));
  7843. setValueBox->setLayout(sVSection);
  7844. seriesLayout->addWidget(setValueBox);
  7845. masterLayout->addLayout(portAndDeviceLayout);
  7846. masterLayout->addLayout(seriesLayout);
  7847. form->setLayout(masterLayout);
  7848. /*749:*/
  7849. #line 15632 "./typica.w"
  7850. QDomElement referenceElement=
  7851. model->referenceElement(model->data(index,Qt::UserRole).toString());
  7852. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  7853. QDomElement node;
  7854. /*:749*/
  7855. #line 18212 "./typica.w"
  7856. for(int i= 0;i<configData.size();i++)
  7857. {
  7858. node= configData.at(i).toElement();
  7859. if(node.attribute("name")=="port")
  7860. {
  7861. QString portname= node.attribute("value");
  7862. int idx= port->findText(portname);
  7863. if(idx>=0)
  7864. {
  7865. port->setCurrentIndex(idx);
  7866. }
  7867. else
  7868. {
  7869. port->addItem(portname);
  7870. }
  7871. }
  7872. else if(node.attribute("name")=="baud")
  7873. {
  7874. baud->setCurrentIndex(baud->findText(node.attribute("value")));
  7875. }
  7876. else if(node.attribute("name")=="parity")
  7877. {
  7878. parity->setCurrentIndex(parity->findData(node.attribute("value")));
  7879. }
  7880. else if(node.attribute("name")=="flow")
  7881. {
  7882. flow->setCurrentIndex(flow->findData(node.attribute("value")));
  7883. }
  7884. else if(node.attribute("name")=="stop")
  7885. {
  7886. stop->setCurrentIndex(stop->findData(node.attribute("value")));
  7887. }
  7888. else if(node.attribute("name")=="station")
  7889. {
  7890. station->setValue(node.attribute("value").toInt());
  7891. }
  7892. else if(node.attribute("name")=="decimalQuery")
  7893. {
  7894. if(node.attribute("value")=="true")
  7895. {
  7896. decimalQuery->setChecked(true);
  7897. }
  7898. else
  7899. {
  7900. decimalQuery->setChecked(false);
  7901. }
  7902. }
  7903. else if(node.attribute("name")=="decimalAddress")
  7904. {
  7905. decimalAddress->setValue(node.attribute("value").toInt());
  7906. }
  7907. else if(node.attribute("name")=="decimalPosition")
  7908. {
  7909. decimalPosition->setValue(node.attribute("value").toInt());
  7910. }
  7911. else if(node.attribute("name")=="unitQuery")
  7912. {
  7913. if(node.attribute("value")=="true")
  7914. {
  7915. unitQuery->setChecked(true);
  7916. }
  7917. else
  7918. {
  7919. unitQuery->setChecked(false);
  7920. }
  7921. }
  7922. else if(node.attribute("name")=="unitAddress")
  7923. {
  7924. unitAddress->setValue(node.attribute("value").toInt());
  7925. }
  7926. else if(node.attribute("name")=="valueF")
  7927. {
  7928. valueF->setValue(node.attribute("value").toInt());
  7929. }
  7930. else if(node.attribute("name")=="valueC")
  7931. {
  7932. valueC->setValue(node.attribute("value").toInt());
  7933. }
  7934. else if(node.attribute("name")=="fixedUnit")
  7935. {
  7936. fixedUnit->setCurrentIndex(fixedUnit->findText(node.attribute("value")));
  7937. }
  7938. else if(node.attribute("name")=="pVAddress")
  7939. {
  7940. pVAddress->setValue(node.attribute("value").toInt());
  7941. }
  7942. else if(node.attribute("name")=="sVEnabled")
  7943. {
  7944. if(node.attribute("value")=="true")
  7945. {
  7946. sVEnabled->setChecked(true);
  7947. }
  7948. else
  7949. {
  7950. sVEnabled->setChecked(false);
  7951. }
  7952. }
  7953. else if(node.attribute("name")=="sVReadAddress")
  7954. {
  7955. sVReadAddress->setValue(node.attribute("value").toInt());
  7956. }
  7957. else if(node.attribute("name")=="deviceLimit")
  7958. {
  7959. if(node.attribute("value")=="true")
  7960. {
  7961. deviceLimit->setChecked(true);
  7962. }
  7963. else
  7964. {
  7965. deviceLimit->setChecked(false);
  7966. }
  7967. }
  7968. else if(node.attribute("name")=="sVLowerAddr")
  7969. {
  7970. sVLowerAddr->setValue(node.attribute("value").toInt());
  7971. }
  7972. else if(node.attribute("name")=="sVUpperAddr")
  7973. {
  7974. sVUpperAddr->setValue(node.attribute("value").toInt());
  7975. }
  7976. else if(node.attribute("name")=="sVLower")
  7977. {
  7978. sVLower->setValue(node.attribute("value").toDouble());
  7979. }
  7980. else if(node.attribute("name")=="sVUpper")
  7981. {
  7982. sVUpper->setValue(node.attribute("value").toDouble());
  7983. }
  7984. else if(node.attribute("name")=="sVWritable")
  7985. {
  7986. if(node.attribute("value")=="true")
  7987. {
  7988. sVWritable->setChecked(true);
  7989. }
  7990. else
  7991. {
  7992. sVWritable->setChecked(false);
  7993. }
  7994. }
  7995. else if(node.attribute("name")=="sVOutputAddr")
  7996. {
  7997. sVOutputAddr->setValue(node.attribute("value").toInt());
  7998. }
  7999. else if(node.attribute("name")=="pvcolname")
  8000. {
  8001. pVColumnName->setText(node.attribute("value"));
  8002. }
  8003. else if(node.attribute("name")=="svcolname")
  8004. {
  8005. sVColumnName->setText(node.attribute("value"));
  8006. }
  8007. else if(node.attribute("name")=="pvhidden")
  8008. {
  8009. pVHideBox->setChecked(node.attribute("value")=="true");
  8010. }
  8011. else if(node.attribute("name")=="svhidden")
  8012. {
  8013. sVHideBox->setChecked(node.attribute("value")=="true");
  8014. }
  8015. }
  8016. updatePort(port->currentText());
  8017. updateBaudRate(baud->currentText());
  8018. updateParity(parity->itemData(parity->currentIndex()).toString());
  8019. updateFlowControl(flow->itemData(flow->currentIndex()).toString());
  8020. updateStopBits(stop->itemData(stop->currentIndex()).toString());
  8021. updateStation(station->value());
  8022. updateFixedDecimal(decimalQuery->isChecked());
  8023. updateDecimalAddress(decimalAddress->value());
  8024. updateDecimalPosition(decimalPosition->value());
  8025. updateFixedUnit(unitQuery->isChecked());
  8026. updateUnitAddress(unitAddress->value());
  8027. updateValueForF(valueF->value());
  8028. updateValueForC(valueC->value());
  8029. updateUnit(fixedUnit->currentText());
  8030. updatePVAddress(pVAddress->value());
  8031. updateSVEnabled(sVEnabled->isChecked());
  8032. updateSVReadAddress(sVReadAddress->value());
  8033. updateDeviceLimit(deviceLimit->isChecked());
  8034. updateSVLowerAddress(sVLowerAddr->value());
  8035. updateSVUpperAddress(sVUpperAddr->value());
  8036. updateSVLower(sVLower->value());
  8037. updateSVUpper(sVUpper->value());
  8038. updateSVWritable(sVWritable->isChecked());
  8039. updateSVWriteAddress(sVOutputAddr->value());
  8040. updatePVColumnName(pVColumnName->text());
  8041. updateSVColumnName(sVColumnName->text());
  8042. updatePVHidden(pVHideBox->isChecked());
  8043. updateSVHidden(sVHideBox->isChecked());
  8044. connect(port,SIGNAL(currentIndexChanged(QString)),this,SLOT(updatePort(QString)));
  8045. connect(port,SIGNAL(editTextChanged(QString)),this,SLOT(updatePort(QString)));
  8046. connect(baud,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateBaudRate(QString)));
  8047. connect(parity,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateParity(QString)));
  8048. connect(flow,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateFlowControl(QString)));
  8049. connect(stop,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateStopBits(QString)));
  8050. connect(station,SIGNAL(valueChanged(int)),this,SLOT(updateStation(int)));
  8051. connect(decimalQuery,SIGNAL(toggled(bool)),this,SLOT(updateFixedDecimal(bool)));
  8052. connect(decimalAddress,SIGNAL(valueChanged(int)),this,SLOT(updateDecimalAddress(int)));
  8053. connect(decimalPosition,SIGNAL(valueChanged(int)),this,SLOT(updateDecimalPosition(int)));
  8054. connect(unitQuery,SIGNAL(toggled(bool)),this,SLOT(updateFixedUnit(bool)));
  8055. connect(unitAddress,SIGNAL(valueChanged(int)),this,SLOT(updateUnitAddress(int)));
  8056. connect(valueF,SIGNAL(valueChanged(int)),this,SLOT(updateValueForF(int)));
  8057. connect(valueC,SIGNAL(valueChanged(int)),this,SLOT(updateValueForC(int)));
  8058. connect(fixedUnit,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateUnit(QString)));
  8059. connect(pVAddress,SIGNAL(valueChanged(int)),this,SLOT(updatePVAddress(int)));
  8060. connect(sVEnabled,SIGNAL(toggled(bool)),this,SLOT(updateSVEnabled(bool)));
  8061. connect(sVReadAddress,SIGNAL(valueChanged(int)),this,SLOT(updateSVReadAddress(int)));
  8062. connect(deviceLimit,SIGNAL(toggled(bool)),this,SLOT(updateDeviceLimit(bool)));
  8063. connect(sVLowerAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVLowerAddress(int)));
  8064. connect(sVUpperAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVUpperAddress(int)));
  8065. connect(sVLower,SIGNAL(valueChanged(double)),this,SLOT(updateSVLower(double)));
  8066. connect(sVUpper,SIGNAL(valueChanged(double)),this,SLOT(updateSVUpper(double)));
  8067. connect(sVWritable,SIGNAL(toggled(bool)),this,SLOT(updateSVWritable(bool)));
  8068. connect(sVOutputAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVWriteAddress(int)));
  8069. connect(pVColumnName,SIGNAL(textEdited(QString)),this,SLOT(updatePVColumnName(QString)));
  8070. connect(sVColumnName,SIGNAL(textEdited(QString)),this,SLOT(updateSVColumnName(QString)));
  8071. connect(pVHideBox,SIGNAL(toggled(bool)),this,SLOT(updatePVHidden(bool)));
  8072. connect(sVHideBox,SIGNAL(toggled(bool)),this,SLOT(updateSVHidden(bool)));
  8073. layout->addWidget(form);
  8074. setLayout(layout);
  8075. }
  8076. void ModbusConfigurator::updatePort(const QString&newPort)
  8077. {
  8078. updateAttribute("port",newPort);
  8079. }
  8080. void ModbusConfigurator::updateBaudRate(const QString&newRate)
  8081. {
  8082. updateAttribute("baud",newRate);
  8083. }
  8084. void ModbusConfigurator::updateParity(const QString&)
  8085. {
  8086. updateAttribute("parity",parity->itemData(parity->currentIndex()).toString());
  8087. }
  8088. void ModbusConfigurator::updateFlowControl(const QString&)
  8089. {
  8090. updateAttribute("flow",flow->itemData(flow->currentIndex()).toString());
  8091. }
  8092. void ModbusConfigurator::updateStopBits(const QString&)
  8093. {
  8094. updateAttribute("stop",stop->itemData(stop->currentIndex()).toString());
  8095. }
  8096. void ModbusConfigurator::updateStation(int station)
  8097. {
  8098. updateAttribute("station",QString("%1").arg(station));
  8099. }
  8100. void ModbusConfigurator::updateFixedDecimal(bool fixed)
  8101. {
  8102. updateAttribute("decimalQuery",fixed?"true":"false");
  8103. }
  8104. void ModbusConfigurator::updateDecimalAddress(int address)
  8105. {
  8106. updateAttribute("decimalAddress",QString("%1").arg(address));
  8107. }
  8108. void ModbusConfigurator::updateDecimalPosition(int position)
  8109. {
  8110. updateAttribute("decimalPosition",QString("%1").arg(position));
  8111. }
  8112. void ModbusConfigurator::updateFixedUnit(bool fixed)
  8113. {
  8114. updateAttribute("unitQuery",fixed?"true":"false");
  8115. }
  8116. void ModbusConfigurator::updateUnitAddress(int address)
  8117. {
  8118. updateAttribute("unitAddress",QString("%1").arg(address));
  8119. }
  8120. void ModbusConfigurator::updateValueForF(int value)
  8121. {
  8122. updateAttribute("valueF",QString("%1").arg(value));
  8123. }
  8124. void ModbusConfigurator::updateValueForC(int value)
  8125. {
  8126. updateAttribute("valueC",QString("%1").arg(value));
  8127. }
  8128. void ModbusConfigurator::updateUnit(const QString&newUnit)
  8129. {
  8130. updateAttribute("fixedUnit",newUnit);
  8131. }
  8132. void ModbusConfigurator::updatePVAddress(int address)
  8133. {
  8134. updateAttribute("pVAddress",QString("%1").arg(address));
  8135. }
  8136. void ModbusConfigurator::updateSVEnabled(bool enabled)
  8137. {
  8138. updateAttribute("sVEnabled",enabled?"true":"false");
  8139. }
  8140. void ModbusConfigurator::updateSVReadAddress(int address)
  8141. {
  8142. updateAttribute("sVReadAddress",QString("%1").arg(address));
  8143. }
  8144. void ModbusConfigurator::updateDeviceLimit(bool query)
  8145. {
  8146. updateAttribute("deviceLimit",query?"true":"false");
  8147. }
  8148. void ModbusConfigurator::updateSVLowerAddress(int address)
  8149. {
  8150. updateAttribute("sVLowerAddr",QString("%1").arg(address));
  8151. }
  8152. void ModbusConfigurator::updateSVUpperAddress(int address)
  8153. {
  8154. updateAttribute("sVUpperAddr",QString("%1").arg(address));
  8155. }
  8156. void ModbusConfigurator::updateSVLower(double value)
  8157. {
  8158. updateAttribute("sVLower",QString("%1").arg(value));
  8159. }
  8160. void ModbusConfigurator::updateSVUpper(double value)
  8161. {
  8162. updateAttribute("sVUpper",QString("%1").arg(value));
  8163. }
  8164. void ModbusConfigurator::updateSVWritable(bool canWriteSV)
  8165. {
  8166. updateAttribute("sVWritable",canWriteSV?"true":"false");
  8167. }
  8168. void ModbusConfigurator::updateSVWriteAddress(int address)
  8169. {
  8170. updateAttribute("sVOutputAddr",QString("%1").arg(address));
  8171. }
  8172. void ModbusConfigurator::updatePVColumnName(const QString&name)
  8173. {
  8174. updateAttribute("pvcolname",name);
  8175. }
  8176. void ModbusConfigurator::updateSVColumnName(const QString&name)
  8177. {
  8178. updateAttribute("svcolname",name);
  8179. }
  8180. void ModbusConfigurator::updatePVHidden(bool hidden)
  8181. {
  8182. updateAttribute("pvhidden",hidden?"true":"false");
  8183. }
  8184. void ModbusConfigurator::updateSVHidden(bool hidden)
  8185. {
  8186. updateAttribute("svhidden",hidden?"true":"false");
  8187. }
  8188. /*:836*/
  8189. #line 578 "./typica.w"
  8190. /*784:*/
  8191. #line 16420 "./typica.w"
  8192. ShortHexSpinBox::ShortHexSpinBox(QWidget*parent):QSpinBox(parent)
  8193. {
  8194. setMinimum(0);
  8195. setMaximum(0xFFFF);
  8196. setPrefix("0x");
  8197. setMinimumWidth(65);
  8198. }
  8199. QValidator::State ShortHexSpinBox::validate(QString&input,int&)const
  8200. {
  8201. if(input.size()==2)
  8202. {
  8203. return QValidator::Intermediate;
  8204. }
  8205. bool okay;
  8206. input.toInt(&okay,16);
  8207. if(okay)
  8208. {
  8209. return QValidator::Acceptable;
  8210. }
  8211. return QValidator::Invalid;
  8212. }
  8213. int ShortHexSpinBox::valueFromText(const QString&text)const
  8214. {
  8215. return text.toInt(NULL,16);
  8216. }
  8217. QString ShortHexSpinBox::textFromValue(int value)const
  8218. {
  8219. QString retval;
  8220. retval.setNum(value,16);
  8221. while(retval.size()<4)
  8222. {
  8223. retval.prepend("0");
  8224. }
  8225. return retval.toUpper();
  8226. }
  8227. /*:784*/
  8228. #line 579 "./typica.w"
  8229. /*821:*/
  8230. #line 17450 "./typica.w"
  8231. ModbusRTUDevice::ModbusRTUDevice(DeviceTreeModel*model,const QModelIndex&index)
  8232. :QObject(NULL),messageDelayTimer(new QTimer),unitIsF(true),readingsv(false),
  8233. waiting(false)
  8234. {
  8235. QDomElement portReferenceElement= model->referenceElement(model->data(index,
  8236. Qt::UserRole).toString());
  8237. QDomNodeList portConfigData= portReferenceElement.elementsByTagName("attribute");
  8238. QDomElement node;
  8239. QVariantMap attributes;
  8240. for(int i= 0;i<portConfigData.size();i++)
  8241. {
  8242. node= portConfigData.at(i).toElement();
  8243. attributes.insert(node.attribute("name"),node.attribute("value"));
  8244. }
  8245. port= new QextSerialPort(attributes.value("port").toString(),
  8246. QextSerialPort::EventDriven);
  8247. int baudRate= attributes.value("baud").toInt();
  8248. port->setBaudRate((BaudRateType)baudRate);
  8249. double temp= ((double)(1)/(double)(baudRate))*48;
  8250. delayTime= (int)(temp*3000);
  8251. messageDelayTimer->setSingleShot(true);
  8252. connect(messageDelayTimer,SIGNAL(timeout()),this,SLOT(sendNextMessage()));
  8253. port->setDataBits(DATA_8);
  8254. port->setParity((ParityType)attributes.value("parity").toInt());
  8255. port->setStopBits((StopBitsType)attributes.value("stop").toInt());
  8256. port->setFlowControl((FlowType)attributes.value("flow").toInt());
  8257. connect(port,SIGNAL(readyRead()),this,SLOT(dataAvailable()));
  8258. port->open(QIODevice::ReadWrite);
  8259. station= (char)attributes.value("station").toInt();
  8260. if(attributes.value("decimalQuery")=="true")
  8261. {
  8262. decimalPosition= 0;
  8263. QByteArray message;
  8264. message.append(station);
  8265. message.append((char)0x03);
  8266. quint16 address= (quint16)attributes.value("decimalAddress").toInt();
  8267. char*addressBytes= (char*)&address;
  8268. message.append(addressBytes[1]);
  8269. message.append(addressBytes[0]);
  8270. message.append((char)0x00);
  8271. message.append((char)0x01);
  8272. queueMessage(message,this,"decimalResponse(QByteArray)");
  8273. }
  8274. else
  8275. {
  8276. decimalPosition= attributes.value("decimalPosition").toInt();
  8277. }
  8278. valueF= attributes.value("valueF").toInt();
  8279. valueC= attributes.value("valueC").toInt();
  8280. if(attributes.value("unitQuery")=="true")
  8281. {
  8282. QByteArray message;
  8283. message.append(station);
  8284. message.append((char)0x03);
  8285. quint16 address= (quint16)attributes.value("unitAddress").toInt();
  8286. char*addressBytes= (char*)&address;
  8287. message.append(addressBytes[1]);
  8288. message.append(addressBytes[0]);
  8289. message.append((char)0x00);
  8290. message.append((char)0x01);
  8291. queueMessage(message,this,"unitResponse(QByteArray)");
  8292. }
  8293. else
  8294. {
  8295. if(attributes.value("fixedUnit")=="Celsius")
  8296. {
  8297. unitIsF= false;
  8298. }
  8299. }
  8300. if(attributes.value("sVWritable")=="true")
  8301. {
  8302. if(attributes.value("deviceLimit")=="true")
  8303. {
  8304. QByteArray lmessage;
  8305. lmessage.append(station);
  8306. lmessage.append((char)0x03);
  8307. quint16 laddress= (quint16)attributes.value("sVLowerAddr").toInt();
  8308. char*addressBytes= (char*)&laddress;
  8309. lmessage.append(addressBytes[1]);
  8310. lmessage.append(addressBytes[0]);
  8311. lmessage.append((char)0x00);
  8312. lmessage.append((char)0x01);
  8313. queueMessage(lmessage,this,"svlResponse(QByteArray)");
  8314. QByteArray umessage;
  8315. umessage.append(station);
  8316. umessage.append((char)0x03);
  8317. quint16 uaddress= (quint16)attributes.value("sVUpperAddr").toInt();
  8318. addressBytes= (char*)&uaddress;
  8319. umessage.append(addressBytes[1]);
  8320. umessage.append(addressBytes[0]);
  8321. umessage.append((char)0x00);
  8322. umessage.append((char)0x01);
  8323. queueMessage(umessage,this,"svuResponse(QByteArray)");
  8324. }
  8325. else
  8326. {
  8327. outputSVLower= attributes.value("sVLower").toDouble();
  8328. outputSVUpper= attributes.value("sVUpper").toDouble();
  8329. }
  8330. outputSVStub.append(station);
  8331. outputSVStub.append((char)0x06);
  8332. quint16 address= (quint16)attributes.value("sVOutputAddr").toInt();
  8333. char*addressBytes= (char*)&address;
  8334. outputSVStub.append(addressBytes[1]);
  8335. outputSVStub.append(addressBytes[0]);
  8336. }
  8337. Channel*pv= new Channel;
  8338. channels.append(pv);
  8339. pvStub.append(station);
  8340. pvStub.append((char)0x04);
  8341. pvaddress= (quint16)attributes.value("pVAddress").toInt();
  8342. char*pvac= (char*)&pvaddress;
  8343. pvStub.append(pvac[1]);
  8344. pvStub.append(pvac[0]);
  8345. pvStub.append((char)0x00);
  8346. pvStub.append((char)0x01);
  8347. svenabled= attributes.value("sVEnabled").toBool();
  8348. if(svenabled)
  8349. {
  8350. Channel*sv= new Channel;
  8351. channels.append(sv);
  8352. svStub.append(station);
  8353. svStub.append((char)0x04);
  8354. svaddress= (quint16)attributes.value("sVReadAddress").toInt();
  8355. char*svac= (char*)&svaddress;
  8356. svStub.append(svac[1]);
  8357. svStub.append(svac[0]);
  8358. svStub.append((char)0x00);
  8359. svStub.append((char)0x01);
  8360. if(svaddress-pvaddress==1)
  8361. {
  8362. mStub.append(station);
  8363. mStub.append((char)0x04);
  8364. mStub.append(pvac[1]);
  8365. mStub.append(pvac[0]);
  8366. mStub.append((char)0x00);
  8367. mStub.append((char)0x02);
  8368. }
  8369. }
  8370. connect(this,SIGNAL(queueEmpty()),this,SLOT(requestMeasurement()));
  8371. requestMeasurement();
  8372. }
  8373. double ModbusRTUDevice::SVLower()
  8374. {
  8375. return outputSVLower;
  8376. }
  8377. double ModbusRTUDevice::SVUpper()
  8378. {
  8379. return outputSVUpper;
  8380. }
  8381. int ModbusRTUDevice::decimals()
  8382. {
  8383. return decimalPosition;
  8384. }
  8385. void ModbusRTUDevice::decimalResponse(QByteArray response)
  8386. {
  8387. quint16 temp;
  8388. char*tchar= (char*)&temp;
  8389. tchar[1]= response.at(3);
  8390. tchar[0]= response.at(4);
  8391. decimalPosition= temp;
  8392. emit SVDecimalChanged(decimalPosition);
  8393. qDebug()<<"Received decimal response";
  8394. }
  8395. void ModbusRTUDevice::unitResponse(QByteArray response)
  8396. {
  8397. quint16 temp;
  8398. char*tchar= (char*)&temp;
  8399. tchar[1]= response.at(3);
  8400. tchar[0]= response.at(4);
  8401. int value= temp;
  8402. if(value==valueF)
  8403. {
  8404. unitIsF= true;
  8405. }
  8406. else
  8407. {
  8408. unitIsF= false;
  8409. }
  8410. }
  8411. void ModbusRTUDevice::svlResponse(QByteArray response)
  8412. {
  8413. quint16 temp;
  8414. char*tchar= (char*)&temp;
  8415. tchar[1]= response.at(3);
  8416. tchar[0]= response.at(4);
  8417. outputSVLower= (double)temp;
  8418. for(int i= 0;i<decimalPosition;i++)
  8419. {
  8420. outputSVLower/= 10;
  8421. }
  8422. emit SVLowerChanged(outputSVLower);
  8423. }
  8424. void ModbusRTUDevice::svuResponse(QByteArray response)
  8425. {
  8426. quint16 temp;
  8427. char*tchar= (char*)&temp;
  8428. tchar[1]= response.at(3);
  8429. tchar[0]= response.at(4);
  8430. outputSVUpper= (double)temp;
  8431. for(int i= 0;i<decimalPosition;i++)
  8432. {
  8433. outputSVUpper/= 10;
  8434. }
  8435. emit SVUpperChanged(outputSVUpper);
  8436. }
  8437. void ModbusRTUDevice::requestMeasurement()
  8438. {
  8439. if(mStub.length()> 0)
  8440. {
  8441. queueMessage(mStub,this,"mResponse(QByteArray)");
  8442. }
  8443. else
  8444. {
  8445. queueMessage(pvStub,this,"mResponse(QByteArray)");
  8446. if(svenabled)
  8447. {
  8448. queueMessage(svStub,this,"mResponse(QByteArray)");
  8449. }
  8450. }
  8451. }
  8452. void ModbusRTUDevice::mResponse(QByteArray response)
  8453. {
  8454. QTime time= QTime::currentTime();
  8455. if(response.at(2)==0x04)
  8456. {
  8457. /*822:*/
  8458. #line 17699 "./typica.w"
  8459. quint16 pv;
  8460. quint16 sv;
  8461. char*pvBytes= (char*)&pv;
  8462. char*svBytes= (char*)&sv;
  8463. pvBytes[1]= response.at(3);
  8464. pvBytes[0]= response.at(4);
  8465. svBytes[1]= response.at(5);
  8466. svBytes[0]= response.at(6);
  8467. double pvOut= (double)pv;
  8468. double svOut= (double)sv;
  8469. for(int i= 0;i<decimalPosition;i++)
  8470. {
  8471. pvOut/= 10;
  8472. svOut/= 10;
  8473. }
  8474. if(!unitIsF)
  8475. {
  8476. pvOut= pvOut*9/5+32;
  8477. svOut= svOut*9/5+32;
  8478. }
  8479. Measurement pvm(pvOut,time,Units::Fahrenheit);
  8480. Measurement svm(svOut,time,Units::Fahrenheit);
  8481. channels.at(0)->input(pvm);
  8482. channels.at(1)->input(svm);
  8483. /*:822*/
  8484. #line 17686 "./typica.w"
  8485. }
  8486. else
  8487. {
  8488. /*823:*/
  8489. #line 17729 "./typica.w"
  8490. quint16 value;
  8491. char*valueBytes= (char*)&value;
  8492. valueBytes[1]= response.at(3);
  8493. valueBytes[0]= response.at(4);
  8494. double valueOut= (double)value;
  8495. for(int i= 0;i<decimalPosition;i++)
  8496. {
  8497. valueOut/= 10;
  8498. }
  8499. if(!unitIsF)
  8500. {
  8501. valueOut= valueOut*9/5+32;
  8502. }
  8503. if(!svenabled)
  8504. {
  8505. Measurement vm(valueOut,time,Units::Fahrenheit);
  8506. channels.at(0)->input(vm);
  8507. }
  8508. else
  8509. {
  8510. if(readingsv)
  8511. {
  8512. Measurement pvm(savedpv,time,Units::Fahrenheit);
  8513. Measurement svm(valueOut,time,Units::Fahrenheit);
  8514. channels.at(0)->input(pvm);
  8515. channels.at(1)->input(svm);
  8516. readingsv= false;
  8517. }
  8518. else
  8519. {
  8520. savedpv= valueOut;
  8521. readingsv= true;
  8522. }
  8523. }
  8524. /*:823*/
  8525. #line 17690 "./typica.w"
  8526. }
  8527. }
  8528. /*:821*//*824:*/
  8529. #line 17767 "./typica.w"
  8530. ModbusRTUDevice::~ModbusRTUDevice()
  8531. {
  8532. messageDelayTimer->stop();
  8533. port->close();
  8534. }
  8535. /*:824*//*825:*/
  8536. #line 17789 "./typica.w"
  8537. void ModbusRTUDevice::dataAvailable()
  8538. {
  8539. if(messageDelayTimer->isActive())
  8540. {
  8541. messageDelayTimer->stop();
  8542. }
  8543. responseBuffer.append(port->readAll());
  8544. /*826:*/
  8545. #line 17834 "./typica.w"
  8546. if(responseBuffer.size()<5)
  8547. {
  8548. return;
  8549. }
  8550. switch(responseBuffer.at(1))
  8551. {
  8552. case 0x01:
  8553. case 0x02:
  8554. if(responseBuffer.size()<6)
  8555. {
  8556. return;
  8557. }
  8558. responseBuffer= responseBuffer.left(6);
  8559. break;
  8560. case 0x03:
  8561. case 0x04:
  8562. if(responseBuffer.size()<5+responseBuffer.at(2))
  8563. {
  8564. return;
  8565. }
  8566. responseBuffer= responseBuffer.left(5+responseBuffer.at(2));
  8567. break;
  8568. case 0x05:
  8569. case 0x06:
  8570. case 0x10:
  8571. if(responseBuffer.size()<8)
  8572. {
  8573. return;
  8574. }
  8575. responseBuffer= responseBuffer.left(8);
  8576. break;
  8577. }
  8578. /*:826*/
  8579. #line 17797 "./typica.w"
  8580. if(calculateCRC(responseBuffer)==0)
  8581. {
  8582. QObject*object= retObjQueue.at(0);
  8583. char*method= callbackQueue.at(0);
  8584. QMetaMethod metamethod= object->metaObject()->
  8585. method(object->metaObject()->
  8586. indexOfMethod(QMetaObject::normalizedSignature(method)));
  8587. metamethod.invoke(object,Qt::QueuedConnection,
  8588. Q_ARG(QByteArray,responseBuffer));
  8589. messageQueue.removeAt(0);
  8590. retObjQueue.removeAt(0);
  8591. callbackQueue.removeAt(0);
  8592. messageDelayTimer->start(delayTime);
  8593. }
  8594. else
  8595. {
  8596. qDebug()<<"CRC failed";
  8597. }
  8598. waiting= false;
  8599. responseBuffer.clear();
  8600. }
  8601. /*:825*//*827:*/
  8602. #line 17876 "./typica.w"
  8603. quint16 ModbusRTUDevice::calculateCRC(QByteArray data)
  8604. {
  8605. quint16 retval= 0xFFFF;
  8606. int i= 0;
  8607. while(i<data.size())
  8608. {
  8609. retval^= 0x00FF&(quint16)data.at(i);
  8610. for(int j= 0;j<8;j++)
  8611. {
  8612. if(retval&1)
  8613. {
  8614. retval= (retval>>1)^0xA001;
  8615. }
  8616. else
  8617. {
  8618. retval>>= 1;
  8619. }
  8620. }
  8621. i++;
  8622. }
  8623. return retval;
  8624. }
  8625. /*:827*//*828:*/
  8626. #line 17907 "./typica.w"
  8627. void ModbusRTUDevice::queueMessage(QByteArray request,QObject*object,
  8628. const char*callback)
  8629. {
  8630. messageQueue.append(request);
  8631. retObjQueue.append(object);
  8632. callbackQueue.append(const_cast<char*> (callback));
  8633. if(messageQueue.size()==1&&!(messageDelayTimer->isActive()))
  8634. {
  8635. sendNextMessage();
  8636. }
  8637. }
  8638. void ModbusRTUDevice::sendNextMessage()
  8639. {
  8640. if(messageQueue.size()> 0&&!waiting)
  8641. {
  8642. QByteArray message= messageQueue.at(0);
  8643. quint16 crc= calculateCRC(message);
  8644. char*check= (char*)&crc;
  8645. message.append(check[0]);
  8646. message.append(check[1]);
  8647. port->write(message);
  8648. messageDelayTimer->start(delayTime);
  8649. waiting= true;
  8650. }
  8651. else
  8652. {
  8653. emit queueEmpty();
  8654. }
  8655. }
  8656. void ModbusRTUDevice::outputSV(double value)
  8657. {
  8658. for(int i= 0;i<decimalPosition;i++)
  8659. {
  8660. value*= 10;
  8661. }
  8662. quint16 outval= (quint16)value;
  8663. QByteArray message(outputSVStub);
  8664. char*valBytes= (char*)&outval;
  8665. message.append(valBytes[1]);
  8666. message.append(valBytes[0]);
  8667. queueMessage(message,this,"ignore(QByteArray)");
  8668. }
  8669. /*:828*//*829:*/
  8670. #line 17955 "./typica.w"
  8671. void ModbusRTUDevice::ignore(QByteArray)
  8672. {
  8673. return;
  8674. }
  8675. /*:829*/
  8676. #line 580 "./typica.w"
  8677. /*703:*/
  8678. #line 14612 "./typica.w"
  8679. DeviceTreeModelNode::DeviceTreeModelNode(QDomNode&node,int row,
  8680. DeviceTreeModelNode*parent)
  8681. :domNode(node),rowNumber(row),parentItem(parent)
  8682. {
  8683. }
  8684. DeviceTreeModelNode::~DeviceTreeModelNode()
  8685. {
  8686. QHash<int,DeviceTreeModelNode*> ::iterator i;
  8687. for(i= children.begin();i!=children.end();i++)
  8688. {
  8689. delete i.value();
  8690. }
  8691. }
  8692. DeviceTreeModelNode*DeviceTreeModelNode::parent()
  8693. {
  8694. return parentItem;
  8695. }
  8696. int DeviceTreeModelNode::row()
  8697. {
  8698. return rowNumber;
  8699. }
  8700. QDomNode DeviceTreeModelNode::node()const
  8701. {
  8702. return domNode;
  8703. }
  8704. DeviceTreeModelNode*DeviceTreeModelNode::child(int index)
  8705. {
  8706. if(children.contains(index))
  8707. {
  8708. return children[index];
  8709. }
  8710. if(index>=0&&index<domNode.childNodes().count())
  8711. {
  8712. QDomNode childNode= domNode.childNodes().item(index);
  8713. DeviceTreeModelNode*childItem= new DeviceTreeModelNode(childNode,
  8714. index,this);
  8715. children[index]= childItem;
  8716. return childItem;
  8717. }
  8718. return NULL;
  8719. }
  8720. /*:703*/
  8721. #line 581 "./typica.w"
  8722. /*705:*/
  8723. #line 14701 "./typica.w"
  8724. DeviceTreeModel::DeviceTreeModel(QObject*parent)
  8725. :QAbstractItemModel(parent)
  8726. {
  8727. document= AppInstance->deviceConfiguration();
  8728. QDomNodeList elements= document.elementsByTagName("devices");
  8729. if(elements.size()!=1)
  8730. {
  8731. qDebug()<<"Unexpected result when loading device map.";
  8732. }
  8733. treeRoot= elements.at(0);
  8734. root= new DeviceTreeModelNode(treeRoot,0);
  8735. elements= document.elementsByTagName("references");
  8736. if(elements.size()!=1)
  8737. {
  8738. qDebug()<<"No references section. Creating.";
  8739. referenceSection= document.createElement("references");
  8740. document.appendChild(referenceSection);
  8741. }
  8742. else
  8743. {
  8744. referenceSection= elements.at(0);
  8745. }
  8746. connect(this,SIGNAL(dataChanged(QModelIndex,QModelIndex)),
  8747. AppInstance,SLOT(saveDeviceConfiguration()));
  8748. connect(this,SIGNAL(modelReset()),
  8749. AppInstance,SLOT(saveDeviceConfiguration()));
  8750. connect(this,SIGNAL(rowsInserted(QModelIndex,int,int)),
  8751. AppInstance,SLOT(saveDeviceConfiguration()));
  8752. }
  8753. /*:705*//*706:*/
  8754. #line 14736 "./typica.w"
  8755. int DeviceTreeModel::columnCount(const QModelIndex&)const
  8756. {
  8757. return 1;
  8758. }
  8759. int DeviceTreeModel::rowCount(const QModelIndex&parent)const
  8760. {
  8761. if(parent.column()> 0)
  8762. {
  8763. return 0;
  8764. }
  8765. /*707:*/
  8766. #line 14755 "./typica.w"
  8767. DeviceTreeModelNode*parentItem;
  8768. if(!parent.isValid())
  8769. {
  8770. parentItem= root;
  8771. }
  8772. else
  8773. {
  8774. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  8775. }
  8776. /*:707*/
  8777. #line 14748 "./typica.w"
  8778. return parentItem->node().childNodes().count();
  8779. }
  8780. /*:706*//*708:*/
  8781. #line 14769 "./typica.w"
  8782. QModelIndex DeviceTreeModel::index(int row,int column,
  8783. const QModelIndex&parent)const
  8784. {
  8785. if(!hasIndex(row,column,parent))
  8786. {
  8787. return QModelIndex();
  8788. }
  8789. /*707:*/
  8790. #line 14755 "./typica.w"
  8791. DeviceTreeModelNode*parentItem;
  8792. if(!parent.isValid())
  8793. {
  8794. parentItem= root;
  8795. }
  8796. else
  8797. {
  8798. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  8799. }
  8800. /*:707*/
  8801. #line 14777 "./typica.w"
  8802. DeviceTreeModelNode*childItem= parentItem->child(row);
  8803. if(childItem)
  8804. {
  8805. return createIndex(row,column,childItem);
  8806. }
  8807. return QModelIndex();
  8808. }
  8809. /*:708*//*709:*/
  8810. #line 14788 "./typica.w"
  8811. QModelIndex DeviceTreeModel::parent(const QModelIndex&child)const
  8812. {
  8813. if(!child.isValid())
  8814. {
  8815. return QModelIndex();
  8816. }
  8817. DeviceTreeModelNode*childItem=
  8818. static_cast<DeviceTreeModelNode*> (child.internalPointer());
  8819. DeviceTreeModelNode*parentItem= childItem->parent();
  8820. if(!parentItem||parentItem==root)
  8821. {
  8822. return QModelIndex();
  8823. }
  8824. return createIndex(parentItem->row(),0,parentItem);
  8825. }
  8826. /*:709*//*710:*/
  8827. #line 14807 "./typica.w"
  8828. Qt::ItemFlags DeviceTreeModel::flags(const QModelIndex&index)const
  8829. {
  8830. if(!index.isValid())
  8831. {
  8832. return 0;
  8833. }
  8834. return Qt::ItemIsEnabled|Qt::ItemIsSelectable|Qt::ItemIsEditable;
  8835. }
  8836. /*:710*//*711:*/
  8837. #line 14822 "./typica.w"
  8838. QVariant DeviceTreeModel::data(const QModelIndex&index,int role)const
  8839. {
  8840. if(!index.isValid())
  8841. {
  8842. return QVariant();
  8843. }
  8844. if(role!=Qt::DisplayRole&&role!=Qt::UserRole&&role!=Qt::EditRole)
  8845. {
  8846. return QVariant();
  8847. }
  8848. DeviceTreeModelNode*item=
  8849. static_cast<DeviceTreeModelNode*> (index.internalPointer());
  8850. QDomNode node= item->node();
  8851. QDomElement element= node.toElement();
  8852. switch(role)
  8853. {
  8854. case Qt::DisplayRole:
  8855. case Qt::EditRole:
  8856. return QVariant(element.attribute("name"));
  8857. case Qt::UserRole:
  8858. return QVariant(element.attribute("reference"));
  8859. default:
  8860. return QVariant();
  8861. }
  8862. return QVariant();
  8863. }
  8864. /*:711*//*712:*/
  8865. #line 14854 "./typica.w"
  8866. bool DeviceTreeModel::setData(const QModelIndex&index,
  8867. const QVariant&value,int)
  8868. {
  8869. if(!index.isValid())
  8870. {
  8871. return false;
  8872. }
  8873. DeviceTreeModelNode*item=
  8874. static_cast<DeviceTreeModelNode*> (index.internalPointer());
  8875. QDomNode node= item->node();
  8876. QDomElement element= node.toElement();
  8877. element.setAttribute("name",value.toString());
  8878. emit dataChanged(index,index);
  8879. return true;
  8880. }
  8881. /*:712*//*713:*/
  8882. #line 14877 "./typica.w"
  8883. void DeviceTreeModel::newNode(const QString&name,const QString&driver,
  8884. const QModelIndex&parent)
  8885. {
  8886. QString referenceID= QUuid::createUuid().toString();
  8887. /*707:*/
  8888. #line 14755 "./typica.w"
  8889. DeviceTreeModelNode*parentItem;
  8890. if(!parent.isValid())
  8891. {
  8892. parentItem= root;
  8893. }
  8894. else
  8895. {
  8896. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  8897. }
  8898. /*:707*/
  8899. #line 14882 "./typica.w"
  8900. QDomNode parentNode= parentItem->node();
  8901. int newRowNumber= rowCount(parent);
  8902. beginInsertRows(parent,newRowNumber,newRowNumber);
  8903. QDomElement deviceElement= document.createElement("node");
  8904. deviceElement.setAttribute("name",name);
  8905. deviceElement.setAttribute("reference",referenceID);
  8906. parentNode.appendChild(deviceElement);
  8907. QDomElement referenceElement= document.createElement("reference");
  8908. referenceElement.setAttribute("id",referenceID);
  8909. referenceElement.setAttribute("driver",driver);
  8910. referenceSection.appendChild(referenceElement);
  8911. endInsertRows();
  8912. }
  8913. /*:713*//*714:*/
  8914. #line 14900 "./typica.w"
  8915. bool DeviceTreeModel::removeRows(int row,int count,const QModelIndex&parent)
  8916. {
  8917. /*707:*/
  8918. #line 14755 "./typica.w"
  8919. DeviceTreeModelNode*parentItem;
  8920. if(!parent.isValid())
  8921. {
  8922. parentItem= root;
  8923. }
  8924. else
  8925. {
  8926. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  8927. }
  8928. /*:707*/
  8929. #line 14903 "./typica.w"
  8930. QDomNode parentNode= parentItem->node();
  8931. QDomNodeList childNodes= parentNode.childNodes();
  8932. if(childNodes.size()<row+count)
  8933. {
  8934. return false;
  8935. }
  8936. beginRemoveRows(parent,row,row+count-1);
  8937. QList<QDomElement> removalList;
  8938. for(int i= row;i<row+count;i++)
  8939. {
  8940. removalList.append(childNodes.at(i).toElement());
  8941. }
  8942. QDomElement element;
  8943. QDomElement reference;
  8944. for(int i= 0;i<count;i++)
  8945. {
  8946. element= removalList.at(i);
  8947. if(element.hasAttribute("reference"))
  8948. {
  8949. reference= referenceElement(element.attribute("reference"));
  8950. if(!reference.isNull())
  8951. {
  8952. referenceSection.removeChild(reference);
  8953. }
  8954. }
  8955. parentNode.removeChild(element);
  8956. }
  8957. endRemoveRows();
  8958. beginResetModel();
  8959. delete root;
  8960. root= new DeviceTreeModelNode(treeRoot,0);
  8961. endResetModel();
  8962. return true;
  8963. }
  8964. /*:714*//*715:*/
  8965. #line 14942 "./typica.w"
  8966. QDomElement DeviceTreeModel::referenceElement(const QString&id)
  8967. {
  8968. QDomNodeList childNodes= referenceSection.childNodes();
  8969. QDomElement element;
  8970. for(int i= 0;i<childNodes.size();i++)
  8971. {
  8972. element= childNodes.at(i).toElement();
  8973. if(element.hasAttribute("id"))
  8974. {
  8975. if(element.attribute("id")==id)
  8976. {
  8977. return element;
  8978. }
  8979. }
  8980. }
  8981. return QDomElement();
  8982. }
  8983. /*:715*//*716:*/
  8984. #line 14963 "./typica.w"
  8985. QVariant DeviceTreeModel::headerData(int,Qt::Orientation,int)const
  8986. {
  8987. return QVariant();
  8988. }
  8989. /*:716*//*717:*/
  8990. #line 14972 "./typica.w"
  8991. DeviceTreeModel::~DeviceTreeModel()
  8992. {
  8993. delete root;
  8994. }
  8995. /*:717*/
  8996. #line 582 "./typica.w"
  8997. /*744:*/
  8998. #line 15472 "./typica.w"
  8999. BasicDeviceConfigurationWidget::BasicDeviceConfigurationWidget(
  9000. DeviceTreeModel*model,const QModelIndex&index)
  9001. :QWidget(NULL),deviceModel(model),currentNode(index)
  9002. {
  9003. }
  9004. /*:744*//*745:*/
  9005. #line 15484 "./typica.w"
  9006. void BasicDeviceConfigurationWidget::updateAttribute(const QString&name,
  9007. const QString&value)
  9008. {
  9009. QDomElement referenceElement= deviceModel->referenceElement(
  9010. deviceModel->data(currentNode,Qt::UserRole).toString());
  9011. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9012. QDomElement node;
  9013. bool found= false;
  9014. for(int i= 0;i<configData.size();i++)
  9015. {
  9016. node= configData.at(i).toElement();
  9017. if(node.attribute("name")==name)
  9018. {
  9019. node.setAttribute("value",value);
  9020. found= true;
  9021. break;
  9022. }
  9023. }
  9024. if(!found)
  9025. {
  9026. node= AppInstance->deviceConfiguration().createElement("attribute");
  9027. node.setAttribute("name",name);
  9028. node.setAttribute("value",value);
  9029. referenceElement.appendChild(node);
  9030. }
  9031. AppInstance->saveDeviceConfiguration();
  9032. }
  9033. /*:745*//*746:*/
  9034. #line 15518 "./typica.w"
  9035. void BasicDeviceConfigurationWidget::insertChildNode(const QString&name,
  9036. const QString&driver)
  9037. {
  9038. deviceModel->newNode(name,driver,currentNode);
  9039. }
  9040. /*:746*/
  9041. #line 583 "./typica.w"
  9042. /*735:*/
  9043. #line 15316 "./typica.w"
  9044. DeviceConfigurationWindow::DeviceConfigurationWindow():QWidget(NULL),
  9045. view(new QTreeView),configArea(new QScrollArea)
  9046. {
  9047. QSplitter*splitter= new QSplitter;
  9048. QWidget*leftWidget= new QWidget;
  9049. leftWidget->setMinimumWidth(200);
  9050. QVBoxLayout*left= new QVBoxLayout;
  9051. view->setAnimated(true);
  9052. view->setSelectionMode(QAbstractItemView::SingleSelection);
  9053. document= AppInstance->deviceConfiguration();
  9054. model= new DeviceTreeModel;
  9055. view->setModel(model);
  9056. view->setTextElideMode(Qt::ElideNone);
  9057. view->expandAll();
  9058. view->resizeColumnToContents(0);
  9059. connect(model,SIGNAL(modelReset()),view,SLOT(expandAll()));
  9060. QHBoxLayout*treeButtons= new QHBoxLayout;
  9061. QToolButton*addDeviceButton= new QToolButton;
  9062. addDeviceButton->setIcon(QIcon::fromTheme("list-add"));
  9063. addDeviceButton->setToolTip(tr("New Roaster"));
  9064. connect(addDeviceButton,SIGNAL(clicked()),
  9065. this,SLOT(addDevice()));
  9066. QToolButton*removeNodeButton= new QToolButton;
  9067. removeNodeButton->setIcon(QIcon::fromTheme("list-remove"));
  9068. removeNodeButton->setToolTip(tr("Delete Selection"));
  9069. connect(removeNodeButton,SIGNAL(clicked()),this,SLOT(removeNode()));
  9070. treeButtons->addWidget(addDeviceButton);
  9071. treeButtons->addWidget(removeNodeButton);
  9072. left->addWidget(view);
  9073. left->addLayout(treeButtons);
  9074. leftWidget->setLayout(left);
  9075. splitter->addWidget(leftWidget);
  9076. configArea->setMinimumWidth(580);
  9077. configArea->setMinimumHeight(460);
  9078. configArea->setWidgetResizable(true);
  9079. splitter->addWidget(configArea);
  9080. QVBoxLayout*centralLayout= new QVBoxLayout;
  9081. centralLayout->addWidget(splitter);
  9082. setLayout(centralLayout);
  9083. connect(view,SIGNAL(activated(QModelIndex)),
  9084. this,SLOT(newSelection(QModelIndex)));
  9085. connect(view,SIGNAL(clicked(QModelIndex)),
  9086. this,SLOT(newSelection(QModelIndex)));
  9087. connect(model,SIGNAL(rowsInserted(QModelIndex,int,int)),
  9088. view,SLOT(expand(QModelIndex)));
  9089. connect(model,SIGNAL(rowsInserted(QModelIndex,int,int)),
  9090. this,SLOT(resizeColumn()));
  9091. connect(model,SIGNAL(rowsRemoved(QModelIndex,int,int)),
  9092. this,SLOT(resizeColumn()));
  9093. }
  9094. /*:735*//*736:*/
  9095. #line 15371 "./typica.w"
  9096. void DeviceConfigurationWindow::addDevice()
  9097. {
  9098. model->newNode(tr("New Roaster"),"roaster",QModelIndex());
  9099. }
  9100. /*:736*//*737:*/
  9101. #line 15379 "./typica.w"
  9102. void DeviceConfigurationWindow::removeNode()
  9103. {
  9104. QModelIndex index= view->currentIndex();
  9105. if(index.isValid())
  9106. {
  9107. int row= index.row();
  9108. QModelIndex parent= index.parent();
  9109. model->removeRow(row,parent);
  9110. }
  9111. }
  9112. /*:737*//*738:*/
  9113. #line 15395 "./typica.w"
  9114. void DeviceConfigurationWindow::newSelection(const QModelIndex&index)
  9115. {
  9116. QWidget*editor= AppInstance->deviceConfigurationWidget(model,index);
  9117. if(editor)
  9118. {
  9119. configArea->setWidget(editor);
  9120. editor->show();
  9121. }
  9122. }
  9123. /*:738*//*739:*/
  9124. #line 15412 "./typica.w"
  9125. void DeviceConfigurationWindow::resizeColumn()
  9126. {
  9127. view->resizeColumnToContents(0);
  9128. }
  9129. /*:739*/
  9130. #line 584 "./typica.w"
  9131. /*759:*/
  9132. #line 15823 "./typica.w"
  9133. Ni9211TcConfWidget::Ni9211TcConfWidget(DeviceTreeModel*model,
  9134. const QModelIndex&index):
  9135. BasicDeviceConfigurationWidget(model,index)
  9136. {
  9137. QFormLayout*layout= new QFormLayout;
  9138. QLineEdit*columnName= new QLineEdit;
  9139. layout->addRow(tr("Column Name:"),columnName);
  9140. QComboBox*typeSelector= new QComboBox;
  9141. typeSelector->addItem("J");
  9142. typeSelector->addItem("K");
  9143. typeSelector->addItem("T");
  9144. typeSelector->addItem("B");
  9145. typeSelector->addItem("E");
  9146. typeSelector->addItem("N");
  9147. typeSelector->addItem("R");
  9148. typeSelector->addItem("S");
  9149. layout->addRow(tr("Thermocouple Type:"),typeSelector);
  9150. QCheckBox*hideSeries= new QCheckBox("Hide this channel");
  9151. layout->addRow(hideSeries);
  9152. setLayout(layout);
  9153. /*749:*/
  9154. #line 15632 "./typica.w"
  9155. QDomElement referenceElement=
  9156. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9157. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9158. QDomElement node;
  9159. /*:749*/
  9160. #line 15844 "./typica.w"
  9161. for(int i= 0;i<configData.size();i++)
  9162. {
  9163. node= configData.at(i).toElement();
  9164. if(node.attribute("name")=="type")
  9165. {
  9166. typeSelector->setCurrentIndex(
  9167. typeSelector->findText(node.attribute("value")));
  9168. }
  9169. else if(node.attribute("name")=="columnname")
  9170. {
  9171. columnName->setText(node.attribute("value"));
  9172. }
  9173. else if(node.attribute("name")=="hidden")
  9174. {
  9175. hideSeries->setChecked(node.attribute("value")=="true");
  9176. }
  9177. }
  9178. updateThermocoupleType(typeSelector->currentText());
  9179. updateColumnName(columnName->text());
  9180. updateHidden(hideSeries->isChecked());
  9181. connect(typeSelector,SIGNAL(currentIndexChanged(QString)),
  9182. this,SLOT(updateThermocoupleType(QString)));
  9183. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  9184. connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  9185. }
  9186. /*:759*//*760:*/
  9187. #line 15874 "./typica.w"
  9188. void Ni9211TcConfWidget::updateThermocoupleType(const QString&type)
  9189. {
  9190. updateAttribute("type",type);
  9191. }
  9192. void Ni9211TcConfWidget::updateColumnName(const QString&name)
  9193. {
  9194. updateAttribute("columnname",name);
  9195. }
  9196. void Ni9211TcConfWidget::updateHidden(bool hidden)
  9197. {
  9198. updateAttribute("hidden",hidden?"true":"false");
  9199. }
  9200. /*:760*/
  9201. #line 585 "./typica.w"
  9202. /*755:*/
  9203. #line 15737 "./typica.w"
  9204. NiDaqMxBase9211ConfWidget::NiDaqMxBase9211ConfWidget(DeviceTreeModel*model,
  9205. const QModelIndex&index)
  9206. :BasicDeviceConfigurationWidget(model,index)
  9207. {
  9208. QVBoxLayout*layout= new QVBoxLayout;
  9209. QHBoxLayout*deviceIdLayout= new QHBoxLayout;
  9210. QLabel*label= new QLabel(tr("Device ID:"));
  9211. QLineEdit*deviceId= new QLineEdit;
  9212. deviceIdLayout->addWidget(label);
  9213. deviceIdLayout->addWidget(deviceId);
  9214. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  9215. layout->addLayout(deviceIdLayout);
  9216. layout->addWidget(addChannelButton);
  9217. /*749:*/
  9218. #line 15632 "./typica.w"
  9219. QDomElement referenceElement=
  9220. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9221. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9222. QDomElement node;
  9223. /*:749*/
  9224. #line 15751 "./typica.w"
  9225. for(int i= 0;i<configData.size();i++)
  9226. {
  9227. node= configData.at(i).toElement();
  9228. if(node.attribute("name")=="deviceID")
  9229. {
  9230. deviceId->setText(node.attribute("value","Dev1"));
  9231. break;
  9232. }
  9233. }
  9234. updateDeviceId(deviceId->text());
  9235. connect(addChannelButton,SIGNAL(clicked()),
  9236. this,SLOT(addChannel()));
  9237. connect(deviceId,SIGNAL(textEdited(QString)),
  9238. this,SLOT(updateDeviceId(QString)));
  9239. setLayout(layout);
  9240. }
  9241. /*:755*//*756:*/
  9242. #line 15773 "./typica.w"
  9243. void NiDaqMxBase9211ConfWidget::updateDeviceId(const QString&newId)
  9244. {
  9245. updateAttribute("deviceID",newId);
  9246. }
  9247. /*:756*//*757:*/
  9248. #line 15781 "./typica.w"
  9249. void NiDaqMxBase9211ConfWidget::addChannel()
  9250. {
  9251. insertChildNode(tr("Thermocouple channel"),"ni9211seriestc");
  9252. }
  9253. /*:757*/
  9254. #line 586 "./typica.w"
  9255. /*753:*/
  9256. #line 15688 "./typica.w"
  9257. NiDaqMxBaseDriverConfWidget::NiDaqMxBaseDriverConfWidget(
  9258. DeviceTreeModel*model,const QModelIndex&index):
  9259. BasicDeviceConfigurationWidget(model,index)
  9260. {
  9261. QHBoxLayout*layout= new QHBoxLayout;
  9262. QToolButton*addDeviceButton= new QToolButton;
  9263. addDeviceButton->setText(tr("Add Device"));
  9264. NodeInserter*add9211= new NodeInserter("NI USB 9211","NI USB 9211",
  9265. "nidaqmxbase9211series");
  9266. NodeInserter*add9211a= new NodeInserter("NI USB 9211A","NI USB 9211A",
  9267. "nidaqmxbase9211series");
  9268. connect(add9211,SIGNAL(triggered(QString,QString)),
  9269. this,SLOT(insertChildNode(QString,QString)));
  9270. connect(add9211a,SIGNAL(triggered(QString,QString)),
  9271. this,SLOT(insertChildNode(QString,QString)));
  9272. QMenu*deviceMenu= new QMenu;
  9273. deviceMenu->addAction(add9211);
  9274. deviceMenu->addAction(add9211a);
  9275. addDeviceButton->setMenu(deviceMenu);
  9276. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  9277. layout->addWidget(addDeviceButton);
  9278. setLayout(layout);
  9279. }
  9280. /*:753*/
  9281. #line 587 "./typica.w"
  9282. /*620:*/
  9283. #line 13234 "./typica.w"
  9284. ReportAction::ReportAction(const QString&fileName,const QString&reportName,
  9285. QObject*parent):
  9286. QAction(reportName,parent),reportFile(fileName)
  9287. {
  9288. connect(this,SIGNAL(triggered()),this,SLOT(createReport()));
  9289. }
  9290. /*:620*//*621:*/
  9291. #line 13250 "./typica.w"
  9292. void ReportAction::createReport()
  9293. {
  9294. QFile file(reportFile);
  9295. QDomDocument document;
  9296. if(file.open(QIODevice::ReadOnly))
  9297. {
  9298. document.setContent(&file,true);
  9299. QDomElement element= document.documentElement();
  9300. QScriptEngine*engine= AppInstance->engine;
  9301. QScriptContext*context= engine->pushContext();
  9302. QScriptValue object;
  9303. QString targetID= reportFile;
  9304. /*176:*/
  9305. #line 4126 "./typica.w"
  9306. ScriptQMainWindow*window= new ScriptQMainWindow;
  9307. window->setObjectName(targetID);
  9308. object= engine->newQObject(window);
  9309. setQMainWindowProperties(object,engine);
  9310. QWidget*central= new(QWidget);
  9311. central->setParent(window);
  9312. central->setObjectName("centralWidget");
  9313. window->setCentralWidget(central);
  9314. if(element.hasChildNodes())
  9315. {
  9316. /*177:*/
  9317. #line 4161 "./typica.w"
  9318. QStack<QWidget*> widgetStack;
  9319. QStack<QLayout*> layoutStack;
  9320. QString windowScript;
  9321. widgetStack.push(central);
  9322. QDomNodeList windowChildren= element.childNodes();
  9323. int i= 0;
  9324. while(i<windowChildren.count())
  9325. {
  9326. QDomNode current;
  9327. QDomElement element;
  9328. current= windowChildren.at(i);
  9329. if(current.isElement())
  9330. {
  9331. element= current.toElement();
  9332. if(element.tagName()=="program")
  9333. {
  9334. windowScript.append(element.text());
  9335. }
  9336. else if(element.tagName()=="layout")
  9337. {
  9338. addLayoutToWidget(element,&widgetStack,&layoutStack);
  9339. }
  9340. else if(element.tagName()=="menu")
  9341. {
  9342. /*178:*/
  9343. #line 4208 "./typica.w"
  9344. QMenuBar*bar= window->menuBar();
  9345. bar->setParent(window);
  9346. bar->setObjectName("menuBar");
  9347. if(element.hasAttribute("name"))
  9348. {
  9349. QMenu*menu= bar->addMenu(element.attribute("name"));
  9350. menu->setParent(bar);
  9351. if(element.hasAttribute("type"))
  9352. {
  9353. if(element.attribute("type")=="reports")
  9354. {
  9355. if(element.hasAttribute("src"))
  9356. {
  9357. /*618:*/
  9358. #line 13194 "./typica.w"
  9359. QSettings settings;
  9360. QString reportDirectory= QString("%1/%2").arg(settings.value("config").
  9361. toString()).
  9362. arg(element.attribute("src"));
  9363. QDir::addSearchPath("reports",reportDirectory);
  9364. QDir directory(reportDirectory);
  9365. directory.setFilter(QDir::Files);
  9366. directory.setSorting(QDir::Name);
  9367. QStringList nameFilter;
  9368. nameFilter<<"*.xml";
  9369. directory.setNameFilters(nameFilter);
  9370. QFileInfoList reportFiles= directory.entryInfoList();
  9371. for(int i= 0;i<reportFiles.size();i++)
  9372. {
  9373. QFileInfo reportFile= reportFiles.at(i);
  9374. /*622:*/
  9375. #line 13274 "./typica.w"
  9376. QString path= reportFile.absoluteFilePath();
  9377. QFile file(path);
  9378. if(file.open(QIODevice::ReadOnly))
  9379. {
  9380. QDomDocument document;
  9381. document.setContent(&file,true);
  9382. QDomElement root= document.documentElement();
  9383. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  9384. if(!titleNode.isNull())
  9385. {
  9386. QDomElement titleElement= titleNode.toElement();
  9387. QString title= titleElement.text();
  9388. if(!title.isEmpty())
  9389. {
  9390. QStringList hierarchy= title.split(":->");
  9391. QMenu*insertionPoint= menu;
  9392. /*623:*/
  9393. #line 13301 "./typica.w"
  9394. for(int j= 0;j<hierarchy.size()-1;j++)
  9395. {
  9396. QObjectList menuList= insertionPoint->children();
  9397. bool menuFound= false;
  9398. for(int k= 0;k<menuList.size();k++)
  9399. {
  9400. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  9401. if(currentItem)
  9402. {
  9403. if(currentItem->title()==hierarchy.at(j))
  9404. {
  9405. menuFound= true;
  9406. insertionPoint= currentItem;
  9407. break;
  9408. }
  9409. }
  9410. }
  9411. if(!menuFound)
  9412. {
  9413. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  9414. }
  9415. }
  9416. /*:623*/
  9417. #line 13291 "./typica.w"
  9418. ReportAction*action= new ReportAction(path,hierarchy.last());
  9419. insertionPoint->addAction(action);
  9420. }
  9421. }
  9422. }
  9423. /*:622*/
  9424. #line 13210 "./typica.w"
  9425. }
  9426. /*:618*/
  9427. #line 4222 "./typica.w"
  9428. }
  9429. }
  9430. }
  9431. if(element.hasChildNodes())
  9432. {
  9433. /*179:*/
  9434. #line 4235 "./typica.w"
  9435. QDomNodeList menuItems= element.childNodes();
  9436. int j= 0;
  9437. while(j<menuItems.count())
  9438. {
  9439. QDomNode item= menuItems.at(j);
  9440. if(item.isElement())
  9441. {
  9442. QDomElement itemElement= item.toElement();
  9443. if(itemElement.tagName()=="item")
  9444. {
  9445. QAction*itemAction= new QAction(itemElement.text(),menu);
  9446. if(itemElement.hasAttribute("id"))
  9447. {
  9448. itemAction->setObjectName(itemElement.attribute("id"));
  9449. }
  9450. if(itemElement.hasAttribute("shortcut"))
  9451. {
  9452. itemAction->setShortcut(itemElement.attribute("shortcut"));
  9453. }
  9454. menu->addAction(itemAction);
  9455. }
  9456. else if(itemElement.tagName()=="separator")
  9457. {
  9458. menu->addSeparator();
  9459. }
  9460. }
  9461. j++;
  9462. }
  9463. #line 1 "./helpmenu.w"
  9464. /*:179*/
  9465. #line 4228 "./typica.w"
  9466. }
  9467. }
  9468. /*:178*/
  9469. #line 4186 "./typica.w"
  9470. }
  9471. }
  9472. i++;
  9473. }
  9474. QScriptValue oldThis= context->thisObject();
  9475. context->setThisObject(object);
  9476. QScriptValue result= engine->evaluate(windowScript);
  9477. /*170:*/
  9478. #line 3943 "./typica.w"
  9479. if(engine->hasUncaughtException())
  9480. {
  9481. int line= engine->uncaughtExceptionLineNumber();
  9482. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  9483. result.toString();
  9484. QString trace;
  9485. foreach(trace,engine->uncaughtExceptionBacktrace())
  9486. {
  9487. qDebug()<<trace;
  9488. }
  9489. }
  9490. /*:170*/
  9491. #line 4194 "./typica.w"
  9492. context->setThisObject(oldThis);
  9493. /*:177*/
  9494. #line 4137 "./typica.w"
  9495. }
  9496. /*180:*/
  9497. #line 9 "./helpmenu.w"
  9498. HelpMenu*helpMenu= new HelpMenu();
  9499. window->menuBar()->addMenu(helpMenu);
  9500. /*:180*/
  9501. #line 4139 "./typica.w"
  9502. window->show();
  9503. /*:176*/
  9504. #line 13263 "./typica.w"
  9505. file.close();
  9506. engine->popContext();
  9507. }
  9508. }
  9509. /*:621*/
  9510. #line 588 "./typica.w"
  9511. /*225:*/
  9512. #line 5303 "./typica.w"
  9513. NumericDelegate::NumericDelegate(QObject*parent):
  9514. QItemDelegate(parent)
  9515. {
  9516. }
  9517. /*:225*//*226:*/
  9518. #line 5315 "./typica.w"
  9519. void NumericDelegate::setEditorData(QWidget*editor,
  9520. const QModelIndex&index)const
  9521. {
  9522. QString value= index.model()->data(index,Qt::EditRole).toString();
  9523. QLineEdit*line= static_cast<QLineEdit*> (editor);
  9524. line->setText(value);
  9525. }
  9526. /*:226*//*227:*/
  9527. #line 5330 "./typica.w"
  9528. void NumericDelegate::setModelData(QWidget*editor,QAbstractItemModel*model,
  9529. const QModelIndex&index)const
  9530. {
  9531. QLineEdit*line= static_cast<QLineEdit*> (editor);
  9532. model->setData(index,line->text(),Qt::EditRole);
  9533. QScriptEngine*engine= AppInstance->engine;
  9534. engine->pushContext();
  9535. QString script= QString("Number(%1)").arg(line->text());
  9536. QScriptValue result= engine->evaluate(line->text());
  9537. if(result.isNumber())
  9538. {
  9539. model->setData(index,result.toVariant(),Qt::DisplayRole);
  9540. }
  9541. else
  9542. {
  9543. model->setData(index,QVariant(),Qt::DisplayRole);
  9544. }
  9545. engine->popContext();
  9546. }
  9547. /*:227*//*228:*/
  9548. #line 5353 "./typica.w"
  9549. QWidget*NumericDelegate::createEditor(QWidget*parent,
  9550. const QStyleOptionViewItem&,
  9551. const QModelIndex&)const
  9552. {
  9553. return(new QLineEdit(parent));
  9554. }
  9555. /*:228*//*229:*/
  9556. #line 5364 "./typica.w"
  9557. void NumericDelegate::updateEditorGeometry(QWidget*editor,
  9558. const QStyleOptionViewItem&option,
  9559. const QModelIndex&)const
  9560. {
  9561. editor->setGeometry(option.rect);
  9562. }
  9563. /*:229*/
  9564. #line 589 "./typica.w"
  9565. /*764:*/
  9566. #line 15933 "./typica.w"
  9567. NiDaqMxDriverConfWidget::NiDaqMxDriverConfWidget(DeviceTreeModel*model,
  9568. const QModelIndex&index)
  9569. :BasicDeviceConfigurationWidget(model,index)
  9570. {
  9571. QHBoxLayout*layout= new QHBoxLayout;
  9572. QToolButton*addDeviceButton= new QToolButton;
  9573. addDeviceButton->setText(tr("Add Device"));
  9574. NodeInserter*add9211a= new NodeInserter("NI USB 9211A","NI USB 9211A",
  9575. "nidaqmx9211series");
  9576. NodeInserter*addtc01= new NodeInserter("NI USB TC01","NI USB TC01",
  9577. "nidaqmxtc01");
  9578. connect(add9211a,SIGNAL(triggered(QString,QString)),
  9579. this,SLOT(insertChildNode(QString,QString)));
  9580. connect(addtc01,SIGNAL(triggered(QString,QString)),
  9581. this,SLOT(insertChildNode(QString,QString)));
  9582. QMenu*deviceMenu= new QMenu;
  9583. deviceMenu->addAction(add9211a);
  9584. deviceMenu->addAction(addtc01);
  9585. addDeviceButton->setMenu(deviceMenu);
  9586. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  9587. layout->addWidget(addDeviceButton);
  9588. setLayout(layout);
  9589. }
  9590. /*:764*/
  9591. #line 590 "./typica.w"
  9592. /*766:*/
  9593. #line 15982 "./typica.w"
  9594. NiDaqMx9211ConfWidget::NiDaqMx9211ConfWidget(DeviceTreeModel*model,
  9595. const QModelIndex&index)
  9596. :BasicDeviceConfigurationWidget(model,index)
  9597. {
  9598. QVBoxLayout*layout= new QVBoxLayout;
  9599. QHBoxLayout*deviceIdLayout= new QHBoxLayout;
  9600. QLabel*label= new QLabel(tr("Device ID:"));
  9601. QLineEdit*deviceId= new QLineEdit;
  9602. deviceIdLayout->addWidget(label);
  9603. deviceIdLayout->addWidget(deviceId);
  9604. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  9605. layout->addLayout(deviceIdLayout);
  9606. layout->addWidget(addChannelButton);
  9607. /*749:*/
  9608. #line 15632 "./typica.w"
  9609. QDomElement referenceElement=
  9610. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9611. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9612. QDomElement node;
  9613. /*:749*/
  9614. #line 15996 "./typica.w"
  9615. for(int i= 0;i<configData.size();i++)
  9616. {
  9617. node= configData.at(i).toElement();
  9618. if(node.attribute("name")=="deviceID")
  9619. {
  9620. deviceId->setText(node.attribute("value","Dev1"));
  9621. break;
  9622. }
  9623. }
  9624. updateDeviceId(deviceId->text());
  9625. connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
  9626. connect(deviceId,SIGNAL(textEdited(QString)),
  9627. this,SLOT(updateDeviceId(QString)));
  9628. setLayout(layout);
  9629. }
  9630. void NiDaqMx9211ConfWidget::updateDeviceId(const QString&newId)
  9631. {
  9632. updateAttribute("deviceID",newId);
  9633. }
  9634. void NiDaqMx9211ConfWidget::addChannel()
  9635. {
  9636. insertChildNode(tr("Thermocouple channel"),"ni9211seriestc");
  9637. }
  9638. /*:766*/
  9639. #line 591 "./typica.w"
  9640. /*768:*/
  9641. #line 16047 "./typica.w"
  9642. NiDaqMxTc01ConfWidget::NiDaqMxTc01ConfWidget(DeviceTreeModel*model,
  9643. const QModelIndex&index)
  9644. :BasicDeviceConfigurationWidget(model,index)
  9645. {
  9646. QFormLayout*layout= new QFormLayout;
  9647. QLineEdit*deviceId= new QLineEdit;
  9648. layout->addRow(tr("Device ID:"),deviceId);
  9649. QLineEdit*columnName= new QLineEdit;
  9650. layout->addRow(tr("Column Name:"),columnName);
  9651. QComboBox*typeSelector= new QComboBox;
  9652. typeSelector->addItem("J");
  9653. typeSelector->addItem("K");
  9654. typeSelector->addItem("T");
  9655. typeSelector->addItem("B");
  9656. typeSelector->addItem("E");
  9657. typeSelector->addItem("N");
  9658. typeSelector->addItem("R");
  9659. typeSelector->addItem("S");
  9660. layout->addRow(tr("Thermocouple Type:"),typeSelector);
  9661. QCheckBox*hideSeries= new QCheckBox(tr("Hide this channel"));
  9662. layout->addRow(hideSeries);
  9663. /*749:*/
  9664. #line 15632 "./typica.w"
  9665. QDomElement referenceElement=
  9666. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9667. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9668. QDomElement node;
  9669. /*:749*/
  9670. #line 16069 "./typica.w"
  9671. for(int i= 0;i<configData.size();i++)
  9672. {
  9673. node= configData.at(i).toElement();
  9674. if(node.attribute("name")=="deviceID")
  9675. {
  9676. deviceId->setText(node.attribute("value"));
  9677. }
  9678. else if(node.attribute("name")=="type")
  9679. {
  9680. typeSelector->setCurrentIndex(typeSelector->findText(node.attribute("value")));
  9681. }
  9682. else if(node.attribute("name")=="columnname")
  9683. {
  9684. columnName->setText(node.attribute("value"));
  9685. }
  9686. else if(node.attribute("name")=="hidden")
  9687. {
  9688. hideSeries->setChecked(node.attribute("value")=="true");
  9689. }
  9690. }
  9691. updateDeviceId(deviceId->text());
  9692. updateThermocoupleType(typeSelector->currentText());
  9693. updateColumnName(columnName->text());
  9694. updateHidden(hideSeries->isChecked());
  9695. connect(deviceId,SIGNAL(textEdited(QString)),this,SLOT(updateDeviceId(QString)));
  9696. connect(typeSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateThermocoupleType(QString)));
  9697. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  9698. setLayout(layout);
  9699. connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  9700. }
  9701. void NiDaqMxTc01ConfWidget::updateDeviceId(const QString&newId)
  9702. {
  9703. updateAttribute("deviceID",newId);
  9704. }
  9705. void NiDaqMxTc01ConfWidget::updateThermocoupleType(const QString&type)
  9706. {
  9707. updateAttribute("type",type);
  9708. }
  9709. void NiDaqMxTc01ConfWidget::updateColumnName(const QString&name)
  9710. {
  9711. updateAttribute("columnname",name);
  9712. }
  9713. void NiDaqMxTc01ConfWidget::updateHidden(bool hidden)
  9714. {
  9715. updateAttribute("hidden",hidden?"true":"false");
  9716. }
  9717. /*:768*/
  9718. #line 592 "./typica.w"
  9719. /*786:*/
  9720. #line 16485 "./typica.w"
  9721. ModbusRtuPortConfWidget::ModbusRtuPortConfWidget(DeviceTreeModel*model,
  9722. const QModelIndex&index)
  9723. :BasicDeviceConfigurationWidget(model,index)
  9724. {
  9725. QFormLayout*layout= new QFormLayout;
  9726. QToolButton*addDeviceButton= new QToolButton;
  9727. addDeviceButton->setText(tr("Add Device"));
  9728. NodeInserter*addModbusRtuDevice= new NodeInserter("Modbus RTU Device",
  9729. "Modbus RTU Device",
  9730. "modbusrtudevice");
  9731. connect(addModbusRtuDevice,SIGNAL(triggered(QString,QString)),
  9732. this,SLOT(insertChildNode(QString,QString)));
  9733. QMenu*deviceMenu= new QMenu;
  9734. deviceMenu->addAction(addModbusRtuDevice);
  9735. addDeviceButton->setMenu(deviceMenu);
  9736. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  9737. layout->addRow(QString(),addDeviceButton);
  9738. PortSelector*port= new PortSelector;
  9739. layout->addRow(tr("Port:"),port);
  9740. connect(port,SIGNAL(currentIndexChanged(QString)),
  9741. this,SLOT(updatePort(QString)));
  9742. connect(port,SIGNAL(editTextChanged(QString)),
  9743. this,SLOT(updatePort(QString)));
  9744. BaudSelector*rate= new BaudSelector;
  9745. layout->addRow(tr("Baud:"),rate);
  9746. connect(rate,SIGNAL(currentIndexChanged(QString)),
  9747. this,SLOT(updateBaudRate(QString)));
  9748. ParitySelector*parity= new ParitySelector;
  9749. layout->addRow(tr("Parity:"),parity);
  9750. connect(parity,SIGNAL(currentIndexChanged(QString)),
  9751. this,SLOT(updateParity(QString)));
  9752. FlowSelector*flow= new FlowSelector;
  9753. layout->addRow(tr("Flow Control:"),flow);
  9754. connect(flow,SIGNAL(currentIndexChanged(QString)),
  9755. this,SLOT(updateFlowControl(QString)));
  9756. StopSelector*stop= new StopSelector;
  9757. layout->addRow(tr("Stop Bits:"),stop);
  9758. connect(stop,SIGNAL(currentIndexChanged(QString)),
  9759. this,SLOT(updateStopBits(QString)));
  9760. /*749:*/
  9761. #line 15632 "./typica.w"
  9762. QDomElement referenceElement=
  9763. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9764. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9765. QDomElement node;
  9766. /*:749*/
  9767. #line 16525 "./typica.w"
  9768. for(int i= 0;i<configData.size();i++)
  9769. {
  9770. node= configData.at(i).toElement();
  9771. if(node.attribute("name")=="port")
  9772. {
  9773. int j= port->findText(node.attribute("value"));
  9774. if(j>=0)
  9775. {
  9776. port->setCurrentIndex(j);
  9777. }
  9778. else
  9779. {
  9780. port->insertItem(0,node.attribute("value"));
  9781. port->setCurrentIndex(0);
  9782. }
  9783. }
  9784. else if(node.attribute("name")=="baudrate")
  9785. {
  9786. rate->setCurrentIndex(rate->findText(node.attribute("value")));
  9787. }
  9788. else if(node.attribute("name")=="parity")
  9789. {
  9790. parity->setCurrentIndex(parity->findText(node.attribute("value")));
  9791. }
  9792. else if(node.attribute("name")=="flowcontrol")
  9793. {
  9794. flow->setCurrentIndex(flow->findText(node.attribute("value")));
  9795. }
  9796. else if(node.attribute("name")=="stopbits")
  9797. {
  9798. stop->setCurrentIndex(stop->findText(node.attribute("value")));
  9799. }
  9800. }
  9801. updatePort(port->currentText());
  9802. updateBaudRate(rate->currentText());
  9803. updateParity(parity->currentText());
  9804. updateFlowControl(flow->currentText());
  9805. updateStopBits(stop->currentText());
  9806. setLayout(layout);
  9807. }
  9808. void ModbusRtuPortConfWidget::updatePort(const QString&newPort)
  9809. {
  9810. updateAttribute("port",newPort);
  9811. }
  9812. void ModbusRtuPortConfWidget::updateBaudRate(const QString&newRate)
  9813. {
  9814. updateAttribute("baudrate",newRate);
  9815. }
  9816. void ModbusRtuPortConfWidget::updateParity(const QString&newParity)
  9817. {
  9818. updateAttribute("parity",newParity);
  9819. }
  9820. void ModbusRtuPortConfWidget::updateFlowControl(const QString&newFlow)
  9821. {
  9822. updateAttribute("flowcontrol",newFlow);
  9823. }
  9824. void ModbusRtuPortConfWidget::updateStopBits(const QString&newStopBits)
  9825. {
  9826. updateAttribute("stopbits",newStopBits);
  9827. }
  9828. /*:786*/
  9829. #line 593 "./typica.w"
  9830. /*788:*/
  9831. #line 16648 "./typica.w"
  9832. ModbusRtuDeviceConfWidget::ModbusRtuDeviceConfWidget(DeviceTreeModel*model,
  9833. const QModelIndex&index)
  9834. :BasicDeviceConfigurationWidget(model,index),
  9835. unitSpecificationLayout(new QStackedLayout),
  9836. decimalSpecificationLayout(new QStackedLayout)
  9837. {
  9838. QVBoxLayout*layout= new QVBoxLayout;
  9839. QToolButton*addChannelButton= new QToolButton;
  9840. addChannelButton->setText(tr("Add Channel"));
  9841. NodeInserter*addTemperaturePV= new NodeInserter("Temperature Process Value",
  9842. "Temperature Process Value",
  9843. "modbustemperaturepv");
  9844. NodeInserter*addTemperatureSV= new NodeInserter("Temperature Set Value",
  9845. "Temperature Set Value",
  9846. "modbustemperaturesv");
  9847. connect(addTemperaturePV,SIGNAL(triggered(QString,QString)),
  9848. this,SLOT(insertChildNode(QString,QString)));
  9849. connect(addTemperatureSV,SIGNAL(triggered(QString,QString)),
  9850. this,SLOT(insertChildNode(QString,QString)));
  9851. QMenu*channelMenu= new QMenu;
  9852. channelMenu->addAction(addTemperaturePV);
  9853. channelMenu->addAction(addTemperatureSV);
  9854. addChannelButton->setMenu(channelMenu);
  9855. addChannelButton->setPopupMode(QToolButton::InstantPopup);
  9856. layout->addWidget(addChannelButton);
  9857. QHBoxLayout*stationLayout= new QHBoxLayout;
  9858. QLabel*stationLabel= new QLabel(tr("Station:"));
  9859. QSpinBox*stationNumber= new QSpinBox;
  9860. stationNumber->setMinimum(0);
  9861. stationNumber->setMaximum(255);
  9862. stationLayout->addWidget(stationLabel);
  9863. stationLayout->addWidget(stationNumber);
  9864. layout->addLayout(stationLayout);
  9865. QCheckBox*fixedUnit= new QCheckBox(tr("Fixed Temperature Unit"));
  9866. layout->addWidget(fixedUnit);
  9867. QWidget*fixedUnitPlaceholder= new QWidget(this);
  9868. QHBoxLayout*fixedUnitLayout= new QHBoxLayout;
  9869. QLabel*fixedUnitLabel= new QLabel(tr("Temperature Unit:"));
  9870. QComboBox*fixedUnitSelector= new QComboBox;
  9871. fixedUnitSelector->addItem("Fahrenheit");
  9872. fixedUnitSelector->addItem("Celsius");
  9873. fixedUnitLayout->addWidget(fixedUnitLabel);
  9874. fixedUnitLayout->addWidget(fixedUnitSelector);
  9875. fixedUnitPlaceholder->setLayout(fixedUnitLayout);
  9876. unitSpecificationLayout->addWidget(fixedUnitPlaceholder);
  9877. QWidget*queriedUnitPlaceholder= new QWidget(this);
  9878. QFormLayout*queriedUnitLayout= new QFormLayout;
  9879. ShortHexSpinBox*unitAddress= new ShortHexSpinBox;
  9880. queriedUnitLayout->addRow(tr("Function 0x03 Unit Address:"),unitAddress);
  9881. QSpinBox*valueF= new QSpinBox;
  9882. valueF->setMinimum(0);
  9883. valueF->setMaximum(65535);
  9884. queriedUnitLayout->addRow(tr("Value for Fahrenheit"),valueF);
  9885. QSpinBox*valueC= new QSpinBox;
  9886. valueC->setMinimum(0);
  9887. valueC->setMaximum(65535);
  9888. queriedUnitLayout->addRow(tr("Value for Celsius"),valueC);
  9889. queriedUnitPlaceholder->setLayout(queriedUnitLayout);
  9890. unitSpecificationLayout->addWidget(queriedUnitPlaceholder);
  9891. layout->addLayout(unitSpecificationLayout);
  9892. QCheckBox*fixedPrecision= new QCheckBox(tr("Fixed Precision"));
  9893. layout->addWidget(fixedPrecision);
  9894. QWidget*fixedPrecisionPlaceholder= new QWidget(this);
  9895. QFormLayout*fixedPrecisionLayout= new QFormLayout;
  9896. QSpinBox*fixedPrecisionValue= new QSpinBox;
  9897. fixedPrecisionValue->setMinimum(0);
  9898. fixedPrecisionValue->setMaximum(9);
  9899. fixedPrecisionLayout->addRow("Places after the decimal point:",
  9900. fixedPrecisionValue);
  9901. fixedPrecisionPlaceholder->setLayout(fixedPrecisionLayout);
  9902. decimalSpecificationLayout->addWidget(fixedPrecisionPlaceholder);
  9903. QWidget*queriedPrecisionPlaceholder= new QWidget(this);
  9904. QFormLayout*queriedPrecisionLayout= new QFormLayout;
  9905. ShortHexSpinBox*precisionAddress= new ShortHexSpinBox;
  9906. queriedPrecisionLayout->addRow("Function 0x03 Decimal Position Address:",
  9907. precisionAddress);
  9908. queriedPrecisionPlaceholder->setLayout(queriedPrecisionLayout);
  9909. decimalSpecificationLayout->addWidget(queriedPrecisionPlaceholder);
  9910. layout->addLayout(decimalSpecificationLayout);
  9911. /*749:*/
  9912. #line 15632 "./typica.w"
  9913. QDomElement referenceElement=
  9914. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9915. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9916. QDomElement node;
  9917. /*:749*/
  9918. #line 16728 "./typica.w"
  9919. for(int i= 0;i<configData.size();i++)
  9920. {
  9921. node= configData.at(i).toElement();
  9922. if(node.attribute("name")=="station")
  9923. {
  9924. stationNumber->setValue(node.attribute("value").toInt());
  9925. }
  9926. else if(node.attribute("name")=="fixedunit")
  9927. {
  9928. if(node.attribute("value")=="true")
  9929. {
  9930. fixedUnit->setCheckState(Qt::Checked);
  9931. }
  9932. else if(node.attribute("value")=="false")
  9933. {
  9934. fixedUnit->setCheckState(Qt::Unchecked);
  9935. }
  9936. }
  9937. else if(node.attribute("name")=="fixedprecision")
  9938. {
  9939. fixedPrecisionValue->setValue(node.attribute("value").toInt());
  9940. }
  9941. else if(node.attribute("name")=="unit")
  9942. {
  9943. fixedUnitSelector->setCurrentIndex(fixedUnitSelector->findText(node.attribute("value")));
  9944. }
  9945. else if(node.attribute("name")=="unitaddress")
  9946. {
  9947. unitAddress->setValue(node.attribute("value").toInt());
  9948. }
  9949. else if(node.attribute("name")=="fvalue")
  9950. {
  9951. valueF->setValue(node.attribute("value").toInt());
  9952. }
  9953. else if(node.attribute("name")=="cvalue")
  9954. {
  9955. valueC->setValue(node.attribute("value").toInt());
  9956. }
  9957. else if(node.attribute("name")=="precisionaddress")
  9958. {
  9959. precisionAddress->setValue(node.attribute("value").toInt());
  9960. }
  9961. else if(node.attribute("name")=="precision")
  9962. {
  9963. fixedPrecisionValue->setValue(node.attribute("value").toInt());
  9964. }
  9965. }
  9966. updateStationNumber(stationNumber->value());
  9967. updateFixedUnit(fixedUnit->isChecked());
  9968. updateFixedDecimal(fixedPrecision->isChecked());
  9969. updateUnit(fixedUnitSelector->currentText());
  9970. updateUnitAddress(unitAddress->value());
  9971. updateValueF(valueF->value());
  9972. updateValueC(valueC->value());
  9973. updatePrecisionAddress(precisionAddress->value());
  9974. updatePrecisionValue(fixedPrecisionValue->value());
  9975. connect(stationNumber,SIGNAL(valueChanged(int)),
  9976. this,SLOT(updateStationNumber(int)));
  9977. connect(fixedUnitSelector,SIGNAL(currentIndexChanged(QString)),
  9978. this,SLOT(updateUnit(QString)));
  9979. connect(unitAddress,SIGNAL(valueChanged(int)),
  9980. this,SLOT(updateUnitAddress(int)));
  9981. connect(valueF,SIGNAL(valueChanged(int)),
  9982. this,SLOT(updateValueF(int)));
  9983. connect(valueC,SIGNAL(valueChanged(int)),
  9984. this,SLOT(updateValueC(int)));
  9985. connect(fixedUnit,SIGNAL(toggled(bool)),
  9986. this,SLOT(updateFixedUnit(bool)));
  9987. connect(fixedPrecision,SIGNAL(toggled(bool)),
  9988. this,SLOT(updateFixedDecimal(bool)));
  9989. connect(fixedPrecisionValue,SIGNAL(valueChanged(int)),
  9990. this,SLOT(updatePrecisionValue(int)));
  9991. connect(precisionAddress,SIGNAL(valueChanged(int)),
  9992. this,SLOT(updatePrecisionAddress(int)));
  9993. setLayout(layout);
  9994. }
  9995. void ModbusRtuDeviceConfWidget::updateStationNumber(int newStation)
  9996. {
  9997. updateAttribute("station",QString("%1").arg(newStation));
  9998. }
  9999. void ModbusRtuDeviceConfWidget::updateFixedUnit(bool newFixed)
  10000. {
  10001. if(newFixed)
  10002. {
  10003. unitSpecificationLayout->setCurrentIndex(0);
  10004. updateAttribute("fixedunit","true");
  10005. }
  10006. else
  10007. {
  10008. unitSpecificationLayout->setCurrentIndex(1);
  10009. updateAttribute("fixedunit","false");
  10010. }
  10011. }
  10012. void ModbusRtuDeviceConfWidget::updateFixedDecimal(bool newFixed)
  10013. {
  10014. if(newFixed)
  10015. {
  10016. decimalSpecificationLayout->setCurrentIndex(0);
  10017. updateAttribute("fixedprecision","true");
  10018. }
  10019. else
  10020. {
  10021. decimalSpecificationLayout->setCurrentIndex(1);
  10022. updateAttribute("fixedprecision","false");
  10023. }
  10024. }
  10025. void ModbusRtuDeviceConfWidget::updateUnit(const QString&newUnit)
  10026. {
  10027. updateAttribute("unit",newUnit);
  10028. }
  10029. void ModbusRtuDeviceConfWidget::updateUnitAddress(int newAddress)
  10030. {
  10031. updateAttribute("unitaddress",QString("%1").arg(newAddress));
  10032. }
  10033. void ModbusRtuDeviceConfWidget::updateValueF(int newValue)
  10034. {
  10035. updateAttribute("fvalue",QString("%1").arg(newValue));
  10036. }
  10037. void ModbusRtuDeviceConfWidget::updateValueC(int newValue)
  10038. {
  10039. updateAttribute("cvalue",QString("%1").arg(newValue));
  10040. }
  10041. void ModbusRtuDeviceConfWidget::updatePrecisionAddress(int newAddress)
  10042. {
  10043. updateAttribute("precisionaddress",QString("%1").arg(newAddress));
  10044. }
  10045. void ModbusRtuDeviceConfWidget::updatePrecisionValue(int newValue)
  10046. {
  10047. updateAttribute("precision",QString("%1").arg(newValue));
  10048. }
  10049. /*:788*/
  10050. #line 594 "./typica.w"
  10051. /*790:*/
  10052. #line 16891 "./typica.w"
  10053. ModbusRtuDeviceTPvConfWidget::ModbusRtuDeviceTPvConfWidget(DeviceTreeModel*model,
  10054. const QModelIndex&index)
  10055. :BasicDeviceConfigurationWidget(model,index)
  10056. {
  10057. QFormLayout*layout= new QFormLayout;
  10058. ShortHexSpinBox*address= new ShortHexSpinBox;
  10059. layout->addRow(tr("Function 0x04 Process Value Address"),address);
  10060. /*749:*/
  10061. #line 15632 "./typica.w"
  10062. QDomElement referenceElement=
  10063. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10064. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10065. QDomElement node;
  10066. /*:749*/
  10067. #line 16899 "./typica.w"
  10068. for(int i= 0;i<configData.size();i++)
  10069. {
  10070. node= configData.at(i).toElement();
  10071. if(node.attribute("name")=="address")
  10072. {
  10073. address->setValue(node.attribute("value").toInt());
  10074. break;
  10075. }
  10076. }
  10077. updateAddress(address->value());
  10078. connect(address,SIGNAL(valueChanged(int)),this,SLOT(updateAddress(int)));
  10079. setLayout(layout);
  10080. }
  10081. void ModbusRtuDeviceTPvConfWidget::updateAddress(int newAddress)
  10082. {
  10083. updateAttribute("address",QString("%1").arg(newAddress));
  10084. }
  10085. /*:790*/
  10086. #line 595 "./typica.w"
  10087. /*792:*/
  10088. #line 16947 "./typica.w"
  10089. ModbusRtuDeviceTSvConfWidget::ModbusRtuDeviceTSvConfWidget(DeviceTreeModel*model,
  10090. const QModelIndex&index)
  10091. :BasicDeviceConfigurationWidget(model,index),boundsLayout(new QStackedLayout)
  10092. {
  10093. QVBoxLayout*layout= new QVBoxLayout;
  10094. QFormLayout*addressLayout= new QFormLayout;
  10095. ShortHexSpinBox*readAddress= new ShortHexSpinBox;
  10096. ShortHexSpinBox*writeAddress= new ShortHexSpinBox;
  10097. addressLayout->addRow(tr("Function 0x04 Read Set Value Address:"),readAddress);
  10098. addressLayout->addRow(tr("Function 0x06 Write Set Value Address:"),writeAddress);
  10099. layout->addLayout(addressLayout);
  10100. QCheckBox*fixedRange= new QCheckBox(tr("Fixed Set Value Range"));
  10101. layout->addWidget(fixedRange);
  10102. QWidget*queriedRangePlaceholder= new QWidget(this);
  10103. QFormLayout*queriedRangeLayout= new QFormLayout;
  10104. ShortHexSpinBox*lowerAddress= new ShortHexSpinBox;
  10105. ShortHexSpinBox*upperAddress= new ShortHexSpinBox;
  10106. queriedRangeLayout->addRow(tr("Function 0x03 Minimum Set Value Address"),
  10107. lowerAddress);
  10108. queriedRangeLayout->addRow(tr("Function 0x03 Maximum Set Value Address"),
  10109. upperAddress);
  10110. queriedRangePlaceholder->setLayout(queriedRangeLayout);
  10111. boundsLayout->addWidget(queriedRangePlaceholder);
  10112. QWidget*fixedRangePlaceholder= new QWidget(this);
  10113. QFormLayout*fixedRangeLayout= new QFormLayout;
  10114. QLineEdit*fixedLower= new QLineEdit;
  10115. QLineEdit*fixedUpper= new QLineEdit;
  10116. fixedRangeLayout->addRow(tr("Minimum Set Value:"),fixedLower);
  10117. fixedRangeLayout->addRow(tr("Maximum Set Value:"),fixedUpper);
  10118. fixedRangePlaceholder->setLayout(fixedRangeLayout);
  10119. boundsLayout->addWidget(fixedRangePlaceholder);
  10120. layout->addLayout(boundsLayout);
  10121. /*749:*/
  10122. #line 15632 "./typica.w"
  10123. QDomElement referenceElement=
  10124. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10125. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10126. QDomElement node;
  10127. /*:749*/
  10128. #line 16980 "./typica.w"
  10129. for(int i= 0;i<configData.size();i++)
  10130. {
  10131. node= configData.at(i).toElement();
  10132. if(node.attribute("name")=="readaddress")
  10133. {
  10134. readAddress->setValue(node.attribute("value").toInt());
  10135. }
  10136. else if(node.attribute("name")=="writeaddress")
  10137. {
  10138. writeAddress->setValue(node.attribute("value").toInt());
  10139. }
  10140. else if(node.attribute("name")=="fixedrange")
  10141. {
  10142. if(node.attribute("value")=="true")
  10143. {
  10144. fixedRange->setCheckState(Qt::Checked);
  10145. }
  10146. else if(node.attribute("value")=="false")
  10147. {
  10148. fixedRange->setCheckState(Qt::Unchecked);
  10149. }
  10150. }
  10151. else if(node.attribute("name")=="fixedlower")
  10152. {
  10153. fixedLower->setText(node.attribute("value"));
  10154. }
  10155. else if(node.attribute("name")=="fixedupper")
  10156. {
  10157. fixedUpper->setText(node.attribute("value"));
  10158. }
  10159. else if(node.attribute("name")=="loweraddress")
  10160. {
  10161. lowerAddress->setValue(node.attribute("value").toInt());
  10162. }
  10163. else if(node.attribute("name")=="upperaddress")
  10164. {
  10165. upperAddress->setValue(node.attribute("value").toInt());
  10166. }
  10167. }
  10168. updateReadAddress(readAddress->value());
  10169. updateWriteAddress(writeAddress->value());
  10170. updateFixedRange(fixedRange->isChecked());
  10171. updateLower(fixedLower->text());
  10172. updateUpper(fixedUpper->text());
  10173. updateLowerAddress(lowerAddress->value());
  10174. updateUpperAddress(upperAddress->value());
  10175. connect(readAddress,SIGNAL(valueChanged(int)),
  10176. this,SLOT(updateReadAddress(int)));
  10177. connect(writeAddress,SIGNAL(valueChanged(int)),
  10178. this,SLOT(updateWriteAddress(int)));
  10179. connect(fixedRange,SIGNAL(toggled(bool)),this,SLOT(updateFixedRange(bool)));
  10180. connect(fixedLower,SIGNAL(textChanged(QString)),
  10181. this,SLOT(updateLower(QString)));
  10182. connect(fixedUpper,SIGNAL(textChanged(QString)),
  10183. this,SLOT(updateUpper(QString)));
  10184. connect(lowerAddress,SIGNAL(valueChanged(int)),
  10185. this,SLOT(updateLowerAddress(int)));
  10186. connect(upperAddress,SIGNAL(valueChanged(int)),
  10187. this,SLOT(updateUpperAddress(int)));
  10188. setLayout(layout);
  10189. }
  10190. void ModbusRtuDeviceTSvConfWidget::updateReadAddress(int newAddress)
  10191. {
  10192. updateAttribute("readaddress",QString("%1").arg(newAddress));
  10193. }
  10194. void ModbusRtuDeviceTSvConfWidget::updateWriteAddress(int newAddress)
  10195. {
  10196. updateAttribute("writeaddress",QString("%1").arg(newAddress));
  10197. }
  10198. void ModbusRtuDeviceTSvConfWidget::updateFixedRange(bool fixed)
  10199. {
  10200. if(fixed)
  10201. {
  10202. updateAttribute("fixedrange","true");
  10203. boundsLayout->setCurrentIndex(1);
  10204. }
  10205. else
  10206. {
  10207. updateAttribute("fixedrange","false");
  10208. boundsLayout->setCurrentIndex(0);
  10209. }
  10210. }
  10211. void ModbusRtuDeviceTSvConfWidget::updateLower(const QString&lower)
  10212. {
  10213. updateAttribute("fixedlower",lower);
  10214. }
  10215. void ModbusRtuDeviceTSvConfWidget::updateUpper(const QString&upper)
  10216. {
  10217. updateAttribute("fixedupper",upper);
  10218. }
  10219. void ModbusRtuDeviceTSvConfWidget::updateLowerAddress(int newAddress)
  10220. {
  10221. updateAttribute("loweraddress",QString("%1").arg(newAddress));
  10222. }
  10223. void ModbusRtuDeviceTSvConfWidget::updateUpperAddress(int newAddress)
  10224. {
  10225. updateAttribute("upperaddress",QString("%1").arg(newAddress));
  10226. }
  10227. /*:792*/
  10228. #line 596 "./typica.w"
  10229. /*748:*/
  10230. #line 15554 "./typica.w"
  10231. RoasterConfWidget::RoasterConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  10232. :BasicDeviceConfigurationWidget(model,index)
  10233. {
  10234. QVBoxLayout*layout= new QVBoxLayout;
  10235. QPushButton*addDeviceButton= new QPushButton(tr("Add Device"));
  10236. QMenu*deviceMenu= new QMenu;
  10237. NodeInserter*insertAction;
  10238. foreach(insertAction,AppInstance->topLevelNodeInserters)
  10239. {
  10240. connect(insertAction,SIGNAL(triggered(QString,QString)),
  10241. this,SLOT(insertChildNode(QString,QString)));
  10242. deviceMenu->addAction(insertAction);
  10243. }
  10244. addDeviceButton->setMenu(deviceMenu);
  10245. layout->addWidget(addDeviceButton);
  10246. QPushButton*addAnnotationControlButton= new QPushButton(tr("Add Annotation Control"));
  10247. QMenu*annotationMenu= new QMenu;
  10248. NodeInserter*basicButtonInserter= new NodeInserter(tr("Annotation Button"),tr("Annotation Button"),"annotationbutton");
  10249. NodeInserter*countingButtonInserter= new NodeInserter(tr("Counting Button"),tr("Counting Button"),"reconfigurablebutton");
  10250. NodeInserter*spinBoxInserter= new NodeInserter(tr("Numeric Entry"),tr("Numeric Entry"),"annotationspinbox");
  10251. NodeInserter*freeAnnotationInserter= new NodeInserter(tr("Free Text"),
  10252. tr("Free Text"),
  10253. "freeannotation");
  10254. annotationMenu->addAction(basicButtonInserter);
  10255. annotationMenu->addAction(countingButtonInserter);
  10256. annotationMenu->addAction(spinBoxInserter);
  10257. annotationMenu->addAction(freeAnnotationInserter);
  10258. connect(basicButtonInserter,SIGNAL(triggered(QString,QString)),
  10259. this,SLOT(insertChildNode(QString,QString)));
  10260. connect(countingButtonInserter,SIGNAL(triggered(QString,QString)),
  10261. this,SLOT(insertChildNode(QString,QString)));
  10262. connect(spinBoxInserter,SIGNAL(triggered(QString,QString)),
  10263. this,SLOT(insertChildNode(QString,QString)));
  10264. connect(freeAnnotationInserter,SIGNAL(triggered(QString,QString)),
  10265. this,SLOT(insertChildNode(QString,QString)));
  10266. /*967:*/
  10267. #line 144 "./valueannotation.w"
  10268. NodeInserter*valueAnnotationInserter= new NodeInserter(tr("Value Annotation"),
  10269. tr("Value Annotation"),
  10270. "valueannotation");
  10271. annotationMenu->addAction(valueAnnotationInserter);
  10272. connect(valueAnnotationInserter,SIGNAL(triggered(QString,QString)),
  10273. this,SLOT(insertChildNode(QString,QString)));
  10274. /*:967*/
  10275. #line 15590 "./typica.w"
  10276. addAnnotationControlButton->setMenu(annotationMenu);
  10277. layout->addWidget(addAnnotationControlButton);
  10278. QPushButton*advancedButton= new QPushButton(tr("Advanced Features"));
  10279. QMenu*advancedMenu= new QMenu;
  10280. NodeInserter*linearsplineinserter= new NodeInserter(tr("Linear Spline Interpolated Series"),tr("Linear Spline Interpolated Series"),"linearspline");
  10281. advancedMenu->addAction(linearsplineinserter);
  10282. NodeInserter*translationinserter= new NodeInserter(tr("Profile Translation"),tr("Profile Translation"),"translation");
  10283. advancedMenu->addAction(translationinserter);
  10284. connect(linearsplineinserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  10285. connect(translationinserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  10286. /*893:*/
  10287. #line 258 "./rate.w"
  10288. NodeInserter*rateOfChangeInserter= new NodeInserter(tr("Rate of Change"),tr("Rate of Change"),"rate");
  10289. connect(rateOfChangeInserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  10290. advancedMenu->addAction(rateOfChangeInserter);
  10291. /*:893*/
  10292. #line 15601 "./typica.w"
  10293. advancedButton->setMenu(advancedMenu);
  10294. layout->addWidget(advancedButton);
  10295. QHBoxLayout*idLayout= new QHBoxLayout;
  10296. QLabel*idLabel= new QLabel(tr("Machine ID for database:"));
  10297. idLayout->addWidget(idLabel);
  10298. QSpinBox*id= new QSpinBox;
  10299. idLayout->addWidget(id);
  10300. layout->addLayout(idLayout);
  10301. /*749:*/
  10302. #line 15632 "./typica.w"
  10303. QDomElement referenceElement=
  10304. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10305. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10306. QDomElement node;
  10307. /*:749*/
  10308. #line 15610 "./typica.w"
  10309. for(int i= 0;i<configData.size();i++)
  10310. {
  10311. node= configData.at(i).toElement();
  10312. if(node.attribute("name")=="databaseid")
  10313. {
  10314. id->setValue(node.attribute("value").toInt());
  10315. break;
  10316. }
  10317. }
  10318. updateRoasterId(id->value());
  10319. connect(id,SIGNAL(valueChanged(int)),this,SLOT(updateRoasterId(int)));
  10320. setLayout(layout);
  10321. }
  10322. /*:748*//*750:*/
  10323. #line 15642 "./typica.w"
  10324. void RoasterConfWidget::updateRoasterId(int id)
  10325. {
  10326. updateAttribute("databaseid",QString("%1").arg(id));
  10327. }
  10328. /*:750*/
  10329. #line 597 "./typica.w"
  10330. /*796:*/
  10331. #line 17130 "./typica.w"
  10332. AnnotationButtonConfWidget::AnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  10333. :BasicDeviceConfigurationWidget(model,index)
  10334. {
  10335. QFormLayout*layout= new QFormLayout;
  10336. QLineEdit*buttonTextEdit= new QLineEdit;
  10337. QLineEdit*annotationTextEdit= new QLineEdit;
  10338. layout->addRow(tr("Button Text:"),buttonTextEdit);
  10339. layout->addRow(tr("Annotation Text:"),annotationTextEdit);
  10340. /*749:*/
  10341. #line 15632 "./typica.w"
  10342. QDomElement referenceElement=
  10343. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10344. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10345. QDomElement node;
  10346. /*:749*/
  10347. #line 17139 "./typica.w"
  10348. for(int i= 0;i<configData.size();i++)
  10349. {
  10350. node= configData.at(i).toElement();
  10351. if(node.attribute("name")=="buttontext")
  10352. {
  10353. buttonTextEdit->setText(node.attribute("value"));
  10354. }
  10355. else if(node.attribute("name")=="annotationtext")
  10356. {
  10357. annotationTextEdit->setText(node.attribute("value"));
  10358. }
  10359. }
  10360. updateButtonText(buttonTextEdit->text());
  10361. updateAnnotationText(annotationTextEdit->text());
  10362. connect(buttonTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateButtonText(QString)));
  10363. connect(annotationTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateAnnotationText(QString)));
  10364. setLayout(layout);
  10365. }
  10366. /*:796*//*797:*/
  10367. #line 17161 "./typica.w"
  10368. void AnnotationButtonConfWidget::updateButtonText(const QString&text)
  10369. {
  10370. updateAttribute("buttontext",text);
  10371. }
  10372. void AnnotationButtonConfWidget::updateAnnotationText(const QString&text)
  10373. {
  10374. updateAttribute("annotationtext",text);
  10375. }
  10376. /*:797*//*800:*/
  10377. #line 17199 "./typica.w"
  10378. ReconfigurableAnnotationButtonConfWidget::ReconfigurableAnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  10379. :BasicDeviceConfigurationWidget(model,index)
  10380. {
  10381. QFormLayout*layout= new QFormLayout;
  10382. QLineEdit*buttonTextEdit= new QLineEdit;
  10383. QLineEdit*annotationTextEdit= new QLineEdit;
  10384. layout->addRow(tr("Button Text:"),buttonTextEdit);
  10385. layout->addRow(tr("Annotation Text:"),annotationTextEdit);
  10386. /*749:*/
  10387. #line 15632 "./typica.w"
  10388. QDomElement referenceElement=
  10389. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10390. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10391. QDomElement node;
  10392. /*:749*/
  10393. #line 17208 "./typica.w"
  10394. for(int i= 0;i<configData.size();i++)
  10395. {
  10396. node= configData.at(i).toElement();
  10397. if(node.attribute("name")=="buttontext")
  10398. {
  10399. buttonTextEdit->setText(node.attribute("value"));
  10400. }
  10401. else if(node.attribute("name")=="annotationtext")
  10402. {
  10403. annotationTextEdit->setText(node.attribute("value"));
  10404. }
  10405. }
  10406. updateButtonText(buttonTextEdit->text());
  10407. updateAnnotationText(annotationTextEdit->text());
  10408. connect(buttonTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateButtonText(QString)));
  10409. connect(annotationTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateAnnotationText(QString)));
  10410. QTextEdit*documentation= new QTextEdit;
  10411. 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."));
  10412. documentation->setReadOnly(true);
  10413. layout->addRow("",documentation);
  10414. setLayout(layout);
  10415. }
  10416. void ReconfigurableAnnotationButtonConfWidget::updateButtonText(const QString&text)
  10417. {
  10418. updateAttribute("buttontext",text);
  10419. }
  10420. void ReconfigurableAnnotationButtonConfWidget::updateAnnotationText(const QString&text)
  10421. {
  10422. updateAttribute("annotationtext",text);
  10423. }
  10424. /*:800*/
  10425. #line 598 "./typica.w"
  10426. /*803:*/
  10427. #line 17276 "./typica.w"
  10428. NoteSpinConfWidget::NoteSpinConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  10429. :BasicDeviceConfigurationWidget(model,index)
  10430. {
  10431. QFormLayout*layout= new QFormLayout;
  10432. QLineEdit*labelEdit= new QLineEdit;
  10433. layout->addRow(tr("Control Label: "),labelEdit);
  10434. QLineEdit*minimumEdit= new QLineEdit;
  10435. layout->addRow(tr("Minimum Value: "),minimumEdit);
  10436. QLineEdit*maximumEdit= new QLineEdit;
  10437. layout->addRow(tr("Maximum Value: "),maximumEdit);
  10438. QSpinBox*precisionEdit= new QSpinBox;
  10439. precisionEdit->setMinimum(0);
  10440. precisionEdit->setMaximum(9);
  10441. layout->addRow(tr("Precision"),precisionEdit);
  10442. QLineEdit*pretext= new QLineEdit;
  10443. layout->addRow(tr("Prefix text"),pretext);
  10444. QLineEdit*posttext= new QLineEdit;
  10445. layout->addRow(tr("Suffix text"),posttext);
  10446. /*749:*/
  10447. #line 15632 "./typica.w"
  10448. QDomElement referenceElement=
  10449. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10450. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10451. QDomElement node;
  10452. /*:749*/
  10453. #line 17295 "./typica.w"
  10454. for(int i= 0;i<configData.size();i++)
  10455. {
  10456. node= configData.at(i).toElement();
  10457. if(node.attribute("name")=="label")
  10458. {
  10459. labelEdit->setText(node.attribute("value"));
  10460. }
  10461. else if(node.attribute("name")=="minimum")
  10462. {
  10463. minimumEdit->setText(node.attribute("value"));
  10464. }
  10465. else if(node.attribute("name")=="maximum")
  10466. {
  10467. maximumEdit->setText(node.attribute("value"));
  10468. }
  10469. else if(node.attribute("name")=="precision")
  10470. {
  10471. precisionEdit->setValue(node.attribute("value").toInt());
  10472. }
  10473. else if(node.attribute("name")=="pretext")
  10474. {
  10475. pretext->setText(node.attribute("value"));
  10476. }
  10477. else if(node.attribute("name")=="posttext")
  10478. {
  10479. posttext->setText(node.attribute("value"));
  10480. }
  10481. }
  10482. updateLabel(labelEdit->text());
  10483. updateMinimum(minimumEdit->text());
  10484. updateMaximum(maximumEdit->text());
  10485. updatePrecision(precisionEdit->value());
  10486. updatePretext(pretext->text());
  10487. updatePosttext(posttext->text());
  10488. connect(labelEdit,SIGNAL(textEdited(QString)),this,SLOT(updateLabel(QString)));
  10489. connect(minimumEdit,SIGNAL(textEdited(QString)),this,SLOT(updateMinimum(QString)));
  10490. connect(maximumEdit,SIGNAL(textEdited(QString)),this,SLOT(updateMaximum(QString)));
  10491. connect(precisionEdit,SIGNAL(valueChanged(int)),this,SLOT(updatePrecision(int)));
  10492. connect(pretext,SIGNAL(textEdited(QString)),this,SLOT(updatePretext(QString)));
  10493. connect(posttext,SIGNAL(textEdited(QString)),this,SLOT(updatePosttext(QString)));
  10494. setLayout(layout);
  10495. }
  10496. void NoteSpinConfWidget::updateLabel(const QString&text)
  10497. {
  10498. updateAttribute("label",text);
  10499. }
  10500. void NoteSpinConfWidget::updateMinimum(const QString&minimum)
  10501. {
  10502. updateAttribute("minimum",minimum);
  10503. }
  10504. void NoteSpinConfWidget::updateMaximum(const QString&maximum)
  10505. {
  10506. updateAttribute("maximum",maximum);
  10507. }
  10508. void NoteSpinConfWidget::updatePrecision(int precision)
  10509. {
  10510. updateAttribute("precision",QString("%1").arg(precision));
  10511. }
  10512. void NoteSpinConfWidget::updatePretext(const QString&text)
  10513. {
  10514. updateAttribute("pretext",text);
  10515. }
  10516. void NoteSpinConfWidget::updatePosttext(const QString&text)
  10517. {
  10518. updateAttribute("posttext",text);
  10519. }
  10520. /*:803*/
  10521. #line 599 "./typica.w"
  10522. /*313:*/
  10523. #line 6945 "./typica.w"
  10524. LinearCalibrator::LinearCalibrator(QObject*parent):
  10525. QObject(parent),Lo1(0),Lo2(0),Up1(1),Up2(1),sensitivitySetting(0.0),clamp(false)
  10526. {
  10527. connect(this,SIGNAL(measurement(Measurement)),this,SIGNAL(newData(Measurement)));
  10528. }
  10529. /*:313*//*314:*/
  10530. #line 6959 "./typica.w"
  10531. Measurement LinearCalibrator::newMeasurement(Measurement measure)
  10532. {
  10533. double outval= Lo1+(measure.temperature()-Lo2)*(Up1-Lo1)/(Up2-Lo2);
  10534. if(clamp)
  10535. {
  10536. if(outval<Lo1)
  10537. {
  10538. outval= Lo1;
  10539. }
  10540. else if(outval> Up1)
  10541. {
  10542. outval= Up1;
  10543. }
  10544. }
  10545. if(sensitivitySetting>=0.05)
  10546. {
  10547. int temp= qRound(outval/sensitivitySetting);
  10548. outval= temp*sensitivitySetting;
  10549. }
  10550. Measurement adjusted(outval,measure.time(),measure.scale());
  10551. emit measurement(adjusted);
  10552. return adjusted;
  10553. }
  10554. /*:314*//*315:*/
  10555. #line 6986 "./typica.w"
  10556. double LinearCalibrator::measuredLower()
  10557. {
  10558. return Lo2;
  10559. }
  10560. double LinearCalibrator::measuredUpper()
  10561. {
  10562. return Up2;
  10563. }
  10564. double LinearCalibrator::mappedLower()
  10565. {
  10566. return Lo1;
  10567. }
  10568. double LinearCalibrator::mappedUpper()
  10569. {
  10570. return Up1;
  10571. }
  10572. bool LinearCalibrator::isClosedRange()
  10573. {
  10574. return clamp;
  10575. }
  10576. void LinearCalibrator::setMeasuredLower(double lower)
  10577. {
  10578. Lo2= lower;
  10579. }
  10580. void LinearCalibrator::setMeasuredUpper(double upper)
  10581. {
  10582. Up2= upper;
  10583. }
  10584. void LinearCalibrator::setMappedLower(double lower)
  10585. {
  10586. Lo1= lower;
  10587. }
  10588. void LinearCalibrator::setMappedUpper(double upper)
  10589. {
  10590. Up1= upper;
  10591. }
  10592. void LinearCalibrator::setClosedRange(bool closed)
  10593. {
  10594. clamp= closed;
  10595. }
  10596. void LinearCalibrator::setSensitivity(double sensitivity)
  10597. {
  10598. sensitivitySetting= sensitivity;
  10599. }
  10600. double LinearCalibrator::sensitivity()
  10601. {
  10602. return sensitivitySetting;
  10603. }
  10604. /*:315*/
  10605. #line 600 "./typica.w"
  10606. /*320:*/
  10607. #line 7119 "./typica.w"
  10608. void LinearSplineInterpolator::add_pair(double source,double destination)
  10609. {
  10610. pairs->insert(source,destination);
  10611. make_interpolators();
  10612. }
  10613. void LinearSplineInterpolator::make_interpolators()
  10614. {
  10615. if(pairs->size()> 1)
  10616. {
  10617. while(interpolators->size()> 0)
  10618. {
  10619. LinearCalibrator*removed= interpolators->takeFirst();
  10620. removed->deleteLater();
  10621. }
  10622. QMap<double,double> ::const_iterator i= pairs->constBegin();
  10623. QMap<double,double> ::const_iterator j= i+1;
  10624. while(j!=pairs->constEnd())
  10625. {
  10626. LinearCalibrator*segment= new LinearCalibrator();
  10627. segment->setMeasuredLower(i.key());
  10628. segment->setMappedLower(i.value());
  10629. segment->setMeasuredUpper(j.key());
  10630. segment->setMappedUpper(j.value());
  10631. segment->setClosedRange(false);
  10632. interpolators->append(segment);
  10633. connect(segment,SIGNAL(measurement(Measurement)),this,SIGNAL(newData(Measurement)));
  10634. i++;
  10635. j++;
  10636. }
  10637. }
  10638. }
  10639. LinearSplineInterpolator::LinearSplineInterpolator(QObject*parent):
  10640. QObject(parent),pairs(new QMap<double,double> ),
  10641. interpolators(new QList<LinearCalibrator*> )
  10642. {
  10643. }
  10644. Measurement LinearSplineInterpolator::newMeasurement(Measurement measure)
  10645. {
  10646. QMap<double,double> ::const_iterator i= pairs->constBegin();
  10647. int index= -1;
  10648. while(i!=pairs->constEnd())
  10649. {
  10650. if(measure.temperature()<=i.key())
  10651. {
  10652. break;
  10653. }
  10654. i++;
  10655. index++;
  10656. }
  10657. if(index<0)
  10658. {
  10659. index= 0;
  10660. }
  10661. if(index>=interpolators->size())
  10662. {
  10663. index= interpolators->size()-1;
  10664. }
  10665. if(interpolators->at(index)!=NULL)
  10666. {
  10667. return interpolators->at(index)->newMeasurement(measure);
  10668. }
  10669. return Measurement();
  10670. }
  10671. /*:320*/
  10672. #line 601 "./typica.w"
  10673. /*872:*/
  10674. #line 18611 "./typica.w"
  10675. LinearSplineInterpolationConfWidget::LinearSplineInterpolationConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  10676. :BasicDeviceConfigurationWidget(model,index),tablemodel(new SaltModel(2))
  10677. {
  10678. QFormLayout*layout= new QFormLayout;
  10679. QLineEdit*source= new QLineEdit;
  10680. layout->addRow(tr("Source column name:"),source);
  10681. QLineEdit*destination= new QLineEdit;
  10682. layout->addRow(tr("Destination column name:"),destination);
  10683. tablemodel->setHeaderData(0,Qt::Horizontal,"Input");
  10684. tablemodel->setHeaderData(1,Qt::Horizontal,"Output");
  10685. QTableView*mappingTable= new QTableView;
  10686. mappingTable->setModel(tablemodel);
  10687. NumericDelegate*delegate= new NumericDelegate;
  10688. mappingTable->setItemDelegate(delegate);
  10689. layout->addRow(tr("Mapping data:"),mappingTable);
  10690. /*749:*/
  10691. #line 15632 "./typica.w"
  10692. QDomElement referenceElement=
  10693. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10694. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10695. QDomElement node;
  10696. /*:749*/
  10697. #line 18627 "./typica.w"
  10698. for(int i= 0;i<configData.size();i++)
  10699. {
  10700. node= configData.at(i).toElement();
  10701. if(node.attribute("name")=="source")
  10702. {
  10703. source->setText(node.attribute("value"));
  10704. }
  10705. else if(node.attribute("name")=="destination")
  10706. {
  10707. destination->setText(node.attribute("value"));
  10708. }
  10709. else if(node.attribute("name")=="sourcevalues")
  10710. {
  10711. /*873:*/
  10712. #line 18666 "./typica.w"
  10713. QString data= node.attribute("value");
  10714. if(data.length()> 3)
  10715. {
  10716. data.chop(2);
  10717. data= data.remove(0,2);
  10718. }
  10719. QStringList itemList= data.split(",");
  10720. /*:873*/
  10721. #line 18641 "./typica.w"
  10722. int column= 0;
  10723. /*874:*/
  10724. #line 18678 "./typica.w"
  10725. for(int i= 0;i<itemList.size();i++)
  10726. {
  10727. tablemodel->setData(tablemodel->index(i,column),
  10728. QVariant(itemList.at(i).toDouble()),
  10729. Qt::DisplayRole);
  10730. }
  10731. /*:874*/
  10732. #line 18643 "./typica.w"
  10733. }
  10734. else if(node.attribute("name")=="destinationvalues")
  10735. {
  10736. /*873:*/
  10737. #line 18666 "./typica.w"
  10738. QString data= node.attribute("value");
  10739. if(data.length()> 3)
  10740. {
  10741. data.chop(2);
  10742. data= data.remove(0,2);
  10743. }
  10744. QStringList itemList= data.split(",");
  10745. /*:873*/
  10746. #line 18648 "./typica.w"
  10747. int column= 1;
  10748. /*874:*/
  10749. #line 18678 "./typica.w"
  10750. for(int i= 0;i<itemList.size();i++)
  10751. {
  10752. tablemodel->setData(tablemodel->index(i,column),
  10753. QVariant(itemList.at(i).toDouble()),
  10754. Qt::DisplayRole);
  10755. }
  10756. /*:874*/
  10757. #line 18650 "./typica.w"
  10758. }
  10759. }
  10760. updateSourceColumn(source->text());
  10761. updateDestinationColumn(destination->text());
  10762. updateKnots();
  10763. connect(source,SIGNAL(textEdited(QString)),this,SLOT(updateSourceColumn(QString)));
  10764. connect(destination,SIGNAL(textEdited(QString)),this,SLOT(updateDestinationColumn(QString)));
  10765. connect(tablemodel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(updateKnots()));
  10766. setLayout(layout);
  10767. }
  10768. /*:872*//*875:*/
  10769. #line 18689 "./typica.w"
  10770. void LinearSplineInterpolationConfWidget::updateKnots()
  10771. {
  10772. updateAttribute("sourcevalues",tablemodel->arrayLiteral(0,Qt::DisplayRole));
  10773. updateAttribute("destinationvalues",tablemodel->arrayLiteral(1,Qt::DisplayRole));
  10774. }
  10775. void LinearSplineInterpolationConfWidget::updateSourceColumn(const QString&source)
  10776. {
  10777. updateAttribute("source",source);
  10778. }
  10779. void LinearSplineInterpolationConfWidget::updateDestinationColumn(const QString&dest)
  10780. {
  10781. updateAttribute("destination",dest);
  10782. }
  10783. /*:875*/
  10784. #line 602 "./typica.w"
  10785. /*878:*/
  10786. #line 18732 "./typica.w"
  10787. TranslationConfWidget::TranslationConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  10788. :BasicDeviceConfigurationWidget(model,index),
  10789. temperatureValue(new QDoubleSpinBox),unitSelector(new QComboBox)
  10790. {
  10791. unitSelector->addItem("Fahrenheit");
  10792. unitSelector->addItem("Celsius");
  10793. temperatureValue->setMinimum(0);
  10794. temperatureValue->setMaximum(1000);
  10795. QFormLayout*layout= new QFormLayout;
  10796. QLineEdit*column= new QLineEdit;
  10797. layout->addRow(tr("Column to match:"),column);
  10798. layout->addRow(tr("Unit:"),unitSelector);
  10799. layout->addRow(tr("Value:"),temperatureValue);
  10800. /*749:*/
  10801. #line 15632 "./typica.w"
  10802. QDomElement referenceElement=
  10803. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10804. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10805. QDomElement node;
  10806. /*:749*/
  10807. #line 18746 "./typica.w"
  10808. for(int i= 0;i<configData.size();i++)
  10809. {
  10810. node= configData.at(i).toElement();
  10811. if(node.attribute("name")=="column")
  10812. {
  10813. column->setText(node.attribute("value"));
  10814. }
  10815. else if(node.attribute("name")=="unit")
  10816. {
  10817. unitSelector->setCurrentIndex(unitSelector->findText(node.attribute("value")));
  10818. }
  10819. else if(node.attribute("name")=="value")
  10820. {
  10821. temperatureValue->setValue(node.attribute("value").toDouble());
  10822. }
  10823. }
  10824. updateMatchingColumn(column->text());
  10825. updateTemperature();
  10826. connect(column,SIGNAL(textEdited(QString)),this,SLOT(updateMatchingColumn(QString)));
  10827. connect(unitSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateTemperature()));
  10828. connect(temperatureValue,SIGNAL(valueChanged(double)),this,SLOT(updateTemperature()));
  10829. setLayout(layout);
  10830. }
  10831. /*:878*//*879:*/
  10832. #line 18775 "./typica.w"
  10833. void TranslationConfWidget::updateTemperature()
  10834. {
  10835. updateAttribute("unit",unitSelector->currentText());
  10836. updateAttribute("value",QString("%1").arg(temperatureValue->value()));
  10837. if(unitSelector->currentText()=="Fahrenheit")
  10838. {
  10839. updateAttribute("FValue",QString("%1").arg(temperatureValue->value()));
  10840. }
  10841. else
  10842. {
  10843. updateAttribute("FValue",QString("%1").arg(temperatureValue->value()*9/5+32));
  10844. }
  10845. }
  10846. void TranslationConfWidget::updateMatchingColumn(const QString&column)
  10847. {
  10848. updateAttribute("column",column);
  10849. }
  10850. /*:879*/
  10851. #line 603 "./typica.w"
  10852. /*806:*/
  10853. #line 24 "./freeannotation.w"
  10854. FreeAnnotationConfWidget::FreeAnnotationConfWidget(DeviceTreeModel*model,
  10855. const QModelIndex&index)
  10856. :BasicDeviceConfigurationWidget(model,index)
  10857. {
  10858. QFormLayout*layout= new QFormLayout;
  10859. QLineEdit*labelEdit= new QLineEdit;
  10860. layout->addRow(tr("Label Text:"),labelEdit);
  10861. /*749:*/
  10862. #line 15632 "./typica.w"
  10863. QDomElement referenceElement=
  10864. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10865. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10866. QDomElement node;
  10867. /*:749*/
  10868. #line 32 "./freeannotation.w"
  10869. for(int i= 0;i<configData.size();i++)
  10870. {
  10871. node= configData.at(i).toElement();
  10872. if(node.attribute("name")=="labeltext")
  10873. {
  10874. labelEdit->setText(node.attribute("value"));
  10875. }
  10876. }
  10877. updateLabel(labelEdit->text());
  10878. connect(labelEdit,SIGNAL(textEdited(QString)),
  10879. this,SLOT(updateLabel(QString)));
  10880. setLayout(layout);
  10881. }
  10882. /*:806*//*807:*/
  10883. #line 49 "./freeannotation.w"
  10884. void FreeAnnotationConfWidget::updateLabel(const QString&text)
  10885. {
  10886. updateAttribute("labeltext",text);
  10887. }
  10888. /*:807*/
  10889. #line 604 "./typica.w"
  10890. /*882:*/
  10891. #line 39 "./rate.w"
  10892. void RateOfChange::newMeasurement(Measurement measure)
  10893. {
  10894. cache.append(measure);
  10895. /*883:*/
  10896. #line 64 "./rate.w"
  10897. if(cache.size()> 2)
  10898. {
  10899. bool done= false;
  10900. while(!done)
  10901. {
  10902. if(cache.front().time().secsTo(cache.back().time())> ct)
  10903. {
  10904. cache.removeFirst();
  10905. }
  10906. else if(cache.back().time()<cache.front().time())
  10907. {
  10908. cache.removeFirst();
  10909. done= true;
  10910. }
  10911. else
  10912. {
  10913. done= true;
  10914. }
  10915. if(cache.size()<3)
  10916. {
  10917. done= true;
  10918. }
  10919. }
  10920. }
  10921. /*:883*/
  10922. #line 43 "./rate.w"
  10923. if(cache.size()>=2)
  10924. {
  10925. /*884:*/
  10926. #line 96 "./rate.w"
  10927. int N= cache.size();
  10928. double SXY= 0;
  10929. double SX= 0;
  10930. double SXX= 0;
  10931. double SY= 0;
  10932. double y;
  10933. double x;
  10934. for(int i= 0;i<N;i++)
  10935. {
  10936. y= cache.at(i).temperature();
  10937. SY+= y;
  10938. x= cache.at(0).time().msecsTo(cache.at(i).time())/1000.0;
  10939. SX+= x;
  10940. SXX+= (x*x);
  10941. SXY+= (x*y);
  10942. }
  10943. double M= ((N*SXY)-(SX*SY))/((N*SXX)-(SX*SX));
  10944. Measurement value(M*st,cache.back().time(),cache.back().scale());
  10945. value.insert("relative",true);
  10946. emit newData(value);
  10947. /*:884*/
  10948. #line 46 "./rate.w"
  10949. }
  10950. }
  10951. /*:882*//*885:*/
  10952. #line 120 "./rate.w"
  10953. RateOfChange::RateOfChange(int cachetime,int scaletime):ct(cachetime),st(1)
  10954. {
  10955. setScaleTime(scaletime);
  10956. }
  10957. void RateOfChange::setCacheTime(int seconds)
  10958. {
  10959. ct= seconds;
  10960. }
  10961. void RateOfChange::setScaleTime(int seconds)
  10962. {
  10963. st= (seconds> 0?seconds:1);
  10964. }
  10965. /*:885*/
  10966. #line 605 "./typica.w"
  10967. /*810:*/
  10968. #line 26 "./settings.w"
  10969. SettingsWindow::SettingsWindow():QMainWindow(NULL)
  10970. {
  10971. QTabWidget*settingsTab= new QTabWidget;
  10972. DeviceConfigurationWindow*deviceSettings= new DeviceConfigurationWindow;
  10973. settingsTab->addTab(deviceSettings,tr("Roasters"));
  10974. GraphSettingsWidget*graphSettings= new GraphSettingsWidget;
  10975. settingsTab->addTab(graphSettings,tr("Graph"));
  10976. setCentralWidget(settingsTab);
  10977. }
  10978. /*:810*/
  10979. #line 606 "./typica.w"
  10980. /*815:*/
  10981. #line 27 "./graphsettings.w"
  10982. GraphSettingsWidget::GraphSettingsWidget():QWidget(NULL)
  10983. {
  10984. QTabWidget*graphCategories= new QTabWidget;
  10985. GraphSettingsRelativeTab*relative= new GraphSettingsRelativeTab;
  10986. graphCategories->addTab(relative,tr("Relative Temperatures"));
  10987. QVBoxLayout*layout= new QVBoxLayout;
  10988. layout->addWidget(graphCategories);
  10989. setLayout(layout);
  10990. }
  10991. /*:815*//*817:*/
  10992. #line 65 "./graphsettings.w"
  10993. GraphSettingsRelativeTab::GraphSettingsRelativeTab():QWidget(NULL),
  10994. colorEdit(new QLineEdit)
  10995. {
  10996. QSettings settings;
  10997. QVBoxLayout*layout= new QVBoxLayout;
  10998. QCheckBox*enable= new QCheckBox(tr("Graph relative temperatures"));
  10999. enable->setChecked(settings.value("settings/graph/relative/enable",true).toBool());
  11000. updateEnableSetting(enable->isChecked());
  11001. connect(enable,SIGNAL(toggled(bool)),this,SLOT(updateEnableSetting(bool)));
  11002. layout->addWidget(enable);
  11003. QHBoxLayout*colorLayout= new QHBoxLayout;
  11004. QLabel*colorLabel= new QLabel(tr("Axis color:"));
  11005. colorEdit->setText(settings.value("settings/graph/relative/color","#000000").toString());
  11006. updateColorSetting(colorEdit->text());
  11007. connect(colorEdit,SIGNAL(textChanged(QString)),this,SLOT(updateColorSetting(QString)));
  11008. QToolButton*colorPickerButton= new QToolButton();
  11009. colorPickerButton->setIcon(QIcon::fromTheme("applications-graphics"));
  11010. connect(colorPickerButton,SIGNAL(clicked()),this,SLOT(showColorPicker()));
  11011. colorLayout->addWidget(colorLabel);
  11012. colorLayout->addWidget(colorEdit);
  11013. colorLayout->addWidget(colorPickerButton);
  11014. colorLayout->addStretch();
  11015. layout->addLayout(colorLayout);
  11016. QHBoxLayout*unitLayout= new QHBoxLayout;
  11017. QLabel*unitLabel= new QLabel(tr("Unit"));
  11018. QComboBox*unitSelector= new QComboBox;
  11019. unitSelector->addItem(tr("Fahrenheit"));
  11020. unitSelector->addItem(tr("Celsius"));
  11021. unitSelector->setCurrentIndex(settings.value("settings/graph/relative/unit",0).toInt());
  11022. updateUnit(unitSelector->currentIndex());
  11023. connect(unitSelector,SIGNAL(currentIndexChanged(int)),this,SLOT(updateUnit(int)));
  11024. unitLayout->addWidget(unitLabel);
  11025. unitLayout->addWidget(unitSelector);
  11026. unitLayout->addStretch();
  11027. layout->addLayout(unitLayout);
  11028. QHBoxLayout*axisLayout= new QHBoxLayout;
  11029. QLabel*axisLabel= new QLabel(tr("Grid line positions (comma separated):"));
  11030. QLineEdit*axisEdit= new QLineEdit;
  11031. axisEdit->setText(settings.value("settings/graph/relative/grid","-300, -100, -10, 0, 10, 30, 50").toString());
  11032. updateAxisSetting(axisEdit->text());
  11033. connect(axisEdit,SIGNAL(textChanged(QString)),this,SLOT(updateAxisSetting(QString)));
  11034. axisLayout->addWidget(axisLabel);
  11035. axisLayout->addWidget(axisEdit);
  11036. layout->addLayout(axisLayout);
  11037. layout->addStretch();
  11038. setLayout(layout);
  11039. }
  11040. /*:817*//*818:*/
  11041. #line 116 "./graphsettings.w"
  11042. void GraphSettingsRelativeTab::updateEnableSetting(bool enabled)
  11043. {
  11044. QSettings settings;
  11045. settings.setValue("settings/graph/relative/enable",enabled);
  11046. }
  11047. void GraphSettingsRelativeTab::updateColorSetting(const QString&color)
  11048. {
  11049. QSettings settings;
  11050. settings.setValue("settings/graph/relative/color",color);
  11051. }
  11052. void GraphSettingsRelativeTab::updateAxisSetting(const QString&gridList)
  11053. {
  11054. QSettings settings;
  11055. QString settingValue;
  11056. QStringList points= gridList.split(QRegExp("[\\s,]+"),QString::SkipEmptyParts);
  11057. QStringList numbers;
  11058. foreach(QString text,points)
  11059. {
  11060. bool okay= false;
  11061. text.toDouble(&okay);
  11062. if(okay)
  11063. {
  11064. numbers.append(text);
  11065. }
  11066. }
  11067. numbers.removeDuplicates();
  11068. settings.setValue("settings/graph/relative/grid",numbers.join(","));
  11069. }
  11070. void GraphSettingsRelativeTab::updateUnit(int unit)
  11071. {
  11072. QSettings settings;
  11073. settings.setValue("settings/graph/relative/unit",unit);
  11074. }
  11075. /*:818*//*819:*/
  11076. #line 159 "./graphsettings.w"
  11077. void GraphSettingsRelativeTab::showColorPicker()
  11078. {
  11079. QColor color= QColorDialog::getColor(QColor(colorEdit->text()),this);
  11080. colorEdit->setText(color.name());
  11081. }
  11082. #line 17377 "./typica.w"
  11083. /*:819*/
  11084. #line 607 "./typica.w"
  11085. /*917:*/
  11086. #line 682 "./dataqsdk.w"
  11087. DataqSdkDeviceConfWidget::DataqSdkDeviceConfWidget(DeviceTreeModel*model,
  11088. const QModelIndex&index)
  11089. :BasicDeviceConfigurationWidget(model,index),
  11090. deviceIdStack(new QStackedWidget)
  11091. {
  11092. QVBoxLayout*layout= new QVBoxLayout;
  11093. QCheckBox*autoDetect= new QCheckBox("Automatically select device");
  11094. layout->addWidget(autoDetect);
  11095. QWidget*autoLayerWidget= new QWidget;
  11096. QHBoxLayout*autoLayerLayout= new QHBoxLayout;
  11097. QLabel*autoLabel= new QLabel(tr("Device number"));
  11098. QSpinBox*autoNumber= new QSpinBox;
  11099. autoNumber->setMinimum(1);
  11100. autoNumber->setMaximum(99);
  11101. autoLayerLayout->addWidget(autoLabel);
  11102. autoLayerLayout->addWidget(autoNumber);
  11103. autoLayerWidget->setLayout(autoLayerLayout);
  11104. QWidget*fixedLayerWidget= new QWidget;
  11105. QHBoxLayout*fixedLayerLayout= new QHBoxLayout;
  11106. QLabel*fixedLabel= new QLabel(tr("Device port"));
  11107. QComboBox*portSelection= new QComboBox;
  11108. portSelection->setEditable(true);
  11109. portSelection->addItems(DataqSdkDevice::detectHardware());
  11110. fixedLayerLayout->addWidget(fixedLabel);
  11111. fixedLayerLayout->addWidget(portSelection);
  11112. fixedLayerWidget->setLayout(fixedLayerLayout);
  11113. deviceIdStack->addWidget(autoLayerWidget);
  11114. deviceIdStack->addWidget(fixedLayerWidget);
  11115. layout->addWidget(deviceIdStack);
  11116. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  11117. layout->addWidget(addChannelButton);
  11118. /*749:*/
  11119. #line 15632 "./typica.w"
  11120. QDomElement referenceElement=
  11121. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11122. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11123. QDomElement node;
  11124. /*:749*/
  11125. #line 714 "./dataqsdk.w"
  11126. for(int i= 0;i<configData.size();i++)
  11127. {
  11128. node= configData.at(i).toElement();
  11129. if(node.attribute("name")=="autoSelect")
  11130. {
  11131. autoDetect->setChecked(node.attribute("value")=="true"?true:false);
  11132. }
  11133. else if(node.attribute("name")=="deviceNumber")
  11134. {
  11135. autoNumber->setValue(node.attribute("value").toInt());
  11136. }
  11137. else if(node.attribute("name")=="port")
  11138. {
  11139. int index= portSelection->findText(node.attribute("value"));
  11140. if(index> -1)
  11141. {
  11142. portSelection->setCurrentIndex(index);
  11143. }
  11144. else
  11145. {
  11146. portSelection->setEditText(node.attribute("value"));
  11147. }
  11148. }
  11149. }
  11150. updateAutoSelect(autoDetect->isChecked());
  11151. updateDeviceNumber(autoNumber->value());
  11152. updatePort(portSelection->currentText());
  11153. connect(autoDetect,SIGNAL(toggled(bool)),this,SLOT(updateAutoSelect(bool)));
  11154. connect(autoNumber,SIGNAL(valueChanged(int)),this,SLOT(updateDeviceNumber(int)));
  11155. connect(portSelection,SIGNAL(currentIndexChanged(QString)),this,SLOT(updatePort(QString)));
  11156. connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
  11157. setLayout(layout);
  11158. }
  11159. /*:917*//*918:*/
  11160. #line 758 "./dataqsdk.w"
  11161. void DataqSdkDeviceConfWidget::updateAutoSelect(bool automatic)
  11162. {
  11163. if(automatic)
  11164. {
  11165. updateAttribute("autoSelect","true");
  11166. deviceIdStack->setCurrentIndex(0);
  11167. }
  11168. else
  11169. {
  11170. updateAttribute("autoSelect","false");
  11171. deviceIdStack->setCurrentIndex(1);
  11172. }
  11173. }
  11174. /*:918*//*919:*/
  11175. #line 775 "./dataqsdk.w"
  11176. void DataqSdkDeviceConfWidget::updateDeviceNumber(int deviceNumber)
  11177. {
  11178. updateAttribute("deviceNumber",QString("%1").arg(deviceNumber));
  11179. }
  11180. void DataqSdkDeviceConfWidget::updatePort(QString portId)
  11181. {
  11182. updateAttribute("port",portId);
  11183. }
  11184. /*:919*//*920:*/
  11185. #line 788 "./dataqsdk.w"
  11186. void DataqSdkDeviceConfWidget::addChannel()
  11187. {
  11188. insertChildNode(tr("Channel"),"dataqsdkchannel");
  11189. }
  11190. /*:920*//*923:*/
  11191. #line 868 "./dataqsdk.w"
  11192. DataqSdkChannelConfWidget::DataqSdkChannelConfWidget(DeviceTreeModel*model,
  11193. const QModelIndex&index)
  11194. :BasicDeviceConfigurationWidget(model,index),
  11195. startButton(new QPushButton(tr("Start"))),
  11196. resetButton(new QPushButton(tr("Reset"))),
  11197. stopButton(new QPushButton(tr("Stop"))),
  11198. calibrator(new LinearCalibrator),
  11199. currentMeasurement(new QLineEdit),minimumMeasurement(new QLineEdit),
  11200. maximumMeasurement(new QLineEdit),averageMeasurement(new QLineEdit),
  11201. currentMapped(new QLineEdit),minimumMapped(new QLineEdit),
  11202. maximumMapped(new QLineEdit),averageMapped(new QLineEdit),
  11203. rmCount(0),cmCount(0),
  11204. rmin(std::numeric_limits<double> ::max()),
  11205. rmax(std::numeric_limits<double> ::min()),rmean(0),
  11206. cmin(std::numeric_limits<double> ::max()),
  11207. cmax(std::numeric_limits<double> ::min()),cmean(0)
  11208. {
  11209. /*927:*/
  11210. #line 1107 "./dataqsdk.w"
  11211. QDomElement parentReference= model->referenceElement(model->data(index.parent(),Qt::UserRole).toString());
  11212. QDomNodeList deviceConfigData= parentReference.elementsByTagName("attribute");
  11213. QDomElement deviceNode;
  11214. QString configPort;
  11215. QString configAuto;
  11216. for(int i= 0;i<deviceConfigData.size();i++)
  11217. {
  11218. deviceNode= deviceConfigData.at(i).toElement();
  11219. if(deviceNode.attribute("name")=="autoSelect")
  11220. {
  11221. autoSelect= (deviceNode.attribute("value")=="true");
  11222. }
  11223. else if(deviceNode.attribute("name")=="deviceNumber")
  11224. {
  11225. configAuto= deviceNode.attribute("value");
  11226. }
  11227. else if(deviceNode.attribute("name")=="port")
  11228. {
  11229. configPort= deviceNode.attribute("value");
  11230. }
  11231. }
  11232. deviceID= autoSelect?configAuto:configPort;
  11233. channelOfInterest= index.row();
  11234. /*:927*/
  11235. #line 886 "./dataqsdk.w"
  11236. resetButton->setEnabled(false);
  11237. stopButton->setEnabled(false);
  11238. connect(startButton,SIGNAL(clicked()),this,SLOT(startCalibration()));
  11239. connect(resetButton,SIGNAL(clicked()),this,SLOT(resetCalibration()));
  11240. connect(stopButton,SIGNAL(clicked()),this,SLOT(stopCalibration()));
  11241. QVBoxLayout*layout= new QVBoxLayout;
  11242. QFormLayout*topLayout= new QFormLayout;
  11243. QLineEdit*columnEdit= new QLineEdit;
  11244. topLayout->addRow(tr("Column name"),columnEdit);
  11245. QComboBox*unitSelector= new QComboBox;
  11246. unitSelector->addItem(tr("Temperature"));
  11247. unitSelector->addItem(tr("Control"));
  11248. topLayout->addRow(tr("Measurement type"),unitSelector);
  11249. QCheckBox*smoothingBox= new QCheckBox(tr("Enable smoothing"));
  11250. topLayout->addRow(smoothingBox);
  11251. layout->addLayout(topLayout);
  11252. QCheckBox*hideSeries= new QCheckBox(tr("Hide this channel"));
  11253. topLayout->addRow(hideSeries);
  11254. QLabel*calibrationLabel= new QLabel(tr("Calibration settings"));
  11255. layout->addWidget(calibrationLabel);
  11256. QHBoxLayout*calibrationLayout= new QHBoxLayout;
  11257. QFormLayout*calibrationControlsLayout= new QFormLayout;
  11258. QLineEdit*measuredLowerEdit= new QLineEdit;
  11259. measuredLowerEdit->setText("0");
  11260. QLineEdit*measuredUpperEdit= new QLineEdit;
  11261. measuredUpperEdit->setText("10");
  11262. QLineEdit*mappedLowerEdit= new QLineEdit;
  11263. mappedLowerEdit->setText("0");
  11264. QLineEdit*mappedUpperEdit= new QLineEdit;
  11265. mappedUpperEdit->setText("10");
  11266. calibrationControlsLayout->addRow(tr("Measured lower value"),measuredLowerEdit);
  11267. calibrationControlsLayout->addRow(tr("Mapped lower value"),mappedLowerEdit);
  11268. calibrationControlsLayout->addRow(tr("Measured upper value"),measuredUpperEdit);
  11269. calibrationControlsLayout->addRow(tr("Mapped upper value"),mappedUpperEdit);
  11270. QCheckBox*closedBox= new QCheckBox(tr("Closed range"));
  11271. calibrationControlsLayout->addRow(closedBox);
  11272. QLineEdit*sensitivityEdit= new QLineEdit;
  11273. sensitivityEdit->setText("0");
  11274. calibrationControlsLayout->addRow(tr("Discrete interval skip"),sensitivityEdit);
  11275. QVBoxLayout*calibrationTestLayout= new QVBoxLayout;
  11276. QHBoxLayout*deviceControlLayout= new QHBoxLayout;
  11277. deviceControlLayout->addWidget(startButton);
  11278. deviceControlLayout->addWidget(resetButton);
  11279. deviceControlLayout->addWidget(stopButton);
  11280. QFormLayout*indicatorLayout= new QFormLayout;
  11281. currentMeasurement->setReadOnly(true);
  11282. minimumMeasurement->setReadOnly(true);
  11283. maximumMeasurement->setReadOnly(true);
  11284. averageMeasurement->setReadOnly(true);
  11285. currentMapped->setReadOnly(true);
  11286. minimumMapped->setReadOnly(true);
  11287. maximumMapped->setReadOnly(true);
  11288. averageMapped->setReadOnly(true);
  11289. indicatorLayout->addRow(tr("Measured Values"),new QWidget);
  11290. indicatorLayout->addRow(tr("Current"),currentMeasurement);
  11291. indicatorLayout->addRow(tr("Minimum"),minimumMeasurement);
  11292. indicatorLayout->addRow(tr("Maximum"),maximumMeasurement);
  11293. indicatorLayout->addRow(tr("Mean"),averageMeasurement);
  11294. indicatorLayout->addRow(tr("Mapped Values"),new QWidget);
  11295. indicatorLayout->addRow(tr("Current Mapped"),currentMapped);
  11296. indicatorLayout->addRow(tr("Minimum Mapped"),minimumMapped);
  11297. indicatorLayout->addRow(tr("Maximum Mapped"),maximumMapped);
  11298. indicatorLayout->addRow(tr("Mean Mapped"),averageMapped);
  11299. calibrationTestLayout->addLayout(deviceControlLayout);
  11300. calibrationTestLayout->addLayout(indicatorLayout);
  11301. calibrationLayout->addLayout(calibrationControlsLayout);
  11302. calibrationLayout->addLayout(calibrationTestLayout);
  11303. layout->addLayout(calibrationLayout);
  11304. /*749:*/
  11305. #line 15632 "./typica.w"
  11306. QDomElement referenceElement=
  11307. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11308. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11309. QDomElement node;
  11310. /*:749*/
  11311. #line 955 "./dataqsdk.w"
  11312. for(int i= 0;i<configData.size();i++)
  11313. {
  11314. node= configData.at(i).toElement();
  11315. if(node.attribute("name")=="column")
  11316. {
  11317. columnEdit->setText(node.attribute("value"));
  11318. }
  11319. else if(node.attribute("name")=="type")
  11320. {
  11321. unitSelector->setCurrentIndex(unitSelector->findText(node.attribute("value")));
  11322. }
  11323. else if(node.attribute("name")=="smoothing")
  11324. {
  11325. smoothingBox->setChecked(node.attribute("value")=="true");
  11326. }
  11327. else if(node.attribute("name")=="calibrationMeasuredLower")
  11328. {
  11329. measuredLowerEdit->setText(node.attribute("value"));
  11330. }
  11331. else if(node.attribute("name")=="calibrationMeasuredUpper")
  11332. {
  11333. measuredUpperEdit->setText(node.attribute("value"));
  11334. }
  11335. else if(node.attribute("name")=="calibrationMappedLower")
  11336. {
  11337. mappedLowerEdit->setText(node.attribute("value"));
  11338. }
  11339. else if(node.attribute("name")=="calibrationMappedUpper")
  11340. {
  11341. mappedUpperEdit->setText(node.attribute("value"));
  11342. }
  11343. else if(node.attribute("name")=="calibrationClosedInterval")
  11344. {
  11345. closedBox->setChecked(node.attribute("value")=="true");
  11346. }
  11347. else if(node.attribute("name")=="calibrationSensitivity")
  11348. {
  11349. sensitivityEdit->setText(node.attribute("value"));
  11350. }
  11351. else if(node.attribute("name")=="hidden")
  11352. {
  11353. hideSeries->setChecked(node.attribute("value")=="true");
  11354. }
  11355. }
  11356. updateColumnName(columnEdit->text());
  11357. updateUnits(unitSelector->currentText());
  11358. updateSmoothingEnabled(smoothingBox->isChecked());
  11359. updateMeasuredLower(measuredLowerEdit->text());
  11360. updateMeasuredUpper(measuredUpperEdit->text());
  11361. updateMappedLower(mappedLowerEdit->text());
  11362. updateMappedUpper(mappedUpperEdit->text());
  11363. updateClosedInterval(closedBox->isChecked());
  11364. updateSensitivity(sensitivityEdit->text());
  11365. updateHidden(hideSeries->isChecked());
  11366. connect(columnEdit,SIGNAL(textChanged(QString)),
  11367. this,SLOT(updateColumnName(QString)));
  11368. connect(unitSelector,SIGNAL(currentIndexChanged(QString)),
  11369. this,SLOT(updateUnits(QString)));
  11370. connect(smoothingBox,SIGNAL(toggled(bool)),
  11371. this,SLOT(updateSmoothingEnabled(bool)));
  11372. connect(measuredLowerEdit,SIGNAL(textChanged(QString)),
  11373. this,SLOT(updateMeasuredLower(QString)));
  11374. connect(mappedLowerEdit,SIGNAL(textChanged(QString)),
  11375. this,SLOT(updateMappedLower(QString)));
  11376. connect(measuredUpperEdit,SIGNAL(textChanged(QString)),
  11377. this,SLOT(updateMeasuredUpper(QString)));
  11378. connect(mappedUpperEdit,SIGNAL(textChanged(QString)),
  11379. this,SLOT(updateMappedUpper(QString)));
  11380. connect(closedBox,SIGNAL(toggled(bool)),
  11381. this,SLOT(updateClosedInterval(bool)));
  11382. connect(sensitivityEdit,SIGNAL(textChanged(QString)),
  11383. this,SLOT(updateSensitivity(QString)));
  11384. connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  11385. setLayout(layout);
  11386. }
  11387. /*:923*//*924:*/
  11388. #line 1038 "./dataqsdk.w"
  11389. void DataqSdkChannelConfWidget::updateUnits(const QString&unit)
  11390. {
  11391. updateAttribute("type",unit);
  11392. }
  11393. /*:924*//*925:*/
  11394. #line 1047 "./dataqsdk.w"
  11395. void DataqSdkChannelConfWidget::updateMeasuredLower(const QString&value)
  11396. {
  11397. updateAttribute("calibrationMeasuredLower",value);
  11398. calibrator->setMeasuredLower(value.toDouble());
  11399. }
  11400. void DataqSdkChannelConfWidget::updateMeasuredUpper(const QString&value)
  11401. {
  11402. updateAttribute("calibrationMeasuredUpper",value);
  11403. calibrator->setMeasuredUpper(value.toDouble());
  11404. }
  11405. void DataqSdkChannelConfWidget::updateMappedLower(const QString&value)
  11406. {
  11407. updateAttribute("calibrationMappedLower",value);
  11408. calibrator->setMappedLower(value.toDouble());
  11409. }
  11410. void DataqSdkChannelConfWidget::updateMappedUpper(const QString&value)
  11411. {
  11412. updateAttribute("calibrationMappedUpper",value);
  11413. calibrator->setMappedUpper(value.toDouble());
  11414. }
  11415. void DataqSdkChannelConfWidget::updateClosedInterval(bool closed)
  11416. {
  11417. updateAttribute("calibrationClosedInterval",closed?"true":"false");
  11418. calibrator->setClosedRange(closed);
  11419. }
  11420. void DataqSdkChannelConfWidget::updateSmoothingEnabled(bool enabled)
  11421. {
  11422. updateAttribute("smoothing",enabled?"true":"false");
  11423. }
  11424. void DataqSdkChannelConfWidget::updateSensitivity(const QString&value)
  11425. {
  11426. updateAttribute("calibrationSensitivity",value);
  11427. calibrator->setSensitivity(value.toDouble());
  11428. }
  11429. void DataqSdkChannelConfWidget::updateHidden(bool hidden)
  11430. {
  11431. updateAttribute("hidden",hidden?"true":"false");
  11432. }
  11433. /*:925*//*928:*/
  11434. #line 1136 "./dataqsdk.w"
  11435. void DataqSdkChannelConfWidget::startCalibration()
  11436. {
  11437. startButton->setEnabled(false);
  11438. stopButton->setEnabled(true);
  11439. resetButton->setEnabled(true);
  11440. calibrationDevice= new DataqSdkDevice(deviceID);
  11441. Channel*channel;
  11442. for(unsigned int i= 0;i<=channelOfInterest;i++)
  11443. {
  11444. channel= calibrationDevice->newChannel(Units::Unitless);
  11445. }
  11446. connect(channel,SIGNAL(newData(Measurement)),this,SLOT(updateInput(Measurement)));
  11447. connect(channel,SIGNAL(newData(Measurement)),calibrator,SLOT(newMeasurement(Measurement)));
  11448. connect(calibrator,SIGNAL(newData(Measurement)),this,SLOT(updateOutput(Measurement)));
  11449. calibrationDevice->setClockRate(6.0/(1.0+channelOfInterest));
  11450. calibrationDevice->start();
  11451. }
  11452. void DataqSdkChannelConfWidget::stopCalibration()
  11453. {
  11454. startButton->setEnabled(true);
  11455. stopButton->setEnabled(false);
  11456. resetButton->setEnabled(false);
  11457. calibrationDevice->deleteLater();
  11458. /*930:*/
  11459. #line 1181 "./dataqsdk.w"
  11460. rmCount= 0;
  11461. cmCount= 0;
  11462. rmin= std::numeric_limits<double> ::max();
  11463. rmax= std::numeric_limits<double> ::min();
  11464. rmean= 0;
  11465. cmin= std::numeric_limits<double> ::max();
  11466. cmax= std::numeric_limits<double> ::min();
  11467. cmean= 0;
  11468. /*:930*/
  11469. #line 1161 "./dataqsdk.w"
  11470. }
  11471. /*:928*//*929:*/
  11472. #line 1172 "./dataqsdk.w"
  11473. void DataqSdkChannelConfWidget::resetCalibration()
  11474. {
  11475. /*930:*/
  11476. #line 1181 "./dataqsdk.w"
  11477. rmCount= 0;
  11478. cmCount= 0;
  11479. rmin= std::numeric_limits<double> ::max();
  11480. rmax= std::numeric_limits<double> ::min();
  11481. rmean= 0;
  11482. cmin= std::numeric_limits<double> ::max();
  11483. cmax= std::numeric_limits<double> ::min();
  11484. cmean= 0;
  11485. /*:930*/
  11486. #line 1175 "./dataqsdk.w"
  11487. }
  11488. /*:929*//*931:*/
  11489. #line 1195 "./dataqsdk.w"
  11490. void DataqSdkChannelConfWidget::updateInput(Measurement measure)
  11491. {
  11492. double nv= measure.temperature();
  11493. currentMeasurement->setText(QString("%1").arg(nv));
  11494. rmin= qMin(nv,rmin);
  11495. minimumMeasurement->setText(QString("%1").arg(rmin));
  11496. rmax= qMax(nv,rmax);
  11497. maximumMeasurement->setText(QString("%1").arg(rmax));
  11498. rmean= ((rmean*rmCount)+nv)/(rmCount+1);
  11499. rmCount++;
  11500. averageMeasurement->setText(QString("%1").arg(rmean));
  11501. }
  11502. void DataqSdkChannelConfWidget::updateOutput(Measurement measure)
  11503. {
  11504. double nv= measure.temperature();
  11505. currentMapped->setText(QString("%1").arg(nv));
  11506. cmin= qMin(nv,cmin);
  11507. minimumMapped->setText(QString("%1").arg(cmin));
  11508. cmax= qMax(nv,cmax);
  11509. maximumMapped->setText(QString("%1").arg(cmax));
  11510. cmean= ((cmean*cmCount)+nv)/(cmCount+1);
  11511. cmCount++;
  11512. averageMapped->setText(QString("%1").arg(cmean));
  11513. }
  11514. /*:931*//*932:*/
  11515. #line 1224 "./dataqsdk.w"
  11516. void DataqSdkChannelConfWidget::updateColumnName(const QString&value)
  11517. {
  11518. updateAttribute("column",value);
  11519. }
  11520. /*:932*/
  11521. #line 608 "./typica.w"
  11522. /*956:*/
  11523. #line 393 "./scales.w"
  11524. SerialScaleConfWidget::SerialScaleConfWidget(DeviceTreeModel*model,
  11525. const QModelIndex&index)
  11526. :BasicDeviceConfigurationWidget(model,index),
  11527. port(new PortSelector),baud(new BaudSelector),parity(new ParitySelector),
  11528. flow(new FlowSelector),stop(new StopSelector)
  11529. {
  11530. QFormLayout*layout= new QFormLayout;
  11531. layout->addRow(tr("Port:"),port);
  11532. connect(port,SIGNAL(currentIndexChanged(QString)),
  11533. this,SLOT(updatePort(QString)));
  11534. connect(port,SIGNAL(editTextChanged(QString)),
  11535. this,SLOT(updatePort(QString)));
  11536. layout->addRow(tr("Baud:"),baud);
  11537. connect(baud,SIGNAL(currentIndexChanged(QString)),
  11538. this,SLOT(updateBaudRate(QString)));
  11539. layout->addRow(tr("Parity:"),parity);
  11540. connect(parity,SIGNAL(currentIndexChanged(int)),
  11541. this,SLOT(updateParity(int)));
  11542. layout->addRow(tr("Flow Control:"),flow);
  11543. connect(flow,SIGNAL(currentIndexChanged(int)),
  11544. this,SLOT(updateFlowControl(int)));
  11545. layout->addRow(tr("Stop Bits:"),stop);
  11546. connect(stop,SIGNAL(currentIndexChanged(int)),
  11547. this,SLOT(updateStopBits(int)));
  11548. /*749:*/
  11549. #line 15632 "./typica.w"
  11550. QDomElement referenceElement=
  11551. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11552. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11553. QDomElement node;
  11554. /*:749*/
  11555. #line 418 "./scales.w"
  11556. for(int i= 0;i<configData.size();i++)
  11557. {
  11558. node= configData.at(i).toElement();
  11559. if(node.attribute("name")=="port")
  11560. {
  11561. int j= port->findText(node.attribute("value"));
  11562. if(j>=0)
  11563. {
  11564. port->setCurrentIndex(j);
  11565. }
  11566. else
  11567. {
  11568. port->insertItem(0,node.attribute("value"));
  11569. port->setCurrentIndex(0);
  11570. }
  11571. }
  11572. else if(node.attribute("name")=="baudrate")
  11573. {
  11574. baud->setCurrentIndex(baud->findText(node.attribute("value")));
  11575. }
  11576. else if(node.attribute("name")=="parity")
  11577. {
  11578. parity->setCurrentIndex(parity->findData(node.attribute("value")));
  11579. }
  11580. else if(node.attribute("name")=="flowcontrol")
  11581. {
  11582. flow->setCurrentIndex(flow->findData(node.attribute("value")));
  11583. }
  11584. else if(node.attribute("name")=="stopbits")
  11585. {
  11586. stop->setCurrentIndex(stop->findData(node.attribute("value")));
  11587. }
  11588. }
  11589. updatePort(port->currentText());
  11590. updateBaudRate(baud->currentText());
  11591. updateParity(parity->currentIndex());
  11592. updateFlowControl(flow->currentIndex());
  11593. updateStopBits(stop->currentIndex());
  11594. setLayout(layout);
  11595. }
  11596. /*:956*//*957:*/
  11597. #line 462 "./scales.w"
  11598. void SerialScaleConfWidget::updatePort(const QString&newPort)
  11599. {
  11600. updateAttribute("port",newPort);
  11601. }
  11602. void SerialScaleConfWidget::updateBaudRate(const QString&rate)
  11603. {
  11604. updateAttribute("baudrate",rate);
  11605. }
  11606. void SerialScaleConfWidget::updateParity(int index)
  11607. {
  11608. updateAttribute("parity",parity->itemData(index).toString());
  11609. }
  11610. void SerialScaleConfWidget::updateFlowControl(int index)
  11611. {
  11612. updateAttribute("flowcontrol",flow->itemData(index).toString());
  11613. }
  11614. void SerialScaleConfWidget::updateStopBits(int index)
  11615. {
  11616. updateAttribute("stopbits",stop->itemData(index).toString());
  11617. }
  11618. /*:957*/
  11619. #line 609 "./typica.w"
  11620. /*969:*/
  11621. #line 195 "./valueannotation.w"
  11622. void ValueAnnotation::newMeasurement(Measurement measure)
  11623. {
  11624. for(int i= 0;i<values.size();i++)
  11625. {
  11626. if(measure.temperature()> values.at(i)-tolerance&&
  11627. measure.temperature()<values.at(i)+tolerance)
  11628. {
  11629. if(i!=lastIndex)
  11630. {
  11631. lastIndex= i;
  11632. emit annotation(annotations.at(i),measurementColumn,annotationColumn);
  11633. }
  11634. }
  11635. }
  11636. }
  11637. /*:969*//*970:*/
  11638. #line 216 "./valueannotation.w"
  11639. void ValueAnnotation::annotate()
  11640. {
  11641. if(lastIndex> -1)
  11642. {
  11643. emit annotation(annotations.at(lastIndex),measurementColumn,annotationColumn);
  11644. }
  11645. }
  11646. /*:970*//*971:*/
  11647. #line 228 "./valueannotation.w"
  11648. void ValueAnnotation::setAnnotation(double value,const QString&annotation)
  11649. {
  11650. values.append(value);
  11651. annotations.append(annotation);
  11652. }
  11653. /*:971*//*972:*/
  11654. #line 237 "./valueannotation.w"
  11655. void ValueAnnotation::setAnnotationColumn(int column)
  11656. {
  11657. annotationColumn= column;
  11658. }
  11659. void ValueAnnotation::setTemperatureColumn(int column)
  11660. {
  11661. measurementColumn= column;
  11662. }
  11663. void ValueAnnotation::setTolerance(double epsilon)
  11664. {
  11665. tolerance= epsilon;
  11666. }
  11667. /*:972*//*973:*/
  11668. #line 255 "./valueannotation.w"
  11669. ValueAnnotation::ValueAnnotation():QObject(),
  11670. lastIndex(-1),annotationColumn(2),measurementColumn(1),tolerance(0.05)
  11671. {
  11672. }
  11673. /*:973*/
  11674. #line 610 "./typica.w"
  11675. /*961:*/
  11676. #line 33 "./valueannotation.w"
  11677. ValueAnnotationConfWidget::ValueAnnotationConfWidget(DeviceTreeModel*model,
  11678. const QModelIndex&index)
  11679. :BasicDeviceConfigurationWidget(model,index),
  11680. tablemodel(new SaltModel(2))
  11681. {
  11682. QFormLayout*layout= new QFormLayout;
  11683. QLineEdit*source= new QLineEdit;
  11684. layout->addRow(tr("Source column name:"),source);
  11685. QCheckBox*noteOnStart= new QCheckBox(tr("Produce Start State Annotation"));
  11686. noteOnStart->setChecked(true);
  11687. layout->addRow(noteOnStart);
  11688. tablemodel->setHeaderData(0,Qt::Horizontal,"Value");
  11689. tablemodel->setHeaderData(1,Qt::Horizontal,"Annotation");
  11690. QTableView*annotationTable= new QTableView;
  11691. annotationTable->setModel(tablemodel);
  11692. NumericDelegate*delegate= new NumericDelegate;
  11693. annotationTable->setItemDelegateForColumn(0,delegate);
  11694. layout->addRow(tr("Annotations for values:"),annotationTable);
  11695. /*749:*/
  11696. #line 15632 "./typica.w"
  11697. QDomElement referenceElement=
  11698. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11699. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11700. QDomElement node;
  11701. /*:749*/
  11702. #line 52 "./valueannotation.w"
  11703. for(int i= 0;i<configData.size();i++)
  11704. {
  11705. node= configData.at(i).toElement();
  11706. if(node.attribute("name")=="source")
  11707. {
  11708. source->setText(node.attribute("value"));
  11709. }
  11710. else if(node.attribute("name")=="emitOnStart")
  11711. {
  11712. noteOnStart->setChecked(node.attribute("value")=="true"?true:false);
  11713. }
  11714. else if(node.attribute("name")=="measuredValues")
  11715. {
  11716. /*873:*/
  11717. #line 18666 "./typica.w"
  11718. QString data= node.attribute("value");
  11719. if(data.length()> 3)
  11720. {
  11721. data.chop(2);
  11722. data= data.remove(0,2);
  11723. }
  11724. QStringList itemList= data.split(",");
  11725. /*:873*/
  11726. #line 66 "./valueannotation.w"
  11727. int column= 0;
  11728. /*874:*/
  11729. #line 18678 "./typica.w"
  11730. for(int i= 0;i<itemList.size();i++)
  11731. {
  11732. tablemodel->setData(tablemodel->index(i,column),
  11733. QVariant(itemList.at(i).toDouble()),
  11734. Qt::DisplayRole);
  11735. }
  11736. /*:874*/
  11737. #line 68 "./valueannotation.w"
  11738. }
  11739. else if(node.attribute("name")=="annotations")
  11740. {
  11741. /*962:*/
  11742. #line 89 "./valueannotation.w"
  11743. QString data= node.attribute("value");
  11744. if(data.length()> 3)
  11745. {
  11746. data.chop(2);
  11747. data= data.remove(0,2);
  11748. }
  11749. QStringList itemList= data.split(",");
  11750. for(int i= 0;i<itemList.size();i++)
  11751. {
  11752. itemList[i]= itemList[i].simplified();
  11753. }
  11754. /*:962*/
  11755. #line 72 "./valueannotation.w"
  11756. int column= 1;
  11757. /*963:*/
  11758. #line 104 "./valueannotation.w"
  11759. for(int i= 0;i<itemList.size();i++)
  11760. {
  11761. tablemodel->setData(tablemodel->index(i,column),
  11762. QVariant(itemList.at(i)),
  11763. Qt::DisplayRole);
  11764. }
  11765. /*:963*/
  11766. #line 74 "./valueannotation.w"
  11767. }
  11768. }
  11769. updateSourceColumn(source->text());
  11770. updateStart(noteOnStart->isChecked());
  11771. updateAnnotations();
  11772. connect(source,SIGNAL(textEdited(QString)),this,SLOT(updateSourceColumn(QString)));
  11773. connect(noteOnStart,SIGNAL(toggled(bool)),this,SLOT(updateStart(bool)));
  11774. connect(tablemodel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(updateAnnotations()));
  11775. setLayout(layout);
  11776. }
  11777. /*:961*//*964:*/
  11778. #line 115 "./valueannotation.w"
  11779. void ValueAnnotationConfWidget::updateAnnotations()
  11780. {
  11781. updateAttribute("measuredValues",tablemodel->arrayLiteral(0,Qt::DisplayRole));
  11782. updateAttribute("annotations",tablemodel->arrayLiteral(1,Qt::DisplayRole));
  11783. }
  11784. /*:964*//*965:*/
  11785. #line 125 "./valueannotation.w"
  11786. void ValueAnnotationConfWidget::updateSourceColumn(const QString&source)
  11787. {
  11788. updateAttribute("source",source);
  11789. }
  11790. void ValueAnnotationConfWidget::updateStart(bool noteOnStart)
  11791. {
  11792. updateAttribute("emitOnStart",noteOnStart?"true":"false");
  11793. }
  11794. /*:965*/
  11795. #line 611 "./typica.w"
  11796. /*:4*//*865:*/
  11797. #line 639 "./unsupportedserial.w"
  11798. /*840:*/
  11799. #line 58 "./unsupportedserial.w"
  11800. UnsupportedSerialDeviceConfWidget::UnsupportedSerialDeviceConfWidget(DeviceTreeModel*model,
  11801. const QModelIndex&index)
  11802. :BasicDeviceConfigurationWidget(model,index),
  11803. deviceSettingsModel(new SaltModel(2)),
  11804. scriptEditor(new QTextEdit)
  11805. {
  11806. scriptEditor->setTabStopWidth(20);
  11807. QVBoxLayout*dummyLayout= new QVBoxLayout;
  11808. QTabWidget*central= new QTabWidget;
  11809. QWidget*deviceConfigurationWidget= new QWidget;
  11810. QVBoxLayout*deviceConfigurationLayout= new QVBoxLayout;
  11811. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  11812. deviceConfigurationLayout->addWidget(addChannelButton);
  11813. connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
  11814. QLabel*deviceSettingsLabel= new QLabel(tr("Device Settings:"));
  11815. deviceConfigurationLayout->addWidget(deviceSettingsLabel);
  11816. QTableView*deviceSettingsView= new QTableView;
  11817. deviceSettingsModel->setHeaderData(0,Qt::Horizontal,tr("Key"));
  11818. deviceSettingsModel->setHeaderData(1,Qt::Horizontal,tr("Value"));
  11819. deviceSettingsView->setModel(deviceSettingsModel);
  11820. deviceConfigurationLayout->addWidget(deviceSettingsView);
  11821. deviceConfigurationWidget->setLayout(deviceConfigurationLayout);
  11822. central->addTab(deviceConfigurationWidget,tr("Configuration"));
  11823. central->addTab(scriptEditor,tr("Script"));
  11824. dummyLayout->addWidget(central);
  11825. /*749:*/
  11826. #line 15632 "./typica.w"
  11827. QDomElement referenceElement=
  11828. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11829. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11830. QDomElement node;
  11831. /*:749*/
  11832. #line 86 "./unsupportedserial.w"
  11833. for(int i= 0;i<configData.size();i++)
  11834. {
  11835. node= configData.at(i).toElement();
  11836. if(node.attribute("name")=="keys"||node.attribute("name")=="values")
  11837. {
  11838. int column= 0;
  11839. if(node.attribute("name")=="values")
  11840. {
  11841. column= 1;
  11842. }
  11843. QString data= node.attribute("value");
  11844. if(data.length()> 3)
  11845. {
  11846. data.chop(2);
  11847. data= data.remove(0,2);
  11848. }
  11849. QStringList keyList= data.split(", ");
  11850. for(int j= 0;j<keyList.size();j++)
  11851. {
  11852. deviceSettingsModel->setData(deviceSettingsModel->index(j,column),
  11853. QVariant(keyList.at(j)),
  11854. Qt::EditRole);
  11855. }
  11856. }
  11857. else if(node.attribute("name")=="script")
  11858. {
  11859. scriptEditor->setPlainText(node.attribute("value"));
  11860. }
  11861. }
  11862. connect(deviceSettingsModel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),
  11863. this,SLOT(updateConfiguration()));
  11864. connect(scriptEditor,SIGNAL(textChanged()),this,SLOT(saveScript()));
  11865. setLayout(dummyLayout);
  11866. }
  11867. /*:840*//*841:*/
  11868. #line 131 "./unsupportedserial.w"
  11869. void UnsupportedSerialDeviceConfWidget::updateConfiguration()
  11870. {
  11871. updateAttribute("keys",deviceSettingsModel->arrayLiteral(0,Qt::DisplayRole));
  11872. updateAttribute("values",deviceSettingsModel->arrayLiteral(1,Qt::DisplayRole));
  11873. }
  11874. /*:841*//*842:*/
  11875. #line 144 "./unsupportedserial.w"
  11876. void UnsupportedSerialDeviceConfWidget::saveScript()
  11877. {
  11878. updateAttribute("script",scriptEditor->toPlainText());
  11879. }
  11880. /*:842*//*843:*/
  11881. #line 155 "./unsupportedserial.w"
  11882. void UnsupportedSerialDeviceConfWidget::addChannel()
  11883. {
  11884. insertChildNode(tr("Channel"),"unsupporteddevicechannel");
  11885. }
  11886. /*:843*//*845:*/
  11887. #line 183 "./unsupportedserial.w"
  11888. UnsupportedDeviceChannelConfWidget::UnsupportedDeviceChannelConfWidget(DeviceTreeModel*model,
  11889. const QModelIndex&index)
  11890. :BasicDeviceConfigurationWidget(model,index),
  11891. channelSettingsModel(new SaltModel(2))
  11892. {
  11893. QFormLayout*layout= new QFormLayout;
  11894. QLineEdit*columnName= new QLineEdit;
  11895. layout->addRow(tr("Column Name:"),columnName);
  11896. QCheckBox*hideSeries= new QCheckBox("Hide this channel");
  11897. layout->addRow(hideSeries);
  11898. QTableView*channelSettings= new QTableView;
  11899. channelSettingsModel->setHeaderData(0,Qt::Horizontal,"Key");
  11900. channelSettingsModel->setHeaderData(1,Qt::Horizontal,"Value");
  11901. channelSettings->setModel(channelSettingsModel);
  11902. layout->addRow(channelSettings);
  11903. setLayout(layout);
  11904. /*749:*/
  11905. #line 15632 "./typica.w"
  11906. QDomElement referenceElement=
  11907. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11908. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11909. QDomElement node;
  11910. /*:749*/
  11911. #line 200 "./unsupportedserial.w"
  11912. for(int i= 0;i<configData.size();i++)
  11913. {
  11914. node= configData.at(i).toElement();
  11915. if(node.attribute("name")=="columnname")
  11916. {
  11917. columnName->setText(node.attribute("value"));
  11918. }
  11919. else if(node.attribute("name")=="hidden")
  11920. {
  11921. hideSeries->setChecked(node.attribute("value")=="true");
  11922. }
  11923. else if(node.attribute("name")=="keys"||node.attribute("name")=="values")
  11924. {
  11925. int column= 0;
  11926. if(node.attribute("name")=="values")
  11927. {
  11928. column= 1;
  11929. }
  11930. QString data= node.attribute("value");
  11931. if(data.length()> 3)
  11932. {
  11933. data.chop(2);
  11934. data= data.remove(0,2);
  11935. }
  11936. QStringList keyList= data.split(", ");
  11937. for(int j= 0;j<keyList.size();j++)
  11938. {
  11939. channelSettingsModel->setData(channelSettingsModel->index(j,column),
  11940. QVariant(keyList.at(j)),
  11941. Qt::EditRole);
  11942. }
  11943. }
  11944. }
  11945. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  11946. connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  11947. connect(channelSettingsModel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),
  11948. this,SLOT(updateConfiguration()));
  11949. }
  11950. /*:845*//*846:*/
  11951. #line 244 "./unsupportedserial.w"
  11952. void UnsupportedDeviceChannelConfWidget::updateColumnName(const QString&value)
  11953. {
  11954. updateAttribute("columnname",value);
  11955. }
  11956. void UnsupportedDeviceChannelConfWidget::updateHidden(bool hidden)
  11957. {
  11958. updateAttribute("hidden",hidden?"true":"false");
  11959. }
  11960. void UnsupportedDeviceChannelConfWidget::updateConfiguration()
  11961. {
  11962. updateAttribute("keys",channelSettingsModel->arrayLiteral(0,Qt::DisplayRole));
  11963. updateAttribute("values",channelSettingsModel->arrayLiteral(1,Qt::DisplayRole));
  11964. }
  11965. /*:846*/
  11966. #line 640 "./unsupportedserial.w"
  11967. /*853:*/
  11968. #line 371 "./unsupportedserial.w"
  11969. void JavaScriptDevice::start()
  11970. {
  11971. QScriptValue object= scriptengine->newQObject(this);
  11972. /*854:*/
  11973. #line 390 "./unsupportedserial.w"
  11974. QScriptValue settingsObject= scriptengine->newObject();
  11975. QVariantMap::const_iterator i= deviceSettings.constBegin();
  11976. while(i!=deviceSettings.constEnd())
  11977. {
  11978. settingsObject.setProperty(i.key(),i.value().toString());
  11979. i++;
  11980. }
  11981. object.setProperty("settings",settingsObject);
  11982. /*:854*/
  11983. #line 375 "./unsupportedserial.w"
  11984. /*855:*/
  11985. #line 405 "./unsupportedserial.w"
  11986. QScriptValue channelsArray= scriptengine->newArray(channelCount());
  11987. for(int i= 0;i<channelCount();i++)
  11988. {
  11989. QScriptValue channelObject= scriptengine->newQObject(getChannel(i));
  11990. QScriptValue channelSettingsObject= scriptengine->newObject();
  11991. QVariantMap::const_iterator j= channelSettings.at(i).constBegin();
  11992. while(j!=channelSettings.at(i).constEnd())
  11993. {
  11994. channelSettingsObject.setProperty(j.key(),j.value().toString());
  11995. j++;
  11996. }
  11997. channelObject.setProperty("settings",channelSettingsObject);
  11998. channelsArray.setProperty(i,channelObject);
  11999. }
  12000. object.setProperty("channels",channelsArray);
  12001. /*:855*/
  12002. #line 376 "./unsupportedserial.w"
  12003. QScriptContext*context= scriptengine->currentContext();
  12004. QScriptValue oldThis= context->thisObject();
  12005. context->setThisObject(object);
  12006. QScriptValue result= scriptengine->evaluate(deviceScript);
  12007. QScriptEngine*engine= scriptengine;
  12008. /*170:*/
  12009. #line 3943 "./typica.w"
  12010. if(engine->hasUncaughtException())
  12011. {
  12012. int line= engine->uncaughtExceptionLineNumber();
  12013. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  12014. result.toString();
  12015. QString trace;
  12016. foreach(trace,engine->uncaughtExceptionBacktrace())
  12017. {
  12018. qDebug()<<trace;
  12019. }
  12020. }
  12021. /*:170*/
  12022. #line 382 "./unsupportedserial.w"
  12023. context->setThisObject(oldThis);
  12024. }
  12025. /*:853*//*858:*/
  12026. #line 446 "./unsupportedserial.w"
  12027. void JavaScriptDevice::stop()
  12028. {
  12029. emit deviceStopRequested();
  12030. }
  12031. /*:858*//*859:*/
  12032. #line 459 "./unsupportedserial.w"
  12033. JavaScriptDevice::JavaScriptDevice(const QModelIndex&index,
  12034. QScriptEngine*engine):
  12035. QObject(NULL),scriptengine(engine)
  12036. {
  12037. DeviceTreeModel*model= (DeviceTreeModel*)(index.model());
  12038. QDomElement deviceReferenceElement=
  12039. model->referenceElement(model->data(index,Qt::UserRole).toString());
  12040. QDomNodeList deviceConfigData= deviceReferenceElement.elementsByTagName("attribute");
  12041. QDomElement node;
  12042. QStringList deviceKeys;
  12043. QStringList deviceValues;
  12044. for(int i= 0;i<deviceConfigData.size();i++)
  12045. {
  12046. node= deviceConfigData.at(i).toElement();
  12047. if(node.attribute("name")=="keys")
  12048. {
  12049. QString data= node.attribute("value");
  12050. if(data.length()> 3)
  12051. {
  12052. data.chop(2);
  12053. data= data.remove(0,2);
  12054. }
  12055. deviceKeys= data.split(", ");
  12056. }
  12057. else if(node.attribute("name")=="values")
  12058. {
  12059. QString data= node.attribute("value");
  12060. if(data.length()> 3)
  12061. {
  12062. data.chop(2);
  12063. data= data.remove(0,2);
  12064. }
  12065. deviceValues= data.split(", ");
  12066. }
  12067. else if(node.attribute("name")=="script")
  12068. {
  12069. deviceScript= node.attribute("value");
  12070. }
  12071. deviceSettings.insert(node.attribute("name"),node.attribute("value"));
  12072. }
  12073. for(int i= 0;i<qMin(deviceKeys.length(),deviceValues.length());i++)
  12074. {
  12075. deviceSettings.insert(deviceKeys[i],deviceValues[i]);
  12076. }
  12077. if(model->hasChildren(index))
  12078. {
  12079. for(int i= 0;i<model->rowCount(index);i++)
  12080. {
  12081. QModelIndex channelIndex= model->index(i,0,index);
  12082. QDomElement channelReference= model->referenceElement(model->data(channelIndex,32).toString());
  12083. channelList.append(new Channel);
  12084. QDomElement channelReferenceElement=
  12085. model->referenceElement(model->data(channelIndex,Qt::UserRole).toString());
  12086. QDomNodeList channelConfigData=
  12087. channelReferenceElement.elementsByTagName("attribute");
  12088. QStringList channelKeys;
  12089. QStringList channelValues;
  12090. for(int j= 0;j<channelConfigData.size();j++)
  12091. {
  12092. node= channelConfigData.at(j).toElement();
  12093. if(node.attribute("name")=="keys")
  12094. {
  12095. QString data= node.attribute("value");
  12096. if(data.length()> 3)
  12097. {
  12098. data.chop(2);
  12099. data= data.remove(0,2);
  12100. }
  12101. channelKeys= data.split(", ");
  12102. }
  12103. else if(node.attribute("name")=="values")
  12104. {
  12105. QString data= node.attribute("value");
  12106. if(data.length()> 3)
  12107. {
  12108. data.chop(2);
  12109. data= data.remove(0,2);
  12110. }
  12111. channelValues= data.split(", ");
  12112. }
  12113. else if(node.attribute("name")=="hidden")
  12114. {
  12115. hiddenState.append(node.attribute("value")=="true");
  12116. }
  12117. else if(node.attribute("name")=="columnname")
  12118. {
  12119. columnNames.append(node.attribute("value"));
  12120. }
  12121. }
  12122. QVariantMap cs;
  12123. for(int j= 0;j<qMin(channelKeys.length(),channelValues.length());j++)
  12124. {
  12125. cs.insert(channelKeys[j],channelValues[j]);
  12126. }
  12127. channelSettings.append(cs);
  12128. indicatorTexts.append(model->data(channelIndex,Qt::DisplayRole).toString());
  12129. channelUnits.append(Units::Fahrenheit);
  12130. }
  12131. }
  12132. }
  12133. /*:859*//*860:*/
  12134. #line 564 "./unsupportedserial.w"
  12135. int JavaScriptDevice::channelCount()
  12136. {
  12137. return channelList.length();
  12138. }
  12139. Channel*JavaScriptDevice::getChannel(int channel)
  12140. {
  12141. return channelList.at(channel);
  12142. }
  12143. bool JavaScriptDevice::isChannelHidden(int channel)
  12144. {
  12145. return hiddenState.at(channel);
  12146. }
  12147. Units::Unit JavaScriptDevice::expectedChannelUnit(int channel)
  12148. {
  12149. return channelUnits.at(channel);
  12150. }
  12151. QString JavaScriptDevice::channelColumnName(int channel)
  12152. {
  12153. if(channel>=0&&channel<columnNames.length())
  12154. {
  12155. return columnNames.at(channel);
  12156. }
  12157. return QString();
  12158. }
  12159. QString JavaScriptDevice::channelIndicatorText(int channel)
  12160. {
  12161. return indicatorTexts.at(channel);
  12162. }
  12163. /*:860*//*861:*/
  12164. #line 601 "./unsupportedserial.w"
  12165. void JavaScriptDevice::setTemperatureColumn(int tcol)
  12166. {
  12167. annotationTemperatureColumn= tcol;
  12168. }
  12169. void JavaScriptDevice::setAnnotationColumn(int ncol)
  12170. {
  12171. annotationNoteColumn= ncol;
  12172. }
  12173. /*:861*/
  12174. #line 641 "./unsupportedserial.w"
  12175. /*:865*//*894:*/
  12176. #line 265 "./rate.w"
  12177. /*890:*/
  12178. #line 191 "./rate.w"
  12179. RateOfChangeConfWidget::RateOfChangeConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  12180. :BasicDeviceConfigurationWidget(model,index)
  12181. {
  12182. QFormLayout*layout= new QFormLayout;
  12183. QLineEdit*column= new QLineEdit;
  12184. layout->addRow(tr("Primary series column name:"),column);
  12185. QSpinBox*cacheTime= new QSpinBox;
  12186. cacheTime->setMinimum(0);
  12187. cacheTime->setMaximum(300);
  12188. layout->addRow(tr("Cache time:"),cacheTime);
  12189. QSpinBox*scaleTime= new QSpinBox;
  12190. scaleTime->setMinimum(1);
  12191. scaleTime->setMaximum(300);
  12192. layout->addRow(tr("Scale time:"),scaleTime);
  12193. /*749:*/
  12194. #line 15632 "./typica.w"
  12195. QDomElement referenceElement=
  12196. model->referenceElement(model->data(index,Qt::UserRole).toString());
  12197. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  12198. QDomElement node;
  12199. /*:749*/
  12200. #line 206 "./rate.w"
  12201. for(int i= 0;i<configData.size();i++)
  12202. {
  12203. node= configData.at(i).toElement();
  12204. if(node.attribute("name")=="column")
  12205. {
  12206. column->setText(node.attribute("value"));
  12207. }
  12208. else if(node.attribute("name")=="cache")
  12209. {
  12210. cacheTime->setValue(node.attribute("value").toInt());
  12211. }
  12212. else if(node.attribute("name")=="scale")
  12213. {
  12214. scaleTime->setValue(node.attribute("value").toInt());
  12215. }
  12216. }
  12217. updateColumn(column->text());
  12218. updateCacheTime(cacheTime->text());
  12219. updateScaleTime(scaleTime->text());
  12220. connect(column,SIGNAL(textEdited(QString)),this,SLOT(updateColumn(QString)));
  12221. connect(cacheTime,SIGNAL(valueChanged(QString)),this,SLOT(updateCacheTime(QString)));
  12222. connect(scaleTime,SIGNAL(valueChanged(QString)),this,SLOT(updateScaleTime(QString)));
  12223. setLayout(layout);
  12224. }
  12225. /*:890*//*891:*/
  12226. #line 235 "./rate.w"
  12227. void RateOfChangeConfWidget::updateColumn(const QString&column)
  12228. {
  12229. updateAttribute("column",column);
  12230. }
  12231. void RateOfChangeConfWidget::updateCacheTime(const QString&seconds)
  12232. {
  12233. updateAttribute("cache",seconds);
  12234. }
  12235. void RateOfChangeConfWidget::updateScaleTime(const QString&seconds)
  12236. {
  12237. updateAttribute("scale",seconds);
  12238. }
  12239. /*:891*/
  12240. #line 266 "./rate.w"
  12241. #line 18801 "./typica.w"
  12242. #line 1 "./dataqsdk.w"
  12243. /*:894*/
  12244. #line 529 "./typica.w"
  12245. /*8:*/
  12246. #line 671 "./typica.w"
  12247. template<class TYPE> TYPE getself(QScriptContext*context)
  12248. {
  12249. TYPE self= qobject_cast<TYPE> (context->thisObject().toQObject());
  12250. return self;
  12251. }
  12252. template<> QTime getself(QScriptContext*context)
  12253. {
  12254. QTime self= context->thisObject().toVariant().toTime();
  12255. return self;
  12256. }
  12257. template<> QByteArray getself(QScriptContext*context)
  12258. {
  12259. QByteArray self= context->thisObject().toVariant().toByteArray();
  12260. return self;
  12261. }
  12262. template<> SqlQueryConnection*getself(QScriptContext*context)
  12263. {
  12264. SqlQueryConnection*self=
  12265. (SqlQueryConnection*)qscriptvalue_cast<void*> (context->thisObject());
  12266. return self;
  12267. }
  12268. template<> QXmlQuery*getself(QScriptContext*context)
  12269. {
  12270. QXmlQuery*self=
  12271. (QXmlQuery*)qscriptvalue_cast<void*> (context->thisObject());
  12272. return self;
  12273. }
  12274. template<> QXmlStreamWriter*getself(QScriptContext*context)
  12275. {
  12276. QXmlStreamWriter*self=
  12277. (QXmlStreamWriter*)qscriptvalue_cast<void*> (context->thisObject());
  12278. return self;
  12279. }
  12280. template<> QXmlStreamReader*getself(QScriptContext*context)
  12281. {
  12282. QXmlStreamReader*self=
  12283. (QXmlStreamReader*)qscriptvalue_cast<void*> (context->thisObject());
  12284. return self;
  12285. }
  12286. /*:8*//*9:*/
  12287. #line 722 "./typica.w"
  12288. template<class TYPE> TYPE argument(int arg,QScriptContext*context)
  12289. {
  12290. TYPE argument= qobject_cast<TYPE> (context->argument(arg).toQObject());
  12291. return argument;
  12292. }
  12293. template<> QString argument(int arg,QScriptContext*context)
  12294. {
  12295. return context->argument(arg).toString();
  12296. }
  12297. template<> QVariant argument(int arg,QScriptContext*context)
  12298. {
  12299. return context->argument(arg).toVariant();
  12300. }
  12301. template<> int argument(int arg,QScriptContext*context)
  12302. {
  12303. return context->argument(arg).toInt32();
  12304. }
  12305. template<> SqlQueryConnection*argument(int arg,QScriptContext*context)
  12306. {
  12307. return(SqlQueryConnection*)
  12308. qscriptvalue_cast<void*> (context->argument(arg));
  12309. }
  12310. template<> QModelIndex argument(int arg,QScriptContext*context)
  12311. {
  12312. return qscriptvalue_cast<QModelIndex> (context->argument(arg));
  12313. }
  12314. template<> double argument(int arg,QScriptContext*context)
  12315. {
  12316. return(double)(context->argument(arg).toNumber());
  12317. }
  12318. template<> Units::Unit argument(int arg,QScriptContext*context)
  12319. {
  12320. return(Units::Unit)(context->argument(arg).toInt32());
  12321. }
  12322. template<> QByteArray argument(int arg,QScriptContext*context)
  12323. {
  12324. return qscriptvalue_cast<QByteArray> (context->argument(arg));
  12325. }
  12326. /*:9*//*13:*/
  12327. #line 814 "./typica.w"
  12328. void setQObjectProperties(QScriptValue,QScriptEngine*)
  12329. {
  12330. }
  12331. /*:13*//*15:*/
  12332. #line 828 "./typica.w"
  12333. void setQPaintDeviceProperties(QScriptValue,QScriptEngine*)
  12334. {
  12335. }
  12336. void setQLayoutItemProperties(QScriptValue,QScriptEngine*)
  12337. {
  12338. }
  12339. /*:15*//*18:*/
  12340. #line 867 "./typica.w"
  12341. QScriptValue constructQWidget(QScriptContext*,QScriptEngine*engine)
  12342. {
  12343. QScriptValue object= engine->newQObject(new QWidget);
  12344. setQWidgetProperties(object,engine);
  12345. return object;
  12346. }
  12347. void setQWidgetProperties(QScriptValue value,QScriptEngine*engine)
  12348. {
  12349. setQObjectProperties(value,engine);
  12350. setQPaintDeviceProperties(value,engine);
  12351. value.setProperty("setLayout",engine->newFunction(QWidget_setLayout));
  12352. value.setProperty("activateWindow",
  12353. engine->newFunction(QWidget_activateWindow));
  12354. }
  12355. /*:18*//*19:*/
  12356. #line 889 "./typica.w"
  12357. QScriptValue QWidget_setLayout(QScriptContext*context,QScriptEngine*)
  12358. {
  12359. if(context->argumentCount()==1)
  12360. {
  12361. QWidget*self= getself<QWidget*> (context);
  12362. QLayout*layout= argument<QLayout*> (0,context);
  12363. if(layout)
  12364. {
  12365. self->setLayout(layout);
  12366. }
  12367. else
  12368. {
  12369. context->throwError("Incorrect argument type passed to "
  12370. "QWidget::setLayout(). This method requires "
  12371. "a QLayout.");
  12372. }
  12373. }
  12374. else
  12375. {
  12376. context->throwError("Incorrect number of arguments passed to "
  12377. "QWidget::setLayout(). This method takes one "
  12378. "QLayout as an argument.");
  12379. }
  12380. return QScriptValue();
  12381. }
  12382. QScriptValue QWidget_activateWindow(QScriptContext*context,
  12383. QScriptEngine*)
  12384. {
  12385. QWidget*self= getself<QWidget*> (context);
  12386. self->activateWindow();
  12387. return QScriptValue();
  12388. }
  12389. /*:19*//*21:*/
  12390. #line 971 "./typica.w"
  12391. ScriptQMainWindow::ScriptQMainWindow():QMainWindow(NULL),
  12392. cprompt(tr("Closing this window may result in loss of data. Continue?"))
  12393. {
  12394. }
  12395. void ScriptQMainWindow::saveSizeAndPosition(const QString&key)
  12396. {
  12397. QSettings settings;
  12398. settings.beginGroup(key);
  12399. settings.setValue("pos",pos());
  12400. settings.setValue("size",size());
  12401. settings.endGroup();
  12402. }
  12403. void ScriptQMainWindow::restoreSizeAndPosition(const QString&key)
  12404. {
  12405. QSettings settings;
  12406. settings.beginGroup(key);
  12407. if(settings.contains("size"))
  12408. {
  12409. resize(settings.value("size").toSize());
  12410. }
  12411. if(settings.contains("pos"))
  12412. {
  12413. move(settings.value("pos").toPoint());
  12414. }
  12415. settings.endGroup();
  12416. }
  12417. void ScriptQMainWindow::displayStatus(const QString&message)
  12418. {
  12419. statusBar()->showMessage(message);
  12420. }
  12421. void ScriptQMainWindow::showEvent(QShowEvent*event)
  12422. {
  12423. if(!event->spontaneous())
  12424. {
  12425. /*26:*/
  12426. #line 1083 "./typica.w"
  12427. QSettings settings;
  12428. restoreGeometry(settings.value(QString("geometries/%1").arg(objectName())).
  12429. toByteArray());
  12430. /*:26*/
  12431. #line 1011 "./typica.w"
  12432. event->accept();
  12433. }
  12434. else
  12435. {
  12436. event->ignore();
  12437. }
  12438. }
  12439. void ScriptQMainWindow::show()
  12440. {
  12441. QMainWindow::show();
  12442. }
  12443. /*:21*//*22:*/
  12444. #line 1032 "./typica.w"
  12445. void ScriptQMainWindow::closeEvent(QCloseEvent*event)
  12446. {
  12447. if(isWindowModified()){
  12448. /*23:*/
  12449. #line 1046 "./typica.w"
  12450. QMessageBox::StandardButton result;
  12451. result= QMessageBox::warning(this,"Typica",closePrompt(),
  12452. QMessageBox::Ok|QMessageBox::Cancel);
  12453. if(result==QMessageBox::Cancel)
  12454. {
  12455. event->ignore();
  12456. return;
  12457. }
  12458. /*:23*/
  12459. #line 1036 "./typica.w"
  12460. }
  12461. emit aboutToClose();
  12462. /*25:*/
  12463. #line 1077 "./typica.w"
  12464. QSettings settings;
  12465. settings.setValue(QString("geometries/%1").arg(objectName()),saveGeometry());
  12466. /*:25*/
  12467. #line 1039 "./typica.w"
  12468. event->accept();
  12469. }
  12470. /*:22*//*24:*/
  12471. #line 1058 "./typica.w"
  12472. QString ScriptQMainWindow::closePrompt()
  12473. {
  12474. return cprompt;
  12475. }
  12476. void ScriptQMainWindow::setClosePrompt(QString prompt)
  12477. {
  12478. cprompt= prompt;
  12479. }
  12480. /*:24*//*29:*/
  12481. #line 1111 "./typica.w"
  12482. QScriptValue constructQMainWindow(QScriptContext*,QScriptEngine*engine)
  12483. {
  12484. QScriptValue object= engine->newQObject(new ScriptQMainWindow);
  12485. setQMainWindowProperties(object,engine);
  12486. return object;
  12487. }
  12488. void setQMainWindowProperties(QScriptValue value,QScriptEngine*engine)
  12489. {
  12490. setQWidgetProperties(value,engine);
  12491. value.setProperty("setCentralWidget",
  12492. engine->newFunction(QMainWindow_setCentralWidget));
  12493. value.setProperty("menuBar",engine->newFunction(QMainWindow_menuBar));
  12494. }
  12495. /*:29*//*30:*/
  12496. #line 1133 "./typica.w"
  12497. QScriptValue QMainWindow_setCentralWidget(QScriptContext*context,
  12498. QScriptEngine*)
  12499. {
  12500. if(context->argumentCount()==1)
  12501. {
  12502. QMainWindow*self= getself<QMainWindow*> (context);
  12503. QWidget*widget= argument<QWidget*> (0,context);
  12504. if(widget)
  12505. {
  12506. self->setCentralWidget(widget);
  12507. }
  12508. else
  12509. {
  12510. context->throwError("Incorrect argument type passed to "
  12511. "QMainWindow::setCentralWidget(). This "
  12512. "method requires a QWidget.");
  12513. }
  12514. }
  12515. else
  12516. {
  12517. context->throwError("Incorrect number of arguments passed to "
  12518. "QMainWindow::setCentralWidget(). This method "
  12519. "takes one QWidget as an argument.");
  12520. }
  12521. return QScriptValue();
  12522. }
  12523. /*:30*//*31:*/
  12524. #line 1167 "./typica.w"
  12525. QScriptValue QMainWindow_menuBar(QScriptContext*context,QScriptEngine*engine)
  12526. {
  12527. QScriptValue object;
  12528. if(context->argumentCount()==0)
  12529. {
  12530. QMainWindow*self= getself<QMainWindow*> (context);
  12531. QMenuBar*bar= self->menuBar();
  12532. object= engine->newQObject(bar);
  12533. setQMenuBarProperties(object,engine);
  12534. }
  12535. else
  12536. {
  12537. context->throwError("Incorrect number of arguments passed to "
  12538. "QMainWindow::menuBar(). This method takes no "
  12539. "arguments.");
  12540. }
  12541. return object;
  12542. }
  12543. /*:31*//*33:*/
  12544. #line 1197 "./typica.w"
  12545. void setQMenuBarProperties(QScriptValue value,QScriptEngine*engine)
  12546. {
  12547. setQWidgetProperties(value,engine);
  12548. value.setProperty("addMenu",engine->newFunction(QMenuBar_addMenu));
  12549. }
  12550. /*:33*//*34:*/
  12551. #line 1212 "./typica.w"
  12552. QScriptValue QMenuBar_addMenu(QScriptContext*context,QScriptEngine*engine)
  12553. {
  12554. QScriptValue object;
  12555. if(context->argumentCount()==1)
  12556. {
  12557. QMenuBar*self= getself<QMenuBar*> (context);
  12558. QString title= argument<QString> (0,context);
  12559. object= engine->newQObject(self->addMenu(title));
  12560. setQMenuProperties(object,engine);
  12561. }
  12562. else
  12563. {
  12564. context->throwError("Incorrect number of arguments passed to "
  12565. "QMenuBar::addMenu(). This method takes one "
  12566. "string as an argument.");
  12567. }
  12568. return object;
  12569. }
  12570. /*:34*//*36:*/
  12571. #line 1242 "./typica.w"
  12572. void setQMenuProperties(QScriptValue value,QScriptEngine*engine)
  12573. {
  12574. setQWidgetProperties(value,engine);
  12575. value.setProperty("addAction",engine->newFunction(QMenu_addAction));
  12576. value.setProperty("addSeparator",engine->newFunction(QMenu_addSeparator));
  12577. }
  12578. /*:36*//*37:*/
  12579. #line 1252 "./typica.w"
  12580. QScriptValue QMenu_addAction(QScriptContext*context,QScriptEngine*)
  12581. {
  12582. if(context->argumentCount()==1)
  12583. {
  12584. QMenu*self= getself<QMenu*> (context);
  12585. QAction*action= argument<QAction*> (0,context);
  12586. if(action)
  12587. {
  12588. self->addAction(action);
  12589. }
  12590. else
  12591. {
  12592. context->throwError("Incorrect argument type passed to "
  12593. "QMenu::addAction(). This method requires a "
  12594. "QAction.");
  12595. }
  12596. }
  12597. else
  12598. {
  12599. context->throwError("Incorrect number of arguments passed to "
  12600. "QMenu::addAction(). This method takes one "
  12601. "QAction as an argument.");
  12602. }
  12603. return QScriptValue();
  12604. }
  12605. QScriptValue QMenu_addSeparator(QScriptContext*context,QScriptEngine*)
  12606. {
  12607. if(context->argumentCount()==0)
  12608. {
  12609. QMenu*self= getself<QMenu*> (context);
  12610. self->addSeparator();
  12611. }
  12612. else
  12613. {
  12614. context->throwError("Incorrect number of arguments passed to "
  12615. "QMenu::addSeparator(). This method takes no "
  12616. "arguments.");
  12617. }
  12618. return QScriptValue();
  12619. }
  12620. /*:37*//*40:*/
  12621. #line 1314 "./typica.w"
  12622. QScriptValue constructQFrame(QScriptContext*,QScriptEngine*engine)
  12623. {
  12624. QScriptValue object= engine->newQObject(new QFrame);
  12625. setQFrameProperties(object,engine);
  12626. return object;
  12627. }
  12628. void setQFrameProperties(QScriptValue value,QScriptEngine*engine)
  12629. {
  12630. setQWidgetProperties(value,engine);
  12631. }
  12632. /*:40*//*43:*/
  12633. #line 1348 "./typica.w"
  12634. QScriptValue constructQLabel(QScriptContext*context,QScriptEngine*engine)
  12635. {
  12636. QString text;
  12637. if(context->argumentCount()==1)
  12638. {
  12639. text= argument<QString> (0,context);
  12640. }
  12641. QScriptValue object= engine->newQObject(new QLabel(text));
  12642. setQLabelProperties(object,engine);
  12643. return object;
  12644. }
  12645. void setQLabelProperties(QScriptValue value,QScriptEngine*engine)
  12646. {
  12647. setQFrameProperties(value,engine);
  12648. }
  12649. /*:43*//*46:*/
  12650. #line 1385 "./typica.w"
  12651. QScriptValue constructQLineEdit(QScriptContext*,QScriptEngine*engine)
  12652. {
  12653. QScriptValue object= engine->newQObject(new QLineEdit());
  12654. setQLineEditProperties(object,engine);
  12655. return object;
  12656. }
  12657. /*:46*//*47:*/
  12658. #line 1396 "./typica.w"
  12659. void setQLineEditProperties(QScriptValue value,QScriptEngine*engine)
  12660. {
  12661. setQWidgetProperties(value,engine);
  12662. }
  12663. /*:47*//*50:*/
  12664. #line 1432 "./typica.w"
  12665. QScriptValue constructQSplitter(QScriptContext*,QScriptEngine*engine)
  12666. {
  12667. QScriptValue object= engine->newQObject(new QSplitter);
  12668. setQSplitterProperties(object,engine);
  12669. return object;
  12670. }
  12671. void setQSplitterProperties(QScriptValue value,QScriptEngine*engine)
  12672. {
  12673. setQFrameProperties(value,engine);
  12674. value.setProperty("addWidget",engine->newFunction(QSplitter_addWidget));
  12675. value.setProperty("saveState",engine->newFunction(QSplitter_saveState));
  12676. value.setProperty("restoreState",
  12677. engine->newFunction(QSplitter_restoreState));
  12678. value.setProperty("count",engine->newFunction(QSplitter_count));
  12679. }
  12680. /*:50*//*51:*/
  12681. #line 1453 "./typica.w"
  12682. QScriptValue QSplitter_addWidget(QScriptContext*context,QScriptEngine*)
  12683. {
  12684. if(context->argumentCount()==1)
  12685. {
  12686. QSplitter*self= getself<QSplitter*> (context);
  12687. QWidget*widget= argument<QWidget*> (0,context);
  12688. if(widget)
  12689. {
  12690. self->addWidget(widget);
  12691. }
  12692. else
  12693. {
  12694. context->throwError("Incorrect argument type passed to "
  12695. "QSplitter::addWidget(). This method "
  12696. "requires a QWidget.");
  12697. }
  12698. }
  12699. else
  12700. {
  12701. context->throwError("Incorrect number of arguments passed to "
  12702. "QSplitter::addWidget(). This method takes one "
  12703. "QWidget as an argument.");
  12704. }
  12705. return QScriptValue();
  12706. }
  12707. /*:51*//*52:*/
  12708. #line 1490 "./typica.w"
  12709. QScriptValue QSplitter_count(QScriptContext*context,QScriptEngine*)
  12710. {
  12711. QSplitter*self= getself<QSplitter*> (context);
  12712. return QScriptValue(self->count());
  12713. }
  12714. /*:52*//*53:*/
  12715. #line 1503 "./typica.w"
  12716. QScriptValue QSplitter_saveState(QScriptContext*context,QScriptEngine*)
  12717. {
  12718. if(context->argumentCount()==1)
  12719. {
  12720. QSplitter*self= getself<QSplitter*> (context);
  12721. QString key= argument<QString> (0,context);
  12722. QSettings settings;
  12723. settings.setValue(key,self->saveState());
  12724. }
  12725. else
  12726. {
  12727. context->throwError("Incorrect number of arguments passed to "
  12728. "QSplitter::saveState(). This method takes one "
  12729. "string as an argument.");
  12730. }
  12731. return QScriptValue();
  12732. }
  12733. QScriptValue QSplitter_restoreState(QScriptContext*context,QScriptEngine*)
  12734. {
  12735. if(context->argumentCount()==1)
  12736. {
  12737. QSplitter*self= getself<QSplitter*> (context);
  12738. QString key= argument<QString> (0,context);
  12739. QSettings settings;
  12740. self->restoreState(settings.value(key).toByteArray());
  12741. }
  12742. else
  12743. {
  12744. context->throwError("Incorrect number of arguments passed to "
  12745. "QSplitter::restoreState(). This method takes "
  12746. "one string as an argument.");
  12747. }
  12748. return QScriptValue();
  12749. }
  12750. /*:53*//*55:*/
  12751. #line 1556 "./typica.w"
  12752. void setQLayoutProperties(QScriptValue value,QScriptEngine*engine)
  12753. {
  12754. setQLayoutItemProperties(value,engine);
  12755. value.setProperty("addWidget",engine->newFunction(QLayout_addWidget));
  12756. }
  12757. QScriptValue QLayout_addWidget(QScriptContext*context,QScriptEngine*)
  12758. {
  12759. if(context->argumentCount()==1)
  12760. {
  12761. QLayout*self= getself<QLayout*> (context);
  12762. QWidget*widget= argument<QWidget*> (0,context);
  12763. if(widget)
  12764. {
  12765. self->addWidget(widget);
  12766. }
  12767. else
  12768. {
  12769. context->throwError("Incorrect argument type passed to "
  12770. "QLayout::addWidget(). This method requires "
  12771. "a QWidget.");
  12772. }
  12773. }
  12774. else
  12775. {
  12776. context->throwError("Incorrect number of arguments passed to "
  12777. "QLayout::addWidget(). This method takes one "
  12778. "QWidget as an argument.");
  12779. }
  12780. return QScriptValue();
  12781. }
  12782. /*:55*//*58:*/
  12783. #line 1623 "./typica.w"
  12784. QScriptValue constructQBoxLayout(QScriptContext*,QScriptEngine*engine)
  12785. {
  12786. QScriptValue object=
  12787. engine->newQObject(new QBoxLayout(QBoxLayout::LeftToRight));
  12788. setQBoxLayoutProperties(object,engine);
  12789. return object;
  12790. }
  12791. void setQBoxLayoutProperties(QScriptValue value,QScriptEngine*engine)
  12792. {
  12793. setQLayoutProperties(value,engine);
  12794. value.setProperty("addLayout",engine->newFunction(QBoxLayout_addLayout));
  12795. value.setProperty("addWidget",engine->newFunction(QBoxLayout_addWidget));
  12796. }
  12797. QScriptValue QBoxLayout_addLayout(QScriptContext*context,QScriptEngine*)
  12798. {
  12799. if(context->argumentCount()> 0&&context->argumentCount()<3)
  12800. {
  12801. QBoxLayout*self= getself<QBoxLayout*> (context);
  12802. QLayout*layout= argument<QLayout*> (0,context);
  12803. int stretch= 0;
  12804. if(context->argumentCount()==2)
  12805. {
  12806. stretch= argument<int> (1,context);
  12807. }
  12808. if(layout)
  12809. {
  12810. self->addLayout(layout,stretch);
  12811. }
  12812. else
  12813. {
  12814. context->throwError("Incorrect argument type passed to "
  12815. "QLayout::addLayout(). This method requires "
  12816. "a QLayout.");
  12817. }
  12818. }
  12819. else
  12820. {
  12821. context->throwError("Incorrect number of arguments passed to "
  12822. "QLayout::addLayout(). This method takes one "
  12823. "QLayout as an argument and optionally one integer.");
  12824. }
  12825. return QScriptValue();
  12826. }
  12827. /*:58*//*59:*/
  12828. #line 1674 "./typica.w"
  12829. QScriptValue QBoxLayout_addWidget(QScriptContext*context,QScriptEngine*)
  12830. {
  12831. if(context->argumentCount()> 0&&context->argumentCount()<4)
  12832. {
  12833. QBoxLayout*self= getself<QBoxLayout*> (context);
  12834. QWidget*widget= argument<QWidget*> (0,context);
  12835. int stretch= 0;
  12836. Qt::Alignment alignment= 0;
  12837. if(context->argumentCount()> 1)
  12838. {
  12839. stretch= argument<int> (1,context);
  12840. }
  12841. if(context->argumentCount()> 2)
  12842. {
  12843. alignment= (Qt::Alignment)(argument<int> (2,context));
  12844. }
  12845. if(widget)
  12846. {
  12847. self->addWidget(widget,stretch,alignment);
  12848. }
  12849. else
  12850. {
  12851. context->throwError("Incorrect argument type passed to "
  12852. "QBoxLayout::addWidget(). This method requires "
  12853. "a QWidget.");
  12854. }
  12855. }
  12856. else
  12857. {
  12858. context->throwError("Incorrect number of arguments passed to "
  12859. "QBoxLayout::addWidget(). This method takes one "
  12860. "QWidget and optionally up to two integers as "
  12861. "arguments.");
  12862. }
  12863. return QScriptValue();
  12864. }
  12865. /*:59*//*62:*/
  12866. #line 1738 "./typica.w"
  12867. QScriptValue constructQAction(QScriptContext*,QScriptEngine*engine)
  12868. {
  12869. QScriptValue object= engine->newQObject(new QAction(NULL));
  12870. setQActionProperties(object,engine);
  12871. return object;
  12872. }
  12873. void setQActionProperties(QScriptValue value,QScriptEngine*engine)
  12874. {
  12875. setQObjectProperties(value,engine);
  12876. value.setProperty("setShortcut",engine->newFunction(QAction_setShortcut));
  12877. }
  12878. QScriptValue QAction_setShortcut(QScriptContext*context,QScriptEngine*)
  12879. {
  12880. if(context->argumentCount()==1)
  12881. {
  12882. QAction*self= getself<QAction*> (context);
  12883. self->setShortcut(argument<QString> (0,context));
  12884. }
  12885. else
  12886. {
  12887. context->throwError("Incorrect number of arguments passed to "
  12888. "QAction::setShortcut(). This method takes one "
  12889. "string as an argument.");
  12890. }
  12891. return QScriptValue();
  12892. }
  12893. /*:62*//*65:*/
  12894. #line 1796 "./typica.w"
  12895. QScriptValue QFileDialog_getOpenFileName(QScriptContext*context,
  12896. QScriptEngine*engine)
  12897. {
  12898. QScriptValue retval;
  12899. if(context->argumentCount()==3)
  12900. {
  12901. QWidget*widget= argument<QWidget*> (0,context);
  12902. if(widget)
  12903. {
  12904. QString caption= argument<QString> (1,context);
  12905. QString dir= argument<QString> (2,context);
  12906. retval= QScriptValue(engine,
  12907. QFileDialog::getOpenFileName(widget,caption,
  12908. dir,"",0,0));
  12909. setQFileDialogProperties(retval,engine);
  12910. }
  12911. else
  12912. {
  12913. context->throwError("Incorrect argument type passed to "
  12914. "QFileDialog::getOpenFileName(). The first "
  12915. "argument to this method must be a QWidget.");
  12916. }
  12917. }
  12918. else
  12919. {
  12920. context->throwError("Incorrect number of arguments passed to "
  12921. "QFileDialog::getOpenFileName(). This method "
  12922. "takes one QWidget followed by two strings for a "
  12923. "total of three arguments.");
  12924. }
  12925. return retval;
  12926. }
  12927. /*:65*//*66:*/
  12928. #line 1832 "./typica.w"
  12929. QScriptValue QFileDialog_getSaveFileName(QScriptContext*context,
  12930. QScriptEngine*engine)
  12931. {
  12932. QScriptValue retval;
  12933. if(context->argumentCount()==3)
  12934. {
  12935. QWidget*widget= argument<QWidget*> (0,context);
  12936. if(widget)
  12937. {
  12938. QString caption= argument<QString> (1,context);
  12939. QString dir= argument<QString> (2,context);
  12940. retval= QScriptValue(engine,
  12941. QFileDialog::getSaveFileName(widget,caption,
  12942. dir,"",0,0));
  12943. setQFileDialogProperties(retval,engine);
  12944. }
  12945. else
  12946. {
  12947. context->throwError("Incorrect argument type passed to "
  12948. "QFileDialog::getSaveFileName(). The first "
  12949. "argument to this method must be a QWidget.");
  12950. }
  12951. }
  12952. else
  12953. {
  12954. context->throwError("Incorrect number of arguments passed to "
  12955. "QFileDialog::getSaveFileName(). This method "
  12956. "takes one QWidget followed by two strings for a "
  12957. "total of three arguments.");
  12958. }
  12959. return retval;
  12960. }
  12961. /*:66*//*67:*/
  12962. #line 1869 "./typica.w"
  12963. void setQFileDialogProperties(QScriptValue value,QScriptEngine*engine)
  12964. {
  12965. setQDialogProperties(value,engine);
  12966. }
  12967. void setQDialogProperties(QScriptValue value,QScriptEngine*engine)
  12968. {
  12969. setQWidgetProperties(value,engine);
  12970. }
  12971. /*:67*//*70:*/
  12972. #line 1907 "./typica.w"
  12973. QScriptValue constructQFile(QScriptContext*context,QScriptEngine*engine)
  12974. {
  12975. QScriptValue object=
  12976. engine->newQObject(new QFile(argument<QString> (0,context)));
  12977. setQFileProperties(object,engine);
  12978. return object;
  12979. }
  12980. /*:70*//*71:*/
  12981. #line 1918 "./typica.w"
  12982. void setQFileProperties(QScriptValue value,QScriptEngine*engine)
  12983. {
  12984. setQIODeviceProperties(value,engine);
  12985. value.setProperty("remove",engine->newFunction(QFile_remove));
  12986. }
  12987. QScriptValue QFile_remove(QScriptContext*context,QScriptEngine*engine)
  12988. {
  12989. QFile*self= getself<QFile*> (context);
  12990. bool retval= self->remove();
  12991. return QScriptValue(engine,retval);
  12992. }
  12993. /*:71*//*72:*/
  12994. #line 1940 "./typica.w"
  12995. void setQIODeviceProperties(QScriptValue value,QScriptEngine*engine)
  12996. {
  12997. setQObjectProperties(value,engine);
  12998. value.setProperty("open",engine->newFunction(QIODevice_open));
  12999. value.setProperty("close",engine->newFunction(QIODevice_close));
  13000. value.setProperty("readToString",
  13001. engine->newFunction(QIODevice_readToString));
  13002. value.setProperty("putChar",engine->newFunction(QIODevice_putChar));
  13003. value.setProperty("writeString",engine->newFunction(QIODevice_writeString));
  13004. value.setProperty("writeBytes",engine->newFunction(QIODevice_writeBytes));
  13005. }
  13006. /*:72*//*73:*/
  13007. #line 1958 "./typica.w"
  13008. QScriptValue QIODevice_open(QScriptContext*context,QScriptEngine*)
  13009. {
  13010. QIODevice*self= getself<QIODevice*> (context);
  13011. bool retval= false;
  13012. if(context->argumentCount()==1)
  13013. {
  13014. switch(argument<int> (0,context))
  13015. {
  13016. case 1:
  13017. retval= self->open(QIODevice::ReadOnly);
  13018. break;
  13019. case 2:
  13020. retval= self->open(QIODevice::WriteOnly);
  13021. break;
  13022. case 3:
  13023. retval= self->open(QIODevice::ReadWrite);
  13024. break;
  13025. default:
  13026. break;
  13027. }
  13028. }
  13029. else
  13030. {
  13031. retval= self->open(QIODevice::ReadWrite);
  13032. }
  13033. return QScriptValue(retval);
  13034. }
  13035. QScriptValue QIODevice_close(QScriptContext*context,QScriptEngine*)
  13036. {
  13037. QIODevice*self= getself<QIODevice*> (context);
  13038. self->close();
  13039. return QScriptValue();
  13040. }
  13041. /*:73*//*74:*/
  13042. #line 1998 "./typica.w"
  13043. QScriptValue QIODevice_readToString(QScriptContext*context,QScriptEngine*)
  13044. {
  13045. QIODevice*self= getself<QIODevice*> (context);
  13046. self->reset();
  13047. return QScriptValue(QString(self->readAll()));
  13048. }
  13049. /*:74*//*75:*/
  13050. #line 2014 "./typica.w"
  13051. QScriptValue QIODevice_putChar(QScriptContext*context,QScriptEngine*)
  13052. {
  13053. QIODevice*self= getself<QIODevice*> (context);
  13054. if(context->argumentCount()==1)
  13055. {
  13056. return QScriptValue(self->putChar(argument<QString> (0,context).toUtf8().at(0)));
  13057. }
  13058. context->throwError("Incorrect number of arguments passed to "
  13059. "QIODevice::putChar()");
  13060. return QScriptValue();
  13061. }
  13062. /*:75*//*76:*/
  13063. #line 2032 "./typica.w"
  13064. QScriptValue QIODevice_writeString(QScriptContext*context,QScriptEngine*)
  13065. {
  13066. QIODevice*self= getself<QIODevice*> (context);
  13067. if(context->argumentCount()==1)
  13068. {
  13069. self->write(argument<QString> (0,context).toUtf8());
  13070. }
  13071. else
  13072. {
  13073. context->throwError("Incorrect number of arguments passed to "
  13074. "QIODevice::writeString()");
  13075. }
  13076. return QScriptValue();
  13077. }
  13078. QScriptValue QIODevice_writeBytes(QScriptContext*context,QScriptEngine*)
  13079. {
  13080. QIODevice*self= getself<QIODevice*> (context);
  13081. if(context->argumentCount()==1)
  13082. {
  13083. self->write(argument<QByteArray> (0,context));
  13084. }
  13085. else
  13086. {
  13087. context->throwError("Incorrect number of arguments passed to "
  13088. "QIODevice::writeBytes()");
  13089. }
  13090. return QScriptValue();
  13091. }
  13092. /*:76*//*79:*/
  13093. #line 2089 "./typica.w"
  13094. QScriptValue constructQProcess(QScriptContext*,QScriptEngine*engine)
  13095. {
  13096. QScriptValue object= engine->newQObject(new QProcess);
  13097. setQProcessProperties(object,engine);
  13098. return object;
  13099. }
  13100. /*:79*//*80:*/
  13101. #line 2100 "./typica.w"
  13102. void setQProcessProperties(QScriptValue value,QScriptEngine*engine)
  13103. {
  13104. setQIODeviceProperties(value,engine);
  13105. value.setProperty("execute",engine->newFunction(QProcess_execute));
  13106. value.setProperty("startDetached",engine->newFunction(QProcess_startDetached));
  13107. value.setProperty("setWorkingDirectory",engine->newFunction(QProcess_setWorkingDirectory));
  13108. value.setProperty("start",engine->newFunction(QProcess_start));
  13109. }
  13110. /*:80*//*81:*/
  13111. #line 2114 "./typica.w"
  13112. QScriptValue QProcess_execute(QScriptContext*context,QScriptEngine*)
  13113. {
  13114. QProcess*self= getself<QProcess*> (context);
  13115. QString program= argument<QString> (0,context);
  13116. QStringList arguments= QStringList();
  13117. if(context->argumentCount()> 1){
  13118. arguments= argument<QVariant> (1,context).toStringList();
  13119. }
  13120. int retval= self->execute(program,arguments);
  13121. return QScriptValue(retval);
  13122. }
  13123. /*:81*//*82:*/
  13124. #line 2129 "./typica.w"
  13125. QScriptValue QProcess_startDetached(QScriptContext*context,QScriptEngine*)
  13126. {
  13127. QProcess*self= getself<QProcess*> (context);
  13128. QString program= argument<QString> (0,context);
  13129. QStringList arguments= QStringList();
  13130. if(context->argumentCount()> 1){
  13131. arguments= argument<QVariant> (1,context).toStringList();
  13132. }
  13133. QString workingDirectory= "";
  13134. if(context->argumentCount()> 2){
  13135. workingDirectory= argument<QString> (2,context);
  13136. }
  13137. bool retval;
  13138. switch(context->argumentCount())
  13139. {
  13140. case 1:
  13141. retval= self->startDetached(program);
  13142. break;
  13143. case 2:
  13144. retval= self->startDetached(program,arguments);
  13145. break;
  13146. case 3:
  13147. retval= self->startDetached(program,arguments,workingDirectory);
  13148. break;
  13149. default:
  13150. retval= false;
  13151. }
  13152. return QScriptValue(retval);
  13153. }
  13154. /*:82*//*83:*/
  13155. #line 2162 "./typica.w"
  13156. QScriptValue QProcess_setWorkingDirectory(QScriptContext*context,QScriptEngine*)
  13157. {
  13158. QProcess*self= getself<QProcess*> (context);
  13159. QString directory= argument<QString> (0,context);
  13160. self->setWorkingDirectory(directory);
  13161. return QScriptValue();
  13162. }
  13163. /*:83*//*84:*/
  13164. #line 2174 "./typica.w"
  13165. QScriptValue QProcess_start(QScriptContext*context,QScriptEngine*)
  13166. {
  13167. QProcess*self= getself<QProcess*> (context);
  13168. QString program= argument<QString> (0,context);
  13169. QStringList arguments= QStringList();
  13170. if(context->argumentCount()> 1){
  13171. arguments= argument<QVariant> (1,context).toStringList();
  13172. }
  13173. self->start(program,arguments);
  13174. return QScriptValue();
  13175. }
  13176. /*:84*//*86:*/
  13177. #line 2200 "./typica.w"
  13178. QScriptValue QByteArray_toScriptValue(QScriptEngine*engine,const QByteArray&bytes)
  13179. {
  13180. QScriptValue object= engine->newVariant(QVariant(bytes));
  13181. setQByteArrayProperties(object,engine);
  13182. return object;
  13183. }
  13184. void QByteArray_fromScriptValue(const QScriptValue&value,QByteArray&bytes)
  13185. {
  13186. bytes= value.toVariant().toByteArray();
  13187. }
  13188. /*:86*//*88:*/
  13189. #line 2223 "./typica.w"
  13190. QScriptValue constructQByteArray(QScriptContext*,QScriptEngine*engine)
  13191. {
  13192. QScriptValue object= engine->toScriptValue<QByteArray> (QByteArray());
  13193. setQByteArrayProperties(object,engine);
  13194. return object;
  13195. }
  13196. /*:88*//*89:*/
  13197. #line 2234 "./typica.w"
  13198. void setQByteArrayProperties(QScriptValue value,QScriptEngine*engine)
  13199. {
  13200. value.setProperty("fromHex",engine->newFunction(QByteArray_fromHex));
  13201. }
  13202. /*:89*//*90:*/
  13203. #line 2243 "./typica.w"
  13204. QScriptValue QByteArray_fromHex(QScriptContext*context,QScriptEngine*engine)
  13205. {
  13206. QByteArray self= getself<QByteArray> (context);
  13207. QByteArray retval;
  13208. retval= self.fromHex(argument<QString> (0,context).toUtf8());
  13209. return engine->toScriptValue<QByteArray> (retval);
  13210. }
  13211. /*:90*//*93:*/
  13212. #line 2274 "./typica.w"
  13213. QScriptValue constructQBuffer(QScriptContext*context,QScriptEngine*engine)
  13214. {
  13215. QByteArray*array= new QByteArray(argument<QString> (0,context).toAscii());
  13216. QScriptValue object= engine->newQObject(new QBuffer(array));
  13217. setQBufferProperties(object,engine);
  13218. return object;
  13219. }
  13220. void setQBufferProperties(QScriptValue value,QScriptEngine*engine)
  13221. {
  13222. setQIODeviceProperties(value,engine);
  13223. value.setProperty("setData",engine->newFunction(QBuffer_setData));
  13224. }
  13225. QScriptValue QBuffer_setData(QScriptContext*context,QScriptEngine*)
  13226. {
  13227. QBuffer*self= getself<QBuffer*> (context);
  13228. self->setData(argument<QString> (0,context).toAscii());
  13229. return QScriptValue();
  13230. }
  13231. /*:93*//*96:*/
  13232. #line 2323 "./typica.w"
  13233. QScriptValue constructXQuery(QScriptContext*,QScriptEngine*engine)
  13234. {
  13235. QScriptValue object= engine->toScriptValue<void*> (new QXmlQuery);
  13236. setXQueryProperties(object,engine);
  13237. return object;
  13238. }
  13239. QScriptValue XQuery_invalidate(QScriptContext*context,QScriptEngine*)
  13240. {
  13241. QXmlQuery*self= getself<QXmlQuery*> (context);
  13242. delete self;
  13243. return QScriptValue();
  13244. }
  13245. void setXQueryProperties(QScriptValue value,QScriptEngine*engine)
  13246. {
  13247. value.setProperty("bind",engine->newFunction(XQuery_bind));
  13248. value.setProperty("exec",engine->newFunction(XQuery_exec));
  13249. value.setProperty("setQuery",engine->newFunction(XQuery_setQuery));
  13250. value.setProperty("invalidate",engine->newFunction(XQuery_invalidate));
  13251. }
  13252. /*:96*//*97:*/
  13253. #line 2349 "./typica.w"
  13254. QScriptValue XQuery_bind(QScriptContext*context,QScriptEngine*)
  13255. {
  13256. QXmlQuery*self= getself<QXmlQuery*> (context);
  13257. QIODevice*buffer= argument<QIODevice*> (1,context);
  13258. self->bindVariable(argument<QString> (0,context),buffer);
  13259. return QScriptValue();
  13260. }
  13261. /*:97*//*98:*/
  13262. #line 2360 "./typica.w"
  13263. QScriptValue XQuery_setQuery(QScriptContext*context,QScriptEngine*)
  13264. {
  13265. QXmlQuery*self= getself<QXmlQuery*> (context);
  13266. self->setQuery(argument<QString> (0,context));
  13267. return QScriptValue();
  13268. }
  13269. /*:98*//*99:*/
  13270. #line 2370 "./typica.w"
  13271. QScriptValue XQuery_exec(QScriptContext*context,QScriptEngine*)
  13272. {
  13273. QXmlQuery*self= getself<QXmlQuery*> (context);
  13274. QString result;
  13275. self->evaluateTo(&result);
  13276. return QScriptValue(result);
  13277. }
  13278. /*:99*//*102:*/
  13279. #line 2425 "./typica.w"
  13280. QScriptValue constructXmlWriter(QScriptContext*context,QScriptEngine*engine)
  13281. {
  13282. QXmlStreamWriter*retval;
  13283. if(context->argumentCount()==1)
  13284. {
  13285. retval= new QXmlStreamWriter(argument<QIODevice*> (0,context));
  13286. }
  13287. else
  13288. {
  13289. retval= new QXmlStreamWriter;
  13290. }
  13291. QScriptValue object= engine->toScriptValue<void*> (retval);
  13292. setXmlWriterProperties(object,engine);
  13293. return object;
  13294. }
  13295. void setXmlWriterProperties(QScriptValue value,QScriptEngine*engine)
  13296. {
  13297. value.setProperty("setDevice",engine->newFunction(XmlWriter_setDevice));
  13298. value.setProperty("writeAttribute",
  13299. engine->newFunction(XmlWriter_writeAttribute));
  13300. value.setProperty("writeCDATA",engine->newFunction(XmlWriter_writeCDATA));
  13301. value.setProperty("writeCharacters",
  13302. engine->newFunction(XmlWriter_writeCharacters));
  13303. value.setProperty("writeDTD",engine->newFunction(XmlWriter_writeDTD));
  13304. value.setProperty("writeEmptyElement",
  13305. engine->newFunction(XmlWriter_writeEmptyElement));
  13306. value.setProperty("writeEndDocument",
  13307. engine->newFunction(XmlWriter_writeEndDocument));
  13308. value.setProperty("writeEndElement",
  13309. engine->newFunction(XmlWriter_writeEndElement));
  13310. value.setProperty("writeEntityReference",
  13311. engine->newFunction(XmlWriter_writeEntityReference));
  13312. value.setProperty("writeProcessingInstruction",
  13313. engine->newFunction(XmlWriter_writeProcessingInstruction));
  13314. value.setProperty("writeStartDocument",
  13315. engine->newFunction(XmlWriter_writeStartDocument));
  13316. value.setProperty("writeStartElement",
  13317. engine->newFunction(XmlWriter_writeStartElement));
  13318. value.setProperty("writeTextElement",
  13319. engine->newFunction(XmlWriter_writeTextElement));
  13320. }
  13321. /*:102*//*103:*/
  13322. #line 2472 "./typica.w"
  13323. QScriptValue XmlWriter_setDevice(QScriptContext*context,QScriptEngine*)
  13324. {
  13325. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  13326. QIODevice*device= argument<QIODevice*> (0,context);
  13327. self->setDevice(device);
  13328. return QScriptValue();
  13329. }
  13330. /*:103*//*104:*/
  13331. #line 2486 "./typica.w"
  13332. QScriptValue XmlWriter_writeStartDocument(QScriptContext*context,
  13333. QScriptEngine*)
  13334. {
  13335. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  13336. self->writeStartDocument(argument<QString> (0,context));
  13337. return QScriptValue();
  13338. }
  13339. QScriptValue XmlWriter_writeEndDocument(QScriptContext*context,
  13340. QScriptEngine*)
  13341. {
  13342. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  13343. self->writeEndDocument();
  13344. return QScriptValue();
  13345. }
  13346. /*:104*//*105:*/
  13347. #line 2505 "./typica.w"
  13348. QScriptValue XmlWriter_writeDTD(QScriptContext*context,QScriptEngine*)
  13349. {
  13350. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  13351. self->writeDTD(argument<QString> (0,context));
  13352. return QScriptValue();
  13353. }
  13354. /*:105*//*106:*/
  13355. #line 2516 "./typica.w"
  13356. QScriptValue XmlWriter_writeStartElement(QScriptContext*context,
  13357. QScriptEngine*)
  13358. {
  13359. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  13360. self->writeStartElement(argument<QString> (0,context));
  13361. return QScriptValue();
  13362. }
  13363. QScriptValue XmlWriter_writeAttribute(QScriptContext*context,QScriptEngine*)
  13364. {
  13365. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  13366. self->writeAttribute(argument<QString> (0,context),
  13367. argument<QString> (1,context));
  13368. return QScriptValue();
  13369. }
  13370. QScriptValue XmlWriter_writeCharacters(QScriptContext*context,QScriptEngine*)
  13371. {
  13372. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  13373. self->writeCharacters(argument<QString> (0,context));
  13374. return QScriptValue();
  13375. }
  13376. QScriptValue XmlWriter_writeEndElement(QScriptContext*context,QScriptEngine*)
  13377. {
  13378. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  13379. self->writeEndElement();
  13380. return QScriptValue();
  13381. }
  13382. /*:106*//*107:*/
  13383. #line 2552 "./typica.w"
  13384. QScriptValue XmlWriter_writeEmptyElement(QScriptContext*context,
  13385. QScriptEngine*)
  13386. {
  13387. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  13388. self->writeEmptyElement(argument<QString> (0,context));
  13389. return QScriptValue();
  13390. }
  13391. QScriptValue XmlWriter_writeTextElement(QScriptContext*context,
  13392. QScriptEngine*)
  13393. {
  13394. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  13395. self->writeTextElement(argument<QString> (0,context),
  13396. argument<QString> (1,context));
  13397. return QScriptValue();
  13398. }
  13399. /*:107*//*108:*/
  13400. #line 2573 "./typica.w"
  13401. QScriptValue XmlWriter_writeCDATA(QScriptContext*context,QScriptEngine*)
  13402. {
  13403. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  13404. self->writeCDATA(argument<QString> (0,context));
  13405. return QScriptValue();
  13406. }
  13407. QScriptValue XmlWriter_writeEntityReference(QScriptContext*context,
  13408. QScriptEngine*)
  13409. {
  13410. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  13411. self->writeEntityReference(argument<QString> (0,context));
  13412. return QScriptValue();
  13413. }
  13414. QScriptValue XmlWriter_writeProcessingInstruction(QScriptContext*context,
  13415. QScriptEngine*)
  13416. {
  13417. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  13418. self->writeProcessingInstruction(argument<QString> (0,context),
  13419. argument<QString> (1,context));
  13420. return QScriptValue();
  13421. }
  13422. /*:108*//*111:*/
  13423. #line 2632 "./typica.w"
  13424. QScriptValue constructXmlReader(QScriptContext*context,QScriptEngine*engine)
  13425. {
  13426. QXmlStreamReader*retval=
  13427. new QXmlStreamReader(argument<QIODevice*> (0,context));
  13428. QScriptValue object= engine->toScriptValue<void*> (retval);
  13429. setXmlReaderProperties(object,engine);
  13430. return object;
  13431. }
  13432. void setXmlReaderProperties(QScriptValue value,QScriptEngine*engine)
  13433. {
  13434. value.setProperty("atEnd",engine->newFunction(XmlReader_atEnd));
  13435. value.setProperty("attribute",engine->newFunction(XmlReader_attribute));
  13436. value.setProperty("hasAttribute",
  13437. engine->newFunction(XmlReader_hasAttribute));
  13438. value.setProperty("isDTD",engine->newFunction(XmlReader_isDTD));
  13439. value.setProperty("isStartElement",
  13440. engine->newFunction(XmlReader_isStartElement));
  13441. value.setProperty("name",engine->newFunction(XmlReader_name));
  13442. value.setProperty("readElementText",
  13443. engine->newFunction(XmlReader_readElementText));
  13444. value.setProperty("readNext",
  13445. engine->newFunction(XmlReader_readNext));
  13446. value.setProperty("text",engine->newFunction(XmlReader_text));
  13447. }
  13448. /*:111*//*112:*/
  13449. #line 2662 "./typica.w"
  13450. QScriptValue XmlReader_attribute(QScriptContext*context,QScriptEngine*)
  13451. {
  13452. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  13453. QString retval=
  13454. self->attributes().value(argument<QString> (0,context)).toString();
  13455. return QScriptValue(retval);
  13456. }
  13457. QScriptValue XmlReader_hasAttribute(QScriptContext*context,QScriptEngine*)
  13458. {
  13459. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  13460. bool retval=
  13461. self->attributes().hasAttribute(argument<QString> (0,context));
  13462. return QScriptValue(retval);
  13463. }
  13464. /*:112*//*113:*/
  13465. #line 2682 "./typica.w"
  13466. QScriptValue XmlReader_atEnd(QScriptContext*context,QScriptEngine*)
  13467. {
  13468. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  13469. return QScriptValue(self->atEnd());
  13470. }
  13471. QScriptValue XmlReader_isDTD(QScriptContext*context,QScriptEngine*)
  13472. {
  13473. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  13474. return QScriptValue(self->isDTD());
  13475. }
  13476. QScriptValue XmlReader_isStartElement(QScriptContext*context,QScriptEngine*)
  13477. {
  13478. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  13479. return QScriptValue(self->isStartElement());
  13480. }
  13481. /*:113*//*114:*/
  13482. #line 2703 "./typica.w"
  13483. QScriptValue XmlReader_readNext(QScriptContext*context,QScriptEngine*)
  13484. {
  13485. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  13486. self->readNext();
  13487. return QScriptValue();
  13488. }
  13489. /*:114*//*115:*/
  13490. #line 2713 "./typica.w"
  13491. QScriptValue XmlReader_name(QScriptContext*context,QScriptEngine*)
  13492. {
  13493. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  13494. return QScriptValue(self->name().toString());
  13495. }
  13496. QScriptValue XmlReader_readElementText(QScriptContext*context,QScriptEngine*)
  13497. {
  13498. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  13499. return QScriptValue(self->readElementText());
  13500. }
  13501. QScriptValue XmlReader_text(QScriptContext*context,QScriptEngine*)
  13502. {
  13503. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  13504. return QScriptValue(self->text().toString());
  13505. }
  13506. /*:115*//*118:*/
  13507. #line 2755 "./typica.w"
  13508. void setQSettingsProperties(QScriptValue value,QScriptEngine*engine)
  13509. {
  13510. setQObjectProperties(value,engine);
  13511. value.setProperty("value",engine->newFunction(QSettings_value));
  13512. value.setProperty("setValue",engine->newFunction(QSettings_setValue));
  13513. }
  13514. /*:118*//*119:*/
  13515. #line 2767 "./typica.w"
  13516. QScriptValue QSettings_value(QScriptContext*context,QScriptEngine*engine)
  13517. {
  13518. QScriptValue object;
  13519. if(context->argumentCount()==1||context->argumentCount()==2)
  13520. {
  13521. QSettings settings;
  13522. QString key= argument<QString> (0,context);
  13523. QVariant value;
  13524. QVariant retval;
  13525. if(context->argumentCount()> 1)
  13526. {
  13527. value= argument<QVariant> (1,context);
  13528. retval= settings.value(key,value);
  13529. }
  13530. else
  13531. {
  13532. retval= settings.value(key);
  13533. }
  13534. object= engine->newVariant(retval);
  13535. }
  13536. else
  13537. {
  13538. context->throwError("Incorrect number of arguments passed to "
  13539. "QSettings::value(). This method takes one "
  13540. "string and one optional variant type.");
  13541. }
  13542. return object;
  13543. }
  13544. QScriptValue QSettings_setValue(QScriptContext*context,QScriptEngine*)
  13545. {
  13546. if(context->argumentCount()==2)
  13547. {
  13548. QSettings settings;
  13549. QString key= argument<QString> (0,context);
  13550. QVariant value= argument<QVariant> (1,context);
  13551. settings.setValue(key,value);
  13552. }
  13553. else
  13554. {
  13555. context->throwError("Incorrect number of arguments passed to "
  13556. "QSettings::setValue(). This method takes one "
  13557. "string and one variant type for a total of two "
  13558. "arguments.");
  13559. }
  13560. return QScriptValue();
  13561. }
  13562. /*:119*//*122:*/
  13563. #line 2836 "./typica.w"
  13564. QScriptValue constructQLCDNumber(QScriptContext*,QScriptEngine*engine)
  13565. {
  13566. QScriptValue object= engine->newQObject(new QLCDNumber());
  13567. setQLCDNumberProperties(object,engine);
  13568. return object;
  13569. }
  13570. void setQLCDNumberProperties(QScriptValue value,QScriptEngine*engine)
  13571. {
  13572. setQFrameProperties(value,engine);
  13573. }
  13574. /*:122*//*125:*/
  13575. #line 2894 "./typica.w"
  13576. QScriptValue constructQTime(QScriptContext*context,
  13577. QScriptEngine*engine)
  13578. {
  13579. QScriptValue object;
  13580. if(context->argumentCount()==0||
  13581. (context->argumentCount()>=2&&context->argumentCount()<=4))
  13582. {
  13583. int arg1= 0;
  13584. int arg2= 0;
  13585. int arg3= 0;
  13586. int arg4= 0;
  13587. switch(context->argumentCount())
  13588. {
  13589. case 4:
  13590. arg4= argument<int> (3,context);
  13591. case 3:
  13592. arg3= argument<int> (2,context);
  13593. case 2:
  13594. arg2= argument<int> (1,context);
  13595. arg1= argument<int> (0,context);
  13596. default:
  13597. break;
  13598. }
  13599. if(context->argumentCount())
  13600. {
  13601. object= engine->toScriptValue<QTime> (QTime(arg1,arg2,arg3,
  13602. arg4));
  13603. }
  13604. else
  13605. {
  13606. object= engine->toScriptValue<QTime> (QTime());
  13607. }
  13608. setQTimeProperties(object,engine);
  13609. }
  13610. else
  13611. {
  13612. context->throwError("Incorrect number of arguments passed to "
  13613. "QTime::QTime(). This method takes zero, two, "
  13614. "three, or four integer arguments.");
  13615. }
  13616. return object;
  13617. }
  13618. /*:125*//*126:*/
  13619. #line 2942 "./typica.w"
  13620. void setQTimeProperties(QScriptValue value,QScriptEngine*engine)
  13621. {
  13622. value.setProperty("addMSecs",engine->newFunction(QTime_addMSecs));
  13623. value.setProperty("addSecs",engine->newFunction(QTime_addSecs));
  13624. value.setProperty("elapsed",engine->newFunction(QTime_elapsed));
  13625. value.setProperty("hour",engine->newFunction(QTime_hour));
  13626. value.setProperty("isNull",engine->newFunction(QTime_isNull));
  13627. value.setProperty("isValid",engine->newFunction(QTime_isValid));
  13628. value.setProperty("minute",engine->newFunction(QTime_minute));
  13629. value.setProperty("msec",engine->newFunction(QTime_msec));
  13630. value.setProperty("msecsTo",engine->newFunction(QTime_msecsTo));
  13631. value.setProperty("restart",engine->newFunction(QTime_restart));
  13632. value.setProperty("second",engine->newFunction(QTime_second));
  13633. value.setProperty("secsTo",engine->newFunction(QTime_secsTo));
  13634. value.setProperty("setHMS",engine->newFunction(QTime_setHMS));
  13635. value.setProperty("start",engine->newFunction(QTime_start));
  13636. value.setProperty("toString",engine->newFunction(QTime_toString));
  13637. value.setProperty("currentTime",engine->newFunction(QTime_currentTime));
  13638. value.setProperty("fromString",engine->newFunction(QTime_fromString));
  13639. value.setProperty("valueOf",engine->newFunction(QTime_valueOf));
  13640. }
  13641. /*:126*//*127:*/
  13642. #line 2971 "./typica.w"
  13643. QScriptValue QTime_valueOf(QScriptContext*context,QScriptEngine*)
  13644. {
  13645. QTime self= getself<QTime> (context);
  13646. int retval= (self.hour()*60*60*1000)+(self.minute()*60*1000)+
  13647. (self.second()*1000)+self.msec();
  13648. return QScriptValue(retval);
  13649. }
  13650. /*:127*//*128:*/
  13651. #line 2985 "./typica.w"
  13652. QScriptValue QTime_addMSecs(QScriptContext*context,QScriptEngine*engine)
  13653. {
  13654. QTime time;
  13655. QScriptValue retval;
  13656. if(context->argumentCount()==1)
  13657. {
  13658. QTime self= getself<QTime> (context);
  13659. time= self.addMSecs(argument<int> (0,context));
  13660. retval= engine->toScriptValue<QTime> (time);
  13661. setQTimeProperties(retval,engine);
  13662. }
  13663. else
  13664. {
  13665. context->throwError("Incorrect number of arguments passed to "
  13666. "QTime::addMSecs(). This method takes one "
  13667. "integer as an argument.");
  13668. }
  13669. return retval;
  13670. }
  13671. QScriptValue QTime_addSecs(QScriptContext*context,QScriptEngine*engine)
  13672. {
  13673. QTime time;
  13674. QScriptValue retval;
  13675. if(context->argumentCount()==1)
  13676. {
  13677. QTime self= getself<QTime> (context);
  13678. time= self.addSecs(argument<int> (0,context));
  13679. retval= engine->toScriptValue<QTime> (time);
  13680. setQTimeProperties(retval,engine);
  13681. }
  13682. else
  13683. {
  13684. context->throwError("Incorrect number of arguments passed to "
  13685. "QTime::addSecs(). This method takes one "
  13686. "integer as an argument.");
  13687. }
  13688. return retval;
  13689. }
  13690. /*:128*//*129:*/
  13691. #line 3028 "./typica.w"
  13692. QScriptValue QTime_elapsed(QScriptContext*context,QScriptEngine*engine)
  13693. {
  13694. QScriptValue retval;
  13695. if(context->argumentCount()==0)
  13696. {
  13697. QTime self= getself<QTime> (context);
  13698. retval= QScriptValue(engine,self.elapsed());
  13699. }
  13700. else
  13701. {
  13702. context->throwError("Incorrect number of arguments passed to "
  13703. "QTime::elapsed(). This method takes no "
  13704. "arguments.");
  13705. }
  13706. return retval;
  13707. }
  13708. /*:129*//*130:*/
  13709. #line 3049 "./typica.w"
  13710. QScriptValue QTime_hour(QScriptContext*context,QScriptEngine*engine)
  13711. {
  13712. QScriptValue retval;
  13713. if(context->argumentCount()==0)
  13714. {
  13715. QTime self= getself<QTime> (context);
  13716. retval= QScriptValue(engine,self.hour());
  13717. }
  13718. else
  13719. {
  13720. context->throwError("Incorrect number of arguments passed to "
  13721. "QTime::hour(). This method takes no "
  13722. "arguments.");
  13723. }
  13724. return retval;
  13725. }
  13726. /*:130*//*131:*/
  13727. #line 3069 "./typica.w"
  13728. QScriptValue QTime_minute(QScriptContext*context,QScriptEngine*engine)
  13729. {
  13730. QScriptValue retval;
  13731. if(context->argumentCount()==0)
  13732. {
  13733. QTime self= getself<QTime> (context);
  13734. retval= QScriptValue(engine,self.minute());
  13735. }
  13736. else
  13737. {
  13738. context->throwError("Incorrect number of arguments passed to "
  13739. "QTime::minute(). This method takes no "
  13740. "arguments.");
  13741. }
  13742. return retval;
  13743. }
  13744. QScriptValue QTime_second(QScriptContext*context,QScriptEngine*engine)
  13745. {
  13746. QScriptValue retval;
  13747. if(context->argumentCount()==0)
  13748. {
  13749. QTime self= getself<QTime> (context);
  13750. retval= QScriptValue(engine,self.second());
  13751. }
  13752. else
  13753. {
  13754. context->throwError("Incorrect number of arguments passed to "
  13755. "QTime::second(). This method takes no "
  13756. "arguments.");
  13757. }
  13758. return retval;
  13759. }
  13760. QScriptValue QTime_msec(QScriptContext*context,QScriptEngine*engine)
  13761. {
  13762. QScriptValue retval;
  13763. if(context->argumentCount()==0)
  13764. {
  13765. QTime self= getself<QTime> (context);
  13766. retval= QScriptValue(engine,self.msec());
  13767. }
  13768. else
  13769. {
  13770. context->throwError("Incorrect number of arguments passed to "
  13771. "QTime::msec(). This method takes no "
  13772. "arguments.");
  13773. }
  13774. return retval;
  13775. }
  13776. /*:131*//*132:*/
  13777. #line 3125 "./typica.w"
  13778. QScriptValue QTime_isNull(QScriptContext*context,QScriptEngine*engine)
  13779. {
  13780. QScriptValue retval;
  13781. if(context->argumentCount()==0)
  13782. {
  13783. QTime self= getself<QTime> (context);
  13784. retval= QScriptValue(engine,self.isNull());
  13785. }
  13786. else
  13787. {
  13788. context->throwError("Incorrect number of arguments passed to "
  13789. "QTime::isNull(). This method takes no "
  13790. "arguments.");
  13791. }
  13792. return retval;
  13793. }
  13794. QScriptValue QTime_isValid(QScriptContext*context,QScriptEngine*engine)
  13795. {
  13796. QScriptValue retval;
  13797. if(context->argumentCount()==0)
  13798. {
  13799. QTime self= getself<QTime> (context);
  13800. retval= QScriptValue(engine,self.isValid());
  13801. }
  13802. else
  13803. {
  13804. context->throwError("Incorrect number of arguments passed to "
  13805. "QTime::isValid(). This method takes no "
  13806. "arguments.");
  13807. }
  13808. return retval;
  13809. }
  13810. /*:132*//*133:*/
  13811. #line 3163 "./typica.w"
  13812. QScriptValue QTime_msecsTo(QScriptContext*context,QScriptEngine*engine)
  13813. {
  13814. QScriptValue retval;
  13815. if(context->argumentCount()==1)
  13816. {
  13817. QTime self= getself<QTime> (context);
  13818. QTime arg= argument<QVariant> (0,context).toTime();
  13819. retval= QScriptValue(engine,self.msecsTo(arg));
  13820. }
  13821. else
  13822. {
  13823. context->throwError("Incorrect number of arguments passed to "
  13824. "QTime::msecsTo(). This method takes one QTime.");
  13825. }
  13826. return retval;
  13827. }
  13828. QScriptValue QTime_secsTo(QScriptContext*context,QScriptEngine*engine)
  13829. {
  13830. QScriptValue retval;
  13831. if(context->argumentCount()==1)
  13832. {
  13833. QTime self= getself<QTime> (context);
  13834. QTime arg= argument<QVariant> (0,context).toTime();
  13835. retval= QScriptValue(engine,self.secsTo(arg));
  13836. }
  13837. else
  13838. {
  13839. context->throwError("Incorrect number of arguments passed to "
  13840. "QTime::secsTo(). This method takes one QTime.");
  13841. }
  13842. return retval;
  13843. }
  13844. /*:133*//*134:*/
  13845. #line 3202 "./typica.w"
  13846. QScriptValue QTime_restart(QScriptContext*context,QScriptEngine*engine)
  13847. {
  13848. QScriptValue retval;
  13849. if(context->argumentCount()==0)
  13850. {
  13851. QTime self= getself<QTime> (context);
  13852. retval= QScriptValue(engine,self.restart());
  13853. }
  13854. else
  13855. {
  13856. context->throwError("Incorrect number of arguments passed to "
  13857. "QTime::restart(). This method takes no "
  13858. "arguments.");
  13859. }
  13860. return retval;
  13861. }
  13862. QScriptValue QTime_start(QScriptContext*context,QScriptEngine*)
  13863. {
  13864. if(context->argumentCount()==0)
  13865. {
  13866. QTime self= getself<QTime> (context);
  13867. self.start();
  13868. }
  13869. else
  13870. {
  13871. context->throwError("Incorrect number of arguments passed to "
  13872. "QTime::start(). This method takes no arguments.");
  13873. }
  13874. return QScriptValue();
  13875. }
  13876. /*:134*//*135:*/
  13877. #line 3238 "./typica.w"
  13878. QScriptValue QTime_setHMS(QScriptContext*context,QScriptEngine*engine)
  13879. {
  13880. QScriptValue retval;
  13881. if(context->argumentCount()==3||context->argumentCount()==4)
  13882. {
  13883. QTime self= getself<QTime> (context);
  13884. int arg1= 0;
  13885. int arg2= 0;
  13886. int arg3= 0;
  13887. int arg4= 0;
  13888. switch(context->argumentCount())
  13889. {
  13890. case 4:
  13891. arg4= argument<int> (3,context);
  13892. case 3:
  13893. arg3= argument<int> (2,context);
  13894. arg2= argument<int> (1,context);
  13895. arg1= argument<int> (0,context);
  13896. default:
  13897. break;
  13898. }
  13899. retval= QScriptValue(engine,self.setHMS(arg1,arg2,arg3,arg4));
  13900. }
  13901. else
  13902. {
  13903. context->throwError("Incorrect number of arguments passed to "
  13904. "QTime::setHMS(). This method takes three or "
  13905. "four integer arguments.");
  13906. }
  13907. return retval;
  13908. }
  13909. /*:135*//*136:*/
  13910. #line 3274 "./typica.w"
  13911. QScriptValue QTime_toString(QScriptContext*context,QScriptEngine*engine)
  13912. {
  13913. QScriptValue retval;
  13914. if(context->argumentCount()==1)
  13915. {
  13916. QTime self= getself<QTime> (context);
  13917. retval= QScriptValue(engine,self.toString(argument<QString> (0,context)));
  13918. }
  13919. else
  13920. {
  13921. context->throwError("Incorrect number of arguments passed to "
  13922. "QTime::toString(). This method takes one QString "
  13923. "as an argument.");
  13924. }
  13925. return retval;
  13926. }
  13927. /*:136*//*137:*/
  13928. #line 3295 "./typica.w"
  13929. QScriptValue QTime_currentTime(QScriptContext*,QScriptEngine*engine)
  13930. {
  13931. QScriptValue object;
  13932. object= engine->toScriptValue<QTime> (QTime::currentTime());
  13933. setQTimeProperties(object,engine);
  13934. return object;
  13935. }
  13936. QScriptValue QTime_fromString(QScriptContext*context,QScriptEngine*engine)
  13937. {
  13938. QScriptValue object;
  13939. if(context->argumentCount()==2)
  13940. {
  13941. QString time= argument<QString> (0,context);
  13942. QString format= argument<QString> (1,context);
  13943. object= engine->toScriptValue<QTime> (QTime::fromString(time,format));
  13944. setQTimeProperties(object,engine);
  13945. }
  13946. else
  13947. {
  13948. context->throwError("Incorrect number of arguments passed to "
  13949. "QTime::fromString(). This method takes two "
  13950. "string arguments.");
  13951. }
  13952. return object;
  13953. }
  13954. /*:137*//*138:*/
  13955. #line 3326 "./typica.w"
  13956. template<> QTime argument(int arg,QScriptContext*context)
  13957. {
  13958. return qscriptvalue_cast<QTime> (context->argument(arg));
  13959. }
  13960. /*:138*//*140:*/
  13961. #line 3344 "./typica.w"
  13962. void setQAbstractScrollAreaProperties(QScriptValue value,QScriptEngine*engine)
  13963. {
  13964. setQFrameProperties(value,engine);
  13965. }
  13966. /*:140*//*142:*/
  13967. #line 3358 "./typica.w"
  13968. void setQAbstractItemViewProperties(QScriptValue value,QScriptEngine*engine)
  13969. {
  13970. setQAbstractScrollAreaProperties(value,engine);
  13971. }
  13972. /*:142*//*144:*/
  13973. #line 3372 "./typica.w"
  13974. void setQGraphicsViewProperties(QScriptValue value,QScriptEngine*engine)
  13975. {
  13976. setQAbstractScrollAreaProperties(value,engine);
  13977. }
  13978. void setQTableViewProperties(QScriptValue value,QScriptEngine*engine)
  13979. {
  13980. setQAbstractItemViewProperties(value,engine);
  13981. }
  13982. /*:144*//*147:*/
  13983. #line 3405 "./typica.w"
  13984. QScriptValue constructQPushButton(QScriptContext*,QScriptEngine*engine)
  13985. {
  13986. QScriptValue object= engine->newQObject(new QPushButton());
  13987. setQPushButtonProperties(object,engine);
  13988. return object;
  13989. }
  13990. void setQPushButtonProperties(QScriptValue value,QScriptEngine*engine)
  13991. {
  13992. setQAbstractButtonProperties(value,engine);
  13993. }
  13994. void setQAbstractButtonProperties(QScriptValue value,QScriptEngine*engine)
  13995. {
  13996. setQWidgetProperties(value,engine);
  13997. }
  13998. /*:147*//*154:*/
  13999. #line 3517 "./typica.w"
  14000. QScriptValue constructQSqlQuery(QScriptContext*,QScriptEngine*engine)
  14001. {
  14002. SqlQueryConnection*obj= new SqlQueryConnection();
  14003. QScriptValue object=
  14004. engine->toScriptValue<void*> (obj);
  14005. setQSqlQueryProperties(object,engine);
  14006. return object;
  14007. }
  14008. /*:154*//*155:*/
  14009. #line 3530 "./typica.w"
  14010. void setQSqlQueryProperties(QScriptValue value,QScriptEngine*engine)
  14011. {
  14012. value.setProperty("bind",engine->newFunction(QSqlQuery_bind));
  14013. value.setProperty("bindFileData",
  14014. engine->newFunction(QSqlQuery_bindFileData));
  14015. value.setProperty("bindDeviceData",
  14016. engine->newFunction(QSqlQuery_bindDeviceData));
  14017. value.setProperty("exec",engine->newFunction(QSqlQuery_exec));
  14018. value.setProperty("executedQuery",engine->newFunction(QSqlQuery_executedQuery));
  14019. value.setProperty("invalidate",engine->newFunction(QSqlQuery_invalidate));
  14020. value.setProperty("next",engine->newFunction(QSqlQuery_next));
  14021. value.setProperty("prepare",engine->newFunction(QSqlQuery_prepare));
  14022. value.setProperty("value",engine->newFunction(QSqlQuery_value));
  14023. }
  14024. /*:155*//*156:*/
  14025. #line 3548 "./typica.w"
  14026. QScriptValue QSqlQuery_exec(QScriptContext*context,QScriptEngine*engine)
  14027. {
  14028. QSqlQuery*q= getself<SqlQueryConnection*> (context)->operator->();
  14029. QScriptValue retval;
  14030. if(context->argumentCount()==1)
  14031. {
  14032. retval= QScriptValue(engine,
  14033. q->exec(argument<QString> (0,context)));
  14034. }
  14035. else
  14036. {
  14037. retval= QScriptValue(engine,q->exec());
  14038. }
  14039. if(q->lastError().isValid())
  14040. {
  14041. qDebug()<<q->lastQuery();
  14042. qDebug()<<q->lastError().text();
  14043. }
  14044. return retval;
  14045. }
  14046. QScriptValue QSqlQuery_executedQuery(QScriptContext*context,QScriptEngine*)
  14047. {
  14048. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  14049. return QScriptValue(query->lastQuery());
  14050. }
  14051. QScriptValue QSqlQuery_next(QScriptContext*context,QScriptEngine*engine)
  14052. {
  14053. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  14054. return QScriptValue(engine,query->next());
  14055. }
  14056. QScriptValue QSqlQuery_value(QScriptContext*context,QScriptEngine*engine)
  14057. {
  14058. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  14059. return QScriptValue(engine,
  14060. query->value(argument<int> (0,context)).toString());
  14061. }
  14062. /*:156*//*157:*/
  14063. #line 3592 "./typica.w"
  14064. QScriptValue QSqlQuery_prepare(QScriptContext*context,QScriptEngine*engine)
  14065. {
  14066. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  14067. return QScriptValue(engine,query->prepare(argument<QString> (0,context)));
  14068. }
  14069. QScriptValue QSqlQuery_bind(QScriptContext*context,QScriptEngine*)
  14070. {
  14071. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  14072. query->bindValue(argument<QString> (0,context),
  14073. argument<QVariant> (1,context));
  14074. return QScriptValue();
  14075. }
  14076. QScriptValue QSqlQuery_bindFileData(QScriptContext*context,
  14077. QScriptEngine*)
  14078. {
  14079. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  14080. QString placeholder= argument<QString> (0,context);
  14081. QString filename= argument<QString> (1,context);
  14082. QFile file(filename);
  14083. QByteArray data;
  14084. if(file.open(QIODevice::ReadOnly))
  14085. {
  14086. data= file.readAll();
  14087. file.close();
  14088. }
  14089. query->bindValue(placeholder,data);
  14090. return QScriptValue();
  14091. }
  14092. QScriptValue QSqlQuery_bindDeviceData(QScriptContext*context,
  14093. QScriptEngine*)
  14094. {
  14095. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  14096. QString placeholder= argument<QString> (0,context);
  14097. QIODevice*device= argument<QIODevice*> (1,context);
  14098. device->reset();
  14099. QByteArray data;
  14100. data= device->readAll();
  14101. query->bindValue(placeholder,data);
  14102. return QScriptValue();
  14103. }
  14104. /*:157*//*158:*/
  14105. #line 3644 "./typica.w"
  14106. QScriptValue QSqlQuery_invalidate(QScriptContext*context,QScriptEngine*)
  14107. {
  14108. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  14109. delete query;
  14110. return QScriptValue::UndefinedValue;
  14111. }
  14112. /*:158*//*161:*/
  14113. #line 3689 "./typica.w"
  14114. QScriptValue baseName(QScriptContext*context,QScriptEngine*engine)
  14115. {
  14116. QFileInfo info(argument<QString> (0,context));
  14117. QScriptValue retval(engine,info.baseName());
  14118. return retval;
  14119. }
  14120. QScriptValue dir(QScriptContext*context,QScriptEngine*engine)
  14121. {
  14122. QFileInfo info(argument<QString> (0,context));
  14123. QDir dir= info.dir();
  14124. QScriptValue retval(engine,dir.path());
  14125. return retval;
  14126. }
  14127. /*:161*//*162:*/
  14128. #line 3708 "./typica.w"
  14129. QScriptValue saveFileFromDatabase(QScriptContext*context,QScriptEngine*)
  14130. {
  14131. SqlQueryConnection h;
  14132. QSqlQuery*query= h.operator->();
  14133. QString q= "SELECT file FROM files WHERE id = :file";
  14134. query->prepare(q);
  14135. query->bindValue(":file",argument<int> (0,context));
  14136. query->exec();
  14137. query->next();
  14138. QByteArray array= query->value(0).toByteArray();
  14139. QFile file(argument<QString> (1,context));
  14140. file.open(QIODevice::WriteOnly);
  14141. file.write(array);
  14142. file.close();
  14143. return QScriptValue();
  14144. }
  14145. /*:162*//*163:*/
  14146. #line 3729 "./typica.w"
  14147. QScriptValue sqlToArray(QScriptContext*context,QScriptEngine*engine)
  14148. {
  14149. QString source= argument<QString> (0,context);
  14150. source.remove(0,1);
  14151. source.chop(1);
  14152. QStringList elements= source.split(",");
  14153. QString element;
  14154. QScriptValue dest= engine->newArray(elements.size());
  14155. int i= 0;
  14156. foreach(element,elements)
  14157. {
  14158. if(element.startsWith("\"")&&element.endsWith("\""))
  14159. {
  14160. element.chop(1);
  14161. element= element.remove(0,1);
  14162. }
  14163. dest.setProperty(i,QScriptValue(engine,element));
  14164. i++;
  14165. }
  14166. return dest;
  14167. }
  14168. /*:163*//*164:*/
  14169. #line 3755 "./typica.w"
  14170. QScriptValue setFont(QScriptContext*context,QScriptEngine*)
  14171. {
  14172. QString font= argument<QString> (0,context);
  14173. QString classname;
  14174. if(context->argumentCount()> 1)
  14175. {
  14176. classname= argument<QString> (1,context);
  14177. QApplication::setFont(QFont(font),classname.toLatin1().constData());
  14178. }
  14179. else
  14180. {
  14181. QApplication::setFont(QFont(font));
  14182. }
  14183. return QScriptValue();
  14184. }
  14185. /*:164*//*165:*/
  14186. #line 3775 "./typica.w"
  14187. QScriptValue annotationFromRecord(QScriptContext*context,QScriptEngine*)
  14188. {
  14189. SqlQueryConnection h;
  14190. QSqlQuery*query= h.operator->();
  14191. QString q= "SELECT file FROM files WHERE id = :file";
  14192. query->prepare(q);
  14193. query->bindValue(":file",argument<int> (0,context));
  14194. query->exec();
  14195. query->next();
  14196. QByteArray array= query->value(0).toByteArray();
  14197. QBuffer buffer(&array);
  14198. buffer.open(QIODevice::ReadOnly);
  14199. QXmlQuery xquery;
  14200. xquery.bindVariable("profile",&buffer);
  14201. QString xq;
  14202. xq= "for $b in doc($profile) //tuple where exists($b/annotation) return $b";
  14203. xquery.setQuery(xq);
  14204. QString result;
  14205. xquery.evaluateTo(&result);
  14206. return QScriptValue(result);
  14207. }
  14208. /*:165*//*166:*/
  14209. #line 3802 "./typica.w"
  14210. QScriptValue setTabOrder(QScriptContext*context,QScriptEngine*)
  14211. {
  14212. QWidget::setTabOrder(argument<QWidget*> (0,context),
  14213. argument<QWidget*> (1,context));
  14214. return QScriptValue();
  14215. }
  14216. /*:166*//*173:*/
  14217. #line 4047 "./typica.w"
  14218. QScriptValue createWindow(QScriptContext*context,QScriptEngine*engine)
  14219. {
  14220. QString targetID= argument<QString> (0,context);
  14221. QDomNode element;
  14222. QScriptValue object;
  14223. /*175:*/
  14224. #line 4094 "./typica.w"
  14225. QDomNodeList windows=
  14226. AppInstance->configuration()->documentElement().elementsByTagName("window");
  14227. QDomNode nullNode;
  14228. int i= 0;
  14229. element= nullNode;
  14230. while(i<windows.count())
  14231. {
  14232. element= windows.at(i);
  14233. QDomNamedNodeMap attributes= element.attributes();
  14234. if(attributes.contains("id"))
  14235. {
  14236. if(attributes.namedItem("id").toAttr().value()==targetID)
  14237. {
  14238. break;
  14239. }
  14240. }
  14241. element= nullNode;
  14242. i++;
  14243. }
  14244. /*:175*/
  14245. #line 4053 "./typica.w"
  14246. if(!element.isNull())
  14247. {
  14248. /*176:*/
  14249. #line 4126 "./typica.w"
  14250. ScriptQMainWindow*window= new ScriptQMainWindow;
  14251. window->setObjectName(targetID);
  14252. object= engine->newQObject(window);
  14253. setQMainWindowProperties(object,engine);
  14254. QWidget*central= new(QWidget);
  14255. central->setParent(window);
  14256. central->setObjectName("centralWidget");
  14257. window->setCentralWidget(central);
  14258. if(element.hasChildNodes())
  14259. {
  14260. /*177:*/
  14261. #line 4161 "./typica.w"
  14262. QStack<QWidget*> widgetStack;
  14263. QStack<QLayout*> layoutStack;
  14264. QString windowScript;
  14265. widgetStack.push(central);
  14266. QDomNodeList windowChildren= element.childNodes();
  14267. int i= 0;
  14268. while(i<windowChildren.count())
  14269. {
  14270. QDomNode current;
  14271. QDomElement element;
  14272. current= windowChildren.at(i);
  14273. if(current.isElement())
  14274. {
  14275. element= current.toElement();
  14276. if(element.tagName()=="program")
  14277. {
  14278. windowScript.append(element.text());
  14279. }
  14280. else if(element.tagName()=="layout")
  14281. {
  14282. addLayoutToWidget(element,&widgetStack,&layoutStack);
  14283. }
  14284. else if(element.tagName()=="menu")
  14285. {
  14286. /*178:*/
  14287. #line 4208 "./typica.w"
  14288. QMenuBar*bar= window->menuBar();
  14289. bar->setParent(window);
  14290. bar->setObjectName("menuBar");
  14291. if(element.hasAttribute("name"))
  14292. {
  14293. QMenu*menu= bar->addMenu(element.attribute("name"));
  14294. menu->setParent(bar);
  14295. if(element.hasAttribute("type"))
  14296. {
  14297. if(element.attribute("type")=="reports")
  14298. {
  14299. if(element.hasAttribute("src"))
  14300. {
  14301. /*618:*/
  14302. #line 13194 "./typica.w"
  14303. QSettings settings;
  14304. QString reportDirectory= QString("%1/%2").arg(settings.value("config").
  14305. toString()).
  14306. arg(element.attribute("src"));
  14307. QDir::addSearchPath("reports",reportDirectory);
  14308. QDir directory(reportDirectory);
  14309. directory.setFilter(QDir::Files);
  14310. directory.setSorting(QDir::Name);
  14311. QStringList nameFilter;
  14312. nameFilter<<"*.xml";
  14313. directory.setNameFilters(nameFilter);
  14314. QFileInfoList reportFiles= directory.entryInfoList();
  14315. for(int i= 0;i<reportFiles.size();i++)
  14316. {
  14317. QFileInfo reportFile= reportFiles.at(i);
  14318. /*622:*/
  14319. #line 13274 "./typica.w"
  14320. QString path= reportFile.absoluteFilePath();
  14321. QFile file(path);
  14322. if(file.open(QIODevice::ReadOnly))
  14323. {
  14324. QDomDocument document;
  14325. document.setContent(&file,true);
  14326. QDomElement root= document.documentElement();
  14327. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  14328. if(!titleNode.isNull())
  14329. {
  14330. QDomElement titleElement= titleNode.toElement();
  14331. QString title= titleElement.text();
  14332. if(!title.isEmpty())
  14333. {
  14334. QStringList hierarchy= title.split(":->");
  14335. QMenu*insertionPoint= menu;
  14336. /*623:*/
  14337. #line 13301 "./typica.w"
  14338. for(int j= 0;j<hierarchy.size()-1;j++)
  14339. {
  14340. QObjectList menuList= insertionPoint->children();
  14341. bool menuFound= false;
  14342. for(int k= 0;k<menuList.size();k++)
  14343. {
  14344. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  14345. if(currentItem)
  14346. {
  14347. if(currentItem->title()==hierarchy.at(j))
  14348. {
  14349. menuFound= true;
  14350. insertionPoint= currentItem;
  14351. break;
  14352. }
  14353. }
  14354. }
  14355. if(!menuFound)
  14356. {
  14357. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  14358. }
  14359. }
  14360. /*:623*/
  14361. #line 13291 "./typica.w"
  14362. ReportAction*action= new ReportAction(path,hierarchy.last());
  14363. insertionPoint->addAction(action);
  14364. }
  14365. }
  14366. }
  14367. /*:622*/
  14368. #line 13210 "./typica.w"
  14369. }
  14370. /*:618*/
  14371. #line 4222 "./typica.w"
  14372. }
  14373. }
  14374. }
  14375. if(element.hasChildNodes())
  14376. {
  14377. /*179:*/
  14378. #line 4235 "./typica.w"
  14379. QDomNodeList menuItems= element.childNodes();
  14380. int j= 0;
  14381. while(j<menuItems.count())
  14382. {
  14383. QDomNode item= menuItems.at(j);
  14384. if(item.isElement())
  14385. {
  14386. QDomElement itemElement= item.toElement();
  14387. if(itemElement.tagName()=="item")
  14388. {
  14389. QAction*itemAction= new QAction(itemElement.text(),menu);
  14390. if(itemElement.hasAttribute("id"))
  14391. {
  14392. itemAction->setObjectName(itemElement.attribute("id"));
  14393. }
  14394. if(itemElement.hasAttribute("shortcut"))
  14395. {
  14396. itemAction->setShortcut(itemElement.attribute("shortcut"));
  14397. }
  14398. menu->addAction(itemAction);
  14399. }
  14400. else if(itemElement.tagName()=="separator")
  14401. {
  14402. menu->addSeparator();
  14403. }
  14404. }
  14405. j++;
  14406. }
  14407. #line 1 "./helpmenu.w"
  14408. /*:179*/
  14409. #line 4228 "./typica.w"
  14410. }
  14411. }
  14412. /*:178*/
  14413. #line 4186 "./typica.w"
  14414. }
  14415. }
  14416. i++;
  14417. }
  14418. QScriptValue oldThis= context->thisObject();
  14419. context->setThisObject(object);
  14420. QScriptValue result= engine->evaluate(windowScript);
  14421. /*170:*/
  14422. #line 3943 "./typica.w"
  14423. if(engine->hasUncaughtException())
  14424. {
  14425. int line= engine->uncaughtExceptionLineNumber();
  14426. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  14427. result.toString();
  14428. QString trace;
  14429. foreach(trace,engine->uncaughtExceptionBacktrace())
  14430. {
  14431. qDebug()<<trace;
  14432. }
  14433. }
  14434. /*:170*/
  14435. #line 4194 "./typica.w"
  14436. context->setThisObject(oldThis);
  14437. /*:177*/
  14438. #line 4137 "./typica.w"
  14439. }
  14440. /*180:*/
  14441. #line 9 "./helpmenu.w"
  14442. HelpMenu*helpMenu= new HelpMenu();
  14443. window->menuBar()->addMenu(helpMenu);
  14444. /*:180*/
  14445. #line 4139 "./typica.w"
  14446. window->show();
  14447. /*:176*/
  14448. #line 4056 "./typica.w"
  14449. }
  14450. return object;
  14451. }
  14452. /*:173*//*174:*/
  14453. #line 4067 "./typica.w"
  14454. QScriptValue createReport(QScriptContext*context,QScriptEngine*engine)
  14455. {
  14456. QString targetID= argument<QString> (0,context);
  14457. QFile file(QString("reports:%1").arg(targetID));
  14458. QScriptValue object;
  14459. if(file.open(QIODevice::ReadOnly))
  14460. {
  14461. QDomDocument document;
  14462. document.setContent(&file,true);
  14463. QDomElement element= document.documentElement();
  14464. if(!element.isNull())
  14465. {
  14466. /*176:*/
  14467. #line 4126 "./typica.w"
  14468. ScriptQMainWindow*window= new ScriptQMainWindow;
  14469. window->setObjectName(targetID);
  14470. object= engine->newQObject(window);
  14471. setQMainWindowProperties(object,engine);
  14472. QWidget*central= new(QWidget);
  14473. central->setParent(window);
  14474. central->setObjectName("centralWidget");
  14475. window->setCentralWidget(central);
  14476. if(element.hasChildNodes())
  14477. {
  14478. /*177:*/
  14479. #line 4161 "./typica.w"
  14480. QStack<QWidget*> widgetStack;
  14481. QStack<QLayout*> layoutStack;
  14482. QString windowScript;
  14483. widgetStack.push(central);
  14484. QDomNodeList windowChildren= element.childNodes();
  14485. int i= 0;
  14486. while(i<windowChildren.count())
  14487. {
  14488. QDomNode current;
  14489. QDomElement element;
  14490. current= windowChildren.at(i);
  14491. if(current.isElement())
  14492. {
  14493. element= current.toElement();
  14494. if(element.tagName()=="program")
  14495. {
  14496. windowScript.append(element.text());
  14497. }
  14498. else if(element.tagName()=="layout")
  14499. {
  14500. addLayoutToWidget(element,&widgetStack,&layoutStack);
  14501. }
  14502. else if(element.tagName()=="menu")
  14503. {
  14504. /*178:*/
  14505. #line 4208 "./typica.w"
  14506. QMenuBar*bar= window->menuBar();
  14507. bar->setParent(window);
  14508. bar->setObjectName("menuBar");
  14509. if(element.hasAttribute("name"))
  14510. {
  14511. QMenu*menu= bar->addMenu(element.attribute("name"));
  14512. menu->setParent(bar);
  14513. if(element.hasAttribute("type"))
  14514. {
  14515. if(element.attribute("type")=="reports")
  14516. {
  14517. if(element.hasAttribute("src"))
  14518. {
  14519. /*618:*/
  14520. #line 13194 "./typica.w"
  14521. QSettings settings;
  14522. QString reportDirectory= QString("%1/%2").arg(settings.value("config").
  14523. toString()).
  14524. arg(element.attribute("src"));
  14525. QDir::addSearchPath("reports",reportDirectory);
  14526. QDir directory(reportDirectory);
  14527. directory.setFilter(QDir::Files);
  14528. directory.setSorting(QDir::Name);
  14529. QStringList nameFilter;
  14530. nameFilter<<"*.xml";
  14531. directory.setNameFilters(nameFilter);
  14532. QFileInfoList reportFiles= directory.entryInfoList();
  14533. for(int i= 0;i<reportFiles.size();i++)
  14534. {
  14535. QFileInfo reportFile= reportFiles.at(i);
  14536. /*622:*/
  14537. #line 13274 "./typica.w"
  14538. QString path= reportFile.absoluteFilePath();
  14539. QFile file(path);
  14540. if(file.open(QIODevice::ReadOnly))
  14541. {
  14542. QDomDocument document;
  14543. document.setContent(&file,true);
  14544. QDomElement root= document.documentElement();
  14545. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  14546. if(!titleNode.isNull())
  14547. {
  14548. QDomElement titleElement= titleNode.toElement();
  14549. QString title= titleElement.text();
  14550. if(!title.isEmpty())
  14551. {
  14552. QStringList hierarchy= title.split(":->");
  14553. QMenu*insertionPoint= menu;
  14554. /*623:*/
  14555. #line 13301 "./typica.w"
  14556. for(int j= 0;j<hierarchy.size()-1;j++)
  14557. {
  14558. QObjectList menuList= insertionPoint->children();
  14559. bool menuFound= false;
  14560. for(int k= 0;k<menuList.size();k++)
  14561. {
  14562. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  14563. if(currentItem)
  14564. {
  14565. if(currentItem->title()==hierarchy.at(j))
  14566. {
  14567. menuFound= true;
  14568. insertionPoint= currentItem;
  14569. break;
  14570. }
  14571. }
  14572. }
  14573. if(!menuFound)
  14574. {
  14575. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  14576. }
  14577. }
  14578. /*:623*/
  14579. #line 13291 "./typica.w"
  14580. ReportAction*action= new ReportAction(path,hierarchy.last());
  14581. insertionPoint->addAction(action);
  14582. }
  14583. }
  14584. }
  14585. /*:622*/
  14586. #line 13210 "./typica.w"
  14587. }
  14588. /*:618*/
  14589. #line 4222 "./typica.w"
  14590. }
  14591. }
  14592. }
  14593. if(element.hasChildNodes())
  14594. {
  14595. /*179:*/
  14596. #line 4235 "./typica.w"
  14597. QDomNodeList menuItems= element.childNodes();
  14598. int j= 0;
  14599. while(j<menuItems.count())
  14600. {
  14601. QDomNode item= menuItems.at(j);
  14602. if(item.isElement())
  14603. {
  14604. QDomElement itemElement= item.toElement();
  14605. if(itemElement.tagName()=="item")
  14606. {
  14607. QAction*itemAction= new QAction(itemElement.text(),menu);
  14608. if(itemElement.hasAttribute("id"))
  14609. {
  14610. itemAction->setObjectName(itemElement.attribute("id"));
  14611. }
  14612. if(itemElement.hasAttribute("shortcut"))
  14613. {
  14614. itemAction->setShortcut(itemElement.attribute("shortcut"));
  14615. }
  14616. menu->addAction(itemAction);
  14617. }
  14618. else if(itemElement.tagName()=="separator")
  14619. {
  14620. menu->addSeparator();
  14621. }
  14622. }
  14623. j++;
  14624. }
  14625. #line 1 "./helpmenu.w"
  14626. /*:179*/
  14627. #line 4228 "./typica.w"
  14628. }
  14629. }
  14630. /*:178*/
  14631. #line 4186 "./typica.w"
  14632. }
  14633. }
  14634. i++;
  14635. }
  14636. QScriptValue oldThis= context->thisObject();
  14637. context->setThisObject(object);
  14638. QScriptValue result= engine->evaluate(windowScript);
  14639. /*170:*/
  14640. #line 3943 "./typica.w"
  14641. if(engine->hasUncaughtException())
  14642. {
  14643. int line= engine->uncaughtExceptionLineNumber();
  14644. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  14645. result.toString();
  14646. QString trace;
  14647. foreach(trace,engine->uncaughtExceptionBacktrace())
  14648. {
  14649. qDebug()<<trace;
  14650. }
  14651. }
  14652. /*:170*/
  14653. #line 4194 "./typica.w"
  14654. context->setThisObject(oldThis);
  14655. /*:177*/
  14656. #line 4137 "./typica.w"
  14657. }
  14658. /*180:*/
  14659. #line 9 "./helpmenu.w"
  14660. HelpMenu*helpMenu= new HelpMenu();
  14661. window->menuBar()->addMenu(helpMenu);
  14662. /*:180*/
  14663. #line 4139 "./typica.w"
  14664. window->show();
  14665. /*:176*/
  14666. #line 4080 "./typica.w"
  14667. }
  14668. file.close();
  14669. }
  14670. return object;
  14671. }
  14672. /*:174*//*198:*/
  14673. #line 4279 "./typica.w"
  14674. void addLayoutToWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  14675. QStack<QLayout*> *layoutStack)
  14676. {
  14677. if(element.hasAttribute("type"))
  14678. {
  14679. /*199:*/
  14680. #line 4300 "./typica.w"
  14681. QLayout*layout;
  14682. QString layoutType= element.attribute("type");
  14683. if(layoutType=="horizontal")
  14684. {
  14685. layout= new QHBoxLayout;
  14686. layoutStack->push(layout);
  14687. populateBoxLayout(element,widgetStack,layoutStack);
  14688. }
  14689. else if(layoutType=="vertical")
  14690. {
  14691. layout= new QVBoxLayout;
  14692. layoutStack->push(layout);
  14693. populateBoxLayout(element,widgetStack,layoutStack);
  14694. }
  14695. else if(layoutType=="grid")
  14696. {
  14697. layout= new QGridLayout;
  14698. layoutStack->push(layout);
  14699. populateGridLayout(element,widgetStack,layoutStack);
  14700. }
  14701. else if(layoutType=="stack")
  14702. {
  14703. layout= new QStackedLayout;
  14704. layoutStack->push(layout);
  14705. populateStackedLayout(element,widgetStack,layoutStack);
  14706. }
  14707. if(element.hasAttribute("id"))
  14708. {
  14709. layout->setObjectName(element.attribute("id"));
  14710. }
  14711. if(element.hasAttribute("spacing"))
  14712. {
  14713. layout->setSpacing(element.attribute("spacing").toInt());
  14714. }
  14715. if(element.hasAttribute("margin"))
  14716. {
  14717. int m= element.attribute("margin").toInt();
  14718. layout->setContentsMargins(m,m,m,m);
  14719. }
  14720. /*:199*/
  14721. #line 4285 "./typica.w"
  14722. QWidget*widget= widgetStack->top();
  14723. if(layout)
  14724. {
  14725. widget->setLayout(layout);
  14726. }
  14727. layoutStack->pop();
  14728. }
  14729. }
  14730. /*:198*//*200:*/
  14731. #line 4347 "./typica.w"
  14732. void populateStackedLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  14733. QStack<QLayout*> *layoutStack)
  14734. {
  14735. QDomNodeList children= element.childNodes();
  14736. QStackedLayout*layout= qobject_cast<QStackedLayout*> (layoutStack->top());
  14737. for(int i= 0;i<children.count();i++)
  14738. {
  14739. QDomNode current;
  14740. QDomElement currentElement;
  14741. current= children.at(i);
  14742. if(current.isElement())
  14743. {
  14744. currentElement= current.toElement();
  14745. if(currentElement.tagName()=="page")
  14746. {
  14747. QWidget*widget= new QWidget;
  14748. layout->addWidget(widget);
  14749. widgetStack->push(widget);
  14750. populateWidget(currentElement,widgetStack,layoutStack);
  14751. widgetStack->pop();
  14752. }
  14753. }
  14754. }
  14755. }
  14756. /*:200*//*201:*/
  14757. #line 4379 "./typica.w"
  14758. void populateGridLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  14759. QStack<QLayout*> *layoutStack)
  14760. {
  14761. QDomNodeList children= element.childNodes();
  14762. int row= -1;
  14763. QGridLayout*layout= qobject_cast<QGridLayout*> (layoutStack->top());
  14764. for(int i= 0;i<children.count();i++)
  14765. {
  14766. QDomNode current;
  14767. QDomElement currentElement;
  14768. current= children.at(i);
  14769. if(current.isElement())
  14770. {
  14771. currentElement= current.toElement();
  14772. if(currentElement.tagName()=="row")
  14773. {
  14774. row++;
  14775. if(currentElement.hasAttribute("height"))
  14776. {
  14777. layout->setRowMinimumHeight(row,
  14778. currentElement.attribute("height").toInt());
  14779. }
  14780. if(currentElement.hasAttribute("stretch"))
  14781. {
  14782. layout->setRowStretch(row,
  14783. currentElement.attribute("stretch").toInt());
  14784. }
  14785. /*202:*/
  14786. #line 4435 "./typica.w"
  14787. int column= -1;
  14788. QDomNodeList rowChildren= currentElement.childNodes();
  14789. for(int j= 0;j<rowChildren.count();j++)
  14790. {
  14791. QDomNode columnNode;
  14792. QDomElement columnElement;
  14793. columnNode= rowChildren.at(j);
  14794. if(columnNode.isElement())
  14795. {
  14796. columnElement= columnNode.toElement();
  14797. if(columnElement.tagName()=="column")
  14798. {
  14799. column++;
  14800. if(columnElement.hasAttribute("column"))
  14801. {
  14802. column= columnElement.attribute("column").toInt();
  14803. }
  14804. if(columnElement.hasAttribute("width"))
  14805. {
  14806. layout->setColumnMinimumWidth(column,
  14807. columnElement.attribute("width").toInt());
  14808. }
  14809. if(columnElement.hasAttribute("stretch"))
  14810. {
  14811. layout->setColumnStretch(column,
  14812. columnElement.attribute("stretch").toInt());
  14813. }
  14814. int hspan= 1;
  14815. int vspan= 1;
  14816. if(columnElement.hasAttribute("rowspan"))
  14817. {
  14818. vspan= columnElement.attribute("rowspan").toInt();
  14819. }
  14820. if(columnElement.hasAttribute("colspan"))
  14821. {
  14822. hspan= columnElement.attribute("colspan").toInt();
  14823. }
  14824. QHBoxLayout*cell= new QHBoxLayout;
  14825. layout->addLayout(cell,row,column,vspan,hspan);
  14826. layoutStack->push(cell);
  14827. populateBoxLayout(columnElement,widgetStack,layoutStack);
  14828. layoutStack->pop();
  14829. }
  14830. }
  14831. }
  14832. /*:202*/
  14833. #line 4407 "./typica.w"
  14834. }
  14835. }
  14836. }
  14837. }
  14838. /*:201*//*203:*/
  14839. #line 4485 "./typica.w"
  14840. void populateBoxLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  14841. QStack<QLayout*> *layoutStack)
  14842. {
  14843. QDomNodeList children= element.childNodes();
  14844. for(int i= 0;i<children.count();i++)
  14845. {
  14846. QDomNode current;
  14847. QDomElement currentElement;
  14848. current= children.at(i);
  14849. if(current.isElement())
  14850. {
  14851. currentElement= current.toElement();
  14852. if(currentElement.tagName()=="button")
  14853. {
  14854. addButtonToLayout(currentElement,widgetStack,layoutStack);
  14855. }
  14856. else if(currentElement.tagName()=="calendar")
  14857. {
  14858. addCalendarToLayout(currentElement,widgetStack,layoutStack);
  14859. }
  14860. else if(currentElement.tagName()=="decoration")
  14861. {
  14862. addDecorationToLayout(currentElement,widgetStack,
  14863. layoutStack);
  14864. }
  14865. else if(currentElement.tagName()=="layout")
  14866. {
  14867. addLayoutToLayout(currentElement,widgetStack,layoutStack);
  14868. }
  14869. else if(currentElement.tagName()=="splitter")
  14870. {
  14871. addSplitterToLayout(currentElement,widgetStack,layoutStack);
  14872. }
  14873. else if(currentElement.tagName()=="label")
  14874. {
  14875. QBoxLayout*layout=
  14876. qobject_cast<QBoxLayout*> (layoutStack->top());
  14877. QLabel*label= new QLabel(currentElement.text());
  14878. layout->addWidget(label);
  14879. }
  14880. else if(currentElement.tagName()=="lcdtemperature")
  14881. {
  14882. addTemperatureDisplayToLayout(currentElement,widgetStack,
  14883. layoutStack);
  14884. }
  14885. else if(currentElement.tagName()=="lcdtimer")
  14886. {
  14887. addTimerDisplayToLayout(currentElement,widgetStack,
  14888. layoutStack);
  14889. }
  14890. else if(currentElement.tagName()=="line")
  14891. {
  14892. addLineToLayout(currentElement,widgetStack,layoutStack);
  14893. }
  14894. else if(currentElement.tagName()=="report")
  14895. {
  14896. addReportToLayout(currentElement,widgetStack,layoutStack);
  14897. }
  14898. else if(currentElement.tagName()=="sqldrop")
  14899. {
  14900. addSqlDropToLayout(currentElement,widgetStack,layoutStack);
  14901. }
  14902. else if(currentElement.tagName()=="sqltablearray")
  14903. {
  14904. addSaltToLayout(currentElement,widgetStack,layoutStack);
  14905. }
  14906. else if(currentElement.tagName()=="sqlview")
  14907. {
  14908. addSqlQueryViewToLayout(currentElement,widgetStack,
  14909. layoutStack);
  14910. }
  14911. else if(currentElement.tagName()=="textarea")
  14912. {
  14913. addTextToLayout(currentElement,widgetStack,layoutStack);
  14914. }
  14915. else if(currentElement.tagName()=="spinbox")
  14916. {
  14917. addSpinBoxToLayout(currentElement,widgetStack,layoutStack);
  14918. }
  14919. else if(currentElement.tagName()=="formarray")
  14920. {
  14921. addFormArrayToLayout(currentElement,widgetStack,layoutStack);
  14922. }
  14923. else if(currentElement.tagName()=="hscale")
  14924. {
  14925. addScaleControlToLayout(currentElement,widgetStack,
  14926. layoutStack);
  14927. }
  14928. else if(currentElement.tagName()=="vscale")
  14929. {
  14930. addIntensityControlToLayout(currentElement,widgetStack,
  14931. layoutStack);
  14932. }
  14933. else if(currentElement.tagName()=="webview")
  14934. {
  14935. addWebViewToLayout(currentElement,widgetStack,layoutStack);
  14936. }
  14937. else if(currentElement.tagName()=="stretch")
  14938. {
  14939. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  14940. layout->addStretch();
  14941. }
  14942. /*660:*/
  14943. #line 440 "./daterangeselector.w"
  14944. else if(currentElement.tagName()=="daterange")
  14945. {
  14946. addDateRangeToLayout(currentElement,widgetStack,layoutStack);
  14947. }
  14948. /*:660*/
  14949. #line 4588 "./typica.w"
  14950. }
  14951. }
  14952. }
  14953. /*:203*//*204:*/
  14954. #line 4596 "./typica.w"
  14955. void addLayoutToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  14956. QStack<QLayout*> *layoutStack)
  14957. {
  14958. QLayout*targetLayout= layoutStack->pop();
  14959. QBoxLayout*boxLayout= qobject_cast<QBoxLayout*> (targetLayout);
  14960. if(element.hasAttribute("type"))
  14961. {
  14962. /*199:*/
  14963. #line 4300 "./typica.w"
  14964. QLayout*layout;
  14965. QString layoutType= element.attribute("type");
  14966. if(layoutType=="horizontal")
  14967. {
  14968. layout= new QHBoxLayout;
  14969. layoutStack->push(layout);
  14970. populateBoxLayout(element,widgetStack,layoutStack);
  14971. }
  14972. else if(layoutType=="vertical")
  14973. {
  14974. layout= new QVBoxLayout;
  14975. layoutStack->push(layout);
  14976. populateBoxLayout(element,widgetStack,layoutStack);
  14977. }
  14978. else if(layoutType=="grid")
  14979. {
  14980. layout= new QGridLayout;
  14981. layoutStack->push(layout);
  14982. populateGridLayout(element,widgetStack,layoutStack);
  14983. }
  14984. else if(layoutType=="stack")
  14985. {
  14986. layout= new QStackedLayout;
  14987. layoutStack->push(layout);
  14988. populateStackedLayout(element,widgetStack,layoutStack);
  14989. }
  14990. if(element.hasAttribute("id"))
  14991. {
  14992. layout->setObjectName(element.attribute("id"));
  14993. }
  14994. if(element.hasAttribute("spacing"))
  14995. {
  14996. layout->setSpacing(element.attribute("spacing").toInt());
  14997. }
  14998. if(element.hasAttribute("margin"))
  14999. {
  15000. int m= element.attribute("margin").toInt();
  15001. layout->setContentsMargins(m,m,m,m);
  15002. }
  15003. /*:199*/
  15004. #line 4604 "./typica.w"
  15005. boxLayout->addLayout(layout);
  15006. layoutStack->pop();
  15007. }
  15008. layoutStack->push(targetLayout);
  15009. }
  15010. /*:204*//*205:*/
  15011. #line 4615 "./typica.w"
  15012. void addSplitterToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  15013. QStack<QLayout*> *layoutStack)
  15014. {
  15015. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  15016. QSplitter*splitter= new(QSplitter);
  15017. layout->addWidget(splitter);
  15018. /*206:*/
  15019. #line 4628 "./typica.w"
  15020. QString orientation= element.attribute("type");
  15021. if(orientation=="horizontal")
  15022. {
  15023. splitter->setOrientation(Qt::Horizontal);
  15024. }
  15025. else if(orientation=="vertical")
  15026. {
  15027. splitter->setOrientation(Qt::Vertical);
  15028. }
  15029. QString id= element.attribute("id");
  15030. if(!id.isEmpty())
  15031. {
  15032. splitter->setObjectName(id);
  15033. }
  15034. if(element.hasChildNodes())
  15035. {
  15036. widgetStack->push(splitter);
  15037. populateSplitter(element,widgetStack,layoutStack);
  15038. widgetStack->pop();
  15039. }
  15040. /*:206*/
  15041. #line 4622 "./typica.w"
  15042. }
  15043. /*:205*//*207:*/
  15044. #line 4654 "./typica.w"
  15045. void populateSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  15046. QStack<QLayout*> *layoutStack)
  15047. {
  15048. QDomNodeList children= element.childNodes();
  15049. for(int i= 0;i<children.count();i++)
  15050. {
  15051. QDomNode current;
  15052. QDomElement currentElement;
  15053. current= children.at(i);
  15054. if(current.isElement())
  15055. {
  15056. currentElement= current.toElement();
  15057. if(currentElement.tagName()=="decoration")
  15058. {
  15059. addDecorationToSplitter(currentElement,widgetStack,
  15060. layoutStack);
  15061. }
  15062. else if(currentElement.tagName()=="graph")
  15063. {
  15064. addGraphToSplitter(currentElement,widgetStack,layoutStack);
  15065. }
  15066. else if(currentElement.tagName()=="splitter")
  15067. {
  15068. addSplitterToSplitter(currentElement,widgetStack,layoutStack);
  15069. }
  15070. else if(currentElement.tagName()=="lcdtemperature")
  15071. {
  15072. addTemperatureDisplayToSplitter(currentElement,widgetStack,
  15073. layoutStack);
  15074. }
  15075. else if(currentElement.tagName()=="lcdtimer")
  15076. {
  15077. addTimerDisplayToSplitter(currentElement,widgetStack,
  15078. layoutStack);
  15079. }
  15080. else if(currentElement.tagName()=="measurementtable")
  15081. {
  15082. addZoomLogToSplitter(currentElement,widgetStack,layoutStack);
  15083. }
  15084. else if(currentElement.tagName()=="widget")
  15085. {
  15086. addWidgetToSplitter(currentElement,widgetStack,layoutStack);
  15087. }
  15088. }
  15089. }
  15090. }
  15091. /*:207*//*208:*/
  15092. #line 4704 "./typica.w"
  15093. void addSplitterToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  15094. QStack<QLayout*> *layoutStack)
  15095. {
  15096. QSplitter*parent= qobject_cast<QSplitter*> (widgetStack->top());
  15097. QSplitter*splitter= new(QSplitter);
  15098. splitter->setParent(parent);
  15099. parent->addWidget(splitter);
  15100. /*206:*/
  15101. #line 4628 "./typica.w"
  15102. QString orientation= element.attribute("type");
  15103. if(orientation=="horizontal")
  15104. {
  15105. splitter->setOrientation(Qt::Horizontal);
  15106. }
  15107. else if(orientation=="vertical")
  15108. {
  15109. splitter->setOrientation(Qt::Vertical);
  15110. }
  15111. QString id= element.attribute("id");
  15112. if(!id.isEmpty())
  15113. {
  15114. splitter->setObjectName(id);
  15115. }
  15116. if(element.hasChildNodes())
  15117. {
  15118. widgetStack->push(splitter);
  15119. populateSplitter(element,widgetStack,layoutStack);
  15120. widgetStack->pop();
  15121. }
  15122. /*:206*/
  15123. #line 4712 "./typica.w"
  15124. }
  15125. /*:208*//*209:*/
  15126. #line 4721 "./typica.w"
  15127. void addTemperatureDisplayToSplitter(QDomElement element,
  15128. QStack<QWidget*> *widgetStack,
  15129. QStack<QLayout*> *)
  15130. {
  15131. TemperatureDisplay*display= new(TemperatureDisplay);
  15132. if(element.hasAttribute("id"))
  15133. {
  15134. display->setObjectName(element.attribute("id"));
  15135. }
  15136. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  15137. splitter->addWidget(display);
  15138. }
  15139. void addTemperatureDisplayToLayout(QDomElement element,
  15140. QStack<QWidget*> *,
  15141. QStack<QLayout*> *layoutStack)
  15142. {
  15143. TemperatureDisplay*display= new(TemperatureDisplay);
  15144. if(element.hasAttribute("id"))
  15145. {
  15146. display->setObjectName(element.attribute("id"));
  15147. }
  15148. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  15149. layout->addWidget(display);
  15150. }
  15151. /*:209*//*210:*/
  15152. #line 4752 "./typica.w"
  15153. void addTimerDisplayToSplitter(QDomElement element,
  15154. QStack<QWidget*> *widgetStack,
  15155. QStack<QLayout*> *)
  15156. {
  15157. TimerDisplay*display= new(TimerDisplay);
  15158. if(element.hasAttribute("id"))
  15159. {
  15160. display->setObjectName(element.attribute("id"));
  15161. }
  15162. if(element.hasAttribute("format"))
  15163. {
  15164. display->setDisplayFormat(element.attribute("format"));
  15165. }
  15166. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  15167. splitter->addWidget(display);
  15168. }
  15169. void addTimerDisplayToLayout(QDomElement element,
  15170. QStack<QWidget*> *,
  15171. QStack<QLayout*> *layoutStack)
  15172. {
  15173. TimerDisplay*display= new(TimerDisplay);
  15174. if(element.hasAttribute("id"))
  15175. {
  15176. display->setObjectName(element.attribute("id"));
  15177. }
  15178. if(element.hasAttribute("format"))
  15179. {
  15180. display->setDisplayFormat(element.attribute("format"));
  15181. }
  15182. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  15183. layout->addWidget(display);
  15184. }
  15185. /*:210*//*211:*/
  15186. #line 4790 "./typica.w"
  15187. void addDecorationToLayout(QDomElement element,QStack<QWidget*> *,
  15188. QStack<QLayout*> *layoutStack)
  15189. {
  15190. /*212:*/
  15191. #line 4811 "./typica.w"
  15192. QString labelText= element.attribute("name");
  15193. Qt::Orientations orientation= Qt::Horizontal;
  15194. if(element.hasAttribute("type"))
  15195. {
  15196. if(element.attribute("type")=="horizontal")
  15197. {
  15198. orientation= Qt::Horizontal;
  15199. }
  15200. else if(element.attribute("type")=="vertical")
  15201. {
  15202. orientation= Qt::Vertical;
  15203. }
  15204. }
  15205. /*213:*/
  15206. #line 4836 "./typica.w"
  15207. QWidget*theWidget= NULL;
  15208. QDomNodeList children= element.childNodes();
  15209. for(int i= 0;i<children.count();i++)
  15210. {
  15211. QDomNode item= children.at(i);
  15212. if(item.isElement())
  15213. {
  15214. QDomElement itemElement= item.toElement();
  15215. if(itemElement.tagName()=="lcdtemperature")
  15216. {
  15217. TemperatureDisplay*display= new TemperatureDisplay;
  15218. if(itemElement.hasAttribute("id"))
  15219. {
  15220. display->setObjectName(itemElement.attribute("id"));
  15221. }
  15222. theWidget= display;
  15223. }
  15224. else if(itemElement.tagName()=="lcdtimer")
  15225. {
  15226. TimerDisplay*display= new TimerDisplay;
  15227. if(itemElement.hasAttribute("id"))
  15228. {
  15229. display->setObjectName(itemElement.attribute("id"));
  15230. }
  15231. if(itemElement.hasAttribute("format"))
  15232. {
  15233. display->setDisplayFormat(itemElement.attribute("format"));
  15234. }
  15235. theWidget= display;
  15236. }
  15237. }
  15238. }
  15239. /*:213*/
  15240. #line 4825 "./typica.w"
  15241. WidgetDecorator*decoration= new WidgetDecorator(theWidget,labelText,
  15242. orientation);
  15243. if(element.hasAttribute("id"))
  15244. {
  15245. decoration->setObjectName(element.attribute("id"));
  15246. }
  15247. /*:212*/
  15248. #line 4794 "./typica.w"
  15249. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  15250. layout->addWidget(decoration);
  15251. }
  15252. void addDecorationToSplitter(QDomElement element,
  15253. QStack<QWidget*> *widgetStack,
  15254. QStack<QLayout*> *)
  15255. {
  15256. /*212:*/
  15257. #line 4811 "./typica.w"
  15258. QString labelText= element.attribute("name");
  15259. Qt::Orientations orientation= Qt::Horizontal;
  15260. if(element.hasAttribute("type"))
  15261. {
  15262. if(element.attribute("type")=="horizontal")
  15263. {
  15264. orientation= Qt::Horizontal;
  15265. }
  15266. else if(element.attribute("type")=="vertical")
  15267. {
  15268. orientation= Qt::Vertical;
  15269. }
  15270. }
  15271. /*213:*/
  15272. #line 4836 "./typica.w"
  15273. QWidget*theWidget= NULL;
  15274. QDomNodeList children= element.childNodes();
  15275. for(int i= 0;i<children.count();i++)
  15276. {
  15277. QDomNode item= children.at(i);
  15278. if(item.isElement())
  15279. {
  15280. QDomElement itemElement= item.toElement();
  15281. if(itemElement.tagName()=="lcdtemperature")
  15282. {
  15283. TemperatureDisplay*display= new TemperatureDisplay;
  15284. if(itemElement.hasAttribute("id"))
  15285. {
  15286. display->setObjectName(itemElement.attribute("id"));
  15287. }
  15288. theWidget= display;
  15289. }
  15290. else if(itemElement.tagName()=="lcdtimer")
  15291. {
  15292. TimerDisplay*display= new TimerDisplay;
  15293. if(itemElement.hasAttribute("id"))
  15294. {
  15295. display->setObjectName(itemElement.attribute("id"));
  15296. }
  15297. if(itemElement.hasAttribute("format"))
  15298. {
  15299. display->setDisplayFormat(itemElement.attribute("format"));
  15300. }
  15301. theWidget= display;
  15302. }
  15303. }
  15304. }
  15305. /*:213*/
  15306. #line 4825 "./typica.w"
  15307. WidgetDecorator*decoration= new WidgetDecorator(theWidget,labelText,
  15308. orientation);
  15309. if(element.hasAttribute("id"))
  15310. {
  15311. decoration->setObjectName(element.attribute("id"));
  15312. }
  15313. /*:212*/
  15314. #line 4803 "./typica.w"
  15315. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  15316. splitter->addWidget(decoration);
  15317. }
  15318. /*:211*//*214:*/
  15319. #line 4875 "./typica.w"
  15320. void addWidgetToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  15321. QStack<QLayout*> *layoutStack)
  15322. {
  15323. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  15324. QWidget*widget= new QWidget;
  15325. if(element.hasAttribute("id"))
  15326. {
  15327. widget->setObjectName(element.attribute("id"));
  15328. }
  15329. splitter->addWidget(widget);
  15330. if(element.hasChildNodes())
  15331. {
  15332. widgetStack->push(widget);
  15333. populateWidget(element,widgetStack,layoutStack);
  15334. widgetStack->pop();
  15335. }
  15336. }
  15337. void populateWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  15338. QStack<QLayout*> *layoutStack)
  15339. {
  15340. QDomNodeList children= element.childNodes();
  15341. for(int i= 0;i<children.count();i++)
  15342. {
  15343. QDomNode current;
  15344. QDomElement currentElement;
  15345. current= children.at(i);
  15346. if(current.isElement())
  15347. {
  15348. currentElement= current.toElement();
  15349. if(currentElement.tagName()=="layout")
  15350. {
  15351. addLayoutToWidget(currentElement,widgetStack,layoutStack);
  15352. }
  15353. }
  15354. }
  15355. }
  15356. /*:214*//*215:*/
  15357. #line 4918 "./typica.w"
  15358. void addButtonToLayout(QDomElement element,QStack<QWidget*> *,
  15359. QStack<QLayout*> *layoutStack)
  15360. {
  15361. QAbstractButton*button= NULL;
  15362. QString text= element.attribute("name");
  15363. if(element.hasAttribute("type"))
  15364. {
  15365. QString type= element.attribute("type");
  15366. if(type=="annotation")
  15367. {
  15368. AnnotationButton*abutton= new AnnotationButton(text);
  15369. if(element.hasAttribute("annotation"))
  15370. {
  15371. abutton->setAnnotation(element.attribute("annotation"));
  15372. }
  15373. if(element.hasAttribute("series"))
  15374. {
  15375. abutton->setTemperatureColumn(element.attribute("series").
  15376. toInt());
  15377. }
  15378. if(element.hasAttribute("column"))
  15379. {
  15380. abutton->setAnnotationColumn(element.attribute("column").
  15381. toInt());
  15382. }
  15383. button= abutton;
  15384. }
  15385. else if(type=="check")
  15386. {
  15387. button= new QCheckBox(text);
  15388. }
  15389. else if(type=="push")
  15390. {
  15391. button= new QPushButton(text);
  15392. }
  15393. }
  15394. if(element.hasAttribute("id"))
  15395. {
  15396. button->setObjectName(element.attribute("id"));
  15397. }
  15398. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  15399. layout->addWidget(button);
  15400. }
  15401. /*:215*//*216:*/
  15402. #line 4970 "./typica.w"
  15403. void addSpinBoxToLayout(QDomElement element,QStack<QWidget*> *,
  15404. QStack<QLayout*> *layoutStack)
  15405. {
  15406. AnnotationSpinBox*box= new AnnotationSpinBox("","",NULL);
  15407. if(element.hasAttribute("pretext"))
  15408. {
  15409. box->setPretext(element.attribute("pretext"));
  15410. }
  15411. if(element.hasAttribute("posttext"))
  15412. {
  15413. box->setPosttext(element.attribute("posttext"));
  15414. }
  15415. if(element.hasAttribute("series"))
  15416. {
  15417. box->setTemperatureColumn(element.attribute("series").toInt());
  15418. }
  15419. if(element.hasAttribute("column"))
  15420. {
  15421. box->setAnnotationColumn(element.attribute("column").toInt());
  15422. }
  15423. if(element.hasAttribute("min"))
  15424. {
  15425. box->setMinimum(element.attribute("min").toDouble());
  15426. }
  15427. if(element.hasAttribute("max"))
  15428. {
  15429. box->setMaximum(element.attribute("max").toDouble());
  15430. }
  15431. if(element.hasAttribute("decimals"))
  15432. {
  15433. box->setDecimals(element.attribute("decimals").toInt());
  15434. }
  15435. if(element.hasAttribute("step"))
  15436. {
  15437. box->setSingleStep(element.attribute("step").toDouble());
  15438. }
  15439. if(element.hasAttribute("id"))
  15440. {
  15441. box->setObjectName(element.attribute("id"));
  15442. }
  15443. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  15444. layout->addWidget(box);
  15445. }
  15446. /*:216*//*217:*/
  15447. #line 5026 "./typica.w"
  15448. void addZoomLogToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  15449. QStack<QLayout*> *)
  15450. {
  15451. ZoomLog*widget= new ZoomLog;
  15452. if(!widget)
  15453. {
  15454. qDebug()<<"Error constructing widget!";
  15455. }
  15456. if(element.hasAttribute("id"))
  15457. {
  15458. widget->setObjectName(element.attribute("id"));
  15459. }
  15460. if(element.hasChildNodes())
  15461. {
  15462. QDomNodeList children= element.childNodes();
  15463. int column= 0;
  15464. for(int i= 0;i<children.count();i++)
  15465. {
  15466. QDomNode current;
  15467. QDomElement currentElement;
  15468. current= children.at(i);
  15469. if(current.isElement())
  15470. {
  15471. currentElement= current.toElement();
  15472. if(currentElement.tagName()=="column")
  15473. {
  15474. QString text= currentElement.text();
  15475. widget->setHeaderData(column,text);
  15476. column++;
  15477. }
  15478. }
  15479. }
  15480. }
  15481. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  15482. if(splitter)
  15483. {
  15484. splitter->addWidget(widget);
  15485. }
  15486. else
  15487. {
  15488. qDebug()<<"Splitter not found at top of widget stack!";
  15489. }
  15490. }
  15491. /*:217*//*218:*/
  15492. #line 5074 "./typica.w"
  15493. void addGraphToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  15494. QStack<QLayout*> *)
  15495. {
  15496. GraphView*view= new GraphView;
  15497. if(element.hasAttribute("id"))
  15498. {
  15499. view->setObjectName(element.attribute("id"));
  15500. }
  15501. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  15502. splitter->addWidget(view);
  15503. }
  15504. /*:218*//*219:*/
  15505. #line 5091 "./typica.w"
  15506. void addSqlDropToLayout(QDomElement element,QStack<QWidget*> *,
  15507. QStack<QLayout*> *layoutStack)
  15508. {
  15509. SqlComboBox*box= new SqlComboBox();
  15510. if(element.hasAttribute("data"))
  15511. {
  15512. box->setDataColumn(element.attribute("data").toInt());
  15513. }
  15514. if(element.hasAttribute("display"))
  15515. {
  15516. box->setDisplayColumn(element.attribute("display").toInt());
  15517. }
  15518. if(element.hasAttribute("showdata"))
  15519. {
  15520. if(element.attribute("showdata")=="true")
  15521. {
  15522. box->showData(true);
  15523. }
  15524. }
  15525. if(element.hasAttribute("editable"))
  15526. {
  15527. if(element.attribute("editable")=="true")
  15528. {
  15529. box->setEditable(true);
  15530. }
  15531. }
  15532. if(element.hasChildNodes())
  15533. {
  15534. QDomNodeList children= element.childNodes();
  15535. for(int i= 0;i<children.count();i++)
  15536. {
  15537. QDomNode current;
  15538. QDomElement currentElement;
  15539. current= children.at(i);
  15540. if(current.isElement())
  15541. {
  15542. currentElement= current.toElement();
  15543. if(currentElement.tagName()=="null")
  15544. {
  15545. box->addNullOption();
  15546. }
  15547. else if(currentElement.tagName()=="query")
  15548. {
  15549. box->addSqlOptions(currentElement.text());
  15550. }
  15551. }
  15552. }
  15553. }
  15554. if(element.hasAttribute("id"))
  15555. {
  15556. box->setObjectName(element.attribute("id"));
  15557. }
  15558. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  15559. layout->addWidget(box);
  15560. }
  15561. /*:219*//*220:*/
  15562. #line 5170 "./typica.w"
  15563. void addSaltToLayout(QDomElement element,QStack<QWidget*> *,
  15564. QStack<QLayout*> *layoutStack)
  15565. {
  15566. QTableView*view= new QTableView;
  15567. view->setProperty("tabletype",QVariant(QString("SaltTable")));
  15568. SaltModel*model= new SaltModel(element.childNodes().count());
  15569. if(element.hasAttribute("id"))
  15570. {
  15571. view->setObjectName(element.attribute("id"));
  15572. }
  15573. if(element.hasChildNodes())
  15574. {
  15575. QDomNodeList children= element.childNodes();
  15576. int currentColumn= 0;
  15577. for(int i= 0;i<children.count();i++)
  15578. {
  15579. QDomNode current;
  15580. QDomElement currentElement;
  15581. current= children.at(i);
  15582. if(current.isElement())
  15583. {
  15584. currentElement= current.toElement();
  15585. if(currentElement.tagName()=="column")
  15586. {
  15587. if(currentElement.hasAttribute("name"))
  15588. {
  15589. model->setHeaderData(currentColumn,Qt::Horizontal,
  15590. currentElement.attribute("name"));
  15591. }
  15592. if(currentElement.hasAttribute("delegate"))
  15593. {
  15594. /*221:*/
  15595. #line 5218 "./typica.w"
  15596. if(currentElement.attribute("delegate")=="sql")
  15597. {
  15598. /*222:*/
  15599. #line 5234 "./typica.w"
  15600. SqlComboBoxDelegate*delegate= new SqlComboBoxDelegate;
  15601. SqlComboBox*widget= new SqlComboBox();
  15602. if(currentElement.hasAttribute("nulltext"))
  15603. {
  15604. widget->setNullText(currentElement.attribute("nulltext"));
  15605. }
  15606. if(currentElement.hasAttribute("nulldata"))
  15607. {
  15608. widget->setNullData(QVariant(currentElement.attribute("nulldata")));
  15609. }
  15610. if(currentElement.hasAttribute("null"))
  15611. {
  15612. if(currentElement.attribute("null")=="true")
  15613. {
  15614. widget->addNullOption();
  15615. }
  15616. }
  15617. if(currentElement.hasAttribute("showdata"))
  15618. {
  15619. if(currentElement.attribute("showdata")=="true")
  15620. {
  15621. widget->showData(true);
  15622. }
  15623. }
  15624. if(currentElement.hasAttribute("data"))
  15625. {
  15626. widget->setDataColumn(currentElement.attribute("data").toInt());
  15627. }
  15628. if(currentElement.hasAttribute("display"))
  15629. {
  15630. widget->setDisplayColumn(currentElement.attribute("display").toInt());
  15631. }
  15632. widget->addSqlOptions(currentElement.text());
  15633. delegate->setWidget(widget);
  15634. view->setItemDelegateForColumn(currentColumn,delegate);
  15635. /*:222*/
  15636. #line 5221 "./typica.w"
  15637. }
  15638. else if(currentElement.attribute("delegate")=="numeric")
  15639. {
  15640. /*223:*/
  15641. #line 5275 "./typica.w"
  15642. NumericDelegate*delegate= new NumericDelegate;
  15643. view->setItemDelegateForColumn(currentColumn,delegate);
  15644. /*:223*/
  15645. #line 5225 "./typica.w"
  15646. }
  15647. /*:221*/
  15648. #line 5202 "./typica.w"
  15649. }
  15650. currentColumn++;
  15651. }
  15652. }
  15653. }
  15654. }
  15655. view->setModel(model);
  15656. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  15657. layout->addWidget(view);
  15658. }
  15659. /*:220*//*230:*/
  15660. #line 5385 "./typica.w"
  15661. void addLineToLayout(QDomElement element,QStack<QWidget*> *,
  15662. QStack<QLayout*> *layoutStack)
  15663. {
  15664. QLineEdit*widget= new QLineEdit(element.text());
  15665. if(element.hasAttribute("id"))
  15666. {
  15667. widget->setObjectName(element.attribute("id"));
  15668. }
  15669. if(element.hasAttribute("writable"))
  15670. {
  15671. if(element.attribute("writable")=="false")
  15672. {
  15673. widget->setReadOnly(true);
  15674. }
  15675. }
  15676. if(element.hasAttribute("validator"))
  15677. {
  15678. if(element.attribute("validator")=="numeric")
  15679. {
  15680. widget->setValidator(new QDoubleValidator(NULL));
  15681. }
  15682. else if(element.attribute("validator")=="integer")
  15683. {
  15684. widget->setValidator(new QIntValidator(NULL));
  15685. }
  15686. else if(element.attribute("validator")=="expression"&&
  15687. element.hasAttribute("expression"))
  15688. {
  15689. widget->setValidator(new QRegExpValidator(
  15690. QRegExp(element.attribute("expression")),
  15691. NULL));
  15692. }
  15693. }
  15694. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  15695. layout->addWidget(widget);
  15696. }
  15697. /*:230*//*231:*/
  15698. #line 5426 "./typica.w"
  15699. void addTextToLayout(QDomElement element,QStack<QWidget*> *,
  15700. QStack<QLayout*> *layoutStack)
  15701. {
  15702. QTextEdit*widget= new QTextEdit;
  15703. if(element.hasAttribute("id"))
  15704. {
  15705. widget->setObjectName(element.attribute("id"));
  15706. }
  15707. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  15708. layout->addWidget(widget);
  15709. }
  15710. /*:231*//*232:*/
  15711. #line 5443 "./typica.w"
  15712. void addSqlQueryViewToLayout(QDomElement element,
  15713. QStack<QWidget*> *,
  15714. QStack<QLayout*> *layoutStack)
  15715. {
  15716. SqlQueryView*view= new SqlQueryView;
  15717. if(element.hasAttribute("id"))
  15718. {
  15719. view->setObjectName(element.attribute("id"));
  15720. }
  15721. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  15722. layout->addWidget(view);
  15723. }
  15724. /*:232*//*233:*/
  15725. #line 5460 "./typica.w"
  15726. void addCalendarToLayout(QDomElement element,QStack<QWidget*> *,
  15727. QStack<QLayout*> *layoutStack)
  15728. {
  15729. QWidget*widget;
  15730. if(element.hasAttribute("time"))
  15731. {
  15732. if(element.attribute("time")=="true")
  15733. {
  15734. QDateTimeEdit*edit= new QDateTimeEdit;
  15735. edit->setDateTime(QDateTime::currentDateTime());
  15736. edit->setCalendarPopup(true);
  15737. edit->setDisplayFormat("yyyy-MM-dd hh:mm:ss");
  15738. widget= qobject_cast<QWidget*> (edit);
  15739. }
  15740. else
  15741. {
  15742. QDateEdit*edit= new QDateEdit;
  15743. edit->setDate(QDate::currentDate());
  15744. edit->setCalendarPopup(true);
  15745. edit->setDisplayFormat("yyyy-MM-dd");
  15746. widget= qobject_cast<QWidget*> (edit);
  15747. }
  15748. }
  15749. else
  15750. {
  15751. QDateEdit*edit= new QDateEdit;
  15752. edit->setDate(QDate::currentDate());
  15753. edit->setCalendarPopup(true);
  15754. edit->setDisplayFormat("yyyy-MM-dd");
  15755. widget= qobject_cast<QWidget*> (edit);
  15756. }
  15757. if(element.hasAttribute("id"))
  15758. {
  15759. widget->setObjectName(element.attribute("id"));
  15760. }
  15761. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  15762. layout->addWidget(widget);
  15763. }
  15764. /*:233*//*234:*/
  15765. #line 5503 "./typica.w"
  15766. void setQDateEditProperties(QScriptValue value,QScriptEngine*engine)
  15767. {
  15768. setQDateTimeEditProperties(value,engine);
  15769. }
  15770. void setQDateTimeEditProperties(QScriptValue value,QScriptEngine*engine)
  15771. {
  15772. setQAbstractSpinBoxProperties(value,engine);
  15773. value.setProperty("setDate",engine->newFunction(QDateTimeEdit_setDate));
  15774. value.setProperty("day",engine->newFunction(QDateTimeEdit_day));
  15775. value.setProperty("month",engine->newFunction(QDateTimeEdit_month));
  15776. value.setProperty("year",engine->newFunction(QDateTimeEdit_year));
  15777. }
  15778. /*:234*//*235:*/
  15779. #line 5523 "./typica.w"
  15780. QScriptValue QDateTimeEdit_setDate(QScriptContext*context,QScriptEngine*)
  15781. {
  15782. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  15783. if(context->argumentCount()==3)
  15784. {
  15785. self->setDate(QDate(argument<int> (0,context),
  15786. argument<int> (1,context),
  15787. argument<int> (2,context)));
  15788. }
  15789. else
  15790. {
  15791. context->throwError("Incorrect number of arguments passed to "
  15792. "QDateTimeEdit::setDate(). This method takes three integer arguments "
  15793. "specifying the year, month, and day.");
  15794. }
  15795. return QScriptValue();
  15796. }
  15797. QScriptValue QDateTimeEdit_day(QScriptContext*context,QScriptEngine*)
  15798. {
  15799. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  15800. return QScriptValue(self->date().day());
  15801. }
  15802. QScriptValue QDateTimeEdit_month(QScriptContext*context,QScriptEngine*)
  15803. {
  15804. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  15805. return QScriptValue(self->date().month());
  15806. }
  15807. QScriptValue QDateTimeEdit_year(QScriptContext*context,QScriptEngine*)
  15808. {
  15809. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  15810. return QScriptValue(self->date().year());
  15811. }
  15812. /*:235*//*239:*/
  15813. #line 5590 "./typica.w"
  15814. QScriptValue findChildObject(QScriptContext*context,QScriptEngine*engine)
  15815. {
  15816. QObject*parent= argument<QObject*> (0,context);
  15817. QString name= argument<QString> (1,context);
  15818. QObject*object= parent->findChild<QObject*> (name);
  15819. QScriptValue value;
  15820. if(object)
  15821. {
  15822. value= engine->newQObject(object);
  15823. QString className= object->metaObject()->className();
  15824. /*240:*/
  15825. #line 5608 "./typica.w"
  15826. if(className=="TemperatureDisplay")
  15827. {
  15828. setTemperatureDisplayProperties(value,engine);
  15829. }
  15830. else if(className=="TimerDisplay")
  15831. {
  15832. setTimerDisplayProperties(value,engine);
  15833. }
  15834. else if(className=="QAction")
  15835. {
  15836. setQActionProperties(value,engine);
  15837. }
  15838. else if(className=="QBoxLayout")
  15839. {
  15840. setQBoxLayoutProperties(value,engine);
  15841. }
  15842. else if(className=="QDateEdit")
  15843. {
  15844. setQDateEditProperties(value,engine);
  15845. }
  15846. else if(className=="QDateTimeEdit")
  15847. {
  15848. setQDateTimeEditProperties(value,engine);
  15849. }
  15850. else if(className=="QFrame")
  15851. {
  15852. setQFrameProperties(value,engine);
  15853. }
  15854. else if(className=="QHBoxLayout")
  15855. {
  15856. setQBoxLayoutProperties(value,engine);
  15857. }
  15858. else if(className=="QLCDNumber")
  15859. {
  15860. setQLCDNumberProperties(value,engine);
  15861. }
  15862. else if(className=="QMenu")
  15863. {
  15864. setQMenuProperties(value,engine);
  15865. }
  15866. else if(className=="QMenuBar")
  15867. {
  15868. setQMenuBarProperties(value,engine);
  15869. }
  15870. else if(className=="QPushButton")
  15871. {
  15872. setQPushButtonProperties(value,engine);
  15873. }
  15874. else if(className=="QSplitter")
  15875. {
  15876. setQSplitterProperties(value,engine);
  15877. }
  15878. else if(className=="QTableView")
  15879. {
  15880. if(object->property("tabletype").isValid())
  15881. {
  15882. if(object->property("tabletype").toString()=="SaltTable")
  15883. {
  15884. setSaltTableProperties(value,engine);
  15885. }
  15886. }
  15887. }
  15888. else if(className=="QVBoxLayout")
  15889. {
  15890. setQBoxLayoutProperties(value,engine);
  15891. }
  15892. else if(className=="QWidget")
  15893. {
  15894. setQWidgetProperties(value,engine);
  15895. }
  15896. else if(className=="ScriptQMainWindow")
  15897. {
  15898. setQMainWindowProperties(value,engine);
  15899. }
  15900. else if(className=="SqlComboBox")
  15901. {
  15902. setSqlComboBoxProperties(value,engine);
  15903. }
  15904. else if(className=="SqlQueryView")
  15905. {
  15906. setSqlQueryViewProperties(value,engine);
  15907. }
  15908. else if(className=="ZoomLog")
  15909. {
  15910. setZoomLogProperties(value,engine);
  15911. }
  15912. else if(className=="QTextEdit")
  15913. {
  15914. setQTextEditProperties(value,engine);
  15915. }
  15916. else if(className=="QWebView")
  15917. {
  15918. setQWebViewProperties(value,engine);
  15919. }
  15920. else if(className=="QLineEdit")
  15921. {
  15922. setQLineEditProperties(value,engine);
  15923. }
  15924. /*:240*/
  15925. #line 5601 "./typica.w"
  15926. }
  15927. return value;
  15928. }
  15929. /*:239*//*242:*/
  15930. #line 5737 "./typica.w"
  15931. QScriptValue SaltTable_columnSum(QScriptContext*context,QScriptEngine*engine)
  15932. {
  15933. QTableView*self= getself<QTableView*> (context);
  15934. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  15935. QString datum;
  15936. double total= 0.0;
  15937. int column= argument<int> (0,context);
  15938. int role= argument<int> (1,context);
  15939. for(int i= 0;i<model->rowCount();i++)
  15940. {
  15941. datum= model->data(model->index(i,column),role).toString();
  15942. if(!datum.isEmpty())
  15943. {
  15944. total+= datum.toDouble();
  15945. }
  15946. }
  15947. return QScriptValue(engine,total);
  15948. }
  15949. /*:242*//*243:*/
  15950. #line 5761 "./typica.w"
  15951. QScriptValue SaltTable_columnArray(QScriptContext*context,
  15952. QScriptEngine*engine)
  15953. {
  15954. QTableView*self= getself<QTableView*> (context);
  15955. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  15956. int column= argument<int> (0,context);
  15957. int role= argument<int> (1,context);
  15958. QString literal= model->arrayLiteral(column,role);
  15959. return QScriptValue(engine,literal);
  15960. }
  15961. QScriptValue SaltTable_quotedColumnArray(QScriptContext*context,
  15962. QScriptEngine*engine)
  15963. {
  15964. QTableView*self= getself<QTableView*> (context);
  15965. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  15966. int column= argument<int> (0,context);
  15967. int role= argument<int> (1,context);
  15968. QString literal= model->quotedArrayLiteral(column,role);
  15969. return QScriptValue(engine,literal);
  15970. }
  15971. QScriptValue SaltTable_bindableColumnArray(QScriptContext*context,
  15972. QScriptEngine*engine)
  15973. {
  15974. QTableView*self= getself<QTableView*> (context);
  15975. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  15976. int column= argument<int> (0,context);
  15977. int role= argument<int> (1,context);
  15978. QString literal= model->arrayLiteral(column,role);
  15979. literal.chop(1);
  15980. literal= literal.remove(0,1);
  15981. return QScriptValue(engine,literal);
  15982. }
  15983. QScriptValue SaltTable_bindableQuotedColumnArray(QScriptContext*context,
  15984. QScriptEngine*engine)
  15985. {
  15986. QTableView*self= getself<QTableView*> (context);
  15987. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  15988. int column= argument<int> (0,context);
  15989. int role= argument<int> (1,context);
  15990. QString literal= model->quotedArrayLiteral(column,role);
  15991. literal.chop(1);
  15992. literal= literal.remove(0,1);
  15993. return QScriptValue(engine,literal);
  15994. }
  15995. /*:243*//*244:*/
  15996. #line 5813 "./typica.w"
  15997. QScriptValue SaltTable_model(QScriptContext*context,QScriptEngine*engine)
  15998. {
  15999. QTableView*self= getself<QTableView*> (context);
  16000. QScriptValue value= engine->newQObject(self->model());
  16001. return value;
  16002. }
  16003. /*:244*//*245:*/
  16004. #line 5827 "./typica.w"
  16005. QScriptValue SaltTable_setData(QScriptContext*context,QScriptEngine*)
  16006. {
  16007. QTableView*self= getself<QTableView*> (context);
  16008. int row= argument<int> (0,context);
  16009. int column= argument<int> (1,context);
  16010. QVariant value= argument<QVariant> (2,context);
  16011. int role= argument<int> (3,context);
  16012. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  16013. QModelIndex cell= model->index(row,column);
  16014. model->setData(cell,value,role);
  16015. self->update(cell);
  16016. return QScriptValue();
  16017. }
  16018. /*:245*//*246:*/
  16019. #line 5845 "./typica.w"
  16020. QScriptValue SaltTable_data(QScriptContext*context,QScriptEngine*engine)
  16021. {
  16022. QTableView*self= getself<QTableView*> (context);
  16023. int row= argument<int> (0,context);
  16024. int column= argument<int> (1,context);
  16025. int role= argument<int> (2,context);
  16026. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  16027. QModelIndex cell= model->index(row,column);
  16028. QVariant value= model->data(cell,role);
  16029. QScriptValue retval= engine->newVariant(value);
  16030. retval.setProperty("value",QScriptValue(value.toString()));
  16031. return retval;
  16032. }
  16033. /*:246*//*247:*/
  16034. #line 5865 "./typica.w"
  16035. QScriptValue SaltTable_clear(QScriptContext*context,QScriptEngine*)
  16036. {
  16037. QTableView*self= getself<QTableView*> (context);
  16038. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  16039. model->clear();
  16040. return QScriptValue();
  16041. }
  16042. /*:247*//*248:*/
  16043. #line 5877 "./typica.w"
  16044. QScriptValue SaltTable_removeRow(QScriptContext*context,QScriptEngine*engine)
  16045. {
  16046. QTableView*self= getself<QTableView*> (context);
  16047. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  16048. int row= argument<int> (0,context);
  16049. return engine->newVariant(model->removeRow(row));
  16050. }
  16051. /*:248*//*249:*/
  16052. #line 5890 "./typica.w"
  16053. QScriptValue SaltTable_findData(QScriptContext*context,QScriptEngine*engine)
  16054. {
  16055. QTableView*self= getself<QTableView*> (context);
  16056. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  16057. QVariant value= argument<QVariant> (0,context);
  16058. int column= argument<int> (1,context);
  16059. return engine->newVariant(model->findData(value,column));
  16060. }
  16061. /*:249*//*250:*/
  16062. #line 5903 "./typica.w"
  16063. void setSaltTableProperties(QScriptValue value,QScriptEngine*engine)
  16064. {
  16065. setQWidgetProperties(value,engine);
  16066. value.setProperty("columnArray",
  16067. engine->newFunction(SaltTable_columnArray));
  16068. value.setProperty("quotedColumnArray",
  16069. engine->newFunction(SaltTable_quotedColumnArray));
  16070. value.setProperty("bindableColumnArray",
  16071. engine->newFunction(SaltTable_bindableColumnArray));
  16072. value.setProperty("bindableQuotedColumnArray",
  16073. engine->newFunction(SaltTable_bindableQuotedColumnArray));
  16074. value.setProperty("columnSum",engine->newFunction(SaltTable_columnSum));
  16075. value.setProperty("data",engine->newFunction(SaltTable_data));
  16076. value.setProperty("model",engine->newFunction(SaltTable_model));
  16077. value.setProperty("setData",engine->newFunction(SaltTable_setData));
  16078. value.setProperty("clear",engine->newFunction(SaltTable_clear));
  16079. value.setProperty("removeRow",engine->newFunction(SaltTable_removeRow));
  16080. value.setProperty("findData",engine->newFunction(SaltTable_findData));
  16081. }
  16082. /*:250*//*252:*/
  16083. #line 5940 "./typica.w"
  16084. void setSqlComboBoxProperties(QScriptValue value,QScriptEngine*engine)
  16085. {
  16086. setQComboBoxProperties(value,engine);
  16087. }
  16088. void setQComboBoxProperties(QScriptValue value,QScriptEngine*engine)
  16089. {
  16090. setQWidgetProperties(value,engine);
  16091. value.setProperty("currentData",
  16092. engine->newFunction(QComboBox_currentData));
  16093. value.setProperty("addItem",engine->newFunction(QComboBox_addItem));
  16094. value.setProperty("setModel",engine->newFunction(QComboBox_setModel));
  16095. value.setProperty("findText",engine->newFunction(QComboBox_findText));
  16096. value.setProperty("findData",engine->newFunction(QComboBox_findData));
  16097. }
  16098. QScriptValue QComboBox_currentData(QScriptContext*context,
  16099. QScriptEngine*engine)
  16100. {
  16101. QComboBox*self= getself<QComboBox*> (context);
  16102. return QScriptValue(engine,
  16103. self->itemData(self->currentIndex()).toString());
  16104. }
  16105. QScriptValue QComboBox_addItem(QScriptContext*context,QScriptEngine*)
  16106. {
  16107. QComboBox*self= getself<QComboBox*> (context);
  16108. self->addItem(argument<QString> (0,context));
  16109. return QScriptValue();
  16110. }
  16111. QScriptValue QComboBox_setModel(QScriptContext*context,QScriptEngine*)
  16112. {
  16113. QComboBox*self= getself<QComboBox*> (context);
  16114. self->setModel(argument<QAbstractItemModel*> (0,context));
  16115. return QScriptValue();
  16116. }
  16117. QScriptValue QComboBox_findText(QScriptContext*context,QScriptEngine*engine)
  16118. {
  16119. QComboBox*self= getself<QComboBox*> (context);
  16120. return QScriptValue(engine,self->findText(argument<QString> (0,context)));
  16121. }
  16122. QScriptValue QComboBox_findData(QScriptContext*context,QScriptEngine*engine)
  16123. {
  16124. QComboBox*self= getself<QComboBox*> (context);
  16125. return QScriptValue(engine,self->findData(argument<QVariant> (0,context)));
  16126. }
  16127. #line 1 "./abouttypica.w"
  16128. /*:252*//*265:*/
  16129. #line 388 "./units.w"
  16130. QScriptValue Units_convertTemperature(QScriptContext*context,QScriptEngine*)
  16131. {
  16132. return QScriptValue(Units::convertTemperature(argument<double> (0,context),
  16133. argument<Units::Unit> (1,context),
  16134. argument<Units::Unit> (2,context)));
  16135. }
  16136. QScriptValue Units_convertRelativeTemperature(QScriptContext*context,
  16137. QScriptEngine*)
  16138. {
  16139. return QScriptValue(Units::convertRelativeTemperature(
  16140. argument<double> (0,context),
  16141. argument<Units::Unit> (1,context),
  16142. argument<Units::Unit> (2,context)));
  16143. }
  16144. QScriptValue Units_isTemperatureUnit(QScriptContext*context,QScriptEngine*)
  16145. {
  16146. return QScriptValue(Units::isTemperatureUnit(argument<Units::Unit> (0,context)));
  16147. }
  16148. QScriptValue Units_convertWeight(QScriptContext*context,QScriptEngine*)
  16149. {
  16150. return QScriptValue(Units::convertWeight(argument<double> (0,context),
  16151. argument<Units::Unit> (1,context),
  16152. argument<Units::Unit> (2,context)));
  16153. }
  16154. QScriptValue Units_isWeightUnit(QScriptContext*context,QScriptEngine*)
  16155. {
  16156. return QScriptValue(Units::isWeightUnit(argument<Units::Unit> (0,context)));
  16157. }
  16158. /*:265*//*268:*/
  16159. #line 436 "./units.w"
  16160. QScriptValue Unit_toScriptValue(QScriptEngine*engine,const Units::Unit&value)
  16161. {
  16162. return engine->newVariant(QVariant(value));
  16163. }
  16164. void Unit_fromScriptValue(const QScriptValue&sv,Units::Unit&value)
  16165. {
  16166. value= sv.toVariant().value<Units::Unit> ();
  16167. }
  16168. /*:268*//*278:*/
  16169. #line 149 "./measurement.w"
  16170. QScriptValue constructMeasurement(QScriptContext*context,QScriptEngine*engine)
  16171. {
  16172. QScriptValue object;
  16173. if(context->argumentCount()==2||context->argumentCount()==3)
  16174. {
  16175. double measurement= argument<double> (0,context);
  16176. QTime timestamp= argument<QTime> (1,context);
  16177. Units::Unit unit= Units::Fahrenheit;
  16178. if(context->argumentCount()==3)
  16179. {
  16180. unit= argument<Units::Unit> (2,context);
  16181. }
  16182. object= engine->toScriptValue<Measurement> (Measurement(measurement,timestamp,unit));
  16183. setMeasurementProperties(object,engine);
  16184. }
  16185. else
  16186. {
  16187. context->throwError("Incorrect number of arguments passed to "
  16188. "Measurement::Measurement(). This method takes two "
  16189. "or three arguments.");
  16190. }
  16191. return object;
  16192. }
  16193. /*:278*//*279:*/
  16194. #line 176 "./measurement.w"
  16195. void setMeasurementProperties(QScriptValue,QScriptEngine*)
  16196. {
  16197. }
  16198. /*:279*//*280:*/
  16199. #line 184 "./measurement.w"
  16200. QScriptValue Measurement_toScriptValue(QScriptEngine*engine,const Measurement&measurement)
  16201. {
  16202. QVariant var;
  16203. var.setValue(measurement);
  16204. return engine->newVariant(var);
  16205. }
  16206. void Measurement_fromScriptValue(const QScriptValue&value,Measurement&measurement)
  16207. {
  16208. measurement= value.toVariant().value<Measurement> ();
  16209. }
  16210. #line 6009 "./typica.w"
  16211. /*:280*//*298:*/
  16212. #line 6586 "./typica.w"
  16213. QScriptValue constructDAQ(QScriptContext*context,QScriptEngine*engine)
  16214. {
  16215. QScriptValue object;
  16216. if(context->argumentCount()==1)
  16217. {
  16218. object= engine->newQObject(new DAQ(argument<QString> (0,context)),
  16219. QScriptEngine::ScriptOwnership);
  16220. setDAQProperties(object,engine);
  16221. }
  16222. else if(context->argumentCount()==2)
  16223. {
  16224. object= engine->newQObject(new DAQ(argument<QString> (0,context),
  16225. argument<QString> (1,context)),
  16226. QScriptEngine::ScriptOwnership);
  16227. setDAQProperties(object,engine);
  16228. }
  16229. else
  16230. {
  16231. context->throwError("Incorrect number of arguments passed to DAQ"
  16232. "constructor. The DAQ constructor takes one"
  16233. "string as an argument specifying a device name."
  16234. "Example: Dev1");
  16235. }
  16236. return object;
  16237. }
  16238. /*:298*//*299:*/
  16239. #line 6616 "./typica.w"
  16240. void setDAQProperties(QScriptValue value,QScriptEngine*engine)
  16241. {
  16242. setQObjectProperties(value,engine);
  16243. value.setProperty("newChannel",engine->newFunction(DAQ_newChannel));
  16244. }
  16245. /*:299*//*300:*/
  16246. #line 6626 "./typica.w"
  16247. QScriptValue DAQ_newChannel(QScriptContext*context,QScriptEngine*engine)
  16248. {
  16249. DAQ*self= getself<DAQ*> (context);
  16250. QScriptValue object;
  16251. if(self)
  16252. {
  16253. object=
  16254. engine->newQObject(self->newChannel(argument<int> (0,context),
  16255. argument<int> (1,context)));
  16256. setChannelProperties(object,engine);
  16257. }
  16258. return object;
  16259. }
  16260. /*:300*//*307:*/
  16261. #line 6782 "./typica.w"
  16262. QScriptValue constructFakeDAQ(QScriptContext*context,
  16263. QScriptEngine*engine)
  16264. {
  16265. QScriptValue object;
  16266. if(context->argumentCount()==1)
  16267. {
  16268. object=
  16269. engine->newQObject(new FakeDAQ(argument<QString> (0,context)),
  16270. QScriptEngine::ScriptOwnership);
  16271. setFakeDAQProperties(object,engine);
  16272. }
  16273. else
  16274. {
  16275. context->throwError("Incorrect number of arguments passed to DAQ"
  16276. "constructor. The DAQ constructor takes one"
  16277. "string as an argument specifying a device name."
  16278. "Example: Dev1");
  16279. }
  16280. return object;
  16281. }
  16282. void setFakeDAQProperties(QScriptValue value,QScriptEngine*engine)
  16283. {
  16284. setQObjectProperties(value,engine);
  16285. value.setProperty("newChannel",engine->newFunction(FakeDAQ_newChannel));
  16286. }
  16287. QScriptValue FakeDAQ_newChannel(QScriptContext*context,QScriptEngine*engine)
  16288. {
  16289. FakeDAQ*self= getself<FakeDAQ*> (context);
  16290. QScriptValue object;
  16291. if(self)
  16292. {
  16293. object=
  16294. engine->newQObject(self->newChannel(argument<int> (0,context),
  16295. argument<int> (1,context)));
  16296. setChannelProperties(object,engine);
  16297. }
  16298. return object;
  16299. }
  16300. /*:307*//*311:*/
  16301. #line 6873 "./typica.w"
  16302. void setChannelProperties(QScriptValue value,QScriptEngine*engine)
  16303. {
  16304. setQObjectProperties(value,engine);
  16305. }
  16306. /*:311*//*318:*/
  16307. #line 7065 "./typica.w"
  16308. QScriptValue constructLinearCalibrator(QScriptContext*,QScriptEngine*engine)
  16309. {
  16310. QScriptValue object= engine->newQObject(new LinearCalibrator(NULL));
  16311. setLinearCalibratorProperties(object,engine);
  16312. return object;
  16313. }
  16314. void setLinearCalibratorProperties(QScriptValue value,QScriptEngine*engine)
  16315. {
  16316. setQObjectProperties(value,engine);
  16317. }
  16318. /*:318*//*323:*/
  16319. #line 7203 "./typica.w"
  16320. QScriptValue constructLinearSplineInterpolator(QScriptContext*,QScriptEngine*engine)
  16321. {
  16322. QScriptValue object= engine->newQObject(new LinearSplineInterpolator(NULL));
  16323. setLinearSplineInterpolatorProperties(object,engine);
  16324. return object;
  16325. }
  16326. void setLinearSplineInterpolatorProperties(QScriptValue value,QScriptEngine*engine)
  16327. {
  16328. setQObjectProperties(value,engine);
  16329. }
  16330. /*:323*//*333:*/
  16331. #line 7409 "./typica.w"
  16332. QScriptValue constructTemperatureDisplay(QScriptContext*,
  16333. QScriptEngine*engine)
  16334. {
  16335. QScriptValue object= engine->newQObject(new TemperatureDisplay);
  16336. setTemperatureDisplayProperties(object,engine);
  16337. return object;
  16338. }
  16339. void setTemperatureDisplayProperties(QScriptValue value,QScriptEngine*engine)
  16340. {
  16341. setQLCDNumberProperties(value,engine);
  16342. value.setProperty("setDisplayUnits",
  16343. engine->newFunction(TemperatureDisplay_setDisplayUnits));
  16344. }
  16345. /*:333*//*334:*/
  16346. #line 7433 "./typica.w"
  16347. QScriptValue TemperatureDisplay_setDisplayUnits(QScriptContext*context,QScriptEngine*)
  16348. {
  16349. TemperatureDisplay*self= getself<TemperatureDisplay*> (context);
  16350. self->setDisplayUnits((Units::Unit)argument<int> (0,context));
  16351. return QScriptValue();
  16352. }
  16353. /*:334*//*341:*/
  16354. #line 7570 "./typica.w"
  16355. QScriptValue constructMeasurementTimeOffset(QScriptContext*,
  16356. QScriptEngine*engine)
  16357. {
  16358. QScriptValue object=
  16359. engine->newQObject(new MeasurementTimeOffset(QTime::currentTime()));
  16360. setMeasurementTimeOffsetProperties(object,engine);
  16361. return object;
  16362. }
  16363. void setMeasurementTimeOffsetProperties(QScriptValue value,
  16364. QScriptEngine*engine)
  16365. {
  16366. setQObjectProperties(value,engine);
  16367. }
  16368. /*:341*//*346:*/
  16369. #line 7679 "./typica.w"
  16370. QScriptValue constructThresholdDetector(QScriptContext*,QScriptEngine*engine)
  16371. {
  16372. QScriptValue object= engine->newQObject(new ThresholdDetector(300));
  16373. return object;
  16374. }
  16375. void setThresholdDetectorProperties(QScriptValue value,QScriptEngine*engine)
  16376. {
  16377. setQObjectProperties(value,engine);
  16378. }
  16379. /*:346*//*351:*/
  16380. #line 7776 "./typica.w"
  16381. QScriptValue constructZeroEmitter(QScriptContext*context,
  16382. QScriptEngine*engine)
  16383. {
  16384. QScriptValue object=
  16385. engine->newQObject(new ZeroEmitter(argument<int> (0,context)));
  16386. setZeroEmitterProperties(object,engine);
  16387. return object;
  16388. }
  16389. void setZeroEmitterProperties(QScriptValue value,QScriptEngine*engine)
  16390. {
  16391. setQObjectProperties(value,engine);
  16392. }
  16393. /*:351*//*356:*/
  16394. #line 7856 "./typica.w"
  16395. QScriptValue constructMeasurementAdapter(QScriptContext*context,
  16396. QScriptEngine*engine)
  16397. {
  16398. QScriptValue object=
  16399. engine->newQObject(new MeasurementAdapter(argument<int> (0,context)));
  16400. setMeasurementAdapterProperties(object,engine);
  16401. return object;
  16402. }
  16403. void setMeasurementAdapterProperties(QScriptValue value,QScriptEngine*engine)
  16404. {
  16405. setQObjectProperties(value,engine);
  16406. }
  16407. /*:356*//*373:*/
  16408. #line 8318 "./typica.w"
  16409. QScriptValue constructGraphView(QScriptContext*,QScriptEngine*engine)
  16410. {
  16411. QScriptValue object= engine->newQObject(new GraphView);
  16412. setGraphViewProperties(object,engine);
  16413. return object;
  16414. }
  16415. void setGraphViewProperties(QScriptValue value,QScriptEngine*engine)
  16416. {
  16417. setQGraphicsViewProperties(value,engine);
  16418. }
  16419. /*:373*//*396:*/
  16420. #line 8956 "./typica.w"
  16421. QScriptValue constructZoomLog(QScriptContext*,QScriptEngine*engine)
  16422. {
  16423. QScriptValue object= engine->newQObject(new ZoomLog);
  16424. setZoomLogProperties(object,engine);
  16425. return object;
  16426. }
  16427. void setZoomLogProperties(QScriptValue value,QScriptEngine*engine)
  16428. {
  16429. setQTableViewProperties(value,engine);
  16430. value.setProperty("saveXML",engine->newFunction(ZoomLog_saveXML));
  16431. value.setProperty("saveCSV",engine->newFunction(ZoomLog_saveCSV));
  16432. value.setProperty("saveState",engine->newFunction(ZoomLog_saveState));
  16433. value.setProperty("restoreState",
  16434. engine->newFunction(ZoomLog_restoreState));
  16435. value.setProperty("lastTime",engine->newFunction(ZoomLog_lastTime));
  16436. value.setProperty("saveTemporary",
  16437. engine->newFunction(ZoomLog_saveTemporary));
  16438. value.setProperty("setDisplayUnits",engine->newFunction(ZoomLog_setDisplayUnits));
  16439. }
  16440. /*:396*//*397:*/
  16441. #line 8983 "./typica.w"
  16442. QScriptValue ZoomLog_saveXML(QScriptContext*context,QScriptEngine*engine)
  16443. {
  16444. ZoomLog*self= getself<ZoomLog*> (context);
  16445. bool retval= self->saveXML(argument<QIODevice*> (0,context));
  16446. return QScriptValue(engine,retval);
  16447. }
  16448. QScriptValue ZoomLog_saveCSV(QScriptContext*context,QScriptEngine*engine)
  16449. {
  16450. ZoomLog*self= getself<ZoomLog*> (context);
  16451. bool retval= self->saveCSV(argument<QIODevice*> (0,context));
  16452. return QScriptValue(engine,retval);
  16453. }
  16454. QScriptValue ZoomLog_saveTemporary(QScriptContext*context,
  16455. QScriptEngine*engine)
  16456. {
  16457. ZoomLog*self= getself<ZoomLog*> (context);
  16458. QString filename= QDir::tempPath();
  16459. filename.append("/");
  16460. filename.append(QUuid::createUuid().toString());
  16461. filename.append(".xml");
  16462. QFile*file= new QFile(filename);
  16463. self->saveXML(file);
  16464. file->close();
  16465. delete file;
  16466. return QScriptValue(engine,filename);
  16467. }
  16468. /*:397*//*398:*/
  16469. #line 9031 "./typica.w"
  16470. QScriptValue ZoomLog_saveState(QScriptContext*context,QScriptEngine*)
  16471. {
  16472. ZoomLog*self= getself<ZoomLog*> (context);
  16473. QString key= argument<QString> (0,context);
  16474. int columns= argument<int> (1,context);
  16475. QSettings settings;
  16476. for(int i= 0;i<columns;i++)
  16477. {
  16478. if(self->columnWidth(i))
  16479. {
  16480. settings.beginGroup(key);
  16481. settings.setValue(QString("%1").arg(i),self->columnWidth(i));
  16482. settings.endGroup();
  16483. }
  16484. }
  16485. return QScriptValue();
  16486. }
  16487. QScriptValue ZoomLog_restoreState(QScriptContext*context,QScriptEngine*)
  16488. {
  16489. ZoomLog*self= getself<ZoomLog*> (context);
  16490. QString key= argument<QString> (0,context);
  16491. int columns= argument<int> (1,context);
  16492. QSettings settings;
  16493. for(int i= 0;i<columns;i++)
  16494. {
  16495. settings.beginGroup(key);
  16496. self->setColumnWidth(i,
  16497. settings.value(QString("%1").arg(i),80).toInt());
  16498. if(settings.value(QString("%1").arg(i),80).toInt()==0)
  16499. {
  16500. self->setColumnWidth(i,80);
  16501. }
  16502. settings.endGroup();
  16503. }
  16504. return QScriptValue();
  16505. }
  16506. QScriptValue ZoomLog_lastTime(QScriptContext*context,QScriptEngine*engine)
  16507. {
  16508. ZoomLog*self= getself<ZoomLog*> (context);
  16509. return QScriptValue(engine,self->lastTime(argument<int> (0,context)));
  16510. }
  16511. /*:398*//*399:*/
  16512. #line 9084 "./typica.w"
  16513. QScriptValue ZoomLog_setDisplayUnits(QScriptContext*context,QScriptEngine*)
  16514. {
  16515. ZoomLog*self= getself<ZoomLog*> (context);
  16516. self->setDisplayUnits((Units::Unit)argument<int> (0,context));
  16517. return QScriptValue();
  16518. }
  16519. /*:399*//*434:*/
  16520. #line 9904 "./typica.w"
  16521. QScriptValue constructAnnotationButton(QScriptContext*context,
  16522. QScriptEngine*engine)
  16523. {
  16524. QScriptValue object=
  16525. engine->newQObject(new AnnotationButton(argument<QString> (0,context)));
  16526. setAnnotationButtonProperties(object,engine);
  16527. return object;
  16528. }
  16529. void setAnnotationButtonProperties(QScriptValue value,QScriptEngine*engine)
  16530. {
  16531. setQPushButtonProperties(value,engine);
  16532. }
  16533. /*:434*//*442:*/
  16534. #line 10047 "./typica.w"
  16535. QScriptValue constructAnnotationSpinBox(QScriptContext*context,
  16536. QScriptEngine*engine)
  16537. {
  16538. QScriptValue object= engine->newQObject(new AnnotationSpinBox(
  16539. argument<QString> (0,context),argument<QString> (1,context)));
  16540. setAnnotationSpinBoxProperties(object,engine);
  16541. return object;
  16542. }
  16543. void setAnnotationSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  16544. {
  16545. setQDoubleSpinBoxProperties(value,engine);
  16546. }
  16547. void setQDoubleSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  16548. {
  16549. setQAbstractSpinBoxProperties(value,engine);
  16550. }
  16551. void setQAbstractSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  16552. {
  16553. setQWidgetProperties(value,engine);
  16554. }
  16555. /*:442*//*463:*/
  16556. #line 10466 "./typica.w"
  16557. QScriptValue constructTimerDisplay(QScriptContext*,QScriptEngine*engine)
  16558. {
  16559. QScriptValue object= engine->newQObject(new TimerDisplay);
  16560. setTimerDisplayProperties(object,engine);
  16561. return object;
  16562. }
  16563. void setTimerDisplayProperties(QScriptValue value,QScriptEngine*engine)
  16564. {
  16565. setQLCDNumberProperties(value,engine);
  16566. }
  16567. /*:463*//*490:*/
  16568. #line 10961 "./typica.w"
  16569. QScriptValue constructWidgetDecorator(QScriptContext*context,
  16570. QScriptEngine*engine)
  16571. {
  16572. QWidget*widget= argument<QWidget*> (0,context);
  16573. QString text= argument<QString> (1,context);
  16574. Qt::Orientations orientation;
  16575. switch(argument<int> (2,context))
  16576. {
  16577. case 2:
  16578. orientation= Qt::Vertical;
  16579. break;
  16580. default:
  16581. orientation= Qt::Horizontal;
  16582. break;
  16583. }
  16584. QScriptValue object=
  16585. engine->newQObject(new WidgetDecorator(widget,text,orientation));
  16586. setWidgetDecoratorProperties(object,engine);
  16587. return object;
  16588. }
  16589. void setWidgetDecoratorProperties(QScriptValue value,QScriptEngine*engine)
  16590. {
  16591. setQWidgetProperties(value,engine);
  16592. }
  16593. /*:490*//*503:*/
  16594. #line 11242 "./typica.w"
  16595. QScriptValue constructLogEditWindow(QScriptContext*,QScriptEngine*engine)
  16596. {
  16597. QScriptValue object= engine->newQObject(new LogEditWindow);
  16598. return object;
  16599. }
  16600. /*:503*//*522:*/
  16601. #line 11770 "./typica.w"
  16602. QScriptValue constructXMLInput(QScriptContext*context,QScriptEngine*engine)
  16603. {
  16604. QIODevice*device= argument<QIODevice*> (0,context);
  16605. QScriptValue object= engine->newQObject(new XMLInput(&*device,
  16606. argument<int> (1,context)));
  16607. object.setProperty("input",engine->newFunction(XMLInput_input));
  16608. return object;
  16609. }
  16610. QScriptValue XMLInput_input(QScriptContext*context,QScriptEngine*)
  16611. {
  16612. XMLInput*self= getself<XMLInput*> (context);
  16613. self->input();
  16614. return QScriptValue();
  16615. }
  16616. /*:522*//*536:*/
  16617. #line 157 "./webview.w"
  16618. QScriptValue constructWebView(QScriptContext*,QScriptEngine*engine)
  16619. {
  16620. QScriptValue object= engine->newQObject(new TypicaWebView);
  16621. setQWebViewProperties(object,engine);
  16622. return object;
  16623. }
  16624. void setQWebViewProperties(QScriptValue value,QScriptEngine*engine)
  16625. {
  16626. setQWidgetProperties(value,engine);
  16627. }
  16628. /*:536*//*537:*/
  16629. #line 174 "./webview.w"
  16630. void addWebViewToLayout(QDomElement element,QStack<QWidget*> *,
  16631. QStack<QLayout*> *layoutStack)
  16632. {
  16633. TypicaWebView*view= new TypicaWebView;
  16634. if(element.hasAttribute("id"))
  16635. {
  16636. view->setObjectName(element.attribute("id"));
  16637. }
  16638. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16639. layout->addWidget(view);
  16640. }
  16641. /*:537*//*542:*/
  16642. #line 225 "./webview.w"
  16643. QScriptValue QWebElement_toScriptValue(QScriptEngine*engine,const QWebElement&element)
  16644. {
  16645. QVariant var;
  16646. var.setValue(element);
  16647. QScriptValue object= engine->newVariant(var);
  16648. return object;
  16649. }
  16650. void QWebElement_fromScriptValue(const QScriptValue&value,QWebElement&element)
  16651. {
  16652. element= value.toVariant().value<QWebElement> ();
  16653. }
  16654. /*:542*//*547:*/
  16655. #line 290 "./webview.w"
  16656. template<> QWebElement argument(int arg,QScriptContext*context)
  16657. {
  16658. return qscriptvalue_cast<QWebElement> (context->argument(arg));
  16659. }
  16660. /*:547*//*548:*/
  16661. #line 299 "./webview.w"
  16662. QScriptValue constructWebElement(QScriptContext*context,
  16663. QScriptEngine*engine)
  16664. {
  16665. QWebElement element= argument<QWebElement> (0,context);
  16666. QScriptValue object= engine->newQObject(new TypicaWebElement(element));
  16667. return object;
  16668. }
  16669. /*:548*//*616:*/
  16670. #line 13115 "./typica.w"
  16671. QScriptValue constructSqlQueryView(QScriptContext*,QScriptEngine*engine)
  16672. {
  16673. QScriptValue object= engine->newQObject(new SqlQueryView);
  16674. setSqlQueryViewProperties(object,engine);
  16675. return object;
  16676. }
  16677. void setSqlQueryViewProperties(QScriptValue value,QScriptEngine*engine)
  16678. {
  16679. setQTableViewProperties(value,engine);
  16680. value.setProperty("setHeaderData",
  16681. engine->newFunction(SqlQueryView_setHeaderData));
  16682. value.setProperty("setQuery",engine->newFunction(SqlQueryView_setQuery));
  16683. }
  16684. /*:616*//*617:*/
  16685. #line 13133 "./typica.w"
  16686. QScriptValue SqlQueryView_setQuery(QScriptContext*context,QScriptEngine*)
  16687. {
  16688. SqlQueryView*self= getself<SqlQueryView*> (context);
  16689. QString query= argument<QString> (0,context);
  16690. self->setQuery(query);
  16691. self->reset();
  16692. return QScriptValue();
  16693. }
  16694. QScriptValue SqlQueryView_setHeaderData(QScriptContext*context,
  16695. QScriptEngine*)
  16696. {
  16697. SqlQueryView*self= getself<SqlQueryView*> (context);
  16698. int section= argument<int> (0,context);
  16699. QString data= argument<QString> (1,context);
  16700. self->setHeaderData(section,Qt::Horizontal,data,Qt::DisplayRole);
  16701. return QScriptValue();
  16702. }
  16703. /*:617*//*625:*/
  16704. #line 13340 "./typica.w"
  16705. void addReportToLayout(QDomElement element,QStack<QWidget*> *,
  16706. QStack<QLayout*> *layoutStack)
  16707. {
  16708. QTextEdit*widget= new QTextEdit;
  16709. if(element.hasAttribute("id"))
  16710. {
  16711. widget->setObjectName(element.attribute("id"));
  16712. }
  16713. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16714. layout->addWidget(widget);
  16715. QTextDocument*document= new QTextDocument;
  16716. QFont defaultFont;
  16717. defaultFont.setPointSize(11);
  16718. document->setDefaultFont(defaultFont);
  16719. QTextCursor cursor(document);
  16720. /*626:*/
  16721. #line 13363 "./typica.w"
  16722. QDomNodeList children= element.childNodes();
  16723. for(int i= 0;i<children.count();i++)
  16724. {
  16725. QDomNode current;
  16726. QDomElement currentElement;
  16727. current= children.at(i);
  16728. if(current.isElement())
  16729. {
  16730. currentElement= current.toElement();
  16731. /*627:*/
  16732. #line 13380 "./typica.w"
  16733. if(currentElement.tagName()=="style")
  16734. {
  16735. document->setDefaultStyleSheet(currentElement.text());
  16736. }
  16737. /*:627*//*628:*/
  16738. #line 13391 "./typica.w"
  16739. if(currentElement.tagName()=="html")
  16740. {
  16741. cursor.insertHtml(currentElement.text());
  16742. }
  16743. /*:628*//*629:*/
  16744. #line 13401 "./typica.w"
  16745. if(currentElement.tagName()=="text")
  16746. {
  16747. cursor.insertText(currentElement.text());
  16748. }
  16749. /*:629*//*630:*/
  16750. #line 13411 "./typica.w"
  16751. if(currentElement.tagName()=="table")
  16752. {
  16753. QTextFrame*frame= cursor.insertFrame(QTextFrameFormat());
  16754. ReportTable*table= new ReportTable(frame,currentElement);
  16755. table->setParent(widget);
  16756. if(currentElement.hasAttribute("id"))
  16757. {
  16758. table->setObjectName(currentElement.attribute("id"));
  16759. }
  16760. }
  16761. /*:630*/
  16762. #line 13373 "./typica.w"
  16763. }
  16764. }
  16765. /*:626*/
  16766. #line 13356 "./typica.w"
  16767. widget->setDocument(document);
  16768. }
  16769. /*:625*//*641:*/
  16770. #line 13624 "./typica.w"
  16771. QScriptValue QTextEdit_print(QScriptContext*context,QScriptEngine*)
  16772. {
  16773. QTextEdit*self= getself<QTextEdit*> (context);
  16774. QTextDocument*document= self->document();
  16775. QPrinter printer;
  16776. QPrintDialog printwindow(&printer,self);
  16777. if(printwindow.exec()!=QDialog::Accepted)
  16778. {
  16779. return QScriptValue();
  16780. }
  16781. document->print(&printer);
  16782. return QScriptValue();
  16783. }
  16784. /*:641*//*642:*/
  16785. #line 13642 "./typica.w"
  16786. void setQTextEditProperties(QScriptValue value,QScriptEngine*engine)
  16787. {
  16788. setQAbstractScrollAreaProperties(value,engine);
  16789. value.setProperty("print",engine->newFunction(QTextEdit_print));
  16790. }
  16791. #line 1 "./daterangeselector.w"
  16792. /*:642*//*661:*/
  16793. #line 450 "./daterangeselector.w"
  16794. void addDateRangeToLayout(QDomElement element,QStack<QWidget*> *,
  16795. QStack<QLayout*> *layoutStack)
  16796. {
  16797. DateRangeSelector*widget= new DateRangeSelector;
  16798. if(element.hasAttribute("id"))
  16799. {
  16800. widget->setObjectName(element.attribute("id"));
  16801. }
  16802. if(element.hasAttribute("initial"))
  16803. {
  16804. widget->setCurrentIndex(element.attribute("initial").toInt());
  16805. }
  16806. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16807. layout->addWidget(widget);
  16808. }
  16809. /*:661*//*672:*/
  16810. #line 13822 "./typica.w"
  16811. void addFormArrayToLayout(QDomElement element,QStack<QWidget*> *,
  16812. QStack<QLayout*> *layoutStack)
  16813. {
  16814. FormArray*widget= new FormArray(element);
  16815. if(element.hasAttribute("id"))
  16816. {
  16817. widget->setObjectName(element.attribute("id"));
  16818. }
  16819. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16820. layout->addWidget(widget);
  16821. }
  16822. /*:672*//*693:*/
  16823. #line 14409 "./typica.w"
  16824. void addScaleControlToLayout(QDomElement element,QStack<QWidget*> *,
  16825. QStack<QLayout*> *layoutStack)
  16826. {
  16827. ScaleControl*scale= new ScaleControl;
  16828. if(element.hasAttribute("id"))
  16829. {
  16830. scale->setObjectName(element.attribute("id"));
  16831. }
  16832. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16833. layout->addWidget(scale);
  16834. }
  16835. void addIntensityControlToLayout(QDomElement element,QStack<QWidget*> *,
  16836. QStack<QLayout*> *layoutStack)
  16837. {
  16838. IntensityControl*scale= new IntensityControl;
  16839. if(element.hasAttribute("id"))
  16840. {
  16841. scale->setObjectName(element.attribute("id"));
  16842. }
  16843. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16844. layout->addWidget(scale);
  16845. }
  16846. /*:693*//*719:*/
  16847. #line 14999 "./typica.w"
  16848. QScriptValue constructDeviceTreeModel(QScriptContext*,QScriptEngine*engine)
  16849. {
  16850. QScriptValue object= engine->newQObject(new DeviceTreeModel);
  16851. setDeviceTreeModelProperties(object,engine);
  16852. return object;
  16853. }
  16854. /*:719*//*721:*/
  16855. #line 15022 "./typica.w"
  16856. void setDeviceTreeModelProperties(QScriptValue value,QScriptEngine*engine)
  16857. {
  16858. setQAbstractItemModelProperties(value,engine);
  16859. value.setProperty("referenceElement",
  16860. engine->newFunction(DeviceTreeModel_referenceElement));
  16861. }
  16862. void setQAbstractItemModelProperties(QScriptValue value,QScriptEngine*engine)
  16863. {
  16864. setQObjectProperties(value,engine);
  16865. value.setProperty("data",engine->newFunction(QAbstractItemModel_data));
  16866. value.setProperty("index",engine->newFunction(QAbstractItemModel_index));
  16867. value.setProperty("rowCount",engine->newFunction(QAbstractItemModel_rowCount));
  16868. value.setProperty("hasChildren",engine->newFunction(QAbstractItemModel_hasChildren));
  16869. }
  16870. /*:721*//*722:*/
  16871. #line 15049 "./typica.w"
  16872. QScriptValue DeviceTreeModel_referenceElement(QScriptContext*context,
  16873. QScriptEngine*engine)
  16874. {
  16875. DeviceTreeModel*model= getself<DeviceTreeModel*> (context);
  16876. QDomElement referenceElement= model->referenceElement(argument<QString> (0,context));
  16877. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  16878. QDomElement node;
  16879. QVariantMap retval;
  16880. retval.insert("driver",referenceElement.attribute("driver"));
  16881. for(int i= 0;i<configData.size();i++)
  16882. {
  16883. node= configData.at(i).toElement();
  16884. retval.insert(node.attribute("name"),node.attribute("value"));
  16885. }
  16886. return engine->toScriptValue(retval);
  16887. }
  16888. QScriptValue QAbstractItemModel_data(QScriptContext*context,QScriptEngine*engine)
  16889. {
  16890. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  16891. QModelIndex index= argument<QModelIndex> (0,context);
  16892. int role= argument<int> (1,context);
  16893. return engine->toScriptValue(model->data(index,role));
  16894. }
  16895. QScriptValue QAbstractItemModel_index(QScriptContext*context,QScriptEngine*engine)
  16896. {
  16897. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  16898. int row= 0;
  16899. int column= 0;
  16900. QModelIndex index;
  16901. if(context->argumentCount()> 1)
  16902. {
  16903. row= argument<int> (0,context);
  16904. column= argument<int> (1,context);
  16905. }
  16906. if(context->argumentCount()> 2)
  16907. {
  16908. index= argument<QModelIndex> (2,context);
  16909. }
  16910. QModelIndex retval= model->index(row,column,index);
  16911. return engine->toScriptValue(retval);
  16912. }
  16913. QScriptValue QAbstractItemModel_rowCount(QScriptContext*context,
  16914. QScriptEngine*)
  16915. {
  16916. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  16917. QModelIndex index;
  16918. if(context->argumentCount()==1)
  16919. {
  16920. index= argument<QModelIndex> (0,context);
  16921. }
  16922. return QScriptValue(model->rowCount(index));
  16923. }
  16924. QScriptValue QAbstractItemModel_hasChildren(QScriptContext*context,
  16925. QScriptEngine*engine)
  16926. {
  16927. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  16928. QModelIndex index;
  16929. if(context->argumentCount()==1)
  16930. {
  16931. index= argument<QModelIndex> (0,context);
  16932. }
  16933. return QScriptValue(engine,model->hasChildren(index));
  16934. }
  16935. /*:722*//*725:*/
  16936. #line 15133 "./typica.w"
  16937. QScriptValue QModelIndex_toScriptValue(QScriptEngine*engine,const QModelIndex&index)
  16938. {
  16939. QVariant var;
  16940. var.setValue(index);
  16941. QScriptValue object= engine->newVariant(var);
  16942. return object;
  16943. }
  16944. void QModelIndex_fromScriptValue(const QScriptValue&value,QModelIndex&index)
  16945. {
  16946. index= value.toVariant().value<QModelIndex> ();
  16947. }
  16948. /*:725*//*741:*/
  16949. #line 15431 "./typica.w"
  16950. QScriptValue constructDeviceConfigurationWindow(QScriptContext*,
  16951. QScriptEngine*engine)
  16952. {
  16953. QScriptValue object= engine->newQObject(new DeviceConfigurationWindow);
  16954. return object;
  16955. }
  16956. /*:741*//*812:*/
  16957. #line 45 "./settings.w"
  16958. QScriptValue constructSettingsWindow(QScriptContext*,QScriptEngine*engine)
  16959. {
  16960. QScriptValue object= engine->newQObject(new SettingsWindow);
  16961. return object;
  16962. }
  16963. /*:812*//*832:*/
  16964. #line 17980 "./typica.w"
  16965. QScriptValue constructModbusRTUDevice(QScriptContext*context,QScriptEngine*engine)
  16966. {
  16967. QScriptValue object;
  16968. if(context->argumentCount()==2)
  16969. {
  16970. object= engine->newQObject(new ModbusRTUDevice(argument<DeviceTreeModel*> (0,context),
  16971. argument<QModelIndex> (1,context)),
  16972. QScriptEngine::ScriptOwnership);
  16973. setModbusRTUDeviceProperties(object,engine);
  16974. }
  16975. else
  16976. {
  16977. context->throwError("Incorrect number of arguments passed to "
  16978. "ModbusRTUDevice constructor. This takes the configuration model "
  16979. "and an index.");
  16980. }
  16981. return object;
  16982. }
  16983. /*:832*//*833:*/
  16984. #line 18002 "./typica.w"
  16985. QScriptValue ModbusRTUDevice_pVChannel(QScriptContext*context,QScriptEngine*engine)
  16986. {
  16987. ModbusRTUDevice*self= getself<ModbusRTUDevice*> (context);
  16988. QScriptValue object;
  16989. if(self)
  16990. {
  16991. if(self->channels.size()> 0)
  16992. {
  16993. object= engine->newQObject(self->channels.at(0));
  16994. setChannelProperties(object,engine);
  16995. }
  16996. }
  16997. return object;
  16998. }
  16999. QScriptValue ModbusRTUDevice_sVChannel(QScriptContext*context,QScriptEngine*engine)
  17000. {
  17001. ModbusRTUDevice*self= getself<ModbusRTUDevice*> (context);
  17002. QScriptValue object;
  17003. if(self)
  17004. {
  17005. if(self->channels.size()> 1)
  17006. {
  17007. object= engine->newQObject(self->channels.at(1));
  17008. setChannelProperties(object,engine);
  17009. }
  17010. }
  17011. return object;
  17012. }
  17013. /*:833*//*834:*/
  17014. #line 18035 "./typica.w"
  17015. void setModbusRTUDeviceProperties(QScriptValue value,QScriptEngine*engine)
  17016. {
  17017. setQObjectProperties(value,engine);
  17018. value.setProperty("pVChannel",engine->newFunction(ModbusRTUDevice_pVChannel));
  17019. value.setProperty("sVChannel",engine->newFunction(ModbusRTUDevice_sVChannel));
  17020. }
  17021. /*:834*//*852:*/
  17022. #line 357 "./unsupportedserial.w"
  17023. QScriptValue createDevice(QScriptContext*context,QScriptEngine*engine)
  17024. {
  17025. QModelIndex deviceIndex= argument<QModelIndex> (0,context);
  17026. JavaScriptDevice*device= new JavaScriptDevice(deviceIndex,engine);
  17027. QScriptValue object= engine->newQObject(device);
  17028. setQObjectProperties(object,engine);
  17029. object.setProperty("getChannel",engine->newFunction(JavaScriptDevice_getChannel));
  17030. return object;
  17031. }
  17032. /*:852*//*857:*/
  17033. #line 430 "./unsupportedserial.w"
  17034. QScriptValue JavaScriptDevice_getChannel(QScriptContext*context,QScriptEngine*engine)
  17035. {
  17036. JavaScriptDevice*self= getself<JavaScriptDevice*> (context);
  17037. QScriptValue object;
  17038. if(self)
  17039. {
  17040. object= engine->newQObject(self->getChannel(argument<int> (0,context)));
  17041. setChannelProperties(object,engine);
  17042. }
  17043. return object;
  17044. }
  17045. /*:857*//*864:*/
  17046. #line 630 "./unsupportedserial.w"
  17047. QScriptValue getMeasurementTimestamp(QScriptContext*,QScriptEngine*engine)
  17048. {
  17049. return engine->toScriptValue<QTime> (QTime::currentTime());
  17050. }
  17051. /*:864*//*868:*/
  17052. #line 667 "./unsupportedserial.w"
  17053. QScriptValue constructSerialPort(QScriptContext*,QScriptEngine*engine)
  17054. {
  17055. QScriptValue object= engine->newQObject(new QextSerialPort());
  17056. setSerialPortProperties(object,engine);
  17057. return object;
  17058. }
  17059. /*:868*//*869:*/
  17060. #line 678 "./unsupportedserial.w"
  17061. void setSerialPortProperties(QScriptValue value,QScriptEngine*engine)
  17062. {
  17063. setQIODeviceProperties(value,engine);
  17064. value.setProperty("flush",engine->newFunction(SerialPort_flush));
  17065. }
  17066. /*:869*//*870:*/
  17067. #line 687 "./unsupportedserial.w"
  17068. QScriptValue SerialPort_flush(QScriptContext*context,QScriptEngine*)
  17069. {
  17070. QextSerialPort*self= getself<QextSerialPort*> (context);
  17071. self->flush();
  17072. return QScriptValue();
  17073. }
  17074. #line 18586 "./typica.w"
  17075. /*:870*//*888:*/
  17076. #line 151 "./rate.w"
  17077. QScriptValue constructRateOfChange(QScriptContext*context,QScriptEngine*engine)
  17078. {
  17079. int cachetime= 1;
  17080. int scaletime= 1;
  17081. if(context->argumentCount()> 0)
  17082. {
  17083. cachetime= argument<int> (0,context);
  17084. if(context->argumentCount()> 1)
  17085. {
  17086. scaletime= argument<int> (1,context);
  17087. }
  17088. }
  17089. QScriptValue object= engine->newQObject(new RateOfChange(cachetime,scaletime));
  17090. setRateOfChangeProperties(object,engine);
  17091. return object;
  17092. }
  17093. void setRateOfChangeProperties(QScriptValue value,QScriptEngine*engine)
  17094. {
  17095. setQObjectProperties(value,engine);
  17096. }
  17097. /*:888*//*913:*/
  17098. #line 614 "./dataqsdk.w"
  17099. QScriptValue constructDataqSdkDevice(QScriptContext*context,QScriptEngine*engine)
  17100. {
  17101. QScriptValue object;
  17102. if(context->argumentCount()==1)
  17103. {
  17104. object= engine->newQObject(new DataqSdkDevice(argument<QString> (0,context)),
  17105. QScriptEngine::ScriptOwnership);
  17106. setDataqSdkDeviceProperties(object,engine);
  17107. }
  17108. else
  17109. {
  17110. context->throwError("Incorrect number of arguments passed to "
  17111. "DataqSdkDevice. The constructor takes one string "
  17112. "as an argument specifying a device name. "
  17113. "Example: Dev1");
  17114. }
  17115. return object;
  17116. }
  17117. /*:913*//*914:*/
  17118. #line 637 "./dataqsdk.w"
  17119. void setDataqSdkDeviceProperties(QScriptValue value,QScriptEngine*engine)
  17120. {
  17121. setQObjectProperties(value,engine);
  17122. value.setProperty("newChannel",engine->newFunction(DataqSdkDevice_newChannel));
  17123. }
  17124. /*:914*//*915:*/
  17125. #line 647 "./dataqsdk.w"
  17126. QScriptValue DataqSdkDevice_newChannel(QScriptContext*context,QScriptEngine*engine)
  17127. {
  17128. DataqSdkDevice*self= getself<DataqSdkDevice*> (context);
  17129. QScriptValue object;
  17130. if(self)
  17131. {
  17132. object= engine->newQObject(self->newChannel((Units::Unit)argument<int> (0,context)));
  17133. setChannelProperties(object,engine);
  17134. }
  17135. return object;
  17136. }
  17137. /*:915*//*940:*/
  17138. #line 80 "./scales.w"
  17139. QScriptValue constructDragLabel(QScriptContext*context,QScriptEngine*engine)
  17140. {
  17141. QScriptValue object;
  17142. QString labelText= "";
  17143. if(context->argumentCount()==1)
  17144. {
  17145. labelText= argument<QString> (0,context);
  17146. }
  17147. object= engine->newQObject(new DragLabel(labelText));
  17148. setDragLabelProperties(object,engine);
  17149. return object;
  17150. }
  17151. void setDragLabelProperties(QScriptValue value,QScriptEngine*engine)
  17152. {
  17153. setQLabelProperties(value,engine);
  17154. }
  17155. /*:940*//*950:*/
  17156. #line 272 "./scales.w"
  17157. QScriptValue BaudRateType_toScriptValue(QScriptEngine*engine,const BaudRateType&value)
  17158. {
  17159. return engine->newVariant(QVariant((int)(value)));
  17160. }
  17161. void BaudRateType_fromScriptValue(const QScriptValue&sv,BaudRateType&value)
  17162. {
  17163. value= (BaudRateType)(sv.toVariant().toInt());
  17164. }
  17165. QScriptValue DataBitsType_toScriptValue(QScriptEngine*engine,const DataBitsType&value)
  17166. {
  17167. return engine->newVariant(QVariant((int)(value)));
  17168. }
  17169. void DataBitsType_fromScriptValue(const QScriptValue&sv,DataBitsType&value)
  17170. {
  17171. value= (DataBitsType)(sv.toVariant().toInt());
  17172. }
  17173. QScriptValue ParityType_toScriptValue(QScriptEngine*engine,const ParityType&value)
  17174. {
  17175. return engine->newVariant(QVariant((int)(value)));
  17176. }
  17177. void ParityType_fromScriptValue(const QScriptValue&sv,ParityType&value)
  17178. {
  17179. value= (ParityType)(sv.toVariant().toInt());
  17180. }
  17181. QScriptValue StopBitsType_toScriptValue(QScriptEngine*engine,const StopBitsType&value)
  17182. {
  17183. return engine->newVariant(QVariant((int)(value)));
  17184. }
  17185. void StopBitsType_fromScriptValue(const QScriptValue&sv,StopBitsType&value)
  17186. {
  17187. value= (StopBitsType)(sv.toVariant().toInt());
  17188. }
  17189. QScriptValue FlowType_toScriptValue(QScriptEngine*engine,const FlowType&value)
  17190. {
  17191. return engine->newVariant(QVariant((int)(value)));
  17192. }
  17193. void FlowType_fromScriptValue(const QScriptValue&sv,FlowType&value)
  17194. {
  17195. value= (FlowType)(sv.toVariant().toInt());
  17196. }
  17197. /*:950*//*953:*/
  17198. #line 341 "./scales.w"
  17199. void setSerialScaleProperties(QScriptValue value,QScriptEngine*engine)
  17200. {
  17201. setQIODeviceProperties(value,engine);
  17202. }
  17203. /*:953*//*954:*/
  17204. #line 349 "./scales.w"
  17205. QScriptValue constructSerialScale(QScriptContext*context,QScriptEngine*engine)
  17206. {
  17207. QScriptValue object;
  17208. if(context->argumentCount()==1)
  17209. {
  17210. object= engine->newQObject(new SerialScale(argument<QString> (0,context)));
  17211. setSerialScaleProperties(object,engine);
  17212. }
  17213. else
  17214. {
  17215. context->throwError("Incorrect number of arguments passed to "
  17216. "SerialScale. The constructor takes one string "
  17217. "as an argument specifying a port name.");
  17218. }
  17219. return object;
  17220. }
  17221. /*:954*//*976:*/
  17222. #line 278 "./valueannotation.w"
  17223. QScriptValue constructValueAnnotation(QScriptContext*,QScriptEngine*engine)
  17224. {
  17225. QScriptValue object= engine->newQObject(new ValueAnnotation);
  17226. setValueAnnotationProperties(object,engine);
  17227. return object;
  17228. }
  17229. void setValueAnnotationProperties(QScriptValue value,QScriptEngine*engine)
  17230. {
  17231. setQObjectProperties(value,engine);
  17232. }
  17233. #line 18807 "./typica.w"
  17234. /*:976*/
  17235. #line 530 "./typica.w"
  17236. /*595:*/
  17237. #line 12758 "./typica.w"
  17238. void messageFileOutput(QtMsgType type,const char*msg)
  17239. {
  17240. QFile output("Typica-"+QDate::currentDate().toString("yyyy-MM-dd")+".log");
  17241. output.open(QIODevice::WriteOnly|QIODevice::Append);
  17242. QTextStream outstream(&output);
  17243. outstream<<msg<<"\n";
  17244. }
  17245. /*:595*/
  17246. #line 531 "./typica.w"
  17247. /*592:*/
  17248. #line 12719 "./typica.w"
  17249. int main(int argc,char**argv)
  17250. {
  17251. /*593:*/
  17252. #line 12748 "./typica.w"
  17253. qInstallMsgHandler(messageFileOutput);
  17254. /*:593*/
  17255. #line 12722 "./typica.w"
  17256. int*c= &argc;
  17257. Application app(*c,argv);
  17258. /*596:*/
  17259. #line 12771 "./typica.w"
  17260. QStringList themeSearchPath= QIcon::themeSearchPaths();
  17261. themeSearchPath.append(":/resources/icons/tango");
  17262. QIcon::setThemeSearchPaths(themeSearchPath);
  17263. QIcon::setThemeName(":/resources/icons/tango");
  17264. app.setWindowIcon(QIcon(":/resources/icons/appicons/logo.svg"));
  17265. /*:596*/
  17266. #line 12725 "./typica.w"
  17267. /*597:*/
  17268. #line 12791 "./typica.w"
  17269. QFile entypo(":/resources/fonts/entypo.ttf");
  17270. entypo.open(QIODevice::ReadOnly);
  17271. QFontDatabase::addApplicationFontFromData(entypo.readAll());
  17272. entypo.close();
  17273. QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-regular.otf");
  17274. QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-bold.otf");
  17275. QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-bolditalic.otf");
  17276. QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-italic.otf");
  17277. QWebSettings::globalSettings()->setFontFamily(QWebSettings::StandardFont,"Tex Gyre Pagella");
  17278. /*:597*/
  17279. #line 12726 "./typica.w"
  17280. QSettings settings;
  17281. /*751:*/
  17282. #line 15651 "./typica.w"
  17283. app.registerDeviceConfigurationWidget("roaster",RoasterConfWidget::staticMetaObject);
  17284. /*:751*//*761:*/
  17285. #line 15893 "./typica.w"
  17286. app.registerDeviceConfigurationWidget("nidaqmxbase",
  17287. NiDaqMxBaseDriverConfWidget::staticMetaObject);
  17288. app.registerDeviceConfigurationWidget("nidaqmxbase9211series",
  17289. NiDaqMxBase9211ConfWidget::staticMetaObject);
  17290. app.registerDeviceConfigurationWidget("ni9211seriestc",
  17291. Ni9211TcConfWidget::staticMetaObject);
  17292. /*:761*//*769:*/
  17293. #line 16124 "./typica.w"
  17294. app.registerDeviceConfigurationWidget("nidaqmx",NiDaqMxDriverConfWidget::staticMetaObject);
  17295. app.registerDeviceConfigurationWidget("nidaqmx9211series",NiDaqMx9211ConfWidget::staticMetaObject);
  17296. app.registerDeviceConfigurationWidget("nidaqmxtc01",NiDaqMxTc01ConfWidget::staticMetaObject);
  17297. /*:769*//*793:*/
  17298. #line 17089 "./typica.w"
  17299. app.registerDeviceConfigurationWidget("modbusrtuport",ModbusRtuPortConfWidget::staticMetaObject);
  17300. app.registerDeviceConfigurationWidget("modbusrtudevice",ModbusRtuDeviceConfWidget::staticMetaObject);
  17301. app.registerDeviceConfigurationWidget("modbustemperaturepv",ModbusRtuDeviceTPvConfWidget::staticMetaObject);
  17302. app.registerDeviceConfigurationWidget("modbustemperaturesv",ModbusRtuDeviceTSvConfWidget::staticMetaObject);
  17303. /*:793*//*798:*/
  17304. #line 17174 "./typica.w"
  17305. app.registerDeviceConfigurationWidget("annotationbutton",AnnotationButtonConfWidget::staticMetaObject);
  17306. /*:798*//*801:*/
  17307. #line 17244 "./typica.w"
  17308. app.registerDeviceConfigurationWidget("reconfigurablebutton",ReconfigurableAnnotationButtonConfWidget::staticMetaObject);
  17309. /*:801*//*804:*/
  17310. #line 17371 "./typica.w"
  17311. app.registerDeviceConfigurationWidget("annotationspinbox",NoteSpinConfWidget::staticMetaObject);
  17312. #line 1 "./freeannotation.w"
  17313. /*:804*//*808:*/
  17314. #line 57 "./freeannotation.w"
  17315. app.registerDeviceConfigurationWidget("freeannotation",
  17316. FreeAnnotationConfWidget::staticMetaObject);
  17317. #line 17375 "./typica.w"
  17318. #line 1 "./settings.w"
  17319. /*:808*//*837:*/
  17320. #line 18576 "./typica.w"
  17321. app.registerDeviceConfigurationWidget("modbusrtu",ModbusConfigurator::staticMetaObject);
  17322. /*:837*//*847:*/
  17323. #line 264 "./unsupportedserial.w"
  17324. app.registerDeviceConfigurationWidget("unsupporteddevicechannel",
  17325. UnsupportedDeviceChannelConfWidget::staticMetaObject);
  17326. app.registerDeviceConfigurationWidget("unsupporteddevice",
  17327. UnsupportedSerialDeviceConfWidget::staticMetaObject);
  17328. /*:847*//*876:*/
  17329. #line 18708 "./typica.w"
  17330. app.registerDeviceConfigurationWidget("linearspline",LinearSplineInterpolationConfWidget::staticMetaObject);
  17331. /*:876*//*880:*/
  17332. #line 18797 "./typica.w"
  17333. app.registerDeviceConfigurationWidget("translation",TranslationConfWidget::staticMetaObject);
  17334. #line 1 "./rate.w"
  17335. /*:880*//*892:*/
  17336. #line 253 "./rate.w"
  17337. app.registerDeviceConfigurationWidget("rate",RateOfChangeConfWidget::staticMetaObject);
  17338. /*:892*//*933:*/
  17339. #line 1233 "./dataqsdk.w"
  17340. app.registerDeviceConfigurationWidget("dataqsdk",DataqSdkDeviceConfWidget::staticMetaObject);
  17341. app.registerDeviceConfigurationWidget("dataqsdkchannel",
  17342. DataqSdkChannelConfWidget::staticMetaObject);
  17343. /*:933*//*958:*/
  17344. #line 490 "./scales.w"
  17345. app.registerDeviceConfigurationWidget("scale",SerialScaleConfWidget::staticMetaObject);
  17346. /*:958*//*966:*/
  17347. #line 138 "./valueannotation.w"
  17348. app.registerDeviceConfigurationWidget("valueannotation",
  17349. ValueAnnotationConfWidget::staticMetaObject);
  17350. /*:966*/
  17351. #line 12730 "./typica.w"
  17352. /*598:*/
  17353. #line 12808 "./typica.w"
  17354. if(settings.value("database/exists","false").toString()=="true")
  17355. {
  17356. /*603:*/
  17357. #line 12930 "./typica.w"
  17358. QSqlDatabase database=
  17359. QSqlDatabase::addDatabase(settings.value("database/driver").toString());
  17360. database.setConnectOptions("application_name=Typica");
  17361. database.setHostName(settings.value("database/hostname").toString());
  17362. database.setDatabaseName(settings.value("database/dbname").toString());
  17363. database.setUserName(settings.value("database/user").toString());
  17364. database.setPassword(settings.value("database/password").toString());
  17365. if(!database.open())
  17366. {
  17367. settings.setValue("database/exists","false");
  17368. }
  17369. else
  17370. {
  17371. database.close();
  17372. }
  17373. /*:603*/
  17374. #line 12811 "./typica.w"
  17375. }
  17376. if(settings.value("database/exists","false").toString()=="false")
  17377. {
  17378. /*602:*/
  17379. #line 12921 "./typica.w"
  17380. SqlConnectionSetup dialog;
  17381. dialog.exec();
  17382. /*:602*/
  17383. #line 12815 "./typica.w"
  17384. }
  17385. /*:598*/
  17386. #line 12731 "./typica.w"
  17387. /*167:*/
  17388. #line 3836 "./typica.w"
  17389. QStringList arguments= QCoreApplication::arguments();
  17390. int position= arguments.indexOf("-c");
  17391. QString filename= QString();
  17392. if(position!=-1)
  17393. {
  17394. if(arguments.size()>=position+1)
  17395. {
  17396. filename= arguments.at(position+1);
  17397. }
  17398. }
  17399. if(filename.isEmpty())
  17400. {
  17401. filename= QFileDialog::getOpenFileName(NULL,"Open Configuration File",
  17402. settings.value("config","").toString());
  17403. }
  17404. QDir directory;
  17405. if(!filename.isEmpty())
  17406. {
  17407. QFile file(filename);
  17408. QFileInfo info(filename);
  17409. directory= info.dir();
  17410. settings.setValue("config",directory.path());
  17411. if(file.open(QIODevice::ReadOnly))
  17412. {
  17413. app.configuration()->setContent(&file,true);
  17414. }
  17415. }
  17416. /*168:*/
  17417. #line 3870 "./typica.w"
  17418. QDomElement root= app.configuration()->documentElement();
  17419. QDomNodeList children= root.childNodes();
  17420. QString replacementDoc;
  17421. QDomDocument includedDoc;
  17422. QDomDocumentFragment fragment;
  17423. for(int i= 0;i<children.size();i++)
  17424. {
  17425. QDomNode currentNode= children.at(i);
  17426. QDomElement currentElement;
  17427. if(currentNode.nodeName()=="include")
  17428. {
  17429. currentElement= currentNode.toElement();
  17430. if(currentElement.hasAttribute("src"))
  17431. {
  17432. replacementDoc= directory.path();
  17433. replacementDoc.append('/');
  17434. replacementDoc.append(currentElement.attribute("src"));
  17435. QFile doc(replacementDoc);
  17436. if(doc.open(QIODevice::ReadOnly))
  17437. {
  17438. includedDoc.setContent(&doc,true);
  17439. fragment= includedDoc.createDocumentFragment();
  17440. fragment.appendChild(includedDoc.documentElement());
  17441. root.replaceChild(fragment,currentNode);
  17442. doc.close();
  17443. }
  17444. }
  17445. }
  17446. }
  17447. /*:168*/
  17448. #line 3864 "./typica.w"
  17449. /*:167*/
  17450. #line 12732 "./typica.w"
  17451. /*7:*/
  17452. #line 659 "./typica.w"
  17453. QScriptEngine*engine= new QScriptEngine;
  17454. QScriptValue constructor;
  17455. QScriptValue value;
  17456. /*:7*//*17:*/
  17457. #line 856 "./typica.w"
  17458. constructor= engine->newFunction(constructQWidget);
  17459. value= engine->newQMetaObject(&QWidget::staticMetaObject,constructor);
  17460. engine->globalObject().setProperty("QWidget",value);
  17461. /*:17*//*28:*/
  17462. #line 1102 "./typica.w"
  17463. constructor= engine->newFunction(constructQMainWindow);
  17464. value= engine->newQMetaObject(&ScriptQMainWindow::staticMetaObject,
  17465. constructor);
  17466. engine->globalObject().setProperty("QMainWindow",value);
  17467. /*:28*//*39:*/
  17468. #line 1307 "./typica.w"
  17469. constructor= engine->newFunction(constructQFrame);
  17470. value= engine->newQMetaObject(&QFrame::staticMetaObject,constructor);
  17471. engine->globalObject().setProperty("QFrame",value);
  17472. /*:39*//*42:*/
  17473. #line 1340 "./typica.w"
  17474. constructor= engine->newFunction(constructQLabel);
  17475. value= engine->newQMetaObject(&QLabel::staticMetaObject,constructor);
  17476. engine->globalObject().setProperty("QLabel",value);
  17477. /*:42*//*45:*/
  17478. #line 1378 "./typica.w"
  17479. constructor= engine->newFunction(constructQLineEdit);
  17480. value= engine->newQMetaObject(&QLineEdit::staticMetaObject,constructor);
  17481. engine->globalObject().setProperty("QLineEdit",value);
  17482. /*:45*//*49:*/
  17483. #line 1425 "./typica.w"
  17484. constructor= engine->newFunction(constructQSplitter);
  17485. value= engine->newQMetaObject(&QSplitter::staticMetaObject,constructor);
  17486. engine->globalObject().setProperty("QSplitter",value);
  17487. /*:49*//*57:*/
  17488. #line 1614 "./typica.w"
  17489. constructor= engine->newFunction(constructQBoxLayout);
  17490. value= engine->newQMetaObject(&QBoxLayout::staticMetaObject,constructor);
  17491. engine->globalObject().setProperty("QBoxLayout",value);
  17492. /*:57*//*61:*/
  17493. #line 1726 "./typica.w"
  17494. constructor= engine->newFunction(constructQAction);
  17495. value= engine->newQMetaObject(&QAction::staticMetaObject,constructor);
  17496. engine->globalObject().setProperty("QAction",value);
  17497. /*:61*//*64:*/
  17498. #line 1785 "./typica.w"
  17499. value= engine->newQMetaObject(&QFileDialog::staticMetaObject);
  17500. value.setProperty("getOpenFileName",
  17501. engine->newFunction(QFileDialog_getOpenFileName));
  17502. value.setProperty("getSaveFileName",
  17503. engine->newFunction(QFileDialog_getSaveFileName));
  17504. engine->globalObject().setProperty("QFileDialog",value);
  17505. /*:64*//*69:*/
  17506. #line 1900 "./typica.w"
  17507. constructor= engine->newFunction(constructQFile);
  17508. value= engine->newQMetaObject(&QFile::staticMetaObject,constructor);
  17509. engine->globalObject().setProperty("QFile",value);
  17510. /*:69*//*78:*/
  17511. #line 2082 "./typica.w"
  17512. constructor= engine->newFunction(constructQProcess);
  17513. value= engine->newQMetaObject(&QProcess::staticMetaObject,constructor);
  17514. engine->globalObject().setProperty("QProcess",value);
  17515. /*:78*//*87:*/
  17516. #line 2216 "./typica.w"
  17517. qScriptRegisterMetaType(engine,QByteArray_toScriptValue,QByteArray_fromScriptValue);
  17518. constructor= engine->newFunction(constructQByteArray);
  17519. engine->globalObject().setProperty("QByteArray",constructor);
  17520. /*:87*//*92:*/
  17521. #line 2267 "./typica.w"
  17522. constructor= engine->newFunction(constructQBuffer);
  17523. value= engine->newQMetaObject(&QBuffer::staticMetaObject,constructor);
  17524. engine->globalObject().setProperty("QBuffer",value);
  17525. /*:92*//*95:*/
  17526. #line 2316 "./typica.w"
  17527. constructor= engine->newFunction(constructXQuery);
  17528. engine->globalObject().setProperty("XQuery",constructor);
  17529. /*:95*//*101:*/
  17530. #line 2418 "./typica.w"
  17531. constructor= engine->newFunction(constructXmlWriter);
  17532. engine->globalObject().setProperty("XmlWriter",constructor);
  17533. /*:101*//*110:*/
  17534. #line 2624 "./typica.w"
  17535. constructor= engine->newFunction(constructXmlReader);
  17536. engine->globalObject().setProperty("XmlReader",constructor);
  17537. /*:110*//*117:*/
  17538. #line 2748 "./typica.w"
  17539. value= engine->newQObject(&settings);
  17540. setQSettingsProperties(value,engine);
  17541. engine->globalObject().setProperty("QSettings",value);
  17542. /*:117*//*121:*/
  17543. #line 2829 "./typica.w"
  17544. constructor= engine->newFunction(constructQLCDNumber);
  17545. value= engine->newQMetaObject(&QLCDNumber::staticMetaObject,constructor);
  17546. engine->globalObject().setProperty("QLCDNumber",value);
  17547. /*:121*//*124:*/
  17548. #line 2885 "./typica.w"
  17549. constructor= engine->newFunction(constructQTime);
  17550. engine->globalObject().setProperty("QTime",constructor);
  17551. /*:124*//*146:*/
  17552. #line 3398 "./typica.w"
  17553. constructor= engine->newFunction(constructQPushButton);
  17554. value= engine->newQMetaObject(&QPushButton::staticMetaObject,constructor);
  17555. engine->globalObject().setProperty("QPushButton",value);
  17556. /*:146*//*153:*/
  17557. #line 3509 "./typica.w"
  17558. constructor= engine->newFunction(constructQSqlQuery);
  17559. engine->globalObject().setProperty("QSqlQuery",constructor);
  17560. /*:153*//*160:*/
  17561. #line 3672 "./typica.w"
  17562. engine->globalObject().setProperty("baseName",engine->newFunction(baseName));
  17563. engine->globalObject().setProperty("dir",engine->newFunction(dir));
  17564. engine->globalObject().setProperty("sqlToArray",
  17565. engine->newFunction(sqlToArray));
  17566. engine->globalObject().setProperty("setFont",engine->newFunction(setFont));
  17567. engine->globalObject().setProperty("annotationFromRecord",
  17568. engine->newFunction(annotationFromRecord));
  17569. engine->globalObject().setProperty("setTabOrder",
  17570. engine->newFunction(setTabOrder));
  17571. engine->globalObject().setProperty("saveFileFromDatabase",
  17572. engine->newFunction(saveFileFromDatabase));
  17573. /*:160*//*172:*/
  17574. #line 4037 "./typica.w"
  17575. engine->globalObject().setProperty("createWindow",
  17576. engine->newFunction(createWindow));
  17577. engine->globalObject().setProperty("createReport",
  17578. engine->newFunction(createReport));
  17579. /*:172*//*238:*/
  17580. #line 5582 "./typica.w"
  17581. engine->globalObject().setProperty("findChildObject",
  17582. engine->newFunction(findChildObject));
  17583. /*:238*//*264:*/
  17584. #line 376 "./units.w"
  17585. value= engine->newQMetaObject(&Units::staticMetaObject);
  17586. value.setProperty("convertTemperature",engine->newFunction(Units_convertTemperature));
  17587. value.setProperty("convertRelativeTemperature",
  17588. engine->newFunction(Units_convertRelativeTemperature));
  17589. value.setProperty("isTemperatureUnit",engine->newFunction(Units_isTemperatureUnit));
  17590. value.setProperty("convertWeight",engine->newFunction(Units_convertWeight));
  17591. value.setProperty("isWeightUnit",engine->newFunction(Units_isWeightUnit));
  17592. engine->globalObject().setProperty("Units",value);
  17593. /*:264*//*269:*/
  17594. #line 449 "./units.w"
  17595. qScriptRegisterMetaType(engine,Unit_toScriptValue,Unit_fromScriptValue);
  17596. #line 6002 "./typica.w"
  17597. /*:269*//*277:*/
  17598. #line 141 "./measurement.w"
  17599. constructor= engine->newFunction(constructMeasurement);
  17600. engine->globalObject().setProperty("Measurement",constructor);
  17601. qScriptRegisterMetaType(engine,Measurement_toScriptValue,Measurement_fromScriptValue);
  17602. /*:277*//*297:*/
  17603. #line 6572 "./typica.w"
  17604. constructor= engine->newFunction(constructDAQ);
  17605. value= engine->newQMetaObject(&DAQ::staticMetaObject,constructor);
  17606. value.setProperty("Fahrenheit",Units::Fahrenheit);
  17607. value.setProperty("Celsius",Units::Celsius);
  17608. value.setProperty("Kelvin",Units::Kelvin);
  17609. value.setProperty("Rankine",Units::Rankine);
  17610. engine->globalObject().setProperty("DAQ",value);
  17611. /*:297*//*306:*/
  17612. #line 6774 "./typica.w"
  17613. constructor= engine->newFunction(constructFakeDAQ);
  17614. value= engine->newQMetaObject(&FakeDAQ::staticMetaObject,constructor);
  17615. engine->globalObject().setProperty("FakeDAQ",value);
  17616. /*:306*//*317:*/
  17617. #line 7057 "./typica.w"
  17618. constructor= engine->newFunction(constructLinearCalibrator);
  17619. value= engine->newQMetaObject(&LinearCalibrator::staticMetaObject,
  17620. constructor);
  17621. engine->globalObject().setProperty("LinearCalibrator",value);
  17622. /*:317*//*322:*/
  17623. #line 7196 "./typica.w"
  17624. constructor= engine->newFunction(constructLinearSplineInterpolator);
  17625. value= engine->newQMetaObject(&LinearSplineInterpolator::staticMetaObject,constructor);
  17626. engine->globalObject().setProperty("LinearSplineInterpolator",value);
  17627. /*:322*//*332:*/
  17628. #line 7401 "./typica.w"
  17629. constructor= engine->newFunction(constructTemperatureDisplay);
  17630. value= engine->newQMetaObject(&TemperatureDisplay::staticMetaObject,
  17631. constructor);
  17632. engine->globalObject().setProperty("TemperatureDisplay",value);
  17633. /*:332*//*340:*/
  17634. #line 7559 "./typica.w"
  17635. constructor= engine->newFunction(constructMeasurementTimeOffset);
  17636. value= engine->newQMetaObject(&MeasurementTimeOffset::staticMetaObject,
  17637. constructor);
  17638. engine->globalObject().setProperty("MeasurementTimeOffset",value);
  17639. /*:340*//*345:*/
  17640. #line 7670 "./typica.w"
  17641. constructor= engine->newFunction(constructThresholdDetector);
  17642. value= engine->newQMetaObject(&ThresholdDetector::staticMetaObject,constructor);
  17643. engine->globalObject().setProperty("ThresholdDetector",value);
  17644. /*:345*//*350:*/
  17645. #line 7769 "./typica.w"
  17646. constructor= engine->newFunction(constructZeroEmitter);
  17647. value= engine->newQMetaObject(&ZeroEmitter::staticMetaObject,constructor);
  17648. engine->globalObject().setProperty("ZeroEmitter",value);
  17649. /*:350*//*355:*/
  17650. #line 7848 "./typica.w"
  17651. constructor= engine->newFunction(constructMeasurementAdapter);
  17652. value= engine->newQMetaObject(&MeasurementAdapter::staticMetaObject,
  17653. constructor);
  17654. engine->globalObject().setProperty("MeasurementAdapter",value);
  17655. /*:355*//*372:*/
  17656. #line 8311 "./typica.w"
  17657. constructor= engine->newFunction(constructGraphView);
  17658. value= engine->newQMetaObject(&GraphView::staticMetaObject,constructor);
  17659. engine->globalObject().setProperty("GraphView",value);
  17660. /*:372*//*395:*/
  17661. #line 8948 "./typica.w"
  17662. constructor= engine->newFunction(constructZoomLog);
  17663. value= engine->newQMetaObject(&ZoomLog::staticMetaObject,constructor);
  17664. engine->globalObject().setProperty("ZoomLog",value);
  17665. /*:395*//*433:*/
  17666. #line 9896 "./typica.w"
  17667. constructor= engine->newFunction(constructAnnotationButton);
  17668. value= engine->newQMetaObject(&AnnotationButton::staticMetaObject,
  17669. constructor);
  17670. engine->globalObject().setProperty("AnnotationButton",value);
  17671. /*:433*//*441:*/
  17672. #line 10038 "./typica.w"
  17673. constructor= engine->newFunction(constructAnnotationSpinBox);
  17674. value= engine->newQMetaObject(&AnnotationSpinBox::staticMetaObject,
  17675. constructor);
  17676. engine->globalObject().setProperty("AnnotationSpinBox",value);
  17677. /*:441*//*462:*/
  17678. #line 10459 "./typica.w"
  17679. constructor= engine->newFunction(constructTimerDisplay);
  17680. value= engine->newQMetaObject(&TimerDisplay::staticMetaObject,constructor);
  17681. engine->globalObject().setProperty("TimerDisplay",value);
  17682. /*:462*//*489:*/
  17683. #line 10953 "./typica.w"
  17684. constructor= engine->newFunction(constructWidgetDecorator);
  17685. value= engine->newQMetaObject(&WidgetDecorator::staticMetaObject,constructor);
  17686. engine->globalObject().setProperty("WidgetDecorator",value);
  17687. /*:489*//*502:*/
  17688. #line 11235 "./typica.w"
  17689. constructor= engine->newFunction(constructLogEditWindow);
  17690. value= engine->newQMetaObject(&LogEditWindow::staticMetaObject,constructor);
  17691. engine->globalObject().setProperty("LogEditWindow",value);
  17692. /*:502*//*521:*/
  17693. #line 11763 "./typica.w"
  17694. constructor= engine->newFunction(constructXMLInput);
  17695. value= engine->newQMetaObject(&XMLInput::staticMetaObject,constructor);
  17696. engine->globalObject().setProperty("XMLInput",value);
  17697. /*:521*//*535:*/
  17698. #line 149 "./webview.w"
  17699. constructor= engine->newFunction(constructWebView);
  17700. value= engine->newQMetaObject(&TypicaWebView::staticMetaObject,constructor);
  17701. engine->globalObject().setProperty("WebView",value);
  17702. /*:535*//*543:*/
  17703. #line 241 "./webview.w"
  17704. qScriptRegisterMetaType(engine,QWebElement_toScriptValue,QWebElement_fromScriptValue);
  17705. /*:543*//*546:*/
  17706. #line 283 "./webview.w"
  17707. constructor= engine->newFunction(constructWebElement);
  17708. engine->globalObject().setProperty("WebElement",constructor);
  17709. /*:546*//*557:*/
  17710. #line 12006 "./typica.w"
  17711. value= engine->newQObject(AppInstance);
  17712. engine->globalObject().setProperty("Application",value);
  17713. /*:557*//*615:*/
  17714. #line 13107 "./typica.w"
  17715. constructor= engine->newFunction(constructSqlQueryView);
  17716. value= engine->newQMetaObject(&SqlQueryView::staticMetaObject,constructor);
  17717. engine->globalObject().setProperty("SqlQueryView",value);
  17718. /*:615*//*720:*/
  17719. #line 15009 "./typica.w"
  17720. constructor= engine->newFunction(constructDeviceTreeModel);
  17721. value= engine->newQMetaObject(&DeviceTreeModel::staticMetaObject,
  17722. constructor);
  17723. engine->globalObject().setProperty("DeviceTreeModel",value);
  17724. /*:720*//*726:*/
  17725. #line 15149 "./typica.w"
  17726. qScriptRegisterMetaType(engine,QModelIndex_toScriptValue,QModelIndex_fromScriptValue);
  17727. /*:726*//*742:*/
  17728. #line 15441 "./typica.w"
  17729. constructor= engine->newFunction(constructDeviceConfigurationWindow);
  17730. value= engine->newQMetaObject(&DeviceConfigurationWindow::staticMetaObject,
  17731. constructor);
  17732. engine->globalObject().setProperty("DeviceConfigurationWindow",value);
  17733. /*:742*//*813:*/
  17734. #line 54 "./settings.w"
  17735. constructor= engine->newFunction(constructSettingsWindow);
  17736. value= engine->newQMetaObject(&DeviceConfigurationWindow::staticMetaObject,constructor);
  17737. engine->globalObject().setProperty("SettingsWindow",value);
  17738. #line 1 "./graphsettings.w"
  17739. /*:813*//*831:*/
  17740. #line 17971 "./typica.w"
  17741. constructor= engine->newFunction(constructModbusRTUDevice);
  17742. value= engine->newQMetaObject(&ModbusRTUDevice::staticMetaObject,constructor);
  17743. engine->globalObject().setProperty("ModbusRTUDevice",value);
  17744. /*:831*//*851:*/
  17745. #line 350 "./unsupportedserial.w"
  17746. engine->globalObject().setProperty("createDevice",
  17747. engine->newFunction(createDevice));
  17748. /*:851*//*863:*/
  17749. #line 622 "./unsupportedserial.w"
  17750. engine->globalObject().setProperty("getMeasurementTimestamp",
  17751. engine->newFunction(getMeasurementTimestamp));
  17752. /*:863*//*867:*/
  17753. #line 658 "./unsupportedserial.w"
  17754. constructor= engine->newFunction(constructSerialPort);
  17755. value= engine->newQMetaObject(&QextSerialPort::staticMetaObject,constructor);
  17756. engine->globalObject().setProperty("SerialPort",value);
  17757. /*:867*//*887:*/
  17758. #line 144 "./rate.w"
  17759. constructor= engine->newFunction(constructRateOfChange);
  17760. value= engine->newQMetaObject(&RateOfChange::staticMetaObject,constructor);
  17761. engine->globalObject().setProperty("RateOfChange",value);
  17762. /*:887*//*912:*/
  17763. #line 604 "./dataqsdk.w"
  17764. constructor= engine->newFunction(constructDataqSdkDevice);
  17765. value= engine->newQMetaObject(&DataqSdkDevice::staticMetaObject,constructor);
  17766. engine->globalObject().setProperty("DataqSdkDevice",value);
  17767. /*:912*//*939:*/
  17768. #line 73 "./scales.w"
  17769. constructor= engine->newFunction(constructDragLabel);
  17770. value= engine->newQMetaObject(&DragLabel::staticMetaObject,constructor);
  17771. engine->globalObject().setProperty("DragLabel",value);
  17772. /*:939*//*947:*/
  17773. #line 239 "./scales.w"
  17774. constructor= engine->newFunction(constructSerialScale);
  17775. value= engine->newQMetaObject(&SerialScale::staticMetaObject,constructor);
  17776. engine->globalObject().setProperty("SerialScale",value);
  17777. /*:947*//*951:*/
  17778. #line 325 "./scales.w"
  17779. qScriptRegisterMetaType(engine,BaudRateType_toScriptValue,BaudRateType_fromScriptValue);
  17780. qScriptRegisterMetaType(engine,DataBitsType_toScriptValue,DataBitsType_fromScriptValue);
  17781. qScriptRegisterMetaType(engine,ParityType_toScriptValue,ParityType_fromScriptValue);
  17782. qScriptRegisterMetaType(engine,StopBitsType_toScriptValue,StopBitsType_fromScriptValue);
  17783. qScriptRegisterMetaType(engine,FlowType_toScriptValue,FlowType_fromScriptValue);
  17784. /*:951*//*975:*/
  17785. #line 271 "./valueannotation.w"
  17786. constructor= engine->newFunction(constructValueAnnotation);
  17787. value= engine->newQMetaObject(&ValueAnnotation::staticMetaObject,constructor);
  17788. engine->globalObject().setProperty("ValueAnnotation",value);
  17789. /*:975*/
  17790. #line 12733 "./typica.w"
  17791. app.engine= engine;
  17792. /*169:*/
  17793. #line 3918 "./typica.w"
  17794. QString styleText;
  17795. QString programText;
  17796. QDomElement currentElement;
  17797. for(int i= 0;i<children.size();i++)
  17798. {
  17799. QDomNode currentNode= children.at(i);
  17800. if(currentNode.nodeName()=="style")
  17801. {
  17802. currentElement= currentNode.toElement();
  17803. styleText.append(currentElement.text());
  17804. }
  17805. else if(currentNode.nodeName()=="program")
  17806. {
  17807. currentElement= currentNode.toElement();
  17808. programText.append(currentElement.text());
  17809. }
  17810. }
  17811. app.setStyleSheet(styleText);
  17812. QScriptValue result= engine->evaluate(programText);
  17813. /*170:*/
  17814. #line 3943 "./typica.w"
  17815. if(engine->hasUncaughtException())
  17816. {
  17817. int line= engine->uncaughtExceptionLineNumber();
  17818. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  17819. result.toString();
  17820. QString trace;
  17821. foreach(trace,engine->uncaughtExceptionBacktrace())
  17822. {
  17823. qDebug()<<trace;
  17824. }
  17825. }
  17826. /*:170*/
  17827. #line 3938 "./typica.w"
  17828. /*:169*/
  17829. #line 12735 "./typica.w"
  17830. int retval= app.exec();
  17831. delete engine;
  17832. return retval;
  17833. }
  17834. /*:592*/
  17835. #line 532 "./typica.w"
  17836. #include "moc_typica.cpp"
  17837. /*:3*/