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.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498
  1. /*3:*/
  2. #line 522 "./typica.w"
  3. #define PROGRAM_NAME "Typica"
  4. /*5:*/
  5. #line 614 "./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 629 "./typica.w"
  17. #include "helpmenu.h"
  18. /*:6*//*238:*/
  19. #line 5653 "./typica.w"
  20. #include "units.h"
  21. #line 1 "./measurement.w"
  22. /*:238*//*501:*/
  23. #line 194 "./webview.w"
  24. #include "webview.h"
  25. /*:501*//*514:*/
  26. #line 372 "./webview.w"
  27. #include "webelement.h"
  28. #line 11582 "./typica.w"
  29. /*:514*//*709:*/
  30. #line 15770 "./typica.w"
  31. #include "qextserialport.h"
  32. #include "qextserialenumerator.h"
  33. /*:709*//*804:*/
  34. #line 124 "./dataqsdk.w"
  35. #ifdef Q_OS_WIN32
  36. #include <windef.h>
  37. #else
  38. #define PASCAL
  39. #endif
  40. /*:804*//*828:*/
  41. #line 862 "./dataqsdk.w"
  42. #include <limits>
  43. /*:828*//*843:*/
  44. #line 62 "./scales.w"
  45. #include "draglabel.h"
  46. /*:843*//*858:*/
  47. #line 335 "./scales.w"
  48. #include "scale.h"
  49. /*:858*/
  50. #line 525 "./typica.w"
  51. /*20:*/
  52. #line 933 "./typica.w"
  53. class ScriptQMainWindow:public QMainWindow
  54. {
  55. Q_OBJECT
  56. Q_PROPERTY(QString closePrompt READ closePrompt WRITE setClosePrompt)
  57. public:
  58. ScriptQMainWindow();
  59. QString closePrompt();
  60. public slots:
  61. void show();
  62. void saveSizeAndPosition(const QString&key);
  63. void restoreSizeAndPosition(const QString&key);
  64. void displayStatus(const QString&message= QString());
  65. void setClosePrompt(QString prompt);
  66. protected:
  67. void closeEvent(QCloseEvent*event);
  68. void showEvent(QShowEvent*event);
  69. signals:
  70. void aboutToClose(void);
  71. private:
  72. QString cprompt;
  73. };
  74. /*:20*//*130:*/
  75. #line 3140 "./typica.w"
  76. class SqlQueryConnection:public QSqlQuery
  77. {
  78. public:
  79. SqlQueryConnection(const QString&query= QString());
  80. ~SqlQueryConnection();
  81. QSqlQuery*operator->()const;
  82. private:
  83. QString connection;
  84. QSqlQuery*q;
  85. };
  86. /*:130*//*192:*/
  87. #line 4961 "./typica.w"
  88. class NumericDelegate:public QItemDelegate
  89. {
  90. Q_OBJECT
  91. public:
  92. NumericDelegate(QObject*parent= NULL);
  93. QWidget*createEditor(QWidget*parent,
  94. const QStyleOptionViewItem&option,
  95. const QModelIndex&index)const;
  96. void setEditorData(QWidget*editor,const QModelIndex&index)const;
  97. void setModelData(QWidget*editor,QAbstractItemModel*model,
  98. const QModelIndex&index)const;
  99. void updateEditorGeometry(QWidget*editor,
  100. const QStyleOptionViewItem&option,
  101. const QModelIndex&index)const;
  102. };
  103. /*:192*//*234:*/
  104. #line 425 "./units.w"
  105. Q_DECLARE_METATYPE(Units::Unit)
  106. /*:234*//*239:*/
  107. #line 19 "./measurement.w"
  108. class Measurement:public QVariantMap
  109. {
  110. public:
  111. Measurement(double temperature= 0,QTime time= QTime(),
  112. Units::Unit sc= Units::Fahrenheit);
  113. Measurement(double temperature);
  114. double temperature()const;
  115. QTime time()const;
  116. void setTemperature(double temperature);
  117. void setTime(QTime time);
  118. void setUnit(Units::Unit scale);
  119. Units::Unit scale()const;
  120. Measurement toFahrenheit();
  121. Measurement toCelsius();
  122. Measurement toKelvin();
  123. Measurement toRankine();
  124. };
  125. /*:239*//*244:*/
  126. #line 5717 "./typica.w"
  127. class Channel;
  128. class DAQImplementation;
  129. class DAQ:public QObject
  130. {
  131. Q_OBJECT
  132. Q_ENUMS(ThermocoupleType)
  133. DAQImplementation*imp;
  134. private slots:
  135. void threadFinished();
  136. public:
  137. DAQ(QString device,const QString&driver= QString("nidaqmxbase"));
  138. ~DAQ();
  139. Channel*newChannel(int units,int thermocouple);
  140. Q_INVOKABLE void setClockRate(double Hz);
  141. Q_INVOKABLE void start();
  142. Q_INVOKABLE void stop();
  143. enum ThermocoupleType
  144. {
  145. TypeJ= 10072,
  146. TypeK= 10073,
  147. TypeN= 10077,
  148. TypeR= 10082,
  149. TypeS= 10085,
  150. TypeT= 10086,
  151. TypeB= 10047,
  152. TypeE= 10055
  153. };
  154. };
  155. /*:244*//*245:*/
  156. #line 5755 "./typica.w"
  157. class DAQImplementation:public QThread
  158. {
  159. Q_OBJECT
  160. public:
  161. DAQImplementation(const QString&driverinfo);
  162. ~DAQImplementation();
  163. void run();
  164. void measure();
  165. /*246:*/
  166. #line 5775 "./typica.w"
  167. typedef int(*daqfp)(...);
  168. daqfp read;
  169. daqfp errorInfo;
  170. daqfp startTask;
  171. daqfp createTask;
  172. daqfp createChannel;
  173. daqfp setClock;
  174. daqfp stopTask;
  175. daqfp clearTask;
  176. daqfp resetDevice;
  177. daqfp waitForMeasurement;
  178. /*:246*/
  179. #line 5764 "./typica.w"
  180. /*247:*/
  181. #line 5791 "./typica.w"
  182. bool useBase;
  183. QString device;
  184. QVector<Channel*> channelMap;
  185. unsigned int handle;
  186. int error;
  187. int channels;
  188. bool ready;
  189. QLibrary driver;
  190. QVector<Units::Unit> unitMap;
  191. /*:247*/
  192. #line 5765 "./typica.w"
  193. };
  194. /*:245*//*263:*/
  195. #line 6295 "./typica.w"
  196. class FakeDAQImplementation:public QThread
  197. {
  198. Q_OBJECT
  199. public:
  200. FakeDAQImplementation();
  201. ~FakeDAQImplementation();
  202. void run();
  203. void measure();
  204. QVector<Channel*> channelMap;
  205. int channels;
  206. bool ready;
  207. double clockRate;
  208. };
  209. class FakeDAQ:public QObject
  210. {
  211. Q_OBJECT
  212. FakeDAQImplementation*imp;
  213. public:
  214. FakeDAQ(QString device);
  215. ~FakeDAQ();
  216. Channel*newChannel(int units,int thermocouple);
  217. Q_INVOKABLE void setClockRate(double Hz);
  218. Q_INVOKABLE void start();
  219. };
  220. /*:263*//*270:*/
  221. #line 6482 "./typica.w"
  222. class Channel:public QObject
  223. {
  224. Q_OBJECT
  225. public:
  226. Channel();
  227. ~Channel();
  228. public slots:
  229. void input(Measurement measurement);
  230. signals:
  231. void newData(Measurement);
  232. };
  233. /*:270*//*274:*/
  234. #line 6549 "./typica.w"
  235. class LinearCalibrator:public QObject
  236. {
  237. Q_OBJECT
  238. Q_PROPERTY(double measuredLower READ measuredLower
  239. WRITE setMeasuredLower)
  240. Q_PROPERTY(double measuredUpper READ measuredUpper
  241. WRITE setMeasuredUpper)
  242. Q_PROPERTY(double mappedLower READ mappedLower WRITE setMappedLower)
  243. Q_PROPERTY(double mappedUpper READ mappedUpper WRITE setMappedUpper)
  244. Q_PROPERTY(bool closedRange READ isClosedRange WRITE setClosedRange)
  245. Q_PROPERTY(double sensitivity READ sensitivity WRITE setSensitivity)
  246. public:
  247. LinearCalibrator(QObject*parent= NULL);
  248. double measuredLower();
  249. double measuredUpper();
  250. double mappedLower();
  251. double mappedUpper();
  252. bool isClosedRange();
  253. double sensitivity();
  254. public slots:
  255. void setMeasuredLower(double lower);
  256. void setMeasuredUpper(double upper);
  257. void setMappedLower(double lower);
  258. void setMappedUpper(double upper);
  259. void setClosedRange(bool closed);
  260. void setSensitivity(double sensitivity);
  261. Measurement newMeasurement(Measurement measure);
  262. signals:
  263. void measurement(Measurement measure);
  264. void newData(Measurement measure);
  265. private:
  266. double Lo1;
  267. double Lo2;
  268. double Up1;
  269. double Up2;
  270. double sensitivitySetting;
  271. bool clamp;
  272. };
  273. /*:274*//*281:*/
  274. #line 6745 "./typica.w"
  275. class LinearSplineInterpolator:public QObject
  276. {
  277. Q_OBJECT
  278. public:
  279. LinearSplineInterpolator(QObject*parent= NULL);
  280. Q_INVOKABLE void add_pair(double source,double destination);
  281. public slots:
  282. Measurement newMeasurement(Measurement measure);
  283. signals:
  284. void newData(Measurement measure);
  285. private:
  286. void make_interpolators();
  287. QMap<double,double> *pairs;
  288. QList<LinearCalibrator*> *interpolators;
  289. };
  290. /*:281*//*286:*/
  291. #line 6881 "./typica.w"
  292. class TemperatureDisplay:public QLCDNumber
  293. {
  294. Q_OBJECT
  295. int unit;
  296. bool r;
  297. public:
  298. TemperatureDisplay(QWidget*parent= NULL);
  299. ~TemperatureDisplay();
  300. public slots:
  301. void setValue(Measurement temperature);
  302. void invalidate();
  303. void setDisplayUnits(Units::Unit scale);
  304. void setRelativeMode(bool relative);
  305. };
  306. /*:286*//*297:*/
  307. #line 7097 "./typica.w"
  308. class MeasurementTimeOffset:public QObject
  309. {
  310. Q_OBJECT
  311. QTime epoch;
  312. QTime previous;
  313. bool hasPrevious;
  314. public:
  315. MeasurementTimeOffset(QTime zero);
  316. QTime zeroTime();
  317. public slots:
  318. void newMeasurement(Measurement measure);
  319. void setZeroTime(QTime zero);
  320. signals:
  321. void measurement(Measurement measure);
  322. };
  323. /*:297*//*304:*/
  324. #line 7249 "./typica.w"
  325. class ThresholdDetector:public QObject
  326. {
  327. Q_OBJECT
  328. Q_ENUMS(EdgeDirection)
  329. public:
  330. enum EdgeDirection{
  331. Ascending,Descending
  332. };
  333. ThresholdDetector(double value);
  334. public slots:
  335. void newMeasurement(Measurement measure);
  336. void setThreshold(double value);
  337. void setEdgeDirection(EdgeDirection direction);
  338. signals:
  339. void timeForValue(double);
  340. private:
  341. double previousValue;
  342. double threshold;
  343. EdgeDirection currentDirection;
  344. };
  345. /*:304*//*309:*/
  346. #line 7355 "./typica.w"
  347. class ZeroEmitter:public QObject
  348. {
  349. Q_OBJECT
  350. Q_PROPERTY(int column READ column WRITE setColumn)
  351. Measurement cache;
  352. int col;
  353. public:
  354. ZeroEmitter(int tempcolumn= 1);
  355. int column();
  356. double lastTemperature();
  357. public slots:
  358. void newMeasurement(Measurement measure);
  359. void setColumn(int column);
  360. void emitZero();
  361. signals:
  362. void measurement(Measurement measure,int tempcolumn);
  363. };
  364. /*:309*//*314:*/
  365. #line 7449 "./typica.w"
  366. class MeasurementAdapter:public QObject
  367. {
  368. Q_OBJECT
  369. int col;
  370. public:
  371. MeasurementAdapter(int tempcolumn);
  372. int column();
  373. public slots:
  374. void newMeasurement(Measurement measure);
  375. void setColumn(int column);
  376. signals:
  377. void measurement(Measurement measure,int tempcolumn);
  378. };
  379. /*:314*//*319:*/
  380. #line 7538 "./typica.w"
  381. class GraphView:public QGraphicsView
  382. {
  383. Q_OBJECT
  384. QGraphicsScene*theScene;
  385. QMap<int,QList<QGraphicsLineItem*> *> *graphLines;
  386. QMap<int,QPointF> *prevPoints;
  387. QMap<int,double> *translations;
  388. QList<QGraphicsItem*> *gridLinesF;
  389. QList<QGraphicsItem*> *gridLinesC;
  390. QList<QGraphicsItem*> *relativeGridLines;
  391. bool relativeEnabled;
  392. bool timeIndicatorEnabled;
  393. QGraphicsLineItem*timeLine;
  394. LinearSplineInterpolator*relativeAdjuster;
  395. public:
  396. GraphView(QWidget*parent= NULL);
  397. void removeSeries(int column);
  398. protected:
  399. void resizeEvent(QResizeEvent*event);
  400. public slots:
  401. void newMeasurement(Measurement measure,int tempcolumn);
  402. void setSeriesTranslation(int column,double offset);
  403. void setTimeIndicatorEnabled(bool enabled);
  404. void clear();
  405. void showF();
  406. void showC();
  407. };
  408. /*:319*//*336:*/
  409. #line 8003 "./typica.w"
  410. class MeasurementModel;
  411. class ZoomLog:public QTableView
  412. {
  413. Q_OBJECT
  414. /*337:*/
  415. #line 8052 "./typica.w"
  416. MeasurementModel*model_ms;
  417. MeasurementModel*model_1s;
  418. MeasurementModel*model_5s;
  419. MeasurementModel*model_10s;
  420. MeasurementModel*model_15s;
  421. MeasurementModel*model_30s;
  422. MeasurementModel*model_1m;
  423. QList<MeasurementModel*> modelSet;
  424. QHash<int,Measurement> lastMeasurement;
  425. MeasurementModel*currentModel;
  426. QList<int> saveTempCols;
  427. QList<int> saveControlCols;
  428. QList<int> saveNoteCols;
  429. QList<int> currentColumnSet;
  430. /*:337*/
  431. #line 8008 "./typica.w"
  432. void switchLOD(MeasurementModel*m);
  433. private slots:
  434. void centerOn(int row);
  435. void persistColumnResize(int column,int oldsize,int newsize);
  436. void restoreColumnWidths();
  437. public:
  438. ZoomLog();
  439. QVariant data(int row,int column)const;
  440. int rowCount();
  441. bool saveXML(QIODevice*device);
  442. bool saveCSV(QIODevice*device);
  443. QString lastTime(int series);
  444. Q_INVOKABLE Units::Unit displayUnits();
  445. public slots:
  446. void setVisible(bool visibility);
  447. void setHeaderData(int section,QString text);
  448. void LOD_ms();
  449. void LOD_1s();
  450. void LOD_5s();
  451. void LOD_10s();
  452. void LOD_15s();
  453. void LOD_30s();
  454. void LOD_1m();
  455. void newMeasurement(Measurement measure,int tempcolumn);
  456. void newAnnotation(QString annotation,int tempcolumn,
  457. int annotationcolumn);
  458. void clear();
  459. void addOutputTemperatureColumn(int column);
  460. void addOutputControlColumn(int column);
  461. void addOutputAnnotationColumn(int column);
  462. void clearOutputColumns();
  463. void setDisplayUnits(Units::Unit scale);
  464. void addToCurrentColumnSet(int column);
  465. void clearCurrentColumnSet();
  466. protected:
  467. virtual void showEvent(QShowEvent*event);
  468. };
  469. /*:336*//*362:*/
  470. #line 8748 "./typica.w"
  471. class MeasurementList;
  472. class MeasurementModel:public QAbstractItemModel
  473. {
  474. Q_OBJECT
  475. Units::Unit unit;
  476. QList<MeasurementList*> *entries;
  477. QStringList*hData;
  478. int colcount;
  479. QHash<int,int> *lastTemperature;
  480. QList<MeasurementList*> ::iterator lastInsertion;
  481. QHash<int,bool> *controlColumns;
  482. public:
  483. MeasurementModel(QObject*parent= NULL);
  484. ~MeasurementModel();
  485. int rowCount(const QModelIndex&parent= QModelIndex())const;
  486. int columnCount(const QModelIndex&parent= QModelIndex())const;
  487. bool setHeaderData(int section,Qt::Orientation orientation,
  488. const QVariant&value,int role= Qt::DisplayRole);
  489. QVariant data(const QModelIndex&index,int role)const;
  490. bool setData(const QModelIndex&index,const QVariant&value,
  491. int role= Qt::EditRole);
  492. Qt::ItemFlags flags(const QModelIndex&index)const;
  493. QVariant headerData(int section,Qt::Orientation orientation,
  494. int role= Qt::DisplayRole)const;
  495. QModelIndex index(int row,int column,
  496. const QModelIndex&parent= QModelIndex())const;
  497. QModelIndex parent(const QModelIndex&index)const;
  498. Units::Unit displayUnits();
  499. public slots:
  500. void newMeasurement(Measurement measure,int tempcolumn);
  501. void newAnnotation(QString annotation,int tempcolumn,
  502. int annotationColumn);
  503. void clear();
  504. void setDisplayUnits(Units::Unit scale);
  505. signals:
  506. void rowChanged(int);
  507. };
  508. /*:362*//*363:*/
  509. #line 8792 "./typica.w"
  510. class MeasurementList:public QVariantList
  511. {
  512. public:
  513. bool operator<(const MeasurementList&other)const;
  514. bool operator==(const MeasurementList&other)const;
  515. };
  516. /*:363*//*389:*/
  517. #line 9450 "./typica.w"
  518. class AnnotationButton:public QPushButton
  519. {
  520. Q_OBJECT
  521. QString note;
  522. int tc;
  523. int ac;
  524. int count;
  525. public:
  526. AnnotationButton(const QString&text,QWidget*parent= NULL);
  527. public slots:
  528. void setAnnotation(const QString&annotation);
  529. void setTemperatureColumn(int tempcolumn);
  530. void setAnnotationColumn(int annotationcolumn);
  531. void annotate();
  532. void resetCount();
  533. signals:
  534. void annotation(QString annotation,int tempcolumn,
  535. int notecolumn);
  536. };
  537. /*:389*//*397:*/
  538. #line 9575 "./typica.w"
  539. class AnnotationSpinBox:public QDoubleSpinBox
  540. {
  541. Q_OBJECT
  542. QString pretext;
  543. QString posttext;
  544. int tc;
  545. int ac;
  546. bool change;
  547. public:
  548. AnnotationSpinBox(const QString&pret,const QString&postt,
  549. QWidget*parent= NULL);
  550. public slots:
  551. void setPretext(const QString&pret);
  552. void setPosttext(const QString&postt);
  553. void setTemperatureColumn(int tempcolumn);
  554. void setAnnotationColumn(int annotationcolumn);
  555. void annotate();
  556. void resetChange();
  557. signals:
  558. void annotation(QString annotation,int tempcolumn,
  559. int notecolumn);
  560. };
  561. /*:397*//*405:*/
  562. #line 9734 "./typica.w"
  563. class TimerDisplay:public QLCDNumber
  564. {
  565. Q_OBJECT
  566. /*406:*/
  567. #line 9784 "./typica.w"
  568. Q_PROPERTY(QTime seconds READ seconds WRITE setTimer)
  569. Q_PROPERTY(TimerMode mode READ mode WRITE setMode)
  570. Q_PROPERTY(bool running READ isRunning)
  571. Q_PROPERTY(QTime resetValue READ resetValue WRITE setResetValue)
  572. Q_PROPERTY(QString displayFormat READ displayFormat WRITE setDisplayFormat)
  573. Q_PROPERTY(bool autoReset READ autoReset WRITE setAutoReset)
  574. /*:406*/
  575. #line 9738 "./typica.w"
  576. private slots:
  577. void updateTime();
  578. void setCountUpMode();
  579. void setCountDownMode();
  580. void setClockMode();
  581. public:
  582. TimerDisplay(QWidget*parent= NULL);
  583. ~TimerDisplay();
  584. enum TimerMode
  585. {
  586. CountUp,
  587. CountDown,
  588. Clock
  589. };
  590. QString value();
  591. QTime seconds();
  592. TimerMode mode();
  593. bool isRunning();
  594. QTime resetValue();
  595. QString displayFormat();
  596. bool autoReset();
  597. public slots:
  598. void setTimer(QTime value= QTime(0,0,0));
  599. void setMode(TimerMode mode);
  600. void startTimer();
  601. void stopTimer();
  602. void copyTimer();
  603. void setResetValue(QTime value= QTime(0,0,0));
  604. void reset();
  605. void setDisplayFormat(QString format);
  606. void setAutoReset(bool reset);
  607. void updateDisplay();
  608. signals:
  609. void valueChanged(QTime);
  610. void runStateChanged(bool);
  611. private:
  612. /*407:*/
  613. #line 9794 "./typica.w"
  614. QTime s;
  615. QTime r;
  616. QTimer clock;
  617. TimerDisplay::TimerMode m;
  618. bool running;
  619. bool ar;
  620. QAction*startAction;
  621. QAction*stopAction;
  622. QAction*resetAction;
  623. QString f;
  624. QTime relative;
  625. QTime base;
  626. /*:407*/
  627. #line 9775 "./typica.w"
  628. };
  629. /*:405*//*427:*/
  630. #line 10153 "./typica.w"
  631. class PackLayout:public QLayout
  632. {
  633. int doLayout(const QRect&rect,bool testOnly)const;
  634. QList<QLayoutItem*> itemList;
  635. Qt::Orientations orientation;
  636. public:
  637. PackLayout(QWidget*parent,int margin= 0,int spacing= -1);
  638. PackLayout(int spacing= -1);
  639. ~PackLayout();
  640. void addItem(QLayoutItem*item);
  641. Qt::Orientations expandingDirections()const;
  642. bool hasHeightForWidth()const;
  643. int heightForWidth(int width)const;
  644. int count()const;
  645. QLayoutItem*itemAt(int index)const;
  646. QSize minimumSize()const;
  647. void setGeometry(const QRect&rect);
  648. void setOrientation(Qt::Orientations direction);
  649. QSize sizeHint()const;
  650. QLayoutItem*takeAt(int index);
  651. };
  652. /*:427*//*440:*/
  653. #line 10431 "./typica.w"
  654. class SceneButton:public QGraphicsScene
  655. {
  656. Q_OBJECT
  657. public:
  658. SceneButton();
  659. ~SceneButton();
  660. protected:
  661. void mousePressEvent(QGraphicsSceneMouseEvent*mouseEvent);
  662. signals:
  663. void clicked(QPoint pos);
  664. };
  665. /*:440*//*442:*/
  666. #line 10473 "./typica.w"
  667. class WidgetDecorator:public QWidget
  668. {
  669. Q_OBJECT
  670. PackLayout*layout;
  671. QGraphicsView*label;
  672. QGraphicsTextItem*text;
  673. SceneButton*scene;
  674. public:
  675. WidgetDecorator(QWidget*widget,const QString&labeltext,
  676. Qt::Orientations orientation= Qt::Horizontal,
  677. QWidget*parent= NULL,Qt::WindowFlags f= 0);
  678. ~WidgetDecorator();
  679. void setBackgroundBrush(QBrush background);
  680. void setTextColor(QColor color);
  681. };
  682. /*:442*//*453:*/
  683. #line 10648 "./typica.w"
  684. class LogEditWindow:public QMainWindow
  685. {
  686. Q_OBJECT
  687. QWidget*centralWidget;
  688. PackLayout*mainLayout;
  689. QHBoxLayout*addRowsLayout;
  690. QLabel*startTimeLabel;
  691. QTimeEdit*startTime;
  692. QLabel*endTimeLabel;
  693. QTimeEdit*endTime;
  694. QLabel*intervalLabel;
  695. QSpinBox*interval;
  696. QPushButton*addRows;
  697. QAction*saveXml;
  698. QAction*saveCsv;
  699. QAction*openXml;
  700. MeasurementModel*model;
  701. QTableView*log;
  702. private slots:
  703. void addTheRows();
  704. void saveXML();
  705. void saveCSV();
  706. void openXML();
  707. protected:
  708. void closeEvent(QCloseEvent*event);
  709. public:
  710. LogEditWindow();
  711. };
  712. /*:453*//*467:*/
  713. #line 10956 "./typica.w"
  714. class XMLOutput:public QObject
  715. {
  716. Q_OBJECT
  717. MeasurementModel*data;
  718. QIODevice*out;
  719. int time;
  720. QMap<int,QString> temperatureColumns;
  721. QMap<int,QString> controlColumns;
  722. QMap<int,QString> annotationColumns;
  723. public:
  724. XMLOutput(MeasurementModel*model,QIODevice*device,int timec= 0);
  725. void addTemperatureColumn(const QString&series,int column);
  726. void addControlColumn(const QString&series,int column);
  727. void addAnnotationColumn(const QString&series,int column);
  728. void setModel(MeasurementModel*model);
  729. void setTimeColumn(int column);
  730. void setDevice(QIODevice*device);
  731. bool output();
  732. };
  733. /*:467*//*474:*/
  734. #line 11192 "./typica.w"
  735. class XMLInput:public QObject
  736. {
  737. Q_OBJECT
  738. int firstc;
  739. QIODevice*in;
  740. public:
  741. XMLInput(QIODevice*input,int c);
  742. void setFirstColumn(int column);
  743. void setDevice(QIODevice*device);
  744. bool input();
  745. signals:
  746. void measure(Measurement,int);
  747. void annotation(QString,int,int);
  748. void newTemperatureColumn(int,QString);
  749. void newAnnotationColumn(int,QString);
  750. void lastColumn(int);
  751. };
  752. /*:474*//*485:*/
  753. #line 11447 "./typica.w"
  754. class CSVOutput
  755. {
  756. MeasurementModel*data;
  757. QIODevice*out;
  758. int time;
  759. QMap<int,QString> temperatureColumns;
  760. QMap<int,QString> controlColumns;
  761. QMap<int,QString> annotationColumns;
  762. public:
  763. CSVOutput(MeasurementModel*model,QIODevice*device,int timec= 0);
  764. void addTemperatureColumn(const QString&series,int column);
  765. void addControlColumn(const QString&series,int column);
  766. void addAnnotationColumn(const QString&series,int column);
  767. void setModel(MeasurementModel*model);
  768. void setTimeColumn(int column);
  769. void setDevice(QIODevice*device);
  770. bool output();
  771. };
  772. /*:485*//*515:*/
  773. #line 11590 "./typica.w"
  774. #define AppInstance (qobject_cast<Application *> (qApp))
  775. class NodeInserter;
  776. class DeviceTreeModel;
  777. class Application:public QApplication
  778. {
  779. Q_OBJECT
  780. public:
  781. Application(int&argc,char**argv);
  782. QDomDocument*configuration();
  783. /*633:*/
  784. #line 14116 "./typica.w"
  785. QDomDocument deviceConfiguration();
  786. /*:633*//*666:*/
  787. #line 14789 "./typica.w"
  788. void registerDeviceConfigurationWidget(QString driver,QMetaObject widget);
  789. QWidget*deviceConfigurationWidget(DeviceTreeModel*model,
  790. const QModelIndex&index);
  791. /*:666*//*671:*/
  792. #line 14893 "./typica.w"
  793. QList<NodeInserter*> topLevelNodeInserters;
  794. /*:671*/
  795. #line 11601 "./typica.w"
  796. QSqlDatabase database();
  797. QScriptEngine*engine;
  798. public slots:
  799. /*634:*/
  800. #line 14123 "./typica.w"
  801. void saveDeviceConfiguration();
  802. /*:634*/
  803. #line 11605 "./typica.w"
  804. private:
  805. /*632:*/
  806. #line 14107 "./typica.w"
  807. QDomDocument deviceConfigurationDocument;
  808. /*:632*//*665:*/
  809. #line 14783 "./typica.w"
  810. QHash<QString,QMetaObject> deviceConfigurationWidgets;
  811. /*:665*/
  812. #line 11607 "./typica.w"
  813. QDomDocument conf;
  814. };
  815. /*:515*//*523:*/
  816. #line 11732 "./typica.w"
  817. class SaltModel:public QAbstractItemModel
  818. {
  819. Q_OBJECT
  820. QList<QList<QMap<int,QVariant> > > modelData;
  821. QStringList hData;
  822. int colcount;
  823. public:
  824. SaltModel(int columns);
  825. ~SaltModel();
  826. int rowCount(const QModelIndex&parent= QModelIndex())const;
  827. int columnCount(const QModelIndex&parent= QModelIndex())const;
  828. bool setHeaderData(int section,Qt::Orientation orientation,
  829. const QVariant&value,int role= Qt::DisplayRole);
  830. QVariant data(const QModelIndex&index,int role)const;
  831. bool setData(const QModelIndex&index,const QVariant&value,
  832. int role= Qt::EditRole);
  833. Qt::ItemFlags flags(const QModelIndex&index)const;
  834. QVariant headerData(int section,Qt::Orientation orientation,
  835. int role= Qt::DisplayRole)const;
  836. QModelIndex index(int row,int column,
  837. const QModelIndex&parent= QModelIndex())const;
  838. QModelIndex parent(const QModelIndex&index)const;
  839. QString arrayLiteral(int column,int role)const;
  840. QString quotedArrayLiteral(int column,int role)const;
  841. void clear();
  842. bool removeRows(int row,int count,
  843. const QModelIndex&parent= QModelIndex());
  844. int findData(const QVariant&value,int column,int role= Qt::UserRole);
  845. };
  846. /*:523*//*539:*/
  847. #line 12117 "./typica.w"
  848. class SqlComboBox:public QComboBox
  849. {
  850. Q_OBJECT
  851. int dataColumn;
  852. int displayColumn;
  853. bool dataColumnShown;
  854. QString specialNullText;
  855. QVariant specialNullData;
  856. public:
  857. SqlComboBox();
  858. ~SqlComboBox();
  859. SqlComboBox*clone(QWidget*parent);
  860. public slots:
  861. void addNullOption();
  862. void addSqlOptions(QString query);
  863. void setDataColumn(int column);
  864. void setDisplayColumn(int column);
  865. void showData(bool show);
  866. void setNullText(QString nullText);
  867. void setNullData(QVariant nullData);
  868. };
  869. /*:539*//*546:*/
  870. #line 12264 "./typica.w"
  871. class SqlComboBoxDelegate:public QItemDelegate
  872. {
  873. Q_OBJECT
  874. SqlComboBox*delegate;
  875. public:
  876. SqlComboBoxDelegate(QObject*parent= NULL);
  877. QWidget*createEditor(QWidget*parent,
  878. const QStyleOptionViewItem&option,
  879. const QModelIndex&index)const;
  880. void setEditorData(QWidget*editor,const QModelIndex&index)const;
  881. void setModelData(QWidget*editor,QAbstractItemModel*model,
  882. const QModelIndex&index)const;
  883. void setWidget(SqlComboBox*widget);
  884. virtual QSize sizeHint()const;
  885. void updateEditorGeometry(QWidget*editor,
  886. const QStyleOptionViewItem&option,
  887. const QModelIndex&index)const;
  888. };
  889. /*:546*//*558:*/
  890. #line 12449 "./typica.w"
  891. class SqlConnectionSetup:public QDialog
  892. {
  893. Q_OBJECT
  894. public:
  895. SqlConnectionSetup();
  896. ~SqlConnectionSetup();
  897. public slots:
  898. void testConnection();
  899. private:
  900. QFormLayout*formLayout;
  901. QComboBox*driver;
  902. QLineEdit*hostname;
  903. QLineEdit*dbname;
  904. QLineEdit*user;
  905. QLineEdit*password;
  906. QVBoxLayout*layout;
  907. QHBoxLayout*buttons;
  908. QPushButton*cancelButton;
  909. QPushButton*connectButton;
  910. };
  911. /*:558*//*563:*/
  912. #line 12584 "./typica.w"
  913. class SqlQueryView:public QTableView
  914. {
  915. Q_OBJECT
  916. public:
  917. SqlQueryView(QWidget*parent= NULL);
  918. void setQuery(const QString&query);
  919. bool setHeaderData(int section,Qt::Orientation orientation,
  920. const QVariant&value,int role);
  921. Q_INVOKABLE QVariant data(int row,int column,
  922. int role= Qt::DisplayRole);
  923. signals:
  924. void openEntry(QString key);
  925. void openEntryRow(int row);
  926. protected:
  927. virtual void showEvent(QShowEvent*event);
  928. private slots:
  929. void openRow(const QModelIndex&index);
  930. void persistColumnResize(int column,int oldsize,int newsize);
  931. };
  932. /*:563*//*578:*/
  933. #line 12839 "./typica.w"
  934. class ReportAction:public QAction
  935. {
  936. Q_OBJECT
  937. public:
  938. ReportAction(const QString&fileName,const QString&reportName,
  939. QObject*parent= NULL);
  940. private slots:
  941. void createReport();
  942. private:
  943. QString reportFile;
  944. };
  945. /*:578*//*590:*/
  946. #line 13048 "./typica.w"
  947. class ReportTable:public QObject
  948. {
  949. Q_OBJECT
  950. QTextFrame*area;
  951. QDomElement configuration;
  952. QMap<QString,QVariant> bindings;
  953. public:
  954. ReportTable(QTextFrame*frame,QDomElement description);
  955. ~ReportTable();
  956. Q_INVOKABLE void bind(QString placeholder,QVariant value);
  957. public slots:
  958. void refresh();
  959. };
  960. /*:590*//*602:*/
  961. #line 13285 "./typica.w"
  962. class FormArray:public QScrollArea
  963. {
  964. Q_OBJECT
  965. QDomElement configuration;
  966. QWidget itemContainer;
  967. QVBoxLayout itemLayout;
  968. int maxwidth;
  969. int maxheight;
  970. public:
  971. FormArray(QDomElement description);
  972. Q_INVOKABLE QWidget*elementAt(int index);
  973. Q_INVOKABLE int elements();
  974. public slots:
  975. void addElements(int copies= 1);
  976. void removeAllElements();
  977. void setMaximumElementWidth(int width);
  978. void setMaximumElementHeight(int height);
  979. };
  980. /*:602*//*612:*/
  981. #line 13501 "./typica.w"
  982. class ScaleControl:public QGraphicsView
  983. {
  984. Q_OBJECT
  985. Q_PROPERTY(double initialValue READ initialValue WRITE setInitialValue)
  986. Q_PROPERTY(double finalValue READ finalValue WRITE setFinalValue)
  987. /*613:*/
  988. #line 13527 "./typica.w"
  989. QGraphicsScene scene;
  990. QGraphicsPolygonItem initialDecrement;
  991. QGraphicsPolygonItem initialIncrement;
  992. QGraphicsPolygonItem finalDecrement;
  993. QGraphicsPolygonItem finalIncrement;
  994. QGraphicsPolygonItem initialIndicator;
  995. QGraphicsPolygonItem finalIndicator;
  996. QGraphicsPathItem scaleLine;
  997. QPolygonF left;
  998. QPolygonF right;
  999. QPolygonF down;
  1000. QPolygonF up;
  1001. QPainterPath scalePath;
  1002. QBrush initialBrush;
  1003. QBrush finalBrush;
  1004. double nonScoredValue;
  1005. double scoredValue;
  1006. bool initialSet;
  1007. bool finalSet;
  1008. bool scaleDown;
  1009. /*:613*/
  1010. #line 13507 "./typica.w"
  1011. public:
  1012. ScaleControl();
  1013. double initialValue(void);
  1014. double finalValue(void);
  1015. virtual QSize sizeHint()const;
  1016. public slots:
  1017. void setInitialValue(double value);
  1018. void setFinalValue(double value);
  1019. signals:
  1020. void initialChanged(double);
  1021. void finalChanged(double);
  1022. protected:
  1023. virtual void mousePressEvent(QMouseEvent*event);
  1024. virtual void mouseReleaseEvent(QMouseEvent*event);
  1025. };
  1026. /*:612*//*624:*/
  1027. #line 13824 "./typica.w"
  1028. class IntensityControl:public QGraphicsView
  1029. {
  1030. Q_OBJECT
  1031. Q_PROPERTY(double value READ value WRITE setValue)
  1032. QGraphicsScene scene;
  1033. QGraphicsPolygonItem decrement;
  1034. QGraphicsPolygonItem increment;
  1035. QGraphicsPolygonItem indicator;
  1036. QGraphicsPathItem scaleLine;
  1037. QPolygonF left;
  1038. QPolygonF up;
  1039. QPolygonF down;
  1040. QPainterPath scalePath;
  1041. QBrush theBrush;
  1042. double theValue;
  1043. bool valueSet;
  1044. bool scaleDown;
  1045. public:
  1046. IntensityControl();
  1047. double value();
  1048. virtual QSize sizeHint()const;
  1049. public slots:
  1050. void setValue(double val);
  1051. signals:
  1052. void valueChanged(double);
  1053. protected:
  1054. virtual void mousePressEvent(QMouseEvent*event);
  1055. virtual void mouseReleaseEvent(QMouseEvent*event);
  1056. };
  1057. /*:624*//*640:*/
  1058. #line 14212 "./typica.w"
  1059. class DeviceTreeModelNode
  1060. {
  1061. public:
  1062. DeviceTreeModelNode(QDomNode&node,int row,
  1063. DeviceTreeModelNode*parent= NULL);
  1064. ~DeviceTreeModelNode();
  1065. DeviceTreeModelNode*child(int index);
  1066. DeviceTreeModelNode*parent();
  1067. QDomNode node()const;
  1068. int row();
  1069. private:
  1070. QDomNode domNode;
  1071. QHash<int,DeviceTreeModelNode*> children;
  1072. int rowNumber;
  1073. DeviceTreeModelNode*parentItem;
  1074. };
  1075. /*:640*//*642:*/
  1076. #line 14287 "./typica.w"
  1077. class DeviceTreeModel:public QAbstractItemModel
  1078. {
  1079. Q_OBJECT
  1080. public:
  1081. DeviceTreeModel(QObject*parent= NULL);
  1082. ~DeviceTreeModel();
  1083. QVariant data(const QModelIndex&index,int role)const;
  1084. Qt::ItemFlags flags(const QModelIndex&index)const;
  1085. QVariant headerData(int section,Qt::Orientation orientation,
  1086. int role= Qt::DisplayRole)const;
  1087. QModelIndex index(int row,int column,
  1088. const QModelIndex&parent= QModelIndex())const;
  1089. QModelIndex parent(const QModelIndex&child)const;
  1090. int rowCount(const QModelIndex&parent= QModelIndex())const;
  1091. int columnCount(const QModelIndex&parent= QModelIndex())const;
  1092. bool setData(const QModelIndex&index,const QVariant&value,
  1093. int role);
  1094. bool removeRows(int row,int count,const QModelIndex&parent);
  1095. QDomElement referenceElement(const QString&id);
  1096. public slots:
  1097. void newNode(const QString&name,const QString&driver,
  1098. const QModelIndex&parent);
  1099. private:
  1100. QDomDocument document;
  1101. DeviceTreeModelNode*root;
  1102. QDomNode referenceSection;
  1103. QDomNode treeRoot;
  1104. };
  1105. /*:642*//*661:*/
  1106. #line 14741 "./typica.w"
  1107. Q_DECLARE_METATYPE(QModelIndex)
  1108. /*:661*//*669:*/
  1109. #line 14848 "./typica.w"
  1110. class NodeInserter:public QAction
  1111. {
  1112. Q_OBJECT
  1113. public:
  1114. NodeInserter(const QString&title,const QString&name,
  1115. const QString&driver,QObject*parent= NULL);
  1116. signals:
  1117. void triggered(QString name,QString driver);
  1118. private slots:
  1119. void onTriggered();
  1120. private:
  1121. QString defaultNodeName;
  1122. QString driverString;
  1123. };
  1124. /*:669*//*672:*/
  1125. #line 14903 "./typica.w"
  1126. class DeviceConfigurationWindow:public QWidget
  1127. {
  1128. Q_OBJECT
  1129. public:
  1130. DeviceConfigurationWindow();
  1131. public slots:
  1132. void addDevice();
  1133. void removeNode();
  1134. void newSelection(const QModelIndex&index);
  1135. private slots:
  1136. void resizeColumn();
  1137. private:
  1138. QDomDocument document;
  1139. DeviceTreeModel*model;
  1140. QTreeView*view;
  1141. QScrollArea*configArea;
  1142. };
  1143. /*:672*//*681:*/
  1144. #line 15072 "./typica.w"
  1145. class BasicDeviceConfigurationWidget:public QWidget
  1146. {
  1147. Q_OBJECT
  1148. public:
  1149. BasicDeviceConfigurationWidget(DeviceTreeModel*model,
  1150. const QModelIndex&index);
  1151. public slots:
  1152. void insertChildNode(const QString&name,const QString&driver);
  1153. void updateAttribute(const QString&name,const QString&value);
  1154. protected:
  1155. DeviceTreeModel*deviceModel;
  1156. QModelIndex currentNode;
  1157. };
  1158. /*:681*//*685:*/
  1159. #line 15157 "./typica.w"
  1160. class RoasterConfWidget:public BasicDeviceConfigurationWidget
  1161. {
  1162. Q_OBJECT
  1163. public:
  1164. Q_INVOKABLE RoasterConfWidget(DeviceTreeModel*model,
  1165. const QModelIndex&index);
  1166. private slots:
  1167. void updateRoasterId(int id);
  1168. };
  1169. /*:685*//*690:*/
  1170. #line 15292 "./typica.w"
  1171. class NiDaqMxBaseDriverConfWidget:public BasicDeviceConfigurationWidget
  1172. {
  1173. Q_OBJECT
  1174. public:
  1175. Q_INVOKABLE NiDaqMxBaseDriverConfWidget(DeviceTreeModel*model,
  1176. const QModelIndex&index);
  1177. };
  1178. /*:690*//*692:*/
  1179. #line 15338 "./typica.w"
  1180. class NiDaqMxBase9211ConfWidget:public BasicDeviceConfigurationWidget
  1181. {
  1182. Q_OBJECT
  1183. public:
  1184. Q_INVOKABLE NiDaqMxBase9211ConfWidget(DeviceTreeModel*device,
  1185. const QModelIndex&index);
  1186. private slots:
  1187. void addChannel();
  1188. void updateDeviceId(const QString&newId);
  1189. };
  1190. /*:692*//*696:*/
  1191. #line 15424 "./typica.w"
  1192. class Ni9211TcConfWidget:public BasicDeviceConfigurationWidget
  1193. {
  1194. Q_OBJECT
  1195. public:
  1196. Q_INVOKABLE Ni9211TcConfWidget(DeviceTreeModel*device,
  1197. const QModelIndex&index);
  1198. private slots:
  1199. void updateThermocoupleType(const QString&type);
  1200. void updateColumnName(const QString&name);
  1201. void updateHidden(bool hidden);
  1202. };
  1203. /*:696*//*701:*/
  1204. #line 15540 "./typica.w"
  1205. class NiDaqMxDriverConfWidget:public BasicDeviceConfigurationWidget
  1206. {
  1207. Q_OBJECT
  1208. public:
  1209. Q_INVOKABLE NiDaqMxDriverConfWidget(DeviceTreeModel*model,
  1210. const QModelIndex&index);
  1211. };
  1212. /*:701*//*703:*/
  1213. #line 15581 "./typica.w"
  1214. class NiDaqMx9211ConfWidget:public BasicDeviceConfigurationWidget
  1215. {
  1216. Q_OBJECT
  1217. public:
  1218. Q_INVOKABLE NiDaqMx9211ConfWidget(DeviceTreeModel*model,
  1219. const QModelIndex&index);
  1220. private slots:
  1221. void addChannel();
  1222. void updateDeviceId(const QString&newId);
  1223. };
  1224. /*:703*//*705:*/
  1225. #line 15650 "./typica.w"
  1226. class NiDaqMxTc01ConfWidget:public BasicDeviceConfigurationWidget
  1227. {
  1228. Q_OBJECT
  1229. public:
  1230. Q_INVOKABLE NiDaqMxTc01ConfWidget(DeviceTreeModel*model,
  1231. const QModelIndex&index);
  1232. private slots:
  1233. void updateDeviceId(const QString&newId);
  1234. void updateThermocoupleType(const QString&type);
  1235. void updateColumnName(const QString&name);
  1236. void updateHidden(bool hidden);
  1237. };
  1238. /*:705*//*710:*/
  1239. #line 15781 "./typica.w"
  1240. class PortSelector:public QComboBox
  1241. {
  1242. Q_OBJECT
  1243. public:
  1244. PortSelector(QWidget*parent= NULL);
  1245. private slots:
  1246. void addDevice(QextPortInfo port);
  1247. private:
  1248. QextSerialEnumerator*lister;
  1249. };
  1250. /*:710*//*712:*/
  1251. #line 15829 "./typica.w"
  1252. class BaudSelector:public QComboBox
  1253. {
  1254. Q_OBJECT
  1255. Q_ENUMS(BaudRateType)
  1256. public:
  1257. BaudSelector(QWidget*parent= NULL);
  1258. enum BaudRateType
  1259. {
  1260. #if defined(Q_OS_UNIX) || defined(qdoc)
  1261. BAUD50= 50,
  1262. BAUD75= 75,
  1263. BAUD134= 134,
  1264. BAUD150= 150,
  1265. BAUD200= 200,
  1266. BAUD1800= 1800,
  1267. #if defined(B76800) || defined(qdoc)
  1268. BAUD76800= 76800,
  1269. #endif
  1270. #if (defined(B230400) && defined(B4000000)) || defined(qdoc)
  1271. BAUD230400= 230400,
  1272. BAUD460800= 460800,
  1273. BAUD500000= 500000,
  1274. BAUD576000= 576000,
  1275. BAUD921600= 921600,
  1276. BAUD1000000= 1000000,
  1277. BAUD1152000= 1152000,
  1278. BAUD1500000= 1500000,
  1279. BAUD2000000= 2000000,
  1280. BAUD2500000= 2500000,
  1281. BAUD3000000= 3000000,
  1282. BAUD3500000= 3500000,
  1283. BAUD4000000= 4000000,
  1284. #endif
  1285. #endif
  1286. #if defined(Q_OS_WIN) || defined(qdoc)
  1287. BAUD14400= 14400,
  1288. BAUD56000= 56000,
  1289. BAUD128000= 128000,
  1290. BAUD256000= 256000,
  1291. #endif
  1292. BAUD110= 110,
  1293. BAUD300= 300,
  1294. BAUD600= 600,
  1295. BAUD1200= 1200,
  1296. BAUD2400= 2400,
  1297. BAUD4800= 4800,
  1298. BAUD9600= 9600,
  1299. BAUD19200= 19200,
  1300. BAUD38400= 38400,
  1301. BAUD57600= 57600,
  1302. BAUD115200= 115200
  1303. };
  1304. };
  1305. /*:712*//*714:*/
  1306. #line 15900 "./typica.w"
  1307. class ParitySelector:public QComboBox
  1308. {
  1309. Q_OBJECT
  1310. Q_ENUMS(ParityType)
  1311. public:
  1312. ParitySelector(QWidget*parent= NULL);
  1313. enum ParityType
  1314. {
  1315. PAR_NONE,
  1316. PAR_ODD,
  1317. PAR_EVEN,
  1318. #if defined(Q_OS_WIN) || defined(qdoc)
  1319. PAR_MARK,
  1320. #endif
  1321. PAR_SPACE
  1322. };
  1323. };
  1324. /*:714*//*716:*/
  1325. #line 15938 "./typica.w"
  1326. class FlowSelector:public QComboBox
  1327. {
  1328. Q_OBJECT
  1329. Q_ENUMS(FlowType)
  1330. public:
  1331. FlowSelector(QWidget*parent= NULL);
  1332. enum FlowType
  1333. {
  1334. FLOW_OFF,
  1335. FLOW_HARDWARE,
  1336. FLOW_XONXOFF
  1337. };
  1338. };
  1339. /*:716*//*718:*/
  1340. #line 15971 "./typica.w"
  1341. class StopSelector:public QComboBox
  1342. {
  1343. Q_OBJECT
  1344. Q_ENUMS(StopBitsType)
  1345. public:
  1346. StopSelector(QWidget*parent= NULL);
  1347. enum StopBitsType
  1348. {
  1349. STOP_1,
  1350. #if defined(Q_OS_WIN) || defined(qdoc)
  1351. STOP_1_5,
  1352. #endif
  1353. STOP_2
  1354. };
  1355. };
  1356. /*:718*//*721:*/
  1357. #line 16024 "./typica.w"
  1358. class ShortHexSpinBox:public QSpinBox
  1359. {
  1360. Q_OBJECT
  1361. public:
  1362. ShortHexSpinBox(QWidget*parent= NULL);
  1363. virtual QValidator::State validate(QString&input,int&pos)const;
  1364. protected:
  1365. virtual int valueFromText(const QString&text)const;
  1366. virtual QString textFromValue(int value)const;
  1367. };
  1368. /*:721*//*723:*/
  1369. #line 16086 "./typica.w"
  1370. class ModbusRtuPortConfWidget:public BasicDeviceConfigurationWidget
  1371. {
  1372. Q_OBJECT
  1373. public:
  1374. Q_INVOKABLE ModbusRtuPortConfWidget(DeviceTreeModel*model,
  1375. const QModelIndex&index);
  1376. private slots:
  1377. void updatePort(const QString&newPort);
  1378. void updateBaudRate(const QString&newRate);
  1379. void updateParity(const QString&newParity);
  1380. void updateFlowControl(const QString&newFlow);
  1381. void updateStopBits(const QString&newStopBits);
  1382. };
  1383. /*:723*//*725:*/
  1384. #line 16237 "./typica.w"
  1385. class ModbusRtuDeviceConfWidget:public BasicDeviceConfigurationWidget
  1386. {
  1387. Q_OBJECT
  1388. public:
  1389. Q_INVOKABLE ModbusRtuDeviceConfWidget(DeviceTreeModel*model,
  1390. const QModelIndex&index);
  1391. private slots:
  1392. void updateStationNumber(int newStation);
  1393. void updateFixedUnit(bool newFixed);
  1394. void updateFixedDecimal(bool newFixed);
  1395. void updateUnit(const QString&newUnit);
  1396. void updateUnitAddress(int newAddress);
  1397. void updateValueF(int newValue);
  1398. void updateValueC(int newValue);
  1399. void updatePrecisionAddress(int newAddress);
  1400. void updatePrecisionValue(int newValue);
  1401. private:
  1402. QStackedLayout*unitSpecificationLayout;
  1403. QStackedLayout*decimalSpecificationLayout;
  1404. };
  1405. /*:725*//*727:*/
  1406. #line 16496 "./typica.w"
  1407. class ModbusRtuDeviceTPvConfWidget:public BasicDeviceConfigurationWidget
  1408. {
  1409. Q_OBJECT
  1410. public:
  1411. Q_INVOKABLE ModbusRtuDeviceTPvConfWidget(DeviceTreeModel*model,
  1412. const QModelIndex&index);
  1413. private slots:
  1414. void updateAddress(int newAddress);
  1415. };
  1416. /*:727*//*729:*/
  1417. #line 16542 "./typica.w"
  1418. class ModbusRtuDeviceTSvConfWidget:public BasicDeviceConfigurationWidget
  1419. {
  1420. Q_OBJECT
  1421. public:
  1422. Q_INVOKABLE ModbusRtuDeviceTSvConfWidget(DeviceTreeModel*model,
  1423. const QModelIndex&index);
  1424. private slots:
  1425. void updateReadAddress(int newAddress);
  1426. void updateWriteAddress(int newAddress);
  1427. void updateFixedRange(bool fixed);
  1428. void updateLower(const QString&lower);
  1429. void updateUpper(const QString&upper);
  1430. void updateLowerAddress(int newAddress);
  1431. void updateUpperAddress(int newAddress);
  1432. private:
  1433. QStackedLayout*boundsLayout;
  1434. };
  1435. /*:729*//*733:*/
  1436. #line 16736 "./typica.w"
  1437. class AnnotationButtonConfWidget:public BasicDeviceConfigurationWidget
  1438. {
  1439. Q_OBJECT
  1440. public:
  1441. Q_INVOKABLE AnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1442. private slots:
  1443. void updateButtonText(const QString&text);
  1444. void updateAnnotationText(const QString&text);
  1445. };
  1446. /*:733*//*737:*/
  1447. #line 16804 "./typica.w"
  1448. class ReconfigurableAnnotationButtonConfWidget:public BasicDeviceConfigurationWidget
  1449. {
  1450. Q_OBJECT
  1451. public:
  1452. Q_INVOKABLE ReconfigurableAnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1453. private slots:
  1454. void updateButtonText(const QString&text);
  1455. void updateAnnotationText(const QString&text);
  1456. };
  1457. /*:737*//*740:*/
  1458. #line 16878 "./typica.w"
  1459. class NoteSpinConfWidget:public BasicDeviceConfigurationWidget
  1460. {
  1461. Q_OBJECT
  1462. public:
  1463. Q_INVOKABLE NoteSpinConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1464. private slots:
  1465. void updateLabel(const QString&text);
  1466. void updateMinimum(const QString&minimum);
  1467. void updateMaximum(const QString&maximum);
  1468. void updatePrecision(int precision);
  1469. void updatePretext(const QString&text);
  1470. void updatePosttext(const QString&text);
  1471. };
  1472. /*:740*//*743:*/
  1473. #line 12 "./freeannotation.w"
  1474. class FreeAnnotationConfWidget:public BasicDeviceConfigurationWidget
  1475. {
  1476. Q_OBJECT
  1477. public:
  1478. Q_INVOKABLE FreeAnnotationConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1479. private slots:
  1480. void updateLabel(const QString&text);
  1481. };
  1482. /*:743*//*747:*/
  1483. #line 11 "./settings.w"
  1484. class SettingsWindow:public QMainWindow
  1485. {
  1486. Q_OBJECT
  1487. public:
  1488. SettingsWindow();
  1489. };
  1490. /*:747*//*752:*/
  1491. #line 8 "./graphsettings.w"
  1492. class GraphSettingsWidget:public QWidget
  1493. {
  1494. Q_OBJECT
  1495. public:
  1496. GraphSettingsWidget();
  1497. };
  1498. /*:752*//*754:*/
  1499. #line 46 "./graphsettings.w"
  1500. class GraphSettingsRelativeTab:public QWidget
  1501. {
  1502. Q_OBJECT
  1503. public:
  1504. GraphSettingsRelativeTab();
  1505. public slots:
  1506. void updateEnableSetting(bool enable);
  1507. void updateColorSetting(const QString&color);
  1508. void updateAxisSetting(const QString&gridList);
  1509. void updateUnit(int unit);
  1510. void showColorPicker();
  1511. private:
  1512. QLineEdit*colorEdit;
  1513. };
  1514. /*:754*//*758:*/
  1515. #line 17003 "./typica.w"
  1516. class ModbusRTUDevice:public QObject
  1517. {
  1518. Q_OBJECT
  1519. public:
  1520. ModbusRTUDevice(DeviceTreeModel*model,const QModelIndex&index);
  1521. ~ModbusRTUDevice();
  1522. void queueMessage(QByteArray request,QObject*object,const char*callback);
  1523. Q_INVOKABLE double SVLower();
  1524. Q_INVOKABLE double SVUpper();
  1525. Q_INVOKABLE int decimals();
  1526. QList<Channel*> channels;
  1527. public slots:
  1528. void outputSV(double sv);
  1529. signals:
  1530. void SVLowerChanged(double);
  1531. void SVUpperChanged(double);
  1532. void SVDecimalChanged(int);
  1533. void queueEmpty();
  1534. private slots:
  1535. void dataAvailable();
  1536. void sendNextMessage();
  1537. void decimalResponse(QByteArray response);
  1538. void unitResponse(QByteArray response);
  1539. void svlResponse(QByteArray response);
  1540. void svuResponse(QByteArray response);
  1541. void requestMeasurement();
  1542. void mResponse(QByteArray response);
  1543. void ignore(QByteArray response);
  1544. private:
  1545. QextSerialPort*port;
  1546. QByteArray responseBuffer;
  1547. QList<QByteArray> messageQueue;
  1548. QList<QObject*> retObjQueue;
  1549. QList<char*> callbackQueue;
  1550. quint16 calculateCRC(QByteArray data);
  1551. QTimer*messageDelayTimer;
  1552. int delayTime;
  1553. char station;
  1554. int decimalPosition;
  1555. int valueF;
  1556. int valueC;
  1557. bool unitIsF;
  1558. double outputSVLower;
  1559. double outputSVUpper;
  1560. QByteArray outputSVStub;
  1561. QByteArray pvStub;
  1562. QByteArray svStub;
  1563. QByteArray mStub;
  1564. quint16 pvaddress;
  1565. quint16 svaddress;
  1566. bool svenabled;
  1567. bool readingsv;
  1568. double savedpv;
  1569. bool waiting;
  1570. };
  1571. /*:758*//*773:*/
  1572. #line 17675 "./typica.w"
  1573. class ModbusConfigurator:public BasicDeviceConfigurationWidget
  1574. {
  1575. Q_OBJECT
  1576. public:
  1577. Q_INVOKABLE ModbusConfigurator(DeviceTreeModel*model,const QModelIndex&index);
  1578. private slots:
  1579. void updatePort(const QString&newPort);
  1580. void updateBaudRate(const QString&newRate);
  1581. void updateParity(const QString&newParity);
  1582. void updateFlowControl(const QString&newFlow);
  1583. void updateStopBits(const QString&newStopBits);
  1584. void updateStation(int station);
  1585. void updateFixedDecimal(bool fixed);
  1586. void updateDecimalAddress(int address);
  1587. void updateDecimalPosition(int position);
  1588. void updateFixedUnit(bool fixed);
  1589. void updateUnitAddress(int address);
  1590. void updateValueForF(int value);
  1591. void updateValueForC(int value);
  1592. void updateUnit(const QString&newUnit);
  1593. void updatePVAddress(int address);
  1594. void updateSVEnabled(bool enabled);
  1595. void updateSVReadAddress(int address);
  1596. void updateDeviceLimit(bool query);
  1597. void updateSVLowerAddress(int address);
  1598. void updateSVUpperAddress(int address);
  1599. void updateSVLower(double value);
  1600. void updateSVUpper(double value);
  1601. void updateSVWritable(bool canWriteSV);
  1602. void updateSVWriteAddress(int address);
  1603. void updatePVColumnName(const QString&name);
  1604. void updateSVColumnName(const QString&name);
  1605. void updatePVHidden(bool hidden);
  1606. void updateSVHidden(bool hidden);
  1607. private:
  1608. PortSelector*port;
  1609. BaudSelector*baud;
  1610. ParitySelector*parity;
  1611. FlowSelector*flow;
  1612. StopSelector*stop;
  1613. QSpinBox*station;
  1614. QCheckBox*decimalQuery;
  1615. ShortHexSpinBox*decimalAddress;
  1616. QSpinBox*decimalPosition;
  1617. QCheckBox*unitQuery;
  1618. ShortHexSpinBox*unitAddress;
  1619. QSpinBox*valueF;
  1620. QSpinBox*valueC;
  1621. QComboBox*fixedUnit;
  1622. ShortHexSpinBox*pVAddress;
  1623. QCheckBox*sVEnabled;
  1624. ShortHexSpinBox*sVReadAddress;
  1625. QCheckBox*deviceLimit;
  1626. ShortHexSpinBox*sVLowerAddr;
  1627. ShortHexSpinBox*sVUpperAddr;
  1628. QDoubleSpinBox*sVLower;
  1629. QDoubleSpinBox*sVUpper;
  1630. QCheckBox*sVWritable;
  1631. ShortHexSpinBox*sVOutputAddr;
  1632. QLineEdit*pVColumnName;
  1633. QLineEdit*sVColumnName;
  1634. };
  1635. /*:773*//*777:*/
  1636. #line 18209 "./typica.w"
  1637. class LinearSplineInterpolationConfWidget:public BasicDeviceConfigurationWidget
  1638. {
  1639. Q_OBJECT
  1640. public:
  1641. Q_INVOKABLE LinearSplineInterpolationConfWidget(DeviceTreeModel*model,
  1642. const QModelIndex&index);
  1643. private slots:
  1644. void updateSourceColumn(const QString&source);
  1645. void updateDestinationColumn(const QString&dest);
  1646. void updateKnots();
  1647. private:
  1648. SaltModel*tablemodel;
  1649. };
  1650. /*:777*//*783:*/
  1651. #line 18333 "./typica.w"
  1652. class TranslationConfWidget:public BasicDeviceConfigurationWidget
  1653. {
  1654. Q_OBJECT
  1655. public:
  1656. Q_INVOKABLE TranslationConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1657. private slots:
  1658. void updateMatchingColumn(const QString&column);
  1659. void updateTemperature();
  1660. private:
  1661. QDoubleSpinBox*temperatureValue;
  1662. QComboBox*unitSelector;
  1663. };
  1664. /*:783*//*787:*/
  1665. #line 16 "./rate.w"
  1666. class RateOfChange:public QObject
  1667. {
  1668. Q_OBJECT
  1669. public:
  1670. RateOfChange(int cachetime= 1,int scaletime= 1);
  1671. public slots:
  1672. void newMeasurement(Measurement measure);
  1673. void setCacheTime(int seconds);
  1674. void setScaleTime(int seconds);
  1675. signals:
  1676. void newData(Measurement measure);
  1677. private:
  1678. int ct;
  1679. int st;
  1680. QList<Measurement> cache;
  1681. QMap<double,double> smoothCache;
  1682. };
  1683. /*:787*//*795:*/
  1684. #line 196 "./rate.w"
  1685. class RateOfChangeConfWidget:public BasicDeviceConfigurationWidget
  1686. {
  1687. Q_OBJECT
  1688. public:
  1689. Q_INVOKABLE RateOfChangeConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1690. private slots:
  1691. void updateColumn(const QString&column);
  1692. void updateCacheTime(const QString&seconds);
  1693. void updateScaleTime(const QString&seconds);
  1694. };
  1695. /*:795*//*801:*/
  1696. #line 19 "./dataqsdk.w"
  1697. class DataqSdkDeviceImplementation;
  1698. class DataqSdkDevice:public QObject
  1699. {
  1700. Q_OBJECT
  1701. DataqSdkDeviceImplementation*imp;
  1702. private slots:
  1703. void threadFinished();
  1704. public:
  1705. DataqSdkDevice(QString device);
  1706. ~DataqSdkDevice();
  1707. Channel*newChannel(Units::Unit scale);
  1708. Q_INVOKABLE void setClockRate(double Hz);
  1709. Q_INVOKABLE void start();
  1710. static QStringList detectPorts();
  1711. static QStringList detectHardware();
  1712. };
  1713. /*:801*//*802:*/
  1714. #line 49 "./dataqsdk.w"
  1715. class DataqSdkDeviceImplementation:public QThread
  1716. {
  1717. Q_OBJECT
  1718. public:
  1719. DataqSdkDeviceImplementation();
  1720. ~DataqSdkDeviceImplementation();
  1721. void run();
  1722. /*803:*/
  1723. #line 70 "./dataqsdk.w"
  1724. typedef struct di_inlist_struct{
  1725. unsigned short chan;
  1726. unsigned short diff;
  1727. unsigned short gain;
  1728. unsigned short unipolar;
  1729. unsigned short dig_out_enable;
  1730. unsigned short dig_out;
  1731. unsigned short ave;
  1732. unsigned short counter;
  1733. }DI_INLIST_STRUCT;
  1734. typedef int(PASCAL*FPDIOPEN)(unsigned);
  1735. typedef int(PASCAL*FPDICLOSE)(void);
  1736. typedef double(PASCAL*FPDISAMPLERATE)(double,long*,long*);
  1737. typedef double(PASCAL*FPDIMAXIMUMRATE)(double);
  1738. typedef int(PASCAL*FPDILISTLENGTH)(unsigned,unsigned);
  1739. typedef int(PASCAL*FPDIINLIST)(di_inlist_struct*);
  1740. typedef int*(PASCAL*FPDIBUFFERALLOC)(unsigned,unsigned);
  1741. typedef int(PASCAL*FPDISTARTSCAN)(void);
  1742. typedef unsigned(PASCAL*FPDISTATUSREAD)(short*,unsigned);
  1743. typedef unsigned(PASCAL*FPDIBUFFERSTATUS)(unsigned);
  1744. typedef int(PASCAL*FPDIBURSTRATE)(unsigned);
  1745. typedef int(PASCAL*FPDISTOPSCAN)(void);
  1746. FPDIOPEN di_open;
  1747. FPDICLOSE di_close;
  1748. FPDISAMPLERATE di_sample_rate;
  1749. FPDIMAXIMUMRATE di_maximum_rate;
  1750. FPDILISTLENGTH di_list_length;
  1751. FPDIINLIST di_inlist;
  1752. FPDIBUFFERALLOC di_buffer_alloc;
  1753. FPDISTARTSCAN di_start_scan;
  1754. FPDISTATUSREAD di_status_read;
  1755. FPDIBUFFERSTATUS di_buffer_status;
  1756. FPDIBURSTRATE di_burst_rate;
  1757. FPDISTOPSCAN di_stop_scan;
  1758. /*:803*/
  1759. #line 57 "./dataqsdk.w"
  1760. /*805:*/
  1761. #line 134 "./dataqsdk.w"
  1762. bool isOpen;
  1763. double sampleRate;
  1764. long oversample;
  1765. long burstDivisor;
  1766. QString device;
  1767. unsigned deviceNumber;
  1768. QVector<Channel*> channelMap;
  1769. int error;
  1770. int channels;
  1771. bool ready;
  1772. QLibrary*driver;
  1773. QVector<Units::Unit> unitMap;
  1774. int*input_buffer;
  1775. QTimer*eventClock;
  1776. QMultiMap<int,double> smoother;
  1777. /*:805*/
  1778. #line 58 "./dataqsdk.w"
  1779. public slots:
  1780. void measure();
  1781. private:
  1782. qint16*buffer;
  1783. };
  1784. /*:802*//*822:*/
  1785. #line 663 "./dataqsdk.w"
  1786. class DataqSdkDeviceConfWidget:public BasicDeviceConfigurationWidget
  1787. {
  1788. Q_OBJECT
  1789. public:
  1790. Q_INVOKABLE DataqSdkDeviceConfWidget(DeviceTreeModel*model,
  1791. const QModelIndex&index);
  1792. private slots:
  1793. void updateAutoSelect(bool automatic);
  1794. void updateDeviceNumber(int deviceNumber);
  1795. void updatePort(QString portId);
  1796. void addChannel();
  1797. private:
  1798. QStackedWidget*deviceIdStack;
  1799. };
  1800. /*:822*//*827:*/
  1801. #line 808 "./dataqsdk.w"
  1802. class DataqSdkChannelConfWidget:public BasicDeviceConfigurationWidget
  1803. {
  1804. Q_OBJECT
  1805. public:
  1806. Q_INVOKABLE DataqSdkChannelConfWidget(DeviceTreeModel*model,
  1807. const QModelIndex&index);
  1808. private slots:
  1809. void updateUnits(const QString&unit);
  1810. void updateColumnName(const QString&value);
  1811. void updateMeasuredLower(const QString&value);
  1812. void updateMeasuredUpper(const QString&value);
  1813. void updateMappedLower(const QString&value);
  1814. void updateMappedUpper(const QString&value);
  1815. void updateClosedInterval(bool closed);
  1816. void updateSmoothingEnabled(bool enabled);
  1817. void updateSensitivity(const QString&value);
  1818. void startCalibration();
  1819. void stopCalibration();
  1820. void resetCalibration();
  1821. void updateInput(Measurement measure);
  1822. void updateOutput(Measurement measure);
  1823. void updateHidden(bool hidden);
  1824. private:
  1825. QPushButton*startButton;
  1826. QPushButton*resetButton;
  1827. QPushButton*stopButton;
  1828. /*832:*/
  1829. #line 1098 "./dataqsdk.w"
  1830. bool autoSelect;
  1831. QString deviceID;
  1832. int channelOfInterest;
  1833. /*:832*/
  1834. #line 835 "./dataqsdk.w"
  1835. DataqSdkDevice*calibrationDevice;
  1836. LinearCalibrator*calibrator;
  1837. QLineEdit*currentMeasurement;
  1838. QLineEdit*minimumMeasurement;
  1839. QLineEdit*maximumMeasurement;
  1840. QLineEdit*averageMeasurement;
  1841. QLineEdit*currentMapped;
  1842. QLineEdit*minimumMapped;
  1843. QLineEdit*maximumMapped;
  1844. QLineEdit*averageMapped;
  1845. int rmCount;
  1846. int cmCount;
  1847. double rmin;
  1848. double rmax;
  1849. double rmean;
  1850. double cmin;
  1851. double cmax;
  1852. double cmean;
  1853. };
  1854. /*:827*//*854:*/
  1855. #line 247 "./scales.w"
  1856. Q_DECLARE_METATYPE(BaudRateType)
  1857. Q_DECLARE_METATYPE(DataBitsType)
  1858. Q_DECLARE_METATYPE(ParityType)
  1859. Q_DECLARE_METATYPE(StopBitsType)
  1860. Q_DECLARE_METATYPE(FlowType)
  1861. /*:854*//*861:*/
  1862. #line 370 "./scales.w"
  1863. class SerialScaleConfWidget:public BasicDeviceConfigurationWidget
  1864. {
  1865. Q_OBJECT
  1866. public:
  1867. Q_INVOKABLE SerialScaleConfWidget(DeviceTreeModel*model,
  1868. const QModelIndex&index);
  1869. private slots:
  1870. void updatePort(const QString&newPort);
  1871. void updateBaudRate(const QString&rate);
  1872. void updateParity(int index);
  1873. void updateFlowControl(int index);
  1874. void updateStopBits(int index);
  1875. private:
  1876. PortSelector*port;
  1877. BaudSelector*baud;
  1878. ParitySelector*parity;
  1879. FlowSelector*flow;
  1880. StopSelector*stop;
  1881. };
  1882. /*:861*//*866:*/
  1883. #line 14 "./valueannotation.w"
  1884. class ValueAnnotationConfWidget:public BasicDeviceConfigurationWidget
  1885. {
  1886. Q_OBJECT
  1887. public:
  1888. Q_INVOKABLE ValueAnnotationConfWidget(DeviceTreeModel*model,
  1889. const QModelIndex&index);
  1890. private slots:
  1891. void updateSourceColumn(const QString&source);
  1892. void updateAnnotations();
  1893. void updateStart(bool noteOnStart);
  1894. private:
  1895. SaltModel*tablemodel;
  1896. };
  1897. /*:866*//*874:*/
  1898. #line 165 "./valueannotation.w"
  1899. class ValueAnnotation:public QObject
  1900. {
  1901. Q_OBJECT
  1902. public:
  1903. ValueAnnotation();
  1904. Q_INVOKABLE void setAnnotation(double value,const QString&annotation);
  1905. public slots:
  1906. void newMeasurement(Measurement measure);
  1907. void annotate();
  1908. void setAnnotationColumn(int column);
  1909. void setTemperatureColumn(int column);
  1910. void setTolerance(double epsilon);
  1911. signals:
  1912. void annotation(QString annotation,int tempcolumn,int notecolumn);
  1913. private:
  1914. int lastIndex;
  1915. int annotationColumn;
  1916. int measurementColumn;
  1917. QList<double> values;
  1918. QStringList annotations;
  1919. double tolerance;
  1920. };
  1921. /*:874*/
  1922. #line 526 "./typica.w"
  1923. /*12:*/
  1924. #line 794 "./typica.w"
  1925. void setQObjectProperties(QScriptValue value,QScriptEngine*engine);
  1926. /*:12*//*14:*/
  1927. #line 809 "./typica.w"
  1928. void setQPaintDeviceProperties(QScriptValue value,QScriptEngine*engine);
  1929. void setQLayoutItemProperties(QScriptValue value,QScriptEngine*engine);
  1930. /*:14*//*16:*/
  1931. #line 834 "./typica.w"
  1932. void setQWidgetProperties(QScriptValue value,QScriptEngine*engine);
  1933. QScriptValue constructQWidget(QScriptContext*context,QScriptEngine*engine);
  1934. QScriptValue QWidget_setLayout(QScriptContext*context,QScriptEngine*engine);
  1935. QScriptValue QWidget_activateWindow(QScriptContext*context,
  1936. QScriptEngine*engine);
  1937. /*:16*//*27:*/
  1938. #line 1078 "./typica.w"
  1939. QScriptValue constructQMainWindow(QScriptContext*context,
  1940. QScriptEngine*engine);
  1941. QScriptValue QMainWindow_setCentralWidget(QScriptContext*context,
  1942. QScriptEngine*engine);
  1943. QScriptValue QMainWindow_menuBar(QScriptContext*context,
  1944. QScriptEngine*engine);
  1945. void setQMainWindowProperties(QScriptValue value,QScriptEngine*engine);
  1946. /*:27*//*32:*/
  1947. #line 1177 "./typica.w"
  1948. void setQMenuBarProperties(QScriptValue value,QScriptEngine*engine);
  1949. QScriptValue QMenuBar_addMenu(QScriptContext*context,QScriptEngine*engine);
  1950. /*:32*//*35:*/
  1951. #line 1222 "./typica.w"
  1952. void setQMenuProperties(QScriptValue value,QScriptEngine*engine);
  1953. QScriptValue QMenu_addAction(QScriptContext*context,QScriptEngine*engine);
  1954. QScriptValue QMenu_addSeparator(QScriptContext*context,QScriptEngine*engine);
  1955. /*:35*//*38:*/
  1956. #line 1288 "./typica.w"
  1957. void setQFrameProperties(QScriptValue value,QScriptEngine*engine);
  1958. QScriptValue constructQFrame(QScriptContext*context,QScriptEngine*engine);
  1959. /*:38*//*41:*/
  1960. #line 1321 "./typica.w"
  1961. void setQLabelProperties(QScriptValue value,QScriptEngine*engine);
  1962. QScriptValue constructQLabel(QScriptContext*context,QScriptEngine*engine);
  1963. /*:41*//*44:*/
  1964. #line 1359 "./typica.w"
  1965. void setQLineEditProperties(QScriptValue value,QScriptEngine*engine);
  1966. QScriptValue constructQLineEdit(QScriptContext*context,QScriptEngine*engine);
  1967. /*:44*//*48:*/
  1968. #line 1398 "./typica.w"
  1969. QScriptValue constructQSplitter(QScriptContext*context,QScriptEngine*engine);
  1970. QScriptValue QSplitter_addWidget(QScriptContext*context,
  1971. QScriptEngine*engine);
  1972. QScriptValue QSplitter_saveState(QScriptContext*context,
  1973. QScriptEngine*engine);
  1974. QScriptValue QSplitter_restoreState(QScriptContext*context,
  1975. QScriptEngine*engine);
  1976. void setQSplitterProperties(QScriptValue value,QScriptEngine*engine);
  1977. /*:48*//*53:*/
  1978. #line 1517 "./typica.w"
  1979. void setQLayoutProperties(QScriptValue value,QScriptEngine*engine);
  1980. QScriptValue QLayout_addWidget(QScriptContext*context,QScriptEngine*engine);
  1981. /*:53*//*55:*/
  1982. #line 1572 "./typica.w"
  1983. QScriptValue constructQBoxLayout(QScriptContext*context,
  1984. QScriptEngine*engine);
  1985. void setQBoxLayoutProperties(QScriptValue value,QScriptEngine*engine);
  1986. QScriptValue QBoxLayout_addLayout(QScriptContext*context,QScriptEngine*engine);
  1987. QScriptValue QBoxLayout_addWidget(QScriptContext*context,QScriptEngine*engine);
  1988. /*:55*//*59:*/
  1989. #line 1685 "./typica.w"
  1990. QScriptValue constructQAction(QScriptContext*context,QScriptEngine*engine);
  1991. QScriptValue QAction_setShortcut(QScriptContext*context,
  1992. QScriptEngine*engine);
  1993. void setQActionProperties(QScriptValue value,QScriptEngine*engine);
  1994. /*:59*//*62:*/
  1995. #line 1741 "./typica.w"
  1996. QScriptValue QFileDialog_getOpenFileName(QScriptContext*context,
  1997. QScriptEngine*engine);
  1998. QScriptValue QFileDialog_getSaveFileName(QScriptContext*context,
  1999. QScriptEngine*engine);
  2000. void setQFileDialogProperties(QScriptValue value,QScriptEngine*engine);
  2001. void setQDialogProperties(QScriptValue value,QScriptEngine*engine);
  2002. /*:62*//*67:*/
  2003. #line 1852 "./typica.w"
  2004. QScriptValue constructQFile(QScriptContext*context,QScriptEngine*engine);
  2005. void setQFileProperties(QScriptValue value,QScriptEngine*engine);
  2006. QScriptValue QFile_remove(QScriptContext*context,QScriptEngine*engine);
  2007. void setQIODeviceProperties(QScriptValue value,QScriptEngine*engine);
  2008. QScriptValue QIODevice_open(QScriptContext*context,QScriptEngine*engine);
  2009. QScriptValue QIODevice_close(QScriptContext*context,QScriptEngine*engine);
  2010. QScriptValue QIODevice_readToString(QScriptContext*context,
  2011. QScriptEngine*engine);
  2012. /*:67*//*74:*/
  2013. #line 1974 "./typica.w"
  2014. QScriptValue constructQBuffer(QScriptContext*context,QScriptEngine*engine);
  2015. void setQBufferProperties(QScriptValue value,QScriptEngine*engine);
  2016. QScriptValue QBuffer_setData(QScriptContext*context,QScriptEngine*engine);
  2017. /*:74*//*77:*/
  2018. #line 2019 "./typica.w"
  2019. QScriptValue constructXQuery(QScriptContext*context,QScriptEngine*engine);
  2020. QScriptValue XQuery_bind(QScriptContext*context,QScriptEngine*engine);
  2021. QScriptValue XQuery_exec(QScriptContext*context,QScriptEngine*engine);
  2022. QScriptValue XQuery_setQuery(QScriptContext*context,QScriptEngine*engine);
  2023. QScriptValue XQuery_invalidate(QScriptContext*context,QScriptEngine*engine);
  2024. void setXQueryProperties(QScriptValue value,QScriptEngine*engine);
  2025. /*:77*//*83:*/
  2026. #line 2101 "./typica.w"
  2027. QScriptValue constructXmlWriter(QScriptContext*context,QScriptEngine*engine);
  2028. QScriptValue XmlWriter_setDevice(QScriptContext*context,
  2029. QScriptEngine*engine);
  2030. QScriptValue XmlWriter_writeAttribute(QScriptContext*context,
  2031. QScriptEngine*engine);
  2032. QScriptValue XmlWriter_writeCDATA(QScriptContext*context,
  2033. QScriptEngine*engine);
  2034. QScriptValue XmlWriter_writeCharacters(QScriptContext*context,
  2035. QScriptEngine*engine);
  2036. QScriptValue XmlWriter_writeDTD(QScriptContext*context,QScriptEngine*engine);
  2037. QScriptValue XmlWriter_writeEmptyElement(QScriptContext*context,
  2038. QScriptEngine*engine);
  2039. QScriptValue XmlWriter_writeEndDocument(QScriptContext*context,
  2040. QScriptEngine*engine);
  2041. QScriptValue XmlWriter_writeEndElement(QScriptContext*context,
  2042. QScriptEngine*engine);
  2043. QScriptValue XmlWriter_writeEntityReference(QScriptContext*context,
  2044. QScriptEngine*engine);
  2045. QScriptValue XmlWriter_writeProcessingInstruction(QScriptContext*context,
  2046. QScriptEngine*engine);
  2047. QScriptValue XmlWriter_writeStartDocument(QScriptContext*context,
  2048. QScriptEngine*engine);
  2049. QScriptValue XmlWriter_writeStartElement(QScriptContext*context,
  2050. QScriptEngine*engine);
  2051. QScriptValue XmlWriter_writeTextElement(QScriptContext*context,
  2052. QScriptEngine*engine);
  2053. void setXmlWriterProperties(QScriptValue value,QScriptEngine*engine);
  2054. /*:83*//*92:*/
  2055. #line 2319 "./typica.w"
  2056. QScriptValue constructXmlReader(QScriptContext*context,QScriptEngine*engine);
  2057. QScriptValue XmlReader_atEnd(QScriptContext*context,QScriptEngine*engine);
  2058. QScriptValue XmlReader_attribute(QScriptContext*context,
  2059. QScriptEngine*engine);
  2060. QScriptValue XmlReader_hasAttribute(QScriptContext*context,
  2061. QScriptEngine*engine);
  2062. QScriptValue XmlReader_isDTD(QScriptContext*context,QScriptEngine*engine);
  2063. QScriptValue XmlReader_isStartElement(QScriptContext*context,
  2064. QScriptEngine*engine);
  2065. QScriptValue XmlReader_name(QScriptContext*context,QScriptEngine*engine);
  2066. QScriptValue XmlReader_readElementText(QScriptContext*context,
  2067. QScriptEngine*engine);
  2068. QScriptValue XmlReader_readNext(QScriptContext*context,QScriptEngine*engine);
  2069. QScriptValue XmlReader_text(QScriptContext*context,QScriptEngine*engine);
  2070. void setXmlReaderProperties(QScriptValue value,QScriptEngine*engine);
  2071. /*:92*//*99:*/
  2072. #line 2454 "./typica.w"
  2073. QScriptValue QSettings_value(QScriptContext*context,QScriptEngine*engine);
  2074. QScriptValue QSettings_setValue(QScriptContext*context,QScriptEngine*engine);
  2075. void setQSettingsProperties(QScriptValue value,QScriptEngine*engine);
  2076. /*:99*//*103:*/
  2077. #line 2536 "./typica.w"
  2078. QScriptValue constructQLCDNumber(QScriptContext*context,
  2079. QScriptEngine*engine);
  2080. void setQLCDNumberProperties(QScriptValue value,QScriptEngine*engine);
  2081. /*:103*//*106:*/
  2082. #line 2574 "./typica.w"
  2083. QScriptValue constructQTime(QScriptContext*context,QScriptEngine*engine);
  2084. QScriptValue QTime_addMSecs(QScriptContext*context,QScriptEngine*engine);
  2085. QScriptValue QTime_addSecs(QScriptContext*context,QScriptEngine*engine);
  2086. QScriptValue QTime_elapsed(QScriptContext*context,QScriptEngine*engine);
  2087. QScriptValue QTime_hour(QScriptContext*context,QScriptEngine*engine);
  2088. QScriptValue QTime_isNull(QScriptContext*context,QScriptEngine*engine);
  2089. QScriptValue QTime_isValid(QScriptContext*context,QScriptEngine*engine);
  2090. QScriptValue QTime_minute(QScriptContext*context,QScriptEngine*engine);
  2091. QScriptValue QTime_msec(QScriptContext*context,QScriptEngine*engine);
  2092. QScriptValue QTime_msecsTo(QScriptContext*context,QScriptEngine*engine);
  2093. QScriptValue QTime_restart(QScriptContext*context,QScriptEngine*engine);
  2094. QScriptValue QTime_second(QScriptContext*context,QScriptEngine*engine);
  2095. QScriptValue QTime_secsTo(QScriptContext*context,QScriptEngine*engine);
  2096. QScriptValue QTime_setHMS(QScriptContext*context,QScriptEngine*engine);
  2097. QScriptValue QTime_start(QScriptContext*context,QScriptEngine*engine);
  2098. QScriptValue QTime_toString(QScriptContext*context,QScriptEngine*engine);
  2099. QScriptValue QTime_currentTime(QScriptContext*context,QScriptEngine*engine);
  2100. QScriptValue QTime_fromString(QScriptContext*context,QScriptEngine*engine);
  2101. QScriptValue QTime_valueOf(QScriptContext*context,QScriptEngine*engine);
  2102. void setQTimeProperties(QScriptValue value,QScriptEngine*engine);
  2103. /*:106*//*121:*/
  2104. #line 3043 "./typica.w"
  2105. void setQAbstractScrollAreaProperties(QScriptValue value,
  2106. QScriptEngine*engine);
  2107. /*:121*//*123:*/
  2108. #line 3058 "./typica.w"
  2109. void setQAbstractItemViewProperties(QScriptValue value,QScriptEngine*engine);
  2110. /*:123*//*125:*/
  2111. #line 3071 "./typica.w"
  2112. void setQGraphicsViewProperties(QScriptValue value,QScriptEngine*engine);
  2113. void setQTableViewProperties(QScriptValue value,QScriptEngine*engine);
  2114. /*:125*//*127:*/
  2115. #line 3095 "./typica.w"
  2116. void setQAbstractButtonProperties(QScriptValue value,QScriptEngine*engine);
  2117. void setQPushButtonProperties(QScriptValue value,QScriptEngine*engine);
  2118. QScriptValue constructQPushButton(QScriptContext*context,
  2119. QScriptEngine*engine);
  2120. /*:127*//*134:*/
  2121. #line 3194 "./typica.w"
  2122. void setQSqlQueryProperties(QScriptValue value,QScriptEngine*engine);
  2123. QScriptValue constructQSqlQuery(QScriptContext*context,QScriptEngine*engine);
  2124. QScriptValue QSqlQuery_bind(QScriptContext*context,QScriptEngine*engine);
  2125. QScriptValue QSqlQuery_bindDeviceData(QScriptContext*context,
  2126. QScriptEngine*engine);
  2127. QScriptValue QSqlQuery_bindFileData(QScriptContext*context,
  2128. QScriptEngine*engine);
  2129. QScriptValue QSqlQuery_exec(QScriptContext*context,
  2130. QScriptEngine*engine);
  2131. QScriptValue QSqlQuery_executedQuery(QScriptContext*context,
  2132. QScriptEngine*engine);
  2133. QScriptValue QSqlQuery_invalidate(QScriptContext*context,QScriptEngine*engine);
  2134. QScriptValue QSqlQuery_next(QScriptContext*context,QScriptEngine*engine);
  2135. QScriptValue QSqlQuery_prepare(QScriptContext*context,QScriptEngine*engine);
  2136. QScriptValue QSqlQuery_value(QScriptContext*context,QScriptEngine*engine);
  2137. /*:134*//*141:*/
  2138. #line 3365 "./typica.w"
  2139. QScriptValue baseName(QScriptContext*context,QScriptEngine*engine);
  2140. QScriptValue dir(QScriptContext*context,QScriptEngine*engine);
  2141. QScriptValue sqlToArray(QScriptContext*context,QScriptEngine*engine);
  2142. QScriptValue setFont(QScriptContext*context,QScriptEngine*engine);
  2143. QScriptValue annotationFromRecord(QScriptContext*context,
  2144. QScriptEngine*engine);
  2145. QScriptValue setTabOrder(QScriptContext*context,QScriptEngine*engine);
  2146. /*:141*//*152:*/
  2147. #line 3652 "./typica.w"
  2148. QScriptValue createWindow(QScriptContext*context,QScriptEngine*engine);
  2149. QScriptValue createReport(QScriptContext*context,QScriptEngine*engine);
  2150. void addLayoutToWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  2151. QStack<QLayout*> *layoutStack);
  2152. void addLayoutToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2153. QStack<QLayout*> *layoutStack);
  2154. void addSplitterToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2155. QStack<QLayout*> *layoutStack);
  2156. void addSplitterToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2157. QStack<QLayout*> *layoutStack);
  2158. void populateGridLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2159. QStack<QLayout*> *layoutStack);
  2160. void populateBoxLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2161. QStack<QLayout*> *layoutStack);
  2162. void populateSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2163. QStack<QLayout*> *layoutStack);
  2164. void populateWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  2165. QStack<QLayout*> *layoutStack);
  2166. void populateStackedLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2167. QStack<QLayout*> *layoutStack);
  2168. void addTemperatureDisplayToSplitter(QDomElement element,
  2169. QStack<QWidget*> *widgetStack,
  2170. QStack<QLayout*> *layoutStack);
  2171. void addTemperatureDisplayToLayout(QDomElement element,
  2172. QStack<QWidget*> *widgetStack,
  2173. QStack<QLayout*> *layoutStack);
  2174. void addTimerDisplayToSplitter(QDomElement element,
  2175. QStack<QWidget*> *widgetStack,
  2176. QStack<QLayout*> *layoutStack);
  2177. void addTimerDisplayToLayout(QDomElement element,
  2178. QStack<QWidget*> *widgetStack,
  2179. QStack<QLayout*> *layoutStack);
  2180. void addDecorationToSplitter(QDomElement element,
  2181. QStack<QWidget*> *widgetStack,
  2182. QStack<QLayout*> *layoutStack);
  2183. void addDecorationToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2184. QStack<QLayout*> *layoutStack);
  2185. void addWidgetToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2186. QStack<QLayout*> *layoutStack);
  2187. void addButtonToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2188. QStack<QLayout*> *layoutStack);
  2189. void addZoomLogToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2190. QStack<QLayout*> *layoutStack);
  2191. void addGraphToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2192. QStack<QLayout*> *layoutStack);
  2193. void addSqlDropToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2194. QStack<QLayout*> *layoutStack);
  2195. void addSaltToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2196. QStack<QLayout*> *layoutStack);
  2197. void addLineToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2198. QStack<QLayout*> *layoutStack);
  2199. void addTextToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2200. QStack<QLayout*> *layoutStack);
  2201. void addSqlQueryViewToLayout(QDomElement element,
  2202. QStack<QWidget*> *widgetStack,
  2203. QStack<QLayout*> *layoutStack);
  2204. void addCalendarToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2205. QStack<QLayout*> *layoutStack);
  2206. void addSpinBoxToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2207. QStack<QLayout*> *layoutStack);
  2208. /*:152*//*204:*/
  2209. #line 5214 "./typica.w"
  2210. void setQDateEditProperties(QScriptValue value,QScriptEngine*engine);
  2211. void setQDateTimeEditProperties(QScriptValue value,QScriptEngine*engine);
  2212. QScriptValue QDateTimeEdit_setDate(QScriptContext*context,
  2213. QScriptEngine*engine);
  2214. QScriptValue QDateTimeEdit_day(QScriptContext*context,QScriptEngine*engine);
  2215. QScriptValue QDateTimeEdit_month(QScriptContext*context,
  2216. QScriptEngine*engine);
  2217. QScriptValue QDateTimeEdit_year(QScriptContext*context,QScriptEngine*engine);
  2218. /*:204*//*205:*/
  2219. #line 5229 "./typica.w"
  2220. QScriptValue findChildObject(QScriptContext*context,QScriptEngine*engine);
  2221. /*:205*//*209:*/
  2222. #line 5360 "./typica.w"
  2223. void setSaltTableProperties(QScriptValue value,QScriptEngine*engine);
  2224. QScriptValue SaltTable_bindableColumnArray(QScriptContext*context,
  2225. QScriptEngine*engine);
  2226. QScriptValue SaltTable_bindableQuotedColumnArray(QScriptContext*context,
  2227. QScriptEngine*engine);
  2228. QScriptValue SaltTable_columnSum(QScriptContext*context,
  2229. QScriptEngine*engine);
  2230. QScriptValue SaltTable_columnArray(QScriptContext*context,
  2231. QScriptEngine*engine);
  2232. QScriptValue SaltTable_data(QScriptContext*context,QScriptEngine*engine);
  2233. QScriptValue SaltTable_model(QScriptContext*context,QScriptEngine*engine);
  2234. QScriptValue SaltTable_quotedColumnArray(QScriptContext*context,
  2235. QScriptEngine*engine);
  2236. QScriptValue SaltTable_setData(QScriptContext*context,QScriptEngine*engine);
  2237. QScriptValue SaltTable_clear(QScriptContext*context,QScriptEngine*engine);
  2238. QScriptValue SaltTable_removeRow(QScriptContext*context,QScriptEngine*engine);
  2239. QScriptValue SaltTable_findData(QScriptContext*context,QScriptEngine*engine);
  2240. /*:209*//*219:*/
  2241. #line 5576 "./typica.w"
  2242. void setSqlComboBoxProperties(QScriptValue value,QScriptEngine*engine);
  2243. void setQComboBoxProperties(QScriptValue value,QScriptEngine*engine);
  2244. QScriptValue QComboBox_currentData(QScriptContext*context,
  2245. QScriptEngine*engine);
  2246. QScriptValue QComboBox_addItem(QScriptContext*context,QScriptEngine*engine);
  2247. QScriptValue QComboBox_setModel(QScriptContext*context,QScriptEngine*engine);
  2248. QScriptValue QComboBox_findText(QScriptContext*context,QScriptEngine*engine);
  2249. QScriptValue QComboBox_findData(QScriptContext*context,QScriptEngine*engine);
  2250. /*:219*//*231:*/
  2251. #line 366 "./units.w"
  2252. QScriptValue Units_convertTemperature(QScriptContext*context,QScriptEngine*engine);
  2253. QScriptValue Units_convertRelativeTemperature(QScriptContext*context,
  2254. QScriptEngine*engine);
  2255. QScriptValue Units_isTemperatureUnit(QScriptContext*context,QScriptEngine*engine);
  2256. QScriptValue Units_convertWeight(QScriptContext*context,QScriptEngine*engine);
  2257. QScriptValue Units_isWeightUnit(QScriptContext*context,QScriptEngine*engine);
  2258. /*:231*//*235:*/
  2259. #line 430 "./units.w"
  2260. QScriptValue Unit_toScriptValue(QScriptEngine*engine,const Units::Unit&value);
  2261. void Unit_fromScriptValue(const QScriptValue&sv,Units::Unit&value);
  2262. /*:235*//*258:*/
  2263. #line 6210 "./typica.w"
  2264. QScriptValue constructDAQ(QScriptContext*context,QScriptEngine*engine);
  2265. QScriptValue DAQ_newChannel(QScriptContext*context,QScriptEngine*engine);
  2266. void setDAQProperties(QScriptValue value,QScriptEngine*engine);
  2267. /*:258*//*267:*/
  2268. #line 6415 "./typica.w"
  2269. QScriptValue constructFakeDAQ(QScriptContext*context,QScriptEngine*engine);
  2270. QScriptValue FakeDAQ_newChannel(QScriptContext*context,QScriptEngine*engine);
  2271. void setFakeDAQProperties(QScriptValue value,QScriptEngine*engine);
  2272. /*:267*//*272:*/
  2273. #line 6516 "./typica.w"
  2274. void setChannelProperties(QScriptValue value,QScriptEngine*engine);
  2275. /*:272*//*278:*/
  2276. #line 6698 "./typica.w"
  2277. QScriptValue constructLinearCalibrator(QScriptContext*context,
  2278. QScriptEngine*engine);
  2279. void setLinearCalibratorProperties(QScriptValue value,QScriptEngine*engine);
  2280. /*:278*//*283:*/
  2281. #line 6838 "./typica.w"
  2282. QScriptValue constructLinearSplineInterpolator(QScriptContext*context,QScriptEngine*engine);
  2283. void setLinearSplineInterpolatorProperties(QScriptValue value,QScriptEngine*engine);
  2284. /*:283*//*293:*/
  2285. #line 7040 "./typica.w"
  2286. QScriptValue constructTemperatureDisplay(QScriptContext*context,
  2287. QScriptEngine*engine);
  2288. void setTemperatureDisplayProperties(QScriptValue value,QScriptEngine*engine);
  2289. QScriptValue TemperatureDisplay_setDisplayUnits(QScriptContext*context,
  2290. QScriptEngine*engine);
  2291. /*:293*//*301:*/
  2292. #line 7199 "./typica.w"
  2293. QScriptValue constructMeasurementTimeOffset(QScriptContext*context,
  2294. QScriptEngine*engine);
  2295. void setMeasurementTimeOffsetProperties(QScriptValue value,
  2296. QScriptEngine*engine);
  2297. /*:301*//*306:*/
  2298. #line 7312 "./typica.w"
  2299. QScriptValue constructThresholdDetector(QScriptContext*context,QScriptEngine*engine);
  2300. void setThresholdDetectorProperties(QScriptValue value,QScriptEngine*engine);
  2301. /*:306*//*311:*/
  2302. #line 7410 "./typica.w"
  2303. QScriptValue constructZeroEmitter(QScriptContext*context,
  2304. QScriptEngine*engine);
  2305. void setZeroEmitterProperties(QScriptValue value,QScriptEngine*engine);
  2306. /*:311*//*316:*/
  2307. #line 7489 "./typica.w"
  2308. QScriptValue constructMeasurementAdapter(QScriptContext*context,
  2309. QScriptEngine*engine);
  2310. void setMeasurementAdapterProperties(QScriptValue value,QScriptEngine*engine);
  2311. /*:316*//*333:*/
  2312. #line 7953 "./typica.w"
  2313. void setGraphViewProperties(QScriptValue value,QScriptEngine*engine);
  2314. QScriptValue constructGraphView(QScriptContext*context,QScriptEngine*engine);
  2315. /*:333*//*356:*/
  2316. #line 8580 "./typica.w"
  2317. void setZoomLogProperties(QScriptValue value,QScriptEngine*engine);
  2318. QScriptValue constructZoomLog(QScriptContext*context,QScriptEngine*engine);
  2319. QScriptValue ZoomLog_saveXML(QScriptContext*context,QScriptEngine*engine);
  2320. QScriptValue ZoomLog_saveCSV(QScriptContext*context,QScriptEngine*engine);
  2321. QScriptValue ZoomLog_saveState(QScriptContext*context,QScriptEngine*engine);
  2322. QScriptValue ZoomLog_restoreState(QScriptContext*context,
  2323. QScriptEngine*engine);
  2324. QScriptValue ZoomLog_lastTime(QScriptContext*context,QScriptEngine*engine);
  2325. QScriptValue ZoomLog_saveTemporary(QScriptContext*context,
  2326. QScriptEngine*engnie);
  2327. QScriptValue ZoomLog_setDisplayUnits(QScriptContext*context,
  2328. QScriptEngine*engine);
  2329. /*:356*//*394:*/
  2330. #line 9537 "./typica.w"
  2331. QScriptValue constructAnnotationButton(QScriptContext*context,
  2332. QScriptEngine*engine);
  2333. void setAnnotationButtonProperties(QScriptValue value,QScriptEngine*engine);
  2334. /*:394*//*402:*/
  2335. #line 9677 "./typica.w"
  2336. QScriptValue constructAnnotationSpinBox(QScriptContext*context,
  2337. QScriptEngine*engine);
  2338. void setAnnotationSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  2339. void setQDoubleSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  2340. void setQAbstractSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  2341. /*:402*//*423:*/
  2342. #line 10100 "./typica.w"
  2343. QScriptValue constructTimerDisplay(QScriptContext*context,
  2344. QScriptEngine*engine);
  2345. void setTimerDisplayProperties(QScriptValue value,QScriptEngine*engine);
  2346. /*:423*//*450:*/
  2347. #line 10594 "./typica.w"
  2348. void setWidgetDecoratorProperties(QScriptValue value,QScriptEngine*engine);
  2349. QScriptValue constructWidgetDecorator(QScriptContext*context,
  2350. QScriptEngine*engine);
  2351. /*:450*//*463:*/
  2352. #line 10877 "./typica.w"
  2353. QScriptValue constructLogEditWindow(QScriptContext*context,
  2354. QScriptEngine*engine);
  2355. /*:463*//*482:*/
  2356. #line 11405 "./typica.w"
  2357. QScriptValue constructXMLInput(QScriptContext*context,QScriptEngine*engine);
  2358. QScriptValue XMLInput_input(QScriptContext*context,QScriptEngine*engine);
  2359. /*:482*//*500:*/
  2360. #line 186 "./webview.w"
  2361. QScriptValue constructWebView(QScriptContext*context,QScriptEngine*engine);
  2362. void setQWebViewProperties(QScriptValue value,QScriptEngine*engine);
  2363. void addWebViewToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2364. QStack<QLayout*> *layoutStack);
  2365. /*:500*//*503:*/
  2366. #line 216 "./webview.w"
  2367. QScriptValue QWebElement_toScriptValue(QScriptEngine*engine,const QWebElement&element);
  2368. void QWebElement_fromScriptValue(const QScriptValue&value,QWebElement&element);
  2369. /*:503*//*507:*/
  2370. #line 274 "./webview.w"
  2371. QScriptValue constructWebElement(QScriptContext*context,
  2372. QScriptEngine*engine);
  2373. /*:507*//*573:*/
  2374. #line 12718 "./typica.w"
  2375. void setSqlQueryViewProperties(QScriptValue value,QScriptEngine*engine);
  2376. QScriptValue constructSqlQueryView(QScriptContext*context,
  2377. QScriptEngine*engine);
  2378. QScriptValue SqlQueryView_setQuery(QScriptContext*context,
  2379. QScriptEngine*engine);
  2380. QScriptValue SqlQueryView_setHeaderData(QScriptContext*context,
  2381. QScriptEngine*engine);
  2382. /*:573*//*583:*/
  2383. #line 12955 "./typica.w"
  2384. void addReportToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2385. QStack<QLayout*> *layoutStack);
  2386. /*:583*//*599:*/
  2387. #line 13240 "./typica.w"
  2388. void setQTextEditProperties(QScriptValue value,QScriptEngine*engine);
  2389. QScriptValue QTextEdit_print(QScriptContext*context,QScriptEngine*engine);
  2390. /*:599*//*609:*/
  2391. #line 13435 "./typica.w"
  2392. void addFormArrayToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2393. QStack<QLayout*> *layoutStack);
  2394. /*:609*//*630:*/
  2395. #line 14019 "./typica.w"
  2396. void addScaleControlToLayout(QDomElement element,
  2397. QStack<QWidget*> *widgetStack,
  2398. QStack<QLayout*> *layoutStack);
  2399. void addIntensityControlToLayout(QDomElement element,
  2400. QStack<QWidget*> *widgetStack,
  2401. QStack<QLayout*> *layoutStack);
  2402. /*:630*//*656:*/
  2403. #line 14605 "./typica.w"
  2404. QScriptValue constructDeviceTreeModel(QScriptContext*context,
  2405. QScriptEngine*engine);
  2406. void setDeviceTreeModelProperties(QScriptValue value,QScriptEngine*engine);
  2407. void setQAbstractItemModelProperties(QScriptValue value,QScriptEngine*engine);
  2408. QScriptValue DeviceTreeModel_referenceElement(QScriptContext*context,
  2409. QScriptEngine*engine);
  2410. QScriptValue QAbstractItemModel_data(QScriptContext*context,QScriptEngine*engine);
  2411. QScriptValue QAbstractItemModel_index(QScriptContext*context,QScriptEngine*engine);
  2412. QScriptValue QAbstractItemModel_rowCount(QScriptContext*context,QScriptEngine*engine);
  2413. QScriptValue QAbstractItemModel_hasChildren(QScriptContext*context,QScriptEngine*engine);
  2414. /*:656*//*662:*/
  2415. #line 14747 "./typica.w"
  2416. QScriptValue QModelIndex_toScriptValue(QScriptEngine*engine,const QModelIndex&index);
  2417. void QModelIndex_fromScriptValue(const QScriptValue&value,QModelIndex&index);
  2418. /*:662*//*678:*/
  2419. #line 15044 "./typica.w"
  2420. QScriptValue constructDeviceConfigurationWindow(QScriptContext*context,
  2421. QScriptEngine*engine);
  2422. /*:678*//*749:*/
  2423. #line 40 "./settings.w"
  2424. QScriptValue constructSettingsWindow(QScriptContext*context,QScriptEngine*engine);
  2425. /*:749*//*768:*/
  2426. #line 17582 "./typica.w"
  2427. QScriptValue constructModbusRTUDevice(QScriptContext*context,QScriptEngine*engine);
  2428. QScriptValue ModbusRTUDevice_pVChannel(QScriptContext*context,QScriptEngine*engine);
  2429. QScriptValue ModbusRTUDevice_sVChannel(QScriptContext*context,QScriptEngine*engine);
  2430. void setModbusRTUDeviceProperties(QScriptValue value,QScriptEngine*engine);
  2431. /*:768*//*792:*/
  2432. #line 157 "./rate.w"
  2433. QScriptValue constructRateOfChange(QScriptContext*context,QScriptEngine*engine);
  2434. void setRateOfChangeProperties(QScriptValue value,QScriptEngine*engine);
  2435. /*:792*//*817:*/
  2436. #line 597 "./dataqsdk.w"
  2437. QScriptValue constructDataqSdkDevice(QScriptContext*context,QScriptEngine*engine);
  2438. QScriptValue DataqSdkDevice_newChannel(QScriptContext*context,QScriptEngine*engine);
  2439. void setDataqSdkDeviceProperties(QScriptValue value,QScriptEngine*engine);
  2440. /*:817*//*844:*/
  2441. #line 67 "./scales.w"
  2442. QScriptValue constructDragLabel(QScriptContext*context,QScriptEngine*engine);
  2443. void setDragLabelProperties(QScriptValue value,QScriptEngine*engine);
  2444. /*:844*//*852:*/
  2445. #line 233 "./scales.w"
  2446. QScriptValue constructSerialScale(QScriptContext*context,QScriptEngine*engine);
  2447. void setSerialScaleProperties(QScriptValue value,QScriptEngine*engine);
  2448. /*:852*//*855:*/
  2449. #line 258 "./scales.w"
  2450. QScriptValue BaudRateType_toScriptValue(QScriptEngine*engine,const BaudRateType&value);
  2451. void BaudRateType_fromScriptValue(const QScriptValue&sv,BaudRateType&value);
  2452. QScriptValue DataBitsType_toScriptValue(QScriptEngine*engine,const DataBitsType&value);
  2453. void DataBitsType_fromScriptValue(const QScriptValue&sv,DataBitsType&value);
  2454. QScriptValue ParityType_toScriptValue(QScriptEngine*engine,const ParityType&value);
  2455. void ParityType_fromScriptValue(const QScriptValue&sv,ParityType&value);
  2456. QScriptValue StopBitsType_toScriptValue(QScriptEngine*engine,const StopBitsType&value);
  2457. void StopBitsType_fromScriptValue(const QScriptValue&sv,StopBitsType&value);
  2458. QScriptValue FlowType_toScriptValue(QScriptEngine*engine,const FlowType&value);
  2459. void FlowType_fromScriptValue(const QScriptValue&sv,FlowType&value);
  2460. /*:855*//*880:*/
  2461. #line 265 "./valueannotation.w"
  2462. QScriptValue constructValueAnnotation(QScriptContext*context,QScriptEngine*engine);
  2463. void setValueAnnotationProperties(QScriptValue value,QScriptEngine*engine);
  2464. /*:880*/
  2465. #line 527 "./typica.w"
  2466. /*4:*/
  2467. #line 535 "./typica.w"
  2468. /*670:*/
  2469. #line 14868 "./typica.w"
  2470. NodeInserter::NodeInserter(const QString&title,const QString&name,
  2471. const QString&driver,QObject*parent):
  2472. QAction(title,parent),defaultNodeName(name),driverString(driver)
  2473. {
  2474. connect(this,SIGNAL(triggered()),this,SLOT(onTriggered()));
  2475. }
  2476. void NodeInserter::onTriggered()
  2477. {
  2478. emit triggered(defaultNodeName,driverString);
  2479. }
  2480. /*:670*/
  2481. #line 536 "./typica.w"
  2482. /*240:*/
  2483. #line 40 "./measurement.w"
  2484. Measurement::Measurement(double temperature,QTime time,Units::Unit sc)
  2485. {
  2486. insert("measurement",temperature);
  2487. insert("time",time);
  2488. insert("unit",sc);
  2489. }
  2490. Measurement::Measurement(double temperature)
  2491. {
  2492. insert("measurement",temperature);
  2493. insert("time",QTime::currentTime());
  2494. insert("unit",Units::Fahrenheit);
  2495. }
  2496. void Measurement::setTemperature(double temperature)
  2497. {
  2498. insert("measurement",temperature);
  2499. }
  2500. void Measurement::setTime(QTime time)
  2501. {
  2502. insert("time",time);
  2503. }
  2504. void Measurement::setUnit(Units::Unit scale)
  2505. {
  2506. insert("unit",scale);
  2507. }
  2508. double Measurement::temperature()const
  2509. {
  2510. return value("measurement").toDouble();
  2511. }
  2512. QTime Measurement::time()const
  2513. {
  2514. return value("time").toTime();
  2515. }
  2516. Units::Unit Measurement::scale()const
  2517. {
  2518. return(Units::Unit)(value("unit").toInt());
  2519. }
  2520. /*:240*//*241:*/
  2521. #line 88 "./measurement.w"
  2522. Measurement Measurement::toFahrenheit()
  2523. {
  2524. return Measurement(Units::convertTemperature(this->temperature(),
  2525. this->scale(),Units::Fahrenheit),
  2526. this->time(),Units::Fahrenheit);
  2527. }
  2528. Measurement Measurement::toCelsius()
  2529. {
  2530. return Measurement(Units::convertTemperature(this->temperature(),
  2531. this->scale(),Units::Celsius),
  2532. this->time(),Units::Celsius);
  2533. }
  2534. Measurement Measurement::toKelvin()
  2535. {
  2536. return Measurement(Units::convertTemperature(this->temperature(),
  2537. this->scale(),Units::Kelvin),
  2538. this->time(),Units::Kelvin);
  2539. }
  2540. Measurement Measurement::toRankine()
  2541. {
  2542. return Measurement(Units::convertTemperature(this->temperature(),
  2543. this->scale(),Units::Rankine),
  2544. this->time(),Units::Rankine);
  2545. }
  2546. /*:241*/
  2547. #line 537 "./typica.w"
  2548. /*248:*/
  2549. #line 5816 "./typica.w"
  2550. void DAQImplementation::measure()
  2551. {
  2552. int samplesRead= 0;
  2553. double buffer[channels];
  2554. error= read((unsigned int)(handle),(signed long)(1),(double)(10.0),
  2555. (unsigned long)(0),buffer,(unsigned long)(channels),
  2556. &samplesRead,(signed long)(0));
  2557. if(error)
  2558. {
  2559. ready= false;
  2560. }
  2561. else
  2562. {
  2563. if(samplesRead)
  2564. {
  2565. QTime time= QTime::currentTime();
  2566. for(int i= 0;i<samplesRead;i++)
  2567. {
  2568. for(int j= 0;j<channels;j++)
  2569. {
  2570. Measurement measure(buffer[j+(i*channels)],time,
  2571. unitMap[j]);
  2572. channelMap[j]->input(measure);
  2573. }
  2574. }
  2575. }
  2576. }
  2577. }
  2578. /*:248*//*249:*/
  2579. #line 5858 "./typica.w"
  2580. void DAQImplementation::run()
  2581. {
  2582. setPriority(QThread::TimeCriticalPriority);
  2583. while(ready)
  2584. {
  2585. measure();
  2586. }
  2587. }
  2588. /*:249*//*250:*/
  2589. #line 5874 "./typica.w"
  2590. void DAQ::threadFinished()
  2591. {
  2592. if(imp->error)
  2593. {
  2594. /*251:*/
  2595. #line 5925 "./typica.w"
  2596. imp->ready= false;
  2597. QMessageBox warning;
  2598. warning.setStandardButtons(QMessageBox::Cancel);
  2599. warning.setIcon(QMessageBox::Warning);
  2600. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2601. unsigned long bytes= imp->errorInfo(NULL,0);
  2602. char string[bytes];
  2603. imp->errorInfo(string,bytes);
  2604. warning.setInformativeText(QString(string));
  2605. warning.setWindowTitle(QString(PROGRAM_NAME));
  2606. warning.exec();
  2607. /*:251*/
  2608. #line 5879 "./typica.w"
  2609. }
  2610. }
  2611. /*:250*//*252:*/
  2612. #line 5950 "./typica.w"
  2613. void DAQ::start()
  2614. {
  2615. if(imp->ready)
  2616. {
  2617. imp->error= imp->startTask(imp->handle);
  2618. if(imp->error)
  2619. {
  2620. /*251:*/
  2621. #line 5925 "./typica.w"
  2622. imp->ready= false;
  2623. QMessageBox warning;
  2624. warning.setStandardButtons(QMessageBox::Cancel);
  2625. warning.setIcon(QMessageBox::Warning);
  2626. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2627. unsigned long bytes= imp->errorInfo(NULL,0);
  2628. char string[bytes];
  2629. imp->errorInfo(string,bytes);
  2630. warning.setInformativeText(QString(string));
  2631. warning.setWindowTitle(QString(PROGRAM_NAME));
  2632. warning.exec();
  2633. /*:251*/
  2634. #line 5958 "./typica.w"
  2635. }
  2636. else
  2637. {
  2638. connect(imp,SIGNAL(finished()),this,SLOT(threadFinished()));
  2639. imp->start();
  2640. }
  2641. }
  2642. }
  2643. void DAQ::stop()
  2644. {
  2645. if(imp->useBase)
  2646. {
  2647. imp->ready= false;
  2648. imp->wait(ULONG_MAX);
  2649. imp->stopTask(imp->handle);
  2650. }
  2651. else
  2652. {
  2653. imp->ready= false;
  2654. imp->error= imp->stopTask(imp->handle);
  2655. if(imp->error)
  2656. {
  2657. /*251:*/
  2658. #line 5925 "./typica.w"
  2659. imp->ready= false;
  2660. QMessageBox warning;
  2661. warning.setStandardButtons(QMessageBox::Cancel);
  2662. warning.setIcon(QMessageBox::Warning);
  2663. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2664. unsigned long bytes= imp->errorInfo(NULL,0);
  2665. char string[bytes];
  2666. imp->errorInfo(string,bytes);
  2667. warning.setInformativeText(QString(string));
  2668. warning.setWindowTitle(QString(PROGRAM_NAME));
  2669. warning.exec();
  2670. /*:251*/
  2671. #line 5982 "./typica.w"
  2672. }
  2673. imp->error= imp->clearTask(imp->handle);
  2674. if(imp->error)
  2675. {
  2676. /*251:*/
  2677. #line 5925 "./typica.w"
  2678. imp->ready= false;
  2679. QMessageBox warning;
  2680. warning.setStandardButtons(QMessageBox::Cancel);
  2681. warning.setIcon(QMessageBox::Warning);
  2682. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2683. unsigned long bytes= imp->errorInfo(NULL,0);
  2684. char string[bytes];
  2685. imp->errorInfo(string,bytes);
  2686. warning.setInformativeText(QString(string));
  2687. warning.setWindowTitle(QString(PROGRAM_NAME));
  2688. warning.exec();
  2689. /*:251*/
  2690. #line 5987 "./typica.w"
  2691. }
  2692. }
  2693. }
  2694. /*:252*//*253:*/
  2695. #line 5997 "./typica.w"
  2696. DAQ::DAQ(QString device,const QString&driver):imp(new DAQImplementation(driver))
  2697. {
  2698. imp->device= device;
  2699. imp->error= imp->createTask(device.toAscii().data(),&(imp->handle));
  2700. if(imp->error)
  2701. {
  2702. /*251:*/
  2703. #line 5925 "./typica.w"
  2704. imp->ready= false;
  2705. QMessageBox warning;
  2706. warning.setStandardButtons(QMessageBox::Cancel);
  2707. warning.setIcon(QMessageBox::Warning);
  2708. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2709. unsigned long bytes= imp->errorInfo(NULL,0);
  2710. char string[bytes];
  2711. imp->errorInfo(string,bytes);
  2712. warning.setInformativeText(QString(string));
  2713. warning.setWindowTitle(QString(PROGRAM_NAME));
  2714. warning.exec();
  2715. /*:251*/
  2716. #line 6004 "./typica.w"
  2717. }
  2718. else
  2719. {
  2720. imp->ready= true;
  2721. }
  2722. }
  2723. /*:253*//*254:*/
  2724. #line 6018 "./typica.w"
  2725. Channel*DAQ::newChannel(int units,int thermocouple)
  2726. {
  2727. Channel*retval= new Channel();
  2728. imp->channelMap[imp->channels]= retval;
  2729. imp->unitMap[imp->channels]= (Units::Unit)units;
  2730. imp->channels++;
  2731. if(imp->ready)
  2732. {
  2733. if(imp->useBase)
  2734. {
  2735. imp->error= imp->createChannel(imp->handle,
  2736. QString("%1/ai%2").arg(imp->device).
  2737. arg(imp->channels-1).
  2738. toAscii().data(),
  2739. "",(double)(-1.0),(double)(100.0),
  2740. (signed long)(units),
  2741. (signed long)(thermocouple),
  2742. (signed long)(10200),(double)(0),
  2743. "");
  2744. }
  2745. else
  2746. {
  2747. imp->error= imp->createChannel(imp->handle,
  2748. QString("%1/ai%2").arg(imp->device).
  2749. arg(imp->channels-1).
  2750. toAscii().data(),
  2751. "",(double)(50.0),(double)(500.0),
  2752. (signed long)(units),
  2753. (signed long)(thermocouple),
  2754. (signed long)(10200),(double)(0),
  2755. "");
  2756. }
  2757. if(imp->error)
  2758. {
  2759. /*251:*/
  2760. #line 5925 "./typica.w"
  2761. imp->ready= false;
  2762. QMessageBox warning;
  2763. warning.setStandardButtons(QMessageBox::Cancel);
  2764. warning.setIcon(QMessageBox::Warning);
  2765. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2766. unsigned long bytes= imp->errorInfo(NULL,0);
  2767. char string[bytes];
  2768. imp->errorInfo(string,bytes);
  2769. warning.setInformativeText(QString(string));
  2770. warning.setWindowTitle(QString(PROGRAM_NAME));
  2771. warning.exec();
  2772. /*:251*/
  2773. #line 6053 "./typica.w"
  2774. }
  2775. }
  2776. return retval;
  2777. }
  2778. /*:254*//*255:*/
  2779. #line 6067 "./typica.w"
  2780. void DAQ::setClockRate(double Hz)
  2781. {
  2782. if(imp->ready)
  2783. {
  2784. imp->error= imp->setClock(imp->handle,"OnboardClock",Hz,
  2785. (signed long)(10280),(signed long)(10123),
  2786. (unsigned long long)(1));
  2787. if(imp->error)
  2788. {
  2789. /*251:*/
  2790. #line 5925 "./typica.w"
  2791. imp->ready= false;
  2792. QMessageBox warning;
  2793. warning.setStandardButtons(QMessageBox::Cancel);
  2794. warning.setIcon(QMessageBox::Warning);
  2795. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2796. unsigned long bytes= imp->errorInfo(NULL,0);
  2797. char string[bytes];
  2798. imp->errorInfo(string,bytes);
  2799. warning.setInformativeText(QString(string));
  2800. warning.setWindowTitle(QString(PROGRAM_NAME));
  2801. warning.exec();
  2802. /*:251*/
  2803. #line 6077 "./typica.w"
  2804. }
  2805. }
  2806. }
  2807. /*:255*//*256:*/
  2808. #line 6087 "./typica.w"
  2809. DAQ::~DAQ()
  2810. {
  2811. if(imp->useBase)
  2812. {
  2813. imp->resetDevice(imp->device.toAscii().data());
  2814. imp->clearTask(imp->handle);
  2815. }
  2816. else
  2817. {
  2818. if(imp->ready)
  2819. {
  2820. imp->ready= false;
  2821. imp->wait(ULONG_MAX);
  2822. imp->stopTask(imp->handle);
  2823. imp->resetDevice(imp->device.toAscii().data());
  2824. imp->clearTask(imp->handle);
  2825. }
  2826. }
  2827. delete imp;
  2828. }
  2829. /*:256*//*257:*/
  2830. #line 6118 "./typica.w"
  2831. DAQImplementation::DAQImplementation(const QString&driverinfo)
  2832. :QThread(NULL),channelMap(4),handle(0),error(0),channels(0),ready(false),
  2833. unitMap(4)
  2834. {
  2835. if(driverinfo=="nidaqmxbase")
  2836. {
  2837. useBase= true;
  2838. }
  2839. else
  2840. {
  2841. useBase= false;
  2842. }
  2843. if(useBase)
  2844. {
  2845. driver.setFileName("nidaqmxbase.framework/nidaqmxbase");
  2846. if(!driver.load())
  2847. {
  2848. driver.setFileName("nidaqmxbase");
  2849. if(!driver.load())
  2850. {
  2851. QMessageBox::critical(NULL,tr("Typica: Driver not found"),
  2852. tr("Failed to find nidaqmxbase. Please install it."));
  2853. QApplication::quit();
  2854. }
  2855. }
  2856. }
  2857. else
  2858. {
  2859. driver.setFileName("nicaiu");
  2860. if(!driver.load())
  2861. {
  2862. QMessageBox::critical(NULL,tr("Typica: Driver not found"),
  2863. tr("Failed to find nidaqmx. Please install it."));
  2864. QApplication::quit();
  2865. }
  2866. }
  2867. if(useBase)
  2868. {
  2869. if((createTask= (daqfp)driver.resolve("DAQmxBaseCreateTask"))==0||
  2870. (startTask= (daqfp)driver.resolve("DAQmxBaseStartTask"))==0||
  2871. (stopTask= (daqfp)driver.resolve("DAQmxBaseStopTask"))==0||
  2872. (clearTask= (daqfp)driver.resolve("DAQmxBaseClearTask"))==0||
  2873. (createChannel= (daqfp)driver.resolve("DAQmxBaseCreateAIThrmcplChan"))
  2874. ==0||
  2875. (setClock= (daqfp)driver.resolve("DAQmxBaseCfgSampClkTiming"))==
  2876. 0||
  2877. (read= (daqfp)driver.resolve("DAQmxBaseReadAnalogF64"))==0||
  2878. (errorInfo= (daqfp)driver.resolve("DAQmxBaseGetExtendedErrorInfo"))==
  2879. 0||
  2880. (resetDevice= (daqfp)driver.resolve("DAQmxBaseResetDevice"))==0)
  2881. {
  2882. waitForMeasurement= NULL;
  2883. QMessageBox::critical(NULL,tr("Typica: Link error"),
  2884. tr("Failed to link a required symbol in NI-DAQmxBase."));
  2885. QApplication::quit();
  2886. }
  2887. }
  2888. else
  2889. {
  2890. if((createTask= (daqfp)driver.resolve("DAQmxCreateTask"))==0||
  2891. (startTask= (daqfp)driver.resolve("DAQmxStartTask"))==0||
  2892. (stopTask= (daqfp)driver.resolve("DAQmxStopTask"))==0||
  2893. (clearTask= (daqfp)driver.resolve("DAQmxClearTask"))==0||
  2894. (createChannel= (daqfp)driver.resolve("DAQmxCreateAIThrmcplChan"))
  2895. ==0||
  2896. (setClock= (daqfp)driver.resolve("DAQmxCfgSampClkTiming"))==0||
  2897. (read= (daqfp)driver.resolve("DAQmxReadAnalogF64"))==0||
  2898. (errorInfo= (daqfp)driver.resolve("DAQmxGetExtendedErrorInfo"))==
  2899. 0||
  2900. (resetDevice= (daqfp)driver.resolve("DAQmxResetDevice"))==0||
  2901. (waitForMeasurement= (daqfp)driver.resolve("DAQmxWaitUntilTaskDone"))==0)
  2902. {
  2903. QMessageBox::critical(NULL,tr("Typica: Link error"),
  2904. tr("Failed to link a required symbol in NI-DAQmx."));
  2905. QApplication::quit();
  2906. }
  2907. }
  2908. }
  2909. DAQImplementation::~DAQImplementation()
  2910. {
  2911. driver.unload();
  2912. }
  2913. /*:257*/
  2914. #line 538 "./typica.w"
  2915. /*806:*/
  2916. #line 197 "./dataqsdk.w"
  2917. void DataqSdkDeviceImplementation::measure()
  2918. {
  2919. unsigned count= channels*40;
  2920. di_status_read(buffer,count);
  2921. QTime time= QTime::currentTime();
  2922. for(unsigned int i= 0;i<count;i++)
  2923. {
  2924. buffer[i]= buffer[i]&0xFFFC;
  2925. }
  2926. QList<int> countList;
  2927. for(unsigned int i= 0;i<(unsigned)channels;i++)
  2928. {
  2929. QList<double> channelBuffer;
  2930. for(unsigned int j= 0;j<40;j++)
  2931. {
  2932. channelBuffer<<((double)buffer[i+(channels*j)]*10.0)/32768.0;
  2933. if(i==0)
  2934. {
  2935. countList<<buffer[i+(channels*j)];
  2936. }
  2937. }
  2938. double value= 0.0;
  2939. for(unsigned int j= 0;j<40;j++)
  2940. {
  2941. value+= channelBuffer[j];
  2942. }
  2943. value/= 40.0;
  2944. if(i==0)
  2945. {
  2946. QList<double> smoothingList;
  2947. smoothingList<<value;
  2948. QList<int> smoothingKeys= smoother.uniqueKeys();
  2949. for(int j= 0;j<smoothingKeys.size();j++)
  2950. {
  2951. if(countList.contains(smoothingKeys[j]))
  2952. {
  2953. QList<double> keyValues= smoother.values(smoothingKeys[j]);
  2954. for(int k= 0;k<keyValues.size();k++)
  2955. {
  2956. smoothingList<<keyValues[k];
  2957. }
  2958. }
  2959. else
  2960. {
  2961. smoother.remove(smoothingKeys[j]);
  2962. }
  2963. }
  2964. qSort(countList);
  2965. int lastCount= 0;
  2966. for(int j= 0;j<countList.size();j++)
  2967. {
  2968. if(j==0||countList[j]!=lastCount)
  2969. {
  2970. smoother.insert(countList[j],value);
  2971. lastCount= countList[j];
  2972. }
  2973. }
  2974. value= 0.0;
  2975. for(int j= 0;j<smoothingList.size();j++)
  2976. {
  2977. value+= smoothingList[j];
  2978. }
  2979. value/= smoothingList.size();
  2980. }
  2981. Measurement measure(value,time,unitMap[i]);
  2982. channelMap[i]->input(measure);
  2983. }
  2984. }
  2985. /*:806*//*807:*/
  2986. #line 290 "./dataqsdk.w"
  2987. void DataqSdkDeviceImplementation::run()
  2988. {
  2989. if(!ready)
  2990. {
  2991. error= 9;
  2992. return;
  2993. }
  2994. driver= new QLibrary(device);
  2995. if(!driver->load())
  2996. {
  2997. error= 1;
  2998. qDebug()<<"Failed to load driver: "<<device;
  2999. return;
  3000. }
  3001. di_open= (FPDIOPEN)driver->resolve("di_open");
  3002. di_close= (FPDICLOSE)driver->resolve("di_close");
  3003. di_sample_rate= (FPDISAMPLERATE)driver->resolve("di_sample_rate");
  3004. di_maximum_rate= (FPDIMAXIMUMRATE)driver->resolve("di_maximum_rate");
  3005. di_list_length= (FPDILISTLENGTH)driver->resolve("di_list_length");
  3006. di_inlist= (FPDIINLIST)driver->resolve("di_inlist");
  3007. di_buffer_alloc= (FPDIBUFFERALLOC)driver->resolve("di_buffer_alloc");
  3008. di_start_scan= (FPDISTARTSCAN)driver->resolve("di_start_scan");
  3009. di_status_read= (FPDISTATUSREAD)driver->resolve("di_status_read");
  3010. di_buffer_status= (FPDIBUFFERSTATUS)driver->resolve("di_buffer_status");
  3011. di_burst_rate= (FPDIBURSTRATE)driver->resolve("di_burst_rate");
  3012. di_stop_scan= (FPDISTOPSCAN)driver->resolve("di_stop_scan");
  3013. if((!di_open)||(!di_close)||(!di_sample_rate)||(!di_maximum_rate)||
  3014. (!di_list_length)||(!di_inlist)||(!di_buffer_alloc)||
  3015. (!di_start_scan)||(!di_status_read)||(!di_buffer_status)||
  3016. (!di_burst_rate)||(!di_stop_scan))
  3017. {
  3018. error= 2;
  3019. return;
  3020. }
  3021. error= di_open(deviceNumber);
  3022. if(error)
  3023. {
  3024. di_close();
  3025. error= di_open(deviceNumber);
  3026. if(error)
  3027. {
  3028. error= 3;
  3029. di_close();
  3030. return;
  3031. }
  3032. }
  3033. isOpen= true;
  3034. di_maximum_rate(240.0);
  3035. sampleRate= di_sample_rate(sampleRate*channels*40,&oversample,
  3036. &burstDivisor);
  3037. buffer= new qint16[(int)sampleRate];
  3038. di_inlist_struct inlist[16]= {{0}};
  3039. for(unsigned short i= 0;i<channels;i++)
  3040. {
  3041. inlist[i].chan= i;
  3042. inlist[i].gain= 0;
  3043. inlist[i].ave= 1;
  3044. inlist[i].counter= (oversample-1);
  3045. }
  3046. error= di_list_length(channels,0);
  3047. if(error)
  3048. {
  3049. error= 4;
  3050. return;
  3051. }
  3052. error= di_inlist(inlist);
  3053. if(error)
  3054. {
  3055. error= 5;
  3056. return;
  3057. }
  3058. input_buffer= di_buffer_alloc(0,4096);
  3059. if(input_buffer==NULL)
  3060. {
  3061. error= 6;
  3062. return;
  3063. }
  3064. error= di_start_scan();
  3065. if(error)
  3066. {
  3067. error= 7;
  3068. return;
  3069. }
  3070. while(ready)
  3071. {
  3072. measure();
  3073. }
  3074. }
  3075. /*:807*//*808:*/
  3076. #line 386 "./dataqsdk.w"
  3077. void DataqSdkDevice::threadFinished()
  3078. {
  3079. if(imp->error)
  3080. {
  3081. /*809:*/
  3082. #line 400 "./dataqsdk.w"
  3083. imp->ready= false;
  3084. QMessageBox warning;
  3085. warning.setStandardButtons(QMessageBox::Cancel);
  3086. warning.setIcon(QMessageBox::Warning);
  3087. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  3088. warning.setInformativeText(tr("An error occurred"));
  3089. warning.setWindowTitle(QString(PROGRAM_NAME));
  3090. warning.exec();
  3091. /*:809*/
  3092. #line 391 "./dataqsdk.w"
  3093. }
  3094. }
  3095. /*:808*//*810:*/
  3096. #line 417 "./dataqsdk.w"
  3097. void DataqSdkDevice::start()
  3098. {
  3099. connect(imp,SIGNAL(finished()),this,SLOT(threadFinished()));
  3100. imp->start();
  3101. }
  3102. /*:810*//*811:*/
  3103. #line 428 "./dataqsdk.w"
  3104. QStringList DataqSdkDevice::detectHardware()
  3105. {
  3106. QSettings deviceLookup("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\services\\usbser\\Enum",
  3107. QSettings::NativeFormat);
  3108. QStringList keys= deviceLookup.childKeys();
  3109. QStringList devices;
  3110. for(int i= 0;i<keys.size();i++)
  3111. {
  3112. QString value= deviceLookup.value(keys.at(i)).toString();
  3113. if(value.startsWith("USB\\VID_0683&PID_1450\\"))
  3114. {
  3115. devices.append(value.split("\\").at(2));
  3116. }
  3117. }
  3118. QStringList portList;
  3119. foreach(QString device,devices)
  3120. {
  3121. QString deviceKey= QString("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\USB\\VID_0683&PID_1450\\%1").arg(device);
  3122. QSettings deviceEntry(deviceKey,QSettings::NativeFormat);
  3123. portList.append(deviceEntry.value("FriendlyName").toString());
  3124. }
  3125. return portList;
  3126. }
  3127. QStringList DataqSdkDevice::detectPorts()
  3128. {
  3129. QStringList friendlyNames= detectHardware();
  3130. QStringList portList;
  3131. foreach(QString name,friendlyNames)
  3132. {
  3133. name.remove(0,name.indexOf("COM"));
  3134. name.chop(1);
  3135. portList.append(name);
  3136. }
  3137. return portList;
  3138. }
  3139. /*:811*//*812:*/
  3140. #line 473 "./dataqsdk.w"
  3141. DataqSdkDevice::DataqSdkDevice(QString device):imp(new DataqSdkDeviceImplementation)
  3142. {
  3143. bool usesAuto= false;
  3144. int autoIndex= device.toInt(&usesAuto);
  3145. QString finalizedPort;
  3146. if(usesAuto)
  3147. {
  3148. QStringList portList= detectPorts();
  3149. if(autoIndex> 0&&autoIndex<=portList.size())
  3150. {
  3151. finalizedPort= portList.at(autoIndex-1);
  3152. }
  3153. else
  3154. {
  3155. imp->error= 8;
  3156. qDebug()<<"Failed to detect port.";
  3157. }
  3158. }
  3159. else
  3160. {
  3161. finalizedPort= device;
  3162. }
  3163. int rstart= finalizedPort.indexOf("COM");
  3164. finalizedPort.remove(0,rstart+3);
  3165. bool chopFinished= false;
  3166. int finalizedPortNumber;
  3167. while(finalizedPort.size()> 0&&!chopFinished)
  3168. {
  3169. finalizedPortNumber= finalizedPort.toInt(&chopFinished);
  3170. if(!chopFinished)
  3171. {
  3172. finalizedPort.chop(1);
  3173. }
  3174. }
  3175. if(finalizedPortNumber<10)
  3176. {
  3177. imp->device= QString("DI10%1NT.DLL").arg(finalizedPort);
  3178. }
  3179. else
  3180. {
  3181. imp->device= QString("DI1%1NT.DLL").arg(finalizedPort);
  3182. }
  3183. imp->deviceNumber= 0x12C02D00;
  3184. imp->deviceNumber+= finalizedPortNumber;
  3185. imp->ready= true;
  3186. }
  3187. /*:812*//*813:*/
  3188. #line 523 "./dataqsdk.w"
  3189. Channel*DataqSdkDevice::newChannel(Units::Unit scale)
  3190. {
  3191. Channel*retval= NULL;
  3192. if(imp->ready)
  3193. {
  3194. retval= new Channel();
  3195. imp->channelMap[imp->channels]= retval;
  3196. imp->unitMap[imp->channels]= scale;
  3197. imp->channels++;
  3198. }
  3199. return retval;
  3200. }
  3201. /*:813*//*814:*/
  3202. #line 547 "./dataqsdk.w"
  3203. void DataqSdkDevice::setClockRate(double Hz)
  3204. {
  3205. imp->sampleRate= Hz;
  3206. }
  3207. /*:814*//*815:*/
  3208. #line 557 "./dataqsdk.w"
  3209. DataqSdkDevice::~DataqSdkDevice()
  3210. {
  3211. if(imp->ready)
  3212. {
  3213. imp->ready= false;
  3214. }
  3215. imp->wait(ULONG_MAX);
  3216. delete imp;
  3217. }
  3218. /*:815*//*816:*/
  3219. #line 575 "./dataqsdk.w"
  3220. DataqSdkDeviceImplementation::DataqSdkDeviceImplementation():QThread(NULL),
  3221. channelMap(4),error(0),channels(0),ready(false),unitMap(4)
  3222. {
  3223. }
  3224. DataqSdkDeviceImplementation::~DataqSdkDeviceImplementation()
  3225. {
  3226. if(isOpen)
  3227. {
  3228. di_stop_scan();
  3229. di_close();
  3230. }
  3231. if(driver->isLoaded())
  3232. {
  3233. driver->unload();
  3234. }
  3235. }
  3236. /*:816*/
  3237. #line 539 "./typica.w"
  3238. /*264:*/
  3239. #line 6327 "./typica.w"
  3240. void FakeDAQImplementation::measure()
  3241. {
  3242. msleep((int)(1000/clockRate));
  3243. QTime time= QTime::currentTime();
  3244. for(int i= 0;i<channels;i++)
  3245. {
  3246. Measurement measure(qrand()%500,time);
  3247. channelMap[i]->input(measure);
  3248. }
  3249. }
  3250. /*:264*//*265:*/
  3251. #line 6341 "./typica.w"
  3252. void FakeDAQImplementation::run()
  3253. {
  3254. setPriority(QThread::TimeCriticalPriority);
  3255. while(ready)
  3256. {
  3257. measure();
  3258. }
  3259. }
  3260. FakeDAQImplementation::FakeDAQImplementation():QThread(NULL),channelMap(4),
  3261. channels(0),ready(false),clockRate(1)
  3262. {
  3263. }
  3264. FakeDAQImplementation::~FakeDAQImplementation()
  3265. {
  3266. }
  3267. /*:265*//*266:*/
  3268. #line 6366 "./typica.w"
  3269. void FakeDAQ::start()
  3270. {
  3271. if(imp->ready)
  3272. {
  3273. imp->start();
  3274. }
  3275. }
  3276. FakeDAQ::FakeDAQ(QString):imp(new FakeDAQImplementation())
  3277. {
  3278. imp->ready= true;
  3279. }
  3280. Channel*FakeDAQ::newChannel(int,int)
  3281. {
  3282. Channel*retval;
  3283. if(imp->ready)
  3284. {
  3285. retval= new Channel();
  3286. imp->channelMap[imp->channels]= retval;
  3287. imp->channels++;
  3288. }
  3289. else
  3290. {
  3291. return NULL;
  3292. }
  3293. return retval;
  3294. }
  3295. void FakeDAQ::setClockRate(double Hz)
  3296. {
  3297. if(imp->ready)
  3298. {
  3299. imp->clockRate= Hz;
  3300. }
  3301. }
  3302. FakeDAQ::~FakeDAQ()
  3303. {
  3304. imp->ready= false;
  3305. imp->wait(ULONG_MAX);
  3306. delete imp;
  3307. }
  3308. /*:266*/
  3309. #line 540 "./typica.w"
  3310. /*271:*/
  3311. #line 6497 "./typica.w"
  3312. Channel::Channel():QObject(NULL)
  3313. {
  3314. }
  3315. Channel::~Channel()
  3316. {
  3317. }
  3318. void Channel::input(Measurement measurement)
  3319. {
  3320. emit newData(measurement);
  3321. }
  3322. /*:271*/
  3323. #line 541 "./typica.w"
  3324. /*287:*/
  3325. #line 6902 "./typica.w"
  3326. void TemperatureDisplay::setRelativeMode(bool relative)
  3327. {
  3328. r= relative;
  3329. }
  3330. /*:287*//*288:*/
  3331. #line 6919 "./typica.w"
  3332. void TemperatureDisplay::setValue(Measurement temperature)
  3333. {
  3334. QString number;
  3335. switch(unit)
  3336. {
  3337. case Units::Fahrenheit:
  3338. display(QString("%1'F").
  3339. arg(number.setNum(temperature.toFahrenheit().temperature(),'f',
  3340. 2)));
  3341. break;
  3342. case Units::Celsius:
  3343. if(!r){
  3344. display(QString("%1'C").
  3345. arg(number.setNum(temperature.toCelsius().temperature(),'f',
  3346. 2)));
  3347. }else{
  3348. number.setNum(temperature.temperature()*(5.0/9.0),'f',2);
  3349. display(QString("%1'C").arg(number));
  3350. }
  3351. break;
  3352. case Units::Kelvin:
  3353. if(!r){
  3354. display(QString("%1").
  3355. arg(number.setNum(temperature.toKelvin().temperature(),'f',
  3356. 2)));
  3357. }else{
  3358. number.setNum(temperature.temperature()*(5.0/9.0),'f',2);
  3359. display(QString("%1").arg(number));
  3360. }
  3361. break;
  3362. case Units::Rankine:
  3363. display(QString("%1'r").
  3364. arg(number.setNum(temperature.toRankine().temperature(),'f',
  3365. 2)));
  3366. break;
  3367. case Units::Unitless:
  3368. display(QString("%1").arg(number.setNum(temperature.temperature(),'f',0)));
  3369. break;
  3370. default:
  3371. switch(temperature.scale())
  3372. {
  3373. case Units::Fahrenheit:
  3374. display(QString("%1'F").
  3375. arg(number.setNum(temperature.temperature(),'f',2)));
  3376. break;
  3377. case Units::Celsius:
  3378. display(QString("%1'C").
  3379. arg(number.setNum(temperature.temperature(),'f',2)));
  3380. break;
  3381. case Units::Kelvin:
  3382. display(QString("%1").
  3383. arg(number.setNum(temperature.temperature(),'f',2)));
  3384. break;
  3385. case Units::Rankine:
  3386. display(QString("%1'r").
  3387. arg(number.setNum(temperature.temperature(),'f',2)));
  3388. break;
  3389. case Units::Unitless:
  3390. display(QString("%1").arg(number.setNum(temperature.temperature(),'f',0)));
  3391. break;
  3392. }
  3393. break;
  3394. }
  3395. }
  3396. /*:288*//*289:*/
  3397. #line 6995 "./typica.w"
  3398. TemperatureDisplay::TemperatureDisplay(QWidget*parent):
  3399. QLCDNumber(8,parent),unit(Units::Fahrenheit),r(false)
  3400. {
  3401. setSegmentStyle(Filled);
  3402. display("---.--'F");
  3403. }
  3404. /*:289*//*290:*/
  3405. #line 7011 "./typica.w"
  3406. void TemperatureDisplay::invalidate()
  3407. {
  3408. display("---.--'F");
  3409. }
  3410. /*:290*//*291:*/
  3411. #line 7023 "./typica.w"
  3412. void TemperatureDisplay::setDisplayUnits(Units::Unit scale)
  3413. {
  3414. unit= scale;
  3415. }
  3416. /*:291*//*292:*/
  3417. #line 7031 "./typica.w"
  3418. TemperatureDisplay::~TemperatureDisplay()
  3419. {
  3420. }
  3421. /*:292*/
  3422. #line 542 "./typica.w"
  3423. /*298:*/
  3424. #line 7131 "./typica.w"
  3425. void MeasurementTimeOffset::newMeasurement(Measurement measure)
  3426. {
  3427. if(measure.time()<epoch)
  3428. {
  3429. if(hasPrevious)
  3430. {
  3431. QTime jitBase(epoch.hour()-1,epoch.minute(),epoch.second(),
  3432. epoch.msec());
  3433. QTime jitComp(epoch.hour(),measure.time().minute(),
  3434. measure.time().second(),measure.time().msec());
  3435. int relTime= jitBase.msecsTo(jitComp);
  3436. /*299:*/
  3437. #line 7165 "./typica.w"
  3438. QTime newTime(0,0,0,0);
  3439. newTime= newTime.addMSecs(relTime);
  3440. if(newTime.hour()> 0)
  3441. {
  3442. newTime.setHMS(0,newTime.minute(),newTime.second(),newTime.msec());
  3443. }
  3444. Measurement rel= measure;
  3445. rel.setTime(newTime);
  3446. emit measurement(rel);
  3447. /*:299*/
  3448. #line 7143 "./typica.w"
  3449. }
  3450. else
  3451. {
  3452. Measurement rel= measure;
  3453. rel.setTime(QTime(0,0,0,0));
  3454. emit measurement(rel);
  3455. }
  3456. }
  3457. else
  3458. {
  3459. int relTime= epoch.msecsTo(measure.time());
  3460. /*299:*/
  3461. #line 7165 "./typica.w"
  3462. QTime newTime(0,0,0,0);
  3463. newTime= newTime.addMSecs(relTime);
  3464. if(newTime.hour()> 0)
  3465. {
  3466. newTime.setHMS(0,newTime.minute(),newTime.second(),newTime.msec());
  3467. }
  3468. Measurement rel= measure;
  3469. rel.setTime(newTime);
  3470. emit measurement(rel);
  3471. /*:299*/
  3472. #line 7155 "./typica.w"
  3473. }
  3474. hasPrevious= true;
  3475. previous= measure.time();
  3476. }
  3477. /*:298*//*300:*/
  3478. #line 7178 "./typica.w"
  3479. MeasurementTimeOffset::MeasurementTimeOffset(QTime zero):epoch(zero),
  3480. previous(0,0,0,0),hasPrevious(false)
  3481. {
  3482. }
  3483. QTime MeasurementTimeOffset::zeroTime()
  3484. {
  3485. return epoch;
  3486. }
  3487. void MeasurementTimeOffset::setZeroTime(QTime zero)
  3488. {
  3489. epoch= zero;
  3490. hasPrevious= false;
  3491. }
  3492. /*:300*/
  3493. #line 543 "./typica.w"
  3494. /*310:*/
  3495. #line 7376 "./typica.w"
  3496. ZeroEmitter::ZeroEmitter(int tempcolumn):QObject(NULL),col(tempcolumn)
  3497. {
  3498. }
  3499. int ZeroEmitter::column()
  3500. {
  3501. return col;
  3502. }
  3503. double ZeroEmitter::lastTemperature()
  3504. {
  3505. return cache.temperature();
  3506. }
  3507. void ZeroEmitter::newMeasurement(Measurement measure)
  3508. {
  3509. cache= measure;
  3510. }
  3511. void ZeroEmitter::setColumn(int column)
  3512. {
  3513. col= column;
  3514. }
  3515. void ZeroEmitter::emitZero()
  3516. {
  3517. cache.setTime(QTime(0,0,0,0));
  3518. emit measurement(cache,col);
  3519. }
  3520. /*:310*/
  3521. #line 544 "./typica.w"
  3522. /*315:*/
  3523. #line 7466 "./typica.w"
  3524. MeasurementAdapter::MeasurementAdapter(int tempcolumn):col(tempcolumn)
  3525. {
  3526. }
  3527. int MeasurementAdapter::column()
  3528. {
  3529. return col;
  3530. }
  3531. void MeasurementAdapter::newMeasurement(Measurement measure)
  3532. {
  3533. emit measurement(measure,col);
  3534. }
  3535. void MeasurementAdapter::setColumn(int column)
  3536. {
  3537. col= column;
  3538. }
  3539. /*:315*/
  3540. #line 545 "./typica.w"
  3541. /*320:*/
  3542. #line 7588 "./typica.w"
  3543. GraphView::GraphView(QWidget*parent):QGraphicsView(parent),
  3544. theScene(new QGraphicsScene),
  3545. graphLines(new QMap<int,QList<QGraphicsLineItem*> *> ),
  3546. prevPoints(new QMap<int,QPointF> ),
  3547. translations(new QMap<int,double> ),
  3548. gridLinesF(new QList<QGraphicsItem*> ),
  3549. gridLinesC(new QList<QGraphicsItem*> ),
  3550. relativeGridLines(new QList<QGraphicsItem*> ),
  3551. relativeEnabled(false),
  3552. timeIndicatorEnabled(false),
  3553. timeLine(new QGraphicsLineItem),
  3554. relativeAdjuster(new LinearSplineInterpolator)
  3555. {
  3556. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  3557. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  3558. setScene(theScene);
  3559. setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
  3560. QPen timePen;
  3561. timePen.setColor(QColor(160,160,164,127));
  3562. timeLine->setPen(timePen);
  3563. timeLine->setLine(0,0,0,-500);
  3564. timeLine->hide();
  3565. theScene->addItem(timeLine);
  3566. /*321:*/
  3567. #line 7628 "./typica.w"
  3568. QGraphicsLineItem*tempaxis= new QGraphicsLineItem;
  3569. tempaxis->setLine(-10,-500,-10,0);
  3570. theScene->addItem(tempaxis);
  3571. QGraphicsLineItem*gridLine;
  3572. QGraphicsTextItem*label;
  3573. for(int y= -100;y> -600;y-= 100)
  3574. {
  3575. gridLine= new QGraphicsLineItem;
  3576. gridLine->setLine(0,y,1200,y);
  3577. theScene->addItem(gridLine);
  3578. label= new QGraphicsTextItem;
  3579. label->setHtml(QString("%1&deg;F").arg(-y));
  3580. label->setPos(-55,y-(label->boundingRect().height()/2));
  3581. theScene->addItem(label);
  3582. gridLinesF->append(gridLine);
  3583. gridLinesF->append(label);
  3584. }
  3585. for(int degC= 50;degC<=250;degC+= 50)
  3586. {
  3587. gridLine= new QGraphicsLineItem;
  3588. int y= -(degC*(9.0/5.0)+32);
  3589. gridLine->setLine(0,y,1200,y);
  3590. gridLine->hide();
  3591. theScene->addItem(gridLine);
  3592. gridLinesC->append(gridLine);
  3593. label= new QGraphicsTextItem;
  3594. label->setHtml(QString("%1&deg;C").arg(degC));
  3595. label->setPos(-55,y-(label->boundingRect().height()/2));
  3596. label->hide();
  3597. theScene->addItem(label);
  3598. gridLinesC->append(label);
  3599. }
  3600. /*:321*/
  3601. #line 7612 "./typica.w"
  3602. ;
  3603. /*322:*/
  3604. #line 7669 "./typica.w"
  3605. QSettings settings;
  3606. if(settings.contains("settings/graph/relative/enable"))
  3607. {
  3608. if(settings.value("settings/graph/relative/enable").toBool())
  3609. {
  3610. relativeEnabled= true;
  3611. QColor relativeColor= QColor(settings.value("settings/graph/relative/color").toString());
  3612. QString unit= QString(settings.value("settings/graph/relative/unit").toInt()==0?"F":"C");
  3613. QMap<double,QString> relativeAxisPairs;
  3614. QStringList relativeAxisLabels= settings.value("settings/graph/relative/grid").toString().split(QRegExp("[\\s,]+"),QString::SkipEmptyParts);
  3615. foreach(QString item,relativeAxisLabels)
  3616. {
  3617. relativeAxisPairs.insert(item.toDouble(),item);
  3618. }
  3619. if(relativeAxisPairs.size()> 1)
  3620. {
  3621. double skip= 500.0/(relativeAxisPairs.size()-1);
  3622. double y= 0;
  3623. foreach(double key,relativeAxisPairs.keys())
  3624. {
  3625. gridLine= new QGraphicsLineItem;
  3626. gridLine->setLine(0,y,1205,y);
  3627. gridLine->setPen(QPen(relativeColor));
  3628. theScene->addItem(gridLine);
  3629. relativeGridLines->append(gridLine);
  3630. label= new QGraphicsTextItem;
  3631. label->setHtml(QString("%1&deg;%2").arg(relativeAxisPairs.value(key)).arg(unit));
  3632. label->setPos(1210,y-(label->boundingRect().height()/2));
  3633. theScene->addItem(label);
  3634. relativeGridLines->append(label);
  3635. if(unit=="F")
  3636. {
  3637. relativeAdjuster->add_pair(key,-y);
  3638. }
  3639. else
  3640. {
  3641. relativeAdjuster->add_pair(key*(9.0/5.0),-y);
  3642. }
  3643. y-= skip;
  3644. }
  3645. }
  3646. }
  3647. }
  3648. /*:322*/
  3649. #line 7613 "./typica.w"
  3650. /*324:*/
  3651. #line 7746 "./typica.w"
  3652. QGraphicsLineItem*timeaxis= new QGraphicsLineItem;
  3653. timeaxis->setLine(0,10,1200,10);
  3654. theScene->addItem(timeaxis);
  3655. for(int x= 0;x<1201;x+= 120)
  3656. {
  3657. QGraphicsLineItem*tick= new QGraphicsLineItem;
  3658. tick->setLine(x,0,x,20);
  3659. theScene->addItem(tick);
  3660. QGraphicsTextItem*label= new QGraphicsTextItem;
  3661. label->setPlainText(QString("%1").arg(x/60));
  3662. label->setPos(x-(label->boundingRect().width()/2),20);
  3663. theScene->addItem(label);
  3664. }
  3665. /*:324*/
  3666. #line 7614 "./typica.w"
  3667. ;
  3668. fitInView(theScene->sceneRect().adjusted(-50,-50,50,50));
  3669. }
  3670. /*:320*//*323:*/
  3671. #line 7716 "./typica.w"
  3672. void GraphView::showF()
  3673. {
  3674. for(int i= 0;i<gridLinesF->size();i++)
  3675. {
  3676. gridLinesF->at(i)->show();
  3677. }
  3678. for(int i= 0;i<gridLinesC->size();i++)
  3679. {
  3680. gridLinesC->at(i)->hide();
  3681. }
  3682. }
  3683. void GraphView::showC()
  3684. {
  3685. for(int i= 0;i<gridLinesF->size();i++)
  3686. {
  3687. gridLinesF->at(i)->hide();
  3688. }
  3689. for(int i= 0;i<gridLinesC->size();i++)
  3690. {
  3691. gridLinesC->at(i)->show();
  3692. }
  3693. }
  3694. /*:323*//*325:*/
  3695. #line 7765 "./typica.w"
  3696. void GraphView::resizeEvent(QResizeEvent*)
  3697. {
  3698. fitInView(theScene->sceneRect().adjusted(-50,-50,50,50));
  3699. }
  3700. /*:325*//*326:*/
  3701. #line 7779 "./typica.w"
  3702. #define FULLTIMETOINT(t) (t.msec() + (t.second() * 1000) + (t.minute() * 60 * 1000))
  3703. void GraphView::newMeasurement(Measurement measure,int tempcolumn)
  3704. {
  3705. double offset= 0;
  3706. if(measure.contains("relative"))
  3707. {
  3708. if(measure.value("relative").toBool())
  3709. {
  3710. if(relativeEnabled)
  3711. {
  3712. measure.setTemperature(relativeAdjuster->newMeasurement(measure).temperature());
  3713. }
  3714. else
  3715. {
  3716. return;
  3717. }
  3718. }
  3719. }
  3720. if(translations->contains(tempcolumn))
  3721. {
  3722. offset= translations->value(tempcolumn);
  3723. }
  3724. if(prevPoints->contains(tempcolumn))
  3725. {
  3726. /*328:*/
  3727. #line 7856 "./typica.w"
  3728. QGraphicsLineItem*segment= new QGraphicsLineItem;
  3729. QPointF nextPoint(FULLTIMETOINT(measure.time())/1000,measure.temperature());
  3730. segment->setLine(prevPoints->value(tempcolumn).x()+offset,
  3731. -(prevPoints->value(tempcolumn).y()),
  3732. nextPoint.x()+offset,-(nextPoint.y()));
  3733. static QColor p[12]= {Qt::yellow,Qt::blue,Qt::cyan,Qt::red,Qt::magenta,
  3734. Qt::green,Qt::darkGreen,Qt::darkMagenta,
  3735. Qt::darkRed,Qt::darkCyan,Qt::darkBlue,
  3736. Qt::darkYellow};
  3737. segment->setPen(p[tempcolumn%12]);
  3738. theScene->addItem(segment);
  3739. prevPoints->insert(tempcolumn,nextPoint);
  3740. if(timeIndicatorEnabled)
  3741. {
  3742. timeLine->setLine(nextPoint.x()+offset,0,nextPoint.x()+offset,-500);
  3743. }
  3744. /*:328*/
  3745. #line 7805 "./typica.w"
  3746. if(graphLines->contains(tempcolumn))
  3747. {
  3748. graphLines->value(tempcolumn)->append(segment);
  3749. }
  3750. else
  3751. {
  3752. QList<QGraphicsLineItem*> *newLine=
  3753. new QList<QGraphicsLineItem*> ;
  3754. newLine->append(segment);
  3755. graphLines->insert(tempcolumn,newLine);
  3756. }
  3757. }
  3758. else
  3759. {
  3760. /*327:*/
  3761. #line 7841 "./typica.w"
  3762. int x= FULLTIMETOINT(measure.time())/1000;
  3763. prevPoints->insert(tempcolumn,QPointF(x,measure.temperature()));
  3764. if(timeIndicatorEnabled)
  3765. {
  3766. timeLine->setLine(x,0,x,-500);
  3767. }
  3768. /*:327*/
  3769. #line 7822 "./typica.w"
  3770. }
  3771. }
  3772. /*:326*//*329:*/
  3773. #line 7877 "./typica.w"
  3774. void GraphView::clear()
  3775. {
  3776. int i;
  3777. foreach(i,prevPoints->keys())
  3778. {
  3779. removeSeries(i);
  3780. }
  3781. translations->clear();
  3782. }
  3783. /*:329*//*330:*/
  3784. #line 7891 "./typica.w"
  3785. void GraphView::removeSeries(int column)
  3786. {
  3787. if(graphLines->contains(column))
  3788. {
  3789. QList<QGraphicsLineItem*> *series= graphLines->value(column);
  3790. QGraphicsLineItem*segment;
  3791. foreach(segment,*series)
  3792. {
  3793. theScene->removeItem(segment);
  3794. }
  3795. qDeleteAll(*series);
  3796. }
  3797. graphLines->remove(column);
  3798. prevPoints->remove(column);
  3799. }
  3800. /*:330*//*331:*/
  3801. #line 7910 "./typica.w"
  3802. void GraphView::setSeriesTranslation(int column,double offset)
  3803. {
  3804. if(graphLines->contains(column))
  3805. {
  3806. QList<QGraphicsLineItem*> *series= graphLines->value(column);
  3807. QGraphicsLineItem*segment;
  3808. foreach(segment,*series)
  3809. {
  3810. segment->setPos(segment->pos().x()+offset,segment->pos().y());
  3811. }
  3812. }
  3813. if(translations->contains(column))
  3814. {
  3815. translations->insert(column,offset+translations->value(column));
  3816. }
  3817. else
  3818. {
  3819. translations->insert(column,offset);
  3820. }
  3821. }
  3822. /*:331*//*332:*/
  3823. #line 7937 "./typica.w"
  3824. void GraphView::setTimeIndicatorEnabled(bool enabled)
  3825. {
  3826. timeIndicatorEnabled= enabled;
  3827. if(enabled)
  3828. {
  3829. timeLine->show();
  3830. }
  3831. else
  3832. {
  3833. timeLine->hide();
  3834. }
  3835. }
  3836. /*:332*/
  3837. #line 546 "./typica.w"
  3838. /*338:*/
  3839. #line 8081 "./typica.w"
  3840. void ZoomLog::newMeasurement(Measurement measure,int tempcolumn)
  3841. {
  3842. if(measure.time()!=QTime(0,0,0,0))
  3843. {
  3844. /*340:*/
  3845. #line 8155 "./typica.w"
  3846. if(lastMeasurement.contains(tempcolumn))
  3847. {
  3848. if(lastMeasurement[tempcolumn].time()<measure.time())
  3849. {
  3850. QList<QTime> timelist;
  3851. for(QTime i= lastMeasurement.value(tempcolumn).time().addSecs(1);i<measure.time();i= i.addSecs(1))
  3852. {
  3853. timelist.append(i);
  3854. }
  3855. for(int i= 0;i<timelist.size();i++)
  3856. {
  3857. Measurement synthesized= measure;
  3858. synthesized.setTime(timelist[i]);
  3859. newMeasurement(synthesized,tempcolumn);
  3860. }
  3861. }
  3862. }
  3863. /*:340*/
  3864. #line 8086 "./typica.w"
  3865. }
  3866. model_ms->newMeasurement(measure,tempcolumn);
  3867. if(lastMeasurement.contains(tempcolumn))
  3868. {
  3869. if(measure.time().second()!=
  3870. lastMeasurement.value(tempcolumn).time().second())
  3871. {
  3872. Measurement adjusted= measure;
  3873. QTime adjtime(0,measure.time().minute(),measure.time().second(),0);
  3874. adjusted.setTime(adjtime);
  3875. model_1s->newMeasurement(adjusted,tempcolumn);
  3876. if(adjusted.time().second()%5==0)
  3877. {
  3878. model_5s->newMeasurement(adjusted,tempcolumn);
  3879. if(adjusted.time().second()%10==0)
  3880. {
  3881. model_10s->newMeasurement(adjusted,tempcolumn);
  3882. }
  3883. if(adjusted.time().second()%15==0)
  3884. {
  3885. model_15s->newMeasurement(adjusted,tempcolumn);
  3886. if(adjusted.time().second()%30==0)
  3887. {
  3888. model_30s->newMeasurement(adjusted,tempcolumn);
  3889. if(adjusted.time().second()==0)
  3890. {
  3891. model_1m->newMeasurement(adjusted,tempcolumn);
  3892. }
  3893. }
  3894. }
  3895. }
  3896. }
  3897. /*342:*/
  3898. #line 8199 "./typica.w"
  3899. if(currentColumnSet.contains(tempcolumn))
  3900. {
  3901. int replicationcolumn;
  3902. foreach(replicationcolumn,currentColumnSet)
  3903. {
  3904. if(replicationcolumn!=tempcolumn)
  3905. {
  3906. if(lastMeasurement.contains(replicationcolumn))
  3907. {
  3908. if(measure.time()> lastMeasurement.value(replicationcolumn).time())
  3909. {
  3910. Measurement synthetic= lastMeasurement.value(replicationcolumn);
  3911. synthetic.setTime(measure.time());
  3912. model_ms->newMeasurement(synthetic,replicationcolumn);
  3913. if(synthetic.time().second()!=lastMeasurement.value(replicationcolumn).time().second())
  3914. {
  3915. Measurement adjusted= synthetic;
  3916. adjusted.setTime(QTime(0,synthetic.time().minute(),synthetic.time().second(),0));
  3917. model_1s->newMeasurement(adjusted,replicationcolumn);
  3918. if(adjusted.time().second()%5==0)
  3919. {
  3920. model_5s->newMeasurement(adjusted,replicationcolumn);
  3921. if(adjusted.time().second()%10==0)
  3922. {
  3923. model_10s->newMeasurement(adjusted,replicationcolumn);
  3924. }
  3925. if(adjusted.time().second()%15==0)
  3926. {
  3927. model_15s->newMeasurement(adjusted,replicationcolumn);
  3928. if(adjusted.time().second()%30==0)
  3929. {
  3930. model_30s->newMeasurement(adjusted,replicationcolumn);
  3931. if(adjusted.time().second()==0)
  3932. {
  3933. model_1m->newMeasurement(adjusted,replicationcolumn);
  3934. }
  3935. }
  3936. }
  3937. }
  3938. }
  3939. lastMeasurement[replicationcolumn]= synthetic;
  3940. }
  3941. }
  3942. }
  3943. }
  3944. }
  3945. /*:342*/
  3946. #line 8119 "./typica.w"
  3947. }
  3948. else
  3949. {
  3950. /*339:*/
  3951. #line 8131 "./typica.w"
  3952. MeasurementModel*m;
  3953. foreach(m,modelSet)
  3954. {
  3955. m->newMeasurement(measure,tempcolumn);
  3956. }
  3957. /*:339*/
  3958. #line 8123 "./typica.w"
  3959. }
  3960. lastMeasurement.insert(tempcolumn,measure);
  3961. }
  3962. /*:338*//*341:*/
  3963. #line 8185 "./typica.w"
  3964. void ZoomLog::addToCurrentColumnSet(int column)
  3965. {
  3966. currentColumnSet.append(column);
  3967. }
  3968. void ZoomLog::clearCurrentColumnSet()
  3969. {
  3970. currentColumnSet.clear();
  3971. }
  3972. /*:341*//*343:*/
  3973. #line 8269 "./typica.w"
  3974. void ZoomLog::newAnnotation(QString annotation,int tempcolumn,
  3975. int annotationcolumn)
  3976. {
  3977. model_ms->newAnnotation(annotation,tempcolumn,annotationcolumn);
  3978. MeasurementModel*m;
  3979. if(lastMeasurement.contains(tempcolumn))
  3980. {
  3981. foreach(m,modelSet)
  3982. {
  3983. m->newMeasurement(lastMeasurement.value(tempcolumn),tempcolumn);
  3984. }
  3985. }
  3986. foreach(m,modelSet)
  3987. {
  3988. m->newAnnotation(annotation,tempcolumn,annotationcolumn);
  3989. }
  3990. }
  3991. /*:343*//*344:*/
  3992. #line 8293 "./typica.w"
  3993. void ZoomLog::centerOn(int row)
  3994. {
  3995. scrollTo(currentModel->index(row,0),QAbstractItemView::PositionAtCenter);
  3996. }
  3997. /*:344*//*345:*/
  3998. #line 8303 "./typica.w"
  3999. void ZoomLog::clear()
  4000. {
  4001. MeasurementModel*m;
  4002. foreach(m,modelSet)
  4003. {
  4004. m->clear();
  4005. }
  4006. lastMeasurement.clear();
  4007. saveTempCols.clear();
  4008. saveControlCols.clear();
  4009. saveNoteCols.clear();
  4010. }
  4011. /*:345*//*346:*/
  4012. #line 8321 "./typica.w"
  4013. QVariant ZoomLog::data(int row,int column)const
  4014. {
  4015. return model_ms->data(model_ms->index(row,column,QModelIndex()),
  4016. Qt::DisplayRole);
  4017. }
  4018. int ZoomLog::rowCount()
  4019. {
  4020. return model_ms->rowCount();
  4021. }
  4022. /*:346*//*347:*/
  4023. #line 8344 "./typica.w"
  4024. bool ZoomLog::saveXML(QIODevice*device)
  4025. {
  4026. Units::Unit prevUnits= model_ms->displayUnits();
  4027. if(prevUnits!=Units::Fahrenheit)
  4028. {
  4029. model_ms->setDisplayUnits(Units::Fahrenheit);
  4030. }
  4031. XMLOutput writer(model_ms,device,0);
  4032. int c;
  4033. foreach(c,saveTempCols)
  4034. {
  4035. writer.addTemperatureColumn(model_ms->headerData(c,Qt::Horizontal).
  4036. toString(),c);
  4037. }
  4038. foreach(c,saveControlCols)
  4039. {
  4040. writer.addControlColumn(model_ms->headerData(c,Qt::Horizontal).
  4041. toString(),c);
  4042. }
  4043. foreach(c,saveNoteCols)
  4044. {
  4045. writer.addAnnotationColumn(model_ms->headerData(c,Qt::Horizontal).
  4046. toString(),c);
  4047. }
  4048. bool retval= writer.output();
  4049. if(prevUnits!=Units::Fahrenheit)
  4050. {
  4051. model_ms->setDisplayUnits(prevUnits);
  4052. }
  4053. return retval;
  4054. }
  4055. /*:347*//*348:*/
  4056. #line 8380 "./typica.w"
  4057. bool ZoomLog::saveCSV(QIODevice*device)
  4058. {
  4059. CSVOutput writer(currentModel,device,0);
  4060. int c;
  4061. foreach(c,saveTempCols)
  4062. {
  4063. writer.addTemperatureColumn(model_ms->headerData(c,Qt::Horizontal).
  4064. toString(),c);
  4065. }
  4066. foreach(c,saveControlCols)
  4067. {
  4068. writer.addControlColumn(model_ms->headerData(c,Qt::Horizontal).
  4069. toString(),c);
  4070. }
  4071. foreach(c,saveNoteCols)
  4072. {
  4073. writer.addAnnotationColumn(model_ms->headerData(c,Qt::Horizontal).
  4074. toString(),c);
  4075. }
  4076. return writer.output();
  4077. }
  4078. /*:348*//*349:*/
  4079. #line 8409 "./typica.w"
  4080. void ZoomLog::switchLOD(MeasurementModel*m)
  4081. {
  4082. disconnect(currentModel,SIGNAL(rowChanged(int)),this,0);
  4083. setModel(m);
  4084. currentModel= m;
  4085. connect(currentModel,SIGNAL(rowChanged(int)),this,SLOT(centerOn(int)));
  4086. }
  4087. void ZoomLog::LOD_ms()
  4088. {
  4089. switchLOD(model_ms);
  4090. }
  4091. void ZoomLog::LOD_1s()
  4092. {
  4093. switchLOD(model_1s);
  4094. }
  4095. void ZoomLog::LOD_5s()
  4096. {
  4097. switchLOD(model_5s);
  4098. }
  4099. void ZoomLog::LOD_10s()
  4100. {
  4101. switchLOD(model_10s);
  4102. }
  4103. void ZoomLog::LOD_15s()
  4104. {
  4105. switchLOD(model_15s);
  4106. }
  4107. void ZoomLog::LOD_30s()
  4108. {
  4109. switchLOD(model_30s);
  4110. }
  4111. void ZoomLog::LOD_1m()
  4112. {
  4113. switchLOD(model_1m);
  4114. }
  4115. /*:349*//*350:*/
  4116. #line 8457 "./typica.w"
  4117. void ZoomLog::setDisplayUnits(Units::Unit scale)
  4118. {
  4119. model_ms->setDisplayUnits(scale);
  4120. model_1s->setDisplayUnits(scale);
  4121. model_5s->setDisplayUnits(scale);
  4122. model_10s->setDisplayUnits(scale);
  4123. model_15s->setDisplayUnits(scale);
  4124. model_30s->setDisplayUnits(scale);
  4125. model_1m->setDisplayUnits(scale);
  4126. }
  4127. Units::Unit ZoomLog::displayUnits()
  4128. {
  4129. return model_ms->displayUnits();
  4130. }
  4131. /*:350*//*351:*/
  4132. #line 8477 "./typica.w"
  4133. QString ZoomLog::lastTime(int series)
  4134. {
  4135. Measurement measure= lastMeasurement.value(series);
  4136. QTime time= measure.time();
  4137. return time.toString("h:mm:ss.zzz");
  4138. }
  4139. /*:351*//*352:*/
  4140. #line 8487 "./typica.w"
  4141. ZoomLog::ZoomLog():QTableView(NULL),model_ms(new MeasurementModel(this)),
  4142. model_1s(new MeasurementModel(this)),model_5s(new MeasurementModel(this)),
  4143. model_10s(new MeasurementModel(this)),model_15s(new MeasurementModel(this)),
  4144. model_30s(new MeasurementModel(this)),model_1m(new MeasurementModel(this))
  4145. {
  4146. setEditTriggers(QAbstractItemView::NoEditTriggers);
  4147. setSelectionMode(QAbstractItemView::NoSelection);
  4148. modelSet<<model_ms<<model_1s<<model_5s<<model_10s<<model_15s<<
  4149. model_30s<<model_1m;
  4150. currentModel= model_30s;
  4151. setModel(currentModel);
  4152. connect(currentModel,SIGNAL(rowChanged(int)),this,SLOT(centerOn(int)));
  4153. connect(horizontalHeader(),SIGNAL(sectionResized(int,int,int)),
  4154. this,SLOT(persistColumnResize(int,int,int)));
  4155. connect(horizontalHeader(),SIGNAL(sectionCountChanged(int,int)),
  4156. this,SLOT(restoreColumnWidths()));
  4157. }
  4158. /*:352*//*353:*/
  4159. #line 8510 "./typica.w"
  4160. void ZoomLog::setHeaderData(int section,QString text)
  4161. {
  4162. MeasurementModel*m;
  4163. foreach(m,modelSet)
  4164. {
  4165. m->setHeaderData(section,Qt::Horizontal,QVariant(text));
  4166. }
  4167. }
  4168. /*:353*//*354:*/
  4169. #line 8528 "./typica.w"
  4170. void ZoomLog::addOutputTemperatureColumn(int column)
  4171. {
  4172. saveTempCols.append(column);
  4173. }
  4174. void ZoomLog::addOutputControlColumn(int column)
  4175. {
  4176. saveControlCols.append(column);
  4177. }
  4178. void ZoomLog::addOutputAnnotationColumn(int column)
  4179. {
  4180. saveNoteCols.append(column);
  4181. }
  4182. void ZoomLog::clearOutputColumns()
  4183. {
  4184. saveTempCols.clear();
  4185. saveControlCols.clear();
  4186. saveNoteCols.clear();
  4187. }
  4188. /*:354*//*355:*/
  4189. #line 8554 "./typica.w"
  4190. void ZoomLog::persistColumnResize(int column,int,int newsize)
  4191. {
  4192. /*566:*/
  4193. #line 12633 "./typica.w"
  4194. QSettings settings;
  4195. /*567:*/
  4196. #line 12646 "./typica.w"
  4197. QWidget*topLevelWidget= this;
  4198. while(topLevelWidget->parentWidget())
  4199. {
  4200. topLevelWidget= topLevelWidget->parentWidget();
  4201. }
  4202. /*:567*/
  4203. #line 12635 "./typica.w"
  4204. settings.setValue(QString("columnWidths/%1/%2/%3").
  4205. arg(topLevelWidget->objectName()).
  4206. arg(objectName()).arg(column),
  4207. QVariant(newsize));
  4208. /*:566*/
  4209. #line 8557 "./typica.w"
  4210. }
  4211. void ZoomLog::restoreColumnWidths()
  4212. {
  4213. /*569:*/
  4214. #line 12666 "./typica.w"
  4215. QSettings settings;
  4216. /*567:*/
  4217. #line 12646 "./typica.w"
  4218. QWidget*topLevelWidget= this;
  4219. while(topLevelWidget->parentWidget())
  4220. {
  4221. topLevelWidget= topLevelWidget->parentWidget();
  4222. }
  4223. /*:567*/
  4224. #line 12668 "./typica.w"
  4225. QString baseKey=
  4226. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  4227. arg(objectName());
  4228. for(int i= 0;i<model()->columnCount();i++)
  4229. {
  4230. QString key= QString("%1/%2").arg(baseKey).arg(i);
  4231. if(settings.contains(key))
  4232. {
  4233. setColumnWidth(i,settings.value(key).toInt());
  4234. }
  4235. }
  4236. /*:569*/
  4237. #line 8562 "./typica.w"
  4238. }
  4239. void ZoomLog::setVisible(bool visibility)
  4240. {
  4241. QTableView::setVisible(visibility);
  4242. }
  4243. void ZoomLog::showEvent(QShowEvent*)
  4244. {
  4245. /*569:*/
  4246. #line 12666 "./typica.w"
  4247. QSettings settings;
  4248. /*567:*/
  4249. #line 12646 "./typica.w"
  4250. QWidget*topLevelWidget= this;
  4251. while(topLevelWidget->parentWidget())
  4252. {
  4253. topLevelWidget= topLevelWidget->parentWidget();
  4254. }
  4255. /*:567*/
  4256. #line 12668 "./typica.w"
  4257. QString baseKey=
  4258. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  4259. arg(objectName());
  4260. for(int i= 0;i<model()->columnCount();i++)
  4261. {
  4262. QString key= QString("%1/%2").arg(baseKey).arg(i);
  4263. if(settings.contains(key))
  4264. {
  4265. setColumnWidth(i,settings.value(key).toInt());
  4266. }
  4267. }
  4268. /*:569*/
  4269. #line 8572 "./typica.w"
  4270. }
  4271. /*:355*/
  4272. #line 547 "./typica.w"
  4273. /*364:*/
  4274. #line 8805 "./typica.w"
  4275. bool MeasurementList::operator<(const MeasurementList&other)const
  4276. {
  4277. return this->first().toTime()<other.first().toTime();
  4278. }
  4279. bool MeasurementList::operator==(const MeasurementList&other)const
  4280. {
  4281. return this->first().toTime()==other.first().toTime();
  4282. }
  4283. /*:364*//*365:*/
  4284. #line 8821 "./typica.w"
  4285. QModelIndex MeasurementModel::parent(const QModelIndex&)const
  4286. {
  4287. return QModelIndex();
  4288. }
  4289. /*:365*//*366:*/
  4290. #line 8831 "./typica.w"
  4291. void MeasurementModel::newMeasurement(Measurement measure,int tempcolumn)
  4292. {
  4293. if(measure.scale()==Units::Unitless)
  4294. {
  4295. controlColumns->insert(tempcolumn,true);
  4296. }
  4297. else
  4298. {
  4299. controlColumns->insert(tempcolumn,false);
  4300. }
  4301. MeasurementList*temp;
  4302. temp= new MeasurementList;
  4303. temp->append(QVariant(measure.time()));
  4304. /*367:*/
  4305. #line 8890 "./typica.w"
  4306. /*368:*/
  4307. #line 8935 "./typica.w"
  4308. QList<MeasurementList*> ::iterator i= lastInsertion;
  4309. bool quickscan= false;
  4310. if(entries->size()> 5)
  4311. {
  4312. if(**i<*temp)
  4313. {
  4314. i+= 1;
  4315. for(int j= 10;j> 0;j--)
  4316. {
  4317. if(i!=entries->end())
  4318. {
  4319. if(**i<*temp)
  4320. {
  4321. i+= 1;
  4322. }
  4323. else
  4324. {
  4325. quickscan= true;
  4326. break;
  4327. }
  4328. }
  4329. else
  4330. {
  4331. quickscan= true;
  4332. break;
  4333. }
  4334. }
  4335. }
  4336. else
  4337. {
  4338. if(**i==*temp)
  4339. {
  4340. quickscan= true;
  4341. }
  4342. }
  4343. }
  4344. /*:368*/
  4345. #line 8891 "./typica.w"
  4346. if(quickscan==false)
  4347. {
  4348. i= entries->begin();
  4349. QList<MeasurementList*> ::iterator u= entries->end();
  4350. QList<MeasurementList*> ::iterator midpoint;
  4351. int n= u-i;
  4352. int rA;
  4353. while(n> 0)
  4354. {
  4355. rA= n>>1;
  4356. midpoint= i+rA;
  4357. if(**midpoint<*temp)
  4358. {
  4359. i= midpoint+1;
  4360. n-= rA+1;
  4361. }
  4362. else
  4363. {
  4364. n= rA;
  4365. }
  4366. }
  4367. }
  4368. /*:367*/
  4369. #line 8845 "./typica.w"
  4370. MeasurementList*newEntry;
  4371. int insertion;
  4372. if(i!=entries->end())
  4373. {
  4374. insertion= entries->indexOf(*i);
  4375. if((*i)->first().toTime()==measure.time())
  4376. {
  4377. /*369:*/
  4378. #line 8977 "./typica.w"
  4379. if((*i)->size()<tempcolumn+1)
  4380. {
  4381. for(int j= (*i)->size()-1;j<tempcolumn+1;j++)
  4382. {
  4383. (*i)->append(QVariant());
  4384. }
  4385. }
  4386. (*i)->replace(tempcolumn,measure);
  4387. lastInsertion= i;
  4388. emit dataChanged(createIndex(insertion,tempcolumn),
  4389. createIndex(insertion,tempcolumn));
  4390. lastTemperature->insert(tempcolumn,insertion);
  4391. /*:369*/
  4392. #line 8853 "./typica.w"
  4393. }
  4394. else
  4395. {
  4396. /*370:*/
  4397. #line 8995 "./typica.w"
  4398. beginInsertRows(QModelIndex(),insertion,insertion);
  4399. newEntry= new MeasurementList;
  4400. newEntry->append(QVariant(measure.time()));
  4401. for(int j= 0;j<tempcolumn+1;j++)
  4402. {
  4403. newEntry->append(QVariant());
  4404. }
  4405. newEntry->replace(tempcolumn,measure);
  4406. lastInsertion= entries->insert(i,newEntry);
  4407. endInsertRows();
  4408. lastTemperature->insert(tempcolumn,insertion);
  4409. /*:370*/
  4410. #line 8857 "./typica.w"
  4411. }
  4412. }
  4413. else
  4414. {
  4415. /*371:*/
  4416. #line 9013 "./typica.w"
  4417. insertion= entries->size();
  4418. /*370:*/
  4419. #line 8995 "./typica.w"
  4420. beginInsertRows(QModelIndex(),insertion,insertion);
  4421. newEntry= new MeasurementList;
  4422. newEntry->append(QVariant(measure.time()));
  4423. for(int j= 0;j<tempcolumn+1;j++)
  4424. {
  4425. newEntry->append(QVariant());
  4426. }
  4427. newEntry->replace(tempcolumn,measure);
  4428. lastInsertion= entries->insert(i,newEntry);
  4429. endInsertRows();
  4430. lastTemperature->insert(tempcolumn,insertion);
  4431. /*:370*/
  4432. #line 9015 "./typica.w"
  4433. /*:371*/
  4434. #line 8862 "./typica.w"
  4435. }
  4436. if(tempcolumn>=colcount)
  4437. {
  4438. colcount= tempcolumn+1;
  4439. }
  4440. emit rowChanged(insertion);
  4441. delete temp;
  4442. }
  4443. /*:366*//*372:*/
  4444. #line 9025 "./typica.w"
  4445. void MeasurementModel::newAnnotation(QString annotation,int tempcolumn,
  4446. int annotationColumn)
  4447. {
  4448. int r;
  4449. if(lastTemperature->contains(tempcolumn))
  4450. {
  4451. r= lastTemperature->value(tempcolumn);
  4452. }
  4453. else
  4454. {
  4455. r= 0;
  4456. }
  4457. if(r==0&&entries->size()==0)
  4458. {
  4459. /*373:*/
  4460. #line 9063 "./typica.w"
  4461. beginInsertRows(QModelIndex(),0,0);
  4462. MeasurementList*newEntry= new MeasurementList;
  4463. newEntry->append(QVariant(QTime(0,0,0,0)));
  4464. entries->append(newEntry);
  4465. endInsertRows();
  4466. /*:373*/
  4467. #line 9040 "./typica.w"
  4468. }
  4469. MeasurementList*row= entries->at(r);
  4470. if(row->size()<=annotationColumn)
  4471. {
  4472. for(int i= row->size()-1;i<annotationColumn+1;i++)
  4473. {
  4474. row->append(QVariant());
  4475. }
  4476. }
  4477. row->replace(annotationColumn,annotation);
  4478. emit dataChanged(createIndex(r,annotationColumn),
  4479. createIndex(r,annotationColumn));
  4480. emit rowChanged(r);
  4481. if(annotationColumn> colcount-1)
  4482. {
  4483. colcount= annotationColumn+1;
  4484. }
  4485. }
  4486. /*:372*//*374:*/
  4487. #line 9074 "./typica.w"
  4488. void MeasurementModel::clear()
  4489. {
  4490. beginRemoveRows(QModelIndex(),0,entries->size());
  4491. while(entries->size()!=0)
  4492. {
  4493. MeasurementList*row= entries->takeFirst();
  4494. delete row;
  4495. }
  4496. endRemoveRows();
  4497. colcount= hData->size();
  4498. lastTemperature->clear();
  4499. reset();
  4500. }
  4501. /*:374*//*375:*/
  4502. #line 9107 "./typica.w"
  4503. bool MeasurementModel::setData(const QModelIndex&index,
  4504. const QVariant&value,int role)
  4505. {
  4506. if(role!=Qt::EditRole&&role!=Qt::DisplayRole)
  4507. {
  4508. return false;
  4509. }
  4510. /*376:*/
  4511. #line 9139 "./typica.w"
  4512. bool valid= false;
  4513. if(index.isValid())
  4514. {
  4515. if(index.row()<entries->size())
  4516. {
  4517. if(index.column()<colcount)
  4518. {
  4519. valid= true;
  4520. }
  4521. }
  4522. }
  4523. /*:376*/
  4524. #line 9115 "./typica.w"
  4525. if(!valid)
  4526. {
  4527. return false;
  4528. }
  4529. MeasurementList*row= entries->at(index.row());
  4530. if(index.column()>=row->size())
  4531. {
  4532. /*377:*/
  4533. #line 9156 "./typica.w"
  4534. for(int i= row->size()-1;i<index.column();i++)
  4535. {
  4536. row->append(QVariant());
  4537. }
  4538. /*:377*/
  4539. #line 9123 "./typica.w"
  4540. }
  4541. if(index.column()==0)
  4542. {
  4543. /*378:*/
  4544. #line 9171 "./typica.w"
  4545. QTime time;
  4546. if(!(time= QTime::fromString(value.toString(),"m:s.z")).isValid())
  4547. {
  4548. if(!(time= QTime::fromString(value.toString(),"m:s")).isValid())
  4549. {
  4550. return false;
  4551. }
  4552. }
  4553. row= entries->takeAt(index.row());
  4554. row->replace(index.column(),QVariant(time));
  4555. MeasurementList*temp= row;
  4556. /*367:*/
  4557. #line 8890 "./typica.w"
  4558. /*368:*/
  4559. #line 8935 "./typica.w"
  4560. QList<MeasurementList*> ::iterator i= lastInsertion;
  4561. bool quickscan= false;
  4562. if(entries->size()> 5)
  4563. {
  4564. if(**i<*temp)
  4565. {
  4566. i+= 1;
  4567. for(int j= 10;j> 0;j--)
  4568. {
  4569. if(i!=entries->end())
  4570. {
  4571. if(**i<*temp)
  4572. {
  4573. i+= 1;
  4574. }
  4575. else
  4576. {
  4577. quickscan= true;
  4578. break;
  4579. }
  4580. }
  4581. else
  4582. {
  4583. quickscan= true;
  4584. break;
  4585. }
  4586. }
  4587. }
  4588. else
  4589. {
  4590. if(**i==*temp)
  4591. {
  4592. quickscan= true;
  4593. }
  4594. }
  4595. }
  4596. /*:368*/
  4597. #line 8891 "./typica.w"
  4598. if(quickscan==false)
  4599. {
  4600. i= entries->begin();
  4601. QList<MeasurementList*> ::iterator u= entries->end();
  4602. QList<MeasurementList*> ::iterator midpoint;
  4603. int n= u-i;
  4604. int rA;
  4605. while(n> 0)
  4606. {
  4607. rA= n>>1;
  4608. midpoint= i+rA;
  4609. if(**midpoint<*temp)
  4610. {
  4611. i= midpoint+1;
  4612. n-= rA+1;
  4613. }
  4614. else
  4615. {
  4616. n= rA;
  4617. }
  4618. }
  4619. }
  4620. /*:367*/
  4621. #line 9183 "./typica.w"
  4622. entries->insert(i,row);
  4623. int newRow= entries->indexOf(*i);
  4624. if(newRow<index.row())
  4625. {
  4626. emit dataChanged(createIndex(newRow,index.column()),index);
  4627. }
  4628. else
  4629. {
  4630. emit dataChanged(index,createIndex(newRow,index.column()));
  4631. }
  4632. /*:378*/
  4633. #line 9127 "./typica.w"
  4634. }
  4635. else
  4636. {
  4637. /*379:*/
  4638. #line 9197 "./typica.w"
  4639. row->replace(index.column(),value);
  4640. emit dataChanged(index,index);
  4641. /*:379*/
  4642. #line 9131 "./typica.w"
  4643. }
  4644. return true;
  4645. }
  4646. /*:375*//*380:*/
  4647. #line 9205 "./typica.w"
  4648. MeasurementModel::MeasurementModel(QObject*parent):QAbstractItemModel(parent),
  4649. unit(Units::Fahrenheit),hData(new QStringList),
  4650. lastTemperature(new QHash<int,int> ),
  4651. controlColumns(new QHash<int,bool> )
  4652. {
  4653. colcount= 1;
  4654. entries= new QList<MeasurementList*> ;
  4655. lastInsertion= entries->begin();
  4656. hData->append(tr("Time"));
  4657. }
  4658. /*:380*//*381:*/
  4659. #line 9219 "./typica.w"
  4660. MeasurementModel::~MeasurementModel()
  4661. {
  4662. clear();
  4663. delete entries;
  4664. delete hData;
  4665. }
  4666. /*:381*//*382:*/
  4667. #line 9231 "./typica.w"
  4668. int MeasurementModel::rowCount(const QModelIndex&parent)const
  4669. {
  4670. if(parent==QModelIndex())
  4671. {
  4672. return entries->size();
  4673. }
  4674. return 0;
  4675. }
  4676. int MeasurementModel::columnCount(const QModelIndex&parent)const
  4677. {
  4678. if(parent==QModelIndex())
  4679. {
  4680. return colcount;
  4681. }
  4682. return 0;
  4683. }
  4684. /*:382*//*383:*/
  4685. #line 9258 "./typica.w"
  4686. bool MeasurementModel::setHeaderData(int section,Qt::Orientation orientation,
  4687. const QVariant&value,int)
  4688. {
  4689. if(orientation==Qt::Horizontal)
  4690. {
  4691. if(hData->size()<section+1)
  4692. {
  4693. for(int i= hData->size();i<section+1;i++)
  4694. {
  4695. if(colcount<i)
  4696. {
  4697. beginInsertColumns(QModelIndex(),i,i);
  4698. }
  4699. hData->append(QString());
  4700. if(colcount<i)
  4701. {
  4702. endInsertColumns();
  4703. }
  4704. }
  4705. }
  4706. hData->replace(section,value.toString());
  4707. emit headerDataChanged(orientation,section,section);
  4708. if(colcount<section+1)
  4709. {
  4710. colcount= section+1;
  4711. }
  4712. return true;
  4713. }
  4714. return false;
  4715. }
  4716. /*:383*//*384:*/
  4717. #line 9298 "./typica.w"
  4718. void MeasurementModel::setDisplayUnits(Units::Unit scale)
  4719. {
  4720. beginResetModel();
  4721. unit= scale;
  4722. endResetModel();
  4723. }
  4724. Units::Unit MeasurementModel::displayUnits()
  4725. {
  4726. return unit;
  4727. }
  4728. /*:384*//*385:*/
  4729. #line 9324 "./typica.w"
  4730. QVariant MeasurementModel::data(const QModelIndex&index,int role)const
  4731. {
  4732. /*376:*/
  4733. #line 9139 "./typica.w"
  4734. bool valid= false;
  4735. if(index.isValid())
  4736. {
  4737. if(index.row()<entries->size())
  4738. {
  4739. if(index.column()<colcount)
  4740. {
  4741. valid= true;
  4742. }
  4743. }
  4744. }
  4745. /*:376*/
  4746. #line 9327 "./typica.w"
  4747. if(!valid)
  4748. {
  4749. return QVariant();
  4750. }
  4751. MeasurementList*row= entries->at(index.row());
  4752. if(role==Qt::UserRole)
  4753. {
  4754. return QVariant(row->at(index.column()));
  4755. }
  4756. if(role==Qt::DisplayRole||role==Qt::EditRole)
  4757. {
  4758. if(index.column()> row->size())
  4759. {
  4760. return QVariant();
  4761. }
  4762. else
  4763. {
  4764. if(index.column()==0)
  4765. {
  4766. return QVariant(row->at(0).toTime().toString("mm:ss.zzz"));
  4767. }
  4768. else if(lastTemperature->contains(index.column()))
  4769. {
  4770. QVariantMap v= row->at(index.column()).toMap();
  4771. if(!v.contains("measurement"))
  4772. {
  4773. return QVariant();
  4774. }
  4775. if((Units::Unit)(v.value("unit").toInt())==Units::Unitless)
  4776. {
  4777. return v.value("measurement");
  4778. }
  4779. else
  4780. {
  4781. if(v.contains("relative"))
  4782. {
  4783. if(v.value("relative").toBool())
  4784. {
  4785. return QVariant(QString("%1").arg(Units::convertRelativeTemperature(v.value("measurement").
  4786. toDouble(),(Units::Unit)(v.value("unit").toInt()),unit)));
  4787. }
  4788. }
  4789. return QVariant(QString("%1").
  4790. arg(Units::convertTemperature(v.value("measurement").toDouble(),
  4791. (Units::Unit)(v.value("unit").toInt()),unit)));
  4792. }
  4793. }
  4794. return QVariant(row->at(index.column()).toString());
  4795. }
  4796. }
  4797. return QVariant();
  4798. }
  4799. /*:385*//*386:*/
  4800. #line 9383 "./typica.w"
  4801. QVariant MeasurementModel::headerData(int section,Qt::Orientation orientation,
  4802. int role)const
  4803. {
  4804. if(orientation==Qt::Horizontal)
  4805. {
  4806. if(role==Qt::DisplayRole)
  4807. {
  4808. if(section<hData->size())
  4809. {
  4810. return QVariant(hData->at(section));
  4811. }
  4812. }
  4813. }
  4814. return QVariant();
  4815. }
  4816. /*:386*//*387:*/
  4817. #line 9410 "./typica.w"
  4818. Qt::ItemFlags MeasurementModel::flags(const QModelIndex&index)const
  4819. {
  4820. /*376:*/
  4821. #line 9139 "./typica.w"
  4822. bool valid= false;
  4823. if(index.isValid())
  4824. {
  4825. if(index.row()<entries->size())
  4826. {
  4827. if(index.column()<colcount)
  4828. {
  4829. valid= true;
  4830. }
  4831. }
  4832. }
  4833. /*:376*/
  4834. #line 9413 "./typica.w"
  4835. if(valid)
  4836. {
  4837. return Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable;
  4838. }
  4839. return 0;
  4840. }
  4841. /*:387*//*388:*/
  4842. #line 9425 "./typica.w"
  4843. QModelIndex MeasurementModel::index(int row,int column,
  4844. const QModelIndex&parent)const
  4845. {
  4846. if(parent==QModelIndex())
  4847. {
  4848. if(row<entries->size()&&entries->isEmpty()==false)
  4849. {
  4850. if(column<entries->at(row)->size())
  4851. {
  4852. return createIndex(row,column);
  4853. }
  4854. }
  4855. }
  4856. return QModelIndex();
  4857. }
  4858. /*:388*/
  4859. #line 548 "./typica.w"
  4860. /*390:*/
  4861. #line 9476 "./typica.w"
  4862. AnnotationButton::AnnotationButton(const QString&text,QWidget*parent):
  4863. QPushButton(text,parent),note(""),tc(0),ac(0),count(0)
  4864. {
  4865. connect(this,SIGNAL(clicked()),this,SLOT(annotate()));
  4866. }
  4867. /*:390*//*391:*/
  4868. #line 9491 "./typica.w"
  4869. void AnnotationButton::annotate()
  4870. {
  4871. if(note.contains("%1"))
  4872. {
  4873. count++;
  4874. emit annotation(note.arg(count),tc,ac);
  4875. }
  4876. else
  4877. {
  4878. emit annotation(note,tc,ac);
  4879. }
  4880. }
  4881. /*:391*//*392:*/
  4882. #line 9509 "./typica.w"
  4883. void AnnotationButton::setTemperatureColumn(int tempcolumn)
  4884. {
  4885. tc= tempcolumn;
  4886. }
  4887. void AnnotationButton::setAnnotationColumn(int annotationcolumn)
  4888. {
  4889. ac= annotationcolumn;
  4890. }
  4891. void AnnotationButton::setAnnotation(const QString&annotation)
  4892. {
  4893. note= annotation;
  4894. }
  4895. /*:392*//*393:*/
  4896. #line 9528 "./typica.w"
  4897. void AnnotationButton::resetCount()
  4898. {
  4899. count= 0;
  4900. }
  4901. /*:393*/
  4902. #line 549 "./typica.w"
  4903. /*398:*/
  4904. #line 9611 "./typica.w"
  4905. AnnotationSpinBox::AnnotationSpinBox(const QString&pret,
  4906. const QString&postt,
  4907. QWidget*parent)
  4908. :QDoubleSpinBox(parent),pretext(pret),posttext(postt)
  4909. {
  4910. resetChange();
  4911. connect(this,SIGNAL(editingFinished()),this,SLOT(annotate()));
  4912. connect(this,SIGNAL(valueChanged(double)),this,SLOT(resetChange()));
  4913. }
  4914. /*:398*//*399:*/
  4915. #line 9628 "./typica.w"
  4916. void AnnotationSpinBox::resetChange()
  4917. {
  4918. change= true;
  4919. }
  4920. /*:399*//*400:*/
  4921. #line 9639 "./typica.w"
  4922. void AnnotationSpinBox::annotate()
  4923. {
  4924. if(change)
  4925. {
  4926. change= false;
  4927. emit annotation(QString("%1%2%3").arg(pretext).
  4928. arg(value()).arg(posttext),tc,ac);
  4929. }
  4930. }
  4931. /*:400*//*401:*/
  4932. #line 9652 "./typica.w"
  4933. void AnnotationSpinBox::setTemperatureColumn(int tempcolumn)
  4934. {
  4935. tc= tempcolumn;
  4936. }
  4937. void AnnotationSpinBox::setAnnotationColumn(int annotationcolumn)
  4938. {
  4939. ac= annotationcolumn;
  4940. }
  4941. void AnnotationSpinBox::setPretext(const QString&pret)
  4942. {
  4943. pretext= pret;
  4944. }
  4945. void AnnotationSpinBox::setPosttext(const QString&postt)
  4946. {
  4947. posttext= postt;
  4948. }
  4949. /*:401*/
  4950. #line 550 "./typica.w"
  4951. /*408:*/
  4952. #line 9820 "./typica.w"
  4953. TimerDisplay::TimerDisplay(QWidget*parent):QLCDNumber(8,parent),
  4954. s(QTime(0,0,0)),r(QTime(0,0,0)),clock(NULL),m(TimerDisplay::CountUp),
  4955. running(false),ar(false),startAction(new QAction(tr("Start"),NULL)),
  4956. stopAction(new QAction(tr("Stop"),NULL)),
  4957. resetAction(new QAction(tr("Reset"),NULL)),f(QString("hh:mm:ss")),
  4958. relative(QTime::currentTime()),base(QTime(0,0,0))
  4959. {
  4960. connect(startAction,SIGNAL(triggered(bool)),this,SLOT(startTimer()));
  4961. connect(stopAction,SIGNAL(triggered(bool)),this,SLOT(stopTimer()));
  4962. connect(resetAction,SIGNAL(triggered(bool)),this,SLOT(reset()));
  4963. clock.setInterval(500);
  4964. clock.setSingleShot(false);
  4965. connect(&clock,SIGNAL(timeout()),this,SLOT(updateTime()));
  4966. setSegmentStyle(Filled);
  4967. updateDisplay();
  4968. }
  4969. /*:408*//*409:*/
  4970. #line 9841 "./typica.w"
  4971. void TimerDisplay::updateTime()
  4972. {
  4973. QTime time;
  4974. int cseconds= 0;
  4975. int oseconds= 0;
  4976. int r= 0;
  4977. QTime nt= QTime(0,0,0);
  4978. int n= 0;
  4979. int bseconds= 0;
  4980. switch(m)
  4981. {
  4982. case TimerDisplay::CountUp:
  4983. /*410:*/
  4984. #line 9873 "./typica.w"
  4985. /*411:*/
  4986. #line 9886 "./typica.w"
  4987. #define TIMETOINT(t) ((t.hour() * 60 * 60) + (t.minute() * 60) + (t.second()))
  4988. time= QTime::currentTime();
  4989. cseconds= TIMETOINT(time);
  4990. oseconds= TIMETOINT(relative);
  4991. r= cseconds-oseconds;
  4992. /*:411*/
  4993. #line 9874 "./typica.w"
  4994. nt= nt.addSecs(r);
  4995. if(nt!=s)
  4996. {
  4997. s= nt;
  4998. emit valueChanged(s);
  4999. }
  5000. /*:410*/
  5001. #line 9854 "./typica.w"
  5002. ;
  5003. break;
  5004. case TimerDisplay::CountDown:
  5005. /*412:*/
  5006. #line 9898 "./typica.w"
  5007. if(s> QTime(0,0,0))
  5008. {
  5009. /*411:*/
  5010. #line 9886 "./typica.w"
  5011. #define TIMETOINT(t) ((t.hour() * 60 * 60) + (t.minute() * 60) + (t.second()))
  5012. time= QTime::currentTime();
  5013. cseconds= TIMETOINT(time);
  5014. oseconds= TIMETOINT(relative);
  5015. r= cseconds-oseconds;
  5016. /*:411*/
  5017. #line 9901 "./typica.w"
  5018. bseconds= TIMETOINT(base);
  5019. n= bseconds-r;
  5020. nt= nt.addSecs(n);
  5021. if(nt!=s)
  5022. {
  5023. s= nt;
  5024. emit valueChanged(s);
  5025. }
  5026. }
  5027. /*:412*/
  5028. #line 9857 "./typica.w"
  5029. ;
  5030. break;
  5031. case TimerDisplay::Clock:
  5032. /*413:*/
  5033. #line 9915 "./typica.w"
  5034. time= QTime::currentTime();
  5035. if(time!=s)
  5036. {
  5037. s= time;
  5038. emit valueChanged(s);
  5039. }
  5040. /*:413*/
  5041. #line 9860 "./typica.w"
  5042. ;
  5043. break;
  5044. default:
  5045. Q_ASSERT_X(false,"updateTime","invalid timer mode");
  5046. break;
  5047. }
  5048. updateDisplay();
  5049. }
  5050. /*:409*//*414:*/
  5051. #line 9927 "./typica.w"
  5052. #define TIMESUBTRACT(t1, t2) (t1.addSecs(-(TIMETOINT(t2))).addSecs(-t2.msec()))
  5053. void TimerDisplay::startTimer()
  5054. {
  5055. if(!running)
  5056. {
  5057. relative= QTime::currentTime();
  5058. if(ar)
  5059. {
  5060. reset();
  5061. }
  5062. else
  5063. {
  5064. relative= TIMESUBTRACT(relative,s);
  5065. }
  5066. if(m==Clock)
  5067. {
  5068. updateTime();
  5069. }
  5070. base= s;
  5071. clock.start();
  5072. running= true;
  5073. emit runStateChanged(true);
  5074. }
  5075. }
  5076. /*:414*//*415:*/
  5077. #line 9957 "./typica.w"
  5078. void TimerDisplay::stopTimer()
  5079. {
  5080. if(running)
  5081. {
  5082. clock.stop();
  5083. running= false;
  5084. emit runStateChanged(false);
  5085. }
  5086. }
  5087. /*:415*//*416:*/
  5088. #line 9970 "./typica.w"
  5089. TimerDisplay::~TimerDisplay()
  5090. {
  5091. clock.stop();
  5092. }
  5093. /*:416*//*417:*/
  5094. #line 9979 "./typica.w"
  5095. void TimerDisplay::setCountUpMode()
  5096. {
  5097. m= TimerDisplay::CountUp;
  5098. }
  5099. void TimerDisplay::setCountDownMode()
  5100. {
  5101. m= TimerDisplay::CountDown;
  5102. }
  5103. void TimerDisplay::setClockMode()
  5104. {
  5105. m= TimerDisplay::Clock;
  5106. }
  5107. /*:417*//*418:*/
  5108. #line 9997 "./typica.w"
  5109. QString TimerDisplay::value()
  5110. {
  5111. return s.toString(f);
  5112. }
  5113. QTime TimerDisplay::seconds()
  5114. {
  5115. return s;
  5116. }
  5117. TimerDisplay::TimerMode TimerDisplay::mode()
  5118. {
  5119. return m;
  5120. }
  5121. bool TimerDisplay::isRunning()
  5122. {
  5123. return running;
  5124. }
  5125. QTime TimerDisplay::resetValue()
  5126. {
  5127. return r;
  5128. }
  5129. QString TimerDisplay::displayFormat()
  5130. {
  5131. return f;
  5132. }
  5133. bool TimerDisplay::autoReset()
  5134. {
  5135. return ar;
  5136. }
  5137. /*:418*//*419:*/
  5138. #line 10035 "./typica.w"
  5139. void TimerDisplay::setTimer(QTime value)
  5140. {
  5141. if(value.isValid())
  5142. {
  5143. s= value;
  5144. updateDisplay();
  5145. emit valueChanged(value);
  5146. }
  5147. }
  5148. void TimerDisplay::setMode(TimerDisplay::TimerMode mode)
  5149. {
  5150. m= mode;
  5151. }
  5152. void TimerDisplay::setResetValue(QTime value)
  5153. {
  5154. r= value;
  5155. }
  5156. void TimerDisplay::setDisplayFormat(QString format)
  5157. {
  5158. f= format;
  5159. setNumDigits(format.length());
  5160. }
  5161. void TimerDisplay::setAutoReset(bool reset)
  5162. {
  5163. ar= reset;
  5164. }
  5165. /*:419*//*420:*/
  5166. #line 10070 "./typica.w"
  5167. void TimerDisplay::copyTimer()
  5168. {
  5169. QApplication::clipboard()->setText(value());
  5170. }
  5171. /*:420*//*421:*/
  5172. #line 10079 "./typica.w"
  5173. void TimerDisplay::reset()
  5174. {
  5175. if(!running)
  5176. {
  5177. s= r;
  5178. updateDisplay();
  5179. }
  5180. }
  5181. /*:421*//*422:*/
  5182. #line 10092 "./typica.w"
  5183. void TimerDisplay::updateDisplay()
  5184. {
  5185. display(value());
  5186. }
  5187. /*:422*/
  5188. #line 551 "./typica.w"
  5189. /*428:*/
  5190. #line 10186 "./typica.w"
  5191. int PackLayout::doLayout(const QRect&rect,bool testOnly)const
  5192. {
  5193. int x= rect.x();
  5194. int y= rect.y();
  5195. QLayoutItem*item;
  5196. if(orientation==Qt::Horizontal)
  5197. {
  5198. /*429:*/
  5199. #line 10210 "./typica.w"
  5200. foreach(item,itemList)
  5201. {
  5202. int nextX= x+item->sizeHint().width()+spacing();
  5203. int right= x+item->sizeHint().width();
  5204. if(item==itemList.last())
  5205. {
  5206. right= rect.right();
  5207. }
  5208. int bottom= rect.bottom();
  5209. if(!testOnly)
  5210. {
  5211. item->setGeometry(QRect(QPoint(x,y),QPoint(right,bottom)));
  5212. }
  5213. x= nextX;
  5214. }
  5215. /*:429*/
  5216. #line 10194 "./typica.w"
  5217. }
  5218. else
  5219. {
  5220. /*430:*/
  5221. #line 10229 "./typica.w"
  5222. foreach(item,itemList)
  5223. {
  5224. int nextY= y+item->sizeHint().height()+spacing();
  5225. int bottom= y+item->sizeHint().height();
  5226. if(item==itemList.last())
  5227. {
  5228. bottom= rect.bottom();
  5229. }
  5230. int right= rect.right();
  5231. if(!testOnly)
  5232. {
  5233. item->setGeometry(QRect(QPoint(x,y),QPoint(right,bottom)));
  5234. }
  5235. y= nextY;
  5236. }
  5237. /*:430*/
  5238. #line 10198 "./typica.w"
  5239. }
  5240. return y;
  5241. }
  5242. /*:428*//*431:*/
  5243. #line 10253 "./typica.w"
  5244. QSize PackLayout::minimumSize()const
  5245. {
  5246. QSize size;
  5247. QLayoutItem*item;
  5248. foreach(item,itemList)
  5249. {
  5250. if(orientation==Qt::Horizontal)
  5251. {
  5252. size+= QSize(item->minimumSize().width(),0);
  5253. if(size.height()<item->minimumSize().height())
  5254. {
  5255. size.setHeight(item->minimumSize().height());
  5256. }
  5257. }
  5258. else
  5259. {
  5260. size+= QSize(0,item->minimumSize().height());
  5261. if(size.width()<item->minimumSize().width())
  5262. {
  5263. size.setWidth(item->minimumSize().width());
  5264. }
  5265. }
  5266. }
  5267. size+= QSize(2*margin(),2*margin());
  5268. return size;
  5269. }
  5270. /*:431*//*432:*/
  5271. #line 10285 "./typica.w"
  5272. PackLayout::PackLayout(QWidget*parent,int margin,int spacing):
  5273. QLayout(parent)
  5274. {
  5275. setMargin(margin);
  5276. setSpacing(spacing);
  5277. setOrientation(Qt::Horizontal);
  5278. }
  5279. PackLayout::PackLayout(int spacing)
  5280. {
  5281. setSpacing(spacing);
  5282. setOrientation(Qt::Horizontal);
  5283. }
  5284. /*:432*//*433:*/
  5285. #line 10303 "./typica.w"
  5286. PackLayout::~PackLayout()
  5287. {
  5288. QLayoutItem*item;
  5289. while((item= takeAt(0)))
  5290. {
  5291. delete item;
  5292. }
  5293. }
  5294. /*:433*//*434:*/
  5295. #line 10317 "./typica.w"
  5296. QLayoutItem*PackLayout::takeAt(int index)
  5297. {
  5298. if(index>=0&&index<itemList.size())
  5299. {
  5300. return itemList.takeAt(index);
  5301. }
  5302. else
  5303. {
  5304. return NULL;
  5305. }
  5306. }
  5307. /*:434*//*435:*/
  5308. #line 10333 "./typica.w"
  5309. QLayoutItem*PackLayout::itemAt(int index)const
  5310. {
  5311. if(index>=0&&index<itemList.size())
  5312. {
  5313. return itemList.at(index);
  5314. }
  5315. else
  5316. {
  5317. return NULL;
  5318. }
  5319. }
  5320. /*:435*//*436:*/
  5321. #line 10356 "./typica.w"
  5322. void PackLayout::addItem(QLayoutItem*item)
  5323. {
  5324. itemList.append(item);
  5325. }
  5326. /*:436*//*437:*/
  5327. #line 10364 "./typica.w"
  5328. int PackLayout::count()const
  5329. {
  5330. return itemList.size();
  5331. }
  5332. /*:437*//*438:*/
  5333. #line 10376 "./typica.w"
  5334. Qt::Orientations PackLayout::expandingDirections()const
  5335. {
  5336. return Qt::Vertical|Qt::Horizontal;
  5337. }
  5338. bool PackLayout::hasHeightForWidth()const
  5339. {
  5340. return false;
  5341. }
  5342. int PackLayout::heightForWidth(int width)const
  5343. {
  5344. return doLayout(QRect(0,0,width,0),true);
  5345. }
  5346. void PackLayout::setGeometry(const QRect&rect)
  5347. {
  5348. QLayout::setGeometry(rect);
  5349. doLayout(rect,false);
  5350. }
  5351. QSize PackLayout::sizeHint()const
  5352. {
  5353. return minimumSize();
  5354. }
  5355. /*:438*//*439:*/
  5356. #line 10407 "./typica.w"
  5357. void PackLayout::setOrientation(Qt::Orientations direction)
  5358. {
  5359. orientation= direction;
  5360. doLayout(geometry(),false);
  5361. }
  5362. /*:439*/
  5363. #line 552 "./typica.w"
  5364. /*441:*/
  5365. #line 10446 "./typica.w"
  5366. SceneButton::SceneButton():QGraphicsScene()
  5367. {
  5368. }
  5369. SceneButton::~SceneButton()
  5370. {
  5371. }
  5372. void SceneButton::mousePressEvent(QGraphicsSceneMouseEvent*mouseEvent)
  5373. {
  5374. emit clicked(mouseEvent->buttonDownScreenPos(mouseEvent->button()));
  5375. }
  5376. /*:441*/
  5377. #line 553 "./typica.w"
  5378. /*443:*/
  5379. #line 10492 "./typica.w"
  5380. WidgetDecorator::WidgetDecorator(QWidget*widget,const QString&labeltext,
  5381. Qt::Orientations orientation,
  5382. QWidget*parent,Qt::WindowFlags f):
  5383. QWidget(parent,f),label(new QGraphicsView()),
  5384. scene(new SceneButton())
  5385. {
  5386. layout= new PackLayout(this);
  5387. layout->setOrientation(orientation);
  5388. /*444:*/
  5389. #line 10512 "./typica.w"
  5390. label->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  5391. label->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  5392. label->setFrameShape(QFrame::NoFrame);
  5393. label->setInteractive(true);
  5394. /*:444*/
  5395. #line 10501 "./typica.w"
  5396. /*445:*/
  5397. #line 10523 "./typica.w"
  5398. scene->setBackgroundBrush(Qt::cyan);
  5399. text= scene->addText(labeltext);
  5400. if(orientation==Qt::Horizontal)
  5401. {
  5402. text->rotate(270.0);
  5403. }
  5404. label->setScene(scene);
  5405. /*:445*/
  5406. #line 10502 "./typica.w"
  5407. /*446:*/
  5408. #line 10541 "./typica.w"
  5409. if(orientation==Qt::Horizontal)
  5410. {
  5411. label->setMaximumWidth((int)(text->boundingRect().height()+1));
  5412. }
  5413. else
  5414. {
  5415. label->setMaximumHeight((int)(text->boundingRect().height()+1));
  5416. }
  5417. label->centerOn(text);
  5418. /*:446*/
  5419. #line 10503 "./typica.w"
  5420. /*447:*/
  5421. #line 10556 "./typica.w"
  5422. layout->addWidget(label);
  5423. layout->addWidget(widget);
  5424. if(orientation==Qt::Horizontal)
  5425. {
  5426. setMinimumSize(widget->sizeHint().width()+label->sizeHint().width(),
  5427. widget->sizeHint().height());
  5428. }
  5429. else
  5430. {
  5431. setMinimumSize(widget->sizeHint().width(),
  5432. widget->sizeHint().height()+label->sizeHint().height());
  5433. }
  5434. /*:447*/
  5435. #line 10504 "./typica.w"
  5436. }
  5437. /*:443*//*448:*/
  5438. #line 10573 "./typica.w"
  5439. void WidgetDecorator::setBackgroundBrush(QBrush background)
  5440. {
  5441. scene->setBackgroundBrush(background);
  5442. }
  5443. void WidgetDecorator::setTextColor(QColor color)
  5444. {
  5445. text->setDefaultTextColor(color);
  5446. }
  5447. /*:448*//*449:*/
  5448. #line 10586 "./typica.w"
  5449. WidgetDecorator::~WidgetDecorator()
  5450. {
  5451. }
  5452. /*:449*/
  5453. #line 554 "./typica.w"
  5454. /*454:*/
  5455. #line 10685 "./typica.w"
  5456. void LogEditWindow::addTheRows()
  5457. {
  5458. QTime s= startTime->time();
  5459. while(s<endTime->time())
  5460. {
  5461. model->newMeasurement(Measurement(0,s),1);
  5462. s= s.addSecs(interval->value());
  5463. }
  5464. model->newMeasurement(Measurement(0,endTime->time()),1);
  5465. }
  5466. /*:454*//*455:*/
  5467. #line 10699 "./typica.w"
  5468. LogEditWindow::LogEditWindow():QMainWindow(NULL),
  5469. centralWidget(new QWidget(NULL)),mainLayout(new PackLayout(0)),
  5470. addRowsLayout(new QHBoxLayout(NULL)),
  5471. startTimeLabel(new QLabel("Start Time")),
  5472. startTime(new QTimeEdit(QTime(0,0,0,0))),
  5473. endTimeLabel(new QLabel("End Time")),
  5474. endTime(new QTimeEdit(QTime(0,20,0,0))),
  5475. intervalLabel(new QLabel("Interval (seconds)")),
  5476. interval(new QSpinBox()),
  5477. addRows(new QPushButton("Add Rows")),
  5478. saveXml(new QAction(tr("Save Profile As..."),NULL)),
  5479. saveCsv(new QAction(tr("Export CSV"),NULL)),
  5480. openXml(new QAction(tr("Load Target Profile..."),NULL)),
  5481. model(new MeasurementModel()),
  5482. log(new QTableView())
  5483. {
  5484. /*456:*/
  5485. #line 10736 "./typica.w"
  5486. QSettings settings;
  5487. resize(settings.value("logSize",QSize(620,400)).toSize());
  5488. move(settings.value("logPos",QPoint(200,60)).toPoint());
  5489. /*:456*/
  5490. #line 10716 "./typica.w"
  5491. /*457:*/
  5492. #line 10749 "./typica.w"
  5493. mainLayout->setOrientation(Qt::Vertical);
  5494. addRowsLayout->addSpacing(10);
  5495. addRowsLayout->addWidget(startTimeLabel);
  5496. addRowsLayout->addWidget(startTime);
  5497. addRowsLayout->addSpacing(10);
  5498. startTime->setDisplayFormat("mm:ss");
  5499. addRowsLayout->addWidget(endTimeLabel);
  5500. addRowsLayout->addWidget(endTime);
  5501. addRowsLayout->addSpacing(10);
  5502. endTime->setDisplayFormat("mm:ss");
  5503. addRowsLayout->addWidget(intervalLabel);
  5504. addRowsLayout->addWidget(interval);
  5505. addRowsLayout->addSpacing(10);
  5506. interval->setRange(0,60);
  5507. interval->setValue(30);
  5508. addRowsLayout->addWidget(addRows);
  5509. addRowsLayout->addSpacing(10);
  5510. connect(addRows,SIGNAL(clicked()),this,SLOT(addTheRows()));
  5511. /*:457*/
  5512. #line 10717 "./typica.w"
  5513. /*458:*/
  5514. #line 10772 "./typica.w"
  5515. model->setHeaderData(0,Qt::Horizontal,"Time");
  5516. model->setHeaderData(1,Qt::Horizontal,"Temperature");
  5517. model->setHeaderData(2,Qt::Horizontal,"Annotation");
  5518. model->clear();
  5519. /*:458*/
  5520. #line 10718 "./typica.w"
  5521. /*459:*/
  5522. #line 10781 "./typica.w"
  5523. log->setModel(model);
  5524. log->setColumnWidth(0,100);
  5525. log->setColumnWidth(1,100);
  5526. log->setColumnWidth(2,100);
  5527. /*:459*/
  5528. #line 10719 "./typica.w"
  5529. mainLayout->addItem(addRowsLayout);
  5530. mainLayout->addWidget(log);
  5531. centralWidget->setLayout(mainLayout);
  5532. setCentralWidget(centralWidget);
  5533. QMenu*fileMenu= menuBar()->addMenu(tr("&File"));
  5534. fileMenu->addAction(openXml);
  5535. connect(openXml,SIGNAL(triggered()),this,SLOT(openXML()));
  5536. fileMenu->addAction(saveXml);
  5537. connect(saveXml,SIGNAL(triggered()),this,SLOT(saveXML()));
  5538. fileMenu->addAction(saveCsv);
  5539. connect(saveCsv,SIGNAL(triggered()),this,SLOT(saveCSV()));
  5540. }
  5541. /*:455*//*460:*/
  5542. #line 10792 "./typica.w"
  5543. void LogEditWindow::saveXML()
  5544. {
  5545. QSettings settings;
  5546. QString lastDir= settings.value("lastDirectory").toString();
  5547. QString filename= QFileDialog::getSaveFileName(this,tr("Save Log As..."),
  5548. lastDir,"",0);
  5549. QFile file(filename);
  5550. XMLOutput writer(model,&file,0);
  5551. writer.addTemperatureColumn("Temperature",1);
  5552. writer.addAnnotationColumn("Annotation",2);
  5553. if(writer.output())
  5554. {
  5555. QFileInfo info(filename);
  5556. QDir directory= info.dir();
  5557. lastDir= directory.path();
  5558. settings.setValue("lastDirectory",lastDir);
  5559. }
  5560. }
  5561. void LogEditWindow::saveCSV()
  5562. {
  5563. QSettings settings;
  5564. QString lastDir= settings.value("lastDirectory").toString();
  5565. QString filename= QFileDialog::getSaveFileName(this,tr("Export As..."),
  5566. lastDir,"",0);
  5567. QFile file(filename);
  5568. CSVOutput writer(model,&file,0);
  5569. writer.addTemperatureColumn("Temperature",1);
  5570. writer.addAnnotationColumn("Annotation",2);
  5571. if(writer.output())
  5572. {
  5573. QFileInfo info(filename);
  5574. QDir directory= info.dir();
  5575. lastDir= directory.path();
  5576. settings.setValue("lastDirectory",lastDir);
  5577. }
  5578. }
  5579. /*:460*//*461:*/
  5580. #line 10835 "./typica.w"
  5581. void LogEditWindow::openXML()
  5582. {
  5583. QSettings settings;
  5584. QString lastDir= settings.value("lastDirectory").toString();
  5585. QString filename= QFileDialog::getOpenFileName(this,tr("Open XML Log..."),
  5586. lastDir,"",0);
  5587. if(filename.isNull())
  5588. {
  5589. return;
  5590. }
  5591. QFile file(filename);
  5592. XMLInput reader(&file,1);
  5593. connect(&reader,SIGNAL(measure(Measurement,int)),
  5594. model,SLOT(newMeasurement(Measurement,int)));
  5595. connect(&reader,SIGNAL(annotation(QString,int,int)),
  5596. model,SLOT(newAnnotation(QString,int,int)));
  5597. if(reader.input())
  5598. {
  5599. QFileInfo info(filename);
  5600. setWindowTitle(QString(tr("%1 - %2")).
  5601. arg(QCoreApplication::applicationName()).arg(info.baseName()));
  5602. QDir directory= info.dir();
  5603. lastDir= directory.path();
  5604. settings.setValue("lastDirectory",lastDir);
  5605. }
  5606. }
  5607. /*:461*//*462:*/
  5608. #line 10866 "./typica.w"
  5609. void LogEditWindow::closeEvent(QCloseEvent*event)
  5610. {
  5611. QSettings settings;
  5612. settings.setValue("logSize",size());
  5613. settings.setValue("logPos",pos());
  5614. event->accept();
  5615. }
  5616. /*:462*/
  5617. #line 555 "./typica.w"
  5618. /*468:*/
  5619. #line 10981 "./typica.w"
  5620. bool XMLOutput::output()
  5621. {
  5622. if(!out->open(QIODevice::WriteOnly|QIODevice::Text))
  5623. {
  5624. return false;
  5625. }
  5626. QXmlStreamWriter xmlout(out);
  5627. xmlout.writeStartDocument("1.0");
  5628. xmlout.writeDTD("<!DOCTYPE roastlog3.0>");
  5629. xmlout.writeStartElement("roastlog");
  5630. /*469:*/
  5631. #line 11014 "./typica.w"
  5632. foreach(int c,temperatureColumns.keys())
  5633. {
  5634. xmlout.writeStartElement("tempseries");
  5635. xmlout.writeAttribute("name",temperatureColumns.value(c));
  5636. xmlout.writeEndElement();
  5637. }
  5638. foreach(int c,controlColumns.keys())
  5639. {
  5640. xmlout.writeStartElement("controlseries");
  5641. xmlout.writeAttribute("name",controlColumns.value(c));
  5642. xmlout.writeEndElement();
  5643. }
  5644. foreach(int c,annotationColumns.keys())
  5645. {
  5646. xmlout.writeStartElement("noteseries");
  5647. xmlout.writeAttribute("name",annotationColumns.value(c));
  5648. xmlout.writeEndElement();
  5649. }
  5650. /*:469*/
  5651. #line 10992 "./typica.w"
  5652. xmlout.writeStartElement("roast");
  5653. bool oresult;
  5654. for(int i= 0;i<data->rowCount();i++)
  5655. {
  5656. /*470:*/
  5657. #line 11039 "./typica.w"
  5658. oresult= false;
  5659. foreach(int c,temperatureColumns.keys())
  5660. {
  5661. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5662. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  5663. {
  5664. oresult= true;
  5665. break;
  5666. }
  5667. }
  5668. foreach(int c,controlColumns.keys())
  5669. {
  5670. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5671. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  5672. {
  5673. oresult= true;
  5674. break;
  5675. }
  5676. }
  5677. if(oresult==false)
  5678. {
  5679. foreach(int c,annotationColumns.keys())
  5680. {
  5681. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5682. !(data->data(data->index(i,c),Qt::DisplayRole).toString().
  5683. isEmpty()))
  5684. {
  5685. oresult= true;
  5686. break;
  5687. }
  5688. }
  5689. }
  5690. /*:470*/
  5691. #line 10997 "./typica.w"
  5692. if(oresult)
  5693. {
  5694. /*471:*/
  5695. #line 11078 "./typica.w"
  5696. xmlout.writeStartElement("tuple");
  5697. xmlout.writeTextElement("time",data->data(data->index(i,time),
  5698. Qt::DisplayRole).toString());
  5699. foreach(int c,temperatureColumns.keys())
  5700. {
  5701. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5702. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  5703. {
  5704. xmlout.writeStartElement("temperature");
  5705. xmlout.writeAttribute("series",temperatureColumns.value(c));
  5706. if(data->data(data->index(i,c),Qt::UserRole).toMap().contains("relative"))
  5707. {
  5708. if(data->data(data->index(i,c),Qt::UserRole).toMap().value("relative").toBool())
  5709. {
  5710. xmlout.writeAttribute("relative","true");
  5711. }
  5712. }
  5713. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).
  5714. toString());
  5715. xmlout.writeEndElement();
  5716. }
  5717. }
  5718. foreach(int c,controlColumns.keys())
  5719. {
  5720. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5721. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  5722. {
  5723. xmlout.writeStartElement("control");
  5724. xmlout.writeAttribute("series",controlColumns.value(c));
  5725. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).toString());
  5726. xmlout.writeEndElement();
  5727. }
  5728. }
  5729. foreach(int c,annotationColumns.keys())
  5730. {
  5731. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5732. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  5733. {
  5734. xmlout.writeStartElement("annotation");
  5735. xmlout.writeAttribute("series",annotationColumns.value(c));
  5736. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).
  5737. toString());
  5738. xmlout.writeEndElement();
  5739. }
  5740. }
  5741. xmlout.writeEndElement();
  5742. /*:471*/
  5743. #line 11000 "./typica.w"
  5744. }
  5745. }
  5746. xmlout.writeEndElement();
  5747. xmlout.writeEndElement();
  5748. xmlout.writeEndDocument();
  5749. out->close();
  5750. return true;
  5751. }
  5752. /*:468*//*472:*/
  5753. #line 11128 "./typica.w"
  5754. XMLOutput::XMLOutput(MeasurementModel*model,QIODevice*device,int timec)
  5755. :QObject(NULL),data(model),out(device),time(timec)
  5756. {
  5757. }
  5758. void XMLOutput::setModel(MeasurementModel*model)
  5759. {
  5760. data= model;
  5761. }
  5762. void XMLOutput::setTimeColumn(int column)
  5763. {
  5764. time= column;
  5765. }
  5766. void XMLOutput::setDevice(QIODevice*device)
  5767. {
  5768. out= device;
  5769. }
  5770. /*:472*//*473:*/
  5771. #line 11157 "./typica.w"
  5772. void XMLOutput::addTemperatureColumn(const QString&series,int column)
  5773. {
  5774. temperatureColumns.insert(column,series);
  5775. }
  5776. void XMLOutput::addControlColumn(const QString&series,int column)
  5777. {
  5778. controlColumns.insert(column,series);
  5779. }
  5780. void XMLOutput::addAnnotationColumn(const QString&series,int column)
  5781. {
  5782. annotationColumns.insert(column,series);
  5783. }
  5784. /*:473*/
  5785. #line 556 "./typica.w"
  5786. /*475:*/
  5787. #line 11214 "./typica.w"
  5788. bool XMLInput::input()
  5789. {
  5790. if(!in->open(QIODevice::ReadOnly|QIODevice::Text))
  5791. {
  5792. return false;
  5793. }
  5794. QXmlStreamReader xmlin(in);
  5795. QMap<QString,int> temperatureColumns;
  5796. QMap<QString,int> annotationColumns;
  5797. int nextColumn= firstc;
  5798. /*476:*/
  5799. #line 11245 "./typica.w"
  5800. while(!xmlin.isDTD())
  5801. {
  5802. xmlin.readNext();
  5803. }
  5804. if(xmlin.isDTD())
  5805. {
  5806. if(xmlin.text()=="<!DOCTYPE roastlog>")
  5807. {
  5808. /*477:*/
  5809. #line 11267 "./typica.w"
  5810. emit newTemperatureColumn(firstc,"Bean");
  5811. emit newAnnotationColumn(firstc+1,"Note");
  5812. emit lastColumn(firstc+1);
  5813. /*:477*/
  5814. #line 11254 "./typica.w"
  5815. }
  5816. else
  5817. {
  5818. xmlin.readNext();
  5819. /*478:*/
  5820. #line 11276 "./typica.w"
  5821. while(xmlin.name()!="roast")
  5822. {
  5823. if(xmlin.isStartElement())
  5824. {
  5825. if((xmlin.name()=="tempseries")||(xmlin.name()=="controlseries"))
  5826. {
  5827. temperatureColumns.insert(xmlin.attributes().value("name").
  5828. toString(),
  5829. nextColumn);
  5830. emit newTemperatureColumn(nextColumn,
  5831. xmlin.attributes().value("name").
  5832. toString());
  5833. nextColumn++;
  5834. }
  5835. else if(xmlin.name()=="noteseries")
  5836. {
  5837. annotationColumns.insert(xmlin.attributes().value("name").
  5838. toString(),nextColumn);
  5839. emit newAnnotationColumn(nextColumn,
  5840. xmlin.attributes().value("name").
  5841. toString());
  5842. nextColumn++;
  5843. }
  5844. }
  5845. xmlin.readNext();
  5846. }
  5847. emit lastColumn(nextColumn-1);
  5848. /*:478*/
  5849. #line 11259 "./typica.w"
  5850. }
  5851. }
  5852. /*:476*/
  5853. #line 11225 "./typica.w"
  5854. QTime timeval= QTime();
  5855. double tempval= 0;
  5856. QString noteval= QString();
  5857. int column;
  5858. int counter= 0;
  5859. while(!xmlin.atEnd())
  5860. {
  5861. /*479:*/
  5862. #line 11317 "./typica.w"
  5863. xmlin.readNext();
  5864. if(xmlin.isStartElement())
  5865. {
  5866. /*480:*/
  5867. #line 11343 "./typica.w"
  5868. if(xmlin.name()=="time")
  5869. {
  5870. timeval= QTime::fromString(xmlin.readElementText(),"mm:ss.zzz");
  5871. }
  5872. else if(xmlin.name()=="temperature")
  5873. {
  5874. column= xmlin.attributes().value("series").toString().isEmpty()?
  5875. firstc:temperatureColumns.value(xmlin.attributes().
  5876. value("series").toString());
  5877. bool relative= (xmlin.attributes().value("relative")=="true");
  5878. tempval= xmlin.readElementText().toDouble();
  5879. Measurement measurement(tempval,timeval);
  5880. if(relative)
  5881. {
  5882. measurement.insert("relative",true);
  5883. }
  5884. emit measure(measurement,column);
  5885. }
  5886. else if(xmlin.name()=="control")
  5887. {
  5888. column= xmlin.attributes().value("series").toString().isEmpty()?
  5889. firstc:temperatureColumns.value(xmlin.attributes().
  5890. value("series").toString());
  5891. tempval= xmlin.readElementText().toDouble();
  5892. Measurement measurement(tempval,timeval,Units::Unitless);
  5893. emit measure(measurement,column);
  5894. }
  5895. else if(xmlin.name()=="annotation")
  5896. {
  5897. column= xmlin.attributes().value("series").toString().isEmpty()?
  5898. firstc+1:annotationColumns.value(xmlin.attributes().
  5899. value("series").toString());
  5900. noteval= xmlin.readElementText();
  5901. if(!noteval.isEmpty())
  5902. {
  5903. emit annotation(noteval,firstc,column);
  5904. }
  5905. }
  5906. /*:480*/
  5907. #line 11321 "./typica.w"
  5908. }
  5909. counter++;
  5910. if(counter%100==0)
  5911. {
  5912. QCoreApplication::processEvents();
  5913. }
  5914. /*:479*/
  5915. #line 11233 "./typica.w"
  5916. }
  5917. return true;
  5918. }
  5919. /*:475*//*481:*/
  5920. #line 11385 "./typica.w"
  5921. XMLInput::XMLInput(QIODevice*input,int c):
  5922. firstc(c),in(input)
  5923. {
  5924. }
  5925. void XMLInput::setFirstColumn(int column)
  5926. {
  5927. firstc= column;
  5928. }
  5929. void XMLInput::setDevice(QIODevice*device)
  5930. {
  5931. in= device;
  5932. }
  5933. /*:481*/
  5934. #line 557 "./typica.w"
  5935. /*486:*/
  5936. #line 11476 "./typica.w"
  5937. bool CSVOutput::output()
  5938. {
  5939. if(!out->open(QIODevice::WriteOnly|QIODevice::Text))
  5940. {
  5941. return false;
  5942. }
  5943. QTextStream output(out);
  5944. /*487:*/
  5945. #line 11500 "./typica.w"
  5946. output<<"Time";
  5947. foreach(int c,temperatureColumns.keys())
  5948. {
  5949. output<<','<<temperatureColumns.value(c);
  5950. }
  5951. foreach(int c,controlColumns.keys())
  5952. {
  5953. output<<','<<controlColumns.value(c);
  5954. }
  5955. foreach(int c,annotationColumns.keys())
  5956. {
  5957. output<<','<<annotationColumns.value(c);
  5958. }
  5959. output<<'\n';
  5960. /*:487*/
  5961. #line 11484 "./typica.w"
  5962. bool oresult;
  5963. for(int i= 0;i<data->rowCount();i++)
  5964. {
  5965. /*470:*/
  5966. #line 11039 "./typica.w"
  5967. oresult= false;
  5968. foreach(int c,temperatureColumns.keys())
  5969. {
  5970. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5971. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  5972. {
  5973. oresult= true;
  5974. break;
  5975. }
  5976. }
  5977. foreach(int c,controlColumns.keys())
  5978. {
  5979. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5980. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  5981. {
  5982. oresult= true;
  5983. break;
  5984. }
  5985. }
  5986. if(oresult==false)
  5987. {
  5988. foreach(int c,annotationColumns.keys())
  5989. {
  5990. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5991. !(data->data(data->index(i,c),Qt::DisplayRole).toString().
  5992. isEmpty()))
  5993. {
  5994. oresult= true;
  5995. break;
  5996. }
  5997. }
  5998. }
  5999. /*:470*/
  6000. #line 11488 "./typica.w"
  6001. if(oresult)
  6002. {
  6003. /*488:*/
  6004. #line 11525 "./typica.w"
  6005. output<<data->data(data->index(i,time),Qt::DisplayRole).toString();
  6006. foreach(int c,temperatureColumns.keys())
  6007. {
  6008. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  6009. }
  6010. foreach(int c,controlColumns.keys())
  6011. {
  6012. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  6013. }
  6014. foreach(int c,annotationColumns.keys())
  6015. {
  6016. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  6017. }
  6018. output<<'\n';
  6019. /*:488*/
  6020. #line 11491 "./typica.w"
  6021. }
  6022. }
  6023. out->close();
  6024. return true;
  6025. }
  6026. /*:486*//*489:*/
  6027. #line 11544 "./typica.w"
  6028. CSVOutput::CSVOutput(MeasurementModel*model,QIODevice*device,int timec):
  6029. data(model),out(device),time(timec)
  6030. {
  6031. }
  6032. void CSVOutput::setModel(MeasurementModel*model)
  6033. {
  6034. data= model;
  6035. }
  6036. void CSVOutput::setTimeColumn(int column)
  6037. {
  6038. time= column;
  6039. }
  6040. void CSVOutput::addTemperatureColumn(const QString&series,int column)
  6041. {
  6042. temperatureColumns.insert(column,series);
  6043. }
  6044. void CSVOutput::addControlColumn(const QString&series,int column)
  6045. {
  6046. controlColumns.insert(column,series);
  6047. }
  6048. void CSVOutput::addAnnotationColumn(const QString&series,int column)
  6049. {
  6050. annotationColumns.insert(column,series);
  6051. }
  6052. void CSVOutput::setDevice(QIODevice*device)
  6053. {
  6054. out= device;
  6055. }
  6056. #line 1 "./webview.w"
  6057. /*:489*/
  6058. #line 558 "./typica.w"
  6059. /*524:*/
  6060. #line 11805 "./typica.w"
  6061. QString SaltModel::arrayLiteral(int column,int role)const
  6062. {
  6063. QString literal= "'{";
  6064. for(int i= 0;i<rowCount();i++)
  6065. {
  6066. QString datum= data(index(i,column),role).toString();
  6067. if(!datum.isEmpty())
  6068. {
  6069. literal.append(datum);
  6070. literal.append(", ");
  6071. }
  6072. }
  6073. if(literal.size()> 2)
  6074. {
  6075. literal.chop(2);
  6076. }
  6077. literal.append("}'");
  6078. return literal;
  6079. }
  6080. QString SaltModel::quotedArrayLiteral(int column,int role)const
  6081. {
  6082. QString literal= "'{";
  6083. for(int i= 0;i<rowCount();i++)
  6084. {
  6085. QString datum= data(index(i,column),role).toString();
  6086. if(!datum.isEmpty())
  6087. {
  6088. literal.append("\"");
  6089. literal.append(datum);
  6090. literal.append("\", ");
  6091. }
  6092. }
  6093. if(literal.size()> 2)
  6094. {
  6095. literal.chop(2);
  6096. }
  6097. literal.append("}'");
  6098. return literal;
  6099. }
  6100. /*:524*//*525:*/
  6101. #line 11849 "./typica.w"
  6102. QModelIndex SaltModel::parent(const QModelIndex&)const
  6103. {
  6104. return QModelIndex();
  6105. }
  6106. /*:525*//*526:*/
  6107. #line 11868 "./typica.w"
  6108. bool SaltModel::setData(const QModelIndex&index,const QVariant&value,
  6109. int role)
  6110. {
  6111. /*527:*/
  6112. #line 11899 "./typica.w"
  6113. bool valid= false;
  6114. if(index.isValid())
  6115. {
  6116. if(index.row()<modelData.size())
  6117. {
  6118. if(index.column()<colcount)
  6119. {
  6120. valid= true;
  6121. }
  6122. }
  6123. }
  6124. /*:527*/
  6125. #line 11872 "./typica.w"
  6126. if(!valid)
  6127. {
  6128. return false;
  6129. }
  6130. if(index.row()==modelData.size()-1)
  6131. {
  6132. beginInsertRows(QModelIndex(),modelData.size(),modelData.size());
  6133. /*528:*/
  6134. #line 11915 "./typica.w"
  6135. QList<QMap<int,QVariant> > newRow;
  6136. QMap<int,QVariant> defaults;
  6137. for(int i= 0;i<colcount;i++)
  6138. {
  6139. newRow.append(defaults);
  6140. }
  6141. modelData.append(newRow);
  6142. /*:528*/
  6143. #line 11880 "./typica.w"
  6144. endInsertRows();
  6145. }
  6146. QList<QMap<int,QVariant> > row= modelData.at(index.row());
  6147. QMap<int,QVariant> cell= row.at(index.column());
  6148. cell.insert(role,value);
  6149. if(role==Qt::EditRole)
  6150. {
  6151. cell.insert(Qt::DisplayRole,value);
  6152. }
  6153. row.replace(index.column(),cell);
  6154. modelData.replace(index.row(),row);
  6155. emit dataChanged(index,index);
  6156. return true;
  6157. }
  6158. /*:526*//*529:*/
  6159. #line 11926 "./typica.w"
  6160. SaltModel::SaltModel(int columns):QAbstractItemModel(),colcount(columns)
  6161. {
  6162. for(int i= 0;i<columns;i++)
  6163. {
  6164. hData<<"";
  6165. }
  6166. /*528:*/
  6167. #line 11915 "./typica.w"
  6168. QList<QMap<int,QVariant> > newRow;
  6169. QMap<int,QVariant> defaults;
  6170. for(int i= 0;i<colcount;i++)
  6171. {
  6172. newRow.append(defaults);
  6173. }
  6174. modelData.append(newRow);
  6175. /*:528*/
  6176. #line 11933 "./typica.w"
  6177. }
  6178. /*:529*//*530:*/
  6179. #line 11938 "./typica.w"
  6180. SaltModel::~SaltModel()
  6181. {
  6182. }
  6183. /*:530*//*531:*/
  6184. #line 11948 "./typica.w"
  6185. int SaltModel::rowCount(const QModelIndex&parent)const
  6186. {
  6187. return(parent==QModelIndex()?modelData.size():0);
  6188. }
  6189. int SaltModel::columnCount(const QModelIndex&parent)const
  6190. {
  6191. return(parent==QModelIndex()?colcount:0);
  6192. }
  6193. /*:531*//*532:*/
  6194. #line 11961 "./typica.w"
  6195. bool SaltModel::setHeaderData(int section,Qt::Orientation orientation,
  6196. const QVariant&value,int)
  6197. {
  6198. if(orientation==Qt::Horizontal&&section<colcount)
  6199. {
  6200. hData.replace(section,value.toString());
  6201. emit headerDataChanged(orientation,section,section);
  6202. return true;
  6203. }
  6204. return false;
  6205. }
  6206. /*:532*//*533:*/
  6207. #line 11976 "./typica.w"
  6208. QVariant SaltModel::data(const QModelIndex&index,int role)const
  6209. {
  6210. /*527:*/
  6211. #line 11899 "./typica.w"
  6212. bool valid= false;
  6213. if(index.isValid())
  6214. {
  6215. if(index.row()<modelData.size())
  6216. {
  6217. if(index.column()<colcount)
  6218. {
  6219. valid= true;
  6220. }
  6221. }
  6222. }
  6223. /*:527*/
  6224. #line 11979 "./typica.w"
  6225. if(!valid)
  6226. {
  6227. return QVariant();
  6228. }
  6229. QList<QMap<int,QVariant> > row= modelData.at(index.row());
  6230. QMap<int,QVariant> cell= row.at(index.column());
  6231. return cell.value(role,QVariant());
  6232. }
  6233. QVariant SaltModel::headerData(int section,Qt::Orientation orientation,
  6234. int role)const
  6235. {
  6236. if(orientation==Qt::Horizontal&&role==Qt::DisplayRole&&
  6237. section<colcount)
  6238. {
  6239. return QVariant(hData.at(section));
  6240. }
  6241. return QVariant();
  6242. }
  6243. /*:533*//*534:*/
  6244. #line 12003 "./typica.w"
  6245. Qt::ItemFlags SaltModel::flags(const QModelIndex&index)const
  6246. {
  6247. /*527:*/
  6248. #line 11899 "./typica.w"
  6249. bool valid= false;
  6250. if(index.isValid())
  6251. {
  6252. if(index.row()<modelData.size())
  6253. {
  6254. if(index.column()<colcount)
  6255. {
  6256. valid= true;
  6257. }
  6258. }
  6259. }
  6260. /*:527*/
  6261. #line 12006 "./typica.w"
  6262. if(valid)
  6263. {
  6264. return Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable|Qt::ItemIsDropEnabled;
  6265. }
  6266. return 0;
  6267. }
  6268. /*:534*//*535:*/
  6269. #line 12017 "./typica.w"
  6270. QModelIndex SaltModel::index(int row,int column,
  6271. const QModelIndex&parent)const
  6272. {
  6273. if(parent==QModelIndex())
  6274. {
  6275. if(row<modelData.size()&&column<colcount)
  6276. {
  6277. return createIndex(row,column);
  6278. }
  6279. }
  6280. return QModelIndex();
  6281. }
  6282. /*:535*//*536:*/
  6283. #line 12035 "./typica.w"
  6284. void SaltModel::clear()
  6285. {
  6286. beginResetModel();
  6287. modelData.clear();
  6288. /*528:*/
  6289. #line 11915 "./typica.w"
  6290. QList<QMap<int,QVariant> > newRow;
  6291. QMap<int,QVariant> defaults;
  6292. for(int i= 0;i<colcount;i++)
  6293. {
  6294. newRow.append(defaults);
  6295. }
  6296. modelData.append(newRow);
  6297. /*:528*/
  6298. #line 12040 "./typica.w"
  6299. endResetModel();
  6300. }
  6301. /*:536*//*537:*/
  6302. #line 12049 "./typica.w"
  6303. bool SaltModel::removeRows(int row,int count,
  6304. const QModelIndex&parent)
  6305. {
  6306. if(parent==QModelIndex())
  6307. {
  6308. if(row>=0&&count> 0&&(row+count-1)<modelData.size())
  6309. {
  6310. beginRemoveRows(parent,row,row+count-1);
  6311. for(int i= 0;i<count;i++)
  6312. {
  6313. modelData.removeAt(row);
  6314. }
  6315. endRemoveRows();
  6316. if(modelData.size()==0)
  6317. {
  6318. beginInsertRows(parent,0,0);
  6319. /*528:*/
  6320. #line 11915 "./typica.w"
  6321. QList<QMap<int,QVariant> > newRow;
  6322. QMap<int,QVariant> defaults;
  6323. for(int i= 0;i<colcount;i++)
  6324. {
  6325. newRow.append(defaults);
  6326. }
  6327. modelData.append(newRow);
  6328. /*:528*/
  6329. #line 12066 "./typica.w"
  6330. endInsertRows();
  6331. }
  6332. return true;
  6333. }
  6334. }
  6335. return false;
  6336. }
  6337. /*:537*//*538:*/
  6338. #line 12080 "./typica.w"
  6339. int SaltModel::findData(const QVariant&value,int column,int role)
  6340. {
  6341. for(int i= 0;i<modelData.size();i++)
  6342. {
  6343. if(modelData.at(i).size()> column)
  6344. {
  6345. if(modelData.at(i).at(column).contains(role))
  6346. {
  6347. if(modelData.at(i).at(column).value(role)==value)
  6348. {
  6349. return i;
  6350. }
  6351. }
  6352. }
  6353. }
  6354. return-1;
  6355. }
  6356. /*:538*/
  6357. #line 559 "./typica.w"
  6358. /*540:*/
  6359. #line 12144 "./typica.w"
  6360. SqlComboBox*SqlComboBox::clone(QWidget*parent)
  6361. {
  6362. SqlComboBox*widget= new SqlComboBox();
  6363. widget->setParent(parent);
  6364. for(int i= 0;i<count();i++)
  6365. {
  6366. widget->addItem(itemText(i),itemData(i));
  6367. }
  6368. return widget;
  6369. }
  6370. /*:540*//*541:*/
  6371. #line 12161 "./typica.w"
  6372. void SqlComboBox::showData(bool show)
  6373. {
  6374. dataColumnShown= show;
  6375. }
  6376. /*:541*//*542:*/
  6377. #line 12175 "./typica.w"
  6378. void SqlComboBox::addNullOption()
  6379. {
  6380. addItem(specialNullText,specialNullData);
  6381. }
  6382. void SqlComboBox::setNullText(QString nullText)
  6383. {
  6384. specialNullText= nullText;
  6385. }
  6386. void SqlComboBox::setNullData(QVariant nullData)
  6387. {
  6388. specialNullData= nullData;
  6389. }
  6390. /*:542*//*543:*/
  6391. #line 12198 "./typica.w"
  6392. void SqlComboBox::setDataColumn(int column)
  6393. {
  6394. dataColumn= column;
  6395. }
  6396. void SqlComboBox::setDisplayColumn(int column)
  6397. {
  6398. displayColumn= column;
  6399. }
  6400. /*:543*//*544:*/
  6401. #line 12212 "./typica.w"
  6402. void SqlComboBox::addSqlOptions(QString query)
  6403. {
  6404. SqlQueryConnection h;
  6405. QSqlQuery*dbquery= h.operator->();
  6406. if(!dbquery->exec(query))
  6407. {
  6408. QSqlError error= dbquery->lastError();
  6409. qDebug()<<error.databaseText();
  6410. qDebug()<<error.driverText();
  6411. qDebug()<<error.text();
  6412. qDebug()<<dbquery->lastQuery();
  6413. }
  6414. while(dbquery->next())
  6415. {
  6416. QString displayValue(dbquery->value(displayColumn).toString());
  6417. QString dataValue(dbquery->value(dataColumn).toString());
  6418. if(dataColumnShown)
  6419. {
  6420. displayValue.append(QString(" (%1)").arg(dataValue));
  6421. }
  6422. addItem(displayValue,dataValue);
  6423. }
  6424. }
  6425. /*:544*//*545:*/
  6426. #line 12248 "./typica.w"
  6427. SqlComboBox::SqlComboBox():
  6428. dataColumn(0),displayColumn(0),dataColumnShown(false),
  6429. specialNullText(tr("Unknown")),specialNullData(QVariant::String)
  6430. {
  6431. view()->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
  6432. }
  6433. SqlComboBox::~SqlComboBox()
  6434. {
  6435. }
  6436. /*:545*/
  6437. #line 560 "./typica.w"
  6438. /*547:*/
  6439. #line 12287 "./typica.w"
  6440. void SqlComboBoxDelegate::setWidget(SqlComboBox*widget)
  6441. {
  6442. delegate= widget;
  6443. }
  6444. /*:547*//*548:*/
  6445. #line 12296 "./typica.w"
  6446. QWidget*SqlComboBoxDelegate::createEditor(QWidget*parent,
  6447. const QStyleOptionViewItem&,
  6448. const QModelIndex&)const
  6449. {
  6450. return delegate->clone(parent);
  6451. }
  6452. /*:548*//*549:*/
  6453. #line 12307 "./typica.w"
  6454. void SqlComboBoxDelegate::setEditorData(QWidget*editor,
  6455. const QModelIndex&index)const
  6456. {
  6457. SqlComboBox*self= qobject_cast<SqlComboBox*> (editor);
  6458. self->setCurrentIndex(self->findData(
  6459. index.model()->data(index,
  6460. Qt::UserRole).toString()));
  6461. }
  6462. /*:549*//*550:*/
  6463. #line 12320 "./typica.w"
  6464. void SqlComboBoxDelegate::setModelData(QWidget*editor,
  6465. QAbstractItemModel*model,
  6466. const QModelIndex&index)const
  6467. {
  6468. SqlComboBox*self= qobject_cast<SqlComboBox*> (editor);
  6469. model->setData(index,self->itemData(self->currentIndex(),Qt::UserRole),
  6470. Qt::UserRole);
  6471. model->setData(index,self->currentText(),Qt::DisplayRole);
  6472. }
  6473. /*:550*//*551:*/
  6474. #line 12333 "./typica.w"
  6475. void SqlComboBoxDelegate::updateEditorGeometry(QWidget*editor,
  6476. const QStyleOptionViewItem&option,
  6477. const QModelIndex&)const
  6478. {
  6479. editor->setGeometry(option.rect);
  6480. }
  6481. /*:551*//*552:*/
  6482. #line 12344 "./typica.w"
  6483. QSize SqlComboBoxDelegate::sizeHint()const
  6484. {
  6485. return delegate->sizeHint();
  6486. }
  6487. /*:552*//*553:*/
  6488. #line 12352 "./typica.w"
  6489. SqlComboBoxDelegate::SqlComboBoxDelegate(QObject*parent)
  6490. :QItemDelegate(parent)
  6491. {
  6492. }
  6493. /*:553*/
  6494. #line 561 "./typica.w"
  6495. /*516:*/
  6496. #line 11614 "./typica.w"
  6497. Application::Application(int&argc,char**argv):QApplication(argc,argv)
  6498. {
  6499. /*517:*/
  6500. #line 11629 "./typica.w"
  6501. setOrganizationName("Wilson's Coffee & Tea");
  6502. setOrganizationDomain("wilsonscoffee.com");
  6503. setApplicationName(PROGRAM_NAME);
  6504. /*:517*/
  6505. #line 11617 "./typica.w"
  6506. /*518:*/
  6507. #line 11638 "./typica.w"
  6508. QTranslator base;
  6509. if(base.load(QString("qt_%1").arg(QLocale::system().name())))
  6510. {
  6511. installTranslator(&base);
  6512. }
  6513. QTranslator app;
  6514. if(app.load(QString("%1_%2").arg("Typica").arg(QLocale::system().name())))
  6515. {
  6516. installTranslator(&app);
  6517. }
  6518. /*:518*/
  6519. #line 11618 "./typica.w"
  6520. /*242:*/
  6521. #line 123 "./measurement.w"
  6522. qRegisterMetaType<Measurement> ("Measurement");
  6523. #line 5657 "./typica.w"
  6524. /*:242*/
  6525. #line 11619 "./typica.w"
  6526. /*700:*/
  6527. #line 15524 "./typica.w"
  6528. NodeInserter*inserter= new NodeInserter(tr("NI DAQmx Base Device"),
  6529. tr("NI DAQmx Base"),
  6530. "nidaqmxbase",NULL);
  6531. topLevelNodeInserters.append(inserter);
  6532. /*:700*//*708:*/
  6533. #line 15755 "./typica.w"
  6534. #ifdef Q_OS_WIN32
  6535. inserter= new NodeInserter(tr("NI DAQmx Device"),tr("NI DAQmx"),"nidaqmx",NULL);
  6536. topLevelNodeInserters.append(inserter);
  6537. #endif
  6538. /*:708*//*732:*/
  6539. #line 16718 "./typica.w"
  6540. #if 0
  6541. inserter= new NodeInserter(tr("Modbus RTU Port"),tr("Modbus RTU Port"),"modbusrtuport",NULL);
  6542. topLevelNodeInserters.append(inserter);
  6543. #endif
  6544. /*:732*//*776:*/
  6545. #line 18200 "./typica.w"
  6546. inserter= new NodeInserter(tr("Modbus RTU Device"),tr("Modbus RTU Device"),"modbusrtu",NULL);
  6547. topLevelNodeInserters.append(inserter);
  6548. /*:776*//*840:*/
  6549. #line 1241 "./dataqsdk.w"
  6550. #ifdef Q_OS_WIN32
  6551. inserter= new NodeInserter(tr("DATAQ SDK Device"),tr("DATAQ Device"),
  6552. "dataqsdk",NULL);
  6553. topLevelNodeInserters.append(inserter);
  6554. #endif
  6555. #line 18420 "./typica.w"
  6556. #line 1 "./scales.w"
  6557. /*:840*//*865:*/
  6558. #line 495 "./scales.w"
  6559. inserter= new NodeInserter(tr("Serial Scale"),tr("Scale"),"scale",NULL);
  6560. topLevelNodeInserters.append(inserter);
  6561. #line 18422 "./typica.w"
  6562. #line 1 "./valueannotation.w"
  6563. /*:865*/
  6564. #line 11620 "./typica.w"
  6565. }
  6566. /*:516*//*520:*/
  6567. #line 11661 "./typica.w"
  6568. QDomDocument*Application::configuration()
  6569. {
  6570. return&conf;
  6571. }
  6572. /*:520*//*521:*/
  6573. #line 11670 "./typica.w"
  6574. QSqlDatabase Application::database()
  6575. {
  6576. QString connectionName;
  6577. QSqlDatabase connection=
  6578. QSqlDatabase::database(QLatin1String(QSqlDatabase::defaultConnection),false);
  6579. do
  6580. {
  6581. connectionName= QUuid::createUuid().toString();
  6582. }while(QSqlDatabase::connectionNames().contains(connectionName));
  6583. return QSqlDatabase::cloneDatabase(connection,QString(connectionName));
  6584. }
  6585. /*:521*//*635:*/
  6586. #line 14128 "./typica.w"
  6587. void Application::saveDeviceConfiguration()
  6588. {
  6589. QSettings settings;
  6590. settings.setValue("DeviceConfiguration",
  6591. QVariant(deviceConfigurationDocument.toByteArray()));
  6592. }
  6593. /*:635*//*636:*/
  6594. #line 14140 "./typica.w"
  6595. QDomDocument Application::deviceConfiguration()
  6596. {
  6597. if(deviceConfigurationDocument.isNull())
  6598. {
  6599. /*637:*/
  6600. #line 14154 "./typica.w"
  6601. QSettings settings;
  6602. QByteArray document= settings.value("DeviceConfiguration").toByteArray();
  6603. QString etext;
  6604. int eline;
  6605. int ecol;
  6606. if(document.length()==0)
  6607. {
  6608. qDebug()<<"Loaded settings length is 0. Creating new configuration.";
  6609. /*638:*/
  6610. #line 14178 "./typica.w"
  6611. QFile emptyDocument(":/resources/xml/EmptyDeviceConfiguration.xml");
  6612. emptyDocument.open(QIODevice::ReadOnly);
  6613. if(!deviceConfigurationDocument.setContent(&emptyDocument,false,
  6614. &etext,&eline,&ecol))
  6615. {
  6616. /*639:*/
  6617. #line 14195 "./typica.w"
  6618. qDebug()<<QString(tr("An error occurred loading device configuration."));
  6619. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  6620. qDebug()<<etext;
  6621. /*:639*/
  6622. #line 14184 "./typica.w"
  6623. }
  6624. else
  6625. {
  6626. saveDeviceConfiguration();
  6627. }
  6628. /*:638*/
  6629. #line 14163 "./typica.w"
  6630. }
  6631. else
  6632. {
  6633. if(!deviceConfigurationDocument.setContent(document,false,
  6634. &etext,&eline,&ecol))
  6635. {
  6636. /*639:*/
  6637. #line 14195 "./typica.w"
  6638. qDebug()<<QString(tr("An error occurred loading device configuration."));
  6639. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  6640. qDebug()<<etext;
  6641. /*:639*/
  6642. #line 14170 "./typica.w"
  6643. /*638:*/
  6644. #line 14178 "./typica.w"
  6645. QFile emptyDocument(":/resources/xml/EmptyDeviceConfiguration.xml");
  6646. emptyDocument.open(QIODevice::ReadOnly);
  6647. if(!deviceConfigurationDocument.setContent(&emptyDocument,false,
  6648. &etext,&eline,&ecol))
  6649. {
  6650. /*639:*/
  6651. #line 14195 "./typica.w"
  6652. qDebug()<<QString(tr("An error occurred loading device configuration."));
  6653. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  6654. qDebug()<<etext;
  6655. /*:639*/
  6656. #line 14184 "./typica.w"
  6657. }
  6658. else
  6659. {
  6660. saveDeviceConfiguration();
  6661. }
  6662. /*:638*/
  6663. #line 14171 "./typica.w"
  6664. }
  6665. }
  6666. /*:637*/
  6667. #line 14145 "./typica.w"
  6668. }
  6669. return deviceConfigurationDocument;
  6670. }
  6671. /*:636*//*667:*/
  6672. #line 14796 "./typica.w"
  6673. void Application::registerDeviceConfigurationWidget(QString driver,
  6674. QMetaObject widget)
  6675. {
  6676. deviceConfigurationWidgets.insert(driver,widget);
  6677. }
  6678. /*:667*//*668:*/
  6679. #line 14812 "./typica.w"
  6680. QWidget*Application::deviceConfigurationWidget(DeviceTreeModel*model,
  6681. const QModelIndex&index)
  6682. {
  6683. QVariant nodeReference= index.data(Qt::UserRole);
  6684. QDomElement referenceElement= model->referenceElement(
  6685. model->data(index,Qt::UserRole).toString());
  6686. QMetaObject metaObject=
  6687. deviceConfigurationWidgets.value(referenceElement.attribute("driver"),
  6688. QWidget::staticMetaObject);
  6689. QWidget*editor;
  6690. if(metaObject.className()==QWidget::staticMetaObject.className())
  6691. {
  6692. editor= NULL;
  6693. }
  6694. else
  6695. {
  6696. editor= qobject_cast<QWidget*> (
  6697. metaObject.newInstance(Q_ARG(DeviceTreeModel*,model),
  6698. Q_ARG(QModelIndex,index)));
  6699. }
  6700. return editor;
  6701. }
  6702. /*:668*/
  6703. #line 562 "./typica.w"
  6704. /*559:*/
  6705. #line 12473 "./typica.w"
  6706. SqlConnectionSetup::SqlConnectionSetup():
  6707. formLayout(new QFormLayout),driver(new QComboBox),hostname(new QLineEdit),
  6708. dbname(new QLineEdit),user(new QLineEdit),password(new QLineEdit),
  6709. layout(new QVBoxLayout),buttons(new QHBoxLayout),
  6710. cancelButton(new QPushButton(tr("Cancel"))),
  6711. connectButton(new QPushButton(tr("Connect")))
  6712. {
  6713. driver->addItem("PostgreSQL","QPSQL");
  6714. formLayout->addRow(tr("Database driver:"),driver);
  6715. formLayout->addRow(tr("Host name:"),hostname);
  6716. formLayout->addRow(tr("Database name:"),dbname);
  6717. formLayout->addRow(tr("User name:"),user);
  6718. password->setEchoMode(QLineEdit::Password);
  6719. formLayout->addRow(tr("Password:"),password);
  6720. layout->addLayout(formLayout);
  6721. buttons->addStretch(1);
  6722. buttons->addWidget(cancelButton);
  6723. connect(cancelButton,SIGNAL(clicked(bool)),this,SLOT(reject()));
  6724. buttons->addWidget(connectButton);
  6725. layout->addLayout(buttons);
  6726. connect(connectButton,SIGNAL(clicked(bool)),this,SLOT(testConnection()));
  6727. setLayout(layout);
  6728. setModal(true);
  6729. }
  6730. SqlConnectionSetup::~SqlConnectionSetup()
  6731. {
  6732. }
  6733. /*:559*//*560:*/
  6734. #line 12507 "./typica.w"
  6735. void SqlConnectionSetup::testConnection()
  6736. {
  6737. QSqlDatabase database=
  6738. QSqlDatabase::addDatabase(driver->itemData(driver->currentIndex()).
  6739. toString());
  6740. database.setConnectOptions("application_name=Typica");
  6741. database.setHostName(hostname->text());
  6742. database.setDatabaseName(dbname->text());
  6743. database.setUserName(user->text());
  6744. database.setPassword(password->text());
  6745. if(database.open())
  6746. {
  6747. QSettings settings;
  6748. settings.setValue("database/exists","true");
  6749. settings.setValue("database/driver",
  6750. driver->itemData(driver->currentIndex()).toString());
  6751. settings.setValue("database/hostname",hostname->text());
  6752. settings.setValue("database/dbname",dbname->text());
  6753. settings.setValue("database/user",user->text());
  6754. settings.setValue("database/password",password->text());
  6755. database.close();
  6756. accept();
  6757. }
  6758. else
  6759. {
  6760. QMessageBox::information(this,tr("Database connection failed"),
  6761. tr("Failed to connect to database."));
  6762. }
  6763. }
  6764. /*:560*/
  6765. #line 563 "./typica.w"
  6766. /*564:*/
  6767. #line 12609 "./typica.w"
  6768. SqlQueryView::SqlQueryView(QWidget*parent):QTableView(parent)
  6769. {
  6770. setModel(new QSqlQueryModel);
  6771. connect(this,SIGNAL(doubleClicked(QModelIndex)),
  6772. this,SLOT(openRow(QModelIndex)));
  6773. connect(horizontalHeader(),SIGNAL(sectionResized(int,int,int)),
  6774. this,SLOT(persistColumnResize(int,int,int)));
  6775. }
  6776. /*:564*//*565:*/
  6777. #line 12624 "./typica.w"
  6778. void SqlQueryView::persistColumnResize(int column,int,int newsize)
  6779. {
  6780. /*566:*/
  6781. #line 12633 "./typica.w"
  6782. QSettings settings;
  6783. /*567:*/
  6784. #line 12646 "./typica.w"
  6785. QWidget*topLevelWidget= this;
  6786. while(topLevelWidget->parentWidget())
  6787. {
  6788. topLevelWidget= topLevelWidget->parentWidget();
  6789. }
  6790. /*:567*/
  6791. #line 12635 "./typica.w"
  6792. settings.setValue(QString("columnWidths/%1/%2/%3").
  6793. arg(topLevelWidget->objectName()).
  6794. arg(objectName()).arg(column),
  6795. QVariant(newsize));
  6796. /*:566*/
  6797. #line 12627 "./typica.w"
  6798. }
  6799. /*:565*//*568:*/
  6800. #line 12656 "./typica.w"
  6801. void SqlQueryView::showEvent(QShowEvent*event)
  6802. {
  6803. /*569:*/
  6804. #line 12666 "./typica.w"
  6805. QSettings settings;
  6806. /*567:*/
  6807. #line 12646 "./typica.w"
  6808. QWidget*topLevelWidget= this;
  6809. while(topLevelWidget->parentWidget())
  6810. {
  6811. topLevelWidget= topLevelWidget->parentWidget();
  6812. }
  6813. /*:567*/
  6814. #line 12668 "./typica.w"
  6815. QString baseKey=
  6816. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  6817. arg(objectName());
  6818. for(int i= 0;i<model()->columnCount();i++)
  6819. {
  6820. QString key= QString("%1/%2").arg(baseKey).arg(i);
  6821. if(settings.contains(key))
  6822. {
  6823. setColumnWidth(i,settings.value(key).toInt());
  6824. }
  6825. }
  6826. /*:569*/
  6827. #line 12659 "./typica.w"
  6828. event->accept();
  6829. }
  6830. /*:568*//*570:*/
  6831. #line 12683 "./typica.w"
  6832. void SqlQueryView::openRow(const QModelIndex&index)
  6833. {
  6834. emit openEntry(((QSqlQueryModel*)model())->record(index.row()).value(0).toString());
  6835. emit openEntryRow(index.row());
  6836. }
  6837. /*:570*//*571:*/
  6838. #line 12692 "./typica.w"
  6839. void SqlQueryView::setQuery(const QString&query)
  6840. {
  6841. QSqlDatabase database= AppInstance->database();
  6842. database.open();
  6843. QSqlQuery q(query,database);
  6844. ((QSqlQueryModel*)model())->setQuery(q);
  6845. database.close();
  6846. }
  6847. bool SqlQueryView::setHeaderData(int section,Qt::Orientation orientation,
  6848. const QVariant&value,int role)
  6849. {
  6850. return model()->setHeaderData(section,orientation,value,role);
  6851. }
  6852. /*:571*//*572:*/
  6853. #line 12710 "./typica.w"
  6854. QVariant SqlQueryView::data(int row,int column,int role)
  6855. {
  6856. return model()->data(model()->index(row,column),role);
  6857. }
  6858. /*:572*/
  6859. #line 564 "./typica.w"
  6860. /*131:*/
  6861. #line 3158 "./typica.w"
  6862. SqlQueryConnection::SqlQueryConnection(const QString&query)
  6863. {
  6864. QSqlDatabase database= AppInstance->database();
  6865. database.open();
  6866. q= new QSqlQuery(query,database);
  6867. connection= database.connectionName();
  6868. }
  6869. /*:131*//*132:*/
  6870. #line 3171 "./typica.w"
  6871. SqlQueryConnection::~SqlQueryConnection()
  6872. {
  6873. delete q;
  6874. {
  6875. QSqlDatabase database= QSqlDatabase::database(connection);
  6876. database.close();
  6877. }
  6878. QSqlDatabase::removeDatabase(connection);
  6879. }
  6880. /*:132*//*133:*/
  6881. #line 3185 "./typica.w"
  6882. QSqlQuery*SqlQueryConnection::operator->()const
  6883. {
  6884. return q;
  6885. }
  6886. /*:133*/
  6887. #line 565 "./typica.w"
  6888. /*591:*/
  6889. #line 13067 "./typica.w"
  6890. ReportTable::ReportTable(QTextFrame*frame,QDomElement description):
  6891. area(frame),configuration(description)
  6892. {
  6893. refresh();
  6894. }
  6895. ReportTable::~ReportTable()
  6896. {
  6897. }
  6898. /*:591*//*592:*/
  6899. #line 13083 "./typica.w"
  6900. void ReportTable::bind(QString placeholder,QVariant value)
  6901. {
  6902. bindings.insert(placeholder,value);
  6903. }
  6904. /*:592*//*593:*/
  6905. #line 13093 "./typica.w"
  6906. void ReportTable::refresh()
  6907. {
  6908. /*594:*/
  6909. #line 13114 "./typica.w"
  6910. QTextCursor cursor= area->firstCursorPosition();
  6911. while(cursor<area->lastCursorPosition())
  6912. {
  6913. cursor.movePosition(QTextCursor::Right,QTextCursor::KeepAnchor);
  6914. }
  6915. cursor.removeSelectedText();
  6916. /*:594*/
  6917. #line 13096 "./typica.w"
  6918. int rows= 1;
  6919. int columns= 1;
  6920. int currentRow= 0;
  6921. QTextTable*table= cursor.insertTable(rows,columns);
  6922. /*595:*/
  6923. #line 13127 "./typica.w"
  6924. QTextTableFormat format= table->format();
  6925. format.setBorderStyle(QTextFrameFormat::BorderStyle_None);
  6926. if(configuration.hasAttribute("align"))
  6927. {
  6928. if(configuration.attribute("align")=="center")
  6929. {
  6930. format.setAlignment(Qt::AlignHCenter);
  6931. }
  6932. }
  6933. table->setFormat(format);
  6934. /*:595*/
  6935. #line 13101 "./typica.w"
  6936. /*596:*/
  6937. #line 13141 "./typica.w"
  6938. QDomNodeList children= configuration.childNodes();
  6939. for(int i= 0;i<children.count();i++)
  6940. {
  6941. QDomNode current;
  6942. QDomElement currentElement;
  6943. current= children.at(i);
  6944. if(current.isElement())
  6945. {
  6946. currentElement= current.toElement();
  6947. if(currentElement.tagName()=="query")
  6948. {
  6949. /*597:*/
  6950. #line 13168 "./typica.w"
  6951. SqlQueryConnection h;
  6952. QSqlQuery*query= h.operator->();
  6953. query->prepare(currentElement.text());
  6954. foreach(QString key,bindings.uniqueKeys())
  6955. {
  6956. if(currentElement.text().contains(key))
  6957. {
  6958. query->bindValue(key,bindings.value(key));
  6959. }
  6960. }
  6961. query->exec();
  6962. if(!query->next())
  6963. {
  6964. continue;
  6965. }
  6966. if(query->record().count()> columns)
  6967. {
  6968. table->appendColumns(query->record().count()-columns);
  6969. }
  6970. do
  6971. {
  6972. table->appendRows(1);
  6973. rows++;
  6974. currentRow++;
  6975. for(int j= 0;j<query->record().count();j++)
  6976. {
  6977. QTextTableCell cell= table->cellAt(currentRow,j);
  6978. cursor= cell.firstCursorPosition();
  6979. cursor.insertText(query->value(j).toString());
  6980. }
  6981. }while(query->next());
  6982. /*:597*/
  6983. #line 13153 "./typica.w"
  6984. }
  6985. else if(currentElement.tagName()=="row")
  6986. {
  6987. /*598:*/
  6988. #line 13208 "./typica.w"
  6989. table->appendRows(1);
  6990. currentRow++;
  6991. rows++;
  6992. QDomNodeList rowChildren= currentElement.childNodes();
  6993. int currentColumn= 0;
  6994. for(int j= 0;j<rowChildren.count();j++)
  6995. {
  6996. QDomNode node;
  6997. QDomElement nodeElement;
  6998. node= rowChildren.at(j);
  6999. if(node.isElement())
  7000. {
  7001. nodeElement= node.toElement();
  7002. if(nodeElement.tagName()=="cell")
  7003. {
  7004. if(currentColumn==columns)
  7005. {
  7006. table->appendColumns(1);
  7007. columns++;
  7008. }
  7009. QTextTableCell cell= table->cellAt(currentRow,currentColumn);
  7010. cursor= cell.firstCursorPosition();
  7011. cursor.insertText(nodeElement.text());
  7012. currentColumn++;
  7013. }
  7014. }
  7015. }
  7016. /*:598*/
  7017. #line 13157 "./typica.w"
  7018. }
  7019. }
  7020. }
  7021. /*:596*/
  7022. #line 13102 "./typica.w"
  7023. if(rows> 1)
  7024. {
  7025. table->removeRows(0,1);
  7026. }
  7027. }
  7028. /*:593*/
  7029. #line 566 "./typica.w"
  7030. /*603:*/
  7031. #line 13310 "./typica.w"
  7032. FormArray::FormArray(QDomElement description):configuration(description),
  7033. maxwidth(-1),maxheight(-1)
  7034. {
  7035. setWidget(&itemContainer);
  7036. itemContainer.setLayout(&itemLayout);
  7037. }
  7038. /*:603*//*604:*/
  7039. #line 13327 "./typica.w"
  7040. void FormArray::addElements(int copies)
  7041. {
  7042. QStack<QWidget*> *widgetStack= new QStack<QWidget*> ;
  7043. QStack<QLayout*> *layoutStack= new QStack<QLayout*> ;
  7044. QWidget*widget;
  7045. for(int i= 0;i<copies;i++)
  7046. {
  7047. widget= new QWidget;
  7048. if(maxwidth> -1)
  7049. {
  7050. widget->setMaximumWidth(maxwidth);
  7051. }
  7052. if(maxheight> -1)
  7053. {
  7054. widget->setMaximumHeight(maxheight);
  7055. }
  7056. if(configuration.hasChildNodes())
  7057. {
  7058. widgetStack->push(widget);
  7059. populateWidget(configuration,widgetStack,layoutStack);
  7060. widgetStack->pop();
  7061. widget->setMinimumHeight(widget->sizeHint().height());
  7062. itemLayout.addWidget(widget);
  7063. if(widget->sizeHint().height()> maxheight&&maxheight> -1)
  7064. {
  7065. itemContainer.setMinimumHeight(maxheight*elements()+50);
  7066. }
  7067. else
  7068. {
  7069. itemContainer.setMinimumHeight(itemContainer.sizeHint().height()
  7070. +widget->sizeHint().height());
  7071. }
  7072. if(maxwidth> -1)
  7073. {
  7074. itemContainer.setMinimumWidth(maxwidth+50);
  7075. }
  7076. else
  7077. {
  7078. itemContainer.setMinimumWidth(widget->sizeHint().width()+50);
  7079. }
  7080. }
  7081. }
  7082. }
  7083. /*:604*//*605:*/
  7084. #line 13377 "./typica.w"
  7085. QWidget*FormArray::elementAt(int index)
  7086. {
  7087. if(index<itemLayout.count())
  7088. {
  7089. QLayoutItem*item= itemLayout.itemAt(index);
  7090. return item->widget();
  7091. }
  7092. else
  7093. {
  7094. return NULL;
  7095. }
  7096. }
  7097. /*:605*//*606:*/
  7098. #line 13394 "./typica.w"
  7099. void FormArray::removeAllElements()
  7100. {
  7101. while(itemLayout.count()> 0)
  7102. {
  7103. QLayoutItem*item;
  7104. item= itemLayout.itemAt(0);
  7105. item->widget()->hide();
  7106. itemLayout.removeWidget(item->widget());
  7107. }
  7108. itemContainer.setMinimumHeight(0);
  7109. }
  7110. /*:606*//*607:*/
  7111. #line 13410 "./typica.w"
  7112. int FormArray::elements()
  7113. {
  7114. return itemLayout.count();
  7115. }
  7116. /*:607*//*608:*/
  7117. #line 13421 "./typica.w"
  7118. void FormArray::setMaximumElementWidth(int width)
  7119. {
  7120. maxwidth= width;
  7121. }
  7122. void FormArray::setMaximumElementHeight(int height)
  7123. {
  7124. maxheight= height;
  7125. }
  7126. /*:608*/
  7127. #line 567 "./typica.w"
  7128. /*614:*/
  7129. #line 13552 "./typica.w"
  7130. ScaleControl::ScaleControl():QGraphicsView(NULL,NULL),nonScoredValue(-1),
  7131. scoredValue(-1),initialSet(false),finalSet(false),scaleDown(false)
  7132. {
  7133. left<<QPointF(0,5)<<QPointF(10,0)<<QPointF(10,10)<<
  7134. QPointF(0,5);
  7135. right<<QPointF(10,5)<<QPointF(0,0)<<QPointF(0,10)<<
  7136. QPointF(10,5);
  7137. down<<QPointF(0,0)<<QPointF(-5,-10)<<QPointF(5,-10)<<
  7138. QPointF(0,0);
  7139. up<<QPointF(0,0)<<QPointF(-5,10)<<QPointF(4,10)<<QPointF(0,0);
  7140. initialBrush.setColor(QColor(170,170,255));
  7141. initialBrush.setStyle(Qt::SolidPattern);
  7142. finalBrush.setColor(Qt::blue);
  7143. finalBrush.setStyle(Qt::SolidPattern);
  7144. initialDecrement.setPolygon(left);
  7145. initialDecrement.setBrush(initialBrush);
  7146. initialDecrement.setPos(0,0);
  7147. scene.addItem(&initialDecrement);
  7148. initialIncrement.setPolygon(right);
  7149. initialIncrement.setBrush(initialBrush);
  7150. initialIncrement.setPos(122,0);
  7151. scene.addItem(&initialIncrement);
  7152. finalDecrement.setPolygon(left);
  7153. finalDecrement.setBrush(finalBrush);
  7154. finalDecrement.setPos(0,12);
  7155. scene.addItem(&finalDecrement);
  7156. finalIncrement.setPolygon(right);
  7157. finalIncrement.setBrush(finalBrush);
  7158. finalIncrement.setPos(122,12);
  7159. scene.addItem(&finalIncrement);
  7160. scalePath.moveTo(0,10);
  7161. scalePath.lineTo(100,10);
  7162. scalePath.moveTo(0,0);
  7163. scalePath.lineTo(0,20);
  7164. scalePath.moveTo(10,5);
  7165. scalePath.lineTo(10,15);
  7166. scalePath.moveTo(20,5);
  7167. scalePath.lineTo(20,15);
  7168. scalePath.moveTo(30,5);
  7169. scalePath.lineTo(30,15);
  7170. scalePath.moveTo(40,5);
  7171. scalePath.lineTo(40,15);
  7172. scalePath.moveTo(50,0);
  7173. scalePath.lineTo(50,20);
  7174. scalePath.moveTo(60,5);
  7175. scalePath.lineTo(60,15);
  7176. scalePath.moveTo(70,5);
  7177. scalePath.lineTo(70,15);
  7178. scalePath.moveTo(80,5);
  7179. scalePath.lineTo(80,15);
  7180. scalePath.moveTo(90,5);
  7181. scalePath.lineTo(90,15);
  7182. scalePath.moveTo(100,0);
  7183. scalePath.lineTo(100,20);
  7184. scaleLine.setPath(scalePath);
  7185. scaleLine.setPos(16,1);
  7186. scene.addItem(&scaleLine);
  7187. setScene(&scene);
  7188. initialIndicator.setPolygon(down);
  7189. initialIndicator.setBrush(initialBrush);
  7190. finalIndicator.setPolygon(up);
  7191. finalIndicator.setBrush(finalBrush);
  7192. setMinimumSize(sizeHint());
  7193. setMaximumSize(sizeHint());
  7194. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  7195. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  7196. setMinimumSize(sizeHint());
  7197. }
  7198. /*:614*//*615:*/
  7199. #line 13625 "./typica.w"
  7200. QSize ScaleControl::sizeHint()const
  7201. {
  7202. return QSize(140,30);
  7203. }
  7204. /*:615*//*616:*/
  7205. #line 13634 "./typica.w"
  7206. void ScaleControl::setInitialValue(double value)
  7207. {
  7208. if(value>=0&&value<=10)
  7209. {
  7210. nonScoredValue= value;
  7211. if(!initialSet)
  7212. {
  7213. scene.addItem(&initialIndicator);
  7214. }
  7215. initialSet= true;
  7216. initialIndicator.setPos(value*10+16,10);
  7217. emit initialChanged(value);
  7218. if(!finalSet)
  7219. {
  7220. setFinalValue(value);
  7221. }
  7222. }
  7223. }
  7224. void ScaleControl::setFinalValue(double value)
  7225. {
  7226. if(value>=0&&value<=10)
  7227. {
  7228. scoredValue= value;
  7229. if(!finalSet)
  7230. {
  7231. scene.addItem(&finalIndicator);
  7232. }
  7233. finalSet= true;
  7234. finalIndicator.setPos(value*10+16,11);
  7235. emit finalChanged(value);
  7236. }
  7237. }
  7238. /*:616*//*617:*/
  7239. #line 13671 "./typica.w"
  7240. double ScaleControl::initialValue(void)
  7241. {
  7242. return nonScoredValue;
  7243. }
  7244. double ScaleControl::finalValue(void)
  7245. {
  7246. return scoredValue;
  7247. }
  7248. /*:617*//*618:*/
  7249. #line 13692 "./typica.w"
  7250. void ScaleControl::mousePressEvent(QMouseEvent*event)
  7251. {
  7252. /*619:*/
  7253. #line 13704 "./typica.w"
  7254. if(event->button()!=Qt::LeftButton)
  7255. {
  7256. event->ignore();
  7257. return;
  7258. }
  7259. /*:619*/
  7260. #line 13695 "./typica.w"
  7261. scaleDown= true;
  7262. event->accept();
  7263. }
  7264. /*:618*//*620:*/
  7265. #line 13715 "./typica.w"
  7266. void ScaleControl::mouseReleaseEvent(QMouseEvent*event)
  7267. {
  7268. /*619:*/
  7269. #line 13704 "./typica.w"
  7270. if(event->button()!=Qt::LeftButton)
  7271. {
  7272. event->ignore();
  7273. return;
  7274. }
  7275. /*:619*/
  7276. #line 13718 "./typica.w"
  7277. if(!scaleDown)
  7278. {
  7279. event->ignore();
  7280. return;
  7281. }
  7282. scaleDown= false;
  7283. QPointF sceneCoordinate= mapToScene(event->x(),event->y());
  7284. /*621:*/
  7285. #line 13740 "./typica.w"
  7286. if(sceneCoordinate.x()>=0&&sceneCoordinate.x()<=10)
  7287. {
  7288. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  7289. {
  7290. if(initialSet)
  7291. {
  7292. setInitialValue(nonScoredValue-0.05);
  7293. }
  7294. event->accept();
  7295. return;
  7296. }
  7297. else if(sceneCoordinate.y()>=12&&sceneCoordinate.y()<=22)
  7298. {
  7299. if(finalSet)
  7300. {
  7301. setFinalValue(scoredValue-0.05);
  7302. event->accept();
  7303. return;
  7304. }
  7305. }
  7306. }
  7307. /*:621*/
  7308. #line 13726 "./typica.w"
  7309. /*622:*/
  7310. #line 13766 "./typica.w"
  7311. else if(sceneCoordinate.x()>=122&&sceneCoordinate.x()<=132)
  7312. {
  7313. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  7314. {
  7315. if(initialSet)
  7316. {
  7317. setInitialValue(nonScoredValue+0.05);
  7318. event->accept();
  7319. return;
  7320. }
  7321. }
  7322. else if(sceneCoordinate.y()>=12&&sceneCoordinate.y()<=22)
  7323. {
  7324. if(finalSet)
  7325. {
  7326. setFinalValue(scoredValue+0.05);
  7327. event->accept();
  7328. return;
  7329. }
  7330. }
  7331. }
  7332. /*:622*/
  7333. #line 13727 "./typica.w"
  7334. /*623:*/
  7335. #line 13792 "./typica.w"
  7336. double relativeX= sceneCoordinate.x()-16;
  7337. if(initialSet)
  7338. {
  7339. if(relativeX>=0&&relativeX<=100)
  7340. {
  7341. setFinalValue(relativeX/10.0);
  7342. event->accept();
  7343. return;
  7344. }
  7345. }
  7346. else
  7347. {
  7348. if(relativeX>=0&&relativeX<=100)
  7349. {
  7350. setInitialValue(relativeX/10.0);
  7351. event->accept();
  7352. return;
  7353. }
  7354. }
  7355. /*:623*/
  7356. #line 13728 "./typica.w"
  7357. event->ignore();
  7358. return;
  7359. }
  7360. /*:620*/
  7361. #line 568 "./typica.w"
  7362. /*625:*/
  7363. #line 13858 "./typica.w"
  7364. IntensityControl::IntensityControl():QGraphicsView(NULL,NULL),theValue(-1),
  7365. valueSet(false),scaleDown(false)
  7366. {
  7367. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  7368. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  7369. left<<QPointF(0,0)<<QPointF(10,-5)<<QPointF(10,5)<<QPointF(0,0);
  7370. down<<QPointF(0,0)<<QPointF(10,0)<<QPointF(5,10)<<QPointF(0,0);
  7371. up<<QPointF(0,10)<<QPointF(10,10)<<QPointF(5,0)<<QPointF(0,10);
  7372. theBrush.setColor(Qt::blue);
  7373. theBrush.setStyle(Qt::SolidPattern);
  7374. increment.setPolygon(up);
  7375. increment.setBrush(theBrush);
  7376. increment.setPos(0,0);
  7377. scene.addItem(&increment);
  7378. decrement.setPolygon(down);
  7379. decrement.setBrush(theBrush);
  7380. decrement.setPos(0,122);
  7381. scene.addItem(&decrement);
  7382. scalePath.moveTo(5,0);
  7383. scalePath.lineTo(5,100);
  7384. scalePath.moveTo(0,0);
  7385. scalePath.lineTo(10,0);
  7386. scalePath.moveTo(0,10);
  7387. scalePath.lineTo(10,10);
  7388. scalePath.moveTo(0,20);
  7389. scalePath.lineTo(10,20);
  7390. scalePath.moveTo(0,30);
  7391. scalePath.lineTo(10,30);
  7392. scalePath.moveTo(0,40);
  7393. scalePath.lineTo(10,40);
  7394. scalePath.moveTo(0,50);
  7395. scalePath.lineTo(10,50);
  7396. scalePath.moveTo(0,60);
  7397. scalePath.lineTo(10,60);
  7398. scalePath.moveTo(0,70);
  7399. scalePath.lineTo(10,70);
  7400. scalePath.moveTo(0,80);
  7401. scalePath.lineTo(10,80);
  7402. scalePath.moveTo(0,90);
  7403. scalePath.lineTo(10,90);
  7404. scalePath.moveTo(0,100);
  7405. scalePath.lineTo(10,100);
  7406. scaleLine.setPath(scalePath);
  7407. scaleLine.setPos(0,16);
  7408. scene.addItem(&scaleLine);
  7409. setScene(&scene);
  7410. indicator.setPolygon(left);
  7411. indicator.setBrush(theBrush);
  7412. setMinimumSize(sizeHint());
  7413. setMaximumSize(sizeHint());
  7414. }
  7415. /*:625*//*626:*/
  7416. #line 13913 "./typica.w"
  7417. QSize IntensityControl::sizeHint()const
  7418. {
  7419. return QSize(25,160);
  7420. }
  7421. /*:626*//*627:*/
  7422. #line 13928 "./typica.w"
  7423. void IntensityControl::setValue(double val)
  7424. {
  7425. if(val>=0&&val<=10)
  7426. {
  7427. theValue= val;
  7428. if(!valueSet)
  7429. {
  7430. scene.addItem(&indicator);
  7431. }
  7432. valueSet= true;
  7433. indicator.setPos(6,(100-(val*10))+16);
  7434. emit(valueChanged(val));
  7435. }
  7436. else if(val<1)
  7437. {
  7438. setValue(0);
  7439. }
  7440. else
  7441. {
  7442. setValue(10);
  7443. }
  7444. }
  7445. double IntensityControl::value()
  7446. {
  7447. return theValue;
  7448. }
  7449. /*:627*//*628:*/
  7450. #line 13960 "./typica.w"
  7451. void IntensityControl::mousePressEvent(QMouseEvent*event)
  7452. {
  7453. /*619:*/
  7454. #line 13704 "./typica.w"
  7455. if(event->button()!=Qt::LeftButton)
  7456. {
  7457. event->ignore();
  7458. return;
  7459. }
  7460. /*:619*/
  7461. #line 13963 "./typica.w"
  7462. scaleDown= true;
  7463. event->accept();
  7464. }
  7465. /*:628*//*629:*/
  7466. #line 13974 "./typica.w"
  7467. void IntensityControl::mouseReleaseEvent(QMouseEvent*event)
  7468. {
  7469. /*619:*/
  7470. #line 13704 "./typica.w"
  7471. if(event->button()!=Qt::LeftButton)
  7472. {
  7473. event->ignore();
  7474. return;
  7475. }
  7476. /*:619*/
  7477. #line 13977 "./typica.w"
  7478. if(!scaleDown)
  7479. {
  7480. event->ignore();
  7481. return;
  7482. }
  7483. scaleDown= false;
  7484. QPointF sceneCoordinate= mapToScene(event->x(),event->y());
  7485. if(sceneCoordinate.x()>=0&&sceneCoordinate.x()<=16)
  7486. {
  7487. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  7488. {
  7489. if(valueSet)
  7490. {
  7491. setValue(theValue+0.05);
  7492. }
  7493. event->accept();
  7494. return;
  7495. }
  7496. else if(sceneCoordinate.y()>=122&&sceneCoordinate.y()<=132)
  7497. {
  7498. if(valueSet)
  7499. {
  7500. setValue(theValue-0.05);
  7501. }
  7502. event->accept();
  7503. return;
  7504. }
  7505. else if(sceneCoordinate.y()>=16&&sceneCoordinate.y()<=116)
  7506. {
  7507. setValue(10-((sceneCoordinate.y()-16)/10.0));
  7508. event->accept();
  7509. return;
  7510. }
  7511. }
  7512. }
  7513. /*:629*/
  7514. #line 569 "./typica.w"
  7515. /*305:*/
  7516. #line 7274 "./typica.w"
  7517. void ThresholdDetector::newMeasurement(Measurement measure)
  7518. {
  7519. if((currentDirection==Ascending&&previousValue<threshold&&
  7520. previousValue>=0)||(currentDirection==Descending&&
  7521. previousValue> threshold&&previousValue>=0))
  7522. {
  7523. if((currentDirection==Ascending&&measure.temperature()>=threshold)||
  7524. (currentDirection==Descending&&measure.temperature()<=threshold))
  7525. {
  7526. double offset= measure.time().hour()*60*60;
  7527. offset+= measure.time().minute()*60;
  7528. offset+= measure.time().second();
  7529. offset+= measure.time().msec()/1000;
  7530. emit timeForValue(offset);
  7531. }
  7532. }
  7533. previousValue= measure.temperature();
  7534. }
  7535. ThresholdDetector::ThresholdDetector(double value):QObject(NULL),
  7536. previousValue(-1),threshold(value),currentDirection(Ascending)
  7537. {
  7538. }
  7539. void ThresholdDetector::setThreshold(double value)
  7540. {
  7541. threshold= value;
  7542. }
  7543. void ThresholdDetector::setEdgeDirection(EdgeDirection direction)
  7544. {
  7545. currentDirection= direction;
  7546. }
  7547. /*:305*/
  7548. #line 570 "./typica.w"
  7549. /*711:*/
  7550. #line 15795 "./typica.w"
  7551. PortSelector::PortSelector(QWidget*parent):QComboBox(parent),
  7552. lister(new QextSerialEnumerator)
  7553. {
  7554. QList<QextPortInfo> ports= QextSerialEnumerator::getPorts();
  7555. QextPortInfo port;
  7556. foreach(port,ports)
  7557. {
  7558. #ifdef Q_OS_WIN32
  7559. addItem(port.portName);
  7560. #else
  7561. addItem(port.physName);
  7562. #endif
  7563. }
  7564. lister->setUpNotifications();
  7565. connect(lister,SIGNAL(deviceDiscovered(QextPortInfo)),
  7566. this,SLOT(addDevice(QextPortInfo)));
  7567. setEditable(true);
  7568. }
  7569. void PortSelector::addDevice(QextPortInfo port)
  7570. {
  7571. addItem(port.portName);
  7572. }
  7573. /*:711*/
  7574. #line 571 "./typica.w"
  7575. /*713:*/
  7576. #line 15887 "./typica.w"
  7577. BaudSelector::BaudSelector(QWidget*parent):QComboBox(parent)
  7578. {
  7579. QMetaObject meta= BaudSelector::staticMetaObject;
  7580. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("BaudRateType"));
  7581. for(int i= 0;i<type.keyCount();i++)
  7582. {
  7583. addItem(QString("%1").arg(type.value(i)));
  7584. }
  7585. }
  7586. /*:713*/
  7587. #line 572 "./typica.w"
  7588. /*715:*/
  7589. #line 15925 "./typica.w"
  7590. ParitySelector::ParitySelector(QWidget*parent):QComboBox(parent)
  7591. {
  7592. QMetaObject meta= ParitySelector::staticMetaObject;
  7593. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("ParityType"));
  7594. for(int i= 0;i<type.keyCount();i++)
  7595. {
  7596. addItem(QString(type.key(i)),QVariant(type.value(i)));
  7597. }
  7598. }
  7599. /*:715*/
  7600. #line 573 "./typica.w"
  7601. /*717:*/
  7602. #line 15955 "./typica.w"
  7603. FlowSelector::FlowSelector(QWidget*parent):QComboBox(parent)
  7604. {
  7605. QMetaObject meta= FlowSelector::staticMetaObject;
  7606. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("FlowType"));
  7607. for(int i= 0;i<type.keyCount();i++)
  7608. {
  7609. addItem(QString(type.key(i)),QVariant(type.value(i)));
  7610. }
  7611. }
  7612. /*:717*/
  7613. #line 574 "./typica.w"
  7614. /*719:*/
  7615. #line 15990 "./typica.w"
  7616. StopSelector::StopSelector(QWidget*parent):QComboBox(parent)
  7617. {
  7618. QMetaObject meta= StopSelector::staticMetaObject;
  7619. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("StopBitsType"));
  7620. for(int i= 0;i<type.keyCount();i++)
  7621. {
  7622. addItem(QString(type.key(i)),QVariant(type.value(i)));
  7623. }
  7624. }
  7625. /*:719*/
  7626. #line 575 "./typica.w"
  7627. /*774:*/
  7628. #line 17741 "./typica.w"
  7629. ModbusConfigurator::ModbusConfigurator(DeviceTreeModel*model,const QModelIndex&index)
  7630. :BasicDeviceConfigurationWidget(model,index),
  7631. port(new PortSelector),baud(new BaudSelector),parity(new ParitySelector),
  7632. flow(new FlowSelector),stop(new StopSelector),station(new QSpinBox),
  7633. decimalQuery(new QCheckBox(tr("Enable"))),
  7634. decimalAddress(new ShortHexSpinBox),decimalPosition(new QSpinBox),
  7635. unitQuery(new QCheckBox(tr("Enable"))),
  7636. unitAddress(new ShortHexSpinBox),valueF(new QSpinBox),
  7637. valueC(new QSpinBox),fixedUnit(new QComboBox),
  7638. pVAddress(new ShortHexSpinBox),
  7639. sVEnabled(new QCheckBox(tr("Enable"))),
  7640. sVReadAddress(new ShortHexSpinBox),
  7641. deviceLimit(new QCheckBox(tr("Enable"))),
  7642. sVLowerAddr(new ShortHexSpinBox),sVUpperAddr(new ShortHexSpinBox),
  7643. sVLower(new QDoubleSpinBox),sVUpper(new QDoubleSpinBox),
  7644. sVWritable(new QCheckBox(tr("Enable"))),
  7645. sVOutputAddr(new ShortHexSpinBox),
  7646. pVColumnName(new QLineEdit),sVColumnName(new QLineEdit)
  7647. {
  7648. QHBoxLayout*layout= new QHBoxLayout;
  7649. QWidget*form= new QWidget;
  7650. QHBoxLayout*masterLayout= new QHBoxLayout;
  7651. QVBoxLayout*portAndDeviceLayout= new QVBoxLayout;
  7652. QVBoxLayout*seriesLayout= new QVBoxLayout;
  7653. QFormLayout*serialSection= new QFormLayout;
  7654. serialSection->addRow(QString(tr("Port:")),port);
  7655. serialSection->addRow(QString(tr("Baud rate:")),baud);
  7656. serialSection->addRow(QString(tr("Parity:")),parity);
  7657. serialSection->addRow(QString(tr("Flow control:")),flow);
  7658. serialSection->addRow(QString(tr("Stop bits:")),stop);
  7659. QGroupBox*serialSectionBox= new QGroupBox(tr("Serial Port Configuration"));
  7660. serialSectionBox->setLayout(serialSection);
  7661. portAndDeviceLayout->addWidget(serialSectionBox);
  7662. QFormLayout*deviceSection= new QFormLayout;
  7663. station->setMinimum(1);
  7664. station->setMaximum(255);
  7665. decimalPosition->setMinimum(0);
  7666. decimalPosition->setMaximum(9);
  7667. valueF->setMinimum(0);
  7668. valueF->setMaximum(0xFFFF);
  7669. valueC->setMinimum(0);
  7670. valueC->setMaximum(0xFFFF);
  7671. fixedUnit->addItem(tr("Fahrenheit"),QVariant(QString("F")));
  7672. fixedUnit->addItem(tr("Celsius"),QVariant(QString("C")));
  7673. deviceSection->addRow(tr("Station:"),station);
  7674. deviceSection->addRow(tr("Decimal position from device:"),decimalQuery);
  7675. deviceSection->addRow(tr("Decimal position relative address:"),decimalAddress);
  7676. deviceSection->addRow(tr("Fixed decimal position:"),decimalPosition);
  7677. deviceSection->addRow(tr("Measurement unit from device:"),unitQuery);
  7678. deviceSection->addRow(tr("Current unit relative address:"),unitAddress);
  7679. deviceSection->addRow(tr("Value for Fahrenheit:"),valueF);
  7680. deviceSection->addRow(tr("Value for Celsius:"),valueC);
  7681. deviceSection->addRow(tr("Fixed unit:"),fixedUnit);
  7682. QGroupBox*deviceSectionBox= new QGroupBox(tr("Device Configuration"));
  7683. deviceSectionBox->setLayout(deviceSection);
  7684. portAndDeviceLayout->addWidget(deviceSectionBox);
  7685. QFormLayout*pVSection= new QFormLayout;
  7686. pVSection->addRow(tr("Value relative address:"),pVAddress);
  7687. pVSection->addRow(tr("PV column name:"),pVColumnName);
  7688. QCheckBox*pVHideBox= new QCheckBox(tr("Hide this channel"));
  7689. pVSection->addRow(pVHideBox);
  7690. QGroupBox*processValueBox= new QGroupBox(tr("Process Value"));
  7691. processValueBox->setLayout(pVSection);
  7692. seriesLayout->addWidget(processValueBox);
  7693. QFormLayout*sVSection= new QFormLayout;
  7694. sVLower->setDecimals(1);
  7695. sVLower->setMinimum(0.0);
  7696. sVLower->setMaximum(999.9);
  7697. sVUpper->setDecimals(1);
  7698. sVUpper->setMinimum(0.0);
  7699. sVUpper->setMaximum(999.9);
  7700. sVSection->addRow(tr("Set value:"),sVEnabled);
  7701. sVSection->addRow(tr("Read relative address:"),sVReadAddress);
  7702. sVSection->addRow(tr("SV column name:"),sVColumnName);
  7703. sVSection->addRow(tr("Limits from device:"),deviceLimit);
  7704. sVSection->addRow(tr("Lower limit relative address:"),sVLowerAddr);
  7705. sVSection->addRow(tr("Upper limit relative address:"),sVUpperAddr);
  7706. sVSection->addRow(tr("Lower limit:"),sVLower);
  7707. sVSection->addRow(tr("Upper limit:"),sVUpper);
  7708. sVSection->addRow(tr("Output set value:"),sVWritable);
  7709. sVSection->addRow(tr("Output relative address:"),sVOutputAddr);
  7710. QCheckBox*sVHideBox= new QCheckBox(tr("Hide this channel"));
  7711. sVSection->addRow(sVHideBox);
  7712. QGroupBox*setValueBox= new QGroupBox(tr("Set Value"));
  7713. setValueBox->setLayout(sVSection);
  7714. seriesLayout->addWidget(setValueBox);
  7715. masterLayout->addLayout(portAndDeviceLayout);
  7716. masterLayout->addLayout(seriesLayout);
  7717. form->setLayout(masterLayout);
  7718. /*687:*/
  7719. #line 15251 "./typica.w"
  7720. QDomElement referenceElement=
  7721. model->referenceElement(model->data(index,Qt::UserRole).toString());
  7722. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  7723. QDomElement node;
  7724. /*:687*/
  7725. #line 17831 "./typica.w"
  7726. for(int i= 0;i<configData.size();i++)
  7727. {
  7728. node= configData.at(i).toElement();
  7729. if(node.attribute("name")=="port")
  7730. {
  7731. QString portname= node.attribute("value");
  7732. int idx= port->findText(portname);
  7733. if(idx>=0)
  7734. {
  7735. port->setCurrentIndex(idx);
  7736. }
  7737. else
  7738. {
  7739. port->addItem(portname);
  7740. }
  7741. }
  7742. else if(node.attribute("name")=="baud")
  7743. {
  7744. baud->setCurrentIndex(baud->findText(node.attribute("value")));
  7745. }
  7746. else if(node.attribute("name")=="parity")
  7747. {
  7748. parity->setCurrentIndex(parity->findData(node.attribute("value")));
  7749. }
  7750. else if(node.attribute("name")=="flow")
  7751. {
  7752. flow->setCurrentIndex(flow->findData(node.attribute("value")));
  7753. }
  7754. else if(node.attribute("name")=="stop")
  7755. {
  7756. stop->setCurrentIndex(stop->findData(node.attribute("value")));
  7757. }
  7758. else if(node.attribute("name")=="station")
  7759. {
  7760. station->setValue(node.attribute("value").toInt());
  7761. }
  7762. else if(node.attribute("name")=="decimalQuery")
  7763. {
  7764. if(node.attribute("value")=="true")
  7765. {
  7766. decimalQuery->setChecked(true);
  7767. }
  7768. else
  7769. {
  7770. decimalQuery->setChecked(false);
  7771. }
  7772. }
  7773. else if(node.attribute("name")=="decimalAddress")
  7774. {
  7775. decimalAddress->setValue(node.attribute("value").toInt());
  7776. }
  7777. else if(node.attribute("name")=="decimalPosition")
  7778. {
  7779. decimalPosition->setValue(node.attribute("value").toInt());
  7780. }
  7781. else if(node.attribute("name")=="unitQuery")
  7782. {
  7783. if(node.attribute("value")=="true")
  7784. {
  7785. unitQuery->setChecked(true);
  7786. }
  7787. else
  7788. {
  7789. unitQuery->setChecked(false);
  7790. }
  7791. }
  7792. else if(node.attribute("name")=="unitAddress")
  7793. {
  7794. unitAddress->setValue(node.attribute("value").toInt());
  7795. }
  7796. else if(node.attribute("name")=="valueF")
  7797. {
  7798. valueF->setValue(node.attribute("value").toInt());
  7799. }
  7800. else if(node.attribute("name")=="valueC")
  7801. {
  7802. valueC->setValue(node.attribute("value").toInt());
  7803. }
  7804. else if(node.attribute("name")=="fixedUnit")
  7805. {
  7806. fixedUnit->setCurrentIndex(fixedUnit->findText(node.attribute("value")));
  7807. }
  7808. else if(node.attribute("name")=="pVAddress")
  7809. {
  7810. pVAddress->setValue(node.attribute("value").toInt());
  7811. }
  7812. else if(node.attribute("name")=="sVEnabled")
  7813. {
  7814. if(node.attribute("value")=="true")
  7815. {
  7816. sVEnabled->setChecked(true);
  7817. }
  7818. else
  7819. {
  7820. sVEnabled->setChecked(false);
  7821. }
  7822. }
  7823. else if(node.attribute("name")=="sVReadAddress")
  7824. {
  7825. sVReadAddress->setValue(node.attribute("value").toInt());
  7826. }
  7827. else if(node.attribute("name")=="deviceLimit")
  7828. {
  7829. if(node.attribute("value")=="true")
  7830. {
  7831. deviceLimit->setChecked(true);
  7832. }
  7833. else
  7834. {
  7835. deviceLimit->setChecked(false);
  7836. }
  7837. }
  7838. else if(node.attribute("name")=="sVLowerAddr")
  7839. {
  7840. sVLowerAddr->setValue(node.attribute("value").toInt());
  7841. }
  7842. else if(node.attribute("name")=="sVUpperAddr")
  7843. {
  7844. sVUpperAddr->setValue(node.attribute("value").toInt());
  7845. }
  7846. else if(node.attribute("name")=="sVLower")
  7847. {
  7848. sVLower->setValue(node.attribute("value").toDouble());
  7849. }
  7850. else if(node.attribute("name")=="sVUpper")
  7851. {
  7852. sVUpper->setValue(node.attribute("value").toDouble());
  7853. }
  7854. else if(node.attribute("name")=="sVWritable")
  7855. {
  7856. if(node.attribute("value")=="true")
  7857. {
  7858. sVWritable->setChecked(true);
  7859. }
  7860. else
  7861. {
  7862. sVWritable->setChecked(false);
  7863. }
  7864. }
  7865. else if(node.attribute("name")=="sVOutputAddr")
  7866. {
  7867. sVOutputAddr->setValue(node.attribute("value").toInt());
  7868. }
  7869. else if(node.attribute("name")=="pvcolname")
  7870. {
  7871. pVColumnName->setText(node.attribute("value"));
  7872. }
  7873. else if(node.attribute("name")=="svcolname")
  7874. {
  7875. sVColumnName->setText(node.attribute("value"));
  7876. }
  7877. else if(node.attribute("name")=="pvhidden")
  7878. {
  7879. pVHideBox->setChecked(node.attribute("value")=="true");
  7880. }
  7881. else if(node.attribute("name")=="svhidden")
  7882. {
  7883. sVHideBox->setChecked(node.attribute("value")=="true");
  7884. }
  7885. }
  7886. updatePort(port->currentText());
  7887. updateBaudRate(baud->currentText());
  7888. updateParity(parity->itemData(parity->currentIndex()).toString());
  7889. updateFlowControl(flow->itemData(flow->currentIndex()).toString());
  7890. updateStopBits(stop->itemData(stop->currentIndex()).toString());
  7891. updateStation(station->value());
  7892. updateFixedDecimal(decimalQuery->isChecked());
  7893. updateDecimalAddress(decimalAddress->value());
  7894. updateDecimalPosition(decimalPosition->value());
  7895. updateFixedUnit(unitQuery->isChecked());
  7896. updateUnitAddress(unitAddress->value());
  7897. updateValueForF(valueF->value());
  7898. updateValueForC(valueC->value());
  7899. updateUnit(fixedUnit->currentText());
  7900. updatePVAddress(pVAddress->value());
  7901. updateSVEnabled(sVEnabled->isChecked());
  7902. updateSVReadAddress(sVReadAddress->value());
  7903. updateDeviceLimit(deviceLimit->isChecked());
  7904. updateSVLowerAddress(sVLowerAddr->value());
  7905. updateSVUpperAddress(sVUpperAddr->value());
  7906. updateSVLower(sVLower->value());
  7907. updateSVUpper(sVUpper->value());
  7908. updateSVWritable(sVWritable->isChecked());
  7909. updateSVWriteAddress(sVOutputAddr->value());
  7910. updatePVColumnName(pVColumnName->text());
  7911. updateSVColumnName(sVColumnName->text());
  7912. updatePVHidden(pVHideBox->isChecked());
  7913. updateSVHidden(sVHideBox->isChecked());
  7914. connect(port,SIGNAL(currentIndexChanged(QString)),this,SLOT(updatePort(QString)));
  7915. connect(port,SIGNAL(editTextChanged(QString)),this,SLOT(updatePort(QString)));
  7916. connect(baud,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateBaudRate(QString)));
  7917. connect(parity,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateParity(QString)));
  7918. connect(flow,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateFlowControl(QString)));
  7919. connect(stop,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateStopBits(QString)));
  7920. connect(station,SIGNAL(valueChanged(int)),this,SLOT(updateStation(int)));
  7921. connect(decimalQuery,SIGNAL(toggled(bool)),this,SLOT(updateFixedDecimal(bool)));
  7922. connect(decimalAddress,SIGNAL(valueChanged(int)),this,SLOT(updateDecimalAddress(int)));
  7923. connect(decimalPosition,SIGNAL(valueChanged(int)),this,SLOT(updateDecimalPosition(int)));
  7924. connect(unitQuery,SIGNAL(toggled(bool)),this,SLOT(updateFixedUnit(bool)));
  7925. connect(unitAddress,SIGNAL(valueChanged(int)),this,SLOT(updateUnitAddress(int)));
  7926. connect(valueF,SIGNAL(valueChanged(int)),this,SLOT(updateValueForF(int)));
  7927. connect(valueC,SIGNAL(valueChanged(int)),this,SLOT(updateValueForC(int)));
  7928. connect(fixedUnit,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateUnit(QString)));
  7929. connect(pVAddress,SIGNAL(valueChanged(int)),this,SLOT(updatePVAddress(int)));
  7930. connect(sVEnabled,SIGNAL(toggled(bool)),this,SLOT(updateSVEnabled(bool)));
  7931. connect(sVReadAddress,SIGNAL(valueChanged(int)),this,SLOT(updateSVReadAddress(int)));
  7932. connect(deviceLimit,SIGNAL(toggled(bool)),this,SLOT(updateDeviceLimit(bool)));
  7933. connect(sVLowerAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVLowerAddress(int)));
  7934. connect(sVUpperAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVUpperAddress(int)));
  7935. connect(sVLower,SIGNAL(valueChanged(double)),this,SLOT(updateSVLower(double)));
  7936. connect(sVUpper,SIGNAL(valueChanged(double)),this,SLOT(updateSVUpper(double)));
  7937. connect(sVWritable,SIGNAL(toggled(bool)),this,SLOT(updateSVWritable(bool)));
  7938. connect(sVOutputAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVWriteAddress(int)));
  7939. connect(pVColumnName,SIGNAL(textEdited(QString)),this,SLOT(updatePVColumnName(QString)));
  7940. connect(sVColumnName,SIGNAL(textEdited(QString)),this,SLOT(updateSVColumnName(QString)));
  7941. connect(pVHideBox,SIGNAL(toggled(bool)),this,SLOT(updatePVHidden(bool)));
  7942. connect(sVHideBox,SIGNAL(toggled(bool)),this,SLOT(updateSVHidden(bool)));
  7943. layout->addWidget(form);
  7944. setLayout(layout);
  7945. }
  7946. void ModbusConfigurator::updatePort(const QString&newPort)
  7947. {
  7948. updateAttribute("port",newPort);
  7949. }
  7950. void ModbusConfigurator::updateBaudRate(const QString&newRate)
  7951. {
  7952. updateAttribute("baud",newRate);
  7953. }
  7954. void ModbusConfigurator::updateParity(const QString&)
  7955. {
  7956. updateAttribute("parity",parity->itemData(parity->currentIndex()).toString());
  7957. }
  7958. void ModbusConfigurator::updateFlowControl(const QString&)
  7959. {
  7960. updateAttribute("flow",flow->itemData(flow->currentIndex()).toString());
  7961. }
  7962. void ModbusConfigurator::updateStopBits(const QString&)
  7963. {
  7964. updateAttribute("stop",stop->itemData(stop->currentIndex()).toString());
  7965. }
  7966. void ModbusConfigurator::updateStation(int station)
  7967. {
  7968. updateAttribute("station",QString("%1").arg(station));
  7969. }
  7970. void ModbusConfigurator::updateFixedDecimal(bool fixed)
  7971. {
  7972. updateAttribute("decimalQuery",fixed?"true":"false");
  7973. }
  7974. void ModbusConfigurator::updateDecimalAddress(int address)
  7975. {
  7976. updateAttribute("decimalAddress",QString("%1").arg(address));
  7977. }
  7978. void ModbusConfigurator::updateDecimalPosition(int position)
  7979. {
  7980. updateAttribute("decimalPosition",QString("%1").arg(position));
  7981. }
  7982. void ModbusConfigurator::updateFixedUnit(bool fixed)
  7983. {
  7984. updateAttribute("unitQuery",fixed?"true":"false");
  7985. }
  7986. void ModbusConfigurator::updateUnitAddress(int address)
  7987. {
  7988. updateAttribute("unitAddress",QString("%1").arg(address));
  7989. }
  7990. void ModbusConfigurator::updateValueForF(int value)
  7991. {
  7992. updateAttribute("valueF",QString("%1").arg(value));
  7993. }
  7994. void ModbusConfigurator::updateValueForC(int value)
  7995. {
  7996. updateAttribute("valueC",QString("%1").arg(value));
  7997. }
  7998. void ModbusConfigurator::updateUnit(const QString&newUnit)
  7999. {
  8000. updateAttribute("fixedUnit",newUnit);
  8001. }
  8002. void ModbusConfigurator::updatePVAddress(int address)
  8003. {
  8004. updateAttribute("pVAddress",QString("%1").arg(address));
  8005. }
  8006. void ModbusConfigurator::updateSVEnabled(bool enabled)
  8007. {
  8008. updateAttribute("sVEnabled",enabled?"true":"false");
  8009. }
  8010. void ModbusConfigurator::updateSVReadAddress(int address)
  8011. {
  8012. updateAttribute("sVReadAddress",QString("%1").arg(address));
  8013. }
  8014. void ModbusConfigurator::updateDeviceLimit(bool query)
  8015. {
  8016. updateAttribute("deviceLimit",query?"true":"false");
  8017. }
  8018. void ModbusConfigurator::updateSVLowerAddress(int address)
  8019. {
  8020. updateAttribute("sVLowerAddr",QString("%1").arg(address));
  8021. }
  8022. void ModbusConfigurator::updateSVUpperAddress(int address)
  8023. {
  8024. updateAttribute("sVUpperAddr",QString("%1").arg(address));
  8025. }
  8026. void ModbusConfigurator::updateSVLower(double value)
  8027. {
  8028. updateAttribute("sVLower",QString("%1").arg(value));
  8029. }
  8030. void ModbusConfigurator::updateSVUpper(double value)
  8031. {
  8032. updateAttribute("sVUpper",QString("%1").arg(value));
  8033. }
  8034. void ModbusConfigurator::updateSVWritable(bool canWriteSV)
  8035. {
  8036. updateAttribute("sVWritable",canWriteSV?"true":"false");
  8037. }
  8038. void ModbusConfigurator::updateSVWriteAddress(int address)
  8039. {
  8040. updateAttribute("sVOutputAddr",QString("%1").arg(address));
  8041. }
  8042. void ModbusConfigurator::updatePVColumnName(const QString&name)
  8043. {
  8044. updateAttribute("pvcolname",name);
  8045. }
  8046. void ModbusConfigurator::updateSVColumnName(const QString&name)
  8047. {
  8048. updateAttribute("svcolname",name);
  8049. }
  8050. void ModbusConfigurator::updatePVHidden(bool hidden)
  8051. {
  8052. updateAttribute("pvhidden",hidden?"true":"false");
  8053. }
  8054. void ModbusConfigurator::updateSVHidden(bool hidden)
  8055. {
  8056. updateAttribute("svhidden",hidden?"true":"false");
  8057. }
  8058. /*:774*/
  8059. #line 576 "./typica.w"
  8060. /*722:*/
  8061. #line 16039 "./typica.w"
  8062. ShortHexSpinBox::ShortHexSpinBox(QWidget*parent):QSpinBox(parent)
  8063. {
  8064. setMinimum(0);
  8065. setMaximum(0xFFFF);
  8066. setPrefix("0x");
  8067. setMinimumWidth(65);
  8068. }
  8069. QValidator::State ShortHexSpinBox::validate(QString&input,int&)const
  8070. {
  8071. if(input.size()==2)
  8072. {
  8073. return QValidator::Intermediate;
  8074. }
  8075. bool okay;
  8076. input.toInt(&okay,16);
  8077. if(okay)
  8078. {
  8079. return QValidator::Acceptable;
  8080. }
  8081. return QValidator::Invalid;
  8082. }
  8083. int ShortHexSpinBox::valueFromText(const QString&text)const
  8084. {
  8085. return text.toInt(NULL,16);
  8086. }
  8087. QString ShortHexSpinBox::textFromValue(int value)const
  8088. {
  8089. QString retval;
  8090. retval.setNum(value,16);
  8091. while(retval.size()<4)
  8092. {
  8093. retval.prepend("0");
  8094. }
  8095. return retval.toUpper();
  8096. }
  8097. /*:722*/
  8098. #line 577 "./typica.w"
  8099. /*759:*/
  8100. #line 17069 "./typica.w"
  8101. ModbusRTUDevice::ModbusRTUDevice(DeviceTreeModel*model,const QModelIndex&index)
  8102. :QObject(NULL),messageDelayTimer(new QTimer),unitIsF(true),readingsv(false),
  8103. waiting(false)
  8104. {
  8105. QDomElement portReferenceElement= model->referenceElement(model->data(index,
  8106. Qt::UserRole).toString());
  8107. QDomNodeList portConfigData= portReferenceElement.elementsByTagName("attribute");
  8108. QDomElement node;
  8109. QVariantMap attributes;
  8110. for(int i= 0;i<portConfigData.size();i++)
  8111. {
  8112. node= portConfigData.at(i).toElement();
  8113. attributes.insert(node.attribute("name"),node.attribute("value"));
  8114. }
  8115. port= new QextSerialPort(attributes.value("port").toString(),
  8116. QextSerialPort::EventDriven);
  8117. int baudRate= attributes.value("baud").toInt();
  8118. port->setBaudRate((BaudRateType)baudRate);
  8119. double temp= ((double)(1)/(double)(baudRate))*48;
  8120. delayTime= (int)(temp*3000);
  8121. messageDelayTimer->setSingleShot(true);
  8122. connect(messageDelayTimer,SIGNAL(timeout()),this,SLOT(sendNextMessage()));
  8123. port->setDataBits(DATA_8);
  8124. port->setParity((ParityType)attributes.value("parity").toInt());
  8125. port->setStopBits((StopBitsType)attributes.value("stop").toInt());
  8126. port->setFlowControl((FlowType)attributes.value("flow").toInt());
  8127. connect(port,SIGNAL(readyRead()),this,SLOT(dataAvailable()));
  8128. port->open(QIODevice::ReadWrite);
  8129. station= (char)attributes.value("station").toInt();
  8130. if(attributes.value("decimalQuery")=="true")
  8131. {
  8132. decimalPosition= 0;
  8133. QByteArray message;
  8134. message.append(station);
  8135. message.append((char)0x03);
  8136. quint16 address= (quint16)attributes.value("decimalAddress").toInt();
  8137. char*addressBytes= (char*)&address;
  8138. message.append(addressBytes[1]);
  8139. message.append(addressBytes[0]);
  8140. message.append((char)0x00);
  8141. message.append((char)0x01);
  8142. queueMessage(message,this,"decimalResponse(QByteArray)");
  8143. }
  8144. else
  8145. {
  8146. decimalPosition= attributes.value("decimalPosition").toInt();
  8147. }
  8148. valueF= attributes.value("valueF").toInt();
  8149. valueC= attributes.value("valueC").toInt();
  8150. if(attributes.value("unitQuery")=="true")
  8151. {
  8152. QByteArray message;
  8153. message.append(station);
  8154. message.append((char)0x03);
  8155. quint16 address= (quint16)attributes.value("unitAddress").toInt();
  8156. char*addressBytes= (char*)&address;
  8157. message.append(addressBytes[1]);
  8158. message.append(addressBytes[0]);
  8159. message.append((char)0x00);
  8160. message.append((char)0x01);
  8161. queueMessage(message,this,"unitResponse(QByteArray)");
  8162. }
  8163. else
  8164. {
  8165. if(attributes.value("fixedUnit")=="Celsius")
  8166. {
  8167. unitIsF= false;
  8168. }
  8169. }
  8170. if(attributes.value("sVWritable")=="true")
  8171. {
  8172. if(attributes.value("deviceLimit")=="true")
  8173. {
  8174. QByteArray lmessage;
  8175. lmessage.append(station);
  8176. lmessage.append((char)0x03);
  8177. quint16 laddress= (quint16)attributes.value("sVLowerAddr").toInt();
  8178. char*addressBytes= (char*)&laddress;
  8179. lmessage.append(addressBytes[1]);
  8180. lmessage.append(addressBytes[0]);
  8181. lmessage.append((char)0x00);
  8182. lmessage.append((char)0x01);
  8183. queueMessage(lmessage,this,"svlResponse(QByteArray)");
  8184. QByteArray umessage;
  8185. umessage.append(station);
  8186. umessage.append((char)0x03);
  8187. quint16 uaddress= (quint16)attributes.value("sVUpperAddr").toInt();
  8188. addressBytes= (char*)&uaddress;
  8189. umessage.append(addressBytes[1]);
  8190. umessage.append(addressBytes[0]);
  8191. umessage.append((char)0x00);
  8192. umessage.append((char)0x01);
  8193. queueMessage(umessage,this,"svuResponse(QByteArray)");
  8194. }
  8195. else
  8196. {
  8197. outputSVLower= attributes.value("sVLower").toDouble();
  8198. outputSVUpper= attributes.value("sVUpper").toDouble();
  8199. }
  8200. outputSVStub.append(station);
  8201. outputSVStub.append((char)0x06);
  8202. quint16 address= (quint16)attributes.value("sVOutputAddr").toInt();
  8203. char*addressBytes= (char*)&address;
  8204. outputSVStub.append(addressBytes[1]);
  8205. outputSVStub.append(addressBytes[0]);
  8206. }
  8207. Channel*pv= new Channel;
  8208. channels.append(pv);
  8209. pvStub.append(station);
  8210. pvStub.append((char)0x04);
  8211. pvaddress= (quint16)attributes.value("pVAddress").toInt();
  8212. char*pvac= (char*)&pvaddress;
  8213. pvStub.append(pvac[1]);
  8214. pvStub.append(pvac[0]);
  8215. pvStub.append((char)0x00);
  8216. pvStub.append((char)0x01);
  8217. svenabled= attributes.value("sVEnabled").toBool();
  8218. if(svenabled)
  8219. {
  8220. Channel*sv= new Channel;
  8221. channels.append(sv);
  8222. svStub.append(station);
  8223. svStub.append((char)0x04);
  8224. svaddress= (quint16)attributes.value("sVReadAddress").toInt();
  8225. char*svac= (char*)&svaddress;
  8226. svStub.append(svac[1]);
  8227. svStub.append(svac[0]);
  8228. svStub.append((char)0x00);
  8229. svStub.append((char)0x01);
  8230. if(svaddress-pvaddress==1)
  8231. {
  8232. mStub.append(station);
  8233. mStub.append((char)0x04);
  8234. mStub.append(pvac[1]);
  8235. mStub.append(pvac[0]);
  8236. mStub.append((char)0x00);
  8237. mStub.append((char)0x02);
  8238. }
  8239. }
  8240. connect(this,SIGNAL(queueEmpty()),this,SLOT(requestMeasurement()));
  8241. requestMeasurement();
  8242. }
  8243. double ModbusRTUDevice::SVLower()
  8244. {
  8245. return outputSVLower;
  8246. }
  8247. double ModbusRTUDevice::SVUpper()
  8248. {
  8249. return outputSVUpper;
  8250. }
  8251. int ModbusRTUDevice::decimals()
  8252. {
  8253. return decimalPosition;
  8254. }
  8255. void ModbusRTUDevice::decimalResponse(QByteArray response)
  8256. {
  8257. quint16 temp;
  8258. char*tchar= (char*)&temp;
  8259. tchar[1]= response.at(3);
  8260. tchar[0]= response.at(4);
  8261. decimalPosition= temp;
  8262. emit SVDecimalChanged(decimalPosition);
  8263. qDebug()<<"Received decimal response";
  8264. }
  8265. void ModbusRTUDevice::unitResponse(QByteArray response)
  8266. {
  8267. quint16 temp;
  8268. char*tchar= (char*)&temp;
  8269. tchar[1]= response.at(3);
  8270. tchar[0]= response.at(4);
  8271. int value= temp;
  8272. if(value==valueF)
  8273. {
  8274. unitIsF= true;
  8275. }
  8276. else
  8277. {
  8278. unitIsF= false;
  8279. }
  8280. }
  8281. void ModbusRTUDevice::svlResponse(QByteArray response)
  8282. {
  8283. quint16 temp;
  8284. char*tchar= (char*)&temp;
  8285. tchar[1]= response.at(3);
  8286. tchar[0]= response.at(4);
  8287. outputSVLower= (double)temp;
  8288. for(int i= 0;i<decimalPosition;i++)
  8289. {
  8290. outputSVLower/= 10;
  8291. }
  8292. emit SVLowerChanged(outputSVLower);
  8293. }
  8294. void ModbusRTUDevice::svuResponse(QByteArray response)
  8295. {
  8296. quint16 temp;
  8297. char*tchar= (char*)&temp;
  8298. tchar[1]= response.at(3);
  8299. tchar[0]= response.at(4);
  8300. outputSVUpper= (double)temp;
  8301. for(int i= 0;i<decimalPosition;i++)
  8302. {
  8303. outputSVUpper/= 10;
  8304. }
  8305. emit SVUpperChanged(outputSVUpper);
  8306. }
  8307. void ModbusRTUDevice::requestMeasurement()
  8308. {
  8309. if(mStub.length()> 0)
  8310. {
  8311. queueMessage(mStub,this,"mResponse(QByteArray)");
  8312. }
  8313. else
  8314. {
  8315. queueMessage(pvStub,this,"mResponse(QByteArray)");
  8316. if(svenabled)
  8317. {
  8318. queueMessage(svStub,this,"mResponse(QByteArray)");
  8319. }
  8320. }
  8321. }
  8322. void ModbusRTUDevice::mResponse(QByteArray response)
  8323. {
  8324. QTime time= QTime::currentTime();
  8325. if(response.at(2)==0x04)
  8326. {
  8327. /*760:*/
  8328. #line 17318 "./typica.w"
  8329. quint16 pv;
  8330. quint16 sv;
  8331. char*pvBytes= (char*)&pv;
  8332. char*svBytes= (char*)&sv;
  8333. pvBytes[1]= response.at(3);
  8334. pvBytes[0]= response.at(4);
  8335. svBytes[1]= response.at(5);
  8336. svBytes[0]= response.at(6);
  8337. double pvOut= (double)pv;
  8338. double svOut= (double)sv;
  8339. for(int i= 0;i<decimalPosition;i++)
  8340. {
  8341. pvOut/= 10;
  8342. svOut/= 10;
  8343. }
  8344. if(!unitIsF)
  8345. {
  8346. pvOut= pvOut*9/5+32;
  8347. svOut= svOut*9/5+32;
  8348. }
  8349. Measurement pvm(pvOut,time,Units::Fahrenheit);
  8350. Measurement svm(svOut,time,Units::Fahrenheit);
  8351. channels.at(0)->input(pvm);
  8352. channels.at(1)->input(svm);
  8353. /*:760*/
  8354. #line 17305 "./typica.w"
  8355. }
  8356. else
  8357. {
  8358. /*761:*/
  8359. #line 17348 "./typica.w"
  8360. quint16 value;
  8361. char*valueBytes= (char*)&value;
  8362. valueBytes[1]= response.at(3);
  8363. valueBytes[0]= response.at(4);
  8364. double valueOut= (double)value;
  8365. for(int i= 0;i<decimalPosition;i++)
  8366. {
  8367. valueOut/= 10;
  8368. }
  8369. if(!unitIsF)
  8370. {
  8371. valueOut= valueOut*9/5+32;
  8372. }
  8373. if(!svenabled)
  8374. {
  8375. Measurement vm(valueOut,time,Units::Fahrenheit);
  8376. channels.at(0)->input(vm);
  8377. }
  8378. else
  8379. {
  8380. if(readingsv)
  8381. {
  8382. Measurement pvm(savedpv,time,Units::Fahrenheit);
  8383. Measurement svm(valueOut,time,Units::Fahrenheit);
  8384. channels.at(0)->input(pvm);
  8385. channels.at(1)->input(svm);
  8386. readingsv= false;
  8387. }
  8388. else
  8389. {
  8390. savedpv= valueOut;
  8391. readingsv= true;
  8392. }
  8393. }
  8394. /*:761*/
  8395. #line 17309 "./typica.w"
  8396. }
  8397. }
  8398. /*:759*//*762:*/
  8399. #line 17386 "./typica.w"
  8400. ModbusRTUDevice::~ModbusRTUDevice()
  8401. {
  8402. messageDelayTimer->stop();
  8403. port->close();
  8404. }
  8405. /*:762*//*763:*/
  8406. #line 17408 "./typica.w"
  8407. void ModbusRTUDevice::dataAvailable()
  8408. {
  8409. if(messageDelayTimer->isActive())
  8410. {
  8411. messageDelayTimer->stop();
  8412. }
  8413. responseBuffer.append(port->readAll());
  8414. /*764:*/
  8415. #line 17453 "./typica.w"
  8416. if(responseBuffer.size()<5)
  8417. {
  8418. return;
  8419. }
  8420. switch(responseBuffer.at(1))
  8421. {
  8422. case 0x01:
  8423. case 0x02:
  8424. if(responseBuffer.size()<6)
  8425. {
  8426. return;
  8427. }
  8428. responseBuffer= responseBuffer.left(6);
  8429. break;
  8430. case 0x03:
  8431. case 0x04:
  8432. if(responseBuffer.size()<5+responseBuffer.at(2))
  8433. {
  8434. return;
  8435. }
  8436. responseBuffer= responseBuffer.left(5+responseBuffer.at(2));
  8437. break;
  8438. case 0x05:
  8439. case 0x06:
  8440. case 0x10:
  8441. if(responseBuffer.size()<8)
  8442. {
  8443. return;
  8444. }
  8445. responseBuffer= responseBuffer.left(8);
  8446. break;
  8447. }
  8448. /*:764*/
  8449. #line 17416 "./typica.w"
  8450. if(calculateCRC(responseBuffer)==0)
  8451. {
  8452. QObject*object= retObjQueue.at(0);
  8453. char*method= callbackQueue.at(0);
  8454. QMetaMethod metamethod= object->metaObject()->
  8455. method(object->metaObject()->
  8456. indexOfMethod(QMetaObject::normalizedSignature(method)));
  8457. metamethod.invoke(object,Qt::QueuedConnection,
  8458. Q_ARG(QByteArray,responseBuffer));
  8459. messageQueue.removeAt(0);
  8460. retObjQueue.removeAt(0);
  8461. callbackQueue.removeAt(0);
  8462. messageDelayTimer->start(delayTime);
  8463. }
  8464. else
  8465. {
  8466. qDebug()<<"CRC failed";
  8467. }
  8468. waiting= false;
  8469. responseBuffer.clear();
  8470. }
  8471. /*:763*//*765:*/
  8472. #line 17495 "./typica.w"
  8473. quint16 ModbusRTUDevice::calculateCRC(QByteArray data)
  8474. {
  8475. quint16 retval= 0xFFFF;
  8476. int i= 0;
  8477. while(i<data.size())
  8478. {
  8479. retval^= 0x00FF&(quint16)data.at(i);
  8480. for(int j= 0;j<8;j++)
  8481. {
  8482. if(retval&1)
  8483. {
  8484. retval= (retval>>1)^0xA001;
  8485. }
  8486. else
  8487. {
  8488. retval>>= 1;
  8489. }
  8490. }
  8491. i++;
  8492. }
  8493. return retval;
  8494. }
  8495. /*:765*//*766:*/
  8496. #line 17526 "./typica.w"
  8497. void ModbusRTUDevice::queueMessage(QByteArray request,QObject*object,
  8498. const char*callback)
  8499. {
  8500. messageQueue.append(request);
  8501. retObjQueue.append(object);
  8502. callbackQueue.append(const_cast<char*> (callback));
  8503. if(messageQueue.size()==1&&!(messageDelayTimer->isActive()))
  8504. {
  8505. sendNextMessage();
  8506. }
  8507. }
  8508. void ModbusRTUDevice::sendNextMessage()
  8509. {
  8510. if(messageQueue.size()> 0&&!waiting)
  8511. {
  8512. QByteArray message= messageQueue.at(0);
  8513. quint16 crc= calculateCRC(message);
  8514. char*check= (char*)&crc;
  8515. message.append(check[0]);
  8516. message.append(check[1]);
  8517. port->write(message);
  8518. messageDelayTimer->start(delayTime);
  8519. waiting= true;
  8520. }
  8521. else
  8522. {
  8523. emit queueEmpty();
  8524. }
  8525. }
  8526. void ModbusRTUDevice::outputSV(double value)
  8527. {
  8528. for(int i= 0;i<decimalPosition;i++)
  8529. {
  8530. value*= 10;
  8531. }
  8532. quint16 outval= (quint16)value;
  8533. QByteArray message(outputSVStub);
  8534. char*valBytes= (char*)&outval;
  8535. message.append(valBytes[1]);
  8536. message.append(valBytes[0]);
  8537. queueMessage(message,this,"ignore(QByteArray)");
  8538. }
  8539. /*:766*//*767:*/
  8540. #line 17574 "./typica.w"
  8541. void ModbusRTUDevice::ignore(QByteArray)
  8542. {
  8543. return;
  8544. }
  8545. /*:767*/
  8546. #line 578 "./typica.w"
  8547. /*641:*/
  8548. #line 14232 "./typica.w"
  8549. DeviceTreeModelNode::DeviceTreeModelNode(QDomNode&node,int row,
  8550. DeviceTreeModelNode*parent)
  8551. :domNode(node),rowNumber(row),parentItem(parent)
  8552. {
  8553. }
  8554. DeviceTreeModelNode::~DeviceTreeModelNode()
  8555. {
  8556. QHash<int,DeviceTreeModelNode*> ::iterator i;
  8557. for(i= children.begin();i!=children.end();i++)
  8558. {
  8559. delete i.value();
  8560. }
  8561. }
  8562. DeviceTreeModelNode*DeviceTreeModelNode::parent()
  8563. {
  8564. return parentItem;
  8565. }
  8566. int DeviceTreeModelNode::row()
  8567. {
  8568. return rowNumber;
  8569. }
  8570. QDomNode DeviceTreeModelNode::node()const
  8571. {
  8572. return domNode;
  8573. }
  8574. DeviceTreeModelNode*DeviceTreeModelNode::child(int index)
  8575. {
  8576. if(children.contains(index))
  8577. {
  8578. return children[index];
  8579. }
  8580. if(index>=0&&index<domNode.childNodes().count())
  8581. {
  8582. QDomNode childNode= domNode.childNodes().item(index);
  8583. DeviceTreeModelNode*childItem= new DeviceTreeModelNode(childNode,
  8584. index,this);
  8585. children[index]= childItem;
  8586. return childItem;
  8587. }
  8588. return NULL;
  8589. }
  8590. /*:641*/
  8591. #line 579 "./typica.w"
  8592. /*643:*/
  8593. #line 14321 "./typica.w"
  8594. DeviceTreeModel::DeviceTreeModel(QObject*parent)
  8595. :QAbstractItemModel(parent)
  8596. {
  8597. document= AppInstance->deviceConfiguration();
  8598. QDomNodeList elements= document.elementsByTagName("devices");
  8599. if(elements.size()!=1)
  8600. {
  8601. qDebug()<<"Unexpected result when loading device map.";
  8602. }
  8603. treeRoot= elements.at(0);
  8604. root= new DeviceTreeModelNode(treeRoot,0);
  8605. elements= document.elementsByTagName("references");
  8606. if(elements.size()!=1)
  8607. {
  8608. qDebug()<<"No references section. Creating.";
  8609. referenceSection= document.createElement("references");
  8610. document.appendChild(referenceSection);
  8611. }
  8612. else
  8613. {
  8614. referenceSection= elements.at(0);
  8615. }
  8616. connect(this,SIGNAL(dataChanged(QModelIndex,QModelIndex)),
  8617. AppInstance,SLOT(saveDeviceConfiguration()));
  8618. connect(this,SIGNAL(modelReset()),
  8619. AppInstance,SLOT(saveDeviceConfiguration()));
  8620. connect(this,SIGNAL(rowsInserted(QModelIndex,int,int)),
  8621. AppInstance,SLOT(saveDeviceConfiguration()));
  8622. }
  8623. /*:643*//*644:*/
  8624. #line 14356 "./typica.w"
  8625. int DeviceTreeModel::columnCount(const QModelIndex&)const
  8626. {
  8627. return 1;
  8628. }
  8629. int DeviceTreeModel::rowCount(const QModelIndex&parent)const
  8630. {
  8631. if(parent.column()> 0)
  8632. {
  8633. return 0;
  8634. }
  8635. /*645:*/
  8636. #line 14375 "./typica.w"
  8637. DeviceTreeModelNode*parentItem;
  8638. if(!parent.isValid())
  8639. {
  8640. parentItem= root;
  8641. }
  8642. else
  8643. {
  8644. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  8645. }
  8646. /*:645*/
  8647. #line 14368 "./typica.w"
  8648. return parentItem->node().childNodes().count();
  8649. }
  8650. /*:644*//*646:*/
  8651. #line 14389 "./typica.w"
  8652. QModelIndex DeviceTreeModel::index(int row,int column,
  8653. const QModelIndex&parent)const
  8654. {
  8655. if(!hasIndex(row,column,parent))
  8656. {
  8657. return QModelIndex();
  8658. }
  8659. /*645:*/
  8660. #line 14375 "./typica.w"
  8661. DeviceTreeModelNode*parentItem;
  8662. if(!parent.isValid())
  8663. {
  8664. parentItem= root;
  8665. }
  8666. else
  8667. {
  8668. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  8669. }
  8670. /*:645*/
  8671. #line 14397 "./typica.w"
  8672. DeviceTreeModelNode*childItem= parentItem->child(row);
  8673. if(childItem)
  8674. {
  8675. return createIndex(row,column,childItem);
  8676. }
  8677. return QModelIndex();
  8678. }
  8679. /*:646*//*647:*/
  8680. #line 14408 "./typica.w"
  8681. QModelIndex DeviceTreeModel::parent(const QModelIndex&child)const
  8682. {
  8683. if(!child.isValid())
  8684. {
  8685. return QModelIndex();
  8686. }
  8687. DeviceTreeModelNode*childItem=
  8688. static_cast<DeviceTreeModelNode*> (child.internalPointer());
  8689. DeviceTreeModelNode*parentItem= childItem->parent();
  8690. if(!parentItem||parentItem==root)
  8691. {
  8692. return QModelIndex();
  8693. }
  8694. return createIndex(parentItem->row(),0,parentItem);
  8695. }
  8696. /*:647*//*648:*/
  8697. #line 14427 "./typica.w"
  8698. Qt::ItemFlags DeviceTreeModel::flags(const QModelIndex&index)const
  8699. {
  8700. if(!index.isValid())
  8701. {
  8702. return 0;
  8703. }
  8704. return Qt::ItemIsEnabled|Qt::ItemIsSelectable|Qt::ItemIsEditable;
  8705. }
  8706. /*:648*//*649:*/
  8707. #line 14442 "./typica.w"
  8708. QVariant DeviceTreeModel::data(const QModelIndex&index,int role)const
  8709. {
  8710. if(!index.isValid())
  8711. {
  8712. return QVariant();
  8713. }
  8714. if(role!=Qt::DisplayRole&&role!=Qt::UserRole&&role!=Qt::EditRole)
  8715. {
  8716. return QVariant();
  8717. }
  8718. DeviceTreeModelNode*item=
  8719. static_cast<DeviceTreeModelNode*> (index.internalPointer());
  8720. QDomNode node= item->node();
  8721. QDomElement element= node.toElement();
  8722. switch(role)
  8723. {
  8724. case Qt::DisplayRole:
  8725. case Qt::EditRole:
  8726. return QVariant(element.attribute("name"));
  8727. case Qt::UserRole:
  8728. return QVariant(element.attribute("reference"));
  8729. default:
  8730. return QVariant();
  8731. }
  8732. return QVariant();
  8733. }
  8734. /*:649*//*650:*/
  8735. #line 14474 "./typica.w"
  8736. bool DeviceTreeModel::setData(const QModelIndex&index,
  8737. const QVariant&value,int)
  8738. {
  8739. if(!index.isValid())
  8740. {
  8741. return false;
  8742. }
  8743. DeviceTreeModelNode*item=
  8744. static_cast<DeviceTreeModelNode*> (index.internalPointer());
  8745. QDomNode node= item->node();
  8746. QDomElement element= node.toElement();
  8747. element.setAttribute("name",value.toString());
  8748. emit dataChanged(index,index);
  8749. return true;
  8750. }
  8751. /*:650*//*651:*/
  8752. #line 14497 "./typica.w"
  8753. void DeviceTreeModel::newNode(const QString&name,const QString&driver,
  8754. const QModelIndex&parent)
  8755. {
  8756. QString referenceID= QUuid::createUuid().toString();
  8757. /*645:*/
  8758. #line 14375 "./typica.w"
  8759. DeviceTreeModelNode*parentItem;
  8760. if(!parent.isValid())
  8761. {
  8762. parentItem= root;
  8763. }
  8764. else
  8765. {
  8766. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  8767. }
  8768. /*:645*/
  8769. #line 14502 "./typica.w"
  8770. QDomNode parentNode= parentItem->node();
  8771. int newRowNumber= rowCount(parent);
  8772. beginInsertRows(parent,newRowNumber,newRowNumber);
  8773. QDomElement deviceElement= document.createElement("node");
  8774. deviceElement.setAttribute("name",name);
  8775. deviceElement.setAttribute("reference",referenceID);
  8776. parentNode.appendChild(deviceElement);
  8777. QDomElement referenceElement= document.createElement("reference");
  8778. referenceElement.setAttribute("id",referenceID);
  8779. referenceElement.setAttribute("driver",driver);
  8780. referenceSection.appendChild(referenceElement);
  8781. endInsertRows();
  8782. }
  8783. /*:651*//*652:*/
  8784. #line 14520 "./typica.w"
  8785. bool DeviceTreeModel::removeRows(int row,int count,const QModelIndex&parent)
  8786. {
  8787. /*645:*/
  8788. #line 14375 "./typica.w"
  8789. DeviceTreeModelNode*parentItem;
  8790. if(!parent.isValid())
  8791. {
  8792. parentItem= root;
  8793. }
  8794. else
  8795. {
  8796. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  8797. }
  8798. /*:645*/
  8799. #line 14523 "./typica.w"
  8800. QDomNode parentNode= parentItem->node();
  8801. QDomNodeList childNodes= parentNode.childNodes();
  8802. if(childNodes.size()<row+count)
  8803. {
  8804. return false;
  8805. }
  8806. beginRemoveRows(parent,row,row+count-1);
  8807. QList<QDomElement> removalList;
  8808. for(int i= row;i<row+count;i++)
  8809. {
  8810. removalList.append(childNodes.at(i).toElement());
  8811. }
  8812. QDomElement element;
  8813. QDomElement reference;
  8814. for(int i= 0;i<count;i++)
  8815. {
  8816. element= removalList.at(i);
  8817. if(element.hasAttribute("reference"))
  8818. {
  8819. reference= referenceElement(element.attribute("reference"));
  8820. if(!reference.isNull())
  8821. {
  8822. referenceSection.removeChild(reference);
  8823. }
  8824. }
  8825. parentNode.removeChild(element);
  8826. }
  8827. endRemoveRows();
  8828. beginResetModel();
  8829. delete root;
  8830. root= new DeviceTreeModelNode(treeRoot,0);
  8831. endResetModel();
  8832. return true;
  8833. }
  8834. /*:652*//*653:*/
  8835. #line 14562 "./typica.w"
  8836. QDomElement DeviceTreeModel::referenceElement(const QString&id)
  8837. {
  8838. QDomNodeList childNodes= referenceSection.childNodes();
  8839. QDomElement element;
  8840. for(int i= 0;i<childNodes.size();i++)
  8841. {
  8842. element= childNodes.at(i).toElement();
  8843. if(element.hasAttribute("id"))
  8844. {
  8845. if(element.attribute("id")==id)
  8846. {
  8847. return element;
  8848. }
  8849. }
  8850. }
  8851. return QDomElement();
  8852. }
  8853. /*:653*//*654:*/
  8854. #line 14583 "./typica.w"
  8855. QVariant DeviceTreeModel::headerData(int,Qt::Orientation,int)const
  8856. {
  8857. return QVariant();
  8858. }
  8859. /*:654*//*655:*/
  8860. #line 14592 "./typica.w"
  8861. DeviceTreeModel::~DeviceTreeModel()
  8862. {
  8863. delete root;
  8864. }
  8865. /*:655*/
  8866. #line 580 "./typica.w"
  8867. /*682:*/
  8868. #line 15091 "./typica.w"
  8869. BasicDeviceConfigurationWidget::BasicDeviceConfigurationWidget(
  8870. DeviceTreeModel*model,const QModelIndex&index)
  8871. :QWidget(NULL),deviceModel(model),currentNode(index)
  8872. {
  8873. }
  8874. /*:682*//*683:*/
  8875. #line 15103 "./typica.w"
  8876. void BasicDeviceConfigurationWidget::updateAttribute(const QString&name,
  8877. const QString&value)
  8878. {
  8879. QDomElement referenceElement= deviceModel->referenceElement(
  8880. deviceModel->data(currentNode,Qt::UserRole).toString());
  8881. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8882. QDomElement node;
  8883. bool found= false;
  8884. for(int i= 0;i<configData.size();i++)
  8885. {
  8886. node= configData.at(i).toElement();
  8887. if(node.attribute("name")==name)
  8888. {
  8889. node.setAttribute("value",value);
  8890. found= true;
  8891. break;
  8892. }
  8893. }
  8894. if(!found)
  8895. {
  8896. node= AppInstance->deviceConfiguration().createElement("attribute");
  8897. node.setAttribute("name",name);
  8898. node.setAttribute("value",value);
  8899. referenceElement.appendChild(node);
  8900. }
  8901. AppInstance->saveDeviceConfiguration();
  8902. }
  8903. /*:683*//*684:*/
  8904. #line 15137 "./typica.w"
  8905. void BasicDeviceConfigurationWidget::insertChildNode(const QString&name,
  8906. const QString&driver)
  8907. {
  8908. deviceModel->newNode(name,driver,currentNode);
  8909. }
  8910. /*:684*/
  8911. #line 581 "./typica.w"
  8912. /*673:*/
  8913. #line 14936 "./typica.w"
  8914. DeviceConfigurationWindow::DeviceConfigurationWindow():QWidget(NULL),
  8915. view(new QTreeView),configArea(new QScrollArea)
  8916. {
  8917. QSplitter*splitter= new QSplitter;
  8918. QWidget*leftWidget= new QWidget;
  8919. leftWidget->setMinimumWidth(200);
  8920. QVBoxLayout*left= new QVBoxLayout;
  8921. view->setAnimated(true);
  8922. view->setSelectionMode(QAbstractItemView::SingleSelection);
  8923. document= AppInstance->deviceConfiguration();
  8924. model= new DeviceTreeModel;
  8925. view->setModel(model);
  8926. view->setTextElideMode(Qt::ElideNone);
  8927. view->expandAll();
  8928. view->resizeColumnToContents(0);
  8929. connect(model,SIGNAL(modelReset()),view,SLOT(expandAll()));
  8930. QHBoxLayout*treeButtons= new QHBoxLayout;
  8931. QToolButton*addDeviceButton= new QToolButton;
  8932. addDeviceButton->setIcon(QIcon::fromTheme("list-add"));
  8933. addDeviceButton->setToolTip(tr("New Roaster"));
  8934. connect(addDeviceButton,SIGNAL(clicked()),
  8935. this,SLOT(addDevice()));
  8936. QToolButton*removeNodeButton= new QToolButton;
  8937. removeNodeButton->setIcon(QIcon::fromTheme("list-remove"));
  8938. removeNodeButton->setToolTip(tr("Delete Selection"));
  8939. connect(removeNodeButton,SIGNAL(clicked()),this,SLOT(removeNode()));
  8940. treeButtons->addWidget(addDeviceButton);
  8941. treeButtons->addWidget(removeNodeButton);
  8942. left->addWidget(view);
  8943. left->addLayout(treeButtons);
  8944. leftWidget->setLayout(left);
  8945. splitter->addWidget(leftWidget);
  8946. configArea->setMinimumWidth(580);
  8947. configArea->setMinimumHeight(460);
  8948. splitter->addWidget(configArea);
  8949. QVBoxLayout*centralLayout= new QVBoxLayout;
  8950. centralLayout->addWidget(splitter);
  8951. setLayout(centralLayout);
  8952. connect(view,SIGNAL(activated(QModelIndex)),
  8953. this,SLOT(newSelection(QModelIndex)));
  8954. connect(view,SIGNAL(clicked(QModelIndex)),
  8955. this,SLOT(newSelection(QModelIndex)));
  8956. connect(model,SIGNAL(rowsInserted(QModelIndex,int,int)),
  8957. view,SLOT(expand(QModelIndex)));
  8958. connect(model,SIGNAL(rowsInserted(QModelIndex,int,int)),
  8959. this,SLOT(resizeColumn()));
  8960. connect(model,SIGNAL(rowsRemoved(QModelIndex,int,int)),
  8961. this,SLOT(resizeColumn()));
  8962. }
  8963. /*:673*//*674:*/
  8964. #line 14990 "./typica.w"
  8965. void DeviceConfigurationWindow::addDevice()
  8966. {
  8967. model->newNode(tr("New Roaster"),"roaster",QModelIndex());
  8968. }
  8969. /*:674*//*675:*/
  8970. #line 14998 "./typica.w"
  8971. void DeviceConfigurationWindow::removeNode()
  8972. {
  8973. QModelIndex index= view->currentIndex();
  8974. if(index.isValid())
  8975. {
  8976. int row= index.row();
  8977. QModelIndex parent= index.parent();
  8978. model->removeRow(row,parent);
  8979. }
  8980. }
  8981. /*:675*//*676:*/
  8982. #line 15014 "./typica.w"
  8983. void DeviceConfigurationWindow::newSelection(const QModelIndex&index)
  8984. {
  8985. QWidget*editor= AppInstance->deviceConfigurationWidget(model,index);
  8986. if(editor)
  8987. {
  8988. configArea->setWidget(editor);
  8989. editor->show();
  8990. }
  8991. }
  8992. /*:676*//*677:*/
  8993. #line 15031 "./typica.w"
  8994. void DeviceConfigurationWindow::resizeColumn()
  8995. {
  8996. view->resizeColumnToContents(0);
  8997. }
  8998. /*:677*/
  8999. #line 582 "./typica.w"
  9000. /*697:*/
  9001. #line 15442 "./typica.w"
  9002. Ni9211TcConfWidget::Ni9211TcConfWidget(DeviceTreeModel*model,
  9003. const QModelIndex&index):
  9004. BasicDeviceConfigurationWidget(model,index)
  9005. {
  9006. QFormLayout*layout= new QFormLayout;
  9007. QLineEdit*columnName= new QLineEdit;
  9008. layout->addRow(tr("Column Name:"),columnName);
  9009. QComboBox*typeSelector= new QComboBox;
  9010. typeSelector->addItem("J");
  9011. typeSelector->addItem("K");
  9012. typeSelector->addItem("T");
  9013. typeSelector->addItem("B");
  9014. typeSelector->addItem("E");
  9015. typeSelector->addItem("N");
  9016. typeSelector->addItem("R");
  9017. typeSelector->addItem("S");
  9018. layout->addRow(tr("Thermocouple Type:"),typeSelector);
  9019. QCheckBox*hideSeries= new QCheckBox("Hide this channel");
  9020. layout->addRow(hideSeries);
  9021. setLayout(layout);
  9022. /*687:*/
  9023. #line 15251 "./typica.w"
  9024. QDomElement referenceElement=
  9025. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9026. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9027. QDomElement node;
  9028. /*:687*/
  9029. #line 15463 "./typica.w"
  9030. for(int i= 0;i<configData.size();i++)
  9031. {
  9032. node= configData.at(i).toElement();
  9033. if(node.attribute("name")=="type")
  9034. {
  9035. typeSelector->setCurrentIndex(
  9036. typeSelector->findText(node.attribute("value")));
  9037. }
  9038. else if(node.attribute("name")=="columnname")
  9039. {
  9040. columnName->setText(node.attribute("value"));
  9041. }
  9042. else if(node.attribute("name")=="hidden")
  9043. {
  9044. hideSeries->setChecked(node.attribute("value")=="true");
  9045. }
  9046. }
  9047. updateThermocoupleType(typeSelector->currentText());
  9048. updateColumnName(columnName->text());
  9049. updateHidden(hideSeries->isChecked());
  9050. connect(typeSelector,SIGNAL(currentIndexChanged(QString)),
  9051. this,SLOT(updateThermocoupleType(QString)));
  9052. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  9053. connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  9054. }
  9055. /*:697*//*698:*/
  9056. #line 15493 "./typica.w"
  9057. void Ni9211TcConfWidget::updateThermocoupleType(const QString&type)
  9058. {
  9059. updateAttribute("type",type);
  9060. }
  9061. void Ni9211TcConfWidget::updateColumnName(const QString&name)
  9062. {
  9063. updateAttribute("columnname",name);
  9064. }
  9065. void Ni9211TcConfWidget::updateHidden(bool hidden)
  9066. {
  9067. updateAttribute("hidden",hidden?"true":"false");
  9068. }
  9069. /*:698*/
  9070. #line 583 "./typica.w"
  9071. /*693:*/
  9072. #line 15356 "./typica.w"
  9073. NiDaqMxBase9211ConfWidget::NiDaqMxBase9211ConfWidget(DeviceTreeModel*model,
  9074. const QModelIndex&index)
  9075. :BasicDeviceConfigurationWidget(model,index)
  9076. {
  9077. QVBoxLayout*layout= new QVBoxLayout;
  9078. QHBoxLayout*deviceIdLayout= new QHBoxLayout;
  9079. QLabel*label= new QLabel(tr("Device ID:"));
  9080. QLineEdit*deviceId= new QLineEdit;
  9081. deviceIdLayout->addWidget(label);
  9082. deviceIdLayout->addWidget(deviceId);
  9083. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  9084. layout->addLayout(deviceIdLayout);
  9085. layout->addWidget(addChannelButton);
  9086. /*687:*/
  9087. #line 15251 "./typica.w"
  9088. QDomElement referenceElement=
  9089. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9090. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9091. QDomElement node;
  9092. /*:687*/
  9093. #line 15370 "./typica.w"
  9094. for(int i= 0;i<configData.size();i++)
  9095. {
  9096. node= configData.at(i).toElement();
  9097. if(node.attribute("name")=="deviceID")
  9098. {
  9099. deviceId->setText(node.attribute("value","Dev1"));
  9100. break;
  9101. }
  9102. }
  9103. updateDeviceId(deviceId->text());
  9104. connect(addChannelButton,SIGNAL(clicked()),
  9105. this,SLOT(addChannel()));
  9106. connect(deviceId,SIGNAL(textEdited(QString)),
  9107. this,SLOT(updateDeviceId(QString)));
  9108. setLayout(layout);
  9109. }
  9110. /*:693*//*694:*/
  9111. #line 15392 "./typica.w"
  9112. void NiDaqMxBase9211ConfWidget::updateDeviceId(const QString&newId)
  9113. {
  9114. updateAttribute("deviceID",newId);
  9115. }
  9116. /*:694*//*695:*/
  9117. #line 15400 "./typica.w"
  9118. void NiDaqMxBase9211ConfWidget::addChannel()
  9119. {
  9120. insertChildNode(tr("Thermocouple channel"),"ni9211seriestc");
  9121. }
  9122. /*:695*/
  9123. #line 584 "./typica.w"
  9124. /*691:*/
  9125. #line 15307 "./typica.w"
  9126. NiDaqMxBaseDriverConfWidget::NiDaqMxBaseDriverConfWidget(
  9127. DeviceTreeModel*model,const QModelIndex&index):
  9128. BasicDeviceConfigurationWidget(model,index)
  9129. {
  9130. QHBoxLayout*layout= new QHBoxLayout;
  9131. QToolButton*addDeviceButton= new QToolButton;
  9132. addDeviceButton->setText(tr("Add Device"));
  9133. NodeInserter*add9211= new NodeInserter("NI USB 9211","NI USB 9211",
  9134. "nidaqmxbase9211series");
  9135. NodeInserter*add9211a= new NodeInserter("NI USB 9211A","NI USB 9211A",
  9136. "nidaqmxbase9211series");
  9137. connect(add9211,SIGNAL(triggered(QString,QString)),
  9138. this,SLOT(insertChildNode(QString,QString)));
  9139. connect(add9211a,SIGNAL(triggered(QString,QString)),
  9140. this,SLOT(insertChildNode(QString,QString)));
  9141. QMenu*deviceMenu= new QMenu;
  9142. deviceMenu->addAction(add9211);
  9143. deviceMenu->addAction(add9211a);
  9144. addDeviceButton->setMenu(deviceMenu);
  9145. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  9146. layout->addWidget(addDeviceButton);
  9147. setLayout(layout);
  9148. }
  9149. /*:691*/
  9150. #line 585 "./typica.w"
  9151. /*579:*/
  9152. #line 12856 "./typica.w"
  9153. ReportAction::ReportAction(const QString&fileName,const QString&reportName,
  9154. QObject*parent):
  9155. QAction(reportName,parent),reportFile(fileName)
  9156. {
  9157. connect(this,SIGNAL(triggered()),this,SLOT(createReport()));
  9158. }
  9159. /*:579*//*580:*/
  9160. #line 12872 "./typica.w"
  9161. void ReportAction::createReport()
  9162. {
  9163. QFile file(reportFile);
  9164. QDomDocument document;
  9165. if(file.open(QIODevice::ReadOnly))
  9166. {
  9167. document.setContent(&file,true);
  9168. QDomElement element= document.documentElement();
  9169. QScriptEngine*engine= AppInstance->engine;
  9170. QScriptContext*context= engine->pushContext();
  9171. QScriptValue object;
  9172. QString targetID= reportFile;
  9173. /*157:*/
  9174. #line 3806 "./typica.w"
  9175. ScriptQMainWindow*window= new ScriptQMainWindow;
  9176. window->setObjectName(targetID);
  9177. object= engine->newQObject(window);
  9178. setQMainWindowProperties(object,engine);
  9179. QWidget*central= new(QWidget);
  9180. central->setParent(window);
  9181. central->setObjectName("centralWidget");
  9182. window->setCentralWidget(central);
  9183. if(element.hasChildNodes())
  9184. {
  9185. /*158:*/
  9186. #line 3841 "./typica.w"
  9187. QStack<QWidget*> widgetStack;
  9188. QStack<QLayout*> layoutStack;
  9189. QString windowScript;
  9190. widgetStack.push(central);
  9191. QDomNodeList windowChildren= element.childNodes();
  9192. int i= 0;
  9193. while(i<windowChildren.count())
  9194. {
  9195. QDomNode current;
  9196. QDomElement element;
  9197. current= windowChildren.at(i);
  9198. if(current.isElement())
  9199. {
  9200. element= current.toElement();
  9201. if(element.tagName()=="program")
  9202. {
  9203. windowScript.append(element.text());
  9204. }
  9205. else if(element.tagName()=="layout")
  9206. {
  9207. addLayoutToWidget(element,&widgetStack,&layoutStack);
  9208. }
  9209. else if(element.tagName()=="menu")
  9210. {
  9211. /*159:*/
  9212. #line 3888 "./typica.w"
  9213. QMenuBar*bar= window->menuBar();
  9214. bar->setParent(window);
  9215. bar->setObjectName("menuBar");
  9216. if(element.hasAttribute("name"))
  9217. {
  9218. QMenu*menu= bar->addMenu(element.attribute("name"));
  9219. menu->setParent(bar);
  9220. if(element.hasAttribute("type"))
  9221. {
  9222. if(element.attribute("type")=="reports")
  9223. {
  9224. if(element.hasAttribute("src"))
  9225. {
  9226. /*577:*/
  9227. #line 12816 "./typica.w"
  9228. QSettings settings;
  9229. QString reportDirectory= QString("%1/%2").arg(settings.value("config").
  9230. toString()).
  9231. arg(element.attribute("src"));
  9232. QDir::addSearchPath("reports",reportDirectory);
  9233. QDir directory(reportDirectory);
  9234. directory.setFilter(QDir::Files);
  9235. directory.setSorting(QDir::Name);
  9236. QStringList nameFilter;
  9237. nameFilter<<"*.xml";
  9238. directory.setNameFilters(nameFilter);
  9239. QFileInfoList reportFiles= directory.entryInfoList();
  9240. for(int i= 0;i<reportFiles.size();i++)
  9241. {
  9242. QFileInfo reportFile= reportFiles.at(i);
  9243. /*581:*/
  9244. #line 12896 "./typica.w"
  9245. QString path= reportFile.absoluteFilePath();
  9246. QFile file(path);
  9247. if(file.open(QIODevice::ReadOnly))
  9248. {
  9249. QDomDocument document;
  9250. document.setContent(&file,true);
  9251. QDomElement root= document.documentElement();
  9252. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  9253. if(!titleNode.isNull())
  9254. {
  9255. QDomElement titleElement= titleNode.toElement();
  9256. QString title= titleElement.text();
  9257. if(!title.isEmpty())
  9258. {
  9259. QStringList hierarchy= title.split(":->");
  9260. QMenu*insertionPoint= menu;
  9261. /*582:*/
  9262. #line 12923 "./typica.w"
  9263. for(int j= 0;j<hierarchy.size()-1;j++)
  9264. {
  9265. QObjectList menuList= insertionPoint->children();
  9266. bool menuFound= false;
  9267. for(int k= 0;k<menuList.size();k++)
  9268. {
  9269. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  9270. if(currentItem)
  9271. {
  9272. if(currentItem->title()==hierarchy.at(j))
  9273. {
  9274. menuFound= true;
  9275. insertionPoint= currentItem;
  9276. break;
  9277. }
  9278. }
  9279. }
  9280. if(!menuFound)
  9281. {
  9282. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  9283. }
  9284. }
  9285. /*:582*/
  9286. #line 12913 "./typica.w"
  9287. ReportAction*action= new ReportAction(path,hierarchy.last());
  9288. insertionPoint->addAction(action);
  9289. }
  9290. }
  9291. }
  9292. /*:581*/
  9293. #line 12832 "./typica.w"
  9294. }
  9295. /*:577*/
  9296. #line 3902 "./typica.w"
  9297. }
  9298. }
  9299. }
  9300. if(element.hasChildNodes())
  9301. {
  9302. /*160:*/
  9303. #line 3915 "./typica.w"
  9304. QDomNodeList menuItems= element.childNodes();
  9305. int j= 0;
  9306. while(j<menuItems.count())
  9307. {
  9308. QDomNode item= menuItems.at(j);
  9309. if(item.isElement())
  9310. {
  9311. QDomElement itemElement= item.toElement();
  9312. if(itemElement.tagName()=="item")
  9313. {
  9314. QAction*itemAction= new QAction(itemElement.text(),menu);
  9315. if(itemElement.hasAttribute("id"))
  9316. {
  9317. itemAction->setObjectName(itemElement.attribute("id"));
  9318. }
  9319. if(itemElement.hasAttribute("shortcut"))
  9320. {
  9321. itemAction->setShortcut(itemElement.attribute("shortcut"));
  9322. }
  9323. menu->addAction(itemAction);
  9324. }
  9325. else if(itemElement.tagName()=="separator")
  9326. {
  9327. menu->addSeparator();
  9328. }
  9329. }
  9330. j++;
  9331. }
  9332. #line 1 "./helpmenu.w"
  9333. /*:160*/
  9334. #line 3908 "./typica.w"
  9335. }
  9336. }
  9337. /*:159*/
  9338. #line 3866 "./typica.w"
  9339. }
  9340. }
  9341. i++;
  9342. }
  9343. QScriptValue oldThis= context->thisObject();
  9344. context->setThisObject(object);
  9345. QScriptValue result= engine->evaluate(windowScript);
  9346. /*151:*/
  9347. #line 3623 "./typica.w"
  9348. if(engine->hasUncaughtException())
  9349. {
  9350. int line= engine->uncaughtExceptionLineNumber();
  9351. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  9352. result.toString();
  9353. QString trace;
  9354. foreach(trace,engine->uncaughtExceptionBacktrace())
  9355. {
  9356. qDebug()<<trace;
  9357. }
  9358. }
  9359. /*:151*/
  9360. #line 3874 "./typica.w"
  9361. context->setThisObject(oldThis);
  9362. /*:158*/
  9363. #line 3817 "./typica.w"
  9364. }
  9365. /*161:*/
  9366. #line 9 "./helpmenu.w"
  9367. HelpMenu*helpMenu= new HelpMenu();
  9368. window->menuBar()->addMenu(helpMenu);
  9369. /*:161*/
  9370. #line 3819 "./typica.w"
  9371. window->show();
  9372. /*:157*/
  9373. #line 12885 "./typica.w"
  9374. file.close();
  9375. engine->popContext();
  9376. }
  9377. }
  9378. /*:580*/
  9379. #line 586 "./typica.w"
  9380. /*193:*/
  9381. #line 4980 "./typica.w"
  9382. NumericDelegate::NumericDelegate(QObject*parent):
  9383. QItemDelegate(parent)
  9384. {
  9385. }
  9386. /*:193*//*194:*/
  9387. #line 4992 "./typica.w"
  9388. void NumericDelegate::setEditorData(QWidget*editor,
  9389. const QModelIndex&index)const
  9390. {
  9391. QString value= index.model()->data(index,Qt::EditRole).toString();
  9392. QLineEdit*line= static_cast<QLineEdit*> (editor);
  9393. line->setText(value);
  9394. }
  9395. /*:194*//*195:*/
  9396. #line 5007 "./typica.w"
  9397. void NumericDelegate::setModelData(QWidget*editor,QAbstractItemModel*model,
  9398. const QModelIndex&index)const
  9399. {
  9400. QLineEdit*line= static_cast<QLineEdit*> (editor);
  9401. model->setData(index,line->text(),Qt::EditRole);
  9402. QScriptEngine*engine= AppInstance->engine;
  9403. engine->pushContext();
  9404. QString script= QString("Number(%1)").arg(line->text());
  9405. QScriptValue result= engine->evaluate(line->text());
  9406. if(result.isNumber())
  9407. {
  9408. model->setData(index,result.toVariant(),Qt::DisplayRole);
  9409. }
  9410. else
  9411. {
  9412. model->setData(index,QVariant(),Qt::DisplayRole);
  9413. }
  9414. engine->popContext();
  9415. }
  9416. /*:195*//*196:*/
  9417. #line 5030 "./typica.w"
  9418. QWidget*NumericDelegate::createEditor(QWidget*parent,
  9419. const QStyleOptionViewItem&,
  9420. const QModelIndex&)const
  9421. {
  9422. return(new QLineEdit(parent));
  9423. }
  9424. /*:196*//*197:*/
  9425. #line 5041 "./typica.w"
  9426. void NumericDelegate::updateEditorGeometry(QWidget*editor,
  9427. const QStyleOptionViewItem&option,
  9428. const QModelIndex&)const
  9429. {
  9430. editor->setGeometry(option.rect);
  9431. }
  9432. /*:197*/
  9433. #line 587 "./typica.w"
  9434. /*702:*/
  9435. #line 15552 "./typica.w"
  9436. NiDaqMxDriverConfWidget::NiDaqMxDriverConfWidget(DeviceTreeModel*model,
  9437. const QModelIndex&index)
  9438. :BasicDeviceConfigurationWidget(model,index)
  9439. {
  9440. QHBoxLayout*layout= new QHBoxLayout;
  9441. QToolButton*addDeviceButton= new QToolButton;
  9442. addDeviceButton->setText(tr("Add Device"));
  9443. NodeInserter*add9211a= new NodeInserter("NI USB 9211A","NI USB 9211A",
  9444. "nidaqmx9211series");
  9445. NodeInserter*addtc01= new NodeInserter("NI USB TC01","NI USB TC01",
  9446. "nidaqmxtc01");
  9447. connect(add9211a,SIGNAL(triggered(QString,QString)),
  9448. this,SLOT(insertChildNode(QString,QString)));
  9449. connect(addtc01,SIGNAL(triggered(QString,QString)),
  9450. this,SLOT(insertChildNode(QString,QString)));
  9451. QMenu*deviceMenu= new QMenu;
  9452. deviceMenu->addAction(add9211a);
  9453. deviceMenu->addAction(addtc01);
  9454. addDeviceButton->setMenu(deviceMenu);
  9455. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  9456. layout->addWidget(addDeviceButton);
  9457. setLayout(layout);
  9458. }
  9459. /*:702*/
  9460. #line 588 "./typica.w"
  9461. /*704:*/
  9462. #line 15601 "./typica.w"
  9463. NiDaqMx9211ConfWidget::NiDaqMx9211ConfWidget(DeviceTreeModel*model,
  9464. const QModelIndex&index)
  9465. :BasicDeviceConfigurationWidget(model,index)
  9466. {
  9467. QVBoxLayout*layout= new QVBoxLayout;
  9468. QHBoxLayout*deviceIdLayout= new QHBoxLayout;
  9469. QLabel*label= new QLabel(tr("Device ID:"));
  9470. QLineEdit*deviceId= new QLineEdit;
  9471. deviceIdLayout->addWidget(label);
  9472. deviceIdLayout->addWidget(deviceId);
  9473. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  9474. layout->addLayout(deviceIdLayout);
  9475. layout->addWidget(addChannelButton);
  9476. /*687:*/
  9477. #line 15251 "./typica.w"
  9478. QDomElement referenceElement=
  9479. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9480. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9481. QDomElement node;
  9482. /*:687*/
  9483. #line 15615 "./typica.w"
  9484. for(int i= 0;i<configData.size();i++)
  9485. {
  9486. node= configData.at(i).toElement();
  9487. if(node.attribute("name")=="deviceID")
  9488. {
  9489. deviceId->setText(node.attribute("value","Dev1"));
  9490. break;
  9491. }
  9492. }
  9493. updateDeviceId(deviceId->text());
  9494. connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
  9495. connect(deviceId,SIGNAL(textEdited(QString)),
  9496. this,SLOT(updateDeviceId(QString)));
  9497. setLayout(layout);
  9498. }
  9499. void NiDaqMx9211ConfWidget::updateDeviceId(const QString&newId)
  9500. {
  9501. updateAttribute("deviceID",newId);
  9502. }
  9503. void NiDaqMx9211ConfWidget::addChannel()
  9504. {
  9505. insertChildNode(tr("Thermocouple channel"),"ni9211seriestc");
  9506. }
  9507. /*:704*/
  9508. #line 589 "./typica.w"
  9509. /*706:*/
  9510. #line 15666 "./typica.w"
  9511. NiDaqMxTc01ConfWidget::NiDaqMxTc01ConfWidget(DeviceTreeModel*model,
  9512. const QModelIndex&index)
  9513. :BasicDeviceConfigurationWidget(model,index)
  9514. {
  9515. QFormLayout*layout= new QFormLayout;
  9516. QLineEdit*deviceId= new QLineEdit;
  9517. layout->addRow(tr("Device ID:"),deviceId);
  9518. QLineEdit*columnName= new QLineEdit;
  9519. layout->addRow(tr("Column Name:"),columnName);
  9520. QComboBox*typeSelector= new QComboBox;
  9521. typeSelector->addItem("J");
  9522. typeSelector->addItem("K");
  9523. typeSelector->addItem("T");
  9524. typeSelector->addItem("B");
  9525. typeSelector->addItem("E");
  9526. typeSelector->addItem("N");
  9527. typeSelector->addItem("R");
  9528. typeSelector->addItem("S");
  9529. layout->addRow(tr("Thermocouple Type:"),typeSelector);
  9530. QCheckBox*hideSeries= new QCheckBox(tr("Hide this channel"));
  9531. layout->addRow(hideSeries);
  9532. /*687:*/
  9533. #line 15251 "./typica.w"
  9534. QDomElement referenceElement=
  9535. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9536. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9537. QDomElement node;
  9538. /*:687*/
  9539. #line 15688 "./typica.w"
  9540. for(int i= 0;i<configData.size();i++)
  9541. {
  9542. node= configData.at(i).toElement();
  9543. if(node.attribute("name")=="deviceID")
  9544. {
  9545. deviceId->setText(node.attribute("value"));
  9546. }
  9547. else if(node.attribute("name")=="type")
  9548. {
  9549. typeSelector->setCurrentIndex(typeSelector->findText(node.attribute("value")));
  9550. }
  9551. else if(node.attribute("name")=="columnname")
  9552. {
  9553. columnName->setText(node.attribute("value"));
  9554. }
  9555. else if(node.attribute("name")=="hidden")
  9556. {
  9557. hideSeries->setChecked(node.attribute("value")=="true");
  9558. }
  9559. }
  9560. updateDeviceId(deviceId->text());
  9561. updateThermocoupleType(typeSelector->currentText());
  9562. updateColumnName(columnName->text());
  9563. updateHidden(hideSeries->isChecked());
  9564. connect(deviceId,SIGNAL(textEdited(QString)),this,SLOT(updateDeviceId(QString)));
  9565. connect(typeSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateThermocoupleType(QString)));
  9566. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  9567. setLayout(layout);
  9568. connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  9569. }
  9570. void NiDaqMxTc01ConfWidget::updateDeviceId(const QString&newId)
  9571. {
  9572. updateAttribute("deviceID",newId);
  9573. }
  9574. void NiDaqMxTc01ConfWidget::updateThermocoupleType(const QString&type)
  9575. {
  9576. updateAttribute("type",type);
  9577. }
  9578. void NiDaqMxTc01ConfWidget::updateColumnName(const QString&name)
  9579. {
  9580. updateAttribute("columnname",name);
  9581. }
  9582. void NiDaqMxTc01ConfWidget::updateHidden(bool hidden)
  9583. {
  9584. updateAttribute("hidden",hidden?"true":"false");
  9585. }
  9586. /*:706*/
  9587. #line 590 "./typica.w"
  9588. /*724:*/
  9589. #line 16104 "./typica.w"
  9590. ModbusRtuPortConfWidget::ModbusRtuPortConfWidget(DeviceTreeModel*model,
  9591. const QModelIndex&index)
  9592. :BasicDeviceConfigurationWidget(model,index)
  9593. {
  9594. QFormLayout*layout= new QFormLayout;
  9595. QToolButton*addDeviceButton= new QToolButton;
  9596. addDeviceButton->setText(tr("Add Device"));
  9597. NodeInserter*addModbusRtuDevice= new NodeInserter("Modbus RTU Device",
  9598. "Modbus RTU Device",
  9599. "modbusrtudevice");
  9600. connect(addModbusRtuDevice,SIGNAL(triggered(QString,QString)),
  9601. this,SLOT(insertChildNode(QString,QString)));
  9602. QMenu*deviceMenu= new QMenu;
  9603. deviceMenu->addAction(addModbusRtuDevice);
  9604. addDeviceButton->setMenu(deviceMenu);
  9605. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  9606. layout->addRow(QString(),addDeviceButton);
  9607. PortSelector*port= new PortSelector;
  9608. layout->addRow(tr("Port:"),port);
  9609. connect(port,SIGNAL(currentIndexChanged(QString)),
  9610. this,SLOT(updatePort(QString)));
  9611. connect(port,SIGNAL(editTextChanged(QString)),
  9612. this,SLOT(updatePort(QString)));
  9613. BaudSelector*rate= new BaudSelector;
  9614. layout->addRow(tr("Baud:"),rate);
  9615. connect(rate,SIGNAL(currentIndexChanged(QString)),
  9616. this,SLOT(updateBaudRate(QString)));
  9617. ParitySelector*parity= new ParitySelector;
  9618. layout->addRow(tr("Parity:"),parity);
  9619. connect(parity,SIGNAL(currentIndexChanged(QString)),
  9620. this,SLOT(updateParity(QString)));
  9621. FlowSelector*flow= new FlowSelector;
  9622. layout->addRow(tr("Flow Control:"),flow);
  9623. connect(flow,SIGNAL(currentIndexChanged(QString)),
  9624. this,SLOT(updateFlowControl(QString)));
  9625. StopSelector*stop= new StopSelector;
  9626. layout->addRow(tr("Stop Bits:"),stop);
  9627. connect(stop,SIGNAL(currentIndexChanged(QString)),
  9628. this,SLOT(updateStopBits(QString)));
  9629. /*687:*/
  9630. #line 15251 "./typica.w"
  9631. QDomElement referenceElement=
  9632. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9633. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9634. QDomElement node;
  9635. /*:687*/
  9636. #line 16144 "./typica.w"
  9637. for(int i= 0;i<configData.size();i++)
  9638. {
  9639. node= configData.at(i).toElement();
  9640. if(node.attribute("name")=="port")
  9641. {
  9642. int j= port->findText(node.attribute("value"));
  9643. if(j>=0)
  9644. {
  9645. port->setCurrentIndex(j);
  9646. }
  9647. else
  9648. {
  9649. port->insertItem(0,node.attribute("value"));
  9650. port->setCurrentIndex(0);
  9651. }
  9652. }
  9653. else if(node.attribute("name")=="baudrate")
  9654. {
  9655. rate->setCurrentIndex(rate->findText(node.attribute("value")));
  9656. }
  9657. else if(node.attribute("name")=="parity")
  9658. {
  9659. parity->setCurrentIndex(parity->findText(node.attribute("value")));
  9660. }
  9661. else if(node.attribute("name")=="flowcontrol")
  9662. {
  9663. flow->setCurrentIndex(flow->findText(node.attribute("value")));
  9664. }
  9665. else if(node.attribute("name")=="stopbits")
  9666. {
  9667. stop->setCurrentIndex(stop->findText(node.attribute("value")));
  9668. }
  9669. }
  9670. updatePort(port->currentText());
  9671. updateBaudRate(rate->currentText());
  9672. updateParity(parity->currentText());
  9673. updateFlowControl(flow->currentText());
  9674. updateStopBits(stop->currentText());
  9675. setLayout(layout);
  9676. }
  9677. void ModbusRtuPortConfWidget::updatePort(const QString&newPort)
  9678. {
  9679. updateAttribute("port",newPort);
  9680. }
  9681. void ModbusRtuPortConfWidget::updateBaudRate(const QString&newRate)
  9682. {
  9683. updateAttribute("baudrate",newRate);
  9684. }
  9685. void ModbusRtuPortConfWidget::updateParity(const QString&newParity)
  9686. {
  9687. updateAttribute("parity",newParity);
  9688. }
  9689. void ModbusRtuPortConfWidget::updateFlowControl(const QString&newFlow)
  9690. {
  9691. updateAttribute("flowcontrol",newFlow);
  9692. }
  9693. void ModbusRtuPortConfWidget::updateStopBits(const QString&newStopBits)
  9694. {
  9695. updateAttribute("stopbits",newStopBits);
  9696. }
  9697. /*:724*/
  9698. #line 591 "./typica.w"
  9699. /*726:*/
  9700. #line 16267 "./typica.w"
  9701. ModbusRtuDeviceConfWidget::ModbusRtuDeviceConfWidget(DeviceTreeModel*model,
  9702. const QModelIndex&index)
  9703. :BasicDeviceConfigurationWidget(model,index),
  9704. unitSpecificationLayout(new QStackedLayout),
  9705. decimalSpecificationLayout(new QStackedLayout)
  9706. {
  9707. QVBoxLayout*layout= new QVBoxLayout;
  9708. QToolButton*addChannelButton= new QToolButton;
  9709. addChannelButton->setText(tr("Add Channel"));
  9710. NodeInserter*addTemperaturePV= new NodeInserter("Temperature Process Value",
  9711. "Temperature Process Value",
  9712. "modbustemperaturepv");
  9713. NodeInserter*addTemperatureSV= new NodeInserter("Temperature Set Value",
  9714. "Temperature Set Value",
  9715. "modbustemperaturesv");
  9716. connect(addTemperaturePV,SIGNAL(triggered(QString,QString)),
  9717. this,SLOT(insertChildNode(QString,QString)));
  9718. connect(addTemperatureSV,SIGNAL(triggered(QString,QString)),
  9719. this,SLOT(insertChildNode(QString,QString)));
  9720. QMenu*channelMenu= new QMenu;
  9721. channelMenu->addAction(addTemperaturePV);
  9722. channelMenu->addAction(addTemperatureSV);
  9723. addChannelButton->setMenu(channelMenu);
  9724. addChannelButton->setPopupMode(QToolButton::InstantPopup);
  9725. layout->addWidget(addChannelButton);
  9726. QHBoxLayout*stationLayout= new QHBoxLayout;
  9727. QLabel*stationLabel= new QLabel(tr("Station:"));
  9728. QSpinBox*stationNumber= new QSpinBox;
  9729. stationNumber->setMinimum(0);
  9730. stationNumber->setMaximum(255);
  9731. stationLayout->addWidget(stationLabel);
  9732. stationLayout->addWidget(stationNumber);
  9733. layout->addLayout(stationLayout);
  9734. QCheckBox*fixedUnit= new QCheckBox(tr("Fixed Temperature Unit"));
  9735. layout->addWidget(fixedUnit);
  9736. QWidget*fixedUnitPlaceholder= new QWidget(this);
  9737. QHBoxLayout*fixedUnitLayout= new QHBoxLayout;
  9738. QLabel*fixedUnitLabel= new QLabel(tr("Temperature Unit:"));
  9739. QComboBox*fixedUnitSelector= new QComboBox;
  9740. fixedUnitSelector->addItem("Fahrenheit");
  9741. fixedUnitSelector->addItem("Celsius");
  9742. fixedUnitLayout->addWidget(fixedUnitLabel);
  9743. fixedUnitLayout->addWidget(fixedUnitSelector);
  9744. fixedUnitPlaceholder->setLayout(fixedUnitLayout);
  9745. unitSpecificationLayout->addWidget(fixedUnitPlaceholder);
  9746. QWidget*queriedUnitPlaceholder= new QWidget(this);
  9747. QFormLayout*queriedUnitLayout= new QFormLayout;
  9748. ShortHexSpinBox*unitAddress= new ShortHexSpinBox;
  9749. queriedUnitLayout->addRow(tr("Function 0x03 Unit Address:"),unitAddress);
  9750. QSpinBox*valueF= new QSpinBox;
  9751. valueF->setMinimum(0);
  9752. valueF->setMaximum(65535);
  9753. queriedUnitLayout->addRow(tr("Value for Fahrenheit"),valueF);
  9754. QSpinBox*valueC= new QSpinBox;
  9755. valueC->setMinimum(0);
  9756. valueC->setMaximum(65535);
  9757. queriedUnitLayout->addRow(tr("Value for Celsius"),valueC);
  9758. queriedUnitPlaceholder->setLayout(queriedUnitLayout);
  9759. unitSpecificationLayout->addWidget(queriedUnitPlaceholder);
  9760. layout->addLayout(unitSpecificationLayout);
  9761. QCheckBox*fixedPrecision= new QCheckBox(tr("Fixed Precision"));
  9762. layout->addWidget(fixedPrecision);
  9763. QWidget*fixedPrecisionPlaceholder= new QWidget(this);
  9764. QFormLayout*fixedPrecisionLayout= new QFormLayout;
  9765. QSpinBox*fixedPrecisionValue= new QSpinBox;
  9766. fixedPrecisionValue->setMinimum(0);
  9767. fixedPrecisionValue->setMaximum(9);
  9768. fixedPrecisionLayout->addRow("Places after the decimal point:",
  9769. fixedPrecisionValue);
  9770. fixedPrecisionPlaceholder->setLayout(fixedPrecisionLayout);
  9771. decimalSpecificationLayout->addWidget(fixedPrecisionPlaceholder);
  9772. QWidget*queriedPrecisionPlaceholder= new QWidget(this);
  9773. QFormLayout*queriedPrecisionLayout= new QFormLayout;
  9774. ShortHexSpinBox*precisionAddress= new ShortHexSpinBox;
  9775. queriedPrecisionLayout->addRow("Function 0x03 Decimal Position Address:",
  9776. precisionAddress);
  9777. queriedPrecisionPlaceholder->setLayout(queriedPrecisionLayout);
  9778. decimalSpecificationLayout->addWidget(queriedPrecisionPlaceholder);
  9779. layout->addLayout(decimalSpecificationLayout);
  9780. /*687:*/
  9781. #line 15251 "./typica.w"
  9782. QDomElement referenceElement=
  9783. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9784. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9785. QDomElement node;
  9786. /*:687*/
  9787. #line 16347 "./typica.w"
  9788. for(int i= 0;i<configData.size();i++)
  9789. {
  9790. node= configData.at(i).toElement();
  9791. if(node.attribute("name")=="station")
  9792. {
  9793. stationNumber->setValue(node.attribute("value").toInt());
  9794. }
  9795. else if(node.attribute("name")=="fixedunit")
  9796. {
  9797. if(node.attribute("value")=="true")
  9798. {
  9799. fixedUnit->setCheckState(Qt::Checked);
  9800. }
  9801. else if(node.attribute("value")=="false")
  9802. {
  9803. fixedUnit->setCheckState(Qt::Unchecked);
  9804. }
  9805. }
  9806. else if(node.attribute("name")=="fixedprecision")
  9807. {
  9808. fixedPrecisionValue->setValue(node.attribute("value").toInt());
  9809. }
  9810. else if(node.attribute("name")=="unit")
  9811. {
  9812. fixedUnitSelector->setCurrentIndex(fixedUnitSelector->findText(node.attribute("value")));
  9813. }
  9814. else if(node.attribute("name")=="unitaddress")
  9815. {
  9816. unitAddress->setValue(node.attribute("value").toInt());
  9817. }
  9818. else if(node.attribute("name")=="fvalue")
  9819. {
  9820. valueF->setValue(node.attribute("value").toInt());
  9821. }
  9822. else if(node.attribute("name")=="cvalue")
  9823. {
  9824. valueC->setValue(node.attribute("value").toInt());
  9825. }
  9826. else if(node.attribute("name")=="precisionaddress")
  9827. {
  9828. precisionAddress->setValue(node.attribute("value").toInt());
  9829. }
  9830. else if(node.attribute("name")=="precision")
  9831. {
  9832. fixedPrecisionValue->setValue(node.attribute("value").toInt());
  9833. }
  9834. }
  9835. updateStationNumber(stationNumber->value());
  9836. updateFixedUnit(fixedUnit->isChecked());
  9837. updateFixedDecimal(fixedPrecision->isChecked());
  9838. updateUnit(fixedUnitSelector->currentText());
  9839. updateUnitAddress(unitAddress->value());
  9840. updateValueF(valueF->value());
  9841. updateValueC(valueC->value());
  9842. updatePrecisionAddress(precisionAddress->value());
  9843. updatePrecisionValue(fixedPrecisionValue->value());
  9844. connect(stationNumber,SIGNAL(valueChanged(int)),
  9845. this,SLOT(updateStationNumber(int)));
  9846. connect(fixedUnitSelector,SIGNAL(currentIndexChanged(QString)),
  9847. this,SLOT(updateUnit(QString)));
  9848. connect(unitAddress,SIGNAL(valueChanged(int)),
  9849. this,SLOT(updateUnitAddress(int)));
  9850. connect(valueF,SIGNAL(valueChanged(int)),
  9851. this,SLOT(updateValueF(int)));
  9852. connect(valueC,SIGNAL(valueChanged(int)),
  9853. this,SLOT(updateValueC(int)));
  9854. connect(fixedUnit,SIGNAL(toggled(bool)),
  9855. this,SLOT(updateFixedUnit(bool)));
  9856. connect(fixedPrecision,SIGNAL(toggled(bool)),
  9857. this,SLOT(updateFixedDecimal(bool)));
  9858. connect(fixedPrecisionValue,SIGNAL(valueChanged(int)),
  9859. this,SLOT(updatePrecisionValue(int)));
  9860. connect(precisionAddress,SIGNAL(valueChanged(int)),
  9861. this,SLOT(updatePrecisionAddress(int)));
  9862. setLayout(layout);
  9863. }
  9864. void ModbusRtuDeviceConfWidget::updateStationNumber(int newStation)
  9865. {
  9866. updateAttribute("station",QString("%1").arg(newStation));
  9867. }
  9868. void ModbusRtuDeviceConfWidget::updateFixedUnit(bool newFixed)
  9869. {
  9870. if(newFixed)
  9871. {
  9872. unitSpecificationLayout->setCurrentIndex(0);
  9873. updateAttribute("fixedunit","true");
  9874. }
  9875. else
  9876. {
  9877. unitSpecificationLayout->setCurrentIndex(1);
  9878. updateAttribute("fixedunit","false");
  9879. }
  9880. }
  9881. void ModbusRtuDeviceConfWidget::updateFixedDecimal(bool newFixed)
  9882. {
  9883. if(newFixed)
  9884. {
  9885. decimalSpecificationLayout->setCurrentIndex(0);
  9886. updateAttribute("fixedprecision","true");
  9887. }
  9888. else
  9889. {
  9890. decimalSpecificationLayout->setCurrentIndex(1);
  9891. updateAttribute("fixedprecision","false");
  9892. }
  9893. }
  9894. void ModbusRtuDeviceConfWidget::updateUnit(const QString&newUnit)
  9895. {
  9896. updateAttribute("unit",newUnit);
  9897. }
  9898. void ModbusRtuDeviceConfWidget::updateUnitAddress(int newAddress)
  9899. {
  9900. updateAttribute("unitaddress",QString("%1").arg(newAddress));
  9901. }
  9902. void ModbusRtuDeviceConfWidget::updateValueF(int newValue)
  9903. {
  9904. updateAttribute("fvalue",QString("%1").arg(newValue));
  9905. }
  9906. void ModbusRtuDeviceConfWidget::updateValueC(int newValue)
  9907. {
  9908. updateAttribute("cvalue",QString("%1").arg(newValue));
  9909. }
  9910. void ModbusRtuDeviceConfWidget::updatePrecisionAddress(int newAddress)
  9911. {
  9912. updateAttribute("precisionaddress",QString("%1").arg(newAddress));
  9913. }
  9914. void ModbusRtuDeviceConfWidget::updatePrecisionValue(int newValue)
  9915. {
  9916. updateAttribute("precision",QString("%1").arg(newValue));
  9917. }
  9918. /*:726*/
  9919. #line 592 "./typica.w"
  9920. /*728:*/
  9921. #line 16510 "./typica.w"
  9922. ModbusRtuDeviceTPvConfWidget::ModbusRtuDeviceTPvConfWidget(DeviceTreeModel*model,
  9923. const QModelIndex&index)
  9924. :BasicDeviceConfigurationWidget(model,index)
  9925. {
  9926. QFormLayout*layout= new QFormLayout;
  9927. ShortHexSpinBox*address= new ShortHexSpinBox;
  9928. layout->addRow(tr("Function 0x04 Process Value Address"),address);
  9929. /*687:*/
  9930. #line 15251 "./typica.w"
  9931. QDomElement referenceElement=
  9932. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9933. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9934. QDomElement node;
  9935. /*:687*/
  9936. #line 16518 "./typica.w"
  9937. for(int i= 0;i<configData.size();i++)
  9938. {
  9939. node= configData.at(i).toElement();
  9940. if(node.attribute("name")=="address")
  9941. {
  9942. address->setValue(node.attribute("value").toInt());
  9943. break;
  9944. }
  9945. }
  9946. updateAddress(address->value());
  9947. connect(address,SIGNAL(valueChanged(int)),this,SLOT(updateAddress(int)));
  9948. setLayout(layout);
  9949. }
  9950. void ModbusRtuDeviceTPvConfWidget::updateAddress(int newAddress)
  9951. {
  9952. updateAttribute("address",QString("%1").arg(newAddress));
  9953. }
  9954. /*:728*/
  9955. #line 593 "./typica.w"
  9956. /*730:*/
  9957. #line 16566 "./typica.w"
  9958. ModbusRtuDeviceTSvConfWidget::ModbusRtuDeviceTSvConfWidget(DeviceTreeModel*model,
  9959. const QModelIndex&index)
  9960. :BasicDeviceConfigurationWidget(model,index),boundsLayout(new QStackedLayout)
  9961. {
  9962. QVBoxLayout*layout= new QVBoxLayout;
  9963. QFormLayout*addressLayout= new QFormLayout;
  9964. ShortHexSpinBox*readAddress= new ShortHexSpinBox;
  9965. ShortHexSpinBox*writeAddress= new ShortHexSpinBox;
  9966. addressLayout->addRow(tr("Function 0x04 Read Set Value Address:"),readAddress);
  9967. addressLayout->addRow(tr("Function 0x06 Write Set Value Address:"),writeAddress);
  9968. layout->addLayout(addressLayout);
  9969. QCheckBox*fixedRange= new QCheckBox(tr("Fixed Set Value Range"));
  9970. layout->addWidget(fixedRange);
  9971. QWidget*queriedRangePlaceholder= new QWidget(this);
  9972. QFormLayout*queriedRangeLayout= new QFormLayout;
  9973. ShortHexSpinBox*lowerAddress= new ShortHexSpinBox;
  9974. ShortHexSpinBox*upperAddress= new ShortHexSpinBox;
  9975. queriedRangeLayout->addRow(tr("Function 0x03 Minimum Set Value Address"),
  9976. lowerAddress);
  9977. queriedRangeLayout->addRow(tr("Function 0x03 Maximum Set Value Address"),
  9978. upperAddress);
  9979. queriedRangePlaceholder->setLayout(queriedRangeLayout);
  9980. boundsLayout->addWidget(queriedRangePlaceholder);
  9981. QWidget*fixedRangePlaceholder= new QWidget(this);
  9982. QFormLayout*fixedRangeLayout= new QFormLayout;
  9983. QLineEdit*fixedLower= new QLineEdit;
  9984. QLineEdit*fixedUpper= new QLineEdit;
  9985. fixedRangeLayout->addRow(tr("Minimum Set Value:"),fixedLower);
  9986. fixedRangeLayout->addRow(tr("Maximum Set Value:"),fixedUpper);
  9987. fixedRangePlaceholder->setLayout(fixedRangeLayout);
  9988. boundsLayout->addWidget(fixedRangePlaceholder);
  9989. layout->addLayout(boundsLayout);
  9990. /*687:*/
  9991. #line 15251 "./typica.w"
  9992. QDomElement referenceElement=
  9993. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9994. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9995. QDomElement node;
  9996. /*:687*/
  9997. #line 16599 "./typica.w"
  9998. for(int i= 0;i<configData.size();i++)
  9999. {
  10000. node= configData.at(i).toElement();
  10001. if(node.attribute("name")=="readaddress")
  10002. {
  10003. readAddress->setValue(node.attribute("value").toInt());
  10004. }
  10005. else if(node.attribute("name")=="writeaddress")
  10006. {
  10007. writeAddress->setValue(node.attribute("value").toInt());
  10008. }
  10009. else if(node.attribute("name")=="fixedrange")
  10010. {
  10011. if(node.attribute("value")=="true")
  10012. {
  10013. fixedRange->setCheckState(Qt::Checked);
  10014. }
  10015. else if(node.attribute("value")=="false")
  10016. {
  10017. fixedRange->setCheckState(Qt::Unchecked);
  10018. }
  10019. }
  10020. else if(node.attribute("name")=="fixedlower")
  10021. {
  10022. fixedLower->setText(node.attribute("value"));
  10023. }
  10024. else if(node.attribute("name")=="fixedupper")
  10025. {
  10026. fixedUpper->setText(node.attribute("value"));
  10027. }
  10028. else if(node.attribute("name")=="loweraddress")
  10029. {
  10030. lowerAddress->setValue(node.attribute("value").toInt());
  10031. }
  10032. else if(node.attribute("name")=="upperaddress")
  10033. {
  10034. upperAddress->setValue(node.attribute("value").toInt());
  10035. }
  10036. }
  10037. updateReadAddress(readAddress->value());
  10038. updateWriteAddress(writeAddress->value());
  10039. updateFixedRange(fixedRange->isChecked());
  10040. updateLower(fixedLower->text());
  10041. updateUpper(fixedUpper->text());
  10042. updateLowerAddress(lowerAddress->value());
  10043. updateUpperAddress(upperAddress->value());
  10044. connect(readAddress,SIGNAL(valueChanged(int)),
  10045. this,SLOT(updateReadAddress(int)));
  10046. connect(writeAddress,SIGNAL(valueChanged(int)),
  10047. this,SLOT(updateWriteAddress(int)));
  10048. connect(fixedRange,SIGNAL(toggled(bool)),this,SLOT(updateFixedRange(bool)));
  10049. connect(fixedLower,SIGNAL(textChanged(QString)),
  10050. this,SLOT(updateLower(QString)));
  10051. connect(fixedUpper,SIGNAL(textChanged(QString)),
  10052. this,SLOT(updateUpper(QString)));
  10053. connect(lowerAddress,SIGNAL(valueChanged(int)),
  10054. this,SLOT(updateLowerAddress(int)));
  10055. connect(upperAddress,SIGNAL(valueChanged(int)),
  10056. this,SLOT(updateUpperAddress(int)));
  10057. setLayout(layout);
  10058. }
  10059. void ModbusRtuDeviceTSvConfWidget::updateReadAddress(int newAddress)
  10060. {
  10061. updateAttribute("readaddress",QString("%1").arg(newAddress));
  10062. }
  10063. void ModbusRtuDeviceTSvConfWidget::updateWriteAddress(int newAddress)
  10064. {
  10065. updateAttribute("writeaddress",QString("%1").arg(newAddress));
  10066. }
  10067. void ModbusRtuDeviceTSvConfWidget::updateFixedRange(bool fixed)
  10068. {
  10069. if(fixed)
  10070. {
  10071. updateAttribute("fixedrange","true");
  10072. boundsLayout->setCurrentIndex(1);
  10073. }
  10074. else
  10075. {
  10076. updateAttribute("fixedrange","false");
  10077. boundsLayout->setCurrentIndex(0);
  10078. }
  10079. }
  10080. void ModbusRtuDeviceTSvConfWidget::updateLower(const QString&lower)
  10081. {
  10082. updateAttribute("fixedlower",lower);
  10083. }
  10084. void ModbusRtuDeviceTSvConfWidget::updateUpper(const QString&upper)
  10085. {
  10086. updateAttribute("fixedupper",upper);
  10087. }
  10088. void ModbusRtuDeviceTSvConfWidget::updateLowerAddress(int newAddress)
  10089. {
  10090. updateAttribute("loweraddress",QString("%1").arg(newAddress));
  10091. }
  10092. void ModbusRtuDeviceTSvConfWidget::updateUpperAddress(int newAddress)
  10093. {
  10094. updateAttribute("upperaddress",QString("%1").arg(newAddress));
  10095. }
  10096. /*:730*/
  10097. #line 594 "./typica.w"
  10098. /*686:*/
  10099. #line 15173 "./typica.w"
  10100. RoasterConfWidget::RoasterConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  10101. :BasicDeviceConfigurationWidget(model,index)
  10102. {
  10103. QVBoxLayout*layout= new QVBoxLayout;
  10104. QPushButton*addDeviceButton= new QPushButton(tr("Add Device"));
  10105. QMenu*deviceMenu= new QMenu;
  10106. NodeInserter*insertAction;
  10107. foreach(insertAction,AppInstance->topLevelNodeInserters)
  10108. {
  10109. connect(insertAction,SIGNAL(triggered(QString,QString)),
  10110. this,SLOT(insertChildNode(QString,QString)));
  10111. deviceMenu->addAction(insertAction);
  10112. }
  10113. addDeviceButton->setMenu(deviceMenu);
  10114. layout->addWidget(addDeviceButton);
  10115. QPushButton*addAnnotationControlButton= new QPushButton(tr("Add Annotation Control"));
  10116. QMenu*annotationMenu= new QMenu;
  10117. NodeInserter*basicButtonInserter= new NodeInserter(tr("Annotation Button"),tr("Annotation Button"),"annotationbutton");
  10118. NodeInserter*countingButtonInserter= new NodeInserter(tr("Counting Button"),tr("Counting Button"),"reconfigurablebutton");
  10119. NodeInserter*spinBoxInserter= new NodeInserter(tr("Numeric Entry"),tr("Numeric Entry"),"annotationspinbox");
  10120. NodeInserter*freeAnnotationInserter= new NodeInserter(tr("Free Text"),
  10121. tr("Free Text"),
  10122. "freeannotation");
  10123. annotationMenu->addAction(basicButtonInserter);
  10124. annotationMenu->addAction(countingButtonInserter);
  10125. annotationMenu->addAction(spinBoxInserter);
  10126. annotationMenu->addAction(freeAnnotationInserter);
  10127. connect(basicButtonInserter,SIGNAL(triggered(QString,QString)),
  10128. this,SLOT(insertChildNode(QString,QString)));
  10129. connect(countingButtonInserter,SIGNAL(triggered(QString,QString)),
  10130. this,SLOT(insertChildNode(QString,QString)));
  10131. connect(spinBoxInserter,SIGNAL(triggered(QString,QString)),
  10132. this,SLOT(insertChildNode(QString,QString)));
  10133. connect(freeAnnotationInserter,SIGNAL(triggered(QString,QString)),
  10134. this,SLOT(insertChildNode(QString,QString)));
  10135. /*873:*/
  10136. #line 144 "./valueannotation.w"
  10137. NodeInserter*valueAnnotationInserter= new NodeInserter(tr("Value Annotation"),
  10138. tr("Value Annotation"),
  10139. "valueannotation");
  10140. annotationMenu->addAction(valueAnnotationInserter);
  10141. connect(valueAnnotationInserter,SIGNAL(triggered(QString,QString)),
  10142. this,SLOT(insertChildNode(QString,QString)));
  10143. /*:873*/
  10144. #line 15209 "./typica.w"
  10145. addAnnotationControlButton->setMenu(annotationMenu);
  10146. layout->addWidget(addAnnotationControlButton);
  10147. QPushButton*advancedButton= new QPushButton(tr("Advanced Features"));
  10148. QMenu*advancedMenu= new QMenu;
  10149. NodeInserter*linearsplineinserter= new NodeInserter(tr("Linear Spline Interpolated Series"),tr("Linear Spline Interpolated Series"),"linearspline");
  10150. advancedMenu->addAction(linearsplineinserter);
  10151. NodeInserter*translationinserter= new NodeInserter(tr("Profile Translation"),tr("Profile Translation"),"translation");
  10152. advancedMenu->addAction(translationinserter);
  10153. connect(linearsplineinserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  10154. connect(translationinserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  10155. /*799:*/
  10156. #line 277 "./rate.w"
  10157. NodeInserter*rateOfChangeInserter= new NodeInserter(tr("Rate of Change"),tr("Rate of Change"),"rate");
  10158. connect(rateOfChangeInserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  10159. advancedMenu->addAction(rateOfChangeInserter);
  10160. /*:799*/
  10161. #line 15220 "./typica.w"
  10162. advancedButton->setMenu(advancedMenu);
  10163. layout->addWidget(advancedButton);
  10164. QHBoxLayout*idLayout= new QHBoxLayout;
  10165. QLabel*idLabel= new QLabel(tr("Machine ID for database:"));
  10166. idLayout->addWidget(idLabel);
  10167. QSpinBox*id= new QSpinBox;
  10168. idLayout->addWidget(id);
  10169. layout->addLayout(idLayout);
  10170. /*687:*/
  10171. #line 15251 "./typica.w"
  10172. QDomElement referenceElement=
  10173. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10174. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10175. QDomElement node;
  10176. /*:687*/
  10177. #line 15229 "./typica.w"
  10178. for(int i= 0;i<configData.size();i++)
  10179. {
  10180. node= configData.at(i).toElement();
  10181. if(node.attribute("name")=="databaseid")
  10182. {
  10183. id->setValue(node.attribute("value").toInt());
  10184. break;
  10185. }
  10186. }
  10187. updateRoasterId(id->value());
  10188. connect(id,SIGNAL(valueChanged(int)),this,SLOT(updateRoasterId(int)));
  10189. setLayout(layout);
  10190. }
  10191. /*:686*//*688:*/
  10192. #line 15261 "./typica.w"
  10193. void RoasterConfWidget::updateRoasterId(int id)
  10194. {
  10195. updateAttribute("databaseid",QString("%1").arg(id));
  10196. }
  10197. /*:688*/
  10198. #line 595 "./typica.w"
  10199. /*734:*/
  10200. #line 16749 "./typica.w"
  10201. AnnotationButtonConfWidget::AnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  10202. :BasicDeviceConfigurationWidget(model,index)
  10203. {
  10204. QFormLayout*layout= new QFormLayout;
  10205. QLineEdit*buttonTextEdit= new QLineEdit;
  10206. QLineEdit*annotationTextEdit= new QLineEdit;
  10207. layout->addRow(tr("Button Text:"),buttonTextEdit);
  10208. layout->addRow(tr("Annotation Text:"),annotationTextEdit);
  10209. /*687:*/
  10210. #line 15251 "./typica.w"
  10211. QDomElement referenceElement=
  10212. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10213. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10214. QDomElement node;
  10215. /*:687*/
  10216. #line 16758 "./typica.w"
  10217. for(int i= 0;i<configData.size();i++)
  10218. {
  10219. node= configData.at(i).toElement();
  10220. if(node.attribute("name")=="buttontext")
  10221. {
  10222. buttonTextEdit->setText(node.attribute("value"));
  10223. }
  10224. else if(node.attribute("name")=="annotationtext")
  10225. {
  10226. annotationTextEdit->setText(node.attribute("value"));
  10227. }
  10228. }
  10229. updateButtonText(buttonTextEdit->text());
  10230. updateAnnotationText(annotationTextEdit->text());
  10231. connect(buttonTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateButtonText(QString)));
  10232. connect(annotationTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateAnnotationText(QString)));
  10233. setLayout(layout);
  10234. }
  10235. /*:734*//*735:*/
  10236. #line 16780 "./typica.w"
  10237. void AnnotationButtonConfWidget::updateButtonText(const QString&text)
  10238. {
  10239. updateAttribute("buttontext",text);
  10240. }
  10241. void AnnotationButtonConfWidget::updateAnnotationText(const QString&text)
  10242. {
  10243. updateAttribute("annotationtext",text);
  10244. }
  10245. /*:735*//*738:*/
  10246. #line 16818 "./typica.w"
  10247. ReconfigurableAnnotationButtonConfWidget::ReconfigurableAnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  10248. :BasicDeviceConfigurationWidget(model,index)
  10249. {
  10250. QFormLayout*layout= new QFormLayout;
  10251. QLineEdit*buttonTextEdit= new QLineEdit;
  10252. QLineEdit*annotationTextEdit= new QLineEdit;
  10253. layout->addRow(tr("Button Text:"),buttonTextEdit);
  10254. layout->addRow(tr("Annotation Text:"),annotationTextEdit);
  10255. /*687:*/
  10256. #line 15251 "./typica.w"
  10257. QDomElement referenceElement=
  10258. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10259. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10260. QDomElement node;
  10261. /*:687*/
  10262. #line 16827 "./typica.w"
  10263. for(int i= 0;i<configData.size();i++)
  10264. {
  10265. node= configData.at(i).toElement();
  10266. if(node.attribute("name")=="buttontext")
  10267. {
  10268. buttonTextEdit->setText(node.attribute("value"));
  10269. }
  10270. else if(node.attribute("name")=="annotationtext")
  10271. {
  10272. annotationTextEdit->setText(node.attribute("value"));
  10273. }
  10274. }
  10275. updateButtonText(buttonTextEdit->text());
  10276. updateAnnotationText(annotationTextEdit->text());
  10277. connect(buttonTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateButtonText(QString)));
  10278. connect(annotationTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateAnnotationText(QString)));
  10279. QTextEdit*documentation= new QTextEdit;
  10280. 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."));
  10281. documentation->setReadOnly(true);
  10282. layout->addRow("",documentation);
  10283. setLayout(layout);
  10284. }
  10285. void ReconfigurableAnnotationButtonConfWidget::updateButtonText(const QString&text)
  10286. {
  10287. updateAttribute("buttontext",text);
  10288. }
  10289. void ReconfigurableAnnotationButtonConfWidget::updateAnnotationText(const QString&text)
  10290. {
  10291. updateAttribute("annotationtext",text);
  10292. }
  10293. /*:738*/
  10294. #line 596 "./typica.w"
  10295. /*741:*/
  10296. #line 16895 "./typica.w"
  10297. NoteSpinConfWidget::NoteSpinConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  10298. :BasicDeviceConfigurationWidget(model,index)
  10299. {
  10300. QFormLayout*layout= new QFormLayout;
  10301. QLineEdit*labelEdit= new QLineEdit;
  10302. layout->addRow(tr("Control Label: "),labelEdit);
  10303. QLineEdit*minimumEdit= new QLineEdit;
  10304. layout->addRow(tr("Minimum Value: "),minimumEdit);
  10305. QLineEdit*maximumEdit= new QLineEdit;
  10306. layout->addRow(tr("Maximum Value: "),maximumEdit);
  10307. QSpinBox*precisionEdit= new QSpinBox;
  10308. precisionEdit->setMinimum(0);
  10309. precisionEdit->setMaximum(9);
  10310. layout->addRow(tr("Precision"),precisionEdit);
  10311. QLineEdit*pretext= new QLineEdit;
  10312. layout->addRow(tr("Prefix text"),pretext);
  10313. QLineEdit*posttext= new QLineEdit;
  10314. layout->addRow(tr("Suffix text"),posttext);
  10315. /*687:*/
  10316. #line 15251 "./typica.w"
  10317. QDomElement referenceElement=
  10318. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10319. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10320. QDomElement node;
  10321. /*:687*/
  10322. #line 16914 "./typica.w"
  10323. for(int i= 0;i<configData.size();i++)
  10324. {
  10325. node= configData.at(i).toElement();
  10326. if(node.attribute("name")=="label")
  10327. {
  10328. labelEdit->setText(node.attribute("value"));
  10329. }
  10330. else if(node.attribute("name")=="minimum")
  10331. {
  10332. minimumEdit->setText(node.attribute("value"));
  10333. }
  10334. else if(node.attribute("name")=="maximum")
  10335. {
  10336. maximumEdit->setText(node.attribute("value"));
  10337. }
  10338. else if(node.attribute("name")=="precision")
  10339. {
  10340. precisionEdit->setValue(node.attribute("value").toInt());
  10341. }
  10342. else if(node.attribute("name")=="pretext")
  10343. {
  10344. pretext->setText(node.attribute("value"));
  10345. }
  10346. else if(node.attribute("name")=="posttext")
  10347. {
  10348. posttext->setText(node.attribute("value"));
  10349. }
  10350. }
  10351. updateLabel(labelEdit->text());
  10352. updateMinimum(minimumEdit->text());
  10353. updateMaximum(maximumEdit->text());
  10354. updatePrecision(precisionEdit->value());
  10355. updatePretext(pretext->text());
  10356. updatePosttext(posttext->text());
  10357. connect(labelEdit,SIGNAL(textEdited(QString)),this,SLOT(updateLabel(QString)));
  10358. connect(minimumEdit,SIGNAL(textEdited(QString)),this,SLOT(updateMinimum(QString)));
  10359. connect(maximumEdit,SIGNAL(textEdited(QString)),this,SLOT(updateMaximum(QString)));
  10360. connect(precisionEdit,SIGNAL(valueChanged(int)),this,SLOT(updatePrecision(int)));
  10361. connect(pretext,SIGNAL(textEdited(QString)),this,SLOT(updatePretext(QString)));
  10362. connect(posttext,SIGNAL(textEdited(QString)),this,SLOT(updatePosttext(QString)));
  10363. setLayout(layout);
  10364. }
  10365. void NoteSpinConfWidget::updateLabel(const QString&text)
  10366. {
  10367. updateAttribute("label",text);
  10368. }
  10369. void NoteSpinConfWidget::updateMinimum(const QString&minimum)
  10370. {
  10371. updateAttribute("minimum",minimum);
  10372. }
  10373. void NoteSpinConfWidget::updateMaximum(const QString&maximum)
  10374. {
  10375. updateAttribute("maximum",maximum);
  10376. }
  10377. void NoteSpinConfWidget::updatePrecision(int precision)
  10378. {
  10379. updateAttribute("precision",QString("%1").arg(precision));
  10380. }
  10381. void NoteSpinConfWidget::updatePretext(const QString&text)
  10382. {
  10383. updateAttribute("pretext",text);
  10384. }
  10385. void NoteSpinConfWidget::updatePosttext(const QString&text)
  10386. {
  10387. updateAttribute("posttext",text);
  10388. }
  10389. /*:741*/
  10390. #line 597 "./typica.w"
  10391. /*275:*/
  10392. #line 6593 "./typica.w"
  10393. LinearCalibrator::LinearCalibrator(QObject*parent):
  10394. QObject(parent),Lo1(0),Lo2(0),Up1(1),Up2(1),sensitivitySetting(0.0),clamp(false)
  10395. {
  10396. connect(this,SIGNAL(measurement(Measurement)),this,SIGNAL(newData(Measurement)));
  10397. }
  10398. /*:275*//*276:*/
  10399. #line 6607 "./typica.w"
  10400. Measurement LinearCalibrator::newMeasurement(Measurement measure)
  10401. {
  10402. double outval= Lo1+(measure.temperature()-Lo2)*(Up1-Lo1)/(Up2-Lo2);
  10403. if(clamp)
  10404. {
  10405. if(outval<Lo1)
  10406. {
  10407. outval= Lo1;
  10408. }
  10409. else if(outval> Up1)
  10410. {
  10411. outval= Up1;
  10412. }
  10413. }
  10414. if(sensitivitySetting>=0.05)
  10415. {
  10416. int temp= qRound(outval/sensitivitySetting);
  10417. outval= temp*sensitivitySetting;
  10418. }
  10419. Measurement adjusted(outval,measure.time(),measure.scale());
  10420. emit measurement(adjusted);
  10421. return adjusted;
  10422. }
  10423. /*:276*//*277:*/
  10424. #line 6634 "./typica.w"
  10425. double LinearCalibrator::measuredLower()
  10426. {
  10427. return Lo2;
  10428. }
  10429. double LinearCalibrator::measuredUpper()
  10430. {
  10431. return Up2;
  10432. }
  10433. double LinearCalibrator::mappedLower()
  10434. {
  10435. return Lo1;
  10436. }
  10437. double LinearCalibrator::mappedUpper()
  10438. {
  10439. return Up1;
  10440. }
  10441. bool LinearCalibrator::isClosedRange()
  10442. {
  10443. return clamp;
  10444. }
  10445. void LinearCalibrator::setMeasuredLower(double lower)
  10446. {
  10447. Lo2= lower;
  10448. }
  10449. void LinearCalibrator::setMeasuredUpper(double upper)
  10450. {
  10451. Up2= upper;
  10452. }
  10453. void LinearCalibrator::setMappedLower(double lower)
  10454. {
  10455. Lo1= lower;
  10456. }
  10457. void LinearCalibrator::setMappedUpper(double upper)
  10458. {
  10459. Up1= upper;
  10460. }
  10461. void LinearCalibrator::setClosedRange(bool closed)
  10462. {
  10463. clamp= closed;
  10464. }
  10465. void LinearCalibrator::setSensitivity(double sensitivity)
  10466. {
  10467. sensitivitySetting= sensitivity;
  10468. }
  10469. double LinearCalibrator::sensitivity()
  10470. {
  10471. return sensitivitySetting;
  10472. }
  10473. /*:277*/
  10474. #line 598 "./typica.w"
  10475. /*282:*/
  10476. #line 6767 "./typica.w"
  10477. void LinearSplineInterpolator::add_pair(double source,double destination)
  10478. {
  10479. pairs->insert(source,destination);
  10480. make_interpolators();
  10481. }
  10482. void LinearSplineInterpolator::make_interpolators()
  10483. {
  10484. if(pairs->size()> 1)
  10485. {
  10486. while(interpolators->size()> 0)
  10487. {
  10488. LinearCalibrator*removed= interpolators->takeFirst();
  10489. removed->deleteLater();
  10490. }
  10491. QMap<double,double> ::const_iterator i= pairs->constBegin();
  10492. QMap<double,double> ::const_iterator j= i+1;
  10493. while(j!=pairs->constEnd())
  10494. {
  10495. LinearCalibrator*segment= new LinearCalibrator();
  10496. segment->setMeasuredLower(i.key());
  10497. segment->setMappedLower(i.value());
  10498. segment->setMeasuredUpper(j.key());
  10499. segment->setMappedUpper(j.value());
  10500. segment->setClosedRange(false);
  10501. interpolators->append(segment);
  10502. connect(segment,SIGNAL(measurement(Measurement)),this,SIGNAL(newData(Measurement)));
  10503. i++;
  10504. j++;
  10505. }
  10506. }
  10507. }
  10508. LinearSplineInterpolator::LinearSplineInterpolator(QObject*parent):
  10509. QObject(parent),pairs(new QMap<double,double> ),
  10510. interpolators(new QList<LinearCalibrator*> )
  10511. {
  10512. }
  10513. Measurement LinearSplineInterpolator::newMeasurement(Measurement measure)
  10514. {
  10515. QMap<double,double> ::const_iterator i= pairs->constBegin();
  10516. int index= -1;
  10517. while(i!=pairs->constEnd())
  10518. {
  10519. if(measure.temperature()<=i.key())
  10520. {
  10521. break;
  10522. }
  10523. i++;
  10524. index++;
  10525. }
  10526. if(index<0)
  10527. {
  10528. index= 0;
  10529. }
  10530. if(index>=interpolators->size())
  10531. {
  10532. index= interpolators->size()-1;
  10533. }
  10534. if(interpolators->at(index)!=NULL)
  10535. {
  10536. return interpolators->at(index)->newMeasurement(measure);
  10537. }
  10538. return Measurement();
  10539. }
  10540. /*:282*/
  10541. #line 599 "./typica.w"
  10542. /*778:*/
  10543. #line 18228 "./typica.w"
  10544. LinearSplineInterpolationConfWidget::LinearSplineInterpolationConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  10545. :BasicDeviceConfigurationWidget(model,index),tablemodel(new SaltModel(2))
  10546. {
  10547. QFormLayout*layout= new QFormLayout;
  10548. QLineEdit*source= new QLineEdit;
  10549. layout->addRow(tr("Source column name:"),source);
  10550. QLineEdit*destination= new QLineEdit;
  10551. layout->addRow(tr("Destination column name:"),destination);
  10552. tablemodel->setHeaderData(0,Qt::Horizontal,"Input");
  10553. tablemodel->setHeaderData(1,Qt::Horizontal,"Output");
  10554. QTableView*mappingTable= new QTableView;
  10555. mappingTable->setModel(tablemodel);
  10556. NumericDelegate*delegate= new NumericDelegate;
  10557. mappingTable->setItemDelegate(delegate);
  10558. layout->addRow(tr("Mapping data:"),mappingTable);
  10559. /*687:*/
  10560. #line 15251 "./typica.w"
  10561. QDomElement referenceElement=
  10562. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10563. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10564. QDomElement node;
  10565. /*:687*/
  10566. #line 18244 "./typica.w"
  10567. for(int i= 0;i<configData.size();i++)
  10568. {
  10569. node= configData.at(i).toElement();
  10570. if(node.attribute("name")=="source")
  10571. {
  10572. source->setText(node.attribute("value"));
  10573. }
  10574. else if(node.attribute("name")=="destination")
  10575. {
  10576. destination->setText(node.attribute("value"));
  10577. }
  10578. else if(node.attribute("name")=="sourcevalues")
  10579. {
  10580. /*779:*/
  10581. #line 18283 "./typica.w"
  10582. QString data= node.attribute("value");
  10583. if(data.length()> 3)
  10584. {
  10585. data.chop(2);
  10586. data= data.remove(0,2);
  10587. }
  10588. QStringList itemList= data.split(",");
  10589. /*:779*/
  10590. #line 18258 "./typica.w"
  10591. int column= 0;
  10592. /*780:*/
  10593. #line 18295 "./typica.w"
  10594. for(int i= 0;i<itemList.size();i++)
  10595. {
  10596. tablemodel->setData(tablemodel->index(i,column),
  10597. QVariant(itemList.at(i).toDouble()),
  10598. Qt::DisplayRole);
  10599. }
  10600. /*:780*/
  10601. #line 18260 "./typica.w"
  10602. }
  10603. else if(node.attribute("name")=="destinationvalues")
  10604. {
  10605. /*779:*/
  10606. #line 18283 "./typica.w"
  10607. QString data= node.attribute("value");
  10608. if(data.length()> 3)
  10609. {
  10610. data.chop(2);
  10611. data= data.remove(0,2);
  10612. }
  10613. QStringList itemList= data.split(",");
  10614. /*:779*/
  10615. #line 18265 "./typica.w"
  10616. int column= 1;
  10617. /*780:*/
  10618. #line 18295 "./typica.w"
  10619. for(int i= 0;i<itemList.size();i++)
  10620. {
  10621. tablemodel->setData(tablemodel->index(i,column),
  10622. QVariant(itemList.at(i).toDouble()),
  10623. Qt::DisplayRole);
  10624. }
  10625. /*:780*/
  10626. #line 18267 "./typica.w"
  10627. }
  10628. }
  10629. updateSourceColumn(source->text());
  10630. updateDestinationColumn(destination->text());
  10631. updateKnots();
  10632. connect(source,SIGNAL(textEdited(QString)),this,SLOT(updateSourceColumn(QString)));
  10633. connect(destination,SIGNAL(textEdited(QString)),this,SLOT(updateDestinationColumn(QString)));
  10634. connect(tablemodel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(updateKnots()));
  10635. setLayout(layout);
  10636. }
  10637. /*:778*//*781:*/
  10638. #line 18306 "./typica.w"
  10639. void LinearSplineInterpolationConfWidget::updateKnots()
  10640. {
  10641. updateAttribute("sourcevalues",tablemodel->arrayLiteral(0,Qt::DisplayRole));
  10642. updateAttribute("destinationvalues",tablemodel->arrayLiteral(1,Qt::DisplayRole));
  10643. }
  10644. void LinearSplineInterpolationConfWidget::updateSourceColumn(const QString&source)
  10645. {
  10646. updateAttribute("source",source);
  10647. }
  10648. void LinearSplineInterpolationConfWidget::updateDestinationColumn(const QString&dest)
  10649. {
  10650. updateAttribute("destination",dest);
  10651. }
  10652. /*:781*/
  10653. #line 600 "./typica.w"
  10654. /*784:*/
  10655. #line 18349 "./typica.w"
  10656. TranslationConfWidget::TranslationConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  10657. :BasicDeviceConfigurationWidget(model,index),
  10658. temperatureValue(new QDoubleSpinBox),unitSelector(new QComboBox)
  10659. {
  10660. unitSelector->addItem("Fahrenheit");
  10661. unitSelector->addItem("Celsius");
  10662. temperatureValue->setMinimum(0);
  10663. temperatureValue->setMaximum(1000);
  10664. QFormLayout*layout= new QFormLayout;
  10665. QLineEdit*column= new QLineEdit;
  10666. layout->addRow(tr("Column to match:"),column);
  10667. layout->addRow(tr("Unit:"),unitSelector);
  10668. layout->addRow(tr("Value:"),temperatureValue);
  10669. /*687:*/
  10670. #line 15251 "./typica.w"
  10671. QDomElement referenceElement=
  10672. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10673. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10674. QDomElement node;
  10675. /*:687*/
  10676. #line 18363 "./typica.w"
  10677. for(int i= 0;i<configData.size();i++)
  10678. {
  10679. node= configData.at(i).toElement();
  10680. if(node.attribute("name")=="column")
  10681. {
  10682. column->setText(node.attribute("value"));
  10683. }
  10684. else if(node.attribute("name")=="unit")
  10685. {
  10686. unitSelector->setCurrentIndex(unitSelector->findText(node.attribute("value")));
  10687. }
  10688. else if(node.attribute("name")=="value")
  10689. {
  10690. temperatureValue->setValue(node.attribute("value").toDouble());
  10691. }
  10692. }
  10693. updateMatchingColumn(column->text());
  10694. updateTemperature();
  10695. connect(column,SIGNAL(textEdited(QString)),this,SLOT(updateMatchingColumn(QString)));
  10696. connect(unitSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateTemperature()));
  10697. connect(temperatureValue,SIGNAL(valueChanged(double)),this,SLOT(updateTemperature()));
  10698. setLayout(layout);
  10699. }
  10700. /*:784*//*785:*/
  10701. #line 18392 "./typica.w"
  10702. void TranslationConfWidget::updateTemperature()
  10703. {
  10704. updateAttribute("unit",unitSelector->currentText());
  10705. updateAttribute("value",QString("%1").arg(temperatureValue->value()));
  10706. if(unitSelector->currentText()=="Fahrenheit")
  10707. {
  10708. updateAttribute("FValue",QString("%1").arg(temperatureValue->value()));
  10709. }
  10710. else
  10711. {
  10712. updateAttribute("FValue",QString("%1").arg(temperatureValue->value()*9/5+32));
  10713. }
  10714. }
  10715. void TranslationConfWidget::updateMatchingColumn(const QString&column)
  10716. {
  10717. updateAttribute("column",column);
  10718. }
  10719. /*:785*/
  10720. #line 601 "./typica.w"
  10721. /*744:*/
  10722. #line 24 "./freeannotation.w"
  10723. FreeAnnotationConfWidget::FreeAnnotationConfWidget(DeviceTreeModel*model,
  10724. const QModelIndex&index)
  10725. :BasicDeviceConfigurationWidget(model,index)
  10726. {
  10727. QFormLayout*layout= new QFormLayout;
  10728. QLineEdit*labelEdit= new QLineEdit;
  10729. layout->addRow(tr("Label Text:"),labelEdit);
  10730. /*687:*/
  10731. #line 15251 "./typica.w"
  10732. QDomElement referenceElement=
  10733. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10734. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10735. QDomElement node;
  10736. /*:687*/
  10737. #line 32 "./freeannotation.w"
  10738. for(int i= 0;i<configData.size();i++)
  10739. {
  10740. node= configData.at(i).toElement();
  10741. if(node.attribute("name")=="labeltext")
  10742. {
  10743. labelEdit->setText(node.attribute("value"));
  10744. }
  10745. }
  10746. updateLabel(labelEdit->text());
  10747. connect(labelEdit,SIGNAL(textEdited(QString)),
  10748. this,SLOT(updateLabel(QString)));
  10749. setLayout(layout);
  10750. }
  10751. /*:744*//*745:*/
  10752. #line 49 "./freeannotation.w"
  10753. void FreeAnnotationConfWidget::updateLabel(const QString&text)
  10754. {
  10755. updateAttribute("labeltext",text);
  10756. }
  10757. /*:745*/
  10758. #line 602 "./typica.w"
  10759. /*788:*/
  10760. #line 40 "./rate.w"
  10761. void RateOfChange::newMeasurement(Measurement measure)
  10762. {
  10763. cache.append(measure);
  10764. /*789:*/
  10765. #line 65 "./rate.w"
  10766. if(cache.size()> 2)
  10767. {
  10768. bool done= false;
  10769. while(!done)
  10770. {
  10771. if(cache.front().time().secsTo(cache.back().time())> ct)
  10772. {
  10773. cache.removeFirst();
  10774. }
  10775. else if(cache.back().time()<cache.front().time())
  10776. {
  10777. cache.removeFirst();
  10778. done= true;
  10779. }
  10780. else
  10781. {
  10782. done= true;
  10783. }
  10784. if(cache.size()<3)
  10785. {
  10786. done= true;
  10787. }
  10788. }
  10789. }
  10790. /*:789*/
  10791. #line 44 "./rate.w"
  10792. if(cache.size()>=2)
  10793. {
  10794. /*790:*/
  10795. #line 100 "./rate.w"
  10796. QList<double> rates;
  10797. for(int i= 1;i<cache.size();i++)
  10798. {
  10799. double mdiff= cache.at(i).temperature()-cache.at(i-1).temperature();
  10800. double tdiff= (double)(cache.at(i-1).time().msecsTo(cache.at(i).time()))/1000.0;
  10801. rates.append(mdiff/tdiff);
  10802. }
  10803. double acc= 0.0;
  10804. for(int i= 0;i<rates.size();i++)
  10805. {
  10806. acc+= rates.at(i);
  10807. }
  10808. double pavg= acc/= rates.size();
  10809. double v2= pavg*st;
  10810. double refm= cache.back().temperature()-cache.front().temperature();
  10811. double reft= (double)(cache.front().time().msecsTo(cache.back().time()))/1000.0;
  10812. double ref= refm/reft;
  10813. Measurement value(v2,cache.back().time(),cache.back().scale());
  10814. value.insert("relative",true);
  10815. emit newData(value);
  10816. double calcdiff= ref-pavg;
  10817. if(calcdiff<0)
  10818. {
  10819. calcdiff= -calcdiff;
  10820. }
  10821. if(pavg<0)
  10822. {
  10823. pavg= -pavg;
  10824. }
  10825. if(calcdiff> (pavg*0.2))
  10826. {
  10827. Measurement save= cache.back();
  10828. cache.clear();
  10829. cache.append(save);
  10830. }
  10831. /*:790*/
  10832. #line 47 "./rate.w"
  10833. }
  10834. }
  10835. /*:788*//*791:*/
  10836. #line 139 "./rate.w"
  10837. RateOfChange::RateOfChange(int cachetime,int scaletime):ct(cachetime),st(1)
  10838. {
  10839. setScaleTime(scaletime);
  10840. }
  10841. void RateOfChange::setCacheTime(int seconds)
  10842. {
  10843. ct= seconds;
  10844. }
  10845. void RateOfChange::setScaleTime(int seconds)
  10846. {
  10847. st= (seconds> 0?seconds:1);
  10848. }
  10849. /*:791*/
  10850. #line 603 "./typica.w"
  10851. /*748:*/
  10852. #line 26 "./settings.w"
  10853. SettingsWindow::SettingsWindow():QMainWindow(NULL)
  10854. {
  10855. QTabWidget*settingsTab= new QTabWidget;
  10856. DeviceConfigurationWindow*deviceSettings= new DeviceConfigurationWindow;
  10857. settingsTab->addTab(deviceSettings,tr("Roasters"));
  10858. GraphSettingsWidget*graphSettings= new GraphSettingsWidget;
  10859. settingsTab->addTab(graphSettings,tr("Graph"));
  10860. setCentralWidget(settingsTab);
  10861. }
  10862. /*:748*/
  10863. #line 604 "./typica.w"
  10864. /*753:*/
  10865. #line 27 "./graphsettings.w"
  10866. GraphSettingsWidget::GraphSettingsWidget():QWidget(NULL)
  10867. {
  10868. QTabWidget*graphCategories= new QTabWidget;
  10869. GraphSettingsRelativeTab*relative= new GraphSettingsRelativeTab;
  10870. graphCategories->addTab(relative,tr("Relative Temperatures"));
  10871. QVBoxLayout*layout= new QVBoxLayout;
  10872. layout->addWidget(graphCategories);
  10873. setLayout(layout);
  10874. }
  10875. /*:753*//*755:*/
  10876. #line 65 "./graphsettings.w"
  10877. GraphSettingsRelativeTab::GraphSettingsRelativeTab():QWidget(NULL),
  10878. colorEdit(new QLineEdit)
  10879. {
  10880. QSettings settings;
  10881. QVBoxLayout*layout= new QVBoxLayout;
  10882. QCheckBox*enable= new QCheckBox(tr("Graph relative temperatures"));
  10883. enable->setChecked(settings.value("settings/graph/relative/enable",true).toBool());
  10884. updateEnableSetting(enable->isChecked());
  10885. connect(enable,SIGNAL(toggled(bool)),this,SLOT(updateEnableSetting(bool)));
  10886. layout->addWidget(enable);
  10887. QHBoxLayout*colorLayout= new QHBoxLayout;
  10888. QLabel*colorLabel= new QLabel(tr("Axis color:"));
  10889. colorEdit->setText(settings.value("settings/graph/relative/color","#000000").toString());
  10890. updateColorSetting(colorEdit->text());
  10891. connect(colorEdit,SIGNAL(textChanged(QString)),this,SLOT(updateColorSetting(QString)));
  10892. QToolButton*colorPickerButton= new QToolButton();
  10893. colorPickerButton->setIcon(QIcon::fromTheme("applications-graphics"));
  10894. connect(colorPickerButton,SIGNAL(clicked()),this,SLOT(showColorPicker()));
  10895. colorLayout->addWidget(colorLabel);
  10896. colorLayout->addWidget(colorEdit);
  10897. colorLayout->addWidget(colorPickerButton);
  10898. colorLayout->addStretch();
  10899. layout->addLayout(colorLayout);
  10900. QHBoxLayout*unitLayout= new QHBoxLayout;
  10901. QLabel*unitLabel= new QLabel(tr("Unit"));
  10902. QComboBox*unitSelector= new QComboBox;
  10903. unitSelector->addItem(tr("Fahrenheit"));
  10904. unitSelector->addItem(tr("Celsius"));
  10905. unitSelector->setCurrentIndex(settings.value("settings/graph/relative/unit",0).toInt());
  10906. updateUnit(unitSelector->currentIndex());
  10907. connect(unitSelector,SIGNAL(currentIndexChanged(int)),this,SLOT(updateUnit(int)));
  10908. unitLayout->addWidget(unitLabel);
  10909. unitLayout->addWidget(unitSelector);
  10910. unitLayout->addStretch();
  10911. layout->addLayout(unitLayout);
  10912. QHBoxLayout*axisLayout= new QHBoxLayout;
  10913. QLabel*axisLabel= new QLabel(tr("Grid line positions (comma separated):"));
  10914. QLineEdit*axisEdit= new QLineEdit;
  10915. axisEdit->setText(settings.value("settings/graph/relative/grid","-300, -100, -10, 0, 10, 30, 50").toString());
  10916. updateAxisSetting(axisEdit->text());
  10917. connect(axisEdit,SIGNAL(textChanged(QString)),this,SLOT(updateAxisSetting(QString)));
  10918. axisLayout->addWidget(axisLabel);
  10919. axisLayout->addWidget(axisEdit);
  10920. layout->addLayout(axisLayout);
  10921. layout->addStretch();
  10922. setLayout(layout);
  10923. }
  10924. /*:755*//*756:*/
  10925. #line 116 "./graphsettings.w"
  10926. void GraphSettingsRelativeTab::updateEnableSetting(bool enabled)
  10927. {
  10928. QSettings settings;
  10929. settings.setValue("settings/graph/relative/enable",enabled);
  10930. }
  10931. void GraphSettingsRelativeTab::updateColorSetting(const QString&color)
  10932. {
  10933. QSettings settings;
  10934. settings.setValue("settings/graph/relative/color",color);
  10935. }
  10936. void GraphSettingsRelativeTab::updateAxisSetting(const QString&gridList)
  10937. {
  10938. QSettings settings;
  10939. QString settingValue;
  10940. QStringList points= gridList.split(QRegExp("[\\s,]+"),QString::SkipEmptyParts);
  10941. QStringList numbers;
  10942. foreach(QString text,points)
  10943. {
  10944. bool okay= false;
  10945. text.toDouble(&okay);
  10946. if(okay)
  10947. {
  10948. numbers.append(text);
  10949. }
  10950. }
  10951. numbers.removeDuplicates();
  10952. settings.setValue("settings/graph/relative/grid",numbers.join(","));
  10953. }
  10954. void GraphSettingsRelativeTab::updateUnit(int unit)
  10955. {
  10956. QSettings settings;
  10957. settings.setValue("settings/graph/relative/unit",unit);
  10958. }
  10959. /*:756*//*757:*/
  10960. #line 159 "./graphsettings.w"
  10961. void GraphSettingsRelativeTab::showColorPicker()
  10962. {
  10963. QColor color= QColorDialog::getColor(QColor(colorEdit->text()),this);
  10964. colorEdit->setText(color.name());
  10965. }
  10966. #line 16996 "./typica.w"
  10967. /*:757*/
  10968. #line 605 "./typica.w"
  10969. /*823:*/
  10970. #line 682 "./dataqsdk.w"
  10971. DataqSdkDeviceConfWidget::DataqSdkDeviceConfWidget(DeviceTreeModel*model,
  10972. const QModelIndex&index)
  10973. :BasicDeviceConfigurationWidget(model,index),
  10974. deviceIdStack(new QStackedWidget)
  10975. {
  10976. QVBoxLayout*layout= new QVBoxLayout;
  10977. QCheckBox*autoDetect= new QCheckBox("Automatically select device");
  10978. layout->addWidget(autoDetect);
  10979. QWidget*autoLayerWidget= new QWidget;
  10980. QHBoxLayout*autoLayerLayout= new QHBoxLayout;
  10981. QLabel*autoLabel= new QLabel(tr("Device number"));
  10982. QSpinBox*autoNumber= new QSpinBox;
  10983. autoNumber->setMinimum(1);
  10984. autoNumber->setMaximum(99);
  10985. autoLayerLayout->addWidget(autoLabel);
  10986. autoLayerLayout->addWidget(autoNumber);
  10987. autoLayerWidget->setLayout(autoLayerLayout);
  10988. QWidget*fixedLayerWidget= new QWidget;
  10989. QHBoxLayout*fixedLayerLayout= new QHBoxLayout;
  10990. QLabel*fixedLabel= new QLabel(tr("Device port"));
  10991. QComboBox*portSelection= new QComboBox;
  10992. portSelection->setEditable(true);
  10993. portSelection->addItems(DataqSdkDevice::detectHardware());
  10994. fixedLayerLayout->addWidget(fixedLabel);
  10995. fixedLayerLayout->addWidget(portSelection);
  10996. fixedLayerWidget->setLayout(fixedLayerLayout);
  10997. deviceIdStack->addWidget(autoLayerWidget);
  10998. deviceIdStack->addWidget(fixedLayerWidget);
  10999. layout->addWidget(deviceIdStack);
  11000. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  11001. layout->addWidget(addChannelButton);
  11002. /*687:*/
  11003. #line 15251 "./typica.w"
  11004. QDomElement referenceElement=
  11005. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11006. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11007. QDomElement node;
  11008. /*:687*/
  11009. #line 714 "./dataqsdk.w"
  11010. for(int i= 0;i<configData.size();i++)
  11011. {
  11012. node= configData.at(i).toElement();
  11013. if(node.attribute("name")=="autoSelect")
  11014. {
  11015. autoDetect->setChecked(node.attribute("value")=="true"?true:false);
  11016. }
  11017. else if(node.attribute("name")=="deviceNumber")
  11018. {
  11019. autoNumber->setValue(node.attribute("value").toInt());
  11020. }
  11021. else if(node.attribute("name")=="port")
  11022. {
  11023. int index= portSelection->findText(node.attribute("value"));
  11024. if(index> -1)
  11025. {
  11026. portSelection->setCurrentIndex(index);
  11027. }
  11028. else
  11029. {
  11030. portSelection->setEditText(node.attribute("value"));
  11031. }
  11032. }
  11033. }
  11034. updateAutoSelect(autoDetect->isChecked());
  11035. updateDeviceNumber(autoNumber->value());
  11036. updatePort(portSelection->currentText());
  11037. connect(autoDetect,SIGNAL(toggled(bool)),this,SLOT(updateAutoSelect(bool)));
  11038. connect(autoNumber,SIGNAL(valueChanged(int)),this,SLOT(updateDeviceNumber(int)));
  11039. connect(portSelection,SIGNAL(currentIndexChanged(QString)),this,SLOT(updatePort(QString)));
  11040. connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
  11041. setLayout(layout);
  11042. }
  11043. /*:823*//*824:*/
  11044. #line 758 "./dataqsdk.w"
  11045. void DataqSdkDeviceConfWidget::updateAutoSelect(bool automatic)
  11046. {
  11047. if(automatic)
  11048. {
  11049. updateAttribute("autoSelect","true");
  11050. deviceIdStack->setCurrentIndex(0);
  11051. }
  11052. else
  11053. {
  11054. updateAttribute("autoSelect","false");
  11055. deviceIdStack->setCurrentIndex(1);
  11056. }
  11057. }
  11058. /*:824*//*825:*/
  11059. #line 775 "./dataqsdk.w"
  11060. void DataqSdkDeviceConfWidget::updateDeviceNumber(int deviceNumber)
  11061. {
  11062. updateAttribute("deviceNumber",QString("%1").arg(deviceNumber));
  11063. }
  11064. void DataqSdkDeviceConfWidget::updatePort(QString portId)
  11065. {
  11066. updateAttribute("port",portId);
  11067. }
  11068. /*:825*//*826:*/
  11069. #line 788 "./dataqsdk.w"
  11070. void DataqSdkDeviceConfWidget::addChannel()
  11071. {
  11072. insertChildNode(tr("Channel"),"dataqsdkchannel");
  11073. }
  11074. /*:826*//*829:*/
  11075. #line 868 "./dataqsdk.w"
  11076. DataqSdkChannelConfWidget::DataqSdkChannelConfWidget(DeviceTreeModel*model,
  11077. const QModelIndex&index)
  11078. :BasicDeviceConfigurationWidget(model,index),
  11079. startButton(new QPushButton(tr("Start"))),
  11080. resetButton(new QPushButton(tr("Reset"))),
  11081. stopButton(new QPushButton(tr("Stop"))),
  11082. calibrator(new LinearCalibrator),
  11083. currentMeasurement(new QLineEdit),minimumMeasurement(new QLineEdit),
  11084. maximumMeasurement(new QLineEdit),averageMeasurement(new QLineEdit),
  11085. currentMapped(new QLineEdit),minimumMapped(new QLineEdit),
  11086. maximumMapped(new QLineEdit),averageMapped(new QLineEdit),
  11087. rmCount(0),cmCount(0),
  11088. rmin(std::numeric_limits<double> ::max()),
  11089. rmax(std::numeric_limits<double> ::min()),rmean(0),
  11090. cmin(std::numeric_limits<double> ::max()),
  11091. cmax(std::numeric_limits<double> ::min()),cmean(0)
  11092. {
  11093. /*833:*/
  11094. #line 1107 "./dataqsdk.w"
  11095. QDomElement parentReference= model->referenceElement(model->data(index.parent(),Qt::UserRole).toString());
  11096. QDomNodeList deviceConfigData= parentReference.elementsByTagName("attribute");
  11097. QDomElement deviceNode;
  11098. QString configPort;
  11099. QString configAuto;
  11100. for(int i= 0;i<deviceConfigData.size();i++)
  11101. {
  11102. deviceNode= deviceConfigData.at(i).toElement();
  11103. if(deviceNode.attribute("name")=="autoSelect")
  11104. {
  11105. autoSelect= (deviceNode.attribute("value")=="true");
  11106. }
  11107. else if(deviceNode.attribute("name")=="deviceNumber")
  11108. {
  11109. configAuto= deviceNode.attribute("value");
  11110. }
  11111. else if(deviceNode.attribute("name")=="port")
  11112. {
  11113. configPort= deviceNode.attribute("value");
  11114. }
  11115. }
  11116. deviceID= autoSelect?configAuto:configPort;
  11117. channelOfInterest= index.row();
  11118. /*:833*/
  11119. #line 886 "./dataqsdk.w"
  11120. resetButton->setEnabled(false);
  11121. stopButton->setEnabled(false);
  11122. connect(startButton,SIGNAL(clicked()),this,SLOT(startCalibration()));
  11123. connect(resetButton,SIGNAL(clicked()),this,SLOT(resetCalibration()));
  11124. connect(stopButton,SIGNAL(clicked()),this,SLOT(stopCalibration()));
  11125. QVBoxLayout*layout= new QVBoxLayout;
  11126. QFormLayout*topLayout= new QFormLayout;
  11127. QLineEdit*columnEdit= new QLineEdit;
  11128. topLayout->addRow(tr("Column name"),columnEdit);
  11129. QComboBox*unitSelector= new QComboBox;
  11130. unitSelector->addItem(tr("Temperature"));
  11131. unitSelector->addItem(tr("Control"));
  11132. topLayout->addRow(tr("Measurement type"),unitSelector);
  11133. QCheckBox*smoothingBox= new QCheckBox(tr("Enable smoothing"));
  11134. topLayout->addRow(smoothingBox);
  11135. layout->addLayout(topLayout);
  11136. QCheckBox*hideSeries= new QCheckBox(tr("Hide this channel"));
  11137. topLayout->addRow(hideSeries);
  11138. QLabel*calibrationLabel= new QLabel(tr("Calibration settings"));
  11139. layout->addWidget(calibrationLabel);
  11140. QHBoxLayout*calibrationLayout= new QHBoxLayout;
  11141. QFormLayout*calibrationControlsLayout= new QFormLayout;
  11142. QLineEdit*measuredLowerEdit= new QLineEdit;
  11143. measuredLowerEdit->setText("0");
  11144. QLineEdit*measuredUpperEdit= new QLineEdit;
  11145. measuredUpperEdit->setText("10");
  11146. QLineEdit*mappedLowerEdit= new QLineEdit;
  11147. mappedLowerEdit->setText("0");
  11148. QLineEdit*mappedUpperEdit= new QLineEdit;
  11149. mappedUpperEdit->setText("10");
  11150. calibrationControlsLayout->addRow(tr("Measured lower value"),measuredLowerEdit);
  11151. calibrationControlsLayout->addRow(tr("Mapped lower value"),mappedLowerEdit);
  11152. calibrationControlsLayout->addRow(tr("Measured upper value"),measuredUpperEdit);
  11153. calibrationControlsLayout->addRow(tr("Mapped upper value"),mappedUpperEdit);
  11154. QCheckBox*closedBox= new QCheckBox(tr("Closed range"));
  11155. calibrationControlsLayout->addRow(closedBox);
  11156. QLineEdit*sensitivityEdit= new QLineEdit;
  11157. sensitivityEdit->setText("0");
  11158. calibrationControlsLayout->addRow(tr("Discrete interval skip"),sensitivityEdit);
  11159. QVBoxLayout*calibrationTestLayout= new QVBoxLayout;
  11160. QHBoxLayout*deviceControlLayout= new QHBoxLayout;
  11161. deviceControlLayout->addWidget(startButton);
  11162. deviceControlLayout->addWidget(resetButton);
  11163. deviceControlLayout->addWidget(stopButton);
  11164. QFormLayout*indicatorLayout= new QFormLayout;
  11165. currentMeasurement->setReadOnly(true);
  11166. minimumMeasurement->setReadOnly(true);
  11167. maximumMeasurement->setReadOnly(true);
  11168. averageMeasurement->setReadOnly(true);
  11169. currentMapped->setReadOnly(true);
  11170. minimumMapped->setReadOnly(true);
  11171. maximumMapped->setReadOnly(true);
  11172. averageMapped->setReadOnly(true);
  11173. indicatorLayout->addRow(tr("Measured Values"),new QWidget);
  11174. indicatorLayout->addRow(tr("Current"),currentMeasurement);
  11175. indicatorLayout->addRow(tr("Minimum"),minimumMeasurement);
  11176. indicatorLayout->addRow(tr("Maximum"),maximumMeasurement);
  11177. indicatorLayout->addRow(tr("Mean"),averageMeasurement);
  11178. indicatorLayout->addRow(tr("Mapped Values"),new QWidget);
  11179. indicatorLayout->addRow(tr("Current Mapped"),currentMapped);
  11180. indicatorLayout->addRow(tr("Minimum Mapped"),minimumMapped);
  11181. indicatorLayout->addRow(tr("Maximum Mapped"),maximumMapped);
  11182. indicatorLayout->addRow(tr("Mean Mapped"),averageMapped);
  11183. calibrationTestLayout->addLayout(deviceControlLayout);
  11184. calibrationTestLayout->addLayout(indicatorLayout);
  11185. calibrationLayout->addLayout(calibrationControlsLayout);
  11186. calibrationLayout->addLayout(calibrationTestLayout);
  11187. layout->addLayout(calibrationLayout);
  11188. /*687:*/
  11189. #line 15251 "./typica.w"
  11190. QDomElement referenceElement=
  11191. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11192. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11193. QDomElement node;
  11194. /*:687*/
  11195. #line 955 "./dataqsdk.w"
  11196. for(int i= 0;i<configData.size();i++)
  11197. {
  11198. node= configData.at(i).toElement();
  11199. if(node.attribute("name")=="column")
  11200. {
  11201. columnEdit->setText(node.attribute("value"));
  11202. }
  11203. else if(node.attribute("name")=="type")
  11204. {
  11205. unitSelector->setCurrentIndex(unitSelector->findText(node.attribute("value")));
  11206. }
  11207. else if(node.attribute("name")=="smoothing")
  11208. {
  11209. smoothingBox->setChecked(node.attribute("value")=="true");
  11210. }
  11211. else if(node.attribute("name")=="calibrationMeasuredLower")
  11212. {
  11213. measuredLowerEdit->setText(node.attribute("value"));
  11214. }
  11215. else if(node.attribute("name")=="calibrationMeasuredUpper")
  11216. {
  11217. measuredUpperEdit->setText(node.attribute("value"));
  11218. }
  11219. else if(node.attribute("name")=="calibrationMappedLower")
  11220. {
  11221. mappedLowerEdit->setText(node.attribute("value"));
  11222. }
  11223. else if(node.attribute("name")=="calibrationMappedUpper")
  11224. {
  11225. mappedUpperEdit->setText(node.attribute("value"));
  11226. }
  11227. else if(node.attribute("name")=="calibrationClosedInterval")
  11228. {
  11229. closedBox->setChecked(node.attribute("value")=="true");
  11230. }
  11231. else if(node.attribute("name")=="calibrationSensitivity")
  11232. {
  11233. sensitivityEdit->setText(node.attribute("value"));
  11234. }
  11235. else if(node.attribute("name")=="hidden")
  11236. {
  11237. hideSeries->setChecked(node.attribute("value")=="true");
  11238. }
  11239. }
  11240. updateColumnName(columnEdit->text());
  11241. updateUnits(unitSelector->currentText());
  11242. updateSmoothingEnabled(smoothingBox->isChecked());
  11243. updateMeasuredLower(measuredLowerEdit->text());
  11244. updateMeasuredUpper(measuredUpperEdit->text());
  11245. updateMappedLower(mappedLowerEdit->text());
  11246. updateMappedUpper(mappedUpperEdit->text());
  11247. updateClosedInterval(closedBox->isChecked());
  11248. updateSensitivity(sensitivityEdit->text());
  11249. updateHidden(hideSeries->isChecked());
  11250. connect(columnEdit,SIGNAL(textChanged(QString)),
  11251. this,SLOT(updateColumnName(QString)));
  11252. connect(unitSelector,SIGNAL(currentIndexChanged(QString)),
  11253. this,SLOT(updateUnits(QString)));
  11254. connect(smoothingBox,SIGNAL(toggled(bool)),
  11255. this,SLOT(updateSmoothingEnabled(bool)));
  11256. connect(measuredLowerEdit,SIGNAL(textChanged(QString)),
  11257. this,SLOT(updateMeasuredLower(QString)));
  11258. connect(mappedLowerEdit,SIGNAL(textChanged(QString)),
  11259. this,SLOT(updateMappedLower(QString)));
  11260. connect(measuredUpperEdit,SIGNAL(textChanged(QString)),
  11261. this,SLOT(updateMeasuredUpper(QString)));
  11262. connect(mappedUpperEdit,SIGNAL(textChanged(QString)),
  11263. this,SLOT(updateMappedUpper(QString)));
  11264. connect(closedBox,SIGNAL(toggled(bool)),
  11265. this,SLOT(updateClosedInterval(bool)));
  11266. connect(sensitivityEdit,SIGNAL(textChanged(QString)),
  11267. this,SLOT(updateSensitivity(QString)));
  11268. connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  11269. setLayout(layout);
  11270. }
  11271. /*:829*//*830:*/
  11272. #line 1038 "./dataqsdk.w"
  11273. void DataqSdkChannelConfWidget::updateUnits(const QString&unit)
  11274. {
  11275. updateAttribute("type",unit);
  11276. }
  11277. /*:830*//*831:*/
  11278. #line 1047 "./dataqsdk.w"
  11279. void DataqSdkChannelConfWidget::updateMeasuredLower(const QString&value)
  11280. {
  11281. updateAttribute("calibrationMeasuredLower",value);
  11282. calibrator->setMeasuredLower(value.toDouble());
  11283. }
  11284. void DataqSdkChannelConfWidget::updateMeasuredUpper(const QString&value)
  11285. {
  11286. updateAttribute("calibrationMeasuredUpper",value);
  11287. calibrator->setMeasuredUpper(value.toDouble());
  11288. }
  11289. void DataqSdkChannelConfWidget::updateMappedLower(const QString&value)
  11290. {
  11291. updateAttribute("calibrationMappedLower",value);
  11292. calibrator->setMappedLower(value.toDouble());
  11293. }
  11294. void DataqSdkChannelConfWidget::updateMappedUpper(const QString&value)
  11295. {
  11296. updateAttribute("calibrationMappedUpper",value);
  11297. calibrator->setMappedUpper(value.toDouble());
  11298. }
  11299. void DataqSdkChannelConfWidget::updateClosedInterval(bool closed)
  11300. {
  11301. updateAttribute("calibrationClosedInterval",closed?"true":"false");
  11302. calibrator->setClosedRange(closed);
  11303. }
  11304. void DataqSdkChannelConfWidget::updateSmoothingEnabled(bool enabled)
  11305. {
  11306. updateAttribute("smoothing",enabled?"true":"false");
  11307. }
  11308. void DataqSdkChannelConfWidget::updateSensitivity(const QString&value)
  11309. {
  11310. updateAttribute("calibrationSensitivity",value);
  11311. calibrator->setSensitivity(value.toDouble());
  11312. }
  11313. void DataqSdkChannelConfWidget::updateHidden(bool hidden)
  11314. {
  11315. updateAttribute("hidden",hidden?"true":"false");
  11316. }
  11317. /*:831*//*834:*/
  11318. #line 1136 "./dataqsdk.w"
  11319. void DataqSdkChannelConfWidget::startCalibration()
  11320. {
  11321. startButton->setEnabled(false);
  11322. stopButton->setEnabled(true);
  11323. resetButton->setEnabled(true);
  11324. calibrationDevice= new DataqSdkDevice(deviceID);
  11325. Channel*channel;
  11326. for(int i= 0;i<=channelOfInterest;i++)
  11327. {
  11328. channel= calibrationDevice->newChannel(Units::Unitless);
  11329. }
  11330. connect(channel,SIGNAL(newData(Measurement)),this,SLOT(updateInput(Measurement)));
  11331. connect(channel,SIGNAL(newData(Measurement)),calibrator,SLOT(newMeasurement(Measurement)));
  11332. connect(calibrator,SIGNAL(newData(Measurement)),this,SLOT(updateOutput(Measurement)));
  11333. calibrationDevice->setClockRate(6.0/(1.0+channelOfInterest));
  11334. calibrationDevice->start();
  11335. }
  11336. void DataqSdkChannelConfWidget::stopCalibration()
  11337. {
  11338. startButton->setEnabled(true);
  11339. stopButton->setEnabled(false);
  11340. resetButton->setEnabled(false);
  11341. calibrationDevice->deleteLater();
  11342. /*836:*/
  11343. #line 1181 "./dataqsdk.w"
  11344. rmCount= 0;
  11345. cmCount= 0;
  11346. rmin= std::numeric_limits<double> ::max();
  11347. rmax= std::numeric_limits<double> ::min();
  11348. rmean= 0;
  11349. cmin= std::numeric_limits<double> ::max();
  11350. cmax= std::numeric_limits<double> ::min();
  11351. cmean= 0;
  11352. /*:836*/
  11353. #line 1161 "./dataqsdk.w"
  11354. }
  11355. /*:834*//*835:*/
  11356. #line 1172 "./dataqsdk.w"
  11357. void DataqSdkChannelConfWidget::resetCalibration()
  11358. {
  11359. /*836:*/
  11360. #line 1181 "./dataqsdk.w"
  11361. rmCount= 0;
  11362. cmCount= 0;
  11363. rmin= std::numeric_limits<double> ::max();
  11364. rmax= std::numeric_limits<double> ::min();
  11365. rmean= 0;
  11366. cmin= std::numeric_limits<double> ::max();
  11367. cmax= std::numeric_limits<double> ::min();
  11368. cmean= 0;
  11369. /*:836*/
  11370. #line 1175 "./dataqsdk.w"
  11371. }
  11372. /*:835*//*837:*/
  11373. #line 1195 "./dataqsdk.w"
  11374. void DataqSdkChannelConfWidget::updateInput(Measurement measure)
  11375. {
  11376. double nv= measure.temperature();
  11377. currentMeasurement->setText(QString("%1").arg(nv));
  11378. rmin= qMin(nv,rmin);
  11379. minimumMeasurement->setText(QString("%1").arg(rmin));
  11380. rmax= qMax(nv,rmax);
  11381. maximumMeasurement->setText(QString("%1").arg(rmax));
  11382. rmean= ((rmean*rmCount)+nv)/(rmCount+1);
  11383. rmCount++;
  11384. averageMeasurement->setText(QString("%1").arg(rmean));
  11385. }
  11386. void DataqSdkChannelConfWidget::updateOutput(Measurement measure)
  11387. {
  11388. double nv= measure.temperature();
  11389. currentMapped->setText(QString("%1").arg(nv));
  11390. cmin= qMin(nv,cmin);
  11391. minimumMapped->setText(QString("%1").arg(cmin));
  11392. cmax= qMax(nv,cmax);
  11393. maximumMapped->setText(QString("%1").arg(cmax));
  11394. cmean= ((cmean*cmCount)+nv)/(cmCount+1);
  11395. cmCount++;
  11396. averageMapped->setText(QString("%1").arg(cmean));
  11397. }
  11398. /*:837*//*838:*/
  11399. #line 1224 "./dataqsdk.w"
  11400. void DataqSdkChannelConfWidget::updateColumnName(const QString&value)
  11401. {
  11402. updateAttribute("column",value);
  11403. }
  11404. /*:838*/
  11405. #line 606 "./typica.w"
  11406. /*862:*/
  11407. #line 393 "./scales.w"
  11408. SerialScaleConfWidget::SerialScaleConfWidget(DeviceTreeModel*model,
  11409. const QModelIndex&index)
  11410. :BasicDeviceConfigurationWidget(model,index),
  11411. port(new PortSelector),baud(new BaudSelector),parity(new ParitySelector),
  11412. flow(new FlowSelector),stop(new StopSelector)
  11413. {
  11414. QFormLayout*layout= new QFormLayout;
  11415. layout->addRow(tr("Port:"),port);
  11416. connect(port,SIGNAL(currentIndexChanged(QString)),
  11417. this,SLOT(updatePort(QString)));
  11418. connect(port,SIGNAL(editTextChanged(QString)),
  11419. this,SLOT(updatePort(QString)));
  11420. layout->addRow(tr("Baud:"),baud);
  11421. connect(baud,SIGNAL(currentIndexChanged(QString)),
  11422. this,SLOT(updateBaudRate(QString)));
  11423. layout->addRow(tr("Parity:"),parity);
  11424. connect(parity,SIGNAL(currentIndexChanged(int)),
  11425. this,SLOT(updateParity(int)));
  11426. layout->addRow(tr("Flow Control:"),flow);
  11427. connect(flow,SIGNAL(currentIndexChanged(int)),
  11428. this,SLOT(updateFlowControl(int)));
  11429. layout->addRow(tr("Stop Bits:"),stop);
  11430. connect(stop,SIGNAL(currentIndexChanged(int)),
  11431. this,SLOT(updateStopBits(int)));
  11432. /*687:*/
  11433. #line 15251 "./typica.w"
  11434. QDomElement referenceElement=
  11435. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11436. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11437. QDomElement node;
  11438. /*:687*/
  11439. #line 418 "./scales.w"
  11440. for(int i= 0;i<configData.size();i++)
  11441. {
  11442. node= configData.at(i).toElement();
  11443. if(node.attribute("name")=="port")
  11444. {
  11445. int j= port->findText(node.attribute("value"));
  11446. if(j>=0)
  11447. {
  11448. port->setCurrentIndex(j);
  11449. }
  11450. else
  11451. {
  11452. port->insertItem(0,node.attribute("value"));
  11453. port->setCurrentIndex(0);
  11454. }
  11455. }
  11456. else if(node.attribute("name")=="baudrate")
  11457. {
  11458. baud->setCurrentIndex(baud->findText(node.attribute("value")));
  11459. }
  11460. else if(node.attribute("name")=="parity")
  11461. {
  11462. parity->setCurrentIndex(parity->findData(node.attribute("value")));
  11463. }
  11464. else if(node.attribute("name")=="flowcontrol")
  11465. {
  11466. flow->setCurrentIndex(flow->findData(node.attribute("value")));
  11467. }
  11468. else if(node.attribute("name")=="stopbits")
  11469. {
  11470. stop->setCurrentIndex(stop->findData(node.attribute("value")));
  11471. }
  11472. }
  11473. updatePort(port->currentText());
  11474. updateBaudRate(baud->currentText());
  11475. updateParity(parity->currentIndex());
  11476. updateFlowControl(flow->currentIndex());
  11477. updateStopBits(stop->currentIndex());
  11478. setLayout(layout);
  11479. }
  11480. /*:862*//*863:*/
  11481. #line 462 "./scales.w"
  11482. void SerialScaleConfWidget::updatePort(const QString&newPort)
  11483. {
  11484. updateAttribute("port",newPort);
  11485. }
  11486. void SerialScaleConfWidget::updateBaudRate(const QString&rate)
  11487. {
  11488. updateAttribute("baudrate",rate);
  11489. }
  11490. void SerialScaleConfWidget::updateParity(int index)
  11491. {
  11492. updateAttribute("parity",parity->itemData(index).toString());
  11493. }
  11494. void SerialScaleConfWidget::updateFlowControl(int index)
  11495. {
  11496. updateAttribute("flowcontrol",flow->itemData(index).toString());
  11497. }
  11498. void SerialScaleConfWidget::updateStopBits(int index)
  11499. {
  11500. updateAttribute("stopbits",stop->itemData(index).toString());
  11501. }
  11502. /*:863*/
  11503. #line 607 "./typica.w"
  11504. /*875:*/
  11505. #line 195 "./valueannotation.w"
  11506. void ValueAnnotation::newMeasurement(Measurement measure)
  11507. {
  11508. for(int i= 0;i<values.size();i++)
  11509. {
  11510. if(measure.temperature()> values.at(i)-tolerance&&
  11511. measure.temperature()<values.at(i)+tolerance)
  11512. {
  11513. if(i!=lastIndex)
  11514. {
  11515. lastIndex= i;
  11516. emit annotation(annotations.at(i),measurementColumn,annotationColumn);
  11517. }
  11518. }
  11519. }
  11520. }
  11521. /*:875*//*876:*/
  11522. #line 216 "./valueannotation.w"
  11523. void ValueAnnotation::annotate()
  11524. {
  11525. if(lastIndex> -1)
  11526. {
  11527. emit annotation(annotations.at(lastIndex),measurementColumn,annotationColumn);
  11528. }
  11529. }
  11530. /*:876*//*877:*/
  11531. #line 228 "./valueannotation.w"
  11532. void ValueAnnotation::setAnnotation(double value,const QString&annotation)
  11533. {
  11534. values.append(value);
  11535. annotations.append(annotation);
  11536. }
  11537. /*:877*//*878:*/
  11538. #line 237 "./valueannotation.w"
  11539. void ValueAnnotation::setAnnotationColumn(int column)
  11540. {
  11541. annotationColumn= column;
  11542. }
  11543. void ValueAnnotation::setTemperatureColumn(int column)
  11544. {
  11545. measurementColumn= column;
  11546. }
  11547. void ValueAnnotation::setTolerance(double epsilon)
  11548. {
  11549. tolerance= epsilon;
  11550. }
  11551. /*:878*//*879:*/
  11552. #line 255 "./valueannotation.w"
  11553. ValueAnnotation::ValueAnnotation():QObject(),
  11554. lastIndex(-1),annotationColumn(2),measurementColumn(1),tolerance(0.05)
  11555. {
  11556. }
  11557. /*:879*/
  11558. #line 608 "./typica.w"
  11559. /*867:*/
  11560. #line 33 "./valueannotation.w"
  11561. ValueAnnotationConfWidget::ValueAnnotationConfWidget(DeviceTreeModel*model,
  11562. const QModelIndex&index)
  11563. :BasicDeviceConfigurationWidget(model,index),
  11564. tablemodel(new SaltModel(2))
  11565. {
  11566. QFormLayout*layout= new QFormLayout;
  11567. QLineEdit*source= new QLineEdit;
  11568. layout->addRow(tr("Source column name:"),source);
  11569. QCheckBox*noteOnStart= new QCheckBox(tr("Produce Start State Annotation"));
  11570. noteOnStart->setChecked(true);
  11571. layout->addRow(noteOnStart);
  11572. tablemodel->setHeaderData(0,Qt::Horizontal,"Value");
  11573. tablemodel->setHeaderData(1,Qt::Horizontal,"Annotation");
  11574. QTableView*annotationTable= new QTableView;
  11575. annotationTable->setModel(tablemodel);
  11576. NumericDelegate*delegate= new NumericDelegate;
  11577. annotationTable->setItemDelegateForColumn(0,delegate);
  11578. layout->addRow(tr("Annotations for values:"),annotationTable);
  11579. /*687:*/
  11580. #line 15251 "./typica.w"
  11581. QDomElement referenceElement=
  11582. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11583. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11584. QDomElement node;
  11585. /*:687*/
  11586. #line 52 "./valueannotation.w"
  11587. for(int i= 0;i<configData.size();i++)
  11588. {
  11589. node= configData.at(i).toElement();
  11590. if(node.attribute("name")=="source")
  11591. {
  11592. source->setText(node.attribute("value"));
  11593. }
  11594. else if(node.attribute("name")=="emitOnStart")
  11595. {
  11596. noteOnStart->setChecked(node.attribute("value")=="true"?true:false);
  11597. }
  11598. else if(node.attribute("name")=="measuredValues")
  11599. {
  11600. /*779:*/
  11601. #line 18283 "./typica.w"
  11602. QString data= node.attribute("value");
  11603. if(data.length()> 3)
  11604. {
  11605. data.chop(2);
  11606. data= data.remove(0,2);
  11607. }
  11608. QStringList itemList= data.split(",");
  11609. /*:779*/
  11610. #line 66 "./valueannotation.w"
  11611. int column= 0;
  11612. /*780:*/
  11613. #line 18295 "./typica.w"
  11614. for(int i= 0;i<itemList.size();i++)
  11615. {
  11616. tablemodel->setData(tablemodel->index(i,column),
  11617. QVariant(itemList.at(i).toDouble()),
  11618. Qt::DisplayRole);
  11619. }
  11620. /*:780*/
  11621. #line 68 "./valueannotation.w"
  11622. }
  11623. else if(node.attribute("name")=="annotations")
  11624. {
  11625. /*868:*/
  11626. #line 89 "./valueannotation.w"
  11627. QString data= node.attribute("value");
  11628. if(data.length()> 3)
  11629. {
  11630. data.chop(2);
  11631. data= data.remove(0,2);
  11632. }
  11633. QStringList itemList= data.split(",");
  11634. for(int i= 0;i<itemList.size();i++)
  11635. {
  11636. itemList[i]= itemList[i].simplified();
  11637. }
  11638. /*:868*/
  11639. #line 72 "./valueannotation.w"
  11640. int column= 1;
  11641. /*869:*/
  11642. #line 104 "./valueannotation.w"
  11643. for(int i= 0;i<itemList.size();i++)
  11644. {
  11645. tablemodel->setData(tablemodel->index(i,column),
  11646. QVariant(itemList.at(i)),
  11647. Qt::DisplayRole);
  11648. }
  11649. /*:869*/
  11650. #line 74 "./valueannotation.w"
  11651. }
  11652. }
  11653. updateSourceColumn(source->text());
  11654. updateStart(noteOnStart->isChecked());
  11655. updateAnnotations();
  11656. connect(source,SIGNAL(textEdited(QString)),this,SLOT(updateSourceColumn(QString)));
  11657. connect(noteOnStart,SIGNAL(toggled(bool)),this,SLOT(updateStart(bool)));
  11658. connect(tablemodel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(updateAnnotations()));
  11659. setLayout(layout);
  11660. }
  11661. /*:867*//*870:*/
  11662. #line 115 "./valueannotation.w"
  11663. void ValueAnnotationConfWidget::updateAnnotations()
  11664. {
  11665. updateAttribute("measuredValues",tablemodel->arrayLiteral(0,Qt::DisplayRole));
  11666. updateAttribute("annotations",tablemodel->arrayLiteral(1,Qt::DisplayRole));
  11667. }
  11668. /*:870*//*871:*/
  11669. #line 125 "./valueannotation.w"
  11670. void ValueAnnotationConfWidget::updateSourceColumn(const QString&source)
  11671. {
  11672. updateAttribute("source",source);
  11673. }
  11674. void ValueAnnotationConfWidget::updateStart(bool noteOnStart)
  11675. {
  11676. updateAttribute("emitOnStart",noteOnStart?"true":"false");
  11677. }
  11678. /*:871*/
  11679. #line 609 "./typica.w"
  11680. /*:4*//*800:*/
  11681. #line 284 "./rate.w"
  11682. /*796:*/
  11683. #line 210 "./rate.w"
  11684. RateOfChangeConfWidget::RateOfChangeConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  11685. :BasicDeviceConfigurationWidget(model,index)
  11686. {
  11687. QFormLayout*layout= new QFormLayout;
  11688. QLineEdit*column= new QLineEdit;
  11689. layout->addRow(tr("Primary series column name:"),column);
  11690. QSpinBox*cacheTime= new QSpinBox;
  11691. cacheTime->setMinimum(0);
  11692. cacheTime->setMaximum(300);
  11693. layout->addRow(tr("Cache time:"),cacheTime);
  11694. QSpinBox*scaleTime= new QSpinBox;
  11695. scaleTime->setMinimum(1);
  11696. scaleTime->setMaximum(300);
  11697. layout->addRow(tr("Scale time:"),scaleTime);
  11698. /*687:*/
  11699. #line 15251 "./typica.w"
  11700. QDomElement referenceElement=
  11701. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11702. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11703. QDomElement node;
  11704. /*:687*/
  11705. #line 225 "./rate.w"
  11706. for(int i= 0;i<configData.size();i++)
  11707. {
  11708. node= configData.at(i).toElement();
  11709. if(node.attribute("name")=="column")
  11710. {
  11711. column->setText(node.attribute("value"));
  11712. }
  11713. else if(node.attribute("name")=="cache")
  11714. {
  11715. cacheTime->setValue(node.attribute("value").toInt());
  11716. }
  11717. else if(node.attribute("name")=="scale")
  11718. {
  11719. scaleTime->setValue(node.attribute("value").toInt());
  11720. }
  11721. }
  11722. updateColumn(column->text());
  11723. updateCacheTime(cacheTime->text());
  11724. updateScaleTime(scaleTime->text());
  11725. connect(column,SIGNAL(textEdited(QString)),this,SLOT(updateColumn(QString)));
  11726. connect(cacheTime,SIGNAL(valueChanged(QString)),this,SLOT(updateCacheTime(QString)));
  11727. connect(scaleTime,SIGNAL(valueChanged(QString)),this,SLOT(updateScaleTime(QString)));
  11728. setLayout(layout);
  11729. }
  11730. /*:796*//*797:*/
  11731. #line 254 "./rate.w"
  11732. void RateOfChangeConfWidget::updateColumn(const QString&column)
  11733. {
  11734. updateAttribute("column",column);
  11735. }
  11736. void RateOfChangeConfWidget::updateCacheTime(const QString&seconds)
  11737. {
  11738. updateAttribute("cache",seconds);
  11739. }
  11740. void RateOfChangeConfWidget::updateScaleTime(const QString&seconds)
  11741. {
  11742. updateAttribute("scale",seconds);
  11743. }
  11744. /*:797*/
  11745. #line 285 "./rate.w"
  11746. #line 18418 "./typica.w"
  11747. #line 1 "./dataqsdk.w"
  11748. /*:800*/
  11749. #line 528 "./typica.w"
  11750. /*8:*/
  11751. #line 669 "./typica.w"
  11752. template<class TYPE> TYPE getself(QScriptContext*context)
  11753. {
  11754. TYPE self= qobject_cast<TYPE> (context->thisObject().toQObject());
  11755. return self;
  11756. }
  11757. template<> QTime getself(QScriptContext*context)
  11758. {
  11759. QTime self= context->thisObject().toVariant().toTime();
  11760. return self;
  11761. }
  11762. template<> SqlQueryConnection*getself(QScriptContext*context)
  11763. {
  11764. SqlQueryConnection*self=
  11765. (SqlQueryConnection*)qscriptvalue_cast<void*> (context->thisObject());
  11766. return self;
  11767. }
  11768. template<> QXmlQuery*getself(QScriptContext*context)
  11769. {
  11770. QXmlQuery*self=
  11771. (QXmlQuery*)qscriptvalue_cast<void*> (context->thisObject());
  11772. return self;
  11773. }
  11774. template<> QXmlStreamWriter*getself(QScriptContext*context)
  11775. {
  11776. QXmlStreamWriter*self=
  11777. (QXmlStreamWriter*)qscriptvalue_cast<void*> (context->thisObject());
  11778. return self;
  11779. }
  11780. template<> QXmlStreamReader*getself(QScriptContext*context)
  11781. {
  11782. QXmlStreamReader*self=
  11783. (QXmlStreamReader*)qscriptvalue_cast<void*> (context->thisObject());
  11784. return self;
  11785. }
  11786. /*:8*//*9:*/
  11787. #line 714 "./typica.w"
  11788. template<class TYPE> TYPE argument(int arg,QScriptContext*context)
  11789. {
  11790. TYPE argument= qobject_cast<TYPE> (context->argument(arg).toQObject());
  11791. return argument;
  11792. }
  11793. template<> QString argument(int arg,QScriptContext*context)
  11794. {
  11795. return context->argument(arg).toString();
  11796. }
  11797. template<> QVariant argument(int arg,QScriptContext*context)
  11798. {
  11799. return context->argument(arg).toVariant();
  11800. }
  11801. template<> int argument(int arg,QScriptContext*context)
  11802. {
  11803. return context->argument(arg).toInt32();
  11804. }
  11805. template<> SqlQueryConnection*argument(int arg,QScriptContext*context)
  11806. {
  11807. return(SqlQueryConnection*)
  11808. qscriptvalue_cast<void*> (context->argument(arg));
  11809. }
  11810. template<> QModelIndex argument(int arg,QScriptContext*context)
  11811. {
  11812. return qscriptvalue_cast<QModelIndex> (context->argument(arg));
  11813. }
  11814. template<> double argument(int arg,QScriptContext*context)
  11815. {
  11816. return(double)(context->argument(arg).toNumber());
  11817. }
  11818. template<> Units::Unit argument(int arg,QScriptContext*context)
  11819. {
  11820. return(Units::Unit)(context->argument(arg).toInt32());
  11821. }
  11822. /*:9*//*13:*/
  11823. #line 801 "./typica.w"
  11824. void setQObjectProperties(QScriptValue,QScriptEngine*)
  11825. {
  11826. }
  11827. /*:13*//*15:*/
  11828. #line 815 "./typica.w"
  11829. void setQPaintDeviceProperties(QScriptValue,QScriptEngine*)
  11830. {
  11831. }
  11832. void setQLayoutItemProperties(QScriptValue,QScriptEngine*)
  11833. {
  11834. }
  11835. /*:15*//*18:*/
  11836. #line 854 "./typica.w"
  11837. QScriptValue constructQWidget(QScriptContext*,QScriptEngine*engine)
  11838. {
  11839. QScriptValue object= engine->newQObject(new QWidget);
  11840. setQWidgetProperties(object,engine);
  11841. return object;
  11842. }
  11843. void setQWidgetProperties(QScriptValue value,QScriptEngine*engine)
  11844. {
  11845. setQObjectProperties(value,engine);
  11846. setQPaintDeviceProperties(value,engine);
  11847. value.setProperty("setLayout",engine->newFunction(QWidget_setLayout));
  11848. value.setProperty("activateWindow",
  11849. engine->newFunction(QWidget_activateWindow));
  11850. }
  11851. /*:18*//*19:*/
  11852. #line 876 "./typica.w"
  11853. QScriptValue QWidget_setLayout(QScriptContext*context,QScriptEngine*)
  11854. {
  11855. if(context->argumentCount()==1)
  11856. {
  11857. QWidget*self= getself<QWidget*> (context);
  11858. QLayout*layout= argument<QLayout*> (0,context);
  11859. if(layout)
  11860. {
  11861. self->setLayout(layout);
  11862. }
  11863. else
  11864. {
  11865. context->throwError("Incorrect argument type passed to "
  11866. "QWidget::setLayout(). This method requires "
  11867. "a QLayout.");
  11868. }
  11869. }
  11870. else
  11871. {
  11872. context->throwError("Incorrect number of arguments passed to "
  11873. "QWidget::setLayout(). This method takes one "
  11874. "QLayout as an argument.");
  11875. }
  11876. return QScriptValue();
  11877. }
  11878. QScriptValue QWidget_activateWindow(QScriptContext*context,
  11879. QScriptEngine*)
  11880. {
  11881. QWidget*self= getself<QWidget*> (context);
  11882. self->activateWindow();
  11883. return QScriptValue();
  11884. }
  11885. /*:19*//*21:*/
  11886. #line 958 "./typica.w"
  11887. ScriptQMainWindow::ScriptQMainWindow():QMainWindow(NULL),
  11888. cprompt(tr("Closing this window may result in loss of data. Continue?"))
  11889. {
  11890. }
  11891. void ScriptQMainWindow::saveSizeAndPosition(const QString&key)
  11892. {
  11893. QSettings settings;
  11894. settings.beginGroup(key);
  11895. settings.setValue("pos",pos());
  11896. settings.setValue("size",size());
  11897. settings.endGroup();
  11898. }
  11899. void ScriptQMainWindow::restoreSizeAndPosition(const QString&key)
  11900. {
  11901. QSettings settings;
  11902. settings.beginGroup(key);
  11903. if(settings.contains("size"))
  11904. {
  11905. resize(settings.value("size").toSize());
  11906. }
  11907. if(settings.contains("pos"))
  11908. {
  11909. move(settings.value("pos").toPoint());
  11910. }
  11911. settings.endGroup();
  11912. }
  11913. void ScriptQMainWindow::displayStatus(const QString&message)
  11914. {
  11915. statusBar()->showMessage(message);
  11916. }
  11917. void ScriptQMainWindow::showEvent(QShowEvent*event)
  11918. {
  11919. if(!event->spontaneous())
  11920. {
  11921. /*26:*/
  11922. #line 1070 "./typica.w"
  11923. QSettings settings;
  11924. restoreGeometry(settings.value(QString("geometries/%1").arg(objectName())).
  11925. toByteArray());
  11926. /*:26*/
  11927. #line 998 "./typica.w"
  11928. event->accept();
  11929. }
  11930. else
  11931. {
  11932. event->ignore();
  11933. }
  11934. }
  11935. void ScriptQMainWindow::show()
  11936. {
  11937. QMainWindow::show();
  11938. }
  11939. /*:21*//*22:*/
  11940. #line 1019 "./typica.w"
  11941. void ScriptQMainWindow::closeEvent(QCloseEvent*event)
  11942. {
  11943. if(isWindowModified()){
  11944. /*23:*/
  11945. #line 1033 "./typica.w"
  11946. QMessageBox::StandardButton result;
  11947. result= QMessageBox::warning(this,"Typica",closePrompt(),
  11948. QMessageBox::Ok|QMessageBox::Cancel);
  11949. if(result==QMessageBox::Cancel)
  11950. {
  11951. event->ignore();
  11952. return;
  11953. }
  11954. /*:23*/
  11955. #line 1023 "./typica.w"
  11956. }
  11957. emit aboutToClose();
  11958. /*25:*/
  11959. #line 1064 "./typica.w"
  11960. QSettings settings;
  11961. settings.setValue(QString("geometries/%1").arg(objectName()),saveGeometry());
  11962. /*:25*/
  11963. #line 1026 "./typica.w"
  11964. event->accept();
  11965. }
  11966. /*:22*//*24:*/
  11967. #line 1045 "./typica.w"
  11968. QString ScriptQMainWindow::closePrompt()
  11969. {
  11970. return cprompt;
  11971. }
  11972. void ScriptQMainWindow::setClosePrompt(QString prompt)
  11973. {
  11974. cprompt= prompt;
  11975. }
  11976. /*:24*//*29:*/
  11977. #line 1098 "./typica.w"
  11978. QScriptValue constructQMainWindow(QScriptContext*,QScriptEngine*engine)
  11979. {
  11980. QScriptValue object= engine->newQObject(new ScriptQMainWindow);
  11981. setQMainWindowProperties(object,engine);
  11982. return object;
  11983. }
  11984. void setQMainWindowProperties(QScriptValue value,QScriptEngine*engine)
  11985. {
  11986. setQWidgetProperties(value,engine);
  11987. value.setProperty("setCentralWidget",
  11988. engine->newFunction(QMainWindow_setCentralWidget));
  11989. value.setProperty("menuBar",engine->newFunction(QMainWindow_menuBar));
  11990. }
  11991. /*:29*//*30:*/
  11992. #line 1120 "./typica.w"
  11993. QScriptValue QMainWindow_setCentralWidget(QScriptContext*context,
  11994. QScriptEngine*)
  11995. {
  11996. if(context->argumentCount()==1)
  11997. {
  11998. QMainWindow*self= getself<QMainWindow*> (context);
  11999. QWidget*widget= argument<QWidget*> (0,context);
  12000. if(widget)
  12001. {
  12002. self->setCentralWidget(widget);
  12003. }
  12004. else
  12005. {
  12006. context->throwError("Incorrect argument type passed to "
  12007. "QMainWindow::setCentralWidget(). This "
  12008. "method requires a QWidget.");
  12009. }
  12010. }
  12011. else
  12012. {
  12013. context->throwError("Incorrect number of arguments passed to "
  12014. "QMainWindow::setCentralWidget(). This method "
  12015. "takes one QWidget as an argument.");
  12016. }
  12017. return QScriptValue();
  12018. }
  12019. /*:30*//*31:*/
  12020. #line 1154 "./typica.w"
  12021. QScriptValue QMainWindow_menuBar(QScriptContext*context,QScriptEngine*engine)
  12022. {
  12023. QScriptValue object;
  12024. if(context->argumentCount()==0)
  12025. {
  12026. QMainWindow*self= getself<QMainWindow*> (context);
  12027. QMenuBar*bar= self->menuBar();
  12028. object= engine->newQObject(bar);
  12029. setQMenuBarProperties(object,engine);
  12030. }
  12031. else
  12032. {
  12033. context->throwError("Incorrect number of arguments passed to "
  12034. "QMainWindow::menuBar(). This method takes no "
  12035. "arguments.");
  12036. }
  12037. return object;
  12038. }
  12039. /*:31*//*33:*/
  12040. #line 1184 "./typica.w"
  12041. void setQMenuBarProperties(QScriptValue value,QScriptEngine*engine)
  12042. {
  12043. setQWidgetProperties(value,engine);
  12044. value.setProperty("addMenu",engine->newFunction(QMenuBar_addMenu));
  12045. }
  12046. /*:33*//*34:*/
  12047. #line 1199 "./typica.w"
  12048. QScriptValue QMenuBar_addMenu(QScriptContext*context,QScriptEngine*engine)
  12049. {
  12050. QScriptValue object;
  12051. if(context->argumentCount()==1)
  12052. {
  12053. QMenuBar*self= getself<QMenuBar*> (context);
  12054. QString title= argument<QString> (0,context);
  12055. object= engine->newQObject(self->addMenu(title));
  12056. setQMenuProperties(object,engine);
  12057. }
  12058. else
  12059. {
  12060. context->throwError("Incorrect number of arguments passed to "
  12061. "QMenuBar::addMenu(). This method takes one "
  12062. "string as an argument.");
  12063. }
  12064. return object;
  12065. }
  12066. /*:34*//*36:*/
  12067. #line 1229 "./typica.w"
  12068. void setQMenuProperties(QScriptValue value,QScriptEngine*engine)
  12069. {
  12070. setQWidgetProperties(value,engine);
  12071. value.setProperty("addAction",engine->newFunction(QMenu_addAction));
  12072. value.setProperty("addSeparator",engine->newFunction(QMenu_addSeparator));
  12073. }
  12074. /*:36*//*37:*/
  12075. #line 1239 "./typica.w"
  12076. QScriptValue QMenu_addAction(QScriptContext*context,QScriptEngine*)
  12077. {
  12078. if(context->argumentCount()==1)
  12079. {
  12080. QMenu*self= getself<QMenu*> (context);
  12081. QAction*action= argument<QAction*> (0,context);
  12082. if(action)
  12083. {
  12084. self->addAction(action);
  12085. }
  12086. else
  12087. {
  12088. context->throwError("Incorrect argument type passed to "
  12089. "QMenu::addAction(). This method requires a "
  12090. "QAction.");
  12091. }
  12092. }
  12093. else
  12094. {
  12095. context->throwError("Incorrect number of arguments passed to "
  12096. "QMenu::addAction(). This method takes one "
  12097. "QAction as an argument.");
  12098. }
  12099. return QScriptValue();
  12100. }
  12101. QScriptValue QMenu_addSeparator(QScriptContext*context,QScriptEngine*)
  12102. {
  12103. if(context->argumentCount()==0)
  12104. {
  12105. QMenu*self= getself<QMenu*> (context);
  12106. self->addSeparator();
  12107. }
  12108. else
  12109. {
  12110. context->throwError("Incorrect number of arguments passed to "
  12111. "QMenu::addSeparator(). This method takes no "
  12112. "arguments.");
  12113. }
  12114. return QScriptValue();
  12115. }
  12116. /*:37*//*40:*/
  12117. #line 1301 "./typica.w"
  12118. QScriptValue constructQFrame(QScriptContext*,QScriptEngine*engine)
  12119. {
  12120. QScriptValue object= engine->newQObject(new QFrame);
  12121. setQFrameProperties(object,engine);
  12122. return object;
  12123. }
  12124. void setQFrameProperties(QScriptValue value,QScriptEngine*engine)
  12125. {
  12126. setQWidgetProperties(value,engine);
  12127. }
  12128. /*:40*//*43:*/
  12129. #line 1335 "./typica.w"
  12130. QScriptValue constructQLabel(QScriptContext*context,QScriptEngine*engine)
  12131. {
  12132. QString text;
  12133. if(context->argumentCount()==1)
  12134. {
  12135. text= argument<QString> (0,context);
  12136. }
  12137. QScriptValue object= engine->newQObject(new QLabel(text));
  12138. setQLabelProperties(object,engine);
  12139. return object;
  12140. }
  12141. void setQLabelProperties(QScriptValue value,QScriptEngine*engine)
  12142. {
  12143. setQFrameProperties(value,engine);
  12144. }
  12145. /*:43*//*46:*/
  12146. #line 1372 "./typica.w"
  12147. QScriptValue constructQLineEdit(QScriptContext*,QScriptEngine*engine)
  12148. {
  12149. QScriptValue object= engine->newQObject(new QLineEdit());
  12150. setQLineEditProperties(object,engine);
  12151. return object;
  12152. }
  12153. /*:46*//*47:*/
  12154. #line 1383 "./typica.w"
  12155. void setQLineEditProperties(QScriptValue value,QScriptEngine*engine)
  12156. {
  12157. setQWidgetProperties(value,engine);
  12158. }
  12159. /*:47*//*50:*/
  12160. #line 1417 "./typica.w"
  12161. QScriptValue constructQSplitter(QScriptContext*,QScriptEngine*engine)
  12162. {
  12163. QScriptValue object= engine->newQObject(new QSplitter);
  12164. setQSplitterProperties(object,engine);
  12165. return object;
  12166. }
  12167. void setQSplitterProperties(QScriptValue value,QScriptEngine*engine)
  12168. {
  12169. setQFrameProperties(value,engine);
  12170. value.setProperty("addWidget",engine->newFunction(QSplitter_addWidget));
  12171. value.setProperty("saveState",engine->newFunction(QSplitter_saveState));
  12172. value.setProperty("restoreState",
  12173. engine->newFunction(QSplitter_restoreState));
  12174. }
  12175. /*:50*//*51:*/
  12176. #line 1437 "./typica.w"
  12177. QScriptValue QSplitter_addWidget(QScriptContext*context,QScriptEngine*)
  12178. {
  12179. if(context->argumentCount()==1)
  12180. {
  12181. QSplitter*self= getself<QSplitter*> (context);
  12182. QWidget*widget= argument<QWidget*> (0,context);
  12183. if(widget)
  12184. {
  12185. self->addWidget(widget);
  12186. }
  12187. else
  12188. {
  12189. context->throwError("Incorrect argument type passed to "
  12190. "QSplitter::addWidget(). This method "
  12191. "requires a QWidget.");
  12192. }
  12193. }
  12194. else
  12195. {
  12196. context->throwError("Incorrect number of arguments passed to "
  12197. "QSplitter::addWidget(). This method takes one "
  12198. "QWidget as an argument.");
  12199. }
  12200. return QScriptValue();
  12201. }
  12202. /*:51*//*52:*/
  12203. #line 1470 "./typica.w"
  12204. QScriptValue QSplitter_saveState(QScriptContext*context,QScriptEngine*)
  12205. {
  12206. if(context->argumentCount()==1)
  12207. {
  12208. QSplitter*self= getself<QSplitter*> (context);
  12209. QString key= argument<QString> (0,context);
  12210. QSettings settings;
  12211. settings.setValue(key,self->saveState());
  12212. }
  12213. else
  12214. {
  12215. context->throwError("Incorrect number of arguments passed to "
  12216. "QSplitter::saveState(). This method takes one "
  12217. "string as an argument.");
  12218. }
  12219. return QScriptValue();
  12220. }
  12221. QScriptValue QSplitter_restoreState(QScriptContext*context,QScriptEngine*)
  12222. {
  12223. if(context->argumentCount()==1)
  12224. {
  12225. QSplitter*self= getself<QSplitter*> (context);
  12226. QString key= argument<QString> (0,context);
  12227. QSettings settings;
  12228. self->restoreState(settings.value(key).toByteArray());
  12229. }
  12230. else
  12231. {
  12232. context->throwError("Incorrect number of arguments passed to "
  12233. "QSplitter::restoreState(). This method takes "
  12234. "one string as an argument.");
  12235. }
  12236. return QScriptValue();
  12237. }
  12238. /*:52*//*54:*/
  12239. #line 1523 "./typica.w"
  12240. void setQLayoutProperties(QScriptValue value,QScriptEngine*engine)
  12241. {
  12242. setQLayoutItemProperties(value,engine);
  12243. value.setProperty("addWidget",engine->newFunction(QLayout_addWidget));
  12244. }
  12245. QScriptValue QLayout_addWidget(QScriptContext*context,QScriptEngine*)
  12246. {
  12247. if(context->argumentCount()==1)
  12248. {
  12249. QLayout*self= getself<QLayout*> (context);
  12250. QWidget*widget= argument<QWidget*> (0,context);
  12251. if(widget)
  12252. {
  12253. self->addWidget(widget);
  12254. }
  12255. else
  12256. {
  12257. context->throwError("Incorrect argument type passed to "
  12258. "QLayout::addWidget(). This method requires "
  12259. "a QWidget.");
  12260. }
  12261. }
  12262. else
  12263. {
  12264. context->throwError("Incorrect number of arguments passed to "
  12265. "QLayout::addWidget(). This method takes one "
  12266. "QWidget as an argument.");
  12267. }
  12268. return QScriptValue();
  12269. }
  12270. /*:54*//*57:*/
  12271. #line 1590 "./typica.w"
  12272. QScriptValue constructQBoxLayout(QScriptContext*,QScriptEngine*engine)
  12273. {
  12274. QScriptValue object=
  12275. engine->newQObject(new QBoxLayout(QBoxLayout::LeftToRight));
  12276. setQBoxLayoutProperties(object,engine);
  12277. return object;
  12278. }
  12279. void setQBoxLayoutProperties(QScriptValue value,QScriptEngine*engine)
  12280. {
  12281. setQLayoutProperties(value,engine);
  12282. value.setProperty("addLayout",engine->newFunction(QBoxLayout_addLayout));
  12283. value.setProperty("addWidget",engine->newFunction(QBoxLayout_addWidget));
  12284. }
  12285. QScriptValue QBoxLayout_addLayout(QScriptContext*context,QScriptEngine*)
  12286. {
  12287. if(context->argumentCount()> 0&&context->argumentCount()<3)
  12288. {
  12289. QBoxLayout*self= getself<QBoxLayout*> (context);
  12290. QLayout*layout= argument<QLayout*> (0,context);
  12291. int stretch= 0;
  12292. if(context->argumentCount()==2)
  12293. {
  12294. stretch= argument<int> (1,context);
  12295. }
  12296. if(layout)
  12297. {
  12298. self->addLayout(layout,stretch);
  12299. }
  12300. else
  12301. {
  12302. context->throwError("Incorrect argument type passed to "
  12303. "QLayout::addLayout(). This method requires "
  12304. "a QLayout.");
  12305. }
  12306. }
  12307. else
  12308. {
  12309. context->throwError("Incorrect number of arguments passed to "
  12310. "QLayout::addLayout(). This method takes one "
  12311. "QLayout as an argument and optionally one integer.");
  12312. }
  12313. return QScriptValue();
  12314. }
  12315. /*:57*//*58:*/
  12316. #line 1641 "./typica.w"
  12317. QScriptValue QBoxLayout_addWidget(QScriptContext*context,QScriptEngine*)
  12318. {
  12319. if(context->argumentCount()> 0&&context->argumentCount()<4)
  12320. {
  12321. QBoxLayout*self= getself<QBoxLayout*> (context);
  12322. QWidget*widget= argument<QWidget*> (0,context);
  12323. int stretch= 0;
  12324. Qt::Alignment alignment= 0;
  12325. if(context->argumentCount()> 1)
  12326. {
  12327. stretch= argument<int> (1,context);
  12328. }
  12329. if(context->argumentCount()> 2)
  12330. {
  12331. alignment= (Qt::Alignment)(argument<int> (2,context));
  12332. }
  12333. if(widget)
  12334. {
  12335. self->addWidget(widget,stretch,alignment);
  12336. }
  12337. else
  12338. {
  12339. context->throwError("Incorrect argument type passed to "
  12340. "QBoxLayout::addWidget(). This method requires "
  12341. "a QWidget.");
  12342. }
  12343. }
  12344. else
  12345. {
  12346. context->throwError("Incorrect number of arguments passed to "
  12347. "QBoxLayout::addWidget(). This method takes one "
  12348. "QWidget and optionally up to two integers as "
  12349. "arguments.");
  12350. }
  12351. return QScriptValue();
  12352. }
  12353. /*:58*//*61:*/
  12354. #line 1705 "./typica.w"
  12355. QScriptValue constructQAction(QScriptContext*,QScriptEngine*engine)
  12356. {
  12357. QScriptValue object= engine->newQObject(new QAction(NULL));
  12358. setQActionProperties(object,engine);
  12359. return object;
  12360. }
  12361. void setQActionProperties(QScriptValue value,QScriptEngine*engine)
  12362. {
  12363. setQObjectProperties(value,engine);
  12364. value.setProperty("setShortcut",engine->newFunction(QAction_setShortcut));
  12365. }
  12366. QScriptValue QAction_setShortcut(QScriptContext*context,QScriptEngine*)
  12367. {
  12368. if(context->argumentCount()==1)
  12369. {
  12370. QAction*self= getself<QAction*> (context);
  12371. self->setShortcut(argument<QString> (0,context));
  12372. }
  12373. else
  12374. {
  12375. context->throwError("Incorrect number of arguments passed to "
  12376. "QAction::setShortcut(). This method takes one "
  12377. "string as an argument.");
  12378. }
  12379. return QScriptValue();
  12380. }
  12381. /*:61*//*64:*/
  12382. #line 1763 "./typica.w"
  12383. QScriptValue QFileDialog_getOpenFileName(QScriptContext*context,
  12384. QScriptEngine*engine)
  12385. {
  12386. QScriptValue retval;
  12387. if(context->argumentCount()==3)
  12388. {
  12389. QWidget*widget= argument<QWidget*> (0,context);
  12390. if(widget)
  12391. {
  12392. QString caption= argument<QString> (1,context);
  12393. QString dir= argument<QString> (2,context);
  12394. retval= QScriptValue(engine,
  12395. QFileDialog::getOpenFileName(widget,caption,
  12396. dir,"",0,0));
  12397. setQFileDialogProperties(retval,engine);
  12398. }
  12399. else
  12400. {
  12401. context->throwError("Incorrect argument type passed to "
  12402. "QFileDialog::getOpenFileName(). The first "
  12403. "argument to this method must be a QWidget.");
  12404. }
  12405. }
  12406. else
  12407. {
  12408. context->throwError("Incorrect number of arguments passed to "
  12409. "QFileDialog::getOpenFileName(). This method "
  12410. "takes one QWidget followed by two strings for a "
  12411. "total of three arguments.");
  12412. }
  12413. return retval;
  12414. }
  12415. /*:64*//*65:*/
  12416. #line 1799 "./typica.w"
  12417. QScriptValue QFileDialog_getSaveFileName(QScriptContext*context,
  12418. QScriptEngine*engine)
  12419. {
  12420. QScriptValue retval;
  12421. if(context->argumentCount()==3)
  12422. {
  12423. QWidget*widget= argument<QWidget*> (0,context);
  12424. if(widget)
  12425. {
  12426. QString caption= argument<QString> (1,context);
  12427. QString dir= argument<QString> (2,context);
  12428. retval= QScriptValue(engine,
  12429. QFileDialog::getSaveFileName(widget,caption,
  12430. dir,"",0,0));
  12431. setQFileDialogProperties(retval,engine);
  12432. }
  12433. else
  12434. {
  12435. context->throwError("Incorrect argument type passed to "
  12436. "QFileDialog::getSaveFileName(). The first "
  12437. "argument to this method must be a QWidget.");
  12438. }
  12439. }
  12440. else
  12441. {
  12442. context->throwError("Incorrect number of arguments passed to "
  12443. "QFileDialog::getSaveFileName(). This method "
  12444. "takes one QWidget followed by two strings for a "
  12445. "total of three arguments.");
  12446. }
  12447. return retval;
  12448. }
  12449. /*:65*//*66:*/
  12450. #line 1836 "./typica.w"
  12451. void setQFileDialogProperties(QScriptValue value,QScriptEngine*engine)
  12452. {
  12453. setQDialogProperties(value,engine);
  12454. }
  12455. void setQDialogProperties(QScriptValue value,QScriptEngine*engine)
  12456. {
  12457. setQWidgetProperties(value,engine);
  12458. }
  12459. /*:66*//*69:*/
  12460. #line 1871 "./typica.w"
  12461. QScriptValue constructQFile(QScriptContext*context,QScriptEngine*engine)
  12462. {
  12463. QScriptValue object=
  12464. engine->newQObject(new QFile(argument<QString> (0,context)));
  12465. setQFileProperties(object,engine);
  12466. return object;
  12467. }
  12468. /*:69*//*70:*/
  12469. #line 1882 "./typica.w"
  12470. void setQFileProperties(QScriptValue value,QScriptEngine*engine)
  12471. {
  12472. setQIODeviceProperties(value,engine);
  12473. value.setProperty("remove",engine->newFunction(QFile_remove));
  12474. }
  12475. QScriptValue QFile_remove(QScriptContext*context,QScriptEngine*engine)
  12476. {
  12477. QFile*self= getself<QFile*> (context);
  12478. bool retval= self->remove();
  12479. return QScriptValue(engine,retval);
  12480. }
  12481. /*:70*//*71:*/
  12482. #line 1904 "./typica.w"
  12483. void setQIODeviceProperties(QScriptValue value,QScriptEngine*engine)
  12484. {
  12485. setQObjectProperties(value,engine);
  12486. value.setProperty("open",engine->newFunction(QIODevice_open));
  12487. value.setProperty("close",engine->newFunction(QIODevice_close));
  12488. value.setProperty("readToString",
  12489. engine->newFunction(QIODevice_readToString));
  12490. }
  12491. /*:71*//*72:*/
  12492. #line 1919 "./typica.w"
  12493. QScriptValue QIODevice_open(QScriptContext*context,QScriptEngine*)
  12494. {
  12495. QIODevice*self= getself<QIODevice*> (context);
  12496. if(context->argumentCount()==1)
  12497. {
  12498. switch(argument<int> (0,context))
  12499. {
  12500. case 1:
  12501. self->open(QIODevice::ReadOnly);
  12502. break;
  12503. case 2:
  12504. self->open(QIODevice::WriteOnly);
  12505. break;
  12506. case 3:
  12507. self->open(QIODevice::ReadWrite);
  12508. break;
  12509. default:
  12510. break;
  12511. }
  12512. }
  12513. else
  12514. {
  12515. self->open(QIODevice::ReadWrite);
  12516. }
  12517. return QScriptValue();
  12518. }
  12519. QScriptValue QIODevice_close(QScriptContext*context,QScriptEngine*)
  12520. {
  12521. QIODevice*self= getself<QIODevice*> (context);
  12522. self->close();
  12523. return QScriptValue();
  12524. }
  12525. /*:72*//*73:*/
  12526. #line 1958 "./typica.w"
  12527. QScriptValue QIODevice_readToString(QScriptContext*context,QScriptEngine*)
  12528. {
  12529. QIODevice*self= getself<QIODevice*> (context);
  12530. self->reset();
  12531. return QScriptValue(QString(self->readAll()));
  12532. }
  12533. /*:73*//*76:*/
  12534. #line 1988 "./typica.w"
  12535. QScriptValue constructQBuffer(QScriptContext*context,QScriptEngine*engine)
  12536. {
  12537. QByteArray*array= new QByteArray(argument<QString> (0,context).toAscii());
  12538. QScriptValue object= engine->newQObject(new QBuffer(array));
  12539. setQBufferProperties(object,engine);
  12540. return object;
  12541. }
  12542. void setQBufferProperties(QScriptValue value,QScriptEngine*engine)
  12543. {
  12544. setQIODeviceProperties(value,engine);
  12545. value.setProperty("setData",engine->newFunction(QBuffer_setData));
  12546. }
  12547. QScriptValue QBuffer_setData(QScriptContext*context,QScriptEngine*)
  12548. {
  12549. QBuffer*self= getself<QBuffer*> (context);
  12550. self->setData(argument<QString> (0,context).toAscii());
  12551. return QScriptValue();
  12552. }
  12553. /*:76*//*79:*/
  12554. #line 2037 "./typica.w"
  12555. QScriptValue constructXQuery(QScriptContext*,QScriptEngine*engine)
  12556. {
  12557. QScriptValue object= engine->toScriptValue<void*> (new QXmlQuery);
  12558. setXQueryProperties(object,engine);
  12559. return object;
  12560. }
  12561. QScriptValue XQuery_invalidate(QScriptContext*context,QScriptEngine*)
  12562. {
  12563. QXmlQuery*self= getself<QXmlQuery*> (context);
  12564. delete self;
  12565. return QScriptValue();
  12566. }
  12567. void setXQueryProperties(QScriptValue value,QScriptEngine*engine)
  12568. {
  12569. value.setProperty("bind",engine->newFunction(XQuery_bind));
  12570. value.setProperty("exec",engine->newFunction(XQuery_exec));
  12571. value.setProperty("setQuery",engine->newFunction(XQuery_setQuery));
  12572. value.setProperty("invalidate",engine->newFunction(XQuery_invalidate));
  12573. }
  12574. /*:79*//*80:*/
  12575. #line 2063 "./typica.w"
  12576. QScriptValue XQuery_bind(QScriptContext*context,QScriptEngine*)
  12577. {
  12578. QXmlQuery*self= getself<QXmlQuery*> (context);
  12579. QIODevice*buffer= argument<QIODevice*> (1,context);
  12580. self->bindVariable(argument<QString> (0,context),buffer);
  12581. return QScriptValue();
  12582. }
  12583. /*:80*//*81:*/
  12584. #line 2074 "./typica.w"
  12585. QScriptValue XQuery_setQuery(QScriptContext*context,QScriptEngine*)
  12586. {
  12587. QXmlQuery*self= getself<QXmlQuery*> (context);
  12588. self->setQuery(argument<QString> (0,context));
  12589. return QScriptValue();
  12590. }
  12591. /*:81*//*82:*/
  12592. #line 2084 "./typica.w"
  12593. QScriptValue XQuery_exec(QScriptContext*context,QScriptEngine*)
  12594. {
  12595. QXmlQuery*self= getself<QXmlQuery*> (context);
  12596. QString result;
  12597. self->evaluateTo(&result);
  12598. return QScriptValue(result);
  12599. }
  12600. /*:82*//*85:*/
  12601. #line 2139 "./typica.w"
  12602. QScriptValue constructXmlWriter(QScriptContext*context,QScriptEngine*engine)
  12603. {
  12604. QXmlStreamWriter*retval;
  12605. if(context->argumentCount()==1)
  12606. {
  12607. retval= new QXmlStreamWriter(argument<QIODevice*> (0,context));
  12608. }
  12609. else
  12610. {
  12611. retval= new QXmlStreamWriter;
  12612. }
  12613. QScriptValue object= engine->toScriptValue<void*> (retval);
  12614. setXmlWriterProperties(object,engine);
  12615. return object;
  12616. }
  12617. void setXmlWriterProperties(QScriptValue value,QScriptEngine*engine)
  12618. {
  12619. value.setProperty("setDevice",engine->newFunction(XmlWriter_setDevice));
  12620. value.setProperty("writeAttribute",
  12621. engine->newFunction(XmlWriter_writeAttribute));
  12622. value.setProperty("writeCDATA",engine->newFunction(XmlWriter_writeCDATA));
  12623. value.setProperty("writeCharacters",
  12624. engine->newFunction(XmlWriter_writeCharacters));
  12625. value.setProperty("writeDTD",engine->newFunction(XmlWriter_writeDTD));
  12626. value.setProperty("writeEmptyElement",
  12627. engine->newFunction(XmlWriter_writeEmptyElement));
  12628. value.setProperty("writeEndDocument",
  12629. engine->newFunction(XmlWriter_writeEndDocument));
  12630. value.setProperty("writeEndElement",
  12631. engine->newFunction(XmlWriter_writeEndElement));
  12632. value.setProperty("writeEntityReference",
  12633. engine->newFunction(XmlWriter_writeEntityReference));
  12634. value.setProperty("writeProcessingInstruction",
  12635. engine->newFunction(XmlWriter_writeProcessingInstruction));
  12636. value.setProperty("writeStartDocument",
  12637. engine->newFunction(XmlWriter_writeStartDocument));
  12638. value.setProperty("writeStartElement",
  12639. engine->newFunction(XmlWriter_writeStartElement));
  12640. value.setProperty("writeTextElement",
  12641. engine->newFunction(XmlWriter_writeTextElement));
  12642. }
  12643. /*:85*//*86:*/
  12644. #line 2186 "./typica.w"
  12645. QScriptValue XmlWriter_setDevice(QScriptContext*context,QScriptEngine*)
  12646. {
  12647. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  12648. QIODevice*device= argument<QIODevice*> (0,context);
  12649. self->setDevice(device);
  12650. return QScriptValue();
  12651. }
  12652. /*:86*//*87:*/
  12653. #line 2200 "./typica.w"
  12654. QScriptValue XmlWriter_writeStartDocument(QScriptContext*context,
  12655. QScriptEngine*)
  12656. {
  12657. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  12658. self->writeStartDocument(argument<QString> (0,context));
  12659. return QScriptValue();
  12660. }
  12661. QScriptValue XmlWriter_writeEndDocument(QScriptContext*context,
  12662. QScriptEngine*)
  12663. {
  12664. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  12665. self->writeEndDocument();
  12666. return QScriptValue();
  12667. }
  12668. /*:87*//*88:*/
  12669. #line 2219 "./typica.w"
  12670. QScriptValue XmlWriter_writeDTD(QScriptContext*context,QScriptEngine*)
  12671. {
  12672. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  12673. self->writeDTD(argument<QString> (0,context));
  12674. return QScriptValue();
  12675. }
  12676. /*:88*//*89:*/
  12677. #line 2230 "./typica.w"
  12678. QScriptValue XmlWriter_writeStartElement(QScriptContext*context,
  12679. QScriptEngine*)
  12680. {
  12681. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  12682. self->writeStartElement(argument<QString> (0,context));
  12683. return QScriptValue();
  12684. }
  12685. QScriptValue XmlWriter_writeAttribute(QScriptContext*context,QScriptEngine*)
  12686. {
  12687. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  12688. self->writeAttribute(argument<QString> (0,context),
  12689. argument<QString> (1,context));
  12690. return QScriptValue();
  12691. }
  12692. QScriptValue XmlWriter_writeCharacters(QScriptContext*context,QScriptEngine*)
  12693. {
  12694. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  12695. self->writeCharacters(argument<QString> (0,context));
  12696. return QScriptValue();
  12697. }
  12698. QScriptValue XmlWriter_writeEndElement(QScriptContext*context,QScriptEngine*)
  12699. {
  12700. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  12701. self->writeEndElement();
  12702. return QScriptValue();
  12703. }
  12704. /*:89*//*90:*/
  12705. #line 2266 "./typica.w"
  12706. QScriptValue XmlWriter_writeEmptyElement(QScriptContext*context,
  12707. QScriptEngine*)
  12708. {
  12709. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  12710. self->writeEmptyElement(argument<QString> (0,context));
  12711. return QScriptValue();
  12712. }
  12713. QScriptValue XmlWriter_writeTextElement(QScriptContext*context,
  12714. QScriptEngine*)
  12715. {
  12716. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  12717. self->writeTextElement(argument<QString> (0,context),
  12718. argument<QString> (1,context));
  12719. return QScriptValue();
  12720. }
  12721. /*:90*//*91:*/
  12722. #line 2287 "./typica.w"
  12723. QScriptValue XmlWriter_writeCDATA(QScriptContext*context,QScriptEngine*)
  12724. {
  12725. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  12726. self->writeCDATA(argument<QString> (0,context));
  12727. return QScriptValue();
  12728. }
  12729. QScriptValue XmlWriter_writeEntityReference(QScriptContext*context,
  12730. QScriptEngine*)
  12731. {
  12732. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  12733. self->writeEntityReference(argument<QString> (0,context));
  12734. return QScriptValue();
  12735. }
  12736. QScriptValue XmlWriter_writeProcessingInstruction(QScriptContext*context,
  12737. QScriptEngine*)
  12738. {
  12739. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  12740. self->writeProcessingInstruction(argument<QString> (0,context),
  12741. argument<QString> (1,context));
  12742. return QScriptValue();
  12743. }
  12744. /*:91*//*94:*/
  12745. #line 2346 "./typica.w"
  12746. QScriptValue constructXmlReader(QScriptContext*context,QScriptEngine*engine)
  12747. {
  12748. QXmlStreamReader*retval=
  12749. new QXmlStreamReader(argument<QIODevice*> (0,context));
  12750. QScriptValue object= engine->toScriptValue<void*> (retval);
  12751. setXmlReaderProperties(object,engine);
  12752. return object;
  12753. }
  12754. void setXmlReaderProperties(QScriptValue value,QScriptEngine*engine)
  12755. {
  12756. value.setProperty("atEnd",engine->newFunction(XmlReader_atEnd));
  12757. value.setProperty("attribute",engine->newFunction(XmlReader_attribute));
  12758. value.setProperty("hasAttribute",
  12759. engine->newFunction(XmlReader_hasAttribute));
  12760. value.setProperty("isDTD",engine->newFunction(XmlReader_isDTD));
  12761. value.setProperty("isStartElement",
  12762. engine->newFunction(XmlReader_isStartElement));
  12763. value.setProperty("name",engine->newFunction(XmlReader_name));
  12764. value.setProperty("readElementText",
  12765. engine->newFunction(XmlReader_readElementText));
  12766. value.setProperty("readNext",
  12767. engine->newFunction(XmlReader_readNext));
  12768. value.setProperty("text",engine->newFunction(XmlReader_text));
  12769. }
  12770. /*:94*//*95:*/
  12771. #line 2376 "./typica.w"
  12772. QScriptValue XmlReader_attribute(QScriptContext*context,QScriptEngine*)
  12773. {
  12774. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  12775. QString retval=
  12776. self->attributes().value(argument<QString> (0,context)).toString();
  12777. return QScriptValue(retval);
  12778. }
  12779. QScriptValue XmlReader_hasAttribute(QScriptContext*context,QScriptEngine*)
  12780. {
  12781. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  12782. bool retval=
  12783. self->attributes().hasAttribute(argument<QString> (0,context));
  12784. return QScriptValue(retval);
  12785. }
  12786. /*:95*//*96:*/
  12787. #line 2396 "./typica.w"
  12788. QScriptValue XmlReader_atEnd(QScriptContext*context,QScriptEngine*)
  12789. {
  12790. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  12791. return QScriptValue(self->atEnd());
  12792. }
  12793. QScriptValue XmlReader_isDTD(QScriptContext*context,QScriptEngine*)
  12794. {
  12795. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  12796. return QScriptValue(self->isDTD());
  12797. }
  12798. QScriptValue XmlReader_isStartElement(QScriptContext*context,QScriptEngine*)
  12799. {
  12800. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  12801. return QScriptValue(self->isStartElement());
  12802. }
  12803. /*:96*//*97:*/
  12804. #line 2417 "./typica.w"
  12805. QScriptValue XmlReader_readNext(QScriptContext*context,QScriptEngine*)
  12806. {
  12807. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  12808. self->readNext();
  12809. return QScriptValue();
  12810. }
  12811. /*:97*//*98:*/
  12812. #line 2427 "./typica.w"
  12813. QScriptValue XmlReader_name(QScriptContext*context,QScriptEngine*)
  12814. {
  12815. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  12816. return QScriptValue(self->name().toString());
  12817. }
  12818. QScriptValue XmlReader_readElementText(QScriptContext*context,QScriptEngine*)
  12819. {
  12820. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  12821. return QScriptValue(self->readElementText());
  12822. }
  12823. QScriptValue XmlReader_text(QScriptContext*context,QScriptEngine*)
  12824. {
  12825. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  12826. return QScriptValue(self->text().toString());
  12827. }
  12828. /*:98*//*101:*/
  12829. #line 2469 "./typica.w"
  12830. void setQSettingsProperties(QScriptValue value,QScriptEngine*engine)
  12831. {
  12832. setQObjectProperties(value,engine);
  12833. value.setProperty("value",engine->newFunction(QSettings_value));
  12834. value.setProperty("setValue",engine->newFunction(QSettings_setValue));
  12835. }
  12836. /*:101*//*102:*/
  12837. #line 2481 "./typica.w"
  12838. QScriptValue QSettings_value(QScriptContext*context,QScriptEngine*engine)
  12839. {
  12840. QScriptValue object;
  12841. if(context->argumentCount()==1||context->argumentCount()==2)
  12842. {
  12843. QSettings settings;
  12844. QString key= argument<QString> (0,context);
  12845. QVariant value;
  12846. QVariant retval;
  12847. if(context->argumentCount()> 1)
  12848. {
  12849. value= argument<QVariant> (1,context);
  12850. retval= settings.value(key,value);
  12851. }
  12852. else
  12853. {
  12854. retval= settings.value(key);
  12855. }
  12856. object= engine->newVariant(retval);
  12857. }
  12858. else
  12859. {
  12860. context->throwError("Incorrect number of arguments passed to "
  12861. "QSettings::value(). This method takes one "
  12862. "string and one optional variant type.");
  12863. }
  12864. return object;
  12865. }
  12866. QScriptValue QSettings_setValue(QScriptContext*context,QScriptEngine*)
  12867. {
  12868. if(context->argumentCount()==2)
  12869. {
  12870. QSettings settings;
  12871. QString key= argument<QString> (0,context);
  12872. QVariant value= argument<QVariant> (1,context);
  12873. settings.setValue(key,value);
  12874. }
  12875. else
  12876. {
  12877. context->throwError("Incorrect number of arguments passed to "
  12878. "QSettings::setValue(). This method takes one "
  12879. "string and one variant type for a total of two "
  12880. "arguments.");
  12881. }
  12882. return QScriptValue();
  12883. }
  12884. /*:102*//*105:*/
  12885. #line 2550 "./typica.w"
  12886. QScriptValue constructQLCDNumber(QScriptContext*,QScriptEngine*engine)
  12887. {
  12888. QScriptValue object= engine->newQObject(new QLCDNumber());
  12889. setQLCDNumberProperties(object,engine);
  12890. return object;
  12891. }
  12892. void setQLCDNumberProperties(QScriptValue value,QScriptEngine*engine)
  12893. {
  12894. setQFrameProperties(value,engine);
  12895. }
  12896. /*:105*//*108:*/
  12897. #line 2608 "./typica.w"
  12898. QScriptValue constructQTime(QScriptContext*context,
  12899. QScriptEngine*engine)
  12900. {
  12901. QScriptValue object;
  12902. if(context->argumentCount()==0||
  12903. (context->argumentCount()>=2&&context->argumentCount()<=4))
  12904. {
  12905. int arg1= 0;
  12906. int arg2= 0;
  12907. int arg3= 0;
  12908. int arg4= 0;
  12909. switch(context->argumentCount())
  12910. {
  12911. case 4:
  12912. arg4= argument<int> (3,context);
  12913. case 3:
  12914. arg3= argument<int> (2,context);
  12915. case 2:
  12916. arg2= argument<int> (1,context);
  12917. arg1= argument<int> (0,context);
  12918. default:
  12919. break;
  12920. }
  12921. if(context->argumentCount())
  12922. {
  12923. object= engine->toScriptValue<QTime> (QTime(arg1,arg2,arg3,
  12924. arg4));
  12925. }
  12926. else
  12927. {
  12928. object= engine->toScriptValue<QTime> (QTime());
  12929. }
  12930. setQTimeProperties(object,engine);
  12931. }
  12932. else
  12933. {
  12934. context->throwError("Incorrect number of arguments passed to "
  12935. "QTime::QTime(). This method takes zero, two, "
  12936. "three, or four integer arguments.");
  12937. }
  12938. return object;
  12939. }
  12940. /*:108*//*109:*/
  12941. #line 2656 "./typica.w"
  12942. void setQTimeProperties(QScriptValue value,QScriptEngine*engine)
  12943. {
  12944. value.setProperty("addMSecs",engine->newFunction(QTime_addMSecs));
  12945. value.setProperty("addSecs",engine->newFunction(QTime_addSecs));
  12946. value.setProperty("elapsed",engine->newFunction(QTime_elapsed));
  12947. value.setProperty("hour",engine->newFunction(QTime_hour));
  12948. value.setProperty("isNull",engine->newFunction(QTime_isNull));
  12949. value.setProperty("isValid",engine->newFunction(QTime_isValid));
  12950. value.setProperty("minute",engine->newFunction(QTime_minute));
  12951. value.setProperty("msec",engine->newFunction(QTime_msec));
  12952. value.setProperty("msecsTo",engine->newFunction(QTime_msecsTo));
  12953. value.setProperty("restart",engine->newFunction(QTime_restart));
  12954. value.setProperty("second",engine->newFunction(QTime_second));
  12955. value.setProperty("secsTo",engine->newFunction(QTime_secsTo));
  12956. value.setProperty("setHMS",engine->newFunction(QTime_setHMS));
  12957. value.setProperty("start",engine->newFunction(QTime_start));
  12958. value.setProperty("toString",engine->newFunction(QTime_toString));
  12959. value.setProperty("currentTime",engine->newFunction(QTime_currentTime));
  12960. value.setProperty("fromString",engine->newFunction(QTime_fromString));
  12961. value.setProperty("valueOf",engine->newFunction(QTime_valueOf));
  12962. }
  12963. /*:109*//*110:*/
  12964. #line 2685 "./typica.w"
  12965. QScriptValue QTime_valueOf(QScriptContext*context,QScriptEngine*)
  12966. {
  12967. QTime self= getself<QTime> (context);
  12968. int retval= (self.hour()*60*60*1000)+(self.minute()*60*1000)+
  12969. (self.second()*1000)+self.msec();
  12970. return QScriptValue(retval);
  12971. }
  12972. /*:110*//*111:*/
  12973. #line 2699 "./typica.w"
  12974. QScriptValue QTime_addMSecs(QScriptContext*context,QScriptEngine*engine)
  12975. {
  12976. QTime time;
  12977. QScriptValue retval;
  12978. if(context->argumentCount()==1)
  12979. {
  12980. QTime self= getself<QTime> (context);
  12981. time= self.addMSecs(argument<int> (0,context));
  12982. retval= engine->toScriptValue<QTime> (time);
  12983. setQTimeProperties(retval,engine);
  12984. }
  12985. else
  12986. {
  12987. context->throwError("Incorrect number of arguments passed to "
  12988. "QTime::addMSecs(). This method takes one "
  12989. "integer as an argument.");
  12990. }
  12991. return retval;
  12992. }
  12993. QScriptValue QTime_addSecs(QScriptContext*context,QScriptEngine*engine)
  12994. {
  12995. QTime time;
  12996. QScriptValue retval;
  12997. if(context->argumentCount()==1)
  12998. {
  12999. QTime self= getself<QTime> (context);
  13000. time= self.addSecs(argument<int> (0,context));
  13001. retval= engine->toScriptValue<QTime> (time);
  13002. setQTimeProperties(retval,engine);
  13003. }
  13004. else
  13005. {
  13006. context->throwError("Incorrect number of arguments passed to "
  13007. "QTime::addSecs(). This method takes one "
  13008. "integer as an argument.");
  13009. }
  13010. return retval;
  13011. }
  13012. /*:111*//*112:*/
  13013. #line 2742 "./typica.w"
  13014. QScriptValue QTime_elapsed(QScriptContext*context,QScriptEngine*engine)
  13015. {
  13016. QScriptValue retval;
  13017. if(context->argumentCount()==0)
  13018. {
  13019. QTime self= getself<QTime> (context);
  13020. retval= QScriptValue(engine,self.elapsed());
  13021. }
  13022. else
  13023. {
  13024. context->throwError("Incorrect number of arguments passed to "
  13025. "QTime::elapsed(). This method takes no "
  13026. "arguments.");
  13027. }
  13028. return retval;
  13029. }
  13030. /*:112*//*113:*/
  13031. #line 2763 "./typica.w"
  13032. QScriptValue QTime_hour(QScriptContext*context,QScriptEngine*engine)
  13033. {
  13034. QScriptValue retval;
  13035. if(context->argumentCount()==0)
  13036. {
  13037. QTime self= getself<QTime> (context);
  13038. retval= QScriptValue(engine,self.hour());
  13039. }
  13040. else
  13041. {
  13042. context->throwError("Incorrect number of arguments passed to "
  13043. "QTime::hour(). This method takes no "
  13044. "arguments.");
  13045. }
  13046. return retval;
  13047. }
  13048. /*:113*//*114:*/
  13049. #line 2783 "./typica.w"
  13050. QScriptValue QTime_minute(QScriptContext*context,QScriptEngine*engine)
  13051. {
  13052. QScriptValue retval;
  13053. if(context->argumentCount()==0)
  13054. {
  13055. QTime self= getself<QTime> (context);
  13056. retval= QScriptValue(engine,self.minute());
  13057. }
  13058. else
  13059. {
  13060. context->throwError("Incorrect number of arguments passed to "
  13061. "QTime::minute(). This method takes no "
  13062. "arguments.");
  13063. }
  13064. return retval;
  13065. }
  13066. QScriptValue QTime_second(QScriptContext*context,QScriptEngine*engine)
  13067. {
  13068. QScriptValue retval;
  13069. if(context->argumentCount()==0)
  13070. {
  13071. QTime self= getself<QTime> (context);
  13072. retval= QScriptValue(engine,self.second());
  13073. }
  13074. else
  13075. {
  13076. context->throwError("Incorrect number of arguments passed to "
  13077. "QTime::second(). This method takes no "
  13078. "arguments.");
  13079. }
  13080. return retval;
  13081. }
  13082. QScriptValue QTime_msec(QScriptContext*context,QScriptEngine*engine)
  13083. {
  13084. QScriptValue retval;
  13085. if(context->argumentCount()==0)
  13086. {
  13087. QTime self= getself<QTime> (context);
  13088. retval= QScriptValue(engine,self.msec());
  13089. }
  13090. else
  13091. {
  13092. context->throwError("Incorrect number of arguments passed to "
  13093. "QTime::msec(). This method takes no "
  13094. "arguments.");
  13095. }
  13096. return retval;
  13097. }
  13098. /*:114*//*115:*/
  13099. #line 2839 "./typica.w"
  13100. QScriptValue QTime_isNull(QScriptContext*context,QScriptEngine*engine)
  13101. {
  13102. QScriptValue retval;
  13103. if(context->argumentCount()==0)
  13104. {
  13105. QTime self= getself<QTime> (context);
  13106. retval= QScriptValue(engine,self.isNull());
  13107. }
  13108. else
  13109. {
  13110. context->throwError("Incorrect number of arguments passed to "
  13111. "QTime::isNull(). This method takes no "
  13112. "arguments.");
  13113. }
  13114. return retval;
  13115. }
  13116. QScriptValue QTime_isValid(QScriptContext*context,QScriptEngine*engine)
  13117. {
  13118. QScriptValue retval;
  13119. if(context->argumentCount()==0)
  13120. {
  13121. QTime self= getself<QTime> (context);
  13122. retval= QScriptValue(engine,self.isValid());
  13123. }
  13124. else
  13125. {
  13126. context->throwError("Incorrect number of arguments passed to "
  13127. "QTime::isValid(). This method takes no "
  13128. "arguments.");
  13129. }
  13130. return retval;
  13131. }
  13132. /*:115*//*116:*/
  13133. #line 2877 "./typica.w"
  13134. QScriptValue QTime_msecsTo(QScriptContext*context,QScriptEngine*engine)
  13135. {
  13136. QScriptValue retval;
  13137. if(context->argumentCount()==1)
  13138. {
  13139. QTime self= getself<QTime> (context);
  13140. QTime arg= argument<QVariant> (0,context).toTime();
  13141. retval= QScriptValue(engine,self.msecsTo(arg));
  13142. }
  13143. else
  13144. {
  13145. context->throwError("Incorrect number of arguments passed to "
  13146. "QTime::msecsTo(). This method takes one QTime.");
  13147. }
  13148. return retval;
  13149. }
  13150. QScriptValue QTime_secsTo(QScriptContext*context,QScriptEngine*engine)
  13151. {
  13152. QScriptValue retval;
  13153. if(context->argumentCount()==1)
  13154. {
  13155. QTime self= getself<QTime> (context);
  13156. QTime arg= argument<QVariant> (0,context).toTime();
  13157. retval= QScriptValue(engine,self.secsTo(arg));
  13158. }
  13159. else
  13160. {
  13161. context->throwError("Incorrect number of arguments passed to "
  13162. "QTime::secsTo(). This method takes one QTime.");
  13163. }
  13164. return retval;
  13165. }
  13166. /*:116*//*117:*/
  13167. #line 2916 "./typica.w"
  13168. QScriptValue QTime_restart(QScriptContext*context,QScriptEngine*engine)
  13169. {
  13170. QScriptValue retval;
  13171. if(context->argumentCount()==0)
  13172. {
  13173. QTime self= getself<QTime> (context);
  13174. retval= QScriptValue(engine,self.restart());
  13175. }
  13176. else
  13177. {
  13178. context->throwError("Incorrect number of arguments passed to "
  13179. "QTime::restart(). This method takes no "
  13180. "arguments.");
  13181. }
  13182. return retval;
  13183. }
  13184. QScriptValue QTime_start(QScriptContext*context,QScriptEngine*)
  13185. {
  13186. if(context->argumentCount()==0)
  13187. {
  13188. QTime self= getself<QTime> (context);
  13189. self.start();
  13190. }
  13191. else
  13192. {
  13193. context->throwError("Incorrect number of arguments passed to "
  13194. "QTime::start(). This method takes no arguments.");
  13195. }
  13196. return QScriptValue();
  13197. }
  13198. /*:117*//*118:*/
  13199. #line 2952 "./typica.w"
  13200. QScriptValue QTime_setHMS(QScriptContext*context,QScriptEngine*engine)
  13201. {
  13202. QScriptValue retval;
  13203. if(context->argumentCount()==3||context->argumentCount()==4)
  13204. {
  13205. QTime self= getself<QTime> (context);
  13206. int arg1= 0;
  13207. int arg2= 0;
  13208. int arg3= 0;
  13209. int arg4= 0;
  13210. switch(context->argumentCount())
  13211. {
  13212. case 4:
  13213. arg4= argument<int> (3,context);
  13214. case 3:
  13215. arg3= argument<int> (2,context);
  13216. arg2= argument<int> (1,context);
  13217. arg1= argument<int> (0,context);
  13218. default:
  13219. break;
  13220. }
  13221. retval= QScriptValue(engine,self.setHMS(arg1,arg2,arg3,arg4));
  13222. }
  13223. else
  13224. {
  13225. context->throwError("Incorrect number of arguments passed to "
  13226. "QTime::setHMS(). This method takes three or "
  13227. "four integer arguments.");
  13228. }
  13229. return retval;
  13230. }
  13231. /*:118*//*119:*/
  13232. #line 2988 "./typica.w"
  13233. QScriptValue QTime_toString(QScriptContext*context,QScriptEngine*engine)
  13234. {
  13235. QScriptValue retval;
  13236. if(context->argumentCount()==1)
  13237. {
  13238. QTime self= getself<QTime> (context);
  13239. retval= QScriptValue(engine,self.toString(argument<QString> (0,context)));
  13240. }
  13241. else
  13242. {
  13243. context->throwError("Incorrect number of arguments passed to "
  13244. "QTime::toString(). This method takes one QString "
  13245. "as an argument.");
  13246. }
  13247. return retval;
  13248. }
  13249. /*:119*//*120:*/
  13250. #line 3009 "./typica.w"
  13251. QScriptValue QTime_currentTime(QScriptContext*,QScriptEngine*engine)
  13252. {
  13253. QScriptValue object;
  13254. object= engine->toScriptValue<QTime> (QTime::currentTime());
  13255. setQTimeProperties(object,engine);
  13256. return object;
  13257. }
  13258. QScriptValue QTime_fromString(QScriptContext*context,QScriptEngine*engine)
  13259. {
  13260. QScriptValue object;
  13261. if(context->argumentCount()==2)
  13262. {
  13263. QString time= argument<QString> (0,context);
  13264. QString format= argument<QString> (1,context);
  13265. object= engine->toScriptValue<QTime> (QTime::fromString(time,format));
  13266. setQTimeProperties(object,engine);
  13267. }
  13268. else
  13269. {
  13270. context->throwError("Incorrect number of arguments passed to "
  13271. "QTime::fromString(). This method takes two "
  13272. "string arguments.");
  13273. }
  13274. return object;
  13275. }
  13276. /*:120*//*122:*/
  13277. #line 3049 "./typica.w"
  13278. void setQAbstractScrollAreaProperties(QScriptValue value,QScriptEngine*engine)
  13279. {
  13280. setQFrameProperties(value,engine);
  13281. }
  13282. /*:122*//*124:*/
  13283. #line 3063 "./typica.w"
  13284. void setQAbstractItemViewProperties(QScriptValue value,QScriptEngine*engine)
  13285. {
  13286. setQAbstractScrollAreaProperties(value,engine);
  13287. }
  13288. /*:124*//*126:*/
  13289. #line 3077 "./typica.w"
  13290. void setQGraphicsViewProperties(QScriptValue value,QScriptEngine*engine)
  13291. {
  13292. setQAbstractScrollAreaProperties(value,engine);
  13293. }
  13294. void setQTableViewProperties(QScriptValue value,QScriptEngine*engine)
  13295. {
  13296. setQAbstractItemViewProperties(value,engine);
  13297. }
  13298. /*:126*//*129:*/
  13299. #line 3110 "./typica.w"
  13300. QScriptValue constructQPushButton(QScriptContext*,QScriptEngine*engine)
  13301. {
  13302. QScriptValue object= engine->newQObject(new QPushButton());
  13303. setQPushButtonProperties(object,engine);
  13304. return object;
  13305. }
  13306. void setQPushButtonProperties(QScriptValue value,QScriptEngine*engine)
  13307. {
  13308. setQAbstractButtonProperties(value,engine);
  13309. }
  13310. void setQAbstractButtonProperties(QScriptValue value,QScriptEngine*engine)
  13311. {
  13312. setQWidgetProperties(value,engine);
  13313. }
  13314. /*:129*//*136:*/
  13315. #line 3222 "./typica.w"
  13316. QScriptValue constructQSqlQuery(QScriptContext*,QScriptEngine*engine)
  13317. {
  13318. SqlQueryConnection*obj= new SqlQueryConnection();
  13319. QScriptValue object=
  13320. engine->toScriptValue<void*> (obj);
  13321. setQSqlQueryProperties(object,engine);
  13322. return object;
  13323. }
  13324. /*:136*//*137:*/
  13325. #line 3235 "./typica.w"
  13326. void setQSqlQueryProperties(QScriptValue value,QScriptEngine*engine)
  13327. {
  13328. value.setProperty("bind",engine->newFunction(QSqlQuery_bind));
  13329. value.setProperty("bindFileData",
  13330. engine->newFunction(QSqlQuery_bindFileData));
  13331. value.setProperty("bindDeviceData",
  13332. engine->newFunction(QSqlQuery_bindDeviceData));
  13333. value.setProperty("exec",engine->newFunction(QSqlQuery_exec));
  13334. value.setProperty("executedQuery",engine->newFunction(QSqlQuery_executedQuery));
  13335. value.setProperty("invalidate",engine->newFunction(QSqlQuery_invalidate));
  13336. value.setProperty("next",engine->newFunction(QSqlQuery_next));
  13337. value.setProperty("prepare",engine->newFunction(QSqlQuery_prepare));
  13338. value.setProperty("value",engine->newFunction(QSqlQuery_value));
  13339. }
  13340. /*:137*//*138:*/
  13341. #line 3253 "./typica.w"
  13342. QScriptValue QSqlQuery_exec(QScriptContext*context,QScriptEngine*engine)
  13343. {
  13344. QSqlQuery*q= getself<SqlQueryConnection*> (context)->operator->();
  13345. QScriptValue retval;
  13346. if(context->argumentCount()==1)
  13347. {
  13348. retval= QScriptValue(engine,
  13349. q->exec(argument<QString> (0,context)));
  13350. }
  13351. else
  13352. {
  13353. retval= QScriptValue(engine,q->exec());
  13354. }
  13355. if(q->lastError().isValid())
  13356. {
  13357. qDebug()<<q->lastQuery();
  13358. qDebug()<<q->lastError().text();
  13359. }
  13360. return retval;
  13361. }
  13362. QScriptValue QSqlQuery_executedQuery(QScriptContext*context,QScriptEngine*)
  13363. {
  13364. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  13365. return QScriptValue(query->lastQuery());
  13366. }
  13367. QScriptValue QSqlQuery_next(QScriptContext*context,QScriptEngine*engine)
  13368. {
  13369. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  13370. return QScriptValue(engine,query->next());
  13371. }
  13372. QScriptValue QSqlQuery_value(QScriptContext*context,QScriptEngine*engine)
  13373. {
  13374. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  13375. return QScriptValue(engine,
  13376. query->value(argument<int> (0,context)).toString());
  13377. }
  13378. /*:138*//*139:*/
  13379. #line 3297 "./typica.w"
  13380. QScriptValue QSqlQuery_prepare(QScriptContext*context,QScriptEngine*engine)
  13381. {
  13382. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  13383. return QScriptValue(engine,query->prepare(argument<QString> (0,context)));
  13384. }
  13385. QScriptValue QSqlQuery_bind(QScriptContext*context,QScriptEngine*)
  13386. {
  13387. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  13388. query->bindValue(argument<QString> (0,context),
  13389. argument<QVariant> (1,context));
  13390. return QScriptValue();
  13391. }
  13392. QScriptValue QSqlQuery_bindFileData(QScriptContext*context,
  13393. QScriptEngine*)
  13394. {
  13395. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  13396. QString placeholder= argument<QString> (0,context);
  13397. QString filename= argument<QString> (1,context);
  13398. QFile file(filename);
  13399. QByteArray data;
  13400. if(file.open(QIODevice::ReadOnly))
  13401. {
  13402. data= file.readAll();
  13403. file.close();
  13404. }
  13405. query->bindValue(placeholder,data);
  13406. return QScriptValue();
  13407. }
  13408. QScriptValue QSqlQuery_bindDeviceData(QScriptContext*context,
  13409. QScriptEngine*)
  13410. {
  13411. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  13412. QString placeholder= argument<QString> (0,context);
  13413. QIODevice*device= argument<QIODevice*> (1,context);
  13414. device->reset();
  13415. QByteArray data;
  13416. data= device->readAll();
  13417. query->bindValue(placeholder,data);
  13418. return QScriptValue();
  13419. }
  13420. /*:139*//*140:*/
  13421. #line 3349 "./typica.w"
  13422. QScriptValue QSqlQuery_invalidate(QScriptContext*context,QScriptEngine*)
  13423. {
  13424. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  13425. delete query;
  13426. return QScriptValue::UndefinedValue;
  13427. }
  13428. /*:140*//*143:*/
  13429. #line 3390 "./typica.w"
  13430. QScriptValue baseName(QScriptContext*context,QScriptEngine*engine)
  13431. {
  13432. QFileInfo info(argument<QString> (0,context));
  13433. QScriptValue retval(engine,info.baseName());
  13434. return retval;
  13435. }
  13436. QScriptValue dir(QScriptContext*context,QScriptEngine*engine)
  13437. {
  13438. QFileInfo info(argument<QString> (0,context));
  13439. QDir dir= info.dir();
  13440. QScriptValue retval(engine,dir.path());
  13441. return retval;
  13442. }
  13443. /*:143*//*144:*/
  13444. #line 3409 "./typica.w"
  13445. QScriptValue sqlToArray(QScriptContext*context,QScriptEngine*engine)
  13446. {
  13447. QString source= argument<QString> (0,context);
  13448. source.remove(0,1);
  13449. source.chop(1);
  13450. QStringList elements= source.split(",");
  13451. QString element;
  13452. QScriptValue dest= engine->newArray(elements.size());
  13453. int i= 0;
  13454. foreach(element,elements)
  13455. {
  13456. if(element.startsWith("\"")&&element.endsWith("\""))
  13457. {
  13458. element.chop(1);
  13459. element= element.remove(0,1);
  13460. }
  13461. dest.setProperty(i,QScriptValue(engine,element));
  13462. i++;
  13463. }
  13464. return dest;
  13465. }
  13466. /*:144*//*145:*/
  13467. #line 3435 "./typica.w"
  13468. QScriptValue setFont(QScriptContext*context,QScriptEngine*)
  13469. {
  13470. QString font= argument<QString> (0,context);
  13471. QString classname;
  13472. if(context->argumentCount()> 1)
  13473. {
  13474. classname= argument<QString> (1,context);
  13475. QApplication::setFont(QFont(font),classname.toLatin1().constData());
  13476. }
  13477. else
  13478. {
  13479. QApplication::setFont(QFont(font));
  13480. }
  13481. return QScriptValue();
  13482. }
  13483. /*:145*//*146:*/
  13484. #line 3455 "./typica.w"
  13485. QScriptValue annotationFromRecord(QScriptContext*context,QScriptEngine*)
  13486. {
  13487. SqlQueryConnection h;
  13488. QSqlQuery*query= h.operator->();
  13489. QString q= "SELECT file FROM files WHERE id = :file";
  13490. query->prepare(q);
  13491. query->bindValue(":file",argument<int> (0,context));
  13492. query->exec();
  13493. query->next();
  13494. QByteArray array= query->value(0).toByteArray();
  13495. QBuffer buffer(&array);
  13496. buffer.open(QIODevice::ReadOnly);
  13497. QXmlQuery xquery;
  13498. xquery.bindVariable("profile",&buffer);
  13499. QString xq;
  13500. xq= "for $b in doc($profile) //tuple where exists($b/annotation) return $b";
  13501. xquery.setQuery(xq);
  13502. QString result;
  13503. xquery.evaluateTo(&result);
  13504. return QScriptValue(result);
  13505. }
  13506. /*:146*//*147:*/
  13507. #line 3482 "./typica.w"
  13508. QScriptValue setTabOrder(QScriptContext*context,QScriptEngine*)
  13509. {
  13510. QWidget::setTabOrder(argument<QWidget*> (0,context),
  13511. argument<QWidget*> (1,context));
  13512. return QScriptValue();
  13513. }
  13514. /*:147*//*154:*/
  13515. #line 3727 "./typica.w"
  13516. QScriptValue createWindow(QScriptContext*context,QScriptEngine*engine)
  13517. {
  13518. QString targetID= argument<QString> (0,context);
  13519. QDomNode element;
  13520. QScriptValue object;
  13521. /*156:*/
  13522. #line 3774 "./typica.w"
  13523. QDomNodeList windows=
  13524. AppInstance->configuration()->documentElement().elementsByTagName("window");
  13525. QDomNode nullNode;
  13526. int i= 0;
  13527. element= nullNode;
  13528. while(i<windows.count())
  13529. {
  13530. element= windows.at(i);
  13531. QDomNamedNodeMap attributes= element.attributes();
  13532. if(attributes.contains("id"))
  13533. {
  13534. if(attributes.namedItem("id").toAttr().value()==targetID)
  13535. {
  13536. break;
  13537. }
  13538. }
  13539. element= nullNode;
  13540. i++;
  13541. }
  13542. /*:156*/
  13543. #line 3733 "./typica.w"
  13544. if(!element.isNull())
  13545. {
  13546. /*157:*/
  13547. #line 3806 "./typica.w"
  13548. ScriptQMainWindow*window= new ScriptQMainWindow;
  13549. window->setObjectName(targetID);
  13550. object= engine->newQObject(window);
  13551. setQMainWindowProperties(object,engine);
  13552. QWidget*central= new(QWidget);
  13553. central->setParent(window);
  13554. central->setObjectName("centralWidget");
  13555. window->setCentralWidget(central);
  13556. if(element.hasChildNodes())
  13557. {
  13558. /*158:*/
  13559. #line 3841 "./typica.w"
  13560. QStack<QWidget*> widgetStack;
  13561. QStack<QLayout*> layoutStack;
  13562. QString windowScript;
  13563. widgetStack.push(central);
  13564. QDomNodeList windowChildren= element.childNodes();
  13565. int i= 0;
  13566. while(i<windowChildren.count())
  13567. {
  13568. QDomNode current;
  13569. QDomElement element;
  13570. current= windowChildren.at(i);
  13571. if(current.isElement())
  13572. {
  13573. element= current.toElement();
  13574. if(element.tagName()=="program")
  13575. {
  13576. windowScript.append(element.text());
  13577. }
  13578. else if(element.tagName()=="layout")
  13579. {
  13580. addLayoutToWidget(element,&widgetStack,&layoutStack);
  13581. }
  13582. else if(element.tagName()=="menu")
  13583. {
  13584. /*159:*/
  13585. #line 3888 "./typica.w"
  13586. QMenuBar*bar= window->menuBar();
  13587. bar->setParent(window);
  13588. bar->setObjectName("menuBar");
  13589. if(element.hasAttribute("name"))
  13590. {
  13591. QMenu*menu= bar->addMenu(element.attribute("name"));
  13592. menu->setParent(bar);
  13593. if(element.hasAttribute("type"))
  13594. {
  13595. if(element.attribute("type")=="reports")
  13596. {
  13597. if(element.hasAttribute("src"))
  13598. {
  13599. /*577:*/
  13600. #line 12816 "./typica.w"
  13601. QSettings settings;
  13602. QString reportDirectory= QString("%1/%2").arg(settings.value("config").
  13603. toString()).
  13604. arg(element.attribute("src"));
  13605. QDir::addSearchPath("reports",reportDirectory);
  13606. QDir directory(reportDirectory);
  13607. directory.setFilter(QDir::Files);
  13608. directory.setSorting(QDir::Name);
  13609. QStringList nameFilter;
  13610. nameFilter<<"*.xml";
  13611. directory.setNameFilters(nameFilter);
  13612. QFileInfoList reportFiles= directory.entryInfoList();
  13613. for(int i= 0;i<reportFiles.size();i++)
  13614. {
  13615. QFileInfo reportFile= reportFiles.at(i);
  13616. /*581:*/
  13617. #line 12896 "./typica.w"
  13618. QString path= reportFile.absoluteFilePath();
  13619. QFile file(path);
  13620. if(file.open(QIODevice::ReadOnly))
  13621. {
  13622. QDomDocument document;
  13623. document.setContent(&file,true);
  13624. QDomElement root= document.documentElement();
  13625. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  13626. if(!titleNode.isNull())
  13627. {
  13628. QDomElement titleElement= titleNode.toElement();
  13629. QString title= titleElement.text();
  13630. if(!title.isEmpty())
  13631. {
  13632. QStringList hierarchy= title.split(":->");
  13633. QMenu*insertionPoint= menu;
  13634. /*582:*/
  13635. #line 12923 "./typica.w"
  13636. for(int j= 0;j<hierarchy.size()-1;j++)
  13637. {
  13638. QObjectList menuList= insertionPoint->children();
  13639. bool menuFound= false;
  13640. for(int k= 0;k<menuList.size();k++)
  13641. {
  13642. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  13643. if(currentItem)
  13644. {
  13645. if(currentItem->title()==hierarchy.at(j))
  13646. {
  13647. menuFound= true;
  13648. insertionPoint= currentItem;
  13649. break;
  13650. }
  13651. }
  13652. }
  13653. if(!menuFound)
  13654. {
  13655. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  13656. }
  13657. }
  13658. /*:582*/
  13659. #line 12913 "./typica.w"
  13660. ReportAction*action= new ReportAction(path,hierarchy.last());
  13661. insertionPoint->addAction(action);
  13662. }
  13663. }
  13664. }
  13665. /*:581*/
  13666. #line 12832 "./typica.w"
  13667. }
  13668. /*:577*/
  13669. #line 3902 "./typica.w"
  13670. }
  13671. }
  13672. }
  13673. if(element.hasChildNodes())
  13674. {
  13675. /*160:*/
  13676. #line 3915 "./typica.w"
  13677. QDomNodeList menuItems= element.childNodes();
  13678. int j= 0;
  13679. while(j<menuItems.count())
  13680. {
  13681. QDomNode item= menuItems.at(j);
  13682. if(item.isElement())
  13683. {
  13684. QDomElement itemElement= item.toElement();
  13685. if(itemElement.tagName()=="item")
  13686. {
  13687. QAction*itemAction= new QAction(itemElement.text(),menu);
  13688. if(itemElement.hasAttribute("id"))
  13689. {
  13690. itemAction->setObjectName(itemElement.attribute("id"));
  13691. }
  13692. if(itemElement.hasAttribute("shortcut"))
  13693. {
  13694. itemAction->setShortcut(itemElement.attribute("shortcut"));
  13695. }
  13696. menu->addAction(itemAction);
  13697. }
  13698. else if(itemElement.tagName()=="separator")
  13699. {
  13700. menu->addSeparator();
  13701. }
  13702. }
  13703. j++;
  13704. }
  13705. #line 1 "./helpmenu.w"
  13706. /*:160*/
  13707. #line 3908 "./typica.w"
  13708. }
  13709. }
  13710. /*:159*/
  13711. #line 3866 "./typica.w"
  13712. }
  13713. }
  13714. i++;
  13715. }
  13716. QScriptValue oldThis= context->thisObject();
  13717. context->setThisObject(object);
  13718. QScriptValue result= engine->evaluate(windowScript);
  13719. /*151:*/
  13720. #line 3623 "./typica.w"
  13721. if(engine->hasUncaughtException())
  13722. {
  13723. int line= engine->uncaughtExceptionLineNumber();
  13724. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  13725. result.toString();
  13726. QString trace;
  13727. foreach(trace,engine->uncaughtExceptionBacktrace())
  13728. {
  13729. qDebug()<<trace;
  13730. }
  13731. }
  13732. /*:151*/
  13733. #line 3874 "./typica.w"
  13734. context->setThisObject(oldThis);
  13735. /*:158*/
  13736. #line 3817 "./typica.w"
  13737. }
  13738. /*161:*/
  13739. #line 9 "./helpmenu.w"
  13740. HelpMenu*helpMenu= new HelpMenu();
  13741. window->menuBar()->addMenu(helpMenu);
  13742. /*:161*/
  13743. #line 3819 "./typica.w"
  13744. window->show();
  13745. /*:157*/
  13746. #line 3736 "./typica.w"
  13747. }
  13748. return object;
  13749. }
  13750. /*:154*//*155:*/
  13751. #line 3747 "./typica.w"
  13752. QScriptValue createReport(QScriptContext*context,QScriptEngine*engine)
  13753. {
  13754. QString targetID= argument<QString> (0,context);
  13755. QFile file(QString("reports:%1").arg(targetID));
  13756. QScriptValue object;
  13757. if(file.open(QIODevice::ReadOnly))
  13758. {
  13759. QDomDocument document;
  13760. document.setContent(&file,true);
  13761. QDomElement element= document.documentElement();
  13762. if(!element.isNull())
  13763. {
  13764. /*157:*/
  13765. #line 3806 "./typica.w"
  13766. ScriptQMainWindow*window= new ScriptQMainWindow;
  13767. window->setObjectName(targetID);
  13768. object= engine->newQObject(window);
  13769. setQMainWindowProperties(object,engine);
  13770. QWidget*central= new(QWidget);
  13771. central->setParent(window);
  13772. central->setObjectName("centralWidget");
  13773. window->setCentralWidget(central);
  13774. if(element.hasChildNodes())
  13775. {
  13776. /*158:*/
  13777. #line 3841 "./typica.w"
  13778. QStack<QWidget*> widgetStack;
  13779. QStack<QLayout*> layoutStack;
  13780. QString windowScript;
  13781. widgetStack.push(central);
  13782. QDomNodeList windowChildren= element.childNodes();
  13783. int i= 0;
  13784. while(i<windowChildren.count())
  13785. {
  13786. QDomNode current;
  13787. QDomElement element;
  13788. current= windowChildren.at(i);
  13789. if(current.isElement())
  13790. {
  13791. element= current.toElement();
  13792. if(element.tagName()=="program")
  13793. {
  13794. windowScript.append(element.text());
  13795. }
  13796. else if(element.tagName()=="layout")
  13797. {
  13798. addLayoutToWidget(element,&widgetStack,&layoutStack);
  13799. }
  13800. else if(element.tagName()=="menu")
  13801. {
  13802. /*159:*/
  13803. #line 3888 "./typica.w"
  13804. QMenuBar*bar= window->menuBar();
  13805. bar->setParent(window);
  13806. bar->setObjectName("menuBar");
  13807. if(element.hasAttribute("name"))
  13808. {
  13809. QMenu*menu= bar->addMenu(element.attribute("name"));
  13810. menu->setParent(bar);
  13811. if(element.hasAttribute("type"))
  13812. {
  13813. if(element.attribute("type")=="reports")
  13814. {
  13815. if(element.hasAttribute("src"))
  13816. {
  13817. /*577:*/
  13818. #line 12816 "./typica.w"
  13819. QSettings settings;
  13820. QString reportDirectory= QString("%1/%2").arg(settings.value("config").
  13821. toString()).
  13822. arg(element.attribute("src"));
  13823. QDir::addSearchPath("reports",reportDirectory);
  13824. QDir directory(reportDirectory);
  13825. directory.setFilter(QDir::Files);
  13826. directory.setSorting(QDir::Name);
  13827. QStringList nameFilter;
  13828. nameFilter<<"*.xml";
  13829. directory.setNameFilters(nameFilter);
  13830. QFileInfoList reportFiles= directory.entryInfoList();
  13831. for(int i= 0;i<reportFiles.size();i++)
  13832. {
  13833. QFileInfo reportFile= reportFiles.at(i);
  13834. /*581:*/
  13835. #line 12896 "./typica.w"
  13836. QString path= reportFile.absoluteFilePath();
  13837. QFile file(path);
  13838. if(file.open(QIODevice::ReadOnly))
  13839. {
  13840. QDomDocument document;
  13841. document.setContent(&file,true);
  13842. QDomElement root= document.documentElement();
  13843. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  13844. if(!titleNode.isNull())
  13845. {
  13846. QDomElement titleElement= titleNode.toElement();
  13847. QString title= titleElement.text();
  13848. if(!title.isEmpty())
  13849. {
  13850. QStringList hierarchy= title.split(":->");
  13851. QMenu*insertionPoint= menu;
  13852. /*582:*/
  13853. #line 12923 "./typica.w"
  13854. for(int j= 0;j<hierarchy.size()-1;j++)
  13855. {
  13856. QObjectList menuList= insertionPoint->children();
  13857. bool menuFound= false;
  13858. for(int k= 0;k<menuList.size();k++)
  13859. {
  13860. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  13861. if(currentItem)
  13862. {
  13863. if(currentItem->title()==hierarchy.at(j))
  13864. {
  13865. menuFound= true;
  13866. insertionPoint= currentItem;
  13867. break;
  13868. }
  13869. }
  13870. }
  13871. if(!menuFound)
  13872. {
  13873. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  13874. }
  13875. }
  13876. /*:582*/
  13877. #line 12913 "./typica.w"
  13878. ReportAction*action= new ReportAction(path,hierarchy.last());
  13879. insertionPoint->addAction(action);
  13880. }
  13881. }
  13882. }
  13883. /*:581*/
  13884. #line 12832 "./typica.w"
  13885. }
  13886. /*:577*/
  13887. #line 3902 "./typica.w"
  13888. }
  13889. }
  13890. }
  13891. if(element.hasChildNodes())
  13892. {
  13893. /*160:*/
  13894. #line 3915 "./typica.w"
  13895. QDomNodeList menuItems= element.childNodes();
  13896. int j= 0;
  13897. while(j<menuItems.count())
  13898. {
  13899. QDomNode item= menuItems.at(j);
  13900. if(item.isElement())
  13901. {
  13902. QDomElement itemElement= item.toElement();
  13903. if(itemElement.tagName()=="item")
  13904. {
  13905. QAction*itemAction= new QAction(itemElement.text(),menu);
  13906. if(itemElement.hasAttribute("id"))
  13907. {
  13908. itemAction->setObjectName(itemElement.attribute("id"));
  13909. }
  13910. if(itemElement.hasAttribute("shortcut"))
  13911. {
  13912. itemAction->setShortcut(itemElement.attribute("shortcut"));
  13913. }
  13914. menu->addAction(itemAction);
  13915. }
  13916. else if(itemElement.tagName()=="separator")
  13917. {
  13918. menu->addSeparator();
  13919. }
  13920. }
  13921. j++;
  13922. }
  13923. #line 1 "./helpmenu.w"
  13924. /*:160*/
  13925. #line 3908 "./typica.w"
  13926. }
  13927. }
  13928. /*:159*/
  13929. #line 3866 "./typica.w"
  13930. }
  13931. }
  13932. i++;
  13933. }
  13934. QScriptValue oldThis= context->thisObject();
  13935. context->setThisObject(object);
  13936. QScriptValue result= engine->evaluate(windowScript);
  13937. /*151:*/
  13938. #line 3623 "./typica.w"
  13939. if(engine->hasUncaughtException())
  13940. {
  13941. int line= engine->uncaughtExceptionLineNumber();
  13942. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  13943. result.toString();
  13944. QString trace;
  13945. foreach(trace,engine->uncaughtExceptionBacktrace())
  13946. {
  13947. qDebug()<<trace;
  13948. }
  13949. }
  13950. /*:151*/
  13951. #line 3874 "./typica.w"
  13952. context->setThisObject(oldThis);
  13953. /*:158*/
  13954. #line 3817 "./typica.w"
  13955. }
  13956. /*161:*/
  13957. #line 9 "./helpmenu.w"
  13958. HelpMenu*helpMenu= new HelpMenu();
  13959. window->menuBar()->addMenu(helpMenu);
  13960. /*:161*/
  13961. #line 3819 "./typica.w"
  13962. window->show();
  13963. /*:157*/
  13964. #line 3760 "./typica.w"
  13965. }
  13966. file.close();
  13967. }
  13968. return object;
  13969. }
  13970. /*:155*//*166:*/
  13971. #line 3957 "./typica.w"
  13972. void addLayoutToWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  13973. QStack<QLayout*> *layoutStack)
  13974. {
  13975. if(element.hasAttribute("type"))
  13976. {
  13977. /*167:*/
  13978. #line 3978 "./typica.w"
  13979. QLayout*layout;
  13980. QString layoutType= element.attribute("type");
  13981. if(layoutType=="horizontal")
  13982. {
  13983. layout= new QHBoxLayout;
  13984. layoutStack->push(layout);
  13985. populateBoxLayout(element,widgetStack,layoutStack);
  13986. }
  13987. else if(layoutType=="vertical")
  13988. {
  13989. layout= new QVBoxLayout;
  13990. layoutStack->push(layout);
  13991. populateBoxLayout(element,widgetStack,layoutStack);
  13992. }
  13993. else if(layoutType=="grid")
  13994. {
  13995. layout= new QGridLayout;
  13996. layoutStack->push(layout);
  13997. populateGridLayout(element,widgetStack,layoutStack);
  13998. }
  13999. else if(layoutType=="stack")
  14000. {
  14001. layout= new QStackedLayout;
  14002. layoutStack->push(layout);
  14003. populateStackedLayout(element,widgetStack,layoutStack);
  14004. }
  14005. if(element.hasAttribute("id"))
  14006. {
  14007. layout->setObjectName(element.attribute("id"));
  14008. }
  14009. if(element.hasAttribute("spacing"))
  14010. {
  14011. layout->setSpacing(element.attribute("spacing").toInt());
  14012. }
  14013. if(element.hasAttribute("margin"))
  14014. {
  14015. int m= element.attribute("margin").toInt();
  14016. layout->setContentsMargins(m,m,m,m);
  14017. }
  14018. /*:167*/
  14019. #line 3963 "./typica.w"
  14020. QWidget*widget= widgetStack->top();
  14021. if(layout)
  14022. {
  14023. widget->setLayout(layout);
  14024. }
  14025. layoutStack->pop();
  14026. }
  14027. }
  14028. /*:166*//*168:*/
  14029. #line 4025 "./typica.w"
  14030. void populateStackedLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  14031. QStack<QLayout*> *layoutStack)
  14032. {
  14033. QDomNodeList children= element.childNodes();
  14034. QStackedLayout*layout= qobject_cast<QStackedLayout*> (layoutStack->top());
  14035. for(int i= 0;i<children.count();i++)
  14036. {
  14037. QDomNode current;
  14038. QDomElement currentElement;
  14039. current= children.at(i);
  14040. if(current.isElement())
  14041. {
  14042. currentElement= current.toElement();
  14043. if(currentElement.tagName()=="page")
  14044. {
  14045. QWidget*widget= new QWidget;
  14046. layout->addWidget(widget);
  14047. widgetStack->push(widget);
  14048. populateWidget(currentElement,widgetStack,layoutStack);
  14049. widgetStack->pop();
  14050. }
  14051. }
  14052. }
  14053. }
  14054. /*:168*//*169:*/
  14055. #line 4057 "./typica.w"
  14056. void populateGridLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  14057. QStack<QLayout*> *layoutStack)
  14058. {
  14059. QDomNodeList children= element.childNodes();
  14060. int row= -1;
  14061. QGridLayout*layout= qobject_cast<QGridLayout*> (layoutStack->top());
  14062. for(int i= 0;i<children.count();i++)
  14063. {
  14064. QDomNode current;
  14065. QDomElement currentElement;
  14066. current= children.at(i);
  14067. if(current.isElement())
  14068. {
  14069. currentElement= current.toElement();
  14070. if(currentElement.tagName()=="row")
  14071. {
  14072. row++;
  14073. if(currentElement.hasAttribute("height"))
  14074. {
  14075. layout->setRowMinimumHeight(row,
  14076. currentElement.attribute("height").toInt());
  14077. }
  14078. if(currentElement.hasAttribute("stretch"))
  14079. {
  14080. layout->setRowStretch(row,
  14081. currentElement.attribute("stretch").toInt());
  14082. }
  14083. /*170:*/
  14084. #line 4113 "./typica.w"
  14085. int column= -1;
  14086. QDomNodeList rowChildren= currentElement.childNodes();
  14087. for(int j= 0;j<rowChildren.count();j++)
  14088. {
  14089. QDomNode columnNode;
  14090. QDomElement columnElement;
  14091. columnNode= rowChildren.at(j);
  14092. if(columnNode.isElement())
  14093. {
  14094. columnElement= columnNode.toElement();
  14095. if(columnElement.tagName()=="column")
  14096. {
  14097. column++;
  14098. if(columnElement.hasAttribute("column"))
  14099. {
  14100. column= columnElement.attribute("column").toInt();
  14101. }
  14102. if(columnElement.hasAttribute("width"))
  14103. {
  14104. layout->setColumnMinimumWidth(column,
  14105. columnElement.attribute("width").toInt());
  14106. }
  14107. if(columnElement.hasAttribute("stretch"))
  14108. {
  14109. layout->setColumnStretch(column,
  14110. columnElement.attribute("stretch").toInt());
  14111. }
  14112. int hspan= 1;
  14113. int vspan= 1;
  14114. if(columnElement.hasAttribute("rowspan"))
  14115. {
  14116. vspan= columnElement.attribute("rowspan").toInt();
  14117. }
  14118. if(columnElement.hasAttribute("colspan"))
  14119. {
  14120. hspan= columnElement.attribute("colspan").toInt();
  14121. }
  14122. QHBoxLayout*cell= new QHBoxLayout;
  14123. layout->addLayout(cell,row,column,vspan,hspan);
  14124. layoutStack->push(cell);
  14125. populateBoxLayout(columnElement,widgetStack,layoutStack);
  14126. layoutStack->pop();
  14127. }
  14128. }
  14129. }
  14130. /*:170*/
  14131. #line 4085 "./typica.w"
  14132. }
  14133. }
  14134. }
  14135. }
  14136. /*:169*//*171:*/
  14137. #line 4163 "./typica.w"
  14138. void populateBoxLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  14139. QStack<QLayout*> *layoutStack)
  14140. {
  14141. QDomNodeList children= element.childNodes();
  14142. for(int i= 0;i<children.count();i++)
  14143. {
  14144. QDomNode current;
  14145. QDomElement currentElement;
  14146. current= children.at(i);
  14147. if(current.isElement())
  14148. {
  14149. currentElement= current.toElement();
  14150. if(currentElement.tagName()=="button")
  14151. {
  14152. addButtonToLayout(currentElement,widgetStack,layoutStack);
  14153. }
  14154. else if(currentElement.tagName()=="calendar")
  14155. {
  14156. addCalendarToLayout(currentElement,widgetStack,layoutStack);
  14157. }
  14158. else if(currentElement.tagName()=="decoration")
  14159. {
  14160. addDecorationToLayout(currentElement,widgetStack,
  14161. layoutStack);
  14162. }
  14163. else if(currentElement.tagName()=="layout")
  14164. {
  14165. addLayoutToLayout(currentElement,widgetStack,layoutStack);
  14166. }
  14167. else if(currentElement.tagName()=="splitter")
  14168. {
  14169. addSplitterToLayout(currentElement,widgetStack,layoutStack);
  14170. }
  14171. else if(currentElement.tagName()=="label")
  14172. {
  14173. QBoxLayout*layout=
  14174. qobject_cast<QBoxLayout*> (layoutStack->top());
  14175. QLabel*label= new QLabel(currentElement.text());
  14176. layout->addWidget(label);
  14177. }
  14178. else if(currentElement.tagName()=="lcdtemperature")
  14179. {
  14180. addTemperatureDisplayToLayout(currentElement,widgetStack,
  14181. layoutStack);
  14182. }
  14183. else if(currentElement.tagName()=="lcdtimer")
  14184. {
  14185. addTimerDisplayToLayout(currentElement,widgetStack,
  14186. layoutStack);
  14187. }
  14188. else if(currentElement.tagName()=="line")
  14189. {
  14190. addLineToLayout(currentElement,widgetStack,layoutStack);
  14191. }
  14192. else if(currentElement.tagName()=="report")
  14193. {
  14194. addReportToLayout(currentElement,widgetStack,layoutStack);
  14195. }
  14196. else if(currentElement.tagName()=="sqldrop")
  14197. {
  14198. addSqlDropToLayout(currentElement,widgetStack,layoutStack);
  14199. }
  14200. else if(currentElement.tagName()=="sqltablearray")
  14201. {
  14202. addSaltToLayout(currentElement,widgetStack,layoutStack);
  14203. }
  14204. else if(currentElement.tagName()=="sqlview")
  14205. {
  14206. addSqlQueryViewToLayout(currentElement,widgetStack,
  14207. layoutStack);
  14208. }
  14209. else if(currentElement.tagName()=="textarea")
  14210. {
  14211. addTextToLayout(currentElement,widgetStack,layoutStack);
  14212. }
  14213. else if(currentElement.tagName()=="spinbox")
  14214. {
  14215. addSpinBoxToLayout(currentElement,widgetStack,layoutStack);
  14216. }
  14217. else if(currentElement.tagName()=="formarray")
  14218. {
  14219. addFormArrayToLayout(currentElement,widgetStack,layoutStack);
  14220. }
  14221. else if(currentElement.tagName()=="hscale")
  14222. {
  14223. addScaleControlToLayout(currentElement,widgetStack,
  14224. layoutStack);
  14225. }
  14226. else if(currentElement.tagName()=="vscale")
  14227. {
  14228. addIntensityControlToLayout(currentElement,widgetStack,
  14229. layoutStack);
  14230. }
  14231. else if(currentElement.tagName()=="webview")
  14232. {
  14233. addWebViewToLayout(currentElement,widgetStack,layoutStack);
  14234. }
  14235. else if(currentElement.tagName()=="stretch")
  14236. {
  14237. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  14238. layout->addStretch();
  14239. }
  14240. }
  14241. }
  14242. }
  14243. /*:171*//*172:*/
  14244. #line 4273 "./typica.w"
  14245. void addLayoutToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  14246. QStack<QLayout*> *layoutStack)
  14247. {
  14248. QLayout*targetLayout= layoutStack->pop();
  14249. QBoxLayout*boxLayout= qobject_cast<QBoxLayout*> (targetLayout);
  14250. if(element.hasAttribute("type"))
  14251. {
  14252. /*167:*/
  14253. #line 3978 "./typica.w"
  14254. QLayout*layout;
  14255. QString layoutType= element.attribute("type");
  14256. if(layoutType=="horizontal")
  14257. {
  14258. layout= new QHBoxLayout;
  14259. layoutStack->push(layout);
  14260. populateBoxLayout(element,widgetStack,layoutStack);
  14261. }
  14262. else if(layoutType=="vertical")
  14263. {
  14264. layout= new QVBoxLayout;
  14265. layoutStack->push(layout);
  14266. populateBoxLayout(element,widgetStack,layoutStack);
  14267. }
  14268. else if(layoutType=="grid")
  14269. {
  14270. layout= new QGridLayout;
  14271. layoutStack->push(layout);
  14272. populateGridLayout(element,widgetStack,layoutStack);
  14273. }
  14274. else if(layoutType=="stack")
  14275. {
  14276. layout= new QStackedLayout;
  14277. layoutStack->push(layout);
  14278. populateStackedLayout(element,widgetStack,layoutStack);
  14279. }
  14280. if(element.hasAttribute("id"))
  14281. {
  14282. layout->setObjectName(element.attribute("id"));
  14283. }
  14284. if(element.hasAttribute("spacing"))
  14285. {
  14286. layout->setSpacing(element.attribute("spacing").toInt());
  14287. }
  14288. if(element.hasAttribute("margin"))
  14289. {
  14290. int m= element.attribute("margin").toInt();
  14291. layout->setContentsMargins(m,m,m,m);
  14292. }
  14293. /*:167*/
  14294. #line 4281 "./typica.w"
  14295. boxLayout->addLayout(layout);
  14296. layoutStack->pop();
  14297. }
  14298. layoutStack->push(targetLayout);
  14299. }
  14300. /*:172*//*173:*/
  14301. #line 4292 "./typica.w"
  14302. void addSplitterToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  14303. QStack<QLayout*> *layoutStack)
  14304. {
  14305. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  14306. QSplitter*splitter= new(QSplitter);
  14307. layout->addWidget(splitter);
  14308. /*174:*/
  14309. #line 4305 "./typica.w"
  14310. QString orientation= element.attribute("type");
  14311. if(orientation=="horizontal")
  14312. {
  14313. splitter->setOrientation(Qt::Horizontal);
  14314. }
  14315. else if(orientation=="vertical")
  14316. {
  14317. splitter->setOrientation(Qt::Vertical);
  14318. }
  14319. QString id= element.attribute("id");
  14320. if(!id.isEmpty())
  14321. {
  14322. splitter->setObjectName(id);
  14323. }
  14324. if(element.hasChildNodes())
  14325. {
  14326. widgetStack->push(splitter);
  14327. populateSplitter(element,widgetStack,layoutStack);
  14328. widgetStack->pop();
  14329. }
  14330. /*:174*/
  14331. #line 4299 "./typica.w"
  14332. }
  14333. /*:173*//*175:*/
  14334. #line 4331 "./typica.w"
  14335. void populateSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  14336. QStack<QLayout*> *layoutStack)
  14337. {
  14338. QDomNodeList children= element.childNodes();
  14339. for(int i= 0;i<children.count();i++)
  14340. {
  14341. QDomNode current;
  14342. QDomElement currentElement;
  14343. current= children.at(i);
  14344. if(current.isElement())
  14345. {
  14346. currentElement= current.toElement();
  14347. if(currentElement.tagName()=="decoration")
  14348. {
  14349. addDecorationToSplitter(currentElement,widgetStack,
  14350. layoutStack);
  14351. }
  14352. else if(currentElement.tagName()=="graph")
  14353. {
  14354. addGraphToSplitter(currentElement,widgetStack,layoutStack);
  14355. }
  14356. else if(currentElement.tagName()=="splitter")
  14357. {
  14358. addSplitterToSplitter(currentElement,widgetStack,layoutStack);
  14359. }
  14360. else if(currentElement.tagName()=="lcdtemperature")
  14361. {
  14362. addTemperatureDisplayToSplitter(currentElement,widgetStack,
  14363. layoutStack);
  14364. }
  14365. else if(currentElement.tagName()=="lcdtimer")
  14366. {
  14367. addTimerDisplayToSplitter(currentElement,widgetStack,
  14368. layoutStack);
  14369. }
  14370. else if(currentElement.tagName()=="measurementtable")
  14371. {
  14372. addZoomLogToSplitter(currentElement,widgetStack,layoutStack);
  14373. }
  14374. else if(currentElement.tagName()=="widget")
  14375. {
  14376. addWidgetToSplitter(currentElement,widgetStack,layoutStack);
  14377. }
  14378. }
  14379. }
  14380. }
  14381. /*:175*//*176:*/
  14382. #line 4381 "./typica.w"
  14383. void addSplitterToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  14384. QStack<QLayout*> *layoutStack)
  14385. {
  14386. QSplitter*parent= qobject_cast<QSplitter*> (widgetStack->top());
  14387. QSplitter*splitter= new(QSplitter);
  14388. splitter->setParent(parent);
  14389. parent->addWidget(splitter);
  14390. /*174:*/
  14391. #line 4305 "./typica.w"
  14392. QString orientation= element.attribute("type");
  14393. if(orientation=="horizontal")
  14394. {
  14395. splitter->setOrientation(Qt::Horizontal);
  14396. }
  14397. else if(orientation=="vertical")
  14398. {
  14399. splitter->setOrientation(Qt::Vertical);
  14400. }
  14401. QString id= element.attribute("id");
  14402. if(!id.isEmpty())
  14403. {
  14404. splitter->setObjectName(id);
  14405. }
  14406. if(element.hasChildNodes())
  14407. {
  14408. widgetStack->push(splitter);
  14409. populateSplitter(element,widgetStack,layoutStack);
  14410. widgetStack->pop();
  14411. }
  14412. /*:174*/
  14413. #line 4389 "./typica.w"
  14414. }
  14415. /*:176*//*177:*/
  14416. #line 4398 "./typica.w"
  14417. void addTemperatureDisplayToSplitter(QDomElement element,
  14418. QStack<QWidget*> *widgetStack,
  14419. QStack<QLayout*> *)
  14420. {
  14421. TemperatureDisplay*display= new(TemperatureDisplay);
  14422. if(element.hasAttribute("id"))
  14423. {
  14424. display->setObjectName(element.attribute("id"));
  14425. }
  14426. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  14427. splitter->addWidget(display);
  14428. }
  14429. void addTemperatureDisplayToLayout(QDomElement element,
  14430. QStack<QWidget*> *,
  14431. QStack<QLayout*> *layoutStack)
  14432. {
  14433. TemperatureDisplay*display= new(TemperatureDisplay);
  14434. if(element.hasAttribute("id"))
  14435. {
  14436. display->setObjectName(element.attribute("id"));
  14437. }
  14438. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  14439. layout->addWidget(display);
  14440. }
  14441. /*:177*//*178:*/
  14442. #line 4429 "./typica.w"
  14443. void addTimerDisplayToSplitter(QDomElement element,
  14444. QStack<QWidget*> *widgetStack,
  14445. QStack<QLayout*> *)
  14446. {
  14447. TimerDisplay*display= new(TimerDisplay);
  14448. if(element.hasAttribute("id"))
  14449. {
  14450. display->setObjectName(element.attribute("id"));
  14451. }
  14452. if(element.hasAttribute("format"))
  14453. {
  14454. display->setDisplayFormat(element.attribute("format"));
  14455. }
  14456. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  14457. splitter->addWidget(display);
  14458. }
  14459. void addTimerDisplayToLayout(QDomElement element,
  14460. QStack<QWidget*> *,
  14461. QStack<QLayout*> *layoutStack)
  14462. {
  14463. TimerDisplay*display= new(TimerDisplay);
  14464. if(element.hasAttribute("id"))
  14465. {
  14466. display->setObjectName(element.attribute("id"));
  14467. }
  14468. if(element.hasAttribute("format"))
  14469. {
  14470. display->setDisplayFormat(element.attribute("format"));
  14471. }
  14472. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  14473. layout->addWidget(display);
  14474. }
  14475. /*:178*//*179:*/
  14476. #line 4467 "./typica.w"
  14477. void addDecorationToLayout(QDomElement element,QStack<QWidget*> *,
  14478. QStack<QLayout*> *layoutStack)
  14479. {
  14480. /*180:*/
  14481. #line 4488 "./typica.w"
  14482. QString labelText= element.attribute("name");
  14483. Qt::Orientations orientation= Qt::Horizontal;
  14484. if(element.hasAttribute("type"))
  14485. {
  14486. if(element.attribute("type")=="horizontal")
  14487. {
  14488. orientation= Qt::Horizontal;
  14489. }
  14490. else if(element.attribute("type")=="vertical")
  14491. {
  14492. orientation= Qt::Vertical;
  14493. }
  14494. }
  14495. /*181:*/
  14496. #line 4513 "./typica.w"
  14497. QWidget*theWidget= NULL;
  14498. QDomNodeList children= element.childNodes();
  14499. for(int i= 0;i<children.count();i++)
  14500. {
  14501. QDomNode item= children.at(i);
  14502. if(item.isElement())
  14503. {
  14504. QDomElement itemElement= item.toElement();
  14505. if(itemElement.tagName()=="lcdtemperature")
  14506. {
  14507. TemperatureDisplay*display= new TemperatureDisplay;
  14508. if(itemElement.hasAttribute("id"))
  14509. {
  14510. display->setObjectName(itemElement.attribute("id"));
  14511. }
  14512. theWidget= display;
  14513. }
  14514. else if(itemElement.tagName()=="lcdtimer")
  14515. {
  14516. TimerDisplay*display= new TimerDisplay;
  14517. if(itemElement.hasAttribute("id"))
  14518. {
  14519. display->setObjectName(itemElement.attribute("id"));
  14520. }
  14521. if(itemElement.hasAttribute("format"))
  14522. {
  14523. display->setDisplayFormat(itemElement.attribute("format"));
  14524. }
  14525. theWidget= display;
  14526. }
  14527. }
  14528. }
  14529. /*:181*/
  14530. #line 4502 "./typica.w"
  14531. WidgetDecorator*decoration= new WidgetDecorator(theWidget,labelText,
  14532. orientation);
  14533. if(element.hasAttribute("id"))
  14534. {
  14535. decoration->setObjectName(element.attribute("id"));
  14536. }
  14537. /*:180*/
  14538. #line 4471 "./typica.w"
  14539. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  14540. layout->addWidget(decoration);
  14541. }
  14542. void addDecorationToSplitter(QDomElement element,
  14543. QStack<QWidget*> *widgetStack,
  14544. QStack<QLayout*> *)
  14545. {
  14546. /*180:*/
  14547. #line 4488 "./typica.w"
  14548. QString labelText= element.attribute("name");
  14549. Qt::Orientations orientation= Qt::Horizontal;
  14550. if(element.hasAttribute("type"))
  14551. {
  14552. if(element.attribute("type")=="horizontal")
  14553. {
  14554. orientation= Qt::Horizontal;
  14555. }
  14556. else if(element.attribute("type")=="vertical")
  14557. {
  14558. orientation= Qt::Vertical;
  14559. }
  14560. }
  14561. /*181:*/
  14562. #line 4513 "./typica.w"
  14563. QWidget*theWidget= NULL;
  14564. QDomNodeList children= element.childNodes();
  14565. for(int i= 0;i<children.count();i++)
  14566. {
  14567. QDomNode item= children.at(i);
  14568. if(item.isElement())
  14569. {
  14570. QDomElement itemElement= item.toElement();
  14571. if(itemElement.tagName()=="lcdtemperature")
  14572. {
  14573. TemperatureDisplay*display= new TemperatureDisplay;
  14574. if(itemElement.hasAttribute("id"))
  14575. {
  14576. display->setObjectName(itemElement.attribute("id"));
  14577. }
  14578. theWidget= display;
  14579. }
  14580. else if(itemElement.tagName()=="lcdtimer")
  14581. {
  14582. TimerDisplay*display= new TimerDisplay;
  14583. if(itemElement.hasAttribute("id"))
  14584. {
  14585. display->setObjectName(itemElement.attribute("id"));
  14586. }
  14587. if(itemElement.hasAttribute("format"))
  14588. {
  14589. display->setDisplayFormat(itemElement.attribute("format"));
  14590. }
  14591. theWidget= display;
  14592. }
  14593. }
  14594. }
  14595. /*:181*/
  14596. #line 4502 "./typica.w"
  14597. WidgetDecorator*decoration= new WidgetDecorator(theWidget,labelText,
  14598. orientation);
  14599. if(element.hasAttribute("id"))
  14600. {
  14601. decoration->setObjectName(element.attribute("id"));
  14602. }
  14603. /*:180*/
  14604. #line 4480 "./typica.w"
  14605. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  14606. splitter->addWidget(decoration);
  14607. }
  14608. /*:179*//*182:*/
  14609. #line 4552 "./typica.w"
  14610. void addWidgetToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  14611. QStack<QLayout*> *layoutStack)
  14612. {
  14613. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  14614. QWidget*widget= new QWidget;
  14615. if(element.hasAttribute("id"))
  14616. {
  14617. widget->setObjectName(element.attribute("id"));
  14618. }
  14619. splitter->addWidget(widget);
  14620. if(element.hasChildNodes())
  14621. {
  14622. widgetStack->push(widget);
  14623. populateWidget(element,widgetStack,layoutStack);
  14624. widgetStack->pop();
  14625. }
  14626. }
  14627. void populateWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  14628. QStack<QLayout*> *layoutStack)
  14629. {
  14630. QDomNodeList children= element.childNodes();
  14631. for(int i= 0;i<children.count();i++)
  14632. {
  14633. QDomNode current;
  14634. QDomElement currentElement;
  14635. current= children.at(i);
  14636. if(current.isElement())
  14637. {
  14638. currentElement= current.toElement();
  14639. if(currentElement.tagName()=="layout")
  14640. {
  14641. addLayoutToWidget(currentElement,widgetStack,layoutStack);
  14642. }
  14643. }
  14644. }
  14645. }
  14646. /*:182*//*183:*/
  14647. #line 4595 "./typica.w"
  14648. void addButtonToLayout(QDomElement element,QStack<QWidget*> *,
  14649. QStack<QLayout*> *layoutStack)
  14650. {
  14651. QAbstractButton*button= NULL;
  14652. QString text= element.attribute("name");
  14653. if(element.hasAttribute("type"))
  14654. {
  14655. QString type= element.attribute("type");
  14656. if(type=="annotation")
  14657. {
  14658. AnnotationButton*abutton= new AnnotationButton(text);
  14659. if(element.hasAttribute("annotation"))
  14660. {
  14661. abutton->setAnnotation(element.attribute("annotation"));
  14662. }
  14663. if(element.hasAttribute("series"))
  14664. {
  14665. abutton->setTemperatureColumn(element.attribute("series").
  14666. toInt());
  14667. }
  14668. if(element.hasAttribute("column"))
  14669. {
  14670. abutton->setAnnotationColumn(element.attribute("column").
  14671. toInt());
  14672. }
  14673. button= abutton;
  14674. }
  14675. else if(type=="check")
  14676. {
  14677. button= new QCheckBox(text);
  14678. }
  14679. else if(type=="push")
  14680. {
  14681. button= new QPushButton(text);
  14682. }
  14683. }
  14684. if(element.hasAttribute("id"))
  14685. {
  14686. button->setObjectName(element.attribute("id"));
  14687. }
  14688. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  14689. layout->addWidget(button);
  14690. }
  14691. /*:183*//*184:*/
  14692. #line 4647 "./typica.w"
  14693. void addSpinBoxToLayout(QDomElement element,QStack<QWidget*> *,
  14694. QStack<QLayout*> *layoutStack)
  14695. {
  14696. AnnotationSpinBox*box= new AnnotationSpinBox("","",NULL);
  14697. if(element.hasAttribute("pretext"))
  14698. {
  14699. box->setPretext(element.attribute("pretext"));
  14700. }
  14701. if(element.hasAttribute("posttext"))
  14702. {
  14703. box->setPosttext(element.attribute("posttext"));
  14704. }
  14705. if(element.hasAttribute("series"))
  14706. {
  14707. box->setTemperatureColumn(element.attribute("series").toInt());
  14708. }
  14709. if(element.hasAttribute("column"))
  14710. {
  14711. box->setAnnotationColumn(element.attribute("column").toInt());
  14712. }
  14713. if(element.hasAttribute("min"))
  14714. {
  14715. box->setMinimum(element.attribute("min").toDouble());
  14716. }
  14717. if(element.hasAttribute("max"))
  14718. {
  14719. box->setMaximum(element.attribute("max").toDouble());
  14720. }
  14721. if(element.hasAttribute("decimals"))
  14722. {
  14723. box->setDecimals(element.attribute("decimals").toInt());
  14724. }
  14725. if(element.hasAttribute("step"))
  14726. {
  14727. box->setSingleStep(element.attribute("step").toDouble());
  14728. }
  14729. if(element.hasAttribute("id"))
  14730. {
  14731. box->setObjectName(element.attribute("id"));
  14732. }
  14733. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  14734. layout->addWidget(box);
  14735. }
  14736. /*:184*//*185:*/
  14737. #line 4703 "./typica.w"
  14738. void addZoomLogToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  14739. QStack<QLayout*> *)
  14740. {
  14741. ZoomLog*widget= new ZoomLog;
  14742. if(!widget)
  14743. {
  14744. qDebug()<<"Error constructing widget!";
  14745. }
  14746. if(element.hasAttribute("id"))
  14747. {
  14748. widget->setObjectName(element.attribute("id"));
  14749. }
  14750. if(element.hasChildNodes())
  14751. {
  14752. QDomNodeList children= element.childNodes();
  14753. int column= 0;
  14754. for(int i= 0;i<children.count();i++)
  14755. {
  14756. QDomNode current;
  14757. QDomElement currentElement;
  14758. current= children.at(i);
  14759. if(current.isElement())
  14760. {
  14761. currentElement= current.toElement();
  14762. if(currentElement.tagName()=="column")
  14763. {
  14764. QString text= currentElement.text();
  14765. widget->setHeaderData(column,text);
  14766. column++;
  14767. }
  14768. }
  14769. }
  14770. }
  14771. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  14772. if(splitter)
  14773. {
  14774. splitter->addWidget(widget);
  14775. }
  14776. else
  14777. {
  14778. qDebug()<<"Splitter not found at top of widget stack!";
  14779. }
  14780. }
  14781. /*:185*//*186:*/
  14782. #line 4751 "./typica.w"
  14783. void addGraphToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  14784. QStack<QLayout*> *)
  14785. {
  14786. GraphView*view= new GraphView;
  14787. if(element.hasAttribute("id"))
  14788. {
  14789. view->setObjectName(element.attribute("id"));
  14790. }
  14791. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  14792. splitter->addWidget(view);
  14793. }
  14794. /*:186*//*187:*/
  14795. #line 4768 "./typica.w"
  14796. void addSqlDropToLayout(QDomElement element,QStack<QWidget*> *,
  14797. QStack<QLayout*> *layoutStack)
  14798. {
  14799. SqlComboBox*box= new SqlComboBox();
  14800. if(element.hasAttribute("data"))
  14801. {
  14802. box->setDataColumn(element.attribute("data").toInt());
  14803. }
  14804. if(element.hasAttribute("display"))
  14805. {
  14806. box->setDisplayColumn(element.attribute("display").toInt());
  14807. }
  14808. if(element.hasAttribute("showdata"))
  14809. {
  14810. if(element.attribute("showdata")=="true")
  14811. {
  14812. box->showData(true);
  14813. }
  14814. }
  14815. if(element.hasAttribute("editable"))
  14816. {
  14817. if(element.attribute("editable")=="true")
  14818. {
  14819. box->setEditable(true);
  14820. }
  14821. }
  14822. if(element.hasChildNodes())
  14823. {
  14824. QDomNodeList children= element.childNodes();
  14825. for(int i= 0;i<children.count();i++)
  14826. {
  14827. QDomNode current;
  14828. QDomElement currentElement;
  14829. current= children.at(i);
  14830. if(current.isElement())
  14831. {
  14832. currentElement= current.toElement();
  14833. if(currentElement.tagName()=="null")
  14834. {
  14835. box->addNullOption();
  14836. }
  14837. else if(currentElement.tagName()=="query")
  14838. {
  14839. box->addSqlOptions(currentElement.text());
  14840. }
  14841. }
  14842. }
  14843. }
  14844. if(element.hasAttribute("id"))
  14845. {
  14846. box->setObjectName(element.attribute("id"));
  14847. }
  14848. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  14849. layout->addWidget(box);
  14850. }
  14851. /*:187*//*188:*/
  14852. #line 4847 "./typica.w"
  14853. void addSaltToLayout(QDomElement element,QStack<QWidget*> *,
  14854. QStack<QLayout*> *layoutStack)
  14855. {
  14856. QTableView*view= new QTableView;
  14857. view->setProperty("tabletype",QVariant(QString("SaltTable")));
  14858. SaltModel*model= new SaltModel(element.childNodes().count());
  14859. if(element.hasAttribute("id"))
  14860. {
  14861. view->setObjectName(element.attribute("id"));
  14862. }
  14863. if(element.hasChildNodes())
  14864. {
  14865. QDomNodeList children= element.childNodes();
  14866. int currentColumn= 0;
  14867. for(int i= 0;i<children.count();i++)
  14868. {
  14869. QDomNode current;
  14870. QDomElement currentElement;
  14871. current= children.at(i);
  14872. if(current.isElement())
  14873. {
  14874. currentElement= current.toElement();
  14875. if(currentElement.tagName()=="column")
  14876. {
  14877. if(currentElement.hasAttribute("name"))
  14878. {
  14879. model->setHeaderData(currentColumn,Qt::Horizontal,
  14880. currentElement.attribute("name"));
  14881. }
  14882. if(currentElement.hasAttribute("delegate"))
  14883. {
  14884. /*189:*/
  14885. #line 4895 "./typica.w"
  14886. if(currentElement.attribute("delegate")=="sql")
  14887. {
  14888. /*190:*/
  14889. #line 4911 "./typica.w"
  14890. SqlComboBoxDelegate*delegate= new SqlComboBoxDelegate;
  14891. SqlComboBox*widget= new SqlComboBox();
  14892. if(currentElement.hasAttribute("nulltext"))
  14893. {
  14894. widget->setNullText(currentElement.attribute("nulltext"));
  14895. }
  14896. if(currentElement.hasAttribute("nulldata"))
  14897. {
  14898. widget->setNullData(QVariant(currentElement.attribute("nulldata")));
  14899. }
  14900. if(currentElement.hasAttribute("null"))
  14901. {
  14902. if(currentElement.attribute("null")=="true")
  14903. {
  14904. widget->addNullOption();
  14905. }
  14906. }
  14907. if(currentElement.hasAttribute("showdata"))
  14908. {
  14909. if(currentElement.attribute("showdata")=="true")
  14910. {
  14911. widget->showData(true);
  14912. }
  14913. }
  14914. if(currentElement.hasAttribute("data"))
  14915. {
  14916. widget->setDataColumn(currentElement.attribute("data").toInt());
  14917. }
  14918. if(currentElement.hasAttribute("display"))
  14919. {
  14920. widget->setDisplayColumn(currentElement.attribute("display").toInt());
  14921. }
  14922. widget->addSqlOptions(currentElement.text());
  14923. delegate->setWidget(widget);
  14924. view->setItemDelegateForColumn(currentColumn,delegate);
  14925. /*:190*/
  14926. #line 4898 "./typica.w"
  14927. }
  14928. else if(currentElement.attribute("delegate")=="numeric")
  14929. {
  14930. /*191:*/
  14931. #line 4952 "./typica.w"
  14932. NumericDelegate*delegate= new NumericDelegate;
  14933. view->setItemDelegateForColumn(currentColumn,delegate);
  14934. /*:191*/
  14935. #line 4902 "./typica.w"
  14936. }
  14937. /*:189*/
  14938. #line 4879 "./typica.w"
  14939. }
  14940. currentColumn++;
  14941. }
  14942. }
  14943. }
  14944. }
  14945. view->setModel(model);
  14946. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  14947. layout->addWidget(view);
  14948. }
  14949. /*:188*//*198:*/
  14950. #line 5062 "./typica.w"
  14951. void addLineToLayout(QDomElement element,QStack<QWidget*> *,
  14952. QStack<QLayout*> *layoutStack)
  14953. {
  14954. QLineEdit*widget= new QLineEdit(element.text());
  14955. if(element.hasAttribute("id"))
  14956. {
  14957. widget->setObjectName(element.attribute("id"));
  14958. }
  14959. if(element.hasAttribute("writable"))
  14960. {
  14961. if(element.attribute("writable")=="false")
  14962. {
  14963. widget->setReadOnly(true);
  14964. }
  14965. }
  14966. if(element.hasAttribute("validator"))
  14967. {
  14968. if(element.attribute("validator")=="numeric")
  14969. {
  14970. widget->setValidator(new QDoubleValidator(NULL));
  14971. }
  14972. else if(element.attribute("validator")=="integer")
  14973. {
  14974. widget->setValidator(new QIntValidator(NULL));
  14975. }
  14976. else if(element.attribute("validator")=="expression"&&
  14977. element.hasAttribute("expression"))
  14978. {
  14979. widget->setValidator(new QRegExpValidator(
  14980. QRegExp(element.attribute("expression")),
  14981. NULL));
  14982. }
  14983. }
  14984. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  14985. layout->addWidget(widget);
  14986. }
  14987. /*:198*//*199:*/
  14988. #line 5103 "./typica.w"
  14989. void addTextToLayout(QDomElement element,QStack<QWidget*> *,
  14990. QStack<QLayout*> *layoutStack)
  14991. {
  14992. QTextEdit*widget= new QTextEdit;
  14993. if(element.hasAttribute("id"))
  14994. {
  14995. widget->setObjectName(element.attribute("id"));
  14996. }
  14997. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  14998. layout->addWidget(widget);
  14999. }
  15000. /*:199*//*200:*/
  15001. #line 5120 "./typica.w"
  15002. void addSqlQueryViewToLayout(QDomElement element,
  15003. QStack<QWidget*> *,
  15004. QStack<QLayout*> *layoutStack)
  15005. {
  15006. SqlQueryView*view= new SqlQueryView;
  15007. if(element.hasAttribute("id"))
  15008. {
  15009. view->setObjectName(element.attribute("id"));
  15010. }
  15011. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  15012. layout->addWidget(view);
  15013. }
  15014. /*:200*//*201:*/
  15015. #line 5137 "./typica.w"
  15016. void addCalendarToLayout(QDomElement element,QStack<QWidget*> *,
  15017. QStack<QLayout*> *layoutStack)
  15018. {
  15019. QDateEdit*widget= new QDateEdit;
  15020. widget->setCalendarPopup(true);
  15021. if(element.hasAttribute("id"))
  15022. {
  15023. widget->setObjectName(element.attribute("id"));
  15024. }
  15025. widget->setDate(QDate::currentDate());
  15026. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  15027. layout->addWidget(widget);
  15028. }
  15029. /*:201*//*202:*/
  15030. #line 5155 "./typica.w"
  15031. void setQDateEditProperties(QScriptValue value,QScriptEngine*engine)
  15032. {
  15033. setQDateTimeEditProperties(value,engine);
  15034. }
  15035. void setQDateTimeEditProperties(QScriptValue value,QScriptEngine*engine)
  15036. {
  15037. setQAbstractSpinBoxProperties(value,engine);
  15038. value.setProperty("setDate",engine->newFunction(QDateTimeEdit_setDate));
  15039. value.setProperty("day",engine->newFunction(QDateTimeEdit_day));
  15040. value.setProperty("month",engine->newFunction(QDateTimeEdit_month));
  15041. value.setProperty("year",engine->newFunction(QDateTimeEdit_year));
  15042. }
  15043. /*:202*//*203:*/
  15044. #line 5175 "./typica.w"
  15045. QScriptValue QDateTimeEdit_setDate(QScriptContext*context,QScriptEngine*)
  15046. {
  15047. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  15048. if(context->argumentCount()==3)
  15049. {
  15050. self->setDate(QDate(argument<int> (0,context),
  15051. argument<int> (1,context),
  15052. argument<int> (2,context)));
  15053. }
  15054. else
  15055. {
  15056. context->throwError("Incorrect number of arguments passed to "
  15057. "QDateTimeEdit::setDate(). This method takes three integer arguments "
  15058. "specifying the year, month, and day.");
  15059. }
  15060. return QScriptValue();
  15061. }
  15062. QScriptValue QDateTimeEdit_day(QScriptContext*context,QScriptEngine*)
  15063. {
  15064. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  15065. return QScriptValue(self->date().day());
  15066. }
  15067. QScriptValue QDateTimeEdit_month(QScriptContext*context,QScriptEngine*)
  15068. {
  15069. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  15070. return QScriptValue(self->date().month());
  15071. }
  15072. QScriptValue QDateTimeEdit_year(QScriptContext*context,QScriptEngine*)
  15073. {
  15074. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  15075. return QScriptValue(self->date().year());
  15076. }
  15077. /*:203*//*207:*/
  15078. #line 5242 "./typica.w"
  15079. QScriptValue findChildObject(QScriptContext*context,QScriptEngine*engine)
  15080. {
  15081. QObject*parent= argument<QObject*> (0,context);
  15082. QString name= argument<QString> (1,context);
  15083. QObject*object= parent->findChild<QObject*> (name);
  15084. QScriptValue value;
  15085. if(object)
  15086. {
  15087. value= engine->newQObject(object);
  15088. QString className= object->metaObject()->className();
  15089. /*208:*/
  15090. #line 5260 "./typica.w"
  15091. if(className=="TemperatureDisplay")
  15092. {
  15093. setTemperatureDisplayProperties(value,engine);
  15094. }
  15095. else if(className=="TimerDisplay")
  15096. {
  15097. setTimerDisplayProperties(value,engine);
  15098. }
  15099. else if(className=="QAction")
  15100. {
  15101. setQActionProperties(value,engine);
  15102. }
  15103. else if(className=="QBoxLayout")
  15104. {
  15105. setQBoxLayoutProperties(value,engine);
  15106. }
  15107. else if(className=="QDateEdit")
  15108. {
  15109. setQDateEditProperties(value,engine);
  15110. }
  15111. else if(className=="QFrame")
  15112. {
  15113. setQFrameProperties(value,engine);
  15114. }
  15115. else if(className=="QHBoxLayout")
  15116. {
  15117. setQBoxLayoutProperties(value,engine);
  15118. }
  15119. else if(className=="QLCDNumber")
  15120. {
  15121. setQLCDNumberProperties(value,engine);
  15122. }
  15123. else if(className=="QMenu")
  15124. {
  15125. setQMenuProperties(value,engine);
  15126. }
  15127. else if(className=="QMenuBar")
  15128. {
  15129. setQMenuBarProperties(value,engine);
  15130. }
  15131. else if(className=="QPushButton")
  15132. {
  15133. setQPushButtonProperties(value,engine);
  15134. }
  15135. else if(className=="QSplitter")
  15136. {
  15137. setQSplitterProperties(value,engine);
  15138. }
  15139. else if(className=="QTableView")
  15140. {
  15141. if(object->property("tabletype").isValid())
  15142. {
  15143. if(object->property("tabletype").toString()=="SaltTable")
  15144. {
  15145. setSaltTableProperties(value,engine);
  15146. }
  15147. }
  15148. }
  15149. else if(className=="QVBoxLayout")
  15150. {
  15151. setQBoxLayoutProperties(value,engine);
  15152. }
  15153. else if(className=="QWidget")
  15154. {
  15155. setQWidgetProperties(value,engine);
  15156. }
  15157. else if(className=="ScriptQMainWindow")
  15158. {
  15159. setQMainWindowProperties(value,engine);
  15160. }
  15161. else if(className=="SqlComboBox")
  15162. {
  15163. setSqlComboBoxProperties(value,engine);
  15164. }
  15165. else if(className=="SqlQueryView")
  15166. {
  15167. setSqlQueryViewProperties(value,engine);
  15168. }
  15169. else if(className=="ZoomLog")
  15170. {
  15171. setZoomLogProperties(value,engine);
  15172. }
  15173. else if(className=="QTextEdit")
  15174. {
  15175. setQTextEditProperties(value,engine);
  15176. }
  15177. else if(className=="QWebView")
  15178. {
  15179. setQWebViewProperties(value,engine);
  15180. }
  15181. else if(className=="QLineEdit")
  15182. {
  15183. setQLineEditProperties(value,engine);
  15184. }
  15185. /*:208*/
  15186. #line 5253 "./typica.w"
  15187. }
  15188. return value;
  15189. }
  15190. /*:207*//*210:*/
  15191. #line 5385 "./typica.w"
  15192. QScriptValue SaltTable_columnSum(QScriptContext*context,QScriptEngine*engine)
  15193. {
  15194. QTableView*self= getself<QTableView*> (context);
  15195. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  15196. QString datum;
  15197. double total= 0.0;
  15198. int column= argument<int> (0,context);
  15199. int role= argument<int> (1,context);
  15200. for(int i= 0;i<model->rowCount();i++)
  15201. {
  15202. datum= model->data(model->index(i,column),role).toString();
  15203. if(!datum.isEmpty())
  15204. {
  15205. total+= datum.toDouble();
  15206. }
  15207. }
  15208. return QScriptValue(engine,total);
  15209. }
  15210. /*:210*//*211:*/
  15211. #line 5409 "./typica.w"
  15212. QScriptValue SaltTable_columnArray(QScriptContext*context,
  15213. QScriptEngine*engine)
  15214. {
  15215. QTableView*self= getself<QTableView*> (context);
  15216. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  15217. int column= argument<int> (0,context);
  15218. int role= argument<int> (1,context);
  15219. QString literal= model->arrayLiteral(column,role);
  15220. return QScriptValue(engine,literal);
  15221. }
  15222. QScriptValue SaltTable_quotedColumnArray(QScriptContext*context,
  15223. QScriptEngine*engine)
  15224. {
  15225. QTableView*self= getself<QTableView*> (context);
  15226. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  15227. int column= argument<int> (0,context);
  15228. int role= argument<int> (1,context);
  15229. QString literal= model->quotedArrayLiteral(column,role);
  15230. return QScriptValue(engine,literal);
  15231. }
  15232. QScriptValue SaltTable_bindableColumnArray(QScriptContext*context,
  15233. QScriptEngine*engine)
  15234. {
  15235. QTableView*self= getself<QTableView*> (context);
  15236. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  15237. int column= argument<int> (0,context);
  15238. int role= argument<int> (1,context);
  15239. QString literal= model->arrayLiteral(column,role);
  15240. literal.chop(1);
  15241. literal= literal.remove(0,1);
  15242. return QScriptValue(engine,literal);
  15243. }
  15244. QScriptValue SaltTable_bindableQuotedColumnArray(QScriptContext*context,
  15245. QScriptEngine*engine)
  15246. {
  15247. QTableView*self= getself<QTableView*> (context);
  15248. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  15249. int column= argument<int> (0,context);
  15250. int role= argument<int> (1,context);
  15251. QString literal= model->quotedArrayLiteral(column,role);
  15252. literal.chop(1);
  15253. literal= literal.remove(0,1);
  15254. return QScriptValue(engine,literal);
  15255. }
  15256. /*:211*//*212:*/
  15257. #line 5461 "./typica.w"
  15258. QScriptValue SaltTable_model(QScriptContext*context,QScriptEngine*engine)
  15259. {
  15260. QTableView*self= getself<QTableView*> (context);
  15261. QScriptValue value= engine->newQObject(self->model());
  15262. return value;
  15263. }
  15264. /*:212*//*213:*/
  15265. #line 5475 "./typica.w"
  15266. QScriptValue SaltTable_setData(QScriptContext*context,QScriptEngine*)
  15267. {
  15268. QTableView*self= getself<QTableView*> (context);
  15269. int row= argument<int> (0,context);
  15270. int column= argument<int> (1,context);
  15271. QVariant value= argument<QVariant> (2,context);
  15272. int role= argument<int> (3,context);
  15273. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  15274. QModelIndex cell= model->index(row,column);
  15275. model->setData(cell,value,role);
  15276. self->update(cell);
  15277. return QScriptValue();
  15278. }
  15279. /*:213*//*214:*/
  15280. #line 5493 "./typica.w"
  15281. QScriptValue SaltTable_data(QScriptContext*context,QScriptEngine*engine)
  15282. {
  15283. QTableView*self= getself<QTableView*> (context);
  15284. int row= argument<int> (0,context);
  15285. int column= argument<int> (1,context);
  15286. int role= argument<int> (2,context);
  15287. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  15288. QModelIndex cell= model->index(row,column);
  15289. QVariant value= model->data(cell,role);
  15290. QScriptValue retval= engine->newVariant(value);
  15291. retval.setProperty("value",QScriptValue(value.toString()));
  15292. return retval;
  15293. }
  15294. /*:214*//*215:*/
  15295. #line 5513 "./typica.w"
  15296. QScriptValue SaltTable_clear(QScriptContext*context,QScriptEngine*)
  15297. {
  15298. QTableView*self= getself<QTableView*> (context);
  15299. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  15300. model->clear();
  15301. return QScriptValue();
  15302. }
  15303. /*:215*//*216:*/
  15304. #line 5525 "./typica.w"
  15305. QScriptValue SaltTable_removeRow(QScriptContext*context,QScriptEngine*engine)
  15306. {
  15307. QTableView*self= getself<QTableView*> (context);
  15308. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  15309. int row= argument<int> (0,context);
  15310. return engine->newVariant(model->removeRow(row));
  15311. }
  15312. /*:216*//*217:*/
  15313. #line 5538 "./typica.w"
  15314. QScriptValue SaltTable_findData(QScriptContext*context,QScriptEngine*engine)
  15315. {
  15316. QTableView*self= getself<QTableView*> (context);
  15317. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  15318. QVariant value= argument<QVariant> (0,context);
  15319. int column= argument<int> (1,context);
  15320. return engine->newVariant(model->findData(value,column));
  15321. }
  15322. /*:217*//*218:*/
  15323. #line 5551 "./typica.w"
  15324. void setSaltTableProperties(QScriptValue value,QScriptEngine*engine)
  15325. {
  15326. setQWidgetProperties(value,engine);
  15327. value.setProperty("columnArray",
  15328. engine->newFunction(SaltTable_columnArray));
  15329. value.setProperty("quotedColumnArray",
  15330. engine->newFunction(SaltTable_quotedColumnArray));
  15331. value.setProperty("bindableColumnArray",
  15332. engine->newFunction(SaltTable_bindableColumnArray));
  15333. value.setProperty("bindableQuotedColumnArray",
  15334. engine->newFunction(SaltTable_bindableQuotedColumnArray));
  15335. value.setProperty("columnSum",engine->newFunction(SaltTable_columnSum));
  15336. value.setProperty("data",engine->newFunction(SaltTable_data));
  15337. value.setProperty("model",engine->newFunction(SaltTable_model));
  15338. value.setProperty("setData",engine->newFunction(SaltTable_setData));
  15339. value.setProperty("clear",engine->newFunction(SaltTable_clear));
  15340. value.setProperty("removeRow",engine->newFunction(SaltTable_removeRow));
  15341. value.setProperty("findData",engine->newFunction(SaltTable_findData));
  15342. }
  15343. /*:218*//*220:*/
  15344. #line 5588 "./typica.w"
  15345. void setSqlComboBoxProperties(QScriptValue value,QScriptEngine*engine)
  15346. {
  15347. setQComboBoxProperties(value,engine);
  15348. }
  15349. void setQComboBoxProperties(QScriptValue value,QScriptEngine*engine)
  15350. {
  15351. setQWidgetProperties(value,engine);
  15352. value.setProperty("currentData",
  15353. engine->newFunction(QComboBox_currentData));
  15354. value.setProperty("addItem",engine->newFunction(QComboBox_addItem));
  15355. value.setProperty("setModel",engine->newFunction(QComboBox_setModel));
  15356. value.setProperty("findText",engine->newFunction(QComboBox_findText));
  15357. value.setProperty("findData",engine->newFunction(QComboBox_findData));
  15358. }
  15359. QScriptValue QComboBox_currentData(QScriptContext*context,
  15360. QScriptEngine*engine)
  15361. {
  15362. QComboBox*self= getself<QComboBox*> (context);
  15363. return QScriptValue(engine,
  15364. self->itemData(self->currentIndex()).toString());
  15365. }
  15366. QScriptValue QComboBox_addItem(QScriptContext*context,QScriptEngine*)
  15367. {
  15368. QComboBox*self= getself<QComboBox*> (context);
  15369. self->addItem(argument<QString> (0,context));
  15370. return QScriptValue();
  15371. }
  15372. QScriptValue QComboBox_setModel(QScriptContext*context,QScriptEngine*)
  15373. {
  15374. QComboBox*self= getself<QComboBox*> (context);
  15375. self->setModel(argument<QAbstractItemModel*> (0,context));
  15376. return QScriptValue();
  15377. }
  15378. QScriptValue QComboBox_findText(QScriptContext*context,QScriptEngine*engine)
  15379. {
  15380. QComboBox*self= getself<QComboBox*> (context);
  15381. return QScriptValue(engine,self->findText(argument<QString> (0,context)));
  15382. }
  15383. QScriptValue QComboBox_findData(QScriptContext*context,QScriptEngine*engine)
  15384. {
  15385. QComboBox*self= getself<QComboBox*> (context);
  15386. return QScriptValue(engine,self->findData(argument<QVariant> (0,context)));
  15387. }
  15388. #line 1 "./abouttypica.w"
  15389. /*:220*//*233:*/
  15390. #line 388 "./units.w"
  15391. QScriptValue Units_convertTemperature(QScriptContext*context,QScriptEngine*engine)
  15392. {
  15393. return QScriptValue(Units::convertTemperature(argument<double> (0,context),
  15394. argument<Units::Unit> (1,context),
  15395. argument<Units::Unit> (2,context)));
  15396. }
  15397. QScriptValue Units_convertRelativeTemperature(QScriptContext*context,
  15398. QScriptEngine*engine)
  15399. {
  15400. return QScriptValue(Units::convertRelativeTemperature(
  15401. argument<double> (0,context),
  15402. argument<Units::Unit> (1,context),
  15403. argument<Units::Unit> (2,context)));
  15404. }
  15405. QScriptValue Units_isTemperatureUnit(QScriptContext*context,QScriptEngine*engine)
  15406. {
  15407. return QScriptValue(Units::isTemperatureUnit(argument<Units::Unit> (0,context)));
  15408. }
  15409. QScriptValue Units_convertWeight(QScriptContext*context,QScriptEngine*engine)
  15410. {
  15411. return QScriptValue(Units::convertWeight(argument<double> (0,context),
  15412. argument<Units::Unit> (1,context),
  15413. argument<Units::Unit> (2,context)));
  15414. }
  15415. QScriptValue Units_isWeightUnit(QScriptContext*context,QScriptEngine*engine)
  15416. {
  15417. return QScriptValue(Units::isWeightUnit(argument<Units::Unit> (0,context)));
  15418. }
  15419. /*:233*//*236:*/
  15420. #line 436 "./units.w"
  15421. QScriptValue Unit_toScriptValue(QScriptEngine*engine,const Units::Unit&value)
  15422. {
  15423. return engine->newVariant(QVariant(value));
  15424. }
  15425. void Unit_fromScriptValue(const QScriptValue&sv,Units::Unit&value)
  15426. {
  15427. value= sv.toVariant().value<Units::Unit> ();
  15428. }
  15429. /*:236*//*260:*/
  15430. #line 6234 "./typica.w"
  15431. QScriptValue constructDAQ(QScriptContext*context,QScriptEngine*engine)
  15432. {
  15433. QScriptValue object;
  15434. if(context->argumentCount()==1)
  15435. {
  15436. object= engine->newQObject(new DAQ(argument<QString> (0,context)),
  15437. QScriptEngine::ScriptOwnership);
  15438. setDAQProperties(object,engine);
  15439. }
  15440. else if(context->argumentCount()==2)
  15441. {
  15442. object= engine->newQObject(new DAQ(argument<QString> (0,context),
  15443. argument<QString> (1,context)),
  15444. QScriptEngine::ScriptOwnership);
  15445. setDAQProperties(object,engine);
  15446. }
  15447. else
  15448. {
  15449. context->throwError("Incorrect number of arguments passed to DAQ"
  15450. "constructor. The DAQ constructor takes one"
  15451. "string as an argument specifying a device name."
  15452. "Example: Dev1");
  15453. }
  15454. return object;
  15455. }
  15456. /*:260*//*261:*/
  15457. #line 6264 "./typica.w"
  15458. void setDAQProperties(QScriptValue value,QScriptEngine*engine)
  15459. {
  15460. setQObjectProperties(value,engine);
  15461. value.setProperty("newChannel",engine->newFunction(DAQ_newChannel));
  15462. }
  15463. /*:261*//*262:*/
  15464. #line 6274 "./typica.w"
  15465. QScriptValue DAQ_newChannel(QScriptContext*context,QScriptEngine*engine)
  15466. {
  15467. DAQ*self= getself<DAQ*> (context);
  15468. QScriptValue object;
  15469. if(self)
  15470. {
  15471. object=
  15472. engine->newQObject(self->newChannel(argument<int> (0,context),
  15473. argument<int> (1,context)));
  15474. setChannelProperties(object,engine);
  15475. }
  15476. return object;
  15477. }
  15478. /*:262*//*269:*/
  15479. #line 6430 "./typica.w"
  15480. QScriptValue constructFakeDAQ(QScriptContext*context,
  15481. QScriptEngine*engine)
  15482. {
  15483. QScriptValue object;
  15484. if(context->argumentCount()==1)
  15485. {
  15486. object=
  15487. engine->newQObject(new FakeDAQ(argument<QString> (0,context)),
  15488. QScriptEngine::ScriptOwnership);
  15489. setFakeDAQProperties(object,engine);
  15490. }
  15491. else
  15492. {
  15493. context->throwError("Incorrect number of arguments passed to DAQ"
  15494. "constructor. The DAQ constructor takes one"
  15495. "string as an argument specifying a device name."
  15496. "Example: Dev1");
  15497. }
  15498. return object;
  15499. }
  15500. void setFakeDAQProperties(QScriptValue value,QScriptEngine*engine)
  15501. {
  15502. setQObjectProperties(value,engine);
  15503. value.setProperty("newChannel",engine->newFunction(FakeDAQ_newChannel));
  15504. }
  15505. QScriptValue FakeDAQ_newChannel(QScriptContext*context,QScriptEngine*engine)
  15506. {
  15507. FakeDAQ*self= getself<FakeDAQ*> (context);
  15508. QScriptValue object;
  15509. if(self)
  15510. {
  15511. object=
  15512. engine->newQObject(self->newChannel(argument<int> (0,context),
  15513. argument<int> (1,context)));
  15514. setChannelProperties(object,engine);
  15515. }
  15516. return object;
  15517. }
  15518. /*:269*//*273:*/
  15519. #line 6521 "./typica.w"
  15520. void setChannelProperties(QScriptValue value,QScriptEngine*engine)
  15521. {
  15522. setQObjectProperties(value,engine);
  15523. }
  15524. /*:273*//*280:*/
  15525. #line 6713 "./typica.w"
  15526. QScriptValue constructLinearCalibrator(QScriptContext*,QScriptEngine*engine)
  15527. {
  15528. QScriptValue object= engine->newQObject(new LinearCalibrator(NULL));
  15529. setLinearCalibratorProperties(object,engine);
  15530. return object;
  15531. }
  15532. void setLinearCalibratorProperties(QScriptValue value,QScriptEngine*engine)
  15533. {
  15534. setQObjectProperties(value,engine);
  15535. }
  15536. /*:280*//*285:*/
  15537. #line 6851 "./typica.w"
  15538. QScriptValue constructLinearSplineInterpolator(QScriptContext*,QScriptEngine*engine)
  15539. {
  15540. QScriptValue object= engine->newQObject(new LinearSplineInterpolator(NULL));
  15541. setLinearSplineInterpolatorProperties(object,engine);
  15542. return object;
  15543. }
  15544. void setLinearSplineInterpolatorProperties(QScriptValue value,QScriptEngine*engine)
  15545. {
  15546. setQObjectProperties(value,engine);
  15547. }
  15548. /*:285*//*295:*/
  15549. #line 7057 "./typica.w"
  15550. QScriptValue constructTemperatureDisplay(QScriptContext*,
  15551. QScriptEngine*engine)
  15552. {
  15553. QScriptValue object= engine->newQObject(new TemperatureDisplay);
  15554. setTemperatureDisplayProperties(object,engine);
  15555. return object;
  15556. }
  15557. void setTemperatureDisplayProperties(QScriptValue value,QScriptEngine*engine)
  15558. {
  15559. setQLCDNumberProperties(value,engine);
  15560. value.setProperty("setDisplayUnits",
  15561. engine->newFunction(TemperatureDisplay_setDisplayUnits));
  15562. }
  15563. /*:295*//*296:*/
  15564. #line 7081 "./typica.w"
  15565. QScriptValue TemperatureDisplay_setDisplayUnits(QScriptContext*context,QScriptEngine*)
  15566. {
  15567. TemperatureDisplay*self= getself<TemperatureDisplay*> (context);
  15568. self->setDisplayUnits((Units::Unit)argument<int> (0,context));
  15569. return QScriptValue();
  15570. }
  15571. /*:296*//*303:*/
  15572. #line 7218 "./typica.w"
  15573. QScriptValue constructMeasurementTimeOffset(QScriptContext*,
  15574. QScriptEngine*engine)
  15575. {
  15576. QScriptValue object=
  15577. engine->newQObject(new MeasurementTimeOffset(QTime::currentTime()));
  15578. setMeasurementTimeOffsetProperties(object,engine);
  15579. return object;
  15580. }
  15581. void setMeasurementTimeOffsetProperties(QScriptValue value,
  15582. QScriptEngine*engine)
  15583. {
  15584. setQObjectProperties(value,engine);
  15585. }
  15586. /*:303*//*308:*/
  15587. #line 7327 "./typica.w"
  15588. QScriptValue constructThresholdDetector(QScriptContext*,QScriptEngine*engine)
  15589. {
  15590. QScriptValue object= engine->newQObject(new ThresholdDetector(300));
  15591. return object;
  15592. }
  15593. void setThresholdDetectorProperties(QScriptValue value,QScriptEngine*engine)
  15594. {
  15595. setQObjectProperties(value,engine);
  15596. }
  15597. /*:308*//*313:*/
  15598. #line 7424 "./typica.w"
  15599. QScriptValue constructZeroEmitter(QScriptContext*context,
  15600. QScriptEngine*engine)
  15601. {
  15602. QScriptValue object=
  15603. engine->newQObject(new ZeroEmitter(argument<int> (0,context)));
  15604. setZeroEmitterProperties(object,engine);
  15605. return object;
  15606. }
  15607. void setZeroEmitterProperties(QScriptValue value,QScriptEngine*engine)
  15608. {
  15609. setQObjectProperties(value,engine);
  15610. }
  15611. /*:313*//*318:*/
  15612. #line 7504 "./typica.w"
  15613. QScriptValue constructMeasurementAdapter(QScriptContext*context,
  15614. QScriptEngine*engine)
  15615. {
  15616. QScriptValue object=
  15617. engine->newQObject(new MeasurementAdapter(argument<int> (0,context)));
  15618. setMeasurementAdapterProperties(object,engine);
  15619. return object;
  15620. }
  15621. void setMeasurementAdapterProperties(QScriptValue value,QScriptEngine*engine)
  15622. {
  15623. setQObjectProperties(value,engine);
  15624. }
  15625. /*:318*//*335:*/
  15626. #line 7966 "./typica.w"
  15627. QScriptValue constructGraphView(QScriptContext*,QScriptEngine*engine)
  15628. {
  15629. QScriptValue object= engine->newQObject(new GraphView);
  15630. setGraphViewProperties(object,engine);
  15631. return object;
  15632. }
  15633. void setGraphViewProperties(QScriptValue value,QScriptEngine*engine)
  15634. {
  15635. setQGraphicsViewProperties(value,engine);
  15636. }
  15637. /*:335*//*358:*/
  15638. #line 8604 "./typica.w"
  15639. QScriptValue constructZoomLog(QScriptContext*,QScriptEngine*engine)
  15640. {
  15641. QScriptValue object= engine->newQObject(new ZoomLog);
  15642. setZoomLogProperties(object,engine);
  15643. return object;
  15644. }
  15645. void setZoomLogProperties(QScriptValue value,QScriptEngine*engine)
  15646. {
  15647. setQTableViewProperties(value,engine);
  15648. value.setProperty("saveXML",engine->newFunction(ZoomLog_saveXML));
  15649. value.setProperty("saveCSV",engine->newFunction(ZoomLog_saveCSV));
  15650. value.setProperty("saveState",engine->newFunction(ZoomLog_saveState));
  15651. value.setProperty("restoreState",
  15652. engine->newFunction(ZoomLog_restoreState));
  15653. value.setProperty("lastTime",engine->newFunction(ZoomLog_lastTime));
  15654. value.setProperty("saveTemporary",
  15655. engine->newFunction(ZoomLog_saveTemporary));
  15656. value.setProperty("setDisplayUnits",engine->newFunction(ZoomLog_setDisplayUnits));
  15657. }
  15658. /*:358*//*359:*/
  15659. #line 8631 "./typica.w"
  15660. QScriptValue ZoomLog_saveXML(QScriptContext*context,QScriptEngine*engine)
  15661. {
  15662. ZoomLog*self= getself<ZoomLog*> (context);
  15663. bool retval= self->saveXML(argument<QIODevice*> (0,context));
  15664. return QScriptValue(engine,retval);
  15665. }
  15666. QScriptValue ZoomLog_saveCSV(QScriptContext*context,QScriptEngine*engine)
  15667. {
  15668. ZoomLog*self= getself<ZoomLog*> (context);
  15669. bool retval= self->saveCSV(argument<QIODevice*> (0,context));
  15670. return QScriptValue(engine,retval);
  15671. }
  15672. QScriptValue ZoomLog_saveTemporary(QScriptContext*context,
  15673. QScriptEngine*engine)
  15674. {
  15675. ZoomLog*self= getself<ZoomLog*> (context);
  15676. QString filename= QDir::tempPath();
  15677. filename.append("/");
  15678. filename.append(QUuid::createUuid().toString());
  15679. filename.append(".xml");
  15680. QFile*file= new QFile(filename);
  15681. self->saveXML(file);
  15682. file->close();
  15683. delete file;
  15684. return QScriptValue(engine,filename);
  15685. }
  15686. /*:359*//*360:*/
  15687. #line 8679 "./typica.w"
  15688. QScriptValue ZoomLog_saveState(QScriptContext*context,QScriptEngine*)
  15689. {
  15690. ZoomLog*self= getself<ZoomLog*> (context);
  15691. QString key= argument<QString> (0,context);
  15692. int columns= argument<int> (1,context);
  15693. QSettings settings;
  15694. for(int i= 0;i<columns;i++)
  15695. {
  15696. if(self->columnWidth(i))
  15697. {
  15698. settings.beginGroup(key);
  15699. settings.setValue(QString("%1").arg(i),self->columnWidth(i));
  15700. settings.endGroup();
  15701. }
  15702. }
  15703. return QScriptValue();
  15704. }
  15705. QScriptValue ZoomLog_restoreState(QScriptContext*context,QScriptEngine*)
  15706. {
  15707. ZoomLog*self= getself<ZoomLog*> (context);
  15708. QString key= argument<QString> (0,context);
  15709. int columns= argument<int> (1,context);
  15710. QSettings settings;
  15711. for(int i= 0;i<columns;i++)
  15712. {
  15713. settings.beginGroup(key);
  15714. self->setColumnWidth(i,
  15715. settings.value(QString("%1").arg(i),80).toInt());
  15716. if(settings.value(QString("%1").arg(i),80).toInt()==0)
  15717. {
  15718. self->setColumnWidth(i,80);
  15719. }
  15720. settings.endGroup();
  15721. }
  15722. return QScriptValue();
  15723. }
  15724. QScriptValue ZoomLog_lastTime(QScriptContext*context,QScriptEngine*engine)
  15725. {
  15726. ZoomLog*self= getself<ZoomLog*> (context);
  15727. return QScriptValue(engine,self->lastTime(argument<int> (0,context)));
  15728. }
  15729. /*:360*//*361:*/
  15730. #line 8732 "./typica.w"
  15731. QScriptValue ZoomLog_setDisplayUnits(QScriptContext*context,QScriptEngine*)
  15732. {
  15733. ZoomLog*self= getself<ZoomLog*> (context);
  15734. self->setDisplayUnits((Units::Unit)argument<int> (0,context));
  15735. return QScriptValue();
  15736. }
  15737. /*:361*//*396:*/
  15738. #line 9552 "./typica.w"
  15739. QScriptValue constructAnnotationButton(QScriptContext*context,
  15740. QScriptEngine*engine)
  15741. {
  15742. QScriptValue object=
  15743. engine->newQObject(new AnnotationButton(argument<QString> (0,context)));
  15744. setAnnotationButtonProperties(object,engine);
  15745. return object;
  15746. }
  15747. void setAnnotationButtonProperties(QScriptValue value,QScriptEngine*engine)
  15748. {
  15749. setQPushButtonProperties(value,engine);
  15750. }
  15751. /*:396*//*404:*/
  15752. #line 9695 "./typica.w"
  15753. QScriptValue constructAnnotationSpinBox(QScriptContext*context,
  15754. QScriptEngine*engine)
  15755. {
  15756. QScriptValue object= engine->newQObject(new AnnotationSpinBox(
  15757. argument<QString> (0,context),argument<QString> (1,context)));
  15758. setAnnotationSpinBoxProperties(object,engine);
  15759. return object;
  15760. }
  15761. void setAnnotationSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  15762. {
  15763. setQDoubleSpinBoxProperties(value,engine);
  15764. }
  15765. void setQDoubleSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  15766. {
  15767. setQAbstractSpinBoxProperties(value,engine);
  15768. }
  15769. void setQAbstractSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  15770. {
  15771. setQWidgetProperties(value,engine);
  15772. }
  15773. /*:404*//*425:*/
  15774. #line 10114 "./typica.w"
  15775. QScriptValue constructTimerDisplay(QScriptContext*,QScriptEngine*engine)
  15776. {
  15777. QScriptValue object= engine->newQObject(new TimerDisplay);
  15778. setTimerDisplayProperties(object,engine);
  15779. return object;
  15780. }
  15781. void setTimerDisplayProperties(QScriptValue value,QScriptEngine*engine)
  15782. {
  15783. setQLCDNumberProperties(value,engine);
  15784. }
  15785. /*:425*//*452:*/
  15786. #line 10609 "./typica.w"
  15787. QScriptValue constructWidgetDecorator(QScriptContext*context,
  15788. QScriptEngine*engine)
  15789. {
  15790. QWidget*widget= argument<QWidget*> (0,context);
  15791. QString text= argument<QString> (1,context);
  15792. Qt::Orientations orientation;
  15793. switch(argument<int> (2,context))
  15794. {
  15795. case 2:
  15796. orientation= Qt::Vertical;
  15797. break;
  15798. default:
  15799. orientation= Qt::Horizontal;
  15800. break;
  15801. }
  15802. QScriptValue object=
  15803. engine->newQObject(new WidgetDecorator(widget,text,orientation));
  15804. setWidgetDecoratorProperties(object,engine);
  15805. return object;
  15806. }
  15807. void setWidgetDecoratorProperties(QScriptValue value,QScriptEngine*engine)
  15808. {
  15809. setQWidgetProperties(value,engine);
  15810. }
  15811. /*:452*//*465:*/
  15812. #line 10890 "./typica.w"
  15813. QScriptValue constructLogEditWindow(QScriptContext*,QScriptEngine*engine)
  15814. {
  15815. QScriptValue object= engine->newQObject(new LogEditWindow);
  15816. return object;
  15817. }
  15818. /*:465*//*484:*/
  15819. #line 11418 "./typica.w"
  15820. QScriptValue constructXMLInput(QScriptContext*context,QScriptEngine*engine)
  15821. {
  15822. QIODevice*device= argument<QIODevice*> (0,context);
  15823. QScriptValue object= engine->newQObject(new XMLInput(&*device,
  15824. argument<int> (1,context)));
  15825. object.setProperty("input",engine->newFunction(XMLInput_input));
  15826. return object;
  15827. }
  15828. QScriptValue XMLInput_input(QScriptContext*context,QScriptEngine*)
  15829. {
  15830. XMLInput*self= getself<XMLInput*> (context);
  15831. self->input();
  15832. return QScriptValue();
  15833. }
  15834. /*:484*//*498:*/
  15835. #line 154 "./webview.w"
  15836. QScriptValue constructWebView(QScriptContext*,QScriptEngine*engine)
  15837. {
  15838. QScriptValue object= engine->newQObject(new TypicaWebView);
  15839. setQWebViewProperties(object,engine);
  15840. return object;
  15841. }
  15842. void setQWebViewProperties(QScriptValue value,QScriptEngine*engine)
  15843. {
  15844. setQWidgetProperties(value,engine);
  15845. }
  15846. /*:498*//*499:*/
  15847. #line 171 "./webview.w"
  15848. void addWebViewToLayout(QDomElement element,QStack<QWidget*> *,
  15849. QStack<QLayout*> *layoutStack)
  15850. {
  15851. TypicaWebView*view= new TypicaWebView;
  15852. if(element.hasAttribute("id"))
  15853. {
  15854. view->setObjectName(element.attribute("id"));
  15855. }
  15856. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  15857. layout->addWidget(view);
  15858. }
  15859. /*:499*//*504:*/
  15860. #line 222 "./webview.w"
  15861. QScriptValue QWebElement_toScriptValue(QScriptEngine*engine,const QWebElement&element)
  15862. {
  15863. QVariant var;
  15864. var.setValue(element);
  15865. QScriptValue object= engine->newVariant(var);
  15866. return object;
  15867. }
  15868. void QWebElement_fromScriptValue(const QScriptValue&value,QWebElement&element)
  15869. {
  15870. element= value.toVariant().value<QWebElement> ();
  15871. }
  15872. /*:504*//*509:*/
  15873. #line 287 "./webview.w"
  15874. template<> QWebElement argument(int arg,QScriptContext*context)
  15875. {
  15876. return qscriptvalue_cast<QWebElement> (context->argument(arg));
  15877. }
  15878. /*:509*//*510:*/
  15879. #line 296 "./webview.w"
  15880. QScriptValue constructWebElement(QScriptContext*context,
  15881. QScriptEngine*engine)
  15882. {
  15883. QWebElement element= argument<QWebElement> (0,context);
  15884. QScriptValue object= engine->newQObject(new TypicaWebElement(element));
  15885. return object;
  15886. }
  15887. /*:510*//*575:*/
  15888. #line 12737 "./typica.w"
  15889. QScriptValue constructSqlQueryView(QScriptContext*,QScriptEngine*engine)
  15890. {
  15891. QScriptValue object= engine->newQObject(new SqlQueryView);
  15892. setSqlQueryViewProperties(object,engine);
  15893. return object;
  15894. }
  15895. void setSqlQueryViewProperties(QScriptValue value,QScriptEngine*engine)
  15896. {
  15897. setQTableViewProperties(value,engine);
  15898. value.setProperty("setHeaderData",
  15899. engine->newFunction(SqlQueryView_setHeaderData));
  15900. value.setProperty("setQuery",engine->newFunction(SqlQueryView_setQuery));
  15901. }
  15902. /*:575*//*576:*/
  15903. #line 12755 "./typica.w"
  15904. QScriptValue SqlQueryView_setQuery(QScriptContext*context,QScriptEngine*)
  15905. {
  15906. SqlQueryView*self= getself<SqlQueryView*> (context);
  15907. QString query= argument<QString> (0,context);
  15908. self->setQuery(query);
  15909. self->reset();
  15910. return QScriptValue();
  15911. }
  15912. QScriptValue SqlQueryView_setHeaderData(QScriptContext*context,
  15913. QScriptEngine*)
  15914. {
  15915. SqlQueryView*self= getself<SqlQueryView*> (context);
  15916. int section= argument<int> (0,context);
  15917. QString data= argument<QString> (1,context);
  15918. self->setHeaderData(section,Qt::Horizontal,data,Qt::DisplayRole);
  15919. return QScriptValue();
  15920. }
  15921. /*:576*//*584:*/
  15922. #line 12962 "./typica.w"
  15923. void addReportToLayout(QDomElement element,QStack<QWidget*> *,
  15924. QStack<QLayout*> *layoutStack)
  15925. {
  15926. QTextEdit*widget= new QTextEdit;
  15927. if(element.hasAttribute("id"))
  15928. {
  15929. widget->setObjectName(element.attribute("id"));
  15930. }
  15931. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  15932. layout->addWidget(widget);
  15933. QTextDocument*document= new QTextDocument;
  15934. QFont defaultFont;
  15935. defaultFont.setPointSize(11);
  15936. document->setDefaultFont(defaultFont);
  15937. QTextCursor cursor(document);
  15938. /*585:*/
  15939. #line 12985 "./typica.w"
  15940. QDomNodeList children= element.childNodes();
  15941. for(int i= 0;i<children.count();i++)
  15942. {
  15943. QDomNode current;
  15944. QDomElement currentElement;
  15945. current= children.at(i);
  15946. if(current.isElement())
  15947. {
  15948. currentElement= current.toElement();
  15949. /*586:*/
  15950. #line 13002 "./typica.w"
  15951. if(currentElement.tagName()=="style")
  15952. {
  15953. document->setDefaultStyleSheet(currentElement.text());
  15954. }
  15955. /*:586*//*587:*/
  15956. #line 13013 "./typica.w"
  15957. if(currentElement.tagName()=="html")
  15958. {
  15959. cursor.insertHtml(currentElement.text());
  15960. }
  15961. /*:587*//*588:*/
  15962. #line 13023 "./typica.w"
  15963. if(currentElement.tagName()=="text")
  15964. {
  15965. cursor.insertText(currentElement.text());
  15966. }
  15967. /*:588*//*589:*/
  15968. #line 13033 "./typica.w"
  15969. if(currentElement.tagName()=="table")
  15970. {
  15971. QTextFrame*frame= cursor.insertFrame(QTextFrameFormat());
  15972. ReportTable*table= new ReportTable(frame,currentElement);
  15973. table->setParent(widget);
  15974. if(currentElement.hasAttribute("id"))
  15975. {
  15976. table->setObjectName(currentElement.attribute("id"));
  15977. }
  15978. }
  15979. /*:589*/
  15980. #line 12995 "./typica.w"
  15981. }
  15982. }
  15983. /*:585*/
  15984. #line 12978 "./typica.w"
  15985. widget->setDocument(document);
  15986. }
  15987. /*:584*//*600:*/
  15988. #line 13246 "./typica.w"
  15989. QScriptValue QTextEdit_print(QScriptContext*context,QScriptEngine*)
  15990. {
  15991. QTextEdit*self= getself<QTextEdit*> (context);
  15992. QTextDocument*document= self->document();
  15993. QPrinter printer;
  15994. QPrintDialog printwindow(&printer,self);
  15995. if(printwindow.exec()!=QDialog::Accepted)
  15996. {
  15997. return QScriptValue();
  15998. }
  15999. document->print(&printer);
  16000. return QScriptValue();
  16001. }
  16002. /*:600*//*601:*/
  16003. #line 13264 "./typica.w"
  16004. void setQTextEditProperties(QScriptValue value,QScriptEngine*engine)
  16005. {
  16006. setQAbstractScrollAreaProperties(value,engine);
  16007. value.setProperty("print",engine->newFunction(QTextEdit_print));
  16008. }
  16009. /*:601*//*610:*/
  16010. #line 13442 "./typica.w"
  16011. void addFormArrayToLayout(QDomElement element,QStack<QWidget*> *,
  16012. QStack<QLayout*> *layoutStack)
  16013. {
  16014. FormArray*widget= new FormArray(element);
  16015. if(element.hasAttribute("id"))
  16016. {
  16017. widget->setObjectName(element.attribute("id"));
  16018. }
  16019. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16020. layout->addWidget(widget);
  16021. }
  16022. /*:610*//*631:*/
  16023. #line 14029 "./typica.w"
  16024. void addScaleControlToLayout(QDomElement element,QStack<QWidget*> *,
  16025. QStack<QLayout*> *layoutStack)
  16026. {
  16027. ScaleControl*scale= new ScaleControl;
  16028. if(element.hasAttribute("id"))
  16029. {
  16030. scale->setObjectName(element.attribute("id"));
  16031. }
  16032. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16033. layout->addWidget(scale);
  16034. }
  16035. void addIntensityControlToLayout(QDomElement element,QStack<QWidget*> *,
  16036. QStack<QLayout*> *layoutStack)
  16037. {
  16038. IntensityControl*scale= new IntensityControl;
  16039. if(element.hasAttribute("id"))
  16040. {
  16041. scale->setObjectName(element.attribute("id"));
  16042. }
  16043. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16044. layout->addWidget(scale);
  16045. }
  16046. /*:631*//*657:*/
  16047. #line 14619 "./typica.w"
  16048. QScriptValue constructDeviceTreeModel(QScriptContext*,QScriptEngine*engine)
  16049. {
  16050. QScriptValue object= engine->newQObject(new DeviceTreeModel);
  16051. setDeviceTreeModelProperties(object,engine);
  16052. return object;
  16053. }
  16054. /*:657*//*659:*/
  16055. #line 14642 "./typica.w"
  16056. void setDeviceTreeModelProperties(QScriptValue value,QScriptEngine*engine)
  16057. {
  16058. setQAbstractItemModelProperties(value,engine);
  16059. value.setProperty("referenceElement",
  16060. engine->newFunction(DeviceTreeModel_referenceElement));
  16061. }
  16062. void setQAbstractItemModelProperties(QScriptValue value,QScriptEngine*engine)
  16063. {
  16064. setQObjectProperties(value,engine);
  16065. value.setProperty("data",engine->newFunction(QAbstractItemModel_data));
  16066. value.setProperty("index",engine->newFunction(QAbstractItemModel_index));
  16067. value.setProperty("rowCount",engine->newFunction(QAbstractItemModel_rowCount));
  16068. value.setProperty("hasChildren",engine->newFunction(QAbstractItemModel_hasChildren));
  16069. }
  16070. /*:659*//*660:*/
  16071. #line 14669 "./typica.w"
  16072. QScriptValue DeviceTreeModel_referenceElement(QScriptContext*context,
  16073. QScriptEngine*engine)
  16074. {
  16075. DeviceTreeModel*model= getself<DeviceTreeModel*> (context);
  16076. QDomElement referenceElement= model->referenceElement(argument<QString> (0,context));
  16077. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  16078. QDomElement node;
  16079. QVariantMap retval;
  16080. retval.insert("driver",referenceElement.attribute("driver"));
  16081. for(int i= 0;i<configData.size();i++)
  16082. {
  16083. node= configData.at(i).toElement();
  16084. retval.insert(node.attribute("name"),node.attribute("value"));
  16085. }
  16086. return engine->toScriptValue(retval);
  16087. }
  16088. QScriptValue QAbstractItemModel_data(QScriptContext*context,QScriptEngine*engine)
  16089. {
  16090. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  16091. QModelIndex index= argument<QModelIndex> (0,context);
  16092. int role= argument<int> (1,context);
  16093. return engine->toScriptValue(model->data(index,role));
  16094. }
  16095. QScriptValue QAbstractItemModel_index(QScriptContext*context,QScriptEngine*engine)
  16096. {
  16097. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  16098. int row= 0;
  16099. int column= 0;
  16100. QModelIndex index;
  16101. if(context->argumentCount()> 1)
  16102. {
  16103. row= argument<int> (0,context);
  16104. column= argument<int> (1,context);
  16105. }
  16106. if(context->argumentCount()> 2)
  16107. {
  16108. index= argument<QModelIndex> (2,context);
  16109. }
  16110. QModelIndex retval= model->index(row,column,index);
  16111. return engine->toScriptValue(retval);
  16112. }
  16113. QScriptValue QAbstractItemModel_rowCount(QScriptContext*context,
  16114. QScriptEngine*)
  16115. {
  16116. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  16117. QModelIndex index;
  16118. if(context->argumentCount()==1)
  16119. {
  16120. index= argument<QModelIndex> (0,context);
  16121. }
  16122. return QScriptValue(model->rowCount(index));
  16123. }
  16124. QScriptValue QAbstractItemModel_hasChildren(QScriptContext*context,
  16125. QScriptEngine*engine)
  16126. {
  16127. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  16128. QModelIndex index;
  16129. if(context->argumentCount()==1)
  16130. {
  16131. index= argument<QModelIndex> (0,context);
  16132. }
  16133. return QScriptValue(engine,model->hasChildren(index));
  16134. }
  16135. /*:660*//*663:*/
  16136. #line 14753 "./typica.w"
  16137. QScriptValue QModelIndex_toScriptValue(QScriptEngine*engine,const QModelIndex&index)
  16138. {
  16139. QVariant var;
  16140. var.setValue(index);
  16141. QScriptValue object= engine->newVariant(var);
  16142. return object;
  16143. }
  16144. void QModelIndex_fromScriptValue(const QScriptValue&value,QModelIndex&index)
  16145. {
  16146. index= value.toVariant().value<QModelIndex> ();
  16147. }
  16148. /*:663*//*679:*/
  16149. #line 15050 "./typica.w"
  16150. QScriptValue constructDeviceConfigurationWindow(QScriptContext*,
  16151. QScriptEngine*engine)
  16152. {
  16153. QScriptValue object= engine->newQObject(new DeviceConfigurationWindow);
  16154. return object;
  16155. }
  16156. /*:679*//*750:*/
  16157. #line 45 "./settings.w"
  16158. QScriptValue constructSettingsWindow(QScriptContext*,QScriptEngine*engine)
  16159. {
  16160. QScriptValue object= engine->newQObject(new SettingsWindow);
  16161. return object;
  16162. }
  16163. /*:750*//*770:*/
  16164. #line 17599 "./typica.w"
  16165. QScriptValue constructModbusRTUDevice(QScriptContext*context,QScriptEngine*engine)
  16166. {
  16167. QScriptValue object;
  16168. if(context->argumentCount()==2)
  16169. {
  16170. object= engine->newQObject(new ModbusRTUDevice(argument<DeviceTreeModel*> (0,context),
  16171. argument<QModelIndex> (1,context)),
  16172. QScriptEngine::ScriptOwnership);
  16173. setModbusRTUDeviceProperties(object,engine);
  16174. }
  16175. else
  16176. {
  16177. context->throwError("Incorrect number of arguments passed to "
  16178. "ModbusRTUDevice constructor. This takes the configuration model "
  16179. "and an index.");
  16180. }
  16181. return object;
  16182. }
  16183. /*:770*//*771:*/
  16184. #line 17621 "./typica.w"
  16185. QScriptValue ModbusRTUDevice_pVChannel(QScriptContext*context,QScriptEngine*engine)
  16186. {
  16187. ModbusRTUDevice*self= getself<ModbusRTUDevice*> (context);
  16188. QScriptValue object;
  16189. if(self)
  16190. {
  16191. if(self->channels.size()> 0)
  16192. {
  16193. object= engine->newQObject(self->channels.at(0));
  16194. setChannelProperties(object,engine);
  16195. }
  16196. }
  16197. return object;
  16198. }
  16199. QScriptValue ModbusRTUDevice_sVChannel(QScriptContext*context,QScriptEngine*engine)
  16200. {
  16201. ModbusRTUDevice*self= getself<ModbusRTUDevice*> (context);
  16202. QScriptValue object;
  16203. if(self)
  16204. {
  16205. if(self->channels.size()> 1)
  16206. {
  16207. object= engine->newQObject(self->channels.at(1));
  16208. setChannelProperties(object,engine);
  16209. }
  16210. }
  16211. return object;
  16212. }
  16213. /*:771*//*772:*/
  16214. #line 17654 "./typica.w"
  16215. void setModbusRTUDeviceProperties(QScriptValue value,QScriptEngine*engine)
  16216. {
  16217. setQObjectProperties(value,engine);
  16218. value.setProperty("pVChannel",engine->newFunction(ModbusRTUDevice_pVChannel));
  16219. value.setProperty("sVChannel",engine->newFunction(ModbusRTUDevice_sVChannel));
  16220. }
  16221. /*:772*//*794:*/
  16222. #line 170 "./rate.w"
  16223. QScriptValue constructRateOfChange(QScriptContext*context,QScriptEngine*engine)
  16224. {
  16225. int cachetime= 1;
  16226. int scaletime= 1;
  16227. if(context->argumentCount()> 0)
  16228. {
  16229. cachetime= argument<int> (0,context);
  16230. if(context->argumentCount()> 1)
  16231. {
  16232. scaletime= argument<int> (1,context);
  16233. }
  16234. }
  16235. QScriptValue object= engine->newQObject(new RateOfChange(cachetime,scaletime));
  16236. setRateOfChangeProperties(object,engine);
  16237. return object;
  16238. }
  16239. void setRateOfChangeProperties(QScriptValue value,QScriptEngine*engine)
  16240. {
  16241. setQObjectProperties(value,engine);
  16242. }
  16243. /*:794*//*819:*/
  16244. #line 614 "./dataqsdk.w"
  16245. QScriptValue constructDataqSdkDevice(QScriptContext*context,QScriptEngine*engine)
  16246. {
  16247. QScriptValue object;
  16248. if(context->argumentCount()==1)
  16249. {
  16250. object= engine->newQObject(new DataqSdkDevice(argument<QString> (0,context)),
  16251. QScriptEngine::ScriptOwnership);
  16252. setDataqSdkDeviceProperties(object,engine);
  16253. }
  16254. else
  16255. {
  16256. context->throwError("Incorrect number of arguments passed to "
  16257. "DataqSdkDevice. The constructor takes one string "
  16258. "as an argument specifying a device name. "
  16259. "Example: Dev1");
  16260. }
  16261. return object;
  16262. }
  16263. /*:819*//*820:*/
  16264. #line 637 "./dataqsdk.w"
  16265. void setDataqSdkDeviceProperties(QScriptValue value,QScriptEngine*engine)
  16266. {
  16267. setQObjectProperties(value,engine);
  16268. value.setProperty("newChannel",engine->newFunction(DataqSdkDevice_newChannel));
  16269. }
  16270. /*:820*//*821:*/
  16271. #line 647 "./dataqsdk.w"
  16272. QScriptValue DataqSdkDevice_newChannel(QScriptContext*context,QScriptEngine*engine)
  16273. {
  16274. DataqSdkDevice*self= getself<DataqSdkDevice*> (context);
  16275. QScriptValue object;
  16276. if(self)
  16277. {
  16278. object= engine->newQObject(self->newChannel((Units::Unit)argument<int> (0,context)));
  16279. setChannelProperties(object,engine);
  16280. }
  16281. return object;
  16282. }
  16283. /*:821*//*846:*/
  16284. #line 80 "./scales.w"
  16285. QScriptValue constructDragLabel(QScriptContext*context,QScriptEngine*engine)
  16286. {
  16287. QScriptValue object;
  16288. QString labelText= "";
  16289. if(context->argumentCount()==1)
  16290. {
  16291. labelText= argument<QString> (0,context);
  16292. }
  16293. object= engine->newQObject(new DragLabel(labelText));
  16294. setDragLabelProperties(object,engine);
  16295. return object;
  16296. }
  16297. void setDragLabelProperties(QScriptValue value,QScriptEngine*engine)
  16298. {
  16299. setQLabelProperties(value,engine);
  16300. }
  16301. /*:846*//*856:*/
  16302. #line 272 "./scales.w"
  16303. QScriptValue BaudRateType_toScriptValue(QScriptEngine*engine,const BaudRateType&value)
  16304. {
  16305. return engine->newVariant(QVariant((int)(value)));
  16306. }
  16307. void BaudRateType_fromScriptValue(const QScriptValue&sv,BaudRateType&value)
  16308. {
  16309. value= (BaudRateType)(sv.toVariant().toInt());
  16310. }
  16311. QScriptValue DataBitsType_toScriptValue(QScriptEngine*engine,const DataBitsType&value)
  16312. {
  16313. return engine->newVariant(QVariant((int)(value)));
  16314. }
  16315. void DataBitsType_fromScriptValue(const QScriptValue&sv,DataBitsType&value)
  16316. {
  16317. value= (DataBitsType)(sv.toVariant().toInt());
  16318. }
  16319. QScriptValue ParityType_toScriptValue(QScriptEngine*engine,const ParityType&value)
  16320. {
  16321. return engine->newVariant(QVariant((int)(value)));
  16322. }
  16323. void ParityType_fromScriptValue(const QScriptValue&sv,ParityType&value)
  16324. {
  16325. value= (ParityType)(sv.toVariant().toInt());
  16326. }
  16327. QScriptValue StopBitsType_toScriptValue(QScriptEngine*engine,const StopBitsType&value)
  16328. {
  16329. return engine->newVariant(QVariant((int)(value)));
  16330. }
  16331. void StopBitsType_fromScriptValue(const QScriptValue&sv,StopBitsType&value)
  16332. {
  16333. value= (StopBitsType)(sv.toVariant().toInt());
  16334. }
  16335. QScriptValue FlowType_toScriptValue(QScriptEngine*engine,const FlowType&value)
  16336. {
  16337. return engine->newVariant(QVariant((int)(value)));
  16338. }
  16339. void FlowType_fromScriptValue(const QScriptValue&sv,FlowType&value)
  16340. {
  16341. value= (FlowType)(sv.toVariant().toInt());
  16342. }
  16343. /*:856*//*859:*/
  16344. #line 341 "./scales.w"
  16345. void setSerialScaleProperties(QScriptValue value,QScriptEngine*engine)
  16346. {
  16347. setQIODeviceProperties(value,engine);
  16348. }
  16349. /*:859*//*860:*/
  16350. #line 349 "./scales.w"
  16351. QScriptValue constructSerialScale(QScriptContext*context,QScriptEngine*engine)
  16352. {
  16353. QScriptValue object;
  16354. if(context->argumentCount()==1)
  16355. {
  16356. object= engine->newQObject(new SerialScale(argument<QString> (0,context)));
  16357. setSerialScaleProperties(object,engine);
  16358. }
  16359. else
  16360. {
  16361. context->throwError("Incorrect number of arguments passed to "
  16362. "SerialScale. The constructor takes one string "
  16363. "as an argument specifying a port name.");
  16364. }
  16365. return object;
  16366. }
  16367. /*:860*//*882:*/
  16368. #line 278 "./valueannotation.w"
  16369. QScriptValue constructValueAnnotation(QScriptContext*context,QScriptEngine*engine)
  16370. {
  16371. QScriptValue object= engine->newQObject(new ValueAnnotation);
  16372. setValueAnnotationProperties(object,engine);
  16373. return object;
  16374. }
  16375. void setValueAnnotationProperties(QScriptValue value,QScriptEngine*engine)
  16376. {
  16377. setQObjectProperties(value,engine);
  16378. }
  16379. #line 18424 "./typica.w"
  16380. /*:882*/
  16381. #line 529 "./typica.w"
  16382. /*554:*/
  16383. #line 12367 "./typica.w"
  16384. int main(int argc,char**argv)
  16385. {
  16386. int*c= &argc;
  16387. Application app(*c,argv);
  16388. /*555:*/
  16389. #line 12393 "./typica.w"
  16390. QStringList themeSearchPath= QIcon::themeSearchPaths();
  16391. themeSearchPath.append(":/resources/icons/tango");
  16392. QIcon::setThemeSearchPaths(themeSearchPath);
  16393. QIcon::setThemeName(":/resources/icons/tango");
  16394. app.setWindowIcon(QIcon(":/resources/icons/appicons/logo.svg"));
  16395. /*:555*/
  16396. #line 12372 "./typica.w"
  16397. /*556:*/
  16398. #line 12413 "./typica.w"
  16399. QFile entypo(":/resources/fonts/entypo.ttf");
  16400. entypo.open(QIODevice::ReadOnly);
  16401. QFontDatabase::addApplicationFontFromData(entypo.readAll());
  16402. entypo.close();
  16403. QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-regular.otf");
  16404. QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-bold.otf");
  16405. QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-bolditalic.otf");
  16406. QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-italic.otf");
  16407. QWebSettings::globalSettings()->setFontFamily(QWebSettings::StandardFont,"Tex Gyre Pagella");
  16408. /*:556*/
  16409. #line 12373 "./typica.w"
  16410. QSettings settings;
  16411. /*689:*/
  16412. #line 15270 "./typica.w"
  16413. app.registerDeviceConfigurationWidget("roaster",RoasterConfWidget::staticMetaObject);
  16414. /*:689*//*699:*/
  16415. #line 15512 "./typica.w"
  16416. app.registerDeviceConfigurationWidget("nidaqmxbase",
  16417. NiDaqMxBaseDriverConfWidget::staticMetaObject);
  16418. app.registerDeviceConfigurationWidget("nidaqmxbase9211series",
  16419. NiDaqMxBase9211ConfWidget::staticMetaObject);
  16420. app.registerDeviceConfigurationWidget("ni9211seriestc",
  16421. Ni9211TcConfWidget::staticMetaObject);
  16422. /*:699*//*707:*/
  16423. #line 15743 "./typica.w"
  16424. app.registerDeviceConfigurationWidget("nidaqmx",NiDaqMxDriverConfWidget::staticMetaObject);
  16425. app.registerDeviceConfigurationWidget("nidaqmx9211series",NiDaqMx9211ConfWidget::staticMetaObject);
  16426. app.registerDeviceConfigurationWidget("nidaqmxtc01",NiDaqMxTc01ConfWidget::staticMetaObject);
  16427. /*:707*//*731:*/
  16428. #line 16708 "./typica.w"
  16429. app.registerDeviceConfigurationWidget("modbusrtuport",ModbusRtuPortConfWidget::staticMetaObject);
  16430. app.registerDeviceConfigurationWidget("modbusrtudevice",ModbusRtuDeviceConfWidget::staticMetaObject);
  16431. app.registerDeviceConfigurationWidget("modbustemperaturepv",ModbusRtuDeviceTPvConfWidget::staticMetaObject);
  16432. app.registerDeviceConfigurationWidget("modbustemperaturesv",ModbusRtuDeviceTSvConfWidget::staticMetaObject);
  16433. /*:731*//*736:*/
  16434. #line 16793 "./typica.w"
  16435. app.registerDeviceConfigurationWidget("annotationbutton",AnnotationButtonConfWidget::staticMetaObject);
  16436. /*:736*//*739:*/
  16437. #line 16863 "./typica.w"
  16438. app.registerDeviceConfigurationWidget("reconfigurablebutton",ReconfigurableAnnotationButtonConfWidget::staticMetaObject);
  16439. /*:739*//*742:*/
  16440. #line 16990 "./typica.w"
  16441. app.registerDeviceConfigurationWidget("annotationspinbox",NoteSpinConfWidget::staticMetaObject);
  16442. #line 1 "./freeannotation.w"
  16443. /*:742*//*746:*/
  16444. #line 57 "./freeannotation.w"
  16445. app.registerDeviceConfigurationWidget("freeannotation",
  16446. FreeAnnotationConfWidget::staticMetaObject);
  16447. #line 16994 "./typica.w"
  16448. #line 1 "./settings.w"
  16449. /*:746*//*775:*/
  16450. #line 18195 "./typica.w"
  16451. app.registerDeviceConfigurationWidget("modbusrtu",ModbusConfigurator::staticMetaObject);
  16452. /*:775*//*782:*/
  16453. #line 18325 "./typica.w"
  16454. app.registerDeviceConfigurationWidget("linearspline",LinearSplineInterpolationConfWidget::staticMetaObject);
  16455. /*:782*//*786:*/
  16456. #line 18414 "./typica.w"
  16457. app.registerDeviceConfigurationWidget("translation",TranslationConfWidget::staticMetaObject);
  16458. #line 1 "./rate.w"
  16459. /*:786*//*798:*/
  16460. #line 272 "./rate.w"
  16461. app.registerDeviceConfigurationWidget("rate",RateOfChangeConfWidget::staticMetaObject);
  16462. /*:798*//*839:*/
  16463. #line 1233 "./dataqsdk.w"
  16464. app.registerDeviceConfigurationWidget("dataqsdk",DataqSdkDeviceConfWidget::staticMetaObject);
  16465. app.registerDeviceConfigurationWidget("dataqsdkchannel",
  16466. DataqSdkChannelConfWidget::staticMetaObject);
  16467. /*:839*//*864:*/
  16468. #line 490 "./scales.w"
  16469. app.registerDeviceConfigurationWidget("scale",SerialScaleConfWidget::staticMetaObject);
  16470. /*:864*//*872:*/
  16471. #line 138 "./valueannotation.w"
  16472. app.registerDeviceConfigurationWidget("valueannotation",
  16473. ValueAnnotationConfWidget::staticMetaObject);
  16474. /*:872*/
  16475. #line 12377 "./typica.w"
  16476. /*557:*/
  16477. #line 12430 "./typica.w"
  16478. if(settings.value("database/exists","false").toString()=="true")
  16479. {
  16480. /*562:*/
  16481. #line 12552 "./typica.w"
  16482. QSqlDatabase database=
  16483. QSqlDatabase::addDatabase(settings.value("database/driver").toString());
  16484. database.setConnectOptions("application_name=Typica");
  16485. database.setHostName(settings.value("database/hostname").toString());
  16486. database.setDatabaseName(settings.value("database/dbname").toString());
  16487. database.setUserName(settings.value("database/user").toString());
  16488. database.setPassword(settings.value("database/password").toString());
  16489. if(!database.open())
  16490. {
  16491. settings.setValue("database/exists","false");
  16492. }
  16493. else
  16494. {
  16495. database.close();
  16496. }
  16497. /*:562*/
  16498. #line 12433 "./typica.w"
  16499. }
  16500. if(settings.value("database/exists","false").toString()=="false")
  16501. {
  16502. /*561:*/
  16503. #line 12543 "./typica.w"
  16504. SqlConnectionSetup dialog;
  16505. dialog.exec();
  16506. /*:561*/
  16507. #line 12437 "./typica.w"
  16508. }
  16509. /*:557*/
  16510. #line 12378 "./typica.w"
  16511. /*148:*/
  16512. #line 3516 "./typica.w"
  16513. QStringList arguments= QCoreApplication::arguments();
  16514. int position= arguments.indexOf("-c");
  16515. QString filename= QString();
  16516. if(position!=-1)
  16517. {
  16518. if(arguments.size()>=position+1)
  16519. {
  16520. filename= arguments.at(position+1);
  16521. }
  16522. }
  16523. if(filename.isEmpty())
  16524. {
  16525. filename= QFileDialog::getOpenFileName(NULL,"Open Configuration File",
  16526. settings.value("config","").toString());
  16527. }
  16528. QDir directory;
  16529. if(!filename.isEmpty())
  16530. {
  16531. QFile file(filename);
  16532. QFileInfo info(filename);
  16533. directory= info.dir();
  16534. settings.setValue("config",directory.path());
  16535. if(file.open(QIODevice::ReadOnly))
  16536. {
  16537. app.configuration()->setContent(&file,true);
  16538. }
  16539. }
  16540. /*149:*/
  16541. #line 3550 "./typica.w"
  16542. QDomElement root= app.configuration()->documentElement();
  16543. QDomNodeList children= root.childNodes();
  16544. QString replacementDoc;
  16545. QDomDocument includedDoc;
  16546. QDomDocumentFragment fragment;
  16547. for(int i= 0;i<children.size();i++)
  16548. {
  16549. QDomNode currentNode= children.at(i);
  16550. QDomElement currentElement;
  16551. if(currentNode.nodeName()=="include")
  16552. {
  16553. currentElement= currentNode.toElement();
  16554. if(currentElement.hasAttribute("src"))
  16555. {
  16556. replacementDoc= directory.path();
  16557. replacementDoc.append('/');
  16558. replacementDoc.append(currentElement.attribute("src"));
  16559. QFile doc(replacementDoc);
  16560. if(doc.open(QIODevice::ReadOnly))
  16561. {
  16562. includedDoc.setContent(&doc,true);
  16563. fragment= includedDoc.createDocumentFragment();
  16564. fragment.appendChild(includedDoc.documentElement());
  16565. root.replaceChild(fragment,currentNode);
  16566. doc.close();
  16567. }
  16568. }
  16569. }
  16570. }
  16571. /*:149*/
  16572. #line 3544 "./typica.w"
  16573. /*:148*/
  16574. #line 12379 "./typica.w"
  16575. /*7:*/
  16576. #line 657 "./typica.w"
  16577. QScriptEngine*engine= new QScriptEngine;
  16578. QScriptValue constructor;
  16579. QScriptValue value;
  16580. /*:7*//*17:*/
  16581. #line 843 "./typica.w"
  16582. constructor= engine->newFunction(constructQWidget);
  16583. value= engine->newQMetaObject(&QWidget::staticMetaObject,constructor);
  16584. engine->globalObject().setProperty("QWidget",value);
  16585. /*:17*//*28:*/
  16586. #line 1089 "./typica.w"
  16587. constructor= engine->newFunction(constructQMainWindow);
  16588. value= engine->newQMetaObject(&ScriptQMainWindow::staticMetaObject,
  16589. constructor);
  16590. engine->globalObject().setProperty("QMainWindow",value);
  16591. /*:28*//*39:*/
  16592. #line 1294 "./typica.w"
  16593. constructor= engine->newFunction(constructQFrame);
  16594. value= engine->newQMetaObject(&QFrame::staticMetaObject,constructor);
  16595. engine->globalObject().setProperty("QFrame",value);
  16596. /*:39*//*42:*/
  16597. #line 1327 "./typica.w"
  16598. constructor= engine->newFunction(constructQLabel);
  16599. value= engine->newQMetaObject(&QLabel::staticMetaObject,constructor);
  16600. engine->globalObject().setProperty("QLabel",value);
  16601. /*:42*//*45:*/
  16602. #line 1365 "./typica.w"
  16603. constructor= engine->newFunction(constructQLineEdit);
  16604. value= engine->newQMetaObject(&QLineEdit::staticMetaObject,constructor);
  16605. engine->globalObject().setProperty("QLineEdit",value);
  16606. /*:45*//*49:*/
  16607. #line 1410 "./typica.w"
  16608. constructor= engine->newFunction(constructQSplitter);
  16609. value= engine->newQMetaObject(&QSplitter::staticMetaObject,constructor);
  16610. engine->globalObject().setProperty("QSplitter",value);
  16611. /*:49*//*56:*/
  16612. #line 1581 "./typica.w"
  16613. constructor= engine->newFunction(constructQBoxLayout);
  16614. value= engine->newQMetaObject(&QBoxLayout::staticMetaObject,constructor);
  16615. engine->globalObject().setProperty("QBoxLayout",value);
  16616. /*:56*//*60:*/
  16617. #line 1693 "./typica.w"
  16618. constructor= engine->newFunction(constructQAction);
  16619. value= engine->newQMetaObject(&QAction::staticMetaObject,constructor);
  16620. engine->globalObject().setProperty("QAction",value);
  16621. /*:60*//*63:*/
  16622. #line 1752 "./typica.w"
  16623. value= engine->newQMetaObject(&QFileDialog::staticMetaObject);
  16624. value.setProperty("getOpenFileName",
  16625. engine->newFunction(QFileDialog_getOpenFileName));
  16626. value.setProperty("getSaveFileName",
  16627. engine->newFunction(QFileDialog_getSaveFileName));
  16628. engine->globalObject().setProperty("QFileDialog",value);
  16629. /*:63*//*68:*/
  16630. #line 1864 "./typica.w"
  16631. constructor= engine->newFunction(constructQFile);
  16632. value= engine->newQMetaObject(&QFile::staticMetaObject,constructor);
  16633. engine->globalObject().setProperty("QFile",value);
  16634. /*:68*//*75:*/
  16635. #line 1981 "./typica.w"
  16636. constructor= engine->newFunction(constructQBuffer);
  16637. value= engine->newQMetaObject(&QBuffer::staticMetaObject,constructor);
  16638. engine->globalObject().setProperty("QBuffer",value);
  16639. /*:75*//*78:*/
  16640. #line 2030 "./typica.w"
  16641. constructor= engine->newFunction(constructXQuery);
  16642. engine->globalObject().setProperty("XQuery",constructor);
  16643. /*:78*//*84:*/
  16644. #line 2132 "./typica.w"
  16645. constructor= engine->newFunction(constructXmlWriter);
  16646. engine->globalObject().setProperty("XmlWriter",constructor);
  16647. /*:84*//*93:*/
  16648. #line 2338 "./typica.w"
  16649. constructor= engine->newFunction(constructXmlReader);
  16650. engine->globalObject().setProperty("XmlReader",constructor);
  16651. /*:93*//*100:*/
  16652. #line 2462 "./typica.w"
  16653. value= engine->newQObject(&settings);
  16654. setQSettingsProperties(value,engine);
  16655. engine->globalObject().setProperty("QSettings",value);
  16656. /*:100*//*104:*/
  16657. #line 2543 "./typica.w"
  16658. constructor= engine->newFunction(constructQLCDNumber);
  16659. value= engine->newQMetaObject(&QLCDNumber::staticMetaObject,constructor);
  16660. engine->globalObject().setProperty("QLCDNumber",value);
  16661. /*:104*//*107:*/
  16662. #line 2599 "./typica.w"
  16663. constructor= engine->newFunction(constructQTime);
  16664. engine->globalObject().setProperty("QTime",constructor);
  16665. /*:107*//*128:*/
  16666. #line 3103 "./typica.w"
  16667. constructor= engine->newFunction(constructQPushButton);
  16668. value= engine->newQMetaObject(&QPushButton::staticMetaObject,constructor);
  16669. engine->globalObject().setProperty("QPushButton",value);
  16670. /*:128*//*135:*/
  16671. #line 3214 "./typica.w"
  16672. constructor= engine->newFunction(constructQSqlQuery);
  16673. engine->globalObject().setProperty("QSqlQuery",constructor);
  16674. /*:135*//*142:*/
  16675. #line 3376 "./typica.w"
  16676. engine->globalObject().setProperty("baseName",engine->newFunction(baseName));
  16677. engine->globalObject().setProperty("dir",engine->newFunction(dir));
  16678. engine->globalObject().setProperty("sqlToArray",
  16679. engine->newFunction(sqlToArray));
  16680. engine->globalObject().setProperty("setFont",engine->newFunction(setFont));
  16681. engine->globalObject().setProperty("annotationFromRecord",
  16682. engine->newFunction(annotationFromRecord));
  16683. engine->globalObject().setProperty("setTabOrder",engine->newFunction(setTabOrder));
  16684. /*:142*//*153:*/
  16685. #line 3717 "./typica.w"
  16686. engine->globalObject().setProperty("createWindow",
  16687. engine->newFunction(createWindow));
  16688. engine->globalObject().setProperty("createReport",
  16689. engine->newFunction(createReport));
  16690. /*:153*//*206:*/
  16691. #line 5234 "./typica.w"
  16692. engine->globalObject().setProperty("findChildObject",
  16693. engine->newFunction(findChildObject));
  16694. /*:206*//*232:*/
  16695. #line 376 "./units.w"
  16696. value= engine->newQMetaObject(&Units::staticMetaObject);
  16697. value.setProperty("convertTemperature",engine->newFunction(Units_convertTemperature));
  16698. value.setProperty("convertRelativeTemperature",
  16699. engine->newFunction(Units_convertRelativeTemperature));
  16700. value.setProperty("isTemperatureUnit",engine->newFunction(Units_isTemperatureUnit));
  16701. value.setProperty("convertWeight",engine->newFunction(Units_convertWeight));
  16702. value.setProperty("isWeightUnit",engine->newFunction(Units_isWeightUnit));
  16703. engine->globalObject().setProperty("Units",value);
  16704. /*:232*//*237:*/
  16705. #line 449 "./units.w"
  16706. qScriptRegisterMetaType(engine,Unit_toScriptValue,Unit_fromScriptValue);
  16707. #line 5650 "./typica.w"
  16708. /*:237*//*259:*/
  16709. #line 6220 "./typica.w"
  16710. constructor= engine->newFunction(constructDAQ);
  16711. value= engine->newQMetaObject(&DAQ::staticMetaObject,constructor);
  16712. value.setProperty("Fahrenheit",Units::Fahrenheit);
  16713. value.setProperty("Celsius",Units::Celsius);
  16714. value.setProperty("Kelvin",Units::Kelvin);
  16715. value.setProperty("Rankine",Units::Rankine);
  16716. engine->globalObject().setProperty("DAQ",value);
  16717. /*:259*//*268:*/
  16718. #line 6422 "./typica.w"
  16719. constructor= engine->newFunction(constructFakeDAQ);
  16720. value= engine->newQMetaObject(&FakeDAQ::staticMetaObject,constructor);
  16721. engine->globalObject().setProperty("FakeDAQ",value);
  16722. /*:268*//*279:*/
  16723. #line 6705 "./typica.w"
  16724. constructor= engine->newFunction(constructLinearCalibrator);
  16725. value= engine->newQMetaObject(&LinearCalibrator::staticMetaObject,
  16726. constructor);
  16727. engine->globalObject().setProperty("LinearCalibrator",value);
  16728. /*:279*//*284:*/
  16729. #line 6844 "./typica.w"
  16730. constructor= engine->newFunction(constructLinearSplineInterpolator);
  16731. value= engine->newQMetaObject(&LinearSplineInterpolator::staticMetaObject,constructor);
  16732. engine->globalObject().setProperty("LinearSplineInterpolator",value);
  16733. /*:284*//*294:*/
  16734. #line 7049 "./typica.w"
  16735. constructor= engine->newFunction(constructTemperatureDisplay);
  16736. value= engine->newQMetaObject(&TemperatureDisplay::staticMetaObject,
  16737. constructor);
  16738. engine->globalObject().setProperty("TemperatureDisplay",value);
  16739. /*:294*//*302:*/
  16740. #line 7207 "./typica.w"
  16741. constructor= engine->newFunction(constructMeasurementTimeOffset);
  16742. value= engine->newQMetaObject(&MeasurementTimeOffset::staticMetaObject,
  16743. constructor);
  16744. engine->globalObject().setProperty("MeasurementTimeOffset",value);
  16745. /*:302*//*307:*/
  16746. #line 7318 "./typica.w"
  16747. constructor= engine->newFunction(constructThresholdDetector);
  16748. value= engine->newQMetaObject(&ThresholdDetector::staticMetaObject,constructor);
  16749. engine->globalObject().setProperty("ThresholdDetector",value);
  16750. /*:307*//*312:*/
  16751. #line 7417 "./typica.w"
  16752. constructor= engine->newFunction(constructZeroEmitter);
  16753. value= engine->newQMetaObject(&ZeroEmitter::staticMetaObject,constructor);
  16754. engine->globalObject().setProperty("ZeroEmitter",value);
  16755. /*:312*//*317:*/
  16756. #line 7496 "./typica.w"
  16757. constructor= engine->newFunction(constructMeasurementAdapter);
  16758. value= engine->newQMetaObject(&MeasurementAdapter::staticMetaObject,
  16759. constructor);
  16760. engine->globalObject().setProperty("MeasurementAdapter",value);
  16761. /*:317*//*334:*/
  16762. #line 7959 "./typica.w"
  16763. constructor= engine->newFunction(constructGraphView);
  16764. value= engine->newQMetaObject(&GraphView::staticMetaObject,constructor);
  16765. engine->globalObject().setProperty("GraphView",value);
  16766. /*:334*//*357:*/
  16767. #line 8596 "./typica.w"
  16768. constructor= engine->newFunction(constructZoomLog);
  16769. value= engine->newQMetaObject(&ZoomLog::staticMetaObject,constructor);
  16770. engine->globalObject().setProperty("ZoomLog",value);
  16771. /*:357*//*395:*/
  16772. #line 9544 "./typica.w"
  16773. constructor= engine->newFunction(constructAnnotationButton);
  16774. value= engine->newQMetaObject(&AnnotationButton::staticMetaObject,
  16775. constructor);
  16776. engine->globalObject().setProperty("AnnotationButton",value);
  16777. /*:395*//*403:*/
  16778. #line 9686 "./typica.w"
  16779. constructor= engine->newFunction(constructAnnotationSpinBox);
  16780. value= engine->newQMetaObject(&AnnotationSpinBox::staticMetaObject,
  16781. constructor);
  16782. engine->globalObject().setProperty("AnnotationSpinBox",value);
  16783. /*:403*//*424:*/
  16784. #line 10107 "./typica.w"
  16785. constructor= engine->newFunction(constructTimerDisplay);
  16786. value= engine->newQMetaObject(&TimerDisplay::staticMetaObject,constructor);
  16787. engine->globalObject().setProperty("TimerDisplay",value);
  16788. /*:424*//*451:*/
  16789. #line 10601 "./typica.w"
  16790. constructor= engine->newFunction(constructWidgetDecorator);
  16791. value= engine->newQMetaObject(&WidgetDecorator::staticMetaObject,constructor);
  16792. engine->globalObject().setProperty("WidgetDecorator",value);
  16793. /*:451*//*464:*/
  16794. #line 10883 "./typica.w"
  16795. constructor= engine->newFunction(constructLogEditWindow);
  16796. value= engine->newQMetaObject(&LogEditWindow::staticMetaObject,constructor);
  16797. engine->globalObject().setProperty("LogEditWindow",value);
  16798. /*:464*//*483:*/
  16799. #line 11411 "./typica.w"
  16800. constructor= engine->newFunction(constructXMLInput);
  16801. value= engine->newQMetaObject(&XMLInput::staticMetaObject,constructor);
  16802. engine->globalObject().setProperty("XMLInput",value);
  16803. /*:483*//*497:*/
  16804. #line 146 "./webview.w"
  16805. constructor= engine->newFunction(constructWebView);
  16806. value= engine->newQMetaObject(&TypicaWebView::staticMetaObject,constructor);
  16807. engine->globalObject().setProperty("WebView",value);
  16808. /*:497*//*505:*/
  16809. #line 238 "./webview.w"
  16810. qScriptRegisterMetaType(engine,QWebElement_toScriptValue,QWebElement_fromScriptValue);
  16811. /*:505*//*508:*/
  16812. #line 280 "./webview.w"
  16813. constructor= engine->newFunction(constructWebElement);
  16814. engine->globalObject().setProperty("WebElement",constructor);
  16815. /*:508*//*519:*/
  16816. #line 11654 "./typica.w"
  16817. value= engine->newQObject(AppInstance);
  16818. engine->globalObject().setProperty("Application",value);
  16819. /*:519*//*574:*/
  16820. #line 12729 "./typica.w"
  16821. constructor= engine->newFunction(constructSqlQueryView);
  16822. value= engine->newQMetaObject(&SqlQueryView::staticMetaObject,constructor);
  16823. engine->globalObject().setProperty("SqlQueryView",value);
  16824. /*:574*//*658:*/
  16825. #line 14629 "./typica.w"
  16826. constructor= engine->newFunction(constructDeviceTreeModel);
  16827. value= engine->newQMetaObject(&DeviceTreeModel::staticMetaObject,
  16828. constructor);
  16829. engine->globalObject().setProperty("DeviceTreeModel",value);
  16830. /*:658*//*664:*/
  16831. #line 14769 "./typica.w"
  16832. qScriptRegisterMetaType(engine,QModelIndex_toScriptValue,QModelIndex_fromScriptValue);
  16833. /*:664*//*680:*/
  16834. #line 15060 "./typica.w"
  16835. constructor= engine->newFunction(constructDeviceConfigurationWindow);
  16836. value= engine->newQMetaObject(&DeviceConfigurationWindow::staticMetaObject,
  16837. constructor);
  16838. engine->globalObject().setProperty("DeviceConfigurationWindow",value);
  16839. /*:680*//*751:*/
  16840. #line 54 "./settings.w"
  16841. constructor= engine->newFunction(constructSettingsWindow);
  16842. value= engine->newQMetaObject(&DeviceConfigurationWindow::staticMetaObject,constructor);
  16843. engine->globalObject().setProperty("SettingsWindow",value);
  16844. #line 1 "./graphsettings.w"
  16845. /*:751*//*769:*/
  16846. #line 17590 "./typica.w"
  16847. constructor= engine->newFunction(constructModbusRTUDevice);
  16848. value= engine->newQMetaObject(&ModbusRTUDevice::staticMetaObject,constructor);
  16849. engine->globalObject().setProperty("ModbusRTUDevice",value);
  16850. /*:769*//*793:*/
  16851. #line 163 "./rate.w"
  16852. constructor= engine->newFunction(constructRateOfChange);
  16853. value= engine->newQMetaObject(&RateOfChange::staticMetaObject,constructor);
  16854. engine->globalObject().setProperty("RateOfChange",value);
  16855. /*:793*//*818:*/
  16856. #line 604 "./dataqsdk.w"
  16857. constructor= engine->newFunction(constructDataqSdkDevice);
  16858. value= engine->newQMetaObject(&DataqSdkDevice::staticMetaObject,constructor);
  16859. engine->globalObject().setProperty("DataqSdkDevice",value);
  16860. /*:818*//*845:*/
  16861. #line 73 "./scales.w"
  16862. constructor= engine->newFunction(constructDragLabel);
  16863. value= engine->newQMetaObject(&DragLabel::staticMetaObject,constructor);
  16864. engine->globalObject().setProperty("DragLabel",value);
  16865. /*:845*//*853:*/
  16866. #line 239 "./scales.w"
  16867. constructor= engine->newFunction(constructSerialScale);
  16868. value= engine->newQMetaObject(&SerialScale::staticMetaObject,constructor);
  16869. engine->globalObject().setProperty("SerialScale",value);
  16870. /*:853*//*857:*/
  16871. #line 325 "./scales.w"
  16872. qScriptRegisterMetaType(engine,BaudRateType_toScriptValue,BaudRateType_fromScriptValue);
  16873. qScriptRegisterMetaType(engine,DataBitsType_toScriptValue,DataBitsType_fromScriptValue);
  16874. qScriptRegisterMetaType(engine,ParityType_toScriptValue,ParityType_fromScriptValue);
  16875. qScriptRegisterMetaType(engine,StopBitsType_toScriptValue,StopBitsType_fromScriptValue);
  16876. qScriptRegisterMetaType(engine,FlowType_toScriptValue,FlowType_fromScriptValue);
  16877. /*:857*//*881:*/
  16878. #line 271 "./valueannotation.w"
  16879. constructor= engine->newFunction(constructValueAnnotation);
  16880. value= engine->newQMetaObject(&ValueAnnotation::staticMetaObject,constructor);
  16881. engine->globalObject().setProperty("ValueAnnotation",value);
  16882. /*:881*/
  16883. #line 12380 "./typica.w"
  16884. app.engine= engine;
  16885. /*150:*/
  16886. #line 3598 "./typica.w"
  16887. QString styleText;
  16888. QString programText;
  16889. QDomElement currentElement;
  16890. for(int i= 0;i<children.size();i++)
  16891. {
  16892. QDomNode currentNode= children.at(i);
  16893. if(currentNode.nodeName()=="style")
  16894. {
  16895. currentElement= currentNode.toElement();
  16896. styleText.append(currentElement.text());
  16897. }
  16898. else if(currentNode.nodeName()=="program")
  16899. {
  16900. currentElement= currentNode.toElement();
  16901. programText.append(currentElement.text());
  16902. }
  16903. }
  16904. app.setStyleSheet(styleText);
  16905. QScriptValue result= engine->evaluate(programText);
  16906. /*151:*/
  16907. #line 3623 "./typica.w"
  16908. if(engine->hasUncaughtException())
  16909. {
  16910. int line= engine->uncaughtExceptionLineNumber();
  16911. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  16912. result.toString();
  16913. QString trace;
  16914. foreach(trace,engine->uncaughtExceptionBacktrace())
  16915. {
  16916. qDebug()<<trace;
  16917. }
  16918. }
  16919. /*:151*/
  16920. #line 3618 "./typica.w"
  16921. /*:150*/
  16922. #line 12382 "./typica.w"
  16923. int retval= app.exec();
  16924. delete engine;
  16925. return retval;
  16926. }
  16927. /*:554*/
  16928. #line 530 "./typica.w"
  16929. #include "moc_typica.cpp"
  16930. /*:3*/