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

typica.cpp 440KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526
  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 5654 "./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 11583 "./typica.w"
  29. /*:514*//*622:*/
  30. #line 477 "./daterangeselector.w"
  31. #include "daterangeselector.h"
  32. #line 13273 "./typica.w"
  33. /*:622*//*730:*/
  34. #line 15773 "./typica.w"
  35. #include "qextserialport.h"
  36. #include "qextserialenumerator.h"
  37. /*:730*//*825:*/
  38. #line 124 "./dataqsdk.w"
  39. #ifdef Q_OS_WIN32
  40. #include <windef.h>
  41. #else
  42. #define PASCAL
  43. #endif
  44. /*:825*//*849:*/
  45. #line 862 "./dataqsdk.w"
  46. #include <limits>
  47. /*:849*//*864:*/
  48. #line 62 "./scales.w"
  49. #include "draglabel.h"
  50. /*:864*//*879:*/
  51. #line 335 "./scales.w"
  52. #include "scale.h"
  53. /*:879*/
  54. #line 525 "./typica.w"
  55. /*20:*/
  56. #line 933 "./typica.w"
  57. class ScriptQMainWindow:public QMainWindow
  58. {
  59. Q_OBJECT
  60. Q_PROPERTY(QString closePrompt READ closePrompt WRITE setClosePrompt)
  61. public:
  62. ScriptQMainWindow();
  63. QString closePrompt();
  64. public slots:
  65. void show();
  66. void saveSizeAndPosition(const QString&key);
  67. void restoreSizeAndPosition(const QString&key);
  68. void displayStatus(const QString&message= QString());
  69. void setClosePrompt(QString prompt);
  70. protected:
  71. void closeEvent(QCloseEvent*event);
  72. void showEvent(QShowEvent*event);
  73. signals:
  74. void aboutToClose(void);
  75. private:
  76. QString cprompt;
  77. };
  78. /*:20*//*130:*/
  79. #line 3140 "./typica.w"
  80. class SqlQueryConnection:public QSqlQuery
  81. {
  82. public:
  83. SqlQueryConnection(const QString&query= QString());
  84. ~SqlQueryConnection();
  85. QSqlQuery*operator->()const;
  86. private:
  87. QString connection;
  88. QSqlQuery*q;
  89. };
  90. /*:130*//*192:*/
  91. #line 4962 "./typica.w"
  92. class NumericDelegate:public QItemDelegate
  93. {
  94. Q_OBJECT
  95. public:
  96. NumericDelegate(QObject*parent= NULL);
  97. QWidget*createEditor(QWidget*parent,
  98. const QStyleOptionViewItem&option,
  99. const QModelIndex&index)const;
  100. void setEditorData(QWidget*editor,const QModelIndex&index)const;
  101. void setModelData(QWidget*editor,QAbstractItemModel*model,
  102. const QModelIndex&index)const;
  103. void updateEditorGeometry(QWidget*editor,
  104. const QStyleOptionViewItem&option,
  105. const QModelIndex&index)const;
  106. };
  107. /*:192*//*234:*/
  108. #line 425 "./units.w"
  109. Q_DECLARE_METATYPE(Units::Unit)
  110. /*:234*//*239:*/
  111. #line 19 "./measurement.w"
  112. class Measurement:public QVariantMap
  113. {
  114. public:
  115. Measurement(double temperature= 0,QTime time= QTime(),
  116. Units::Unit sc= Units::Fahrenheit);
  117. Measurement(double temperature);
  118. double temperature()const;
  119. QTime time()const;
  120. void setTemperature(double temperature);
  121. void setTime(QTime time);
  122. void setUnit(Units::Unit scale);
  123. Units::Unit scale()const;
  124. Measurement toFahrenheit();
  125. Measurement toCelsius();
  126. Measurement toKelvin();
  127. Measurement toRankine();
  128. };
  129. /*:239*//*244:*/
  130. #line 5718 "./typica.w"
  131. class Channel;
  132. class DAQImplementation;
  133. class DAQ:public QObject
  134. {
  135. Q_OBJECT
  136. Q_ENUMS(ThermocoupleType)
  137. DAQImplementation*imp;
  138. private slots:
  139. void threadFinished();
  140. public:
  141. DAQ(QString device,const QString&driver= QString("nidaqmxbase"));
  142. ~DAQ();
  143. Channel*newChannel(int units,int thermocouple);
  144. Q_INVOKABLE void setClockRate(double Hz);
  145. Q_INVOKABLE void start();
  146. Q_INVOKABLE void stop();
  147. enum ThermocoupleType
  148. {
  149. TypeJ= 10072,
  150. TypeK= 10073,
  151. TypeN= 10077,
  152. TypeR= 10082,
  153. TypeS= 10085,
  154. TypeT= 10086,
  155. TypeB= 10047,
  156. TypeE= 10055
  157. };
  158. };
  159. /*:244*//*245:*/
  160. #line 5756 "./typica.w"
  161. class DAQImplementation:public QThread
  162. {
  163. Q_OBJECT
  164. public:
  165. DAQImplementation(const QString&driverinfo);
  166. ~DAQImplementation();
  167. void run();
  168. void measure();
  169. /*246:*/
  170. #line 5776 "./typica.w"
  171. typedef int(*daqfp)(...);
  172. daqfp read;
  173. daqfp errorInfo;
  174. daqfp startTask;
  175. daqfp createTask;
  176. daqfp createChannel;
  177. daqfp setClock;
  178. daqfp stopTask;
  179. daqfp clearTask;
  180. daqfp resetDevice;
  181. daqfp waitForMeasurement;
  182. /*:246*/
  183. #line 5765 "./typica.w"
  184. /*247:*/
  185. #line 5792 "./typica.w"
  186. bool useBase;
  187. QString device;
  188. QVector<Channel*> channelMap;
  189. unsigned int handle;
  190. int error;
  191. int channels;
  192. bool ready;
  193. QLibrary driver;
  194. QVector<Units::Unit> unitMap;
  195. /*:247*/
  196. #line 5766 "./typica.w"
  197. };
  198. /*:245*//*263:*/
  199. #line 6296 "./typica.w"
  200. class FakeDAQImplementation:public QThread
  201. {
  202. Q_OBJECT
  203. public:
  204. FakeDAQImplementation();
  205. ~FakeDAQImplementation();
  206. void run();
  207. void measure();
  208. QVector<Channel*> channelMap;
  209. int channels;
  210. bool ready;
  211. double clockRate;
  212. };
  213. class FakeDAQ:public QObject
  214. {
  215. Q_OBJECT
  216. FakeDAQImplementation*imp;
  217. public:
  218. FakeDAQ(QString device);
  219. ~FakeDAQ();
  220. Channel*newChannel(int units,int thermocouple);
  221. Q_INVOKABLE void setClockRate(double Hz);
  222. Q_INVOKABLE void start();
  223. };
  224. /*:263*//*270:*/
  225. #line 6483 "./typica.w"
  226. class Channel:public QObject
  227. {
  228. Q_OBJECT
  229. public:
  230. Channel();
  231. ~Channel();
  232. public slots:
  233. void input(Measurement measurement);
  234. signals:
  235. void newData(Measurement);
  236. };
  237. /*:270*//*274:*/
  238. #line 6550 "./typica.w"
  239. class LinearCalibrator:public QObject
  240. {
  241. Q_OBJECT
  242. Q_PROPERTY(double measuredLower READ measuredLower
  243. WRITE setMeasuredLower)
  244. Q_PROPERTY(double measuredUpper READ measuredUpper
  245. WRITE setMeasuredUpper)
  246. Q_PROPERTY(double mappedLower READ mappedLower WRITE setMappedLower)
  247. Q_PROPERTY(double mappedUpper READ mappedUpper WRITE setMappedUpper)
  248. Q_PROPERTY(bool closedRange READ isClosedRange WRITE setClosedRange)
  249. Q_PROPERTY(double sensitivity READ sensitivity WRITE setSensitivity)
  250. public:
  251. LinearCalibrator(QObject*parent= NULL);
  252. double measuredLower();
  253. double measuredUpper();
  254. double mappedLower();
  255. double mappedUpper();
  256. bool isClosedRange();
  257. double sensitivity();
  258. public slots:
  259. void setMeasuredLower(double lower);
  260. void setMeasuredUpper(double upper);
  261. void setMappedLower(double lower);
  262. void setMappedUpper(double upper);
  263. void setClosedRange(bool closed);
  264. void setSensitivity(double sensitivity);
  265. Measurement newMeasurement(Measurement measure);
  266. signals:
  267. void measurement(Measurement measure);
  268. void newData(Measurement measure);
  269. private:
  270. double Lo1;
  271. double Lo2;
  272. double Up1;
  273. double Up2;
  274. double sensitivitySetting;
  275. bool clamp;
  276. };
  277. /*:274*//*281:*/
  278. #line 6746 "./typica.w"
  279. class LinearSplineInterpolator:public QObject
  280. {
  281. Q_OBJECT
  282. public:
  283. LinearSplineInterpolator(QObject*parent= NULL);
  284. Q_INVOKABLE void add_pair(double source,double destination);
  285. public slots:
  286. Measurement newMeasurement(Measurement measure);
  287. signals:
  288. void newData(Measurement measure);
  289. private:
  290. void make_interpolators();
  291. QMap<double,double> *pairs;
  292. QList<LinearCalibrator*> *interpolators;
  293. };
  294. /*:281*//*286:*/
  295. #line 6882 "./typica.w"
  296. class TemperatureDisplay:public QLCDNumber
  297. {
  298. Q_OBJECT
  299. int unit;
  300. bool r;
  301. public:
  302. TemperatureDisplay(QWidget*parent= NULL);
  303. ~TemperatureDisplay();
  304. public slots:
  305. void setValue(Measurement temperature);
  306. void invalidate();
  307. void setDisplayUnits(Units::Unit scale);
  308. void setRelativeMode(bool relative);
  309. };
  310. /*:286*//*297:*/
  311. #line 7098 "./typica.w"
  312. class MeasurementTimeOffset:public QObject
  313. {
  314. Q_OBJECT
  315. QTime epoch;
  316. QTime previous;
  317. bool hasPrevious;
  318. public:
  319. MeasurementTimeOffset(QTime zero);
  320. QTime zeroTime();
  321. public slots:
  322. void newMeasurement(Measurement measure);
  323. void setZeroTime(QTime zero);
  324. signals:
  325. void measurement(Measurement measure);
  326. };
  327. /*:297*//*304:*/
  328. #line 7250 "./typica.w"
  329. class ThresholdDetector:public QObject
  330. {
  331. Q_OBJECT
  332. Q_ENUMS(EdgeDirection)
  333. public:
  334. enum EdgeDirection{
  335. Ascending,Descending
  336. };
  337. ThresholdDetector(double value);
  338. public slots:
  339. void newMeasurement(Measurement measure);
  340. void setThreshold(double value);
  341. void setEdgeDirection(EdgeDirection direction);
  342. signals:
  343. void timeForValue(double);
  344. private:
  345. double previousValue;
  346. double threshold;
  347. EdgeDirection currentDirection;
  348. };
  349. /*:304*//*309:*/
  350. #line 7356 "./typica.w"
  351. class ZeroEmitter:public QObject
  352. {
  353. Q_OBJECT
  354. Q_PROPERTY(int column READ column WRITE setColumn)
  355. Measurement cache;
  356. int col;
  357. public:
  358. ZeroEmitter(int tempcolumn= 1);
  359. int column();
  360. double lastTemperature();
  361. public slots:
  362. void newMeasurement(Measurement measure);
  363. void setColumn(int column);
  364. void emitZero();
  365. signals:
  366. void measurement(Measurement measure,int tempcolumn);
  367. };
  368. /*:309*//*314:*/
  369. #line 7450 "./typica.w"
  370. class MeasurementAdapter:public QObject
  371. {
  372. Q_OBJECT
  373. int col;
  374. public:
  375. MeasurementAdapter(int tempcolumn);
  376. int column();
  377. public slots:
  378. void newMeasurement(Measurement measure);
  379. void setColumn(int column);
  380. signals:
  381. void measurement(Measurement measure,int tempcolumn);
  382. };
  383. /*:314*//*319:*/
  384. #line 7539 "./typica.w"
  385. class GraphView:public QGraphicsView
  386. {
  387. Q_OBJECT
  388. QGraphicsScene*theScene;
  389. QMap<int,QList<QGraphicsLineItem*> *> *graphLines;
  390. QMap<int,QPointF> *prevPoints;
  391. QMap<int,double> *translations;
  392. QList<QGraphicsItem*> *gridLinesF;
  393. QList<QGraphicsItem*> *gridLinesC;
  394. QList<QGraphicsItem*> *relativeGridLines;
  395. bool relativeEnabled;
  396. bool timeIndicatorEnabled;
  397. QGraphicsLineItem*timeLine;
  398. LinearSplineInterpolator*relativeAdjuster;
  399. public:
  400. GraphView(QWidget*parent= NULL);
  401. void removeSeries(int column);
  402. protected:
  403. void resizeEvent(QResizeEvent*event);
  404. public slots:
  405. void newMeasurement(Measurement measure,int tempcolumn);
  406. void setSeriesTranslation(int column,double offset);
  407. void setTimeIndicatorEnabled(bool enabled);
  408. void clear();
  409. void showF();
  410. void showC();
  411. };
  412. /*:319*//*336:*/
  413. #line 8004 "./typica.w"
  414. class MeasurementModel;
  415. class ZoomLog:public QTableView
  416. {
  417. Q_OBJECT
  418. /*337:*/
  419. #line 8053 "./typica.w"
  420. MeasurementModel*model_ms;
  421. MeasurementModel*model_1s;
  422. MeasurementModel*model_5s;
  423. MeasurementModel*model_10s;
  424. MeasurementModel*model_15s;
  425. MeasurementModel*model_30s;
  426. MeasurementModel*model_1m;
  427. QList<MeasurementModel*> modelSet;
  428. QHash<int,Measurement> lastMeasurement;
  429. MeasurementModel*currentModel;
  430. QList<int> saveTempCols;
  431. QList<int> saveControlCols;
  432. QList<int> saveNoteCols;
  433. QList<int> currentColumnSet;
  434. /*:337*/
  435. #line 8009 "./typica.w"
  436. void switchLOD(MeasurementModel*m);
  437. private slots:
  438. void centerOn(int row);
  439. void persistColumnResize(int column,int oldsize,int newsize);
  440. void restoreColumnWidths();
  441. public:
  442. ZoomLog();
  443. QVariant data(int row,int column)const;
  444. int rowCount();
  445. bool saveXML(QIODevice*device);
  446. bool saveCSV(QIODevice*device);
  447. QString lastTime(int series);
  448. Q_INVOKABLE Units::Unit displayUnits();
  449. public slots:
  450. void setVisible(bool visibility);
  451. void setHeaderData(int section,QString text);
  452. void LOD_ms();
  453. void LOD_1s();
  454. void LOD_5s();
  455. void LOD_10s();
  456. void LOD_15s();
  457. void LOD_30s();
  458. void LOD_1m();
  459. void newMeasurement(Measurement measure,int tempcolumn);
  460. void newAnnotation(QString annotation,int tempcolumn,
  461. int annotationcolumn);
  462. void clear();
  463. void addOutputTemperatureColumn(int column);
  464. void addOutputControlColumn(int column);
  465. void addOutputAnnotationColumn(int column);
  466. void clearOutputColumns();
  467. void setDisplayUnits(Units::Unit scale);
  468. void addToCurrentColumnSet(int column);
  469. void clearCurrentColumnSet();
  470. protected:
  471. virtual void showEvent(QShowEvent*event);
  472. };
  473. /*:336*//*362:*/
  474. #line 8749 "./typica.w"
  475. class MeasurementList;
  476. class MeasurementModel:public QAbstractItemModel
  477. {
  478. Q_OBJECT
  479. Units::Unit unit;
  480. QList<MeasurementList*> *entries;
  481. QStringList*hData;
  482. int colcount;
  483. QHash<int,int> *lastTemperature;
  484. QList<MeasurementList*> ::iterator lastInsertion;
  485. QHash<int,bool> *controlColumns;
  486. public:
  487. MeasurementModel(QObject*parent= NULL);
  488. ~MeasurementModel();
  489. int rowCount(const QModelIndex&parent= QModelIndex())const;
  490. int columnCount(const QModelIndex&parent= QModelIndex())const;
  491. bool setHeaderData(int section,Qt::Orientation orientation,
  492. const QVariant&value,int role= Qt::DisplayRole);
  493. QVariant data(const QModelIndex&index,int role)const;
  494. bool setData(const QModelIndex&index,const QVariant&value,
  495. int role= Qt::EditRole);
  496. Qt::ItemFlags flags(const QModelIndex&index)const;
  497. QVariant headerData(int section,Qt::Orientation orientation,
  498. int role= Qt::DisplayRole)const;
  499. QModelIndex index(int row,int column,
  500. const QModelIndex&parent= QModelIndex())const;
  501. QModelIndex parent(const QModelIndex&index)const;
  502. Units::Unit displayUnits();
  503. public slots:
  504. void newMeasurement(Measurement measure,int tempcolumn);
  505. void newAnnotation(QString annotation,int tempcolumn,
  506. int annotationColumn);
  507. void clear();
  508. void setDisplayUnits(Units::Unit scale);
  509. signals:
  510. void rowChanged(int);
  511. };
  512. /*:362*//*363:*/
  513. #line 8793 "./typica.w"
  514. class MeasurementList:public QVariantList
  515. {
  516. public:
  517. bool operator<(const MeasurementList&other)const;
  518. bool operator==(const MeasurementList&other)const;
  519. };
  520. /*:363*//*389:*/
  521. #line 9451 "./typica.w"
  522. class AnnotationButton:public QPushButton
  523. {
  524. Q_OBJECT
  525. QString note;
  526. int tc;
  527. int ac;
  528. int count;
  529. public:
  530. AnnotationButton(const QString&text,QWidget*parent= NULL);
  531. public slots:
  532. void setAnnotation(const QString&annotation);
  533. void setTemperatureColumn(int tempcolumn);
  534. void setAnnotationColumn(int annotationcolumn);
  535. void annotate();
  536. void resetCount();
  537. signals:
  538. void annotation(QString annotation,int tempcolumn,
  539. int notecolumn);
  540. };
  541. /*:389*//*397:*/
  542. #line 9576 "./typica.w"
  543. class AnnotationSpinBox:public QDoubleSpinBox
  544. {
  545. Q_OBJECT
  546. QString pretext;
  547. QString posttext;
  548. int tc;
  549. int ac;
  550. bool change;
  551. public:
  552. AnnotationSpinBox(const QString&pret,const QString&postt,
  553. QWidget*parent= NULL);
  554. public slots:
  555. void setPretext(const QString&pret);
  556. void setPosttext(const QString&postt);
  557. void setTemperatureColumn(int tempcolumn);
  558. void setAnnotationColumn(int annotationcolumn);
  559. void annotate();
  560. void resetChange();
  561. signals:
  562. void annotation(QString annotation,int tempcolumn,
  563. int notecolumn);
  564. };
  565. /*:397*//*405:*/
  566. #line 9735 "./typica.w"
  567. class TimerDisplay:public QLCDNumber
  568. {
  569. Q_OBJECT
  570. /*406:*/
  571. #line 9785 "./typica.w"
  572. Q_PROPERTY(QTime seconds READ seconds WRITE setTimer)
  573. Q_PROPERTY(TimerMode mode READ mode WRITE setMode)
  574. Q_PROPERTY(bool running READ isRunning)
  575. Q_PROPERTY(QTime resetValue READ resetValue WRITE setResetValue)
  576. Q_PROPERTY(QString displayFormat READ displayFormat WRITE setDisplayFormat)
  577. Q_PROPERTY(bool autoReset READ autoReset WRITE setAutoReset)
  578. /*:406*/
  579. #line 9739 "./typica.w"
  580. private slots:
  581. void updateTime();
  582. void setCountUpMode();
  583. void setCountDownMode();
  584. void setClockMode();
  585. public:
  586. TimerDisplay(QWidget*parent= NULL);
  587. ~TimerDisplay();
  588. enum TimerMode
  589. {
  590. CountUp,
  591. CountDown,
  592. Clock
  593. };
  594. QString value();
  595. QTime seconds();
  596. TimerMode mode();
  597. bool isRunning();
  598. QTime resetValue();
  599. QString displayFormat();
  600. bool autoReset();
  601. public slots:
  602. void setTimer(QTime value= QTime(0,0,0));
  603. void setMode(TimerMode mode);
  604. void startTimer();
  605. void stopTimer();
  606. void copyTimer();
  607. void setResetValue(QTime value= QTime(0,0,0));
  608. void reset();
  609. void setDisplayFormat(QString format);
  610. void setAutoReset(bool reset);
  611. void updateDisplay();
  612. signals:
  613. void valueChanged(QTime);
  614. void runStateChanged(bool);
  615. private:
  616. /*407:*/
  617. #line 9795 "./typica.w"
  618. QTime s;
  619. QTime r;
  620. QTimer clock;
  621. TimerDisplay::TimerMode m;
  622. bool running;
  623. bool ar;
  624. QAction*startAction;
  625. QAction*stopAction;
  626. QAction*resetAction;
  627. QString f;
  628. QTime relative;
  629. QTime base;
  630. /*:407*/
  631. #line 9776 "./typica.w"
  632. };
  633. /*:405*//*427:*/
  634. #line 10154 "./typica.w"
  635. class PackLayout:public QLayout
  636. {
  637. int doLayout(const QRect&rect,bool testOnly)const;
  638. QList<QLayoutItem*> itemList;
  639. Qt::Orientations orientation;
  640. public:
  641. PackLayout(QWidget*parent,int margin= 0,int spacing= -1);
  642. PackLayout(int spacing= -1);
  643. ~PackLayout();
  644. void addItem(QLayoutItem*item);
  645. Qt::Orientations expandingDirections()const;
  646. bool hasHeightForWidth()const;
  647. int heightForWidth(int width)const;
  648. int count()const;
  649. QLayoutItem*itemAt(int index)const;
  650. QSize minimumSize()const;
  651. void setGeometry(const QRect&rect);
  652. void setOrientation(Qt::Orientations direction);
  653. QSize sizeHint()const;
  654. QLayoutItem*takeAt(int index);
  655. };
  656. /*:427*//*440:*/
  657. #line 10432 "./typica.w"
  658. class SceneButton:public QGraphicsScene
  659. {
  660. Q_OBJECT
  661. public:
  662. SceneButton();
  663. ~SceneButton();
  664. protected:
  665. void mousePressEvent(QGraphicsSceneMouseEvent*mouseEvent);
  666. signals:
  667. void clicked(QPoint pos);
  668. };
  669. /*:440*//*442:*/
  670. #line 10474 "./typica.w"
  671. class WidgetDecorator:public QWidget
  672. {
  673. Q_OBJECT
  674. PackLayout*layout;
  675. QGraphicsView*label;
  676. QGraphicsTextItem*text;
  677. SceneButton*scene;
  678. public:
  679. WidgetDecorator(QWidget*widget,const QString&labeltext,
  680. Qt::Orientations orientation= Qt::Horizontal,
  681. QWidget*parent= NULL,Qt::WindowFlags f= 0);
  682. ~WidgetDecorator();
  683. void setBackgroundBrush(QBrush background);
  684. void setTextColor(QColor color);
  685. };
  686. /*:442*//*453:*/
  687. #line 10649 "./typica.w"
  688. class LogEditWindow:public QMainWindow
  689. {
  690. Q_OBJECT
  691. QWidget*centralWidget;
  692. PackLayout*mainLayout;
  693. QHBoxLayout*addRowsLayout;
  694. QLabel*startTimeLabel;
  695. QTimeEdit*startTime;
  696. QLabel*endTimeLabel;
  697. QTimeEdit*endTime;
  698. QLabel*intervalLabel;
  699. QSpinBox*interval;
  700. QPushButton*addRows;
  701. QAction*saveXml;
  702. QAction*saveCsv;
  703. QAction*openXml;
  704. MeasurementModel*model;
  705. QTableView*log;
  706. private slots:
  707. void addTheRows();
  708. void saveXML();
  709. void saveCSV();
  710. void openXML();
  711. protected:
  712. void closeEvent(QCloseEvent*event);
  713. public:
  714. LogEditWindow();
  715. };
  716. /*:453*//*467:*/
  717. #line 10957 "./typica.w"
  718. class XMLOutput:public QObject
  719. {
  720. Q_OBJECT
  721. MeasurementModel*data;
  722. QIODevice*out;
  723. int time;
  724. QMap<int,QString> temperatureColumns;
  725. QMap<int,QString> controlColumns;
  726. QMap<int,QString> annotationColumns;
  727. public:
  728. XMLOutput(MeasurementModel*model,QIODevice*device,int timec= 0);
  729. void addTemperatureColumn(const QString&series,int column);
  730. void addControlColumn(const QString&series,int column);
  731. void addAnnotationColumn(const QString&series,int column);
  732. void setModel(MeasurementModel*model);
  733. void setTimeColumn(int column);
  734. void setDevice(QIODevice*device);
  735. bool output();
  736. };
  737. /*:467*//*474:*/
  738. #line 11193 "./typica.w"
  739. class XMLInput:public QObject
  740. {
  741. Q_OBJECT
  742. int firstc;
  743. QIODevice*in;
  744. public:
  745. XMLInput(QIODevice*input,int c);
  746. void setFirstColumn(int column);
  747. void setDevice(QIODevice*device);
  748. bool input();
  749. signals:
  750. void measure(Measurement,int);
  751. void annotation(QString,int,int);
  752. void newTemperatureColumn(int,QString);
  753. void newAnnotationColumn(int,QString);
  754. void lastColumn(int);
  755. };
  756. /*:474*//*485:*/
  757. #line 11448 "./typica.w"
  758. class CSVOutput
  759. {
  760. MeasurementModel*data;
  761. QIODevice*out;
  762. int time;
  763. QMap<int,QString> temperatureColumns;
  764. QMap<int,QString> controlColumns;
  765. QMap<int,QString> annotationColumns;
  766. public:
  767. CSVOutput(MeasurementModel*model,QIODevice*device,int timec= 0);
  768. void addTemperatureColumn(const QString&series,int column);
  769. void addControlColumn(const QString&series,int column);
  770. void addAnnotationColumn(const QString&series,int column);
  771. void setModel(MeasurementModel*model);
  772. void setTimeColumn(int column);
  773. void setDevice(QIODevice*device);
  774. bool output();
  775. };
  776. /*:485*//*515:*/
  777. #line 11591 "./typica.w"
  778. #define AppInstance (qobject_cast<Application *> (qApp))
  779. class NodeInserter;
  780. class DeviceTreeModel;
  781. class Application:public QApplication
  782. {
  783. Q_OBJECT
  784. public:
  785. Application(int&argc,char**argv);
  786. QDomDocument*configuration();
  787. /*654:*/
  788. #line 14119 "./typica.w"
  789. QDomDocument deviceConfiguration();
  790. /*:654*//*687:*/
  791. #line 14792 "./typica.w"
  792. void registerDeviceConfigurationWidget(QString driver,QMetaObject widget);
  793. QWidget*deviceConfigurationWidget(DeviceTreeModel*model,
  794. const QModelIndex&index);
  795. /*:687*//*692:*/
  796. #line 14896 "./typica.w"
  797. QList<NodeInserter*> topLevelNodeInserters;
  798. /*:692*/
  799. #line 11602 "./typica.w"
  800. QSqlDatabase database();
  801. QScriptEngine*engine;
  802. public slots:
  803. /*655:*/
  804. #line 14126 "./typica.w"
  805. void saveDeviceConfiguration();
  806. /*:655*/
  807. #line 11606 "./typica.w"
  808. private:
  809. /*653:*/
  810. #line 14110 "./typica.w"
  811. QDomDocument deviceConfigurationDocument;
  812. /*:653*//*686:*/
  813. #line 14786 "./typica.w"
  814. QHash<QString,QMetaObject> deviceConfigurationWidgets;
  815. /*:686*/
  816. #line 11608 "./typica.w"
  817. QDomDocument conf;
  818. };
  819. /*:515*//*523:*/
  820. #line 11733 "./typica.w"
  821. class SaltModel:public QAbstractItemModel
  822. {
  823. Q_OBJECT
  824. QList<QList<QMap<int,QVariant> > > modelData;
  825. QStringList hData;
  826. int colcount;
  827. public:
  828. SaltModel(int columns);
  829. ~SaltModel();
  830. int rowCount(const QModelIndex&parent= QModelIndex())const;
  831. int columnCount(const QModelIndex&parent= QModelIndex())const;
  832. bool setHeaderData(int section,Qt::Orientation orientation,
  833. const QVariant&value,int role= Qt::DisplayRole);
  834. QVariant data(const QModelIndex&index,int role)const;
  835. bool setData(const QModelIndex&index,const QVariant&value,
  836. int role= Qt::EditRole);
  837. Qt::ItemFlags flags(const QModelIndex&index)const;
  838. QVariant headerData(int section,Qt::Orientation orientation,
  839. int role= Qt::DisplayRole)const;
  840. QModelIndex index(int row,int column,
  841. const QModelIndex&parent= QModelIndex())const;
  842. QModelIndex parent(const QModelIndex&index)const;
  843. QString arrayLiteral(int column,int role)const;
  844. QString quotedArrayLiteral(int column,int role)const;
  845. void clear();
  846. bool removeRows(int row,int count,
  847. const QModelIndex&parent= QModelIndex());
  848. int findData(const QVariant&value,int column,int role= Qt::UserRole);
  849. };
  850. /*:523*//*539:*/
  851. #line 12118 "./typica.w"
  852. class SqlComboBox:public QComboBox
  853. {
  854. Q_OBJECT
  855. int dataColumn;
  856. int displayColumn;
  857. bool dataColumnShown;
  858. QString specialNullText;
  859. QVariant specialNullData;
  860. public:
  861. SqlComboBox();
  862. ~SqlComboBox();
  863. SqlComboBox*clone(QWidget*parent);
  864. public slots:
  865. void addNullOption();
  866. void addSqlOptions(QString query);
  867. void setDataColumn(int column);
  868. void setDisplayColumn(int column);
  869. void showData(bool show);
  870. void setNullText(QString nullText);
  871. void setNullData(QVariant nullData);
  872. };
  873. /*:539*//*546:*/
  874. #line 12265 "./typica.w"
  875. class SqlComboBoxDelegate:public QItemDelegate
  876. {
  877. Q_OBJECT
  878. SqlComboBox*delegate;
  879. public:
  880. SqlComboBoxDelegate(QObject*parent= NULL);
  881. QWidget*createEditor(QWidget*parent,
  882. const QStyleOptionViewItem&option,
  883. const QModelIndex&index)const;
  884. void setEditorData(QWidget*editor,const QModelIndex&index)const;
  885. void setModelData(QWidget*editor,QAbstractItemModel*model,
  886. const QModelIndex&index)const;
  887. void setWidget(SqlComboBox*widget);
  888. virtual QSize sizeHint()const;
  889. void updateEditorGeometry(QWidget*editor,
  890. const QStyleOptionViewItem&option,
  891. const QModelIndex&index)const;
  892. };
  893. /*:546*//*558:*/
  894. #line 12450 "./typica.w"
  895. class SqlConnectionSetup:public QDialog
  896. {
  897. Q_OBJECT
  898. public:
  899. SqlConnectionSetup();
  900. ~SqlConnectionSetup();
  901. public slots:
  902. void testConnection();
  903. private:
  904. QFormLayout*formLayout;
  905. QComboBox*driver;
  906. QLineEdit*hostname;
  907. QLineEdit*dbname;
  908. QLineEdit*user;
  909. QLineEdit*password;
  910. QVBoxLayout*layout;
  911. QHBoxLayout*buttons;
  912. QPushButton*cancelButton;
  913. QPushButton*connectButton;
  914. };
  915. /*:558*//*563:*/
  916. #line 12585 "./typica.w"
  917. class SqlQueryView:public QTableView
  918. {
  919. Q_OBJECT
  920. public:
  921. SqlQueryView(QWidget*parent= NULL);
  922. void setQuery(const QString&query);
  923. bool setHeaderData(int section,Qt::Orientation orientation,
  924. const QVariant&value,int role);
  925. Q_INVOKABLE QVariant data(int row,int column,
  926. int role= Qt::DisplayRole);
  927. signals:
  928. void openEntry(QString key);
  929. void openEntryRow(int row);
  930. protected:
  931. virtual void showEvent(QShowEvent*event);
  932. private slots:
  933. void openRow(const QModelIndex&index);
  934. void persistColumnResize(int column,int oldsize,int newsize);
  935. };
  936. /*:563*//*578:*/
  937. #line 12840 "./typica.w"
  938. class ReportAction:public QAction
  939. {
  940. Q_OBJECT
  941. public:
  942. ReportAction(const QString&fileName,const QString&reportName,
  943. QObject*parent= NULL);
  944. private slots:
  945. void createReport();
  946. private:
  947. QString reportFile;
  948. };
  949. /*:578*//*590:*/
  950. #line 13049 "./typica.w"
  951. class ReportTable:public QObject
  952. {
  953. Q_OBJECT
  954. QTextFrame*area;
  955. QDomElement configuration;
  956. QMap<QString,QVariant> bindings;
  957. public:
  958. ReportTable(QTextFrame*frame,QDomElement description);
  959. ~ReportTable();
  960. Q_INVOKABLE void bind(QString placeholder,QVariant value);
  961. public slots:
  962. void refresh();
  963. };
  964. /*:590*//*623:*/
  965. #line 13288 "./typica.w"
  966. class FormArray:public QScrollArea
  967. {
  968. Q_OBJECT
  969. QDomElement configuration;
  970. QWidget itemContainer;
  971. QVBoxLayout itemLayout;
  972. int maxwidth;
  973. int maxheight;
  974. public:
  975. FormArray(QDomElement description);
  976. Q_INVOKABLE QWidget*elementAt(int index);
  977. Q_INVOKABLE int elements();
  978. public slots:
  979. void addElements(int copies= 1);
  980. void removeAllElements();
  981. void setMaximumElementWidth(int width);
  982. void setMaximumElementHeight(int height);
  983. };
  984. /*:623*//*633:*/
  985. #line 13504 "./typica.w"
  986. class ScaleControl:public QGraphicsView
  987. {
  988. Q_OBJECT
  989. Q_PROPERTY(double initialValue READ initialValue WRITE setInitialValue)
  990. Q_PROPERTY(double finalValue READ finalValue WRITE setFinalValue)
  991. /*634:*/
  992. #line 13530 "./typica.w"
  993. QGraphicsScene scene;
  994. QGraphicsPolygonItem initialDecrement;
  995. QGraphicsPolygonItem initialIncrement;
  996. QGraphicsPolygonItem finalDecrement;
  997. QGraphicsPolygonItem finalIncrement;
  998. QGraphicsPolygonItem initialIndicator;
  999. QGraphicsPolygonItem finalIndicator;
  1000. QGraphicsPathItem scaleLine;
  1001. QPolygonF left;
  1002. QPolygonF right;
  1003. QPolygonF down;
  1004. QPolygonF up;
  1005. QPainterPath scalePath;
  1006. QBrush initialBrush;
  1007. QBrush finalBrush;
  1008. double nonScoredValue;
  1009. double scoredValue;
  1010. bool initialSet;
  1011. bool finalSet;
  1012. bool scaleDown;
  1013. /*:634*/
  1014. #line 13510 "./typica.w"
  1015. public:
  1016. ScaleControl();
  1017. double initialValue(void);
  1018. double finalValue(void);
  1019. virtual QSize sizeHint()const;
  1020. public slots:
  1021. void setInitialValue(double value);
  1022. void setFinalValue(double value);
  1023. signals:
  1024. void initialChanged(double);
  1025. void finalChanged(double);
  1026. protected:
  1027. virtual void mousePressEvent(QMouseEvent*event);
  1028. virtual void mouseReleaseEvent(QMouseEvent*event);
  1029. };
  1030. /*:633*//*645:*/
  1031. #line 13827 "./typica.w"
  1032. class IntensityControl:public QGraphicsView
  1033. {
  1034. Q_OBJECT
  1035. Q_PROPERTY(double value READ value WRITE setValue)
  1036. QGraphicsScene scene;
  1037. QGraphicsPolygonItem decrement;
  1038. QGraphicsPolygonItem increment;
  1039. QGraphicsPolygonItem indicator;
  1040. QGraphicsPathItem scaleLine;
  1041. QPolygonF left;
  1042. QPolygonF up;
  1043. QPolygonF down;
  1044. QPainterPath scalePath;
  1045. QBrush theBrush;
  1046. double theValue;
  1047. bool valueSet;
  1048. bool scaleDown;
  1049. public:
  1050. IntensityControl();
  1051. double value();
  1052. virtual QSize sizeHint()const;
  1053. public slots:
  1054. void setValue(double val);
  1055. signals:
  1056. void valueChanged(double);
  1057. protected:
  1058. virtual void mousePressEvent(QMouseEvent*event);
  1059. virtual void mouseReleaseEvent(QMouseEvent*event);
  1060. };
  1061. /*:645*//*661:*/
  1062. #line 14215 "./typica.w"
  1063. class DeviceTreeModelNode
  1064. {
  1065. public:
  1066. DeviceTreeModelNode(QDomNode&node,int row,
  1067. DeviceTreeModelNode*parent= NULL);
  1068. ~DeviceTreeModelNode();
  1069. DeviceTreeModelNode*child(int index);
  1070. DeviceTreeModelNode*parent();
  1071. QDomNode node()const;
  1072. int row();
  1073. private:
  1074. QDomNode domNode;
  1075. QHash<int,DeviceTreeModelNode*> children;
  1076. int rowNumber;
  1077. DeviceTreeModelNode*parentItem;
  1078. };
  1079. /*:661*//*663:*/
  1080. #line 14290 "./typica.w"
  1081. class DeviceTreeModel:public QAbstractItemModel
  1082. {
  1083. Q_OBJECT
  1084. public:
  1085. DeviceTreeModel(QObject*parent= NULL);
  1086. ~DeviceTreeModel();
  1087. QVariant data(const QModelIndex&index,int role)const;
  1088. Qt::ItemFlags flags(const QModelIndex&index)const;
  1089. QVariant headerData(int section,Qt::Orientation orientation,
  1090. int role= Qt::DisplayRole)const;
  1091. QModelIndex index(int row,int column,
  1092. const QModelIndex&parent= QModelIndex())const;
  1093. QModelIndex parent(const QModelIndex&child)const;
  1094. int rowCount(const QModelIndex&parent= QModelIndex())const;
  1095. int columnCount(const QModelIndex&parent= QModelIndex())const;
  1096. bool setData(const QModelIndex&index,const QVariant&value,
  1097. int role);
  1098. bool removeRows(int row,int count,const QModelIndex&parent);
  1099. QDomElement referenceElement(const QString&id);
  1100. public slots:
  1101. void newNode(const QString&name,const QString&driver,
  1102. const QModelIndex&parent);
  1103. private:
  1104. QDomDocument document;
  1105. DeviceTreeModelNode*root;
  1106. QDomNode referenceSection;
  1107. QDomNode treeRoot;
  1108. };
  1109. /*:663*//*682:*/
  1110. #line 14744 "./typica.w"
  1111. Q_DECLARE_METATYPE(QModelIndex)
  1112. /*:682*//*690:*/
  1113. #line 14851 "./typica.w"
  1114. class NodeInserter:public QAction
  1115. {
  1116. Q_OBJECT
  1117. public:
  1118. NodeInserter(const QString&title,const QString&name,
  1119. const QString&driver,QObject*parent= NULL);
  1120. signals:
  1121. void triggered(QString name,QString driver);
  1122. private slots:
  1123. void onTriggered();
  1124. private:
  1125. QString defaultNodeName;
  1126. QString driverString;
  1127. };
  1128. /*:690*//*693:*/
  1129. #line 14906 "./typica.w"
  1130. class DeviceConfigurationWindow:public QWidget
  1131. {
  1132. Q_OBJECT
  1133. public:
  1134. DeviceConfigurationWindow();
  1135. public slots:
  1136. void addDevice();
  1137. void removeNode();
  1138. void newSelection(const QModelIndex&index);
  1139. private slots:
  1140. void resizeColumn();
  1141. private:
  1142. QDomDocument document;
  1143. DeviceTreeModel*model;
  1144. QTreeView*view;
  1145. QScrollArea*configArea;
  1146. };
  1147. /*:693*//*702:*/
  1148. #line 15075 "./typica.w"
  1149. class BasicDeviceConfigurationWidget:public QWidget
  1150. {
  1151. Q_OBJECT
  1152. public:
  1153. BasicDeviceConfigurationWidget(DeviceTreeModel*model,
  1154. const QModelIndex&index);
  1155. public slots:
  1156. void insertChildNode(const QString&name,const QString&driver);
  1157. void updateAttribute(const QString&name,const QString&value);
  1158. protected:
  1159. DeviceTreeModel*deviceModel;
  1160. QModelIndex currentNode;
  1161. };
  1162. /*:702*//*706:*/
  1163. #line 15160 "./typica.w"
  1164. class RoasterConfWidget:public BasicDeviceConfigurationWidget
  1165. {
  1166. Q_OBJECT
  1167. public:
  1168. Q_INVOKABLE RoasterConfWidget(DeviceTreeModel*model,
  1169. const QModelIndex&index);
  1170. private slots:
  1171. void updateRoasterId(int id);
  1172. };
  1173. /*:706*//*711:*/
  1174. #line 15295 "./typica.w"
  1175. class NiDaqMxBaseDriverConfWidget:public BasicDeviceConfigurationWidget
  1176. {
  1177. Q_OBJECT
  1178. public:
  1179. Q_INVOKABLE NiDaqMxBaseDriverConfWidget(DeviceTreeModel*model,
  1180. const QModelIndex&index);
  1181. };
  1182. /*:711*//*713:*/
  1183. #line 15341 "./typica.w"
  1184. class NiDaqMxBase9211ConfWidget:public BasicDeviceConfigurationWidget
  1185. {
  1186. Q_OBJECT
  1187. public:
  1188. Q_INVOKABLE NiDaqMxBase9211ConfWidget(DeviceTreeModel*device,
  1189. const QModelIndex&index);
  1190. private slots:
  1191. void addChannel();
  1192. void updateDeviceId(const QString&newId);
  1193. };
  1194. /*:713*//*717:*/
  1195. #line 15427 "./typica.w"
  1196. class Ni9211TcConfWidget:public BasicDeviceConfigurationWidget
  1197. {
  1198. Q_OBJECT
  1199. public:
  1200. Q_INVOKABLE Ni9211TcConfWidget(DeviceTreeModel*device,
  1201. const QModelIndex&index);
  1202. private slots:
  1203. void updateThermocoupleType(const QString&type);
  1204. void updateColumnName(const QString&name);
  1205. void updateHidden(bool hidden);
  1206. };
  1207. /*:717*//*722:*/
  1208. #line 15543 "./typica.w"
  1209. class NiDaqMxDriverConfWidget:public BasicDeviceConfigurationWidget
  1210. {
  1211. Q_OBJECT
  1212. public:
  1213. Q_INVOKABLE NiDaqMxDriverConfWidget(DeviceTreeModel*model,
  1214. const QModelIndex&index);
  1215. };
  1216. /*:722*//*724:*/
  1217. #line 15584 "./typica.w"
  1218. class NiDaqMx9211ConfWidget:public BasicDeviceConfigurationWidget
  1219. {
  1220. Q_OBJECT
  1221. public:
  1222. Q_INVOKABLE NiDaqMx9211ConfWidget(DeviceTreeModel*model,
  1223. const QModelIndex&index);
  1224. private slots:
  1225. void addChannel();
  1226. void updateDeviceId(const QString&newId);
  1227. };
  1228. /*:724*//*726:*/
  1229. #line 15653 "./typica.w"
  1230. class NiDaqMxTc01ConfWidget:public BasicDeviceConfigurationWidget
  1231. {
  1232. Q_OBJECT
  1233. public:
  1234. Q_INVOKABLE NiDaqMxTc01ConfWidget(DeviceTreeModel*model,
  1235. const QModelIndex&index);
  1236. private slots:
  1237. void updateDeviceId(const QString&newId);
  1238. void updateThermocoupleType(const QString&type);
  1239. void updateColumnName(const QString&name);
  1240. void updateHidden(bool hidden);
  1241. };
  1242. /*:726*//*731:*/
  1243. #line 15784 "./typica.w"
  1244. class PortSelector:public QComboBox
  1245. {
  1246. Q_OBJECT
  1247. public:
  1248. PortSelector(QWidget*parent= NULL);
  1249. private slots:
  1250. void addDevice(QextPortInfo port);
  1251. private:
  1252. QextSerialEnumerator*lister;
  1253. };
  1254. /*:731*//*733:*/
  1255. #line 15832 "./typica.w"
  1256. class BaudSelector:public QComboBox
  1257. {
  1258. Q_OBJECT
  1259. Q_ENUMS(BaudRateType)
  1260. public:
  1261. BaudSelector(QWidget*parent= NULL);
  1262. enum BaudRateType
  1263. {
  1264. #if defined(Q_OS_UNIX) || defined(qdoc)
  1265. BAUD50= 50,
  1266. BAUD75= 75,
  1267. BAUD134= 134,
  1268. BAUD150= 150,
  1269. BAUD200= 200,
  1270. BAUD1800= 1800,
  1271. #if defined(B76800) || defined(qdoc)
  1272. BAUD76800= 76800,
  1273. #endif
  1274. #if (defined(B230400) && defined(B4000000)) || defined(qdoc)
  1275. BAUD230400= 230400,
  1276. BAUD460800= 460800,
  1277. BAUD500000= 500000,
  1278. BAUD576000= 576000,
  1279. BAUD921600= 921600,
  1280. BAUD1000000= 1000000,
  1281. BAUD1152000= 1152000,
  1282. BAUD1500000= 1500000,
  1283. BAUD2000000= 2000000,
  1284. BAUD2500000= 2500000,
  1285. BAUD3000000= 3000000,
  1286. BAUD3500000= 3500000,
  1287. BAUD4000000= 4000000,
  1288. #endif
  1289. #endif
  1290. #if defined(Q_OS_WIN) || defined(qdoc)
  1291. BAUD14400= 14400,
  1292. BAUD56000= 56000,
  1293. BAUD128000= 128000,
  1294. BAUD256000= 256000,
  1295. #endif
  1296. BAUD110= 110,
  1297. BAUD300= 300,
  1298. BAUD600= 600,
  1299. BAUD1200= 1200,
  1300. BAUD2400= 2400,
  1301. BAUD4800= 4800,
  1302. BAUD9600= 9600,
  1303. BAUD19200= 19200,
  1304. BAUD38400= 38400,
  1305. BAUD57600= 57600,
  1306. BAUD115200= 115200
  1307. };
  1308. };
  1309. /*:733*//*735:*/
  1310. #line 15903 "./typica.w"
  1311. class ParitySelector:public QComboBox
  1312. {
  1313. Q_OBJECT
  1314. Q_ENUMS(ParityType)
  1315. public:
  1316. ParitySelector(QWidget*parent= NULL);
  1317. enum ParityType
  1318. {
  1319. PAR_NONE,
  1320. PAR_ODD,
  1321. PAR_EVEN,
  1322. #if defined(Q_OS_WIN) || defined(qdoc)
  1323. PAR_MARK,
  1324. #endif
  1325. PAR_SPACE
  1326. };
  1327. };
  1328. /*:735*//*737:*/
  1329. #line 15941 "./typica.w"
  1330. class FlowSelector:public QComboBox
  1331. {
  1332. Q_OBJECT
  1333. Q_ENUMS(FlowType)
  1334. public:
  1335. FlowSelector(QWidget*parent= NULL);
  1336. enum FlowType
  1337. {
  1338. FLOW_OFF,
  1339. FLOW_HARDWARE,
  1340. FLOW_XONXOFF
  1341. };
  1342. };
  1343. /*:737*//*739:*/
  1344. #line 15974 "./typica.w"
  1345. class StopSelector:public QComboBox
  1346. {
  1347. Q_OBJECT
  1348. Q_ENUMS(StopBitsType)
  1349. public:
  1350. StopSelector(QWidget*parent= NULL);
  1351. enum StopBitsType
  1352. {
  1353. STOP_1,
  1354. #if defined(Q_OS_WIN) || defined(qdoc)
  1355. STOP_1_5,
  1356. #endif
  1357. STOP_2
  1358. };
  1359. };
  1360. /*:739*//*742:*/
  1361. #line 16027 "./typica.w"
  1362. class ShortHexSpinBox:public QSpinBox
  1363. {
  1364. Q_OBJECT
  1365. public:
  1366. ShortHexSpinBox(QWidget*parent= NULL);
  1367. virtual QValidator::State validate(QString&input,int&pos)const;
  1368. protected:
  1369. virtual int valueFromText(const QString&text)const;
  1370. virtual QString textFromValue(int value)const;
  1371. };
  1372. /*:742*//*744:*/
  1373. #line 16089 "./typica.w"
  1374. class ModbusRtuPortConfWidget:public BasicDeviceConfigurationWidget
  1375. {
  1376. Q_OBJECT
  1377. public:
  1378. Q_INVOKABLE ModbusRtuPortConfWidget(DeviceTreeModel*model,
  1379. const QModelIndex&index);
  1380. private slots:
  1381. void updatePort(const QString&newPort);
  1382. void updateBaudRate(const QString&newRate);
  1383. void updateParity(const QString&newParity);
  1384. void updateFlowControl(const QString&newFlow);
  1385. void updateStopBits(const QString&newStopBits);
  1386. };
  1387. /*:744*//*746:*/
  1388. #line 16240 "./typica.w"
  1389. class ModbusRtuDeviceConfWidget:public BasicDeviceConfigurationWidget
  1390. {
  1391. Q_OBJECT
  1392. public:
  1393. Q_INVOKABLE ModbusRtuDeviceConfWidget(DeviceTreeModel*model,
  1394. const QModelIndex&index);
  1395. private slots:
  1396. void updateStationNumber(int newStation);
  1397. void updateFixedUnit(bool newFixed);
  1398. void updateFixedDecimal(bool newFixed);
  1399. void updateUnit(const QString&newUnit);
  1400. void updateUnitAddress(int newAddress);
  1401. void updateValueF(int newValue);
  1402. void updateValueC(int newValue);
  1403. void updatePrecisionAddress(int newAddress);
  1404. void updatePrecisionValue(int newValue);
  1405. private:
  1406. QStackedLayout*unitSpecificationLayout;
  1407. QStackedLayout*decimalSpecificationLayout;
  1408. };
  1409. /*:746*//*748:*/
  1410. #line 16499 "./typica.w"
  1411. class ModbusRtuDeviceTPvConfWidget:public BasicDeviceConfigurationWidget
  1412. {
  1413. Q_OBJECT
  1414. public:
  1415. Q_INVOKABLE ModbusRtuDeviceTPvConfWidget(DeviceTreeModel*model,
  1416. const QModelIndex&index);
  1417. private slots:
  1418. void updateAddress(int newAddress);
  1419. };
  1420. /*:748*//*750:*/
  1421. #line 16545 "./typica.w"
  1422. class ModbusRtuDeviceTSvConfWidget:public BasicDeviceConfigurationWidget
  1423. {
  1424. Q_OBJECT
  1425. public:
  1426. Q_INVOKABLE ModbusRtuDeviceTSvConfWidget(DeviceTreeModel*model,
  1427. const QModelIndex&index);
  1428. private slots:
  1429. void updateReadAddress(int newAddress);
  1430. void updateWriteAddress(int newAddress);
  1431. void updateFixedRange(bool fixed);
  1432. void updateLower(const QString&lower);
  1433. void updateUpper(const QString&upper);
  1434. void updateLowerAddress(int newAddress);
  1435. void updateUpperAddress(int newAddress);
  1436. private:
  1437. QStackedLayout*boundsLayout;
  1438. };
  1439. /*:750*//*754:*/
  1440. #line 16739 "./typica.w"
  1441. class AnnotationButtonConfWidget:public BasicDeviceConfigurationWidget
  1442. {
  1443. Q_OBJECT
  1444. public:
  1445. Q_INVOKABLE AnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1446. private slots:
  1447. void updateButtonText(const QString&text);
  1448. void updateAnnotationText(const QString&text);
  1449. };
  1450. /*:754*//*758:*/
  1451. #line 16807 "./typica.w"
  1452. class ReconfigurableAnnotationButtonConfWidget:public BasicDeviceConfigurationWidget
  1453. {
  1454. Q_OBJECT
  1455. public:
  1456. Q_INVOKABLE ReconfigurableAnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1457. private slots:
  1458. void updateButtonText(const QString&text);
  1459. void updateAnnotationText(const QString&text);
  1460. };
  1461. /*:758*//*761:*/
  1462. #line 16881 "./typica.w"
  1463. class NoteSpinConfWidget:public BasicDeviceConfigurationWidget
  1464. {
  1465. Q_OBJECT
  1466. public:
  1467. Q_INVOKABLE NoteSpinConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1468. private slots:
  1469. void updateLabel(const QString&text);
  1470. void updateMinimum(const QString&minimum);
  1471. void updateMaximum(const QString&maximum);
  1472. void updatePrecision(int precision);
  1473. void updatePretext(const QString&text);
  1474. void updatePosttext(const QString&text);
  1475. };
  1476. /*:761*//*764:*/
  1477. #line 12 "./freeannotation.w"
  1478. class FreeAnnotationConfWidget:public BasicDeviceConfigurationWidget
  1479. {
  1480. Q_OBJECT
  1481. public:
  1482. Q_INVOKABLE FreeAnnotationConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1483. private slots:
  1484. void updateLabel(const QString&text);
  1485. };
  1486. /*:764*//*768:*/
  1487. #line 11 "./settings.w"
  1488. class SettingsWindow:public QMainWindow
  1489. {
  1490. Q_OBJECT
  1491. public:
  1492. SettingsWindow();
  1493. };
  1494. /*:768*//*773:*/
  1495. #line 8 "./graphsettings.w"
  1496. class GraphSettingsWidget:public QWidget
  1497. {
  1498. Q_OBJECT
  1499. public:
  1500. GraphSettingsWidget();
  1501. };
  1502. /*:773*//*775:*/
  1503. #line 46 "./graphsettings.w"
  1504. class GraphSettingsRelativeTab:public QWidget
  1505. {
  1506. Q_OBJECT
  1507. public:
  1508. GraphSettingsRelativeTab();
  1509. public slots:
  1510. void updateEnableSetting(bool enable);
  1511. void updateColorSetting(const QString&color);
  1512. void updateAxisSetting(const QString&gridList);
  1513. void updateUnit(int unit);
  1514. void showColorPicker();
  1515. private:
  1516. QLineEdit*colorEdit;
  1517. };
  1518. /*:775*//*779:*/
  1519. #line 17006 "./typica.w"
  1520. class ModbusRTUDevice:public QObject
  1521. {
  1522. Q_OBJECT
  1523. public:
  1524. ModbusRTUDevice(DeviceTreeModel*model,const QModelIndex&index);
  1525. ~ModbusRTUDevice();
  1526. void queueMessage(QByteArray request,QObject*object,const char*callback);
  1527. Q_INVOKABLE double SVLower();
  1528. Q_INVOKABLE double SVUpper();
  1529. Q_INVOKABLE int decimals();
  1530. QList<Channel*> channels;
  1531. public slots:
  1532. void outputSV(double sv);
  1533. signals:
  1534. void SVLowerChanged(double);
  1535. void SVUpperChanged(double);
  1536. void SVDecimalChanged(int);
  1537. void queueEmpty();
  1538. private slots:
  1539. void dataAvailable();
  1540. void sendNextMessage();
  1541. void decimalResponse(QByteArray response);
  1542. void unitResponse(QByteArray response);
  1543. void svlResponse(QByteArray response);
  1544. void svuResponse(QByteArray response);
  1545. void requestMeasurement();
  1546. void mResponse(QByteArray response);
  1547. void ignore(QByteArray response);
  1548. private:
  1549. QextSerialPort*port;
  1550. QByteArray responseBuffer;
  1551. QList<QByteArray> messageQueue;
  1552. QList<QObject*> retObjQueue;
  1553. QList<char*> callbackQueue;
  1554. quint16 calculateCRC(QByteArray data);
  1555. QTimer*messageDelayTimer;
  1556. int delayTime;
  1557. char station;
  1558. int decimalPosition;
  1559. int valueF;
  1560. int valueC;
  1561. bool unitIsF;
  1562. double outputSVLower;
  1563. double outputSVUpper;
  1564. QByteArray outputSVStub;
  1565. QByteArray pvStub;
  1566. QByteArray svStub;
  1567. QByteArray mStub;
  1568. quint16 pvaddress;
  1569. quint16 svaddress;
  1570. bool svenabled;
  1571. bool readingsv;
  1572. double savedpv;
  1573. bool waiting;
  1574. };
  1575. /*:779*//*794:*/
  1576. #line 17678 "./typica.w"
  1577. class ModbusConfigurator:public BasicDeviceConfigurationWidget
  1578. {
  1579. Q_OBJECT
  1580. public:
  1581. Q_INVOKABLE ModbusConfigurator(DeviceTreeModel*model,const QModelIndex&index);
  1582. private slots:
  1583. void updatePort(const QString&newPort);
  1584. void updateBaudRate(const QString&newRate);
  1585. void updateParity(const QString&newParity);
  1586. void updateFlowControl(const QString&newFlow);
  1587. void updateStopBits(const QString&newStopBits);
  1588. void updateStation(int station);
  1589. void updateFixedDecimal(bool fixed);
  1590. void updateDecimalAddress(int address);
  1591. void updateDecimalPosition(int position);
  1592. void updateFixedUnit(bool fixed);
  1593. void updateUnitAddress(int address);
  1594. void updateValueForF(int value);
  1595. void updateValueForC(int value);
  1596. void updateUnit(const QString&newUnit);
  1597. void updatePVAddress(int address);
  1598. void updateSVEnabled(bool enabled);
  1599. void updateSVReadAddress(int address);
  1600. void updateDeviceLimit(bool query);
  1601. void updateSVLowerAddress(int address);
  1602. void updateSVUpperAddress(int address);
  1603. void updateSVLower(double value);
  1604. void updateSVUpper(double value);
  1605. void updateSVWritable(bool canWriteSV);
  1606. void updateSVWriteAddress(int address);
  1607. void updatePVColumnName(const QString&name);
  1608. void updateSVColumnName(const QString&name);
  1609. void updatePVHidden(bool hidden);
  1610. void updateSVHidden(bool hidden);
  1611. private:
  1612. PortSelector*port;
  1613. BaudSelector*baud;
  1614. ParitySelector*parity;
  1615. FlowSelector*flow;
  1616. StopSelector*stop;
  1617. QSpinBox*station;
  1618. QCheckBox*decimalQuery;
  1619. ShortHexSpinBox*decimalAddress;
  1620. QSpinBox*decimalPosition;
  1621. QCheckBox*unitQuery;
  1622. ShortHexSpinBox*unitAddress;
  1623. QSpinBox*valueF;
  1624. QSpinBox*valueC;
  1625. QComboBox*fixedUnit;
  1626. ShortHexSpinBox*pVAddress;
  1627. QCheckBox*sVEnabled;
  1628. ShortHexSpinBox*sVReadAddress;
  1629. QCheckBox*deviceLimit;
  1630. ShortHexSpinBox*sVLowerAddr;
  1631. ShortHexSpinBox*sVUpperAddr;
  1632. QDoubleSpinBox*sVLower;
  1633. QDoubleSpinBox*sVUpper;
  1634. QCheckBox*sVWritable;
  1635. ShortHexSpinBox*sVOutputAddr;
  1636. QLineEdit*pVColumnName;
  1637. QLineEdit*sVColumnName;
  1638. };
  1639. /*:794*//*798:*/
  1640. #line 18212 "./typica.w"
  1641. class LinearSplineInterpolationConfWidget:public BasicDeviceConfigurationWidget
  1642. {
  1643. Q_OBJECT
  1644. public:
  1645. Q_INVOKABLE LinearSplineInterpolationConfWidget(DeviceTreeModel*model,
  1646. const QModelIndex&index);
  1647. private slots:
  1648. void updateSourceColumn(const QString&source);
  1649. void updateDestinationColumn(const QString&dest);
  1650. void updateKnots();
  1651. private:
  1652. SaltModel*tablemodel;
  1653. };
  1654. /*:798*//*804:*/
  1655. #line 18336 "./typica.w"
  1656. class TranslationConfWidget:public BasicDeviceConfigurationWidget
  1657. {
  1658. Q_OBJECT
  1659. public:
  1660. Q_INVOKABLE TranslationConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1661. private slots:
  1662. void updateMatchingColumn(const QString&column);
  1663. void updateTemperature();
  1664. private:
  1665. QDoubleSpinBox*temperatureValue;
  1666. QComboBox*unitSelector;
  1667. };
  1668. /*:804*//*808:*/
  1669. #line 16 "./rate.w"
  1670. class RateOfChange:public QObject
  1671. {
  1672. Q_OBJECT
  1673. public:
  1674. RateOfChange(int cachetime= 1,int scaletime= 1);
  1675. public slots:
  1676. void newMeasurement(Measurement measure);
  1677. void setCacheTime(int seconds);
  1678. void setScaleTime(int seconds);
  1679. signals:
  1680. void newData(Measurement measure);
  1681. private:
  1682. int ct;
  1683. int st;
  1684. QList<Measurement> cache;
  1685. };
  1686. /*:808*//*816:*/
  1687. #line 177 "./rate.w"
  1688. class RateOfChangeConfWidget:public BasicDeviceConfigurationWidget
  1689. {
  1690. Q_OBJECT
  1691. public:
  1692. Q_INVOKABLE RateOfChangeConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1693. private slots:
  1694. void updateColumn(const QString&column);
  1695. void updateCacheTime(const QString&seconds);
  1696. void updateScaleTime(const QString&seconds);
  1697. };
  1698. /*:816*//*822:*/
  1699. #line 19 "./dataqsdk.w"
  1700. class DataqSdkDeviceImplementation;
  1701. class DataqSdkDevice:public QObject
  1702. {
  1703. Q_OBJECT
  1704. DataqSdkDeviceImplementation*imp;
  1705. private slots:
  1706. void threadFinished();
  1707. public:
  1708. DataqSdkDevice(QString device);
  1709. ~DataqSdkDevice();
  1710. Channel*newChannel(Units::Unit scale);
  1711. Q_INVOKABLE void setClockRate(double Hz);
  1712. Q_INVOKABLE void start();
  1713. static QStringList detectPorts();
  1714. static QStringList detectHardware();
  1715. };
  1716. /*:822*//*823:*/
  1717. #line 49 "./dataqsdk.w"
  1718. class DataqSdkDeviceImplementation:public QThread
  1719. {
  1720. Q_OBJECT
  1721. public:
  1722. DataqSdkDeviceImplementation();
  1723. ~DataqSdkDeviceImplementation();
  1724. void run();
  1725. /*824:*/
  1726. #line 70 "./dataqsdk.w"
  1727. typedef struct di_inlist_struct{
  1728. unsigned short chan;
  1729. unsigned short diff;
  1730. unsigned short gain;
  1731. unsigned short unipolar;
  1732. unsigned short dig_out_enable;
  1733. unsigned short dig_out;
  1734. unsigned short ave;
  1735. unsigned short counter;
  1736. }DI_INLIST_STRUCT;
  1737. typedef int(PASCAL*FPDIOPEN)(unsigned);
  1738. typedef int(PASCAL*FPDICLOSE)(void);
  1739. typedef double(PASCAL*FPDISAMPLERATE)(double,long*,long*);
  1740. typedef double(PASCAL*FPDIMAXIMUMRATE)(double);
  1741. typedef int(PASCAL*FPDILISTLENGTH)(unsigned,unsigned);
  1742. typedef int(PASCAL*FPDIINLIST)(di_inlist_struct*);
  1743. typedef int*(PASCAL*FPDIBUFFERALLOC)(unsigned,unsigned);
  1744. typedef int(PASCAL*FPDISTARTSCAN)(void);
  1745. typedef unsigned(PASCAL*FPDISTATUSREAD)(short*,unsigned);
  1746. typedef unsigned(PASCAL*FPDIBUFFERSTATUS)(unsigned);
  1747. typedef int(PASCAL*FPDIBURSTRATE)(unsigned);
  1748. typedef int(PASCAL*FPDISTOPSCAN)(void);
  1749. FPDIOPEN di_open;
  1750. FPDICLOSE di_close;
  1751. FPDISAMPLERATE di_sample_rate;
  1752. FPDIMAXIMUMRATE di_maximum_rate;
  1753. FPDILISTLENGTH di_list_length;
  1754. FPDIINLIST di_inlist;
  1755. FPDIBUFFERALLOC di_buffer_alloc;
  1756. FPDISTARTSCAN di_start_scan;
  1757. FPDISTATUSREAD di_status_read;
  1758. FPDIBUFFERSTATUS di_buffer_status;
  1759. FPDIBURSTRATE di_burst_rate;
  1760. FPDISTOPSCAN di_stop_scan;
  1761. /*:824*/
  1762. #line 57 "./dataqsdk.w"
  1763. /*826:*/
  1764. #line 134 "./dataqsdk.w"
  1765. bool isOpen;
  1766. double sampleRate;
  1767. long oversample;
  1768. long burstDivisor;
  1769. QString device;
  1770. unsigned deviceNumber;
  1771. QVector<Channel*> channelMap;
  1772. int error;
  1773. int channels;
  1774. bool ready;
  1775. QLibrary*driver;
  1776. QVector<Units::Unit> unitMap;
  1777. int*input_buffer;
  1778. QTimer*eventClock;
  1779. QMultiMap<int,double> smoother;
  1780. /*:826*/
  1781. #line 58 "./dataqsdk.w"
  1782. public slots:
  1783. void measure();
  1784. private:
  1785. qint16*buffer;
  1786. };
  1787. /*:823*//*843:*/
  1788. #line 663 "./dataqsdk.w"
  1789. class DataqSdkDeviceConfWidget:public BasicDeviceConfigurationWidget
  1790. {
  1791. Q_OBJECT
  1792. public:
  1793. Q_INVOKABLE DataqSdkDeviceConfWidget(DeviceTreeModel*model,
  1794. const QModelIndex&index);
  1795. private slots:
  1796. void updateAutoSelect(bool automatic);
  1797. void updateDeviceNumber(int deviceNumber);
  1798. void updatePort(QString portId);
  1799. void addChannel();
  1800. private:
  1801. QStackedWidget*deviceIdStack;
  1802. };
  1803. /*:843*//*848:*/
  1804. #line 808 "./dataqsdk.w"
  1805. class DataqSdkChannelConfWidget:public BasicDeviceConfigurationWidget
  1806. {
  1807. Q_OBJECT
  1808. public:
  1809. Q_INVOKABLE DataqSdkChannelConfWidget(DeviceTreeModel*model,
  1810. const QModelIndex&index);
  1811. private slots:
  1812. void updateUnits(const QString&unit);
  1813. void updateColumnName(const QString&value);
  1814. void updateMeasuredLower(const QString&value);
  1815. void updateMeasuredUpper(const QString&value);
  1816. void updateMappedLower(const QString&value);
  1817. void updateMappedUpper(const QString&value);
  1818. void updateClosedInterval(bool closed);
  1819. void updateSmoothingEnabled(bool enabled);
  1820. void updateSensitivity(const QString&value);
  1821. void startCalibration();
  1822. void stopCalibration();
  1823. void resetCalibration();
  1824. void updateInput(Measurement measure);
  1825. void updateOutput(Measurement measure);
  1826. void updateHidden(bool hidden);
  1827. private:
  1828. QPushButton*startButton;
  1829. QPushButton*resetButton;
  1830. QPushButton*stopButton;
  1831. /*853:*/
  1832. #line 1098 "./dataqsdk.w"
  1833. bool autoSelect;
  1834. QString deviceID;
  1835. unsigned int channelOfInterest;
  1836. /*:853*/
  1837. #line 835 "./dataqsdk.w"
  1838. DataqSdkDevice*calibrationDevice;
  1839. LinearCalibrator*calibrator;
  1840. QLineEdit*currentMeasurement;
  1841. QLineEdit*minimumMeasurement;
  1842. QLineEdit*maximumMeasurement;
  1843. QLineEdit*averageMeasurement;
  1844. QLineEdit*currentMapped;
  1845. QLineEdit*minimumMapped;
  1846. QLineEdit*maximumMapped;
  1847. QLineEdit*averageMapped;
  1848. int rmCount;
  1849. int cmCount;
  1850. double rmin;
  1851. double rmax;
  1852. double rmean;
  1853. double cmin;
  1854. double cmax;
  1855. double cmean;
  1856. };
  1857. /*:848*//*875:*/
  1858. #line 247 "./scales.w"
  1859. Q_DECLARE_METATYPE(BaudRateType)
  1860. Q_DECLARE_METATYPE(DataBitsType)
  1861. Q_DECLARE_METATYPE(ParityType)
  1862. Q_DECLARE_METATYPE(StopBitsType)
  1863. Q_DECLARE_METATYPE(FlowType)
  1864. /*:875*//*882:*/
  1865. #line 370 "./scales.w"
  1866. class SerialScaleConfWidget:public BasicDeviceConfigurationWidget
  1867. {
  1868. Q_OBJECT
  1869. public:
  1870. Q_INVOKABLE SerialScaleConfWidget(DeviceTreeModel*model,
  1871. const QModelIndex&index);
  1872. private slots:
  1873. void updatePort(const QString&newPort);
  1874. void updateBaudRate(const QString&rate);
  1875. void updateParity(int index);
  1876. void updateFlowControl(int index);
  1877. void updateStopBits(int index);
  1878. private:
  1879. PortSelector*port;
  1880. BaudSelector*baud;
  1881. ParitySelector*parity;
  1882. FlowSelector*flow;
  1883. StopSelector*stop;
  1884. };
  1885. /*:882*//*887:*/
  1886. #line 14 "./valueannotation.w"
  1887. class ValueAnnotationConfWidget:public BasicDeviceConfigurationWidget
  1888. {
  1889. Q_OBJECT
  1890. public:
  1891. Q_INVOKABLE ValueAnnotationConfWidget(DeviceTreeModel*model,
  1892. const QModelIndex&index);
  1893. private slots:
  1894. void updateSourceColumn(const QString&source);
  1895. void updateAnnotations();
  1896. void updateStart(bool noteOnStart);
  1897. private:
  1898. SaltModel*tablemodel;
  1899. };
  1900. /*:887*//*895:*/
  1901. #line 165 "./valueannotation.w"
  1902. class ValueAnnotation:public QObject
  1903. {
  1904. Q_OBJECT
  1905. public:
  1906. ValueAnnotation();
  1907. Q_INVOKABLE void setAnnotation(double value,const QString&annotation);
  1908. public slots:
  1909. void newMeasurement(Measurement measure);
  1910. void annotate();
  1911. void setAnnotationColumn(int column);
  1912. void setTemperatureColumn(int column);
  1913. void setTolerance(double epsilon);
  1914. signals:
  1915. void annotation(QString annotation,int tempcolumn,int notecolumn);
  1916. private:
  1917. int lastIndex;
  1918. int annotationColumn;
  1919. int measurementColumn;
  1920. QList<double> values;
  1921. QStringList annotations;
  1922. double tolerance;
  1923. };
  1924. /*:895*/
  1925. #line 526 "./typica.w"
  1926. /*12:*/
  1927. #line 794 "./typica.w"
  1928. void setQObjectProperties(QScriptValue value,QScriptEngine*engine);
  1929. /*:12*//*14:*/
  1930. #line 809 "./typica.w"
  1931. void setQPaintDeviceProperties(QScriptValue value,QScriptEngine*engine);
  1932. void setQLayoutItemProperties(QScriptValue value,QScriptEngine*engine);
  1933. /*:14*//*16:*/
  1934. #line 834 "./typica.w"
  1935. void setQWidgetProperties(QScriptValue value,QScriptEngine*engine);
  1936. QScriptValue constructQWidget(QScriptContext*context,QScriptEngine*engine);
  1937. QScriptValue QWidget_setLayout(QScriptContext*context,QScriptEngine*engine);
  1938. QScriptValue QWidget_activateWindow(QScriptContext*context,
  1939. QScriptEngine*engine);
  1940. /*:16*//*27:*/
  1941. #line 1078 "./typica.w"
  1942. QScriptValue constructQMainWindow(QScriptContext*context,
  1943. QScriptEngine*engine);
  1944. QScriptValue QMainWindow_setCentralWidget(QScriptContext*context,
  1945. QScriptEngine*engine);
  1946. QScriptValue QMainWindow_menuBar(QScriptContext*context,
  1947. QScriptEngine*engine);
  1948. void setQMainWindowProperties(QScriptValue value,QScriptEngine*engine);
  1949. /*:27*//*32:*/
  1950. #line 1177 "./typica.w"
  1951. void setQMenuBarProperties(QScriptValue value,QScriptEngine*engine);
  1952. QScriptValue QMenuBar_addMenu(QScriptContext*context,QScriptEngine*engine);
  1953. /*:32*//*35:*/
  1954. #line 1222 "./typica.w"
  1955. void setQMenuProperties(QScriptValue value,QScriptEngine*engine);
  1956. QScriptValue QMenu_addAction(QScriptContext*context,QScriptEngine*engine);
  1957. QScriptValue QMenu_addSeparator(QScriptContext*context,QScriptEngine*engine);
  1958. /*:35*//*38:*/
  1959. #line 1288 "./typica.w"
  1960. void setQFrameProperties(QScriptValue value,QScriptEngine*engine);
  1961. QScriptValue constructQFrame(QScriptContext*context,QScriptEngine*engine);
  1962. /*:38*//*41:*/
  1963. #line 1321 "./typica.w"
  1964. void setQLabelProperties(QScriptValue value,QScriptEngine*engine);
  1965. QScriptValue constructQLabel(QScriptContext*context,QScriptEngine*engine);
  1966. /*:41*//*44:*/
  1967. #line 1359 "./typica.w"
  1968. void setQLineEditProperties(QScriptValue value,QScriptEngine*engine);
  1969. QScriptValue constructQLineEdit(QScriptContext*context,QScriptEngine*engine);
  1970. /*:44*//*48:*/
  1971. #line 1398 "./typica.w"
  1972. QScriptValue constructQSplitter(QScriptContext*context,QScriptEngine*engine);
  1973. QScriptValue QSplitter_addWidget(QScriptContext*context,
  1974. QScriptEngine*engine);
  1975. QScriptValue QSplitter_saveState(QScriptContext*context,
  1976. QScriptEngine*engine);
  1977. QScriptValue QSplitter_restoreState(QScriptContext*context,
  1978. QScriptEngine*engine);
  1979. void setQSplitterProperties(QScriptValue value,QScriptEngine*engine);
  1980. /*:48*//*53:*/
  1981. #line 1517 "./typica.w"
  1982. void setQLayoutProperties(QScriptValue value,QScriptEngine*engine);
  1983. QScriptValue QLayout_addWidget(QScriptContext*context,QScriptEngine*engine);
  1984. /*:53*//*55:*/
  1985. #line 1572 "./typica.w"
  1986. QScriptValue constructQBoxLayout(QScriptContext*context,
  1987. QScriptEngine*engine);
  1988. void setQBoxLayoutProperties(QScriptValue value,QScriptEngine*engine);
  1989. QScriptValue QBoxLayout_addLayout(QScriptContext*context,QScriptEngine*engine);
  1990. QScriptValue QBoxLayout_addWidget(QScriptContext*context,QScriptEngine*engine);
  1991. /*:55*//*59:*/
  1992. #line 1685 "./typica.w"
  1993. QScriptValue constructQAction(QScriptContext*context,QScriptEngine*engine);
  1994. QScriptValue QAction_setShortcut(QScriptContext*context,
  1995. QScriptEngine*engine);
  1996. void setQActionProperties(QScriptValue value,QScriptEngine*engine);
  1997. /*:59*//*62:*/
  1998. #line 1741 "./typica.w"
  1999. QScriptValue QFileDialog_getOpenFileName(QScriptContext*context,
  2000. QScriptEngine*engine);
  2001. QScriptValue QFileDialog_getSaveFileName(QScriptContext*context,
  2002. QScriptEngine*engine);
  2003. void setQFileDialogProperties(QScriptValue value,QScriptEngine*engine);
  2004. void setQDialogProperties(QScriptValue value,QScriptEngine*engine);
  2005. /*:62*//*67:*/
  2006. #line 1852 "./typica.w"
  2007. QScriptValue constructQFile(QScriptContext*context,QScriptEngine*engine);
  2008. void setQFileProperties(QScriptValue value,QScriptEngine*engine);
  2009. QScriptValue QFile_remove(QScriptContext*context,QScriptEngine*engine);
  2010. void setQIODeviceProperties(QScriptValue value,QScriptEngine*engine);
  2011. QScriptValue QIODevice_open(QScriptContext*context,QScriptEngine*engine);
  2012. QScriptValue QIODevice_close(QScriptContext*context,QScriptEngine*engine);
  2013. QScriptValue QIODevice_readToString(QScriptContext*context,
  2014. QScriptEngine*engine);
  2015. /*:67*//*74:*/
  2016. #line 1974 "./typica.w"
  2017. QScriptValue constructQBuffer(QScriptContext*context,QScriptEngine*engine);
  2018. void setQBufferProperties(QScriptValue value,QScriptEngine*engine);
  2019. QScriptValue QBuffer_setData(QScriptContext*context,QScriptEngine*engine);
  2020. /*:74*//*77:*/
  2021. #line 2019 "./typica.w"
  2022. QScriptValue constructXQuery(QScriptContext*context,QScriptEngine*engine);
  2023. QScriptValue XQuery_bind(QScriptContext*context,QScriptEngine*engine);
  2024. QScriptValue XQuery_exec(QScriptContext*context,QScriptEngine*engine);
  2025. QScriptValue XQuery_setQuery(QScriptContext*context,QScriptEngine*engine);
  2026. QScriptValue XQuery_invalidate(QScriptContext*context,QScriptEngine*engine);
  2027. void setXQueryProperties(QScriptValue value,QScriptEngine*engine);
  2028. /*:77*//*83:*/
  2029. #line 2101 "./typica.w"
  2030. QScriptValue constructXmlWriter(QScriptContext*context,QScriptEngine*engine);
  2031. QScriptValue XmlWriter_setDevice(QScriptContext*context,
  2032. QScriptEngine*engine);
  2033. QScriptValue XmlWriter_writeAttribute(QScriptContext*context,
  2034. QScriptEngine*engine);
  2035. QScriptValue XmlWriter_writeCDATA(QScriptContext*context,
  2036. QScriptEngine*engine);
  2037. QScriptValue XmlWriter_writeCharacters(QScriptContext*context,
  2038. QScriptEngine*engine);
  2039. QScriptValue XmlWriter_writeDTD(QScriptContext*context,QScriptEngine*engine);
  2040. QScriptValue XmlWriter_writeEmptyElement(QScriptContext*context,
  2041. QScriptEngine*engine);
  2042. QScriptValue XmlWriter_writeEndDocument(QScriptContext*context,
  2043. QScriptEngine*engine);
  2044. QScriptValue XmlWriter_writeEndElement(QScriptContext*context,
  2045. QScriptEngine*engine);
  2046. QScriptValue XmlWriter_writeEntityReference(QScriptContext*context,
  2047. QScriptEngine*engine);
  2048. QScriptValue XmlWriter_writeProcessingInstruction(QScriptContext*context,
  2049. QScriptEngine*engine);
  2050. QScriptValue XmlWriter_writeStartDocument(QScriptContext*context,
  2051. QScriptEngine*engine);
  2052. QScriptValue XmlWriter_writeStartElement(QScriptContext*context,
  2053. QScriptEngine*engine);
  2054. QScriptValue XmlWriter_writeTextElement(QScriptContext*context,
  2055. QScriptEngine*engine);
  2056. void setXmlWriterProperties(QScriptValue value,QScriptEngine*engine);
  2057. /*:83*//*92:*/
  2058. #line 2319 "./typica.w"
  2059. QScriptValue constructXmlReader(QScriptContext*context,QScriptEngine*engine);
  2060. QScriptValue XmlReader_atEnd(QScriptContext*context,QScriptEngine*engine);
  2061. QScriptValue XmlReader_attribute(QScriptContext*context,
  2062. QScriptEngine*engine);
  2063. QScriptValue XmlReader_hasAttribute(QScriptContext*context,
  2064. QScriptEngine*engine);
  2065. QScriptValue XmlReader_isDTD(QScriptContext*context,QScriptEngine*engine);
  2066. QScriptValue XmlReader_isStartElement(QScriptContext*context,
  2067. QScriptEngine*engine);
  2068. QScriptValue XmlReader_name(QScriptContext*context,QScriptEngine*engine);
  2069. QScriptValue XmlReader_readElementText(QScriptContext*context,
  2070. QScriptEngine*engine);
  2071. QScriptValue XmlReader_readNext(QScriptContext*context,QScriptEngine*engine);
  2072. QScriptValue XmlReader_text(QScriptContext*context,QScriptEngine*engine);
  2073. void setXmlReaderProperties(QScriptValue value,QScriptEngine*engine);
  2074. /*:92*//*99:*/
  2075. #line 2454 "./typica.w"
  2076. QScriptValue QSettings_value(QScriptContext*context,QScriptEngine*engine);
  2077. QScriptValue QSettings_setValue(QScriptContext*context,QScriptEngine*engine);
  2078. void setQSettingsProperties(QScriptValue value,QScriptEngine*engine);
  2079. /*:99*//*103:*/
  2080. #line 2536 "./typica.w"
  2081. QScriptValue constructQLCDNumber(QScriptContext*context,
  2082. QScriptEngine*engine);
  2083. void setQLCDNumberProperties(QScriptValue value,QScriptEngine*engine);
  2084. /*:103*//*106:*/
  2085. #line 2574 "./typica.w"
  2086. QScriptValue constructQTime(QScriptContext*context,QScriptEngine*engine);
  2087. QScriptValue QTime_addMSecs(QScriptContext*context,QScriptEngine*engine);
  2088. QScriptValue QTime_addSecs(QScriptContext*context,QScriptEngine*engine);
  2089. QScriptValue QTime_elapsed(QScriptContext*context,QScriptEngine*engine);
  2090. QScriptValue QTime_hour(QScriptContext*context,QScriptEngine*engine);
  2091. QScriptValue QTime_isNull(QScriptContext*context,QScriptEngine*engine);
  2092. QScriptValue QTime_isValid(QScriptContext*context,QScriptEngine*engine);
  2093. QScriptValue QTime_minute(QScriptContext*context,QScriptEngine*engine);
  2094. QScriptValue QTime_msec(QScriptContext*context,QScriptEngine*engine);
  2095. QScriptValue QTime_msecsTo(QScriptContext*context,QScriptEngine*engine);
  2096. QScriptValue QTime_restart(QScriptContext*context,QScriptEngine*engine);
  2097. QScriptValue QTime_second(QScriptContext*context,QScriptEngine*engine);
  2098. QScriptValue QTime_secsTo(QScriptContext*context,QScriptEngine*engine);
  2099. QScriptValue QTime_setHMS(QScriptContext*context,QScriptEngine*engine);
  2100. QScriptValue QTime_start(QScriptContext*context,QScriptEngine*engine);
  2101. QScriptValue QTime_toString(QScriptContext*context,QScriptEngine*engine);
  2102. QScriptValue QTime_currentTime(QScriptContext*context,QScriptEngine*engine);
  2103. QScriptValue QTime_fromString(QScriptContext*context,QScriptEngine*engine);
  2104. QScriptValue QTime_valueOf(QScriptContext*context,QScriptEngine*engine);
  2105. void setQTimeProperties(QScriptValue value,QScriptEngine*engine);
  2106. /*:106*//*121:*/
  2107. #line 3043 "./typica.w"
  2108. void setQAbstractScrollAreaProperties(QScriptValue value,
  2109. QScriptEngine*engine);
  2110. /*:121*//*123:*/
  2111. #line 3058 "./typica.w"
  2112. void setQAbstractItemViewProperties(QScriptValue value,QScriptEngine*engine);
  2113. /*:123*//*125:*/
  2114. #line 3071 "./typica.w"
  2115. void setQGraphicsViewProperties(QScriptValue value,QScriptEngine*engine);
  2116. void setQTableViewProperties(QScriptValue value,QScriptEngine*engine);
  2117. /*:125*//*127:*/
  2118. #line 3095 "./typica.w"
  2119. void setQAbstractButtonProperties(QScriptValue value,QScriptEngine*engine);
  2120. void setQPushButtonProperties(QScriptValue value,QScriptEngine*engine);
  2121. QScriptValue constructQPushButton(QScriptContext*context,
  2122. QScriptEngine*engine);
  2123. /*:127*//*134:*/
  2124. #line 3194 "./typica.w"
  2125. void setQSqlQueryProperties(QScriptValue value,QScriptEngine*engine);
  2126. QScriptValue constructQSqlQuery(QScriptContext*context,QScriptEngine*engine);
  2127. QScriptValue QSqlQuery_bind(QScriptContext*context,QScriptEngine*engine);
  2128. QScriptValue QSqlQuery_bindDeviceData(QScriptContext*context,
  2129. QScriptEngine*engine);
  2130. QScriptValue QSqlQuery_bindFileData(QScriptContext*context,
  2131. QScriptEngine*engine);
  2132. QScriptValue QSqlQuery_exec(QScriptContext*context,
  2133. QScriptEngine*engine);
  2134. QScriptValue QSqlQuery_executedQuery(QScriptContext*context,
  2135. QScriptEngine*engine);
  2136. QScriptValue QSqlQuery_invalidate(QScriptContext*context,QScriptEngine*engine);
  2137. QScriptValue QSqlQuery_next(QScriptContext*context,QScriptEngine*engine);
  2138. QScriptValue QSqlQuery_prepare(QScriptContext*context,QScriptEngine*engine);
  2139. QScriptValue QSqlQuery_value(QScriptContext*context,QScriptEngine*engine);
  2140. /*:134*//*141:*/
  2141. #line 3365 "./typica.w"
  2142. QScriptValue baseName(QScriptContext*context,QScriptEngine*engine);
  2143. QScriptValue dir(QScriptContext*context,QScriptEngine*engine);
  2144. QScriptValue sqlToArray(QScriptContext*context,QScriptEngine*engine);
  2145. QScriptValue setFont(QScriptContext*context,QScriptEngine*engine);
  2146. QScriptValue annotationFromRecord(QScriptContext*context,
  2147. QScriptEngine*engine);
  2148. QScriptValue setTabOrder(QScriptContext*context,QScriptEngine*engine);
  2149. /*:141*//*152:*/
  2150. #line 3652 "./typica.w"
  2151. QScriptValue createWindow(QScriptContext*context,QScriptEngine*engine);
  2152. QScriptValue createReport(QScriptContext*context,QScriptEngine*engine);
  2153. void addLayoutToWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  2154. QStack<QLayout*> *layoutStack);
  2155. void addLayoutToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2156. QStack<QLayout*> *layoutStack);
  2157. void addSplitterToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2158. QStack<QLayout*> *layoutStack);
  2159. void addSplitterToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2160. QStack<QLayout*> *layoutStack);
  2161. void populateGridLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2162. QStack<QLayout*> *layoutStack);
  2163. void populateBoxLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2164. QStack<QLayout*> *layoutStack);
  2165. void populateSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2166. QStack<QLayout*> *layoutStack);
  2167. void populateWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  2168. QStack<QLayout*> *layoutStack);
  2169. void populateStackedLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2170. QStack<QLayout*> *layoutStack);
  2171. void addTemperatureDisplayToSplitter(QDomElement element,
  2172. QStack<QWidget*> *widgetStack,
  2173. QStack<QLayout*> *layoutStack);
  2174. void addTemperatureDisplayToLayout(QDomElement element,
  2175. QStack<QWidget*> *widgetStack,
  2176. QStack<QLayout*> *layoutStack);
  2177. void addTimerDisplayToSplitter(QDomElement element,
  2178. QStack<QWidget*> *widgetStack,
  2179. QStack<QLayout*> *layoutStack);
  2180. void addTimerDisplayToLayout(QDomElement element,
  2181. QStack<QWidget*> *widgetStack,
  2182. QStack<QLayout*> *layoutStack);
  2183. void addDecorationToSplitter(QDomElement element,
  2184. QStack<QWidget*> *widgetStack,
  2185. QStack<QLayout*> *layoutStack);
  2186. void addDecorationToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2187. QStack<QLayout*> *layoutStack);
  2188. void addWidgetToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2189. QStack<QLayout*> *layoutStack);
  2190. void addButtonToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2191. QStack<QLayout*> *layoutStack);
  2192. void addZoomLogToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2193. QStack<QLayout*> *layoutStack);
  2194. void addGraphToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2195. QStack<QLayout*> *layoutStack);
  2196. void addSqlDropToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2197. QStack<QLayout*> *layoutStack);
  2198. void addSaltToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2199. QStack<QLayout*> *layoutStack);
  2200. void addLineToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2201. QStack<QLayout*> *layoutStack);
  2202. void addTextToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2203. QStack<QLayout*> *layoutStack);
  2204. void addSqlQueryViewToLayout(QDomElement element,
  2205. QStack<QWidget*> *widgetStack,
  2206. QStack<QLayout*> *layoutStack);
  2207. void addCalendarToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2208. QStack<QLayout*> *layoutStack);
  2209. void addSpinBoxToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2210. QStack<QLayout*> *layoutStack);
  2211. /*:152*//*204:*/
  2212. #line 5215 "./typica.w"
  2213. void setQDateEditProperties(QScriptValue value,QScriptEngine*engine);
  2214. void setQDateTimeEditProperties(QScriptValue value,QScriptEngine*engine);
  2215. QScriptValue QDateTimeEdit_setDate(QScriptContext*context,
  2216. QScriptEngine*engine);
  2217. QScriptValue QDateTimeEdit_day(QScriptContext*context,QScriptEngine*engine);
  2218. QScriptValue QDateTimeEdit_month(QScriptContext*context,
  2219. QScriptEngine*engine);
  2220. QScriptValue QDateTimeEdit_year(QScriptContext*context,QScriptEngine*engine);
  2221. /*:204*//*205:*/
  2222. #line 5230 "./typica.w"
  2223. QScriptValue findChildObject(QScriptContext*context,QScriptEngine*engine);
  2224. /*:205*//*209:*/
  2225. #line 5361 "./typica.w"
  2226. void setSaltTableProperties(QScriptValue value,QScriptEngine*engine);
  2227. QScriptValue SaltTable_bindableColumnArray(QScriptContext*context,
  2228. QScriptEngine*engine);
  2229. QScriptValue SaltTable_bindableQuotedColumnArray(QScriptContext*context,
  2230. QScriptEngine*engine);
  2231. QScriptValue SaltTable_columnSum(QScriptContext*context,
  2232. QScriptEngine*engine);
  2233. QScriptValue SaltTable_columnArray(QScriptContext*context,
  2234. QScriptEngine*engine);
  2235. QScriptValue SaltTable_data(QScriptContext*context,QScriptEngine*engine);
  2236. QScriptValue SaltTable_model(QScriptContext*context,QScriptEngine*engine);
  2237. QScriptValue SaltTable_quotedColumnArray(QScriptContext*context,
  2238. QScriptEngine*engine);
  2239. QScriptValue SaltTable_setData(QScriptContext*context,QScriptEngine*engine);
  2240. QScriptValue SaltTable_clear(QScriptContext*context,QScriptEngine*engine);
  2241. QScriptValue SaltTable_removeRow(QScriptContext*context,QScriptEngine*engine);
  2242. QScriptValue SaltTable_findData(QScriptContext*context,QScriptEngine*engine);
  2243. /*:209*//*219:*/
  2244. #line 5577 "./typica.w"
  2245. void setSqlComboBoxProperties(QScriptValue value,QScriptEngine*engine);
  2246. void setQComboBoxProperties(QScriptValue value,QScriptEngine*engine);
  2247. QScriptValue QComboBox_currentData(QScriptContext*context,
  2248. QScriptEngine*engine);
  2249. QScriptValue QComboBox_addItem(QScriptContext*context,QScriptEngine*engine);
  2250. QScriptValue QComboBox_setModel(QScriptContext*context,QScriptEngine*engine);
  2251. QScriptValue QComboBox_findText(QScriptContext*context,QScriptEngine*engine);
  2252. QScriptValue QComboBox_findData(QScriptContext*context,QScriptEngine*engine);
  2253. /*:219*//*231:*/
  2254. #line 366 "./units.w"
  2255. QScriptValue Units_convertTemperature(QScriptContext*context,QScriptEngine*engine);
  2256. QScriptValue Units_convertRelativeTemperature(QScriptContext*context,
  2257. QScriptEngine*engine);
  2258. QScriptValue Units_isTemperatureUnit(QScriptContext*context,QScriptEngine*engine);
  2259. QScriptValue Units_convertWeight(QScriptContext*context,QScriptEngine*engine);
  2260. QScriptValue Units_isWeightUnit(QScriptContext*context,QScriptEngine*engine);
  2261. /*:231*//*235:*/
  2262. #line 430 "./units.w"
  2263. QScriptValue Unit_toScriptValue(QScriptEngine*engine,const Units::Unit&value);
  2264. void Unit_fromScriptValue(const QScriptValue&sv,Units::Unit&value);
  2265. /*:235*//*258:*/
  2266. #line 6211 "./typica.w"
  2267. QScriptValue constructDAQ(QScriptContext*context,QScriptEngine*engine);
  2268. QScriptValue DAQ_newChannel(QScriptContext*context,QScriptEngine*engine);
  2269. void setDAQProperties(QScriptValue value,QScriptEngine*engine);
  2270. /*:258*//*267:*/
  2271. #line 6416 "./typica.w"
  2272. QScriptValue constructFakeDAQ(QScriptContext*context,QScriptEngine*engine);
  2273. QScriptValue FakeDAQ_newChannel(QScriptContext*context,QScriptEngine*engine);
  2274. void setFakeDAQProperties(QScriptValue value,QScriptEngine*engine);
  2275. /*:267*//*272:*/
  2276. #line 6517 "./typica.w"
  2277. void setChannelProperties(QScriptValue value,QScriptEngine*engine);
  2278. /*:272*//*278:*/
  2279. #line 6699 "./typica.w"
  2280. QScriptValue constructLinearCalibrator(QScriptContext*context,
  2281. QScriptEngine*engine);
  2282. void setLinearCalibratorProperties(QScriptValue value,QScriptEngine*engine);
  2283. /*:278*//*283:*/
  2284. #line 6839 "./typica.w"
  2285. QScriptValue constructLinearSplineInterpolator(QScriptContext*context,QScriptEngine*engine);
  2286. void setLinearSplineInterpolatorProperties(QScriptValue value,QScriptEngine*engine);
  2287. /*:283*//*293:*/
  2288. #line 7041 "./typica.w"
  2289. QScriptValue constructTemperatureDisplay(QScriptContext*context,
  2290. QScriptEngine*engine);
  2291. void setTemperatureDisplayProperties(QScriptValue value,QScriptEngine*engine);
  2292. QScriptValue TemperatureDisplay_setDisplayUnits(QScriptContext*context,
  2293. QScriptEngine*engine);
  2294. /*:293*//*301:*/
  2295. #line 7200 "./typica.w"
  2296. QScriptValue constructMeasurementTimeOffset(QScriptContext*context,
  2297. QScriptEngine*engine);
  2298. void setMeasurementTimeOffsetProperties(QScriptValue value,
  2299. QScriptEngine*engine);
  2300. /*:301*//*306:*/
  2301. #line 7313 "./typica.w"
  2302. QScriptValue constructThresholdDetector(QScriptContext*context,QScriptEngine*engine);
  2303. void setThresholdDetectorProperties(QScriptValue value,QScriptEngine*engine);
  2304. /*:306*//*311:*/
  2305. #line 7411 "./typica.w"
  2306. QScriptValue constructZeroEmitter(QScriptContext*context,
  2307. QScriptEngine*engine);
  2308. void setZeroEmitterProperties(QScriptValue value,QScriptEngine*engine);
  2309. /*:311*//*316:*/
  2310. #line 7490 "./typica.w"
  2311. QScriptValue constructMeasurementAdapter(QScriptContext*context,
  2312. QScriptEngine*engine);
  2313. void setMeasurementAdapterProperties(QScriptValue value,QScriptEngine*engine);
  2314. /*:316*//*333:*/
  2315. #line 7954 "./typica.w"
  2316. void setGraphViewProperties(QScriptValue value,QScriptEngine*engine);
  2317. QScriptValue constructGraphView(QScriptContext*context,QScriptEngine*engine);
  2318. /*:333*//*356:*/
  2319. #line 8581 "./typica.w"
  2320. void setZoomLogProperties(QScriptValue value,QScriptEngine*engine);
  2321. QScriptValue constructZoomLog(QScriptContext*context,QScriptEngine*engine);
  2322. QScriptValue ZoomLog_saveXML(QScriptContext*context,QScriptEngine*engine);
  2323. QScriptValue ZoomLog_saveCSV(QScriptContext*context,QScriptEngine*engine);
  2324. QScriptValue ZoomLog_saveState(QScriptContext*context,QScriptEngine*engine);
  2325. QScriptValue ZoomLog_restoreState(QScriptContext*context,
  2326. QScriptEngine*engine);
  2327. QScriptValue ZoomLog_lastTime(QScriptContext*context,QScriptEngine*engine);
  2328. QScriptValue ZoomLog_saveTemporary(QScriptContext*context,
  2329. QScriptEngine*engnie);
  2330. QScriptValue ZoomLog_setDisplayUnits(QScriptContext*context,
  2331. QScriptEngine*engine);
  2332. /*:356*//*394:*/
  2333. #line 9538 "./typica.w"
  2334. QScriptValue constructAnnotationButton(QScriptContext*context,
  2335. QScriptEngine*engine);
  2336. void setAnnotationButtonProperties(QScriptValue value,QScriptEngine*engine);
  2337. /*:394*//*402:*/
  2338. #line 9678 "./typica.w"
  2339. QScriptValue constructAnnotationSpinBox(QScriptContext*context,
  2340. QScriptEngine*engine);
  2341. void setAnnotationSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  2342. void setQDoubleSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  2343. void setQAbstractSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  2344. /*:402*//*423:*/
  2345. #line 10101 "./typica.w"
  2346. QScriptValue constructTimerDisplay(QScriptContext*context,
  2347. QScriptEngine*engine);
  2348. void setTimerDisplayProperties(QScriptValue value,QScriptEngine*engine);
  2349. /*:423*//*450:*/
  2350. #line 10595 "./typica.w"
  2351. void setWidgetDecoratorProperties(QScriptValue value,QScriptEngine*engine);
  2352. QScriptValue constructWidgetDecorator(QScriptContext*context,
  2353. QScriptEngine*engine);
  2354. /*:450*//*463:*/
  2355. #line 10878 "./typica.w"
  2356. QScriptValue constructLogEditWindow(QScriptContext*context,
  2357. QScriptEngine*engine);
  2358. /*:463*//*482:*/
  2359. #line 11406 "./typica.w"
  2360. QScriptValue constructXMLInput(QScriptContext*context,QScriptEngine*engine);
  2361. QScriptValue XMLInput_input(QScriptContext*context,QScriptEngine*engine);
  2362. /*:482*//*500:*/
  2363. #line 186 "./webview.w"
  2364. QScriptValue constructWebView(QScriptContext*context,QScriptEngine*engine);
  2365. void setQWebViewProperties(QScriptValue value,QScriptEngine*engine);
  2366. void addWebViewToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2367. QStack<QLayout*> *layoutStack);
  2368. /*:500*//*503:*/
  2369. #line 216 "./webview.w"
  2370. QScriptValue QWebElement_toScriptValue(QScriptEngine*engine,const QWebElement&element);
  2371. void QWebElement_fromScriptValue(const QScriptValue&value,QWebElement&element);
  2372. /*:503*//*507:*/
  2373. #line 274 "./webview.w"
  2374. QScriptValue constructWebElement(QScriptContext*context,
  2375. QScriptEngine*engine);
  2376. /*:507*//*573:*/
  2377. #line 12719 "./typica.w"
  2378. void setSqlQueryViewProperties(QScriptValue value,QScriptEngine*engine);
  2379. QScriptValue constructSqlQueryView(QScriptContext*context,
  2380. QScriptEngine*engine);
  2381. QScriptValue SqlQueryView_setQuery(QScriptContext*context,
  2382. QScriptEngine*engine);
  2383. QScriptValue SqlQueryView_setHeaderData(QScriptContext*context,
  2384. QScriptEngine*engine);
  2385. /*:573*//*583:*/
  2386. #line 12956 "./typica.w"
  2387. void addReportToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2388. QStack<QLayout*> *layoutStack);
  2389. /*:583*//*599:*/
  2390. #line 13241 "./typica.w"
  2391. void setQTextEditProperties(QScriptValue value,QScriptEngine*engine);
  2392. QScriptValue QTextEdit_print(QScriptContext*context,QScriptEngine*engine);
  2393. /*:599*//*621:*/
  2394. #line 470 "./daterangeselector.w"
  2395. void addDateRangeToLayout(QDomElement element,
  2396. QStack<QWidget*> *widgetStack,
  2397. QStack<QLayout*> *layoutStack);
  2398. /*:621*//*630:*/
  2399. #line 13438 "./typica.w"
  2400. void addFormArrayToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2401. QStack<QLayout*> *layoutStack);
  2402. /*:630*//*651:*/
  2403. #line 14022 "./typica.w"
  2404. void addScaleControlToLayout(QDomElement element,
  2405. QStack<QWidget*> *widgetStack,
  2406. QStack<QLayout*> *layoutStack);
  2407. void addIntensityControlToLayout(QDomElement element,
  2408. QStack<QWidget*> *widgetStack,
  2409. QStack<QLayout*> *layoutStack);
  2410. /*:651*//*677:*/
  2411. #line 14608 "./typica.w"
  2412. QScriptValue constructDeviceTreeModel(QScriptContext*context,
  2413. QScriptEngine*engine);
  2414. void setDeviceTreeModelProperties(QScriptValue value,QScriptEngine*engine);
  2415. void setQAbstractItemModelProperties(QScriptValue value,QScriptEngine*engine);
  2416. QScriptValue DeviceTreeModel_referenceElement(QScriptContext*context,
  2417. QScriptEngine*engine);
  2418. QScriptValue QAbstractItemModel_data(QScriptContext*context,QScriptEngine*engine);
  2419. QScriptValue QAbstractItemModel_index(QScriptContext*context,QScriptEngine*engine);
  2420. QScriptValue QAbstractItemModel_rowCount(QScriptContext*context,QScriptEngine*engine);
  2421. QScriptValue QAbstractItemModel_hasChildren(QScriptContext*context,QScriptEngine*engine);
  2422. /*:677*//*683:*/
  2423. #line 14750 "./typica.w"
  2424. QScriptValue QModelIndex_toScriptValue(QScriptEngine*engine,const QModelIndex&index);
  2425. void QModelIndex_fromScriptValue(const QScriptValue&value,QModelIndex&index);
  2426. /*:683*//*699:*/
  2427. #line 15047 "./typica.w"
  2428. QScriptValue constructDeviceConfigurationWindow(QScriptContext*context,
  2429. QScriptEngine*engine);
  2430. /*:699*//*770:*/
  2431. #line 40 "./settings.w"
  2432. QScriptValue constructSettingsWindow(QScriptContext*context,QScriptEngine*engine);
  2433. /*:770*//*789:*/
  2434. #line 17585 "./typica.w"
  2435. QScriptValue constructModbusRTUDevice(QScriptContext*context,QScriptEngine*engine);
  2436. QScriptValue ModbusRTUDevice_pVChannel(QScriptContext*context,QScriptEngine*engine);
  2437. QScriptValue ModbusRTUDevice_sVChannel(QScriptContext*context,QScriptEngine*engine);
  2438. void setModbusRTUDeviceProperties(QScriptValue value,QScriptEngine*engine);
  2439. /*:789*//*813:*/
  2440. #line 138 "./rate.w"
  2441. QScriptValue constructRateOfChange(QScriptContext*context,QScriptEngine*engine);
  2442. void setRateOfChangeProperties(QScriptValue value,QScriptEngine*engine);
  2443. /*:813*//*838:*/
  2444. #line 597 "./dataqsdk.w"
  2445. QScriptValue constructDataqSdkDevice(QScriptContext*context,QScriptEngine*engine);
  2446. QScriptValue DataqSdkDevice_newChannel(QScriptContext*context,QScriptEngine*engine);
  2447. void setDataqSdkDeviceProperties(QScriptValue value,QScriptEngine*engine);
  2448. /*:838*//*865:*/
  2449. #line 67 "./scales.w"
  2450. QScriptValue constructDragLabel(QScriptContext*context,QScriptEngine*engine);
  2451. void setDragLabelProperties(QScriptValue value,QScriptEngine*engine);
  2452. /*:865*//*873:*/
  2453. #line 233 "./scales.w"
  2454. QScriptValue constructSerialScale(QScriptContext*context,QScriptEngine*engine);
  2455. void setSerialScaleProperties(QScriptValue value,QScriptEngine*engine);
  2456. /*:873*//*876:*/
  2457. #line 258 "./scales.w"
  2458. QScriptValue BaudRateType_toScriptValue(QScriptEngine*engine,const BaudRateType&value);
  2459. void BaudRateType_fromScriptValue(const QScriptValue&sv,BaudRateType&value);
  2460. QScriptValue DataBitsType_toScriptValue(QScriptEngine*engine,const DataBitsType&value);
  2461. void DataBitsType_fromScriptValue(const QScriptValue&sv,DataBitsType&value);
  2462. QScriptValue ParityType_toScriptValue(QScriptEngine*engine,const ParityType&value);
  2463. void ParityType_fromScriptValue(const QScriptValue&sv,ParityType&value);
  2464. QScriptValue StopBitsType_toScriptValue(QScriptEngine*engine,const StopBitsType&value);
  2465. void StopBitsType_fromScriptValue(const QScriptValue&sv,StopBitsType&value);
  2466. QScriptValue FlowType_toScriptValue(QScriptEngine*engine,const FlowType&value);
  2467. void FlowType_fromScriptValue(const QScriptValue&sv,FlowType&value);
  2468. /*:876*//*901:*/
  2469. #line 265 "./valueannotation.w"
  2470. QScriptValue constructValueAnnotation(QScriptContext*context,QScriptEngine*engine);
  2471. void setValueAnnotationProperties(QScriptValue value,QScriptEngine*engine);
  2472. /*:901*/
  2473. #line 527 "./typica.w"
  2474. /*4:*/
  2475. #line 535 "./typica.w"
  2476. /*691:*/
  2477. #line 14871 "./typica.w"
  2478. NodeInserter::NodeInserter(const QString&title,const QString&name,
  2479. const QString&driver,QObject*parent):
  2480. QAction(title,parent),defaultNodeName(name),driverString(driver)
  2481. {
  2482. connect(this,SIGNAL(triggered()),this,SLOT(onTriggered()));
  2483. }
  2484. void NodeInserter::onTriggered()
  2485. {
  2486. emit triggered(defaultNodeName,driverString);
  2487. }
  2488. /*:691*/
  2489. #line 536 "./typica.w"
  2490. /*240:*/
  2491. #line 40 "./measurement.w"
  2492. Measurement::Measurement(double temperature,QTime time,Units::Unit sc)
  2493. {
  2494. insert("measurement",temperature);
  2495. insert("time",time);
  2496. insert("unit",sc);
  2497. }
  2498. Measurement::Measurement(double temperature)
  2499. {
  2500. insert("measurement",temperature);
  2501. insert("time",QTime::currentTime());
  2502. insert("unit",Units::Fahrenheit);
  2503. }
  2504. void Measurement::setTemperature(double temperature)
  2505. {
  2506. insert("measurement",temperature);
  2507. }
  2508. void Measurement::setTime(QTime time)
  2509. {
  2510. insert("time",time);
  2511. }
  2512. void Measurement::setUnit(Units::Unit scale)
  2513. {
  2514. insert("unit",scale);
  2515. }
  2516. double Measurement::temperature()const
  2517. {
  2518. return value("measurement").toDouble();
  2519. }
  2520. QTime Measurement::time()const
  2521. {
  2522. return value("time").toTime();
  2523. }
  2524. Units::Unit Measurement::scale()const
  2525. {
  2526. return(Units::Unit)(value("unit").toInt());
  2527. }
  2528. /*:240*//*241:*/
  2529. #line 88 "./measurement.w"
  2530. Measurement Measurement::toFahrenheit()
  2531. {
  2532. return Measurement(Units::convertTemperature(this->temperature(),
  2533. this->scale(),Units::Fahrenheit),
  2534. this->time(),Units::Fahrenheit);
  2535. }
  2536. Measurement Measurement::toCelsius()
  2537. {
  2538. return Measurement(Units::convertTemperature(this->temperature(),
  2539. this->scale(),Units::Celsius),
  2540. this->time(),Units::Celsius);
  2541. }
  2542. Measurement Measurement::toKelvin()
  2543. {
  2544. return Measurement(Units::convertTemperature(this->temperature(),
  2545. this->scale(),Units::Kelvin),
  2546. this->time(),Units::Kelvin);
  2547. }
  2548. Measurement Measurement::toRankine()
  2549. {
  2550. return Measurement(Units::convertTemperature(this->temperature(),
  2551. this->scale(),Units::Rankine),
  2552. this->time(),Units::Rankine);
  2553. }
  2554. /*:241*/
  2555. #line 537 "./typica.w"
  2556. /*248:*/
  2557. #line 5817 "./typica.w"
  2558. void DAQImplementation::measure()
  2559. {
  2560. int samplesRead= 0;
  2561. double buffer[channels];
  2562. error= read((unsigned int)(handle),(signed long)(1),(double)(10.0),
  2563. (unsigned long)(0),buffer,(unsigned long)(channels),
  2564. &samplesRead,(signed long)(0));
  2565. if(error)
  2566. {
  2567. ready= false;
  2568. }
  2569. else
  2570. {
  2571. if(samplesRead)
  2572. {
  2573. QTime time= QTime::currentTime();
  2574. for(int i= 0;i<samplesRead;i++)
  2575. {
  2576. for(int j= 0;j<channels;j++)
  2577. {
  2578. Measurement measure(buffer[j+(i*channels)],time,
  2579. unitMap[j]);
  2580. channelMap[j]->input(measure);
  2581. }
  2582. }
  2583. }
  2584. }
  2585. }
  2586. /*:248*//*249:*/
  2587. #line 5859 "./typica.w"
  2588. void DAQImplementation::run()
  2589. {
  2590. setPriority(QThread::TimeCriticalPriority);
  2591. while(ready)
  2592. {
  2593. measure();
  2594. }
  2595. }
  2596. /*:249*//*250:*/
  2597. #line 5875 "./typica.w"
  2598. void DAQ::threadFinished()
  2599. {
  2600. if(imp->error)
  2601. {
  2602. /*251:*/
  2603. #line 5926 "./typica.w"
  2604. imp->ready= false;
  2605. QMessageBox warning;
  2606. warning.setStandardButtons(QMessageBox::Cancel);
  2607. warning.setIcon(QMessageBox::Warning);
  2608. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2609. unsigned long bytes= imp->errorInfo(NULL,0);
  2610. char string[bytes];
  2611. imp->errorInfo(string,bytes);
  2612. warning.setInformativeText(QString(string));
  2613. warning.setWindowTitle(QString(PROGRAM_NAME));
  2614. warning.exec();
  2615. /*:251*/
  2616. #line 5880 "./typica.w"
  2617. }
  2618. }
  2619. /*:250*//*252:*/
  2620. #line 5951 "./typica.w"
  2621. void DAQ::start()
  2622. {
  2623. if(imp->ready)
  2624. {
  2625. imp->error= imp->startTask(imp->handle);
  2626. if(imp->error)
  2627. {
  2628. /*251:*/
  2629. #line 5926 "./typica.w"
  2630. imp->ready= false;
  2631. QMessageBox warning;
  2632. warning.setStandardButtons(QMessageBox::Cancel);
  2633. warning.setIcon(QMessageBox::Warning);
  2634. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2635. unsigned long bytes= imp->errorInfo(NULL,0);
  2636. char string[bytes];
  2637. imp->errorInfo(string,bytes);
  2638. warning.setInformativeText(QString(string));
  2639. warning.setWindowTitle(QString(PROGRAM_NAME));
  2640. warning.exec();
  2641. /*:251*/
  2642. #line 5959 "./typica.w"
  2643. }
  2644. else
  2645. {
  2646. connect(imp,SIGNAL(finished()),this,SLOT(threadFinished()));
  2647. imp->start();
  2648. }
  2649. }
  2650. }
  2651. void DAQ::stop()
  2652. {
  2653. if(imp->useBase)
  2654. {
  2655. imp->ready= false;
  2656. imp->wait(ULONG_MAX);
  2657. imp->stopTask(imp->handle);
  2658. }
  2659. else
  2660. {
  2661. imp->ready= false;
  2662. imp->error= imp->stopTask(imp->handle);
  2663. if(imp->error)
  2664. {
  2665. /*251:*/
  2666. #line 5926 "./typica.w"
  2667. imp->ready= false;
  2668. QMessageBox warning;
  2669. warning.setStandardButtons(QMessageBox::Cancel);
  2670. warning.setIcon(QMessageBox::Warning);
  2671. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2672. unsigned long bytes= imp->errorInfo(NULL,0);
  2673. char string[bytes];
  2674. imp->errorInfo(string,bytes);
  2675. warning.setInformativeText(QString(string));
  2676. warning.setWindowTitle(QString(PROGRAM_NAME));
  2677. warning.exec();
  2678. /*:251*/
  2679. #line 5983 "./typica.w"
  2680. }
  2681. imp->error= imp->clearTask(imp->handle);
  2682. if(imp->error)
  2683. {
  2684. /*251:*/
  2685. #line 5926 "./typica.w"
  2686. imp->ready= false;
  2687. QMessageBox warning;
  2688. warning.setStandardButtons(QMessageBox::Cancel);
  2689. warning.setIcon(QMessageBox::Warning);
  2690. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2691. unsigned long bytes= imp->errorInfo(NULL,0);
  2692. char string[bytes];
  2693. imp->errorInfo(string,bytes);
  2694. warning.setInformativeText(QString(string));
  2695. warning.setWindowTitle(QString(PROGRAM_NAME));
  2696. warning.exec();
  2697. /*:251*/
  2698. #line 5988 "./typica.w"
  2699. }
  2700. }
  2701. }
  2702. /*:252*//*253:*/
  2703. #line 5998 "./typica.w"
  2704. DAQ::DAQ(QString device,const QString&driver):imp(new DAQImplementation(driver))
  2705. {
  2706. imp->device= device;
  2707. imp->error= imp->createTask(device.toAscii().data(),&(imp->handle));
  2708. if(imp->error)
  2709. {
  2710. /*251:*/
  2711. #line 5926 "./typica.w"
  2712. imp->ready= false;
  2713. QMessageBox warning;
  2714. warning.setStandardButtons(QMessageBox::Cancel);
  2715. warning.setIcon(QMessageBox::Warning);
  2716. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2717. unsigned long bytes= imp->errorInfo(NULL,0);
  2718. char string[bytes];
  2719. imp->errorInfo(string,bytes);
  2720. warning.setInformativeText(QString(string));
  2721. warning.setWindowTitle(QString(PROGRAM_NAME));
  2722. warning.exec();
  2723. /*:251*/
  2724. #line 6005 "./typica.w"
  2725. }
  2726. else
  2727. {
  2728. imp->ready= true;
  2729. }
  2730. }
  2731. /*:253*//*254:*/
  2732. #line 6019 "./typica.w"
  2733. Channel*DAQ::newChannel(int units,int thermocouple)
  2734. {
  2735. Channel*retval= new Channel();
  2736. imp->channelMap[imp->channels]= retval;
  2737. imp->unitMap[imp->channels]= (Units::Unit)units;
  2738. imp->channels++;
  2739. if(imp->ready)
  2740. {
  2741. if(imp->useBase)
  2742. {
  2743. imp->error= imp->createChannel(imp->handle,
  2744. QString("%1/ai%2").arg(imp->device).
  2745. arg(imp->channels-1).
  2746. toAscii().data(),
  2747. "",(double)(-1.0),(double)(100.0),
  2748. (signed long)(units),
  2749. (signed long)(thermocouple),
  2750. (signed long)(10200),(double)(0),
  2751. "");
  2752. }
  2753. else
  2754. {
  2755. imp->error= imp->createChannel(imp->handle,
  2756. QString("%1/ai%2").arg(imp->device).
  2757. arg(imp->channels-1).
  2758. toAscii().data(),
  2759. "",(double)(50.0),(double)(500.0),
  2760. (signed long)(units),
  2761. (signed long)(thermocouple),
  2762. (signed long)(10200),(double)(0),
  2763. "");
  2764. }
  2765. if(imp->error)
  2766. {
  2767. /*251:*/
  2768. #line 5926 "./typica.w"
  2769. imp->ready= false;
  2770. QMessageBox warning;
  2771. warning.setStandardButtons(QMessageBox::Cancel);
  2772. warning.setIcon(QMessageBox::Warning);
  2773. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2774. unsigned long bytes= imp->errorInfo(NULL,0);
  2775. char string[bytes];
  2776. imp->errorInfo(string,bytes);
  2777. warning.setInformativeText(QString(string));
  2778. warning.setWindowTitle(QString(PROGRAM_NAME));
  2779. warning.exec();
  2780. /*:251*/
  2781. #line 6054 "./typica.w"
  2782. }
  2783. }
  2784. return retval;
  2785. }
  2786. /*:254*//*255:*/
  2787. #line 6068 "./typica.w"
  2788. void DAQ::setClockRate(double Hz)
  2789. {
  2790. if(imp->ready)
  2791. {
  2792. imp->error= imp->setClock(imp->handle,"OnboardClock",Hz,
  2793. (signed long)(10280),(signed long)(10123),
  2794. (unsigned long long)(1));
  2795. if(imp->error)
  2796. {
  2797. /*251:*/
  2798. #line 5926 "./typica.w"
  2799. imp->ready= false;
  2800. QMessageBox warning;
  2801. warning.setStandardButtons(QMessageBox::Cancel);
  2802. warning.setIcon(QMessageBox::Warning);
  2803. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  2804. unsigned long bytes= imp->errorInfo(NULL,0);
  2805. char string[bytes];
  2806. imp->errorInfo(string,bytes);
  2807. warning.setInformativeText(QString(string));
  2808. warning.setWindowTitle(QString(PROGRAM_NAME));
  2809. warning.exec();
  2810. /*:251*/
  2811. #line 6078 "./typica.w"
  2812. }
  2813. }
  2814. }
  2815. /*:255*//*256:*/
  2816. #line 6088 "./typica.w"
  2817. DAQ::~DAQ()
  2818. {
  2819. if(imp->useBase)
  2820. {
  2821. imp->resetDevice(imp->device.toAscii().data());
  2822. imp->clearTask(imp->handle);
  2823. }
  2824. else
  2825. {
  2826. if(imp->ready)
  2827. {
  2828. imp->ready= false;
  2829. imp->wait(ULONG_MAX);
  2830. imp->stopTask(imp->handle);
  2831. imp->resetDevice(imp->device.toAscii().data());
  2832. imp->clearTask(imp->handle);
  2833. }
  2834. }
  2835. delete imp;
  2836. }
  2837. /*:256*//*257:*/
  2838. #line 6119 "./typica.w"
  2839. DAQImplementation::DAQImplementation(const QString&driverinfo)
  2840. :QThread(NULL),channelMap(4),handle(0),error(0),channels(0),ready(false),
  2841. unitMap(4)
  2842. {
  2843. if(driverinfo=="nidaqmxbase")
  2844. {
  2845. useBase= true;
  2846. }
  2847. else
  2848. {
  2849. useBase= false;
  2850. }
  2851. if(useBase)
  2852. {
  2853. driver.setFileName("nidaqmxbase.framework/nidaqmxbase");
  2854. if(!driver.load())
  2855. {
  2856. driver.setFileName("nidaqmxbase");
  2857. if(!driver.load())
  2858. {
  2859. QMessageBox::critical(NULL,tr("Typica: Driver not found"),
  2860. tr("Failed to find nidaqmxbase. Please install it."));
  2861. QApplication::quit();
  2862. }
  2863. }
  2864. }
  2865. else
  2866. {
  2867. driver.setFileName("nicaiu");
  2868. if(!driver.load())
  2869. {
  2870. QMessageBox::critical(NULL,tr("Typica: Driver not found"),
  2871. tr("Failed to find nidaqmx. Please install it."));
  2872. QApplication::quit();
  2873. }
  2874. }
  2875. if(useBase)
  2876. {
  2877. if((createTask= (daqfp)driver.resolve("DAQmxBaseCreateTask"))==0||
  2878. (startTask= (daqfp)driver.resolve("DAQmxBaseStartTask"))==0||
  2879. (stopTask= (daqfp)driver.resolve("DAQmxBaseStopTask"))==0||
  2880. (clearTask= (daqfp)driver.resolve("DAQmxBaseClearTask"))==0||
  2881. (createChannel= (daqfp)driver.resolve("DAQmxBaseCreateAIThrmcplChan"))
  2882. ==0||
  2883. (setClock= (daqfp)driver.resolve("DAQmxBaseCfgSampClkTiming"))==
  2884. 0||
  2885. (read= (daqfp)driver.resolve("DAQmxBaseReadAnalogF64"))==0||
  2886. (errorInfo= (daqfp)driver.resolve("DAQmxBaseGetExtendedErrorInfo"))==
  2887. 0||
  2888. (resetDevice= (daqfp)driver.resolve("DAQmxBaseResetDevice"))==0)
  2889. {
  2890. waitForMeasurement= NULL;
  2891. QMessageBox::critical(NULL,tr("Typica: Link error"),
  2892. tr("Failed to link a required symbol in NI-DAQmxBase."));
  2893. QApplication::quit();
  2894. }
  2895. }
  2896. else
  2897. {
  2898. if((createTask= (daqfp)driver.resolve("DAQmxCreateTask"))==0||
  2899. (startTask= (daqfp)driver.resolve("DAQmxStartTask"))==0||
  2900. (stopTask= (daqfp)driver.resolve("DAQmxStopTask"))==0||
  2901. (clearTask= (daqfp)driver.resolve("DAQmxClearTask"))==0||
  2902. (createChannel= (daqfp)driver.resolve("DAQmxCreateAIThrmcplChan"))
  2903. ==0||
  2904. (setClock= (daqfp)driver.resolve("DAQmxCfgSampClkTiming"))==0||
  2905. (read= (daqfp)driver.resolve("DAQmxReadAnalogF64"))==0||
  2906. (errorInfo= (daqfp)driver.resolve("DAQmxGetExtendedErrorInfo"))==
  2907. 0||
  2908. (resetDevice= (daqfp)driver.resolve("DAQmxResetDevice"))==0||
  2909. (waitForMeasurement= (daqfp)driver.resolve("DAQmxWaitUntilTaskDone"))==0)
  2910. {
  2911. QMessageBox::critical(NULL,tr("Typica: Link error"),
  2912. tr("Failed to link a required symbol in NI-DAQmx."));
  2913. QApplication::quit();
  2914. }
  2915. }
  2916. }
  2917. DAQImplementation::~DAQImplementation()
  2918. {
  2919. driver.unload();
  2920. }
  2921. /*:257*/
  2922. #line 538 "./typica.w"
  2923. /*827:*/
  2924. #line 197 "./dataqsdk.w"
  2925. void DataqSdkDeviceImplementation::measure()
  2926. {
  2927. unsigned count= channels*40;
  2928. di_status_read(buffer,count);
  2929. QTime time= QTime::currentTime();
  2930. for(unsigned int i= 0;i<count;i++)
  2931. {
  2932. buffer[i]= buffer[i]&0xFFFC;
  2933. }
  2934. QList<int> countList;
  2935. for(unsigned int i= 0;i<(unsigned)channels;i++)
  2936. {
  2937. QList<double> channelBuffer;
  2938. for(unsigned int j= 0;j<40;j++)
  2939. {
  2940. channelBuffer<<((double)buffer[i+(channels*j)]*10.0)/32768.0;
  2941. if(i==0)
  2942. {
  2943. countList<<buffer[i+(channels*j)];
  2944. }
  2945. }
  2946. double value= 0.0;
  2947. for(unsigned int j= 0;j<40;j++)
  2948. {
  2949. value+= channelBuffer[j];
  2950. }
  2951. value/= 40.0;
  2952. if(i==0)
  2953. {
  2954. QList<double> smoothingList;
  2955. smoothingList<<value;
  2956. QList<int> smoothingKeys= smoother.uniqueKeys();
  2957. for(int j= 0;j<smoothingKeys.size();j++)
  2958. {
  2959. if(countList.contains(smoothingKeys[j]))
  2960. {
  2961. QList<double> keyValues= smoother.values(smoothingKeys[j]);
  2962. for(int k= 0;k<keyValues.size();k++)
  2963. {
  2964. smoothingList<<keyValues[k];
  2965. }
  2966. }
  2967. else
  2968. {
  2969. smoother.remove(smoothingKeys[j]);
  2970. }
  2971. }
  2972. qSort(countList);
  2973. int lastCount= 0;
  2974. for(int j= 0;j<countList.size();j++)
  2975. {
  2976. if(j==0||countList[j]!=lastCount)
  2977. {
  2978. smoother.insert(countList[j],value);
  2979. lastCount= countList[j];
  2980. }
  2981. }
  2982. value= 0.0;
  2983. for(int j= 0;j<smoothingList.size();j++)
  2984. {
  2985. value+= smoothingList[j];
  2986. }
  2987. value/= smoothingList.size();
  2988. }
  2989. Measurement measure(value,time,unitMap[i]);
  2990. channelMap[i]->input(measure);
  2991. }
  2992. }
  2993. /*:827*//*828:*/
  2994. #line 290 "./dataqsdk.w"
  2995. void DataqSdkDeviceImplementation::run()
  2996. {
  2997. if(!ready)
  2998. {
  2999. error= 9;
  3000. return;
  3001. }
  3002. driver= new QLibrary(device);
  3003. if(!driver->load())
  3004. {
  3005. error= 1;
  3006. qDebug()<<"Failed to load driver: "<<device;
  3007. return;
  3008. }
  3009. di_open= (FPDIOPEN)driver->resolve("di_open");
  3010. di_close= (FPDICLOSE)driver->resolve("di_close");
  3011. di_sample_rate= (FPDISAMPLERATE)driver->resolve("di_sample_rate");
  3012. di_maximum_rate= (FPDIMAXIMUMRATE)driver->resolve("di_maximum_rate");
  3013. di_list_length= (FPDILISTLENGTH)driver->resolve("di_list_length");
  3014. di_inlist= (FPDIINLIST)driver->resolve("di_inlist");
  3015. di_buffer_alloc= (FPDIBUFFERALLOC)driver->resolve("di_buffer_alloc");
  3016. di_start_scan= (FPDISTARTSCAN)driver->resolve("di_start_scan");
  3017. di_status_read= (FPDISTATUSREAD)driver->resolve("di_status_read");
  3018. di_buffer_status= (FPDIBUFFERSTATUS)driver->resolve("di_buffer_status");
  3019. di_burst_rate= (FPDIBURSTRATE)driver->resolve("di_burst_rate");
  3020. di_stop_scan= (FPDISTOPSCAN)driver->resolve("di_stop_scan");
  3021. if((!di_open)||(!di_close)||(!di_sample_rate)||(!di_maximum_rate)||
  3022. (!di_list_length)||(!di_inlist)||(!di_buffer_alloc)||
  3023. (!di_start_scan)||(!di_status_read)||(!di_buffer_status)||
  3024. (!di_burst_rate)||(!di_stop_scan))
  3025. {
  3026. error= 2;
  3027. return;
  3028. }
  3029. error= di_open(deviceNumber);
  3030. if(error)
  3031. {
  3032. di_close();
  3033. error= di_open(deviceNumber);
  3034. if(error)
  3035. {
  3036. error= 3;
  3037. di_close();
  3038. return;
  3039. }
  3040. }
  3041. isOpen= true;
  3042. di_maximum_rate(240.0);
  3043. sampleRate= di_sample_rate(sampleRate*channels*40,&oversample,
  3044. &burstDivisor);
  3045. buffer= new qint16[(int)sampleRate];
  3046. di_inlist_struct inlist[16]= {{0}};
  3047. for(unsigned short i= 0;i<channels;i++)
  3048. {
  3049. inlist[i].chan= i;
  3050. inlist[i].gain= 0;
  3051. inlist[i].ave= 1;
  3052. inlist[i].counter= (oversample-1);
  3053. }
  3054. error= di_list_length(channels,0);
  3055. if(error)
  3056. {
  3057. error= 4;
  3058. return;
  3059. }
  3060. error= di_inlist(inlist);
  3061. if(error)
  3062. {
  3063. error= 5;
  3064. return;
  3065. }
  3066. input_buffer= di_buffer_alloc(0,4096);
  3067. if(input_buffer==NULL)
  3068. {
  3069. error= 6;
  3070. return;
  3071. }
  3072. error= di_start_scan();
  3073. if(error)
  3074. {
  3075. error= 7;
  3076. return;
  3077. }
  3078. while(ready)
  3079. {
  3080. measure();
  3081. }
  3082. }
  3083. /*:828*//*829:*/
  3084. #line 386 "./dataqsdk.w"
  3085. void DataqSdkDevice::threadFinished()
  3086. {
  3087. if(imp->error)
  3088. {
  3089. /*830:*/
  3090. #line 400 "./dataqsdk.w"
  3091. imp->ready= false;
  3092. QMessageBox warning;
  3093. warning.setStandardButtons(QMessageBox::Cancel);
  3094. warning.setIcon(QMessageBox::Warning);
  3095. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  3096. warning.setInformativeText(tr("An error occurred"));
  3097. warning.setWindowTitle(QString(PROGRAM_NAME));
  3098. warning.exec();
  3099. /*:830*/
  3100. #line 391 "./dataqsdk.w"
  3101. }
  3102. }
  3103. /*:829*//*831:*/
  3104. #line 417 "./dataqsdk.w"
  3105. void DataqSdkDevice::start()
  3106. {
  3107. connect(imp,SIGNAL(finished()),this,SLOT(threadFinished()));
  3108. imp->start();
  3109. }
  3110. /*:831*//*832:*/
  3111. #line 428 "./dataqsdk.w"
  3112. QStringList DataqSdkDevice::detectHardware()
  3113. {
  3114. QSettings deviceLookup("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\services\\usbser\\Enum",
  3115. QSettings::NativeFormat);
  3116. QStringList keys= deviceLookup.childKeys();
  3117. QStringList devices;
  3118. for(int i= 0;i<keys.size();i++)
  3119. {
  3120. QString value= deviceLookup.value(keys.at(i)).toString();
  3121. if(value.startsWith("USB\\VID_0683&PID_1450\\"))
  3122. {
  3123. devices.append(value.split("\\").at(2));
  3124. }
  3125. }
  3126. QStringList portList;
  3127. foreach(QString device,devices)
  3128. {
  3129. QString deviceKey= QString("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\USB\\VID_0683&PID_1450\\%1").arg(device);
  3130. QSettings deviceEntry(deviceKey,QSettings::NativeFormat);
  3131. portList.append(deviceEntry.value("FriendlyName").toString());
  3132. }
  3133. return portList;
  3134. }
  3135. QStringList DataqSdkDevice::detectPorts()
  3136. {
  3137. QStringList friendlyNames= detectHardware();
  3138. QStringList portList;
  3139. foreach(QString name,friendlyNames)
  3140. {
  3141. name.remove(0,name.indexOf("COM"));
  3142. name.chop(1);
  3143. portList.append(name);
  3144. }
  3145. return portList;
  3146. }
  3147. /*:832*//*833:*/
  3148. #line 473 "./dataqsdk.w"
  3149. DataqSdkDevice::DataqSdkDevice(QString device):imp(new DataqSdkDeviceImplementation)
  3150. {
  3151. bool usesAuto= false;
  3152. int autoIndex= device.toInt(&usesAuto);
  3153. QString finalizedPort;
  3154. if(usesAuto)
  3155. {
  3156. QStringList portList= detectPorts();
  3157. if(autoIndex> 0&&autoIndex<=portList.size())
  3158. {
  3159. finalizedPort= portList.at(autoIndex-1);
  3160. }
  3161. else
  3162. {
  3163. imp->error= 8;
  3164. qDebug()<<"Failed to detect port.";
  3165. }
  3166. }
  3167. else
  3168. {
  3169. finalizedPort= device;
  3170. }
  3171. int rstart= finalizedPort.indexOf("COM");
  3172. finalizedPort.remove(0,rstart+3);
  3173. bool chopFinished= false;
  3174. int finalizedPortNumber= 0;
  3175. while(finalizedPort.size()> 0&&!chopFinished)
  3176. {
  3177. finalizedPortNumber= finalizedPort.toInt(&chopFinished);
  3178. if(!chopFinished)
  3179. {
  3180. finalizedPort.chop(1);
  3181. }
  3182. }
  3183. if(finalizedPortNumber<10)
  3184. {
  3185. imp->device= QString("DI10%1NT.DLL").arg(finalizedPort);
  3186. }
  3187. else
  3188. {
  3189. imp->device= QString("DI1%1NT.DLL").arg(finalizedPort);
  3190. }
  3191. imp->deviceNumber= 0x12C02D00;
  3192. imp->deviceNumber+= finalizedPortNumber;
  3193. imp->ready= true;
  3194. }
  3195. /*:833*//*834:*/
  3196. #line 523 "./dataqsdk.w"
  3197. Channel*DataqSdkDevice::newChannel(Units::Unit scale)
  3198. {
  3199. Channel*retval= NULL;
  3200. if(imp->ready)
  3201. {
  3202. retval= new Channel();
  3203. imp->channelMap[imp->channels]= retval;
  3204. imp->unitMap[imp->channels]= scale;
  3205. imp->channels++;
  3206. }
  3207. return retval;
  3208. }
  3209. /*:834*//*835:*/
  3210. #line 547 "./dataqsdk.w"
  3211. void DataqSdkDevice::setClockRate(double Hz)
  3212. {
  3213. imp->sampleRate= Hz;
  3214. }
  3215. /*:835*//*836:*/
  3216. #line 557 "./dataqsdk.w"
  3217. DataqSdkDevice::~DataqSdkDevice()
  3218. {
  3219. if(imp->ready)
  3220. {
  3221. imp->ready= false;
  3222. }
  3223. imp->wait(ULONG_MAX);
  3224. delete imp;
  3225. }
  3226. /*:836*//*837:*/
  3227. #line 575 "./dataqsdk.w"
  3228. DataqSdkDeviceImplementation::DataqSdkDeviceImplementation():QThread(NULL),
  3229. channelMap(4),error(0),channels(0),ready(false),unitMap(4)
  3230. {
  3231. }
  3232. DataqSdkDeviceImplementation::~DataqSdkDeviceImplementation()
  3233. {
  3234. if(isOpen)
  3235. {
  3236. di_stop_scan();
  3237. di_close();
  3238. }
  3239. if(driver->isLoaded())
  3240. {
  3241. driver->unload();
  3242. }
  3243. }
  3244. /*:837*/
  3245. #line 539 "./typica.w"
  3246. /*264:*/
  3247. #line 6328 "./typica.w"
  3248. void FakeDAQImplementation::measure()
  3249. {
  3250. msleep((int)(1000/clockRate));
  3251. QTime time= QTime::currentTime();
  3252. for(int i= 0;i<channels;i++)
  3253. {
  3254. Measurement measure(qrand()%500,time);
  3255. channelMap[i]->input(measure);
  3256. }
  3257. }
  3258. /*:264*//*265:*/
  3259. #line 6342 "./typica.w"
  3260. void FakeDAQImplementation::run()
  3261. {
  3262. setPriority(QThread::TimeCriticalPriority);
  3263. while(ready)
  3264. {
  3265. measure();
  3266. }
  3267. }
  3268. FakeDAQImplementation::FakeDAQImplementation():QThread(NULL),channelMap(4),
  3269. channels(0),ready(false),clockRate(1)
  3270. {
  3271. }
  3272. FakeDAQImplementation::~FakeDAQImplementation()
  3273. {
  3274. }
  3275. /*:265*//*266:*/
  3276. #line 6367 "./typica.w"
  3277. void FakeDAQ::start()
  3278. {
  3279. if(imp->ready)
  3280. {
  3281. imp->start();
  3282. }
  3283. }
  3284. FakeDAQ::FakeDAQ(QString):imp(new FakeDAQImplementation())
  3285. {
  3286. imp->ready= true;
  3287. }
  3288. Channel*FakeDAQ::newChannel(int,int)
  3289. {
  3290. Channel*retval;
  3291. if(imp->ready)
  3292. {
  3293. retval= new Channel();
  3294. imp->channelMap[imp->channels]= retval;
  3295. imp->channels++;
  3296. }
  3297. else
  3298. {
  3299. return NULL;
  3300. }
  3301. return retval;
  3302. }
  3303. void FakeDAQ::setClockRate(double Hz)
  3304. {
  3305. if(imp->ready)
  3306. {
  3307. imp->clockRate= Hz;
  3308. }
  3309. }
  3310. FakeDAQ::~FakeDAQ()
  3311. {
  3312. imp->ready= false;
  3313. imp->wait(ULONG_MAX);
  3314. delete imp;
  3315. }
  3316. /*:266*/
  3317. #line 540 "./typica.w"
  3318. /*271:*/
  3319. #line 6498 "./typica.w"
  3320. Channel::Channel():QObject(NULL)
  3321. {
  3322. }
  3323. Channel::~Channel()
  3324. {
  3325. }
  3326. void Channel::input(Measurement measurement)
  3327. {
  3328. emit newData(measurement);
  3329. }
  3330. /*:271*/
  3331. #line 541 "./typica.w"
  3332. /*287:*/
  3333. #line 6903 "./typica.w"
  3334. void TemperatureDisplay::setRelativeMode(bool relative)
  3335. {
  3336. r= relative;
  3337. }
  3338. /*:287*//*288:*/
  3339. #line 6920 "./typica.w"
  3340. void TemperatureDisplay::setValue(Measurement temperature)
  3341. {
  3342. QString number;
  3343. switch(unit)
  3344. {
  3345. case Units::Fahrenheit:
  3346. display(QString("%1'F").
  3347. arg(number.setNum(temperature.toFahrenheit().temperature(),'f',
  3348. 2)));
  3349. break;
  3350. case Units::Celsius:
  3351. if(!r){
  3352. display(QString("%1'C").
  3353. arg(number.setNum(temperature.toCelsius().temperature(),'f',
  3354. 2)));
  3355. }else{
  3356. number.setNum(temperature.temperature()*(5.0/9.0),'f',2);
  3357. display(QString("%1'C").arg(number));
  3358. }
  3359. break;
  3360. case Units::Kelvin:
  3361. if(!r){
  3362. display(QString("%1").
  3363. arg(number.setNum(temperature.toKelvin().temperature(),'f',
  3364. 2)));
  3365. }else{
  3366. number.setNum(temperature.temperature()*(5.0/9.0),'f',2);
  3367. display(QString("%1").arg(number));
  3368. }
  3369. break;
  3370. case Units::Rankine:
  3371. display(QString("%1'r").
  3372. arg(number.setNum(temperature.toRankine().temperature(),'f',
  3373. 2)));
  3374. break;
  3375. case Units::Unitless:
  3376. display(QString("%1").arg(number.setNum(temperature.temperature(),'f',0)));
  3377. break;
  3378. default:
  3379. switch(temperature.scale())
  3380. {
  3381. case Units::Fahrenheit:
  3382. display(QString("%1'F").
  3383. arg(number.setNum(temperature.temperature(),'f',2)));
  3384. break;
  3385. case Units::Celsius:
  3386. display(QString("%1'C").
  3387. arg(number.setNum(temperature.temperature(),'f',2)));
  3388. break;
  3389. case Units::Kelvin:
  3390. display(QString("%1").
  3391. arg(number.setNum(temperature.temperature(),'f',2)));
  3392. break;
  3393. case Units::Rankine:
  3394. display(QString("%1'r").
  3395. arg(number.setNum(temperature.temperature(),'f',2)));
  3396. break;
  3397. case Units::Unitless:
  3398. display(QString("%1").arg(number.setNum(temperature.temperature(),'f',0)));
  3399. break;
  3400. }
  3401. break;
  3402. }
  3403. }
  3404. /*:288*//*289:*/
  3405. #line 6996 "./typica.w"
  3406. TemperatureDisplay::TemperatureDisplay(QWidget*parent):
  3407. QLCDNumber(8,parent),unit(Units::Fahrenheit),r(false)
  3408. {
  3409. setSegmentStyle(Filled);
  3410. display("---.--'F");
  3411. }
  3412. /*:289*//*290:*/
  3413. #line 7012 "./typica.w"
  3414. void TemperatureDisplay::invalidate()
  3415. {
  3416. display("---.--'F");
  3417. }
  3418. /*:290*//*291:*/
  3419. #line 7024 "./typica.w"
  3420. void TemperatureDisplay::setDisplayUnits(Units::Unit scale)
  3421. {
  3422. unit= scale;
  3423. }
  3424. /*:291*//*292:*/
  3425. #line 7032 "./typica.w"
  3426. TemperatureDisplay::~TemperatureDisplay()
  3427. {
  3428. }
  3429. /*:292*/
  3430. #line 542 "./typica.w"
  3431. /*298:*/
  3432. #line 7132 "./typica.w"
  3433. void MeasurementTimeOffset::newMeasurement(Measurement measure)
  3434. {
  3435. if(measure.time()<epoch)
  3436. {
  3437. if(hasPrevious)
  3438. {
  3439. QTime jitBase(epoch.hour()-1,epoch.minute(),epoch.second(),
  3440. epoch.msec());
  3441. QTime jitComp(epoch.hour(),measure.time().minute(),
  3442. measure.time().second(),measure.time().msec());
  3443. int relTime= jitBase.msecsTo(jitComp);
  3444. /*299:*/
  3445. #line 7166 "./typica.w"
  3446. QTime newTime(0,0,0,0);
  3447. newTime= newTime.addMSecs(relTime);
  3448. if(newTime.hour()> 0)
  3449. {
  3450. newTime.setHMS(0,newTime.minute(),newTime.second(),newTime.msec());
  3451. }
  3452. Measurement rel= measure;
  3453. rel.setTime(newTime);
  3454. emit measurement(rel);
  3455. /*:299*/
  3456. #line 7144 "./typica.w"
  3457. }
  3458. else
  3459. {
  3460. Measurement rel= measure;
  3461. rel.setTime(QTime(0,0,0,0));
  3462. emit measurement(rel);
  3463. }
  3464. }
  3465. else
  3466. {
  3467. int relTime= epoch.msecsTo(measure.time());
  3468. /*299:*/
  3469. #line 7166 "./typica.w"
  3470. QTime newTime(0,0,0,0);
  3471. newTime= newTime.addMSecs(relTime);
  3472. if(newTime.hour()> 0)
  3473. {
  3474. newTime.setHMS(0,newTime.minute(),newTime.second(),newTime.msec());
  3475. }
  3476. Measurement rel= measure;
  3477. rel.setTime(newTime);
  3478. emit measurement(rel);
  3479. /*:299*/
  3480. #line 7156 "./typica.w"
  3481. }
  3482. hasPrevious= true;
  3483. previous= measure.time();
  3484. }
  3485. /*:298*//*300:*/
  3486. #line 7179 "./typica.w"
  3487. MeasurementTimeOffset::MeasurementTimeOffset(QTime zero):epoch(zero),
  3488. previous(0,0,0,0),hasPrevious(false)
  3489. {
  3490. }
  3491. QTime MeasurementTimeOffset::zeroTime()
  3492. {
  3493. return epoch;
  3494. }
  3495. void MeasurementTimeOffset::setZeroTime(QTime zero)
  3496. {
  3497. epoch= zero;
  3498. hasPrevious= false;
  3499. }
  3500. /*:300*/
  3501. #line 543 "./typica.w"
  3502. /*310:*/
  3503. #line 7377 "./typica.w"
  3504. ZeroEmitter::ZeroEmitter(int tempcolumn):QObject(NULL),col(tempcolumn)
  3505. {
  3506. }
  3507. int ZeroEmitter::column()
  3508. {
  3509. return col;
  3510. }
  3511. double ZeroEmitter::lastTemperature()
  3512. {
  3513. return cache.temperature();
  3514. }
  3515. void ZeroEmitter::newMeasurement(Measurement measure)
  3516. {
  3517. cache= measure;
  3518. }
  3519. void ZeroEmitter::setColumn(int column)
  3520. {
  3521. col= column;
  3522. }
  3523. void ZeroEmitter::emitZero()
  3524. {
  3525. cache.setTime(QTime(0,0,0,0));
  3526. emit measurement(cache,col);
  3527. }
  3528. /*:310*/
  3529. #line 544 "./typica.w"
  3530. /*315:*/
  3531. #line 7467 "./typica.w"
  3532. MeasurementAdapter::MeasurementAdapter(int tempcolumn):col(tempcolumn)
  3533. {
  3534. }
  3535. int MeasurementAdapter::column()
  3536. {
  3537. return col;
  3538. }
  3539. void MeasurementAdapter::newMeasurement(Measurement measure)
  3540. {
  3541. emit measurement(measure,col);
  3542. }
  3543. void MeasurementAdapter::setColumn(int column)
  3544. {
  3545. col= column;
  3546. }
  3547. /*:315*/
  3548. #line 545 "./typica.w"
  3549. /*320:*/
  3550. #line 7589 "./typica.w"
  3551. GraphView::GraphView(QWidget*parent):QGraphicsView(parent),
  3552. theScene(new QGraphicsScene),
  3553. graphLines(new QMap<int,QList<QGraphicsLineItem*> *> ),
  3554. prevPoints(new QMap<int,QPointF> ),
  3555. translations(new QMap<int,double> ),
  3556. gridLinesF(new QList<QGraphicsItem*> ),
  3557. gridLinesC(new QList<QGraphicsItem*> ),
  3558. relativeGridLines(new QList<QGraphicsItem*> ),
  3559. relativeEnabled(false),
  3560. timeIndicatorEnabled(false),
  3561. timeLine(new QGraphicsLineItem),
  3562. relativeAdjuster(new LinearSplineInterpolator)
  3563. {
  3564. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  3565. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  3566. setScene(theScene);
  3567. setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
  3568. QPen timePen;
  3569. timePen.setColor(QColor(160,160,164,127));
  3570. timeLine->setPen(timePen);
  3571. timeLine->setLine(0,0,0,-500);
  3572. timeLine->hide();
  3573. theScene->addItem(timeLine);
  3574. /*321:*/
  3575. #line 7629 "./typica.w"
  3576. QGraphicsLineItem*tempaxis= new QGraphicsLineItem;
  3577. tempaxis->setLine(-10,-500,-10,0);
  3578. theScene->addItem(tempaxis);
  3579. QGraphicsLineItem*gridLine;
  3580. QGraphicsTextItem*label;
  3581. for(int y= -100;y> -600;y-= 100)
  3582. {
  3583. gridLine= new QGraphicsLineItem;
  3584. gridLine->setLine(0,y,1200,y);
  3585. theScene->addItem(gridLine);
  3586. label= new QGraphicsTextItem;
  3587. label->setHtml(QString("%1&deg;F").arg(-y));
  3588. label->setPos(-55,y-(label->boundingRect().height()/2));
  3589. theScene->addItem(label);
  3590. gridLinesF->append(gridLine);
  3591. gridLinesF->append(label);
  3592. }
  3593. for(int degC= 50;degC<=250;degC+= 50)
  3594. {
  3595. gridLine= new QGraphicsLineItem;
  3596. int y= -(degC*(9.0/5.0)+32);
  3597. gridLine->setLine(0,y,1200,y);
  3598. gridLine->hide();
  3599. theScene->addItem(gridLine);
  3600. gridLinesC->append(gridLine);
  3601. label= new QGraphicsTextItem;
  3602. label->setHtml(QString("%1&deg;C").arg(degC));
  3603. label->setPos(-55,y-(label->boundingRect().height()/2));
  3604. label->hide();
  3605. theScene->addItem(label);
  3606. gridLinesC->append(label);
  3607. }
  3608. /*:321*/
  3609. #line 7613 "./typica.w"
  3610. ;
  3611. /*322:*/
  3612. #line 7670 "./typica.w"
  3613. QSettings settings;
  3614. if(settings.contains("settings/graph/relative/enable"))
  3615. {
  3616. if(settings.value("settings/graph/relative/enable").toBool())
  3617. {
  3618. relativeEnabled= true;
  3619. QColor relativeColor= QColor(settings.value("settings/graph/relative/color").toString());
  3620. QString unit= QString(settings.value("settings/graph/relative/unit").toInt()==0?"F":"C");
  3621. QMap<double,QString> relativeAxisPairs;
  3622. QStringList relativeAxisLabels= settings.value("settings/graph/relative/grid").toString().split(QRegExp("[\\s,]+"),QString::SkipEmptyParts);
  3623. foreach(QString item,relativeAxisLabels)
  3624. {
  3625. relativeAxisPairs.insert(item.toDouble(),item);
  3626. }
  3627. if(relativeAxisPairs.size()> 1)
  3628. {
  3629. double skip= 500.0/(relativeAxisPairs.size()-1);
  3630. double y= 0;
  3631. foreach(double key,relativeAxisPairs.keys())
  3632. {
  3633. gridLine= new QGraphicsLineItem;
  3634. gridLine->setLine(0,y,1205,y);
  3635. gridLine->setPen(QPen(relativeColor));
  3636. theScene->addItem(gridLine);
  3637. relativeGridLines->append(gridLine);
  3638. label= new QGraphicsTextItem;
  3639. label->setHtml(QString("%1&deg;%2").arg(relativeAxisPairs.value(key)).arg(unit));
  3640. label->setPos(1210,y-(label->boundingRect().height()/2));
  3641. theScene->addItem(label);
  3642. relativeGridLines->append(label);
  3643. if(unit=="F")
  3644. {
  3645. relativeAdjuster->add_pair(key,-y);
  3646. }
  3647. else
  3648. {
  3649. relativeAdjuster->add_pair(key*(9.0/5.0),-y);
  3650. }
  3651. y-= skip;
  3652. }
  3653. }
  3654. }
  3655. }
  3656. /*:322*/
  3657. #line 7614 "./typica.w"
  3658. /*324:*/
  3659. #line 7747 "./typica.w"
  3660. QGraphicsLineItem*timeaxis= new QGraphicsLineItem;
  3661. timeaxis->setLine(0,10,1200,10);
  3662. theScene->addItem(timeaxis);
  3663. for(int x= 0;x<1201;x+= 120)
  3664. {
  3665. QGraphicsLineItem*tick= new QGraphicsLineItem;
  3666. tick->setLine(x,0,x,20);
  3667. theScene->addItem(tick);
  3668. QGraphicsTextItem*label= new QGraphicsTextItem;
  3669. label->setPlainText(QString("%1").arg(x/60));
  3670. label->setPos(x-(label->boundingRect().width()/2),20);
  3671. theScene->addItem(label);
  3672. }
  3673. /*:324*/
  3674. #line 7615 "./typica.w"
  3675. ;
  3676. fitInView(theScene->sceneRect().adjusted(-50,-50,50,50));
  3677. }
  3678. /*:320*//*323:*/
  3679. #line 7717 "./typica.w"
  3680. void GraphView::showF()
  3681. {
  3682. for(int i= 0;i<gridLinesF->size();i++)
  3683. {
  3684. gridLinesF->at(i)->show();
  3685. }
  3686. for(int i= 0;i<gridLinesC->size();i++)
  3687. {
  3688. gridLinesC->at(i)->hide();
  3689. }
  3690. }
  3691. void GraphView::showC()
  3692. {
  3693. for(int i= 0;i<gridLinesF->size();i++)
  3694. {
  3695. gridLinesF->at(i)->hide();
  3696. }
  3697. for(int i= 0;i<gridLinesC->size();i++)
  3698. {
  3699. gridLinesC->at(i)->show();
  3700. }
  3701. }
  3702. /*:323*//*325:*/
  3703. #line 7766 "./typica.w"
  3704. void GraphView::resizeEvent(QResizeEvent*)
  3705. {
  3706. fitInView(theScene->sceneRect().adjusted(-50,-50,50,50));
  3707. }
  3708. /*:325*//*326:*/
  3709. #line 7780 "./typica.w"
  3710. #define FULLTIMETOINT(t) (t.msec() + (t.second() * 1000) + (t.minute() * 60 * 1000))
  3711. void GraphView::newMeasurement(Measurement measure,int tempcolumn)
  3712. {
  3713. double offset= 0;
  3714. if(measure.contains("relative"))
  3715. {
  3716. if(measure.value("relative").toBool())
  3717. {
  3718. if(relativeEnabled)
  3719. {
  3720. measure.setTemperature(relativeAdjuster->newMeasurement(measure).temperature());
  3721. }
  3722. else
  3723. {
  3724. return;
  3725. }
  3726. }
  3727. }
  3728. if(translations->contains(tempcolumn))
  3729. {
  3730. offset= translations->value(tempcolumn);
  3731. }
  3732. if(prevPoints->contains(tempcolumn))
  3733. {
  3734. /*328:*/
  3735. #line 7857 "./typica.w"
  3736. QGraphicsLineItem*segment= new QGraphicsLineItem;
  3737. QPointF nextPoint(FULLTIMETOINT(measure.time())/1000,measure.temperature());
  3738. segment->setLine(prevPoints->value(tempcolumn).x()+offset,
  3739. -(prevPoints->value(tempcolumn).y()),
  3740. nextPoint.x()+offset,-(nextPoint.y()));
  3741. static QColor p[12]= {Qt::yellow,Qt::blue,Qt::cyan,Qt::red,Qt::magenta,
  3742. Qt::green,Qt::darkGreen,Qt::darkMagenta,
  3743. Qt::darkRed,Qt::darkCyan,Qt::darkBlue,
  3744. Qt::darkYellow};
  3745. segment->setPen(p[tempcolumn%12]);
  3746. theScene->addItem(segment);
  3747. prevPoints->insert(tempcolumn,nextPoint);
  3748. if(timeIndicatorEnabled)
  3749. {
  3750. timeLine->setLine(nextPoint.x()+offset,0,nextPoint.x()+offset,-500);
  3751. }
  3752. /*:328*/
  3753. #line 7806 "./typica.w"
  3754. if(graphLines->contains(tempcolumn))
  3755. {
  3756. graphLines->value(tempcolumn)->append(segment);
  3757. }
  3758. else
  3759. {
  3760. QList<QGraphicsLineItem*> *newLine=
  3761. new QList<QGraphicsLineItem*> ;
  3762. newLine->append(segment);
  3763. graphLines->insert(tempcolumn,newLine);
  3764. }
  3765. }
  3766. else
  3767. {
  3768. /*327:*/
  3769. #line 7842 "./typica.w"
  3770. int x= FULLTIMETOINT(measure.time())/1000;
  3771. prevPoints->insert(tempcolumn,QPointF(x,measure.temperature()));
  3772. if(timeIndicatorEnabled)
  3773. {
  3774. timeLine->setLine(x,0,x,-500);
  3775. }
  3776. /*:327*/
  3777. #line 7823 "./typica.w"
  3778. }
  3779. }
  3780. /*:326*//*329:*/
  3781. #line 7878 "./typica.w"
  3782. void GraphView::clear()
  3783. {
  3784. int i;
  3785. foreach(i,prevPoints->keys())
  3786. {
  3787. removeSeries(i);
  3788. }
  3789. translations->clear();
  3790. }
  3791. /*:329*//*330:*/
  3792. #line 7892 "./typica.w"
  3793. void GraphView::removeSeries(int column)
  3794. {
  3795. if(graphLines->contains(column))
  3796. {
  3797. QList<QGraphicsLineItem*> *series= graphLines->value(column);
  3798. QGraphicsLineItem*segment;
  3799. foreach(segment,*series)
  3800. {
  3801. theScene->removeItem(segment);
  3802. }
  3803. qDeleteAll(*series);
  3804. }
  3805. graphLines->remove(column);
  3806. prevPoints->remove(column);
  3807. }
  3808. /*:330*//*331:*/
  3809. #line 7911 "./typica.w"
  3810. void GraphView::setSeriesTranslation(int column,double offset)
  3811. {
  3812. if(graphLines->contains(column))
  3813. {
  3814. QList<QGraphicsLineItem*> *series= graphLines->value(column);
  3815. QGraphicsLineItem*segment;
  3816. foreach(segment,*series)
  3817. {
  3818. segment->setPos(segment->pos().x()+offset,segment->pos().y());
  3819. }
  3820. }
  3821. if(translations->contains(column))
  3822. {
  3823. translations->insert(column,offset+translations->value(column));
  3824. }
  3825. else
  3826. {
  3827. translations->insert(column,offset);
  3828. }
  3829. }
  3830. /*:331*//*332:*/
  3831. #line 7938 "./typica.w"
  3832. void GraphView::setTimeIndicatorEnabled(bool enabled)
  3833. {
  3834. timeIndicatorEnabled= enabled;
  3835. if(enabled)
  3836. {
  3837. timeLine->show();
  3838. }
  3839. else
  3840. {
  3841. timeLine->hide();
  3842. }
  3843. }
  3844. /*:332*/
  3845. #line 546 "./typica.w"
  3846. /*338:*/
  3847. #line 8082 "./typica.w"
  3848. void ZoomLog::newMeasurement(Measurement measure,int tempcolumn)
  3849. {
  3850. if(measure.time()!=QTime(0,0,0,0))
  3851. {
  3852. /*340:*/
  3853. #line 8156 "./typica.w"
  3854. if(lastMeasurement.contains(tempcolumn))
  3855. {
  3856. if(lastMeasurement[tempcolumn].time()<measure.time())
  3857. {
  3858. QList<QTime> timelist;
  3859. for(QTime i= lastMeasurement.value(tempcolumn).time().addSecs(1);i<measure.time();i= i.addSecs(1))
  3860. {
  3861. timelist.append(i);
  3862. }
  3863. for(int i= 0;i<timelist.size();i++)
  3864. {
  3865. Measurement synthesized= measure;
  3866. synthesized.setTime(timelist[i]);
  3867. newMeasurement(synthesized,tempcolumn);
  3868. }
  3869. }
  3870. }
  3871. /*:340*/
  3872. #line 8087 "./typica.w"
  3873. }
  3874. model_ms->newMeasurement(measure,tempcolumn);
  3875. if(lastMeasurement.contains(tempcolumn))
  3876. {
  3877. if(measure.time().second()!=
  3878. lastMeasurement.value(tempcolumn).time().second())
  3879. {
  3880. Measurement adjusted= measure;
  3881. QTime adjtime(0,measure.time().minute(),measure.time().second(),0);
  3882. adjusted.setTime(adjtime);
  3883. model_1s->newMeasurement(adjusted,tempcolumn);
  3884. if(adjusted.time().second()%5==0)
  3885. {
  3886. model_5s->newMeasurement(adjusted,tempcolumn);
  3887. if(adjusted.time().second()%10==0)
  3888. {
  3889. model_10s->newMeasurement(adjusted,tempcolumn);
  3890. }
  3891. if(adjusted.time().second()%15==0)
  3892. {
  3893. model_15s->newMeasurement(adjusted,tempcolumn);
  3894. if(adjusted.time().second()%30==0)
  3895. {
  3896. model_30s->newMeasurement(adjusted,tempcolumn);
  3897. if(adjusted.time().second()==0)
  3898. {
  3899. model_1m->newMeasurement(adjusted,tempcolumn);
  3900. }
  3901. }
  3902. }
  3903. }
  3904. }
  3905. /*342:*/
  3906. #line 8200 "./typica.w"
  3907. if(currentColumnSet.contains(tempcolumn))
  3908. {
  3909. int replicationcolumn;
  3910. foreach(replicationcolumn,currentColumnSet)
  3911. {
  3912. if(replicationcolumn!=tempcolumn)
  3913. {
  3914. if(lastMeasurement.contains(replicationcolumn))
  3915. {
  3916. if(measure.time()> lastMeasurement.value(replicationcolumn).time())
  3917. {
  3918. Measurement synthetic= lastMeasurement.value(replicationcolumn);
  3919. synthetic.setTime(measure.time());
  3920. model_ms->newMeasurement(synthetic,replicationcolumn);
  3921. if(synthetic.time().second()!=lastMeasurement.value(replicationcolumn).time().second())
  3922. {
  3923. Measurement adjusted= synthetic;
  3924. adjusted.setTime(QTime(0,synthetic.time().minute(),synthetic.time().second(),0));
  3925. model_1s->newMeasurement(adjusted,replicationcolumn);
  3926. if(adjusted.time().second()%5==0)
  3927. {
  3928. model_5s->newMeasurement(adjusted,replicationcolumn);
  3929. if(adjusted.time().second()%10==0)
  3930. {
  3931. model_10s->newMeasurement(adjusted,replicationcolumn);
  3932. }
  3933. if(adjusted.time().second()%15==0)
  3934. {
  3935. model_15s->newMeasurement(adjusted,replicationcolumn);
  3936. if(adjusted.time().second()%30==0)
  3937. {
  3938. model_30s->newMeasurement(adjusted,replicationcolumn);
  3939. if(adjusted.time().second()==0)
  3940. {
  3941. model_1m->newMeasurement(adjusted,replicationcolumn);
  3942. }
  3943. }
  3944. }
  3945. }
  3946. }
  3947. lastMeasurement[replicationcolumn]= synthetic;
  3948. }
  3949. }
  3950. }
  3951. }
  3952. }
  3953. /*:342*/
  3954. #line 8120 "./typica.w"
  3955. }
  3956. else
  3957. {
  3958. /*339:*/
  3959. #line 8132 "./typica.w"
  3960. MeasurementModel*m;
  3961. foreach(m,modelSet)
  3962. {
  3963. m->newMeasurement(measure,tempcolumn);
  3964. }
  3965. /*:339*/
  3966. #line 8124 "./typica.w"
  3967. }
  3968. lastMeasurement.insert(tempcolumn,measure);
  3969. }
  3970. /*:338*//*341:*/
  3971. #line 8186 "./typica.w"
  3972. void ZoomLog::addToCurrentColumnSet(int column)
  3973. {
  3974. currentColumnSet.append(column);
  3975. }
  3976. void ZoomLog::clearCurrentColumnSet()
  3977. {
  3978. currentColumnSet.clear();
  3979. }
  3980. /*:341*//*343:*/
  3981. #line 8270 "./typica.w"
  3982. void ZoomLog::newAnnotation(QString annotation,int tempcolumn,
  3983. int annotationcolumn)
  3984. {
  3985. model_ms->newAnnotation(annotation,tempcolumn,annotationcolumn);
  3986. MeasurementModel*m;
  3987. if(lastMeasurement.contains(tempcolumn))
  3988. {
  3989. foreach(m,modelSet)
  3990. {
  3991. m->newMeasurement(lastMeasurement.value(tempcolumn),tempcolumn);
  3992. }
  3993. }
  3994. foreach(m,modelSet)
  3995. {
  3996. m->newAnnotation(annotation,tempcolumn,annotationcolumn);
  3997. }
  3998. }
  3999. /*:343*//*344:*/
  4000. #line 8294 "./typica.w"
  4001. void ZoomLog::centerOn(int row)
  4002. {
  4003. scrollTo(currentModel->index(row,0),QAbstractItemView::PositionAtCenter);
  4004. }
  4005. /*:344*//*345:*/
  4006. #line 8304 "./typica.w"
  4007. void ZoomLog::clear()
  4008. {
  4009. MeasurementModel*m;
  4010. foreach(m,modelSet)
  4011. {
  4012. m->clear();
  4013. }
  4014. lastMeasurement.clear();
  4015. saveTempCols.clear();
  4016. saveControlCols.clear();
  4017. saveNoteCols.clear();
  4018. }
  4019. /*:345*//*346:*/
  4020. #line 8322 "./typica.w"
  4021. QVariant ZoomLog::data(int row,int column)const
  4022. {
  4023. return model_ms->data(model_ms->index(row,column,QModelIndex()),
  4024. Qt::DisplayRole);
  4025. }
  4026. int ZoomLog::rowCount()
  4027. {
  4028. return model_ms->rowCount();
  4029. }
  4030. /*:346*//*347:*/
  4031. #line 8345 "./typica.w"
  4032. bool ZoomLog::saveXML(QIODevice*device)
  4033. {
  4034. Units::Unit prevUnits= model_ms->displayUnits();
  4035. if(prevUnits!=Units::Fahrenheit)
  4036. {
  4037. model_ms->setDisplayUnits(Units::Fahrenheit);
  4038. }
  4039. XMLOutput writer(model_ms,device,0);
  4040. int c;
  4041. foreach(c,saveTempCols)
  4042. {
  4043. writer.addTemperatureColumn(model_ms->headerData(c,Qt::Horizontal).
  4044. toString(),c);
  4045. }
  4046. foreach(c,saveControlCols)
  4047. {
  4048. writer.addControlColumn(model_ms->headerData(c,Qt::Horizontal).
  4049. toString(),c);
  4050. }
  4051. foreach(c,saveNoteCols)
  4052. {
  4053. writer.addAnnotationColumn(model_ms->headerData(c,Qt::Horizontal).
  4054. toString(),c);
  4055. }
  4056. bool retval= writer.output();
  4057. if(prevUnits!=Units::Fahrenheit)
  4058. {
  4059. model_ms->setDisplayUnits(prevUnits);
  4060. }
  4061. return retval;
  4062. }
  4063. /*:347*//*348:*/
  4064. #line 8381 "./typica.w"
  4065. bool ZoomLog::saveCSV(QIODevice*device)
  4066. {
  4067. CSVOutput writer(currentModel,device,0);
  4068. int c;
  4069. foreach(c,saveTempCols)
  4070. {
  4071. writer.addTemperatureColumn(model_ms->headerData(c,Qt::Horizontal).
  4072. toString(),c);
  4073. }
  4074. foreach(c,saveControlCols)
  4075. {
  4076. writer.addControlColumn(model_ms->headerData(c,Qt::Horizontal).
  4077. toString(),c);
  4078. }
  4079. foreach(c,saveNoteCols)
  4080. {
  4081. writer.addAnnotationColumn(model_ms->headerData(c,Qt::Horizontal).
  4082. toString(),c);
  4083. }
  4084. return writer.output();
  4085. }
  4086. /*:348*//*349:*/
  4087. #line 8410 "./typica.w"
  4088. void ZoomLog::switchLOD(MeasurementModel*m)
  4089. {
  4090. disconnect(currentModel,SIGNAL(rowChanged(int)),this,0);
  4091. setModel(m);
  4092. currentModel= m;
  4093. connect(currentModel,SIGNAL(rowChanged(int)),this,SLOT(centerOn(int)));
  4094. }
  4095. void ZoomLog::LOD_ms()
  4096. {
  4097. switchLOD(model_ms);
  4098. }
  4099. void ZoomLog::LOD_1s()
  4100. {
  4101. switchLOD(model_1s);
  4102. }
  4103. void ZoomLog::LOD_5s()
  4104. {
  4105. switchLOD(model_5s);
  4106. }
  4107. void ZoomLog::LOD_10s()
  4108. {
  4109. switchLOD(model_10s);
  4110. }
  4111. void ZoomLog::LOD_15s()
  4112. {
  4113. switchLOD(model_15s);
  4114. }
  4115. void ZoomLog::LOD_30s()
  4116. {
  4117. switchLOD(model_30s);
  4118. }
  4119. void ZoomLog::LOD_1m()
  4120. {
  4121. switchLOD(model_1m);
  4122. }
  4123. /*:349*//*350:*/
  4124. #line 8458 "./typica.w"
  4125. void ZoomLog::setDisplayUnits(Units::Unit scale)
  4126. {
  4127. model_ms->setDisplayUnits(scale);
  4128. model_1s->setDisplayUnits(scale);
  4129. model_5s->setDisplayUnits(scale);
  4130. model_10s->setDisplayUnits(scale);
  4131. model_15s->setDisplayUnits(scale);
  4132. model_30s->setDisplayUnits(scale);
  4133. model_1m->setDisplayUnits(scale);
  4134. }
  4135. Units::Unit ZoomLog::displayUnits()
  4136. {
  4137. return model_ms->displayUnits();
  4138. }
  4139. /*:350*//*351:*/
  4140. #line 8478 "./typica.w"
  4141. QString ZoomLog::lastTime(int series)
  4142. {
  4143. Measurement measure= lastMeasurement.value(series);
  4144. QTime time= measure.time();
  4145. return time.toString("h:mm:ss.zzz");
  4146. }
  4147. /*:351*//*352:*/
  4148. #line 8488 "./typica.w"
  4149. ZoomLog::ZoomLog():QTableView(NULL),model_ms(new MeasurementModel(this)),
  4150. model_1s(new MeasurementModel(this)),model_5s(new MeasurementModel(this)),
  4151. model_10s(new MeasurementModel(this)),model_15s(new MeasurementModel(this)),
  4152. model_30s(new MeasurementModel(this)),model_1m(new MeasurementModel(this))
  4153. {
  4154. setEditTriggers(QAbstractItemView::NoEditTriggers);
  4155. setSelectionMode(QAbstractItemView::NoSelection);
  4156. modelSet<<model_ms<<model_1s<<model_5s<<model_10s<<model_15s<<
  4157. model_30s<<model_1m;
  4158. currentModel= model_30s;
  4159. setModel(currentModel);
  4160. connect(currentModel,SIGNAL(rowChanged(int)),this,SLOT(centerOn(int)));
  4161. connect(horizontalHeader(),SIGNAL(sectionResized(int,int,int)),
  4162. this,SLOT(persistColumnResize(int,int,int)));
  4163. connect(horizontalHeader(),SIGNAL(sectionCountChanged(int,int)),
  4164. this,SLOT(restoreColumnWidths()));
  4165. }
  4166. /*:352*//*353:*/
  4167. #line 8511 "./typica.w"
  4168. void ZoomLog::setHeaderData(int section,QString text)
  4169. {
  4170. MeasurementModel*m;
  4171. foreach(m,modelSet)
  4172. {
  4173. m->setHeaderData(section,Qt::Horizontal,QVariant(text));
  4174. }
  4175. }
  4176. /*:353*//*354:*/
  4177. #line 8529 "./typica.w"
  4178. void ZoomLog::addOutputTemperatureColumn(int column)
  4179. {
  4180. saveTempCols.append(column);
  4181. }
  4182. void ZoomLog::addOutputControlColumn(int column)
  4183. {
  4184. saveControlCols.append(column);
  4185. }
  4186. void ZoomLog::addOutputAnnotationColumn(int column)
  4187. {
  4188. saveNoteCols.append(column);
  4189. }
  4190. void ZoomLog::clearOutputColumns()
  4191. {
  4192. saveTempCols.clear();
  4193. saveControlCols.clear();
  4194. saveNoteCols.clear();
  4195. }
  4196. /*:354*//*355:*/
  4197. #line 8555 "./typica.w"
  4198. void ZoomLog::persistColumnResize(int column,int,int newsize)
  4199. {
  4200. /*566:*/
  4201. #line 12634 "./typica.w"
  4202. QSettings settings;
  4203. /*567:*/
  4204. #line 12647 "./typica.w"
  4205. QWidget*topLevelWidget= this;
  4206. while(topLevelWidget->parentWidget())
  4207. {
  4208. topLevelWidget= topLevelWidget->parentWidget();
  4209. }
  4210. /*:567*/
  4211. #line 12636 "./typica.w"
  4212. settings.setValue(QString("columnWidths/%1/%2/%3").
  4213. arg(topLevelWidget->objectName()).
  4214. arg(objectName()).arg(column),
  4215. QVariant(newsize));
  4216. /*:566*/
  4217. #line 8558 "./typica.w"
  4218. }
  4219. void ZoomLog::restoreColumnWidths()
  4220. {
  4221. /*569:*/
  4222. #line 12667 "./typica.w"
  4223. QSettings settings;
  4224. /*567:*/
  4225. #line 12647 "./typica.w"
  4226. QWidget*topLevelWidget= this;
  4227. while(topLevelWidget->parentWidget())
  4228. {
  4229. topLevelWidget= topLevelWidget->parentWidget();
  4230. }
  4231. /*:567*/
  4232. #line 12669 "./typica.w"
  4233. QString baseKey=
  4234. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  4235. arg(objectName());
  4236. for(int i= 0;i<model()->columnCount();i++)
  4237. {
  4238. QString key= QString("%1/%2").arg(baseKey).arg(i);
  4239. if(settings.contains(key))
  4240. {
  4241. setColumnWidth(i,settings.value(key).toInt());
  4242. }
  4243. }
  4244. /*:569*/
  4245. #line 8563 "./typica.w"
  4246. }
  4247. void ZoomLog::setVisible(bool visibility)
  4248. {
  4249. QTableView::setVisible(visibility);
  4250. }
  4251. void ZoomLog::showEvent(QShowEvent*)
  4252. {
  4253. /*569:*/
  4254. #line 12667 "./typica.w"
  4255. QSettings settings;
  4256. /*567:*/
  4257. #line 12647 "./typica.w"
  4258. QWidget*topLevelWidget= this;
  4259. while(topLevelWidget->parentWidget())
  4260. {
  4261. topLevelWidget= topLevelWidget->parentWidget();
  4262. }
  4263. /*:567*/
  4264. #line 12669 "./typica.w"
  4265. QString baseKey=
  4266. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  4267. arg(objectName());
  4268. for(int i= 0;i<model()->columnCount();i++)
  4269. {
  4270. QString key= QString("%1/%2").arg(baseKey).arg(i);
  4271. if(settings.contains(key))
  4272. {
  4273. setColumnWidth(i,settings.value(key).toInt());
  4274. }
  4275. }
  4276. /*:569*/
  4277. #line 8573 "./typica.w"
  4278. }
  4279. /*:355*/
  4280. #line 547 "./typica.w"
  4281. /*364:*/
  4282. #line 8806 "./typica.w"
  4283. bool MeasurementList::operator<(const MeasurementList&other)const
  4284. {
  4285. return this->first().toTime()<other.first().toTime();
  4286. }
  4287. bool MeasurementList::operator==(const MeasurementList&other)const
  4288. {
  4289. return this->first().toTime()==other.first().toTime();
  4290. }
  4291. /*:364*//*365:*/
  4292. #line 8822 "./typica.w"
  4293. QModelIndex MeasurementModel::parent(const QModelIndex&)const
  4294. {
  4295. return QModelIndex();
  4296. }
  4297. /*:365*//*366:*/
  4298. #line 8832 "./typica.w"
  4299. void MeasurementModel::newMeasurement(Measurement measure,int tempcolumn)
  4300. {
  4301. if(measure.scale()==Units::Unitless)
  4302. {
  4303. controlColumns->insert(tempcolumn,true);
  4304. }
  4305. else
  4306. {
  4307. controlColumns->insert(tempcolumn,false);
  4308. }
  4309. MeasurementList*temp;
  4310. temp= new MeasurementList;
  4311. temp->append(QVariant(measure.time()));
  4312. /*367:*/
  4313. #line 8891 "./typica.w"
  4314. /*368:*/
  4315. #line 8936 "./typica.w"
  4316. QList<MeasurementList*> ::iterator i= lastInsertion;
  4317. bool quickscan= false;
  4318. if(entries->size()> 5)
  4319. {
  4320. if(**i<*temp)
  4321. {
  4322. i+= 1;
  4323. for(int j= 10;j> 0;j--)
  4324. {
  4325. if(i!=entries->end())
  4326. {
  4327. if(**i<*temp)
  4328. {
  4329. i+= 1;
  4330. }
  4331. else
  4332. {
  4333. quickscan= true;
  4334. break;
  4335. }
  4336. }
  4337. else
  4338. {
  4339. quickscan= true;
  4340. break;
  4341. }
  4342. }
  4343. }
  4344. else
  4345. {
  4346. if(**i==*temp)
  4347. {
  4348. quickscan= true;
  4349. }
  4350. }
  4351. }
  4352. /*:368*/
  4353. #line 8892 "./typica.w"
  4354. if(quickscan==false)
  4355. {
  4356. i= entries->begin();
  4357. QList<MeasurementList*> ::iterator u= entries->end();
  4358. QList<MeasurementList*> ::iterator midpoint;
  4359. int n= u-i;
  4360. int rA;
  4361. while(n> 0)
  4362. {
  4363. rA= n>>1;
  4364. midpoint= i+rA;
  4365. if(**midpoint<*temp)
  4366. {
  4367. i= midpoint+1;
  4368. n-= rA+1;
  4369. }
  4370. else
  4371. {
  4372. n= rA;
  4373. }
  4374. }
  4375. }
  4376. /*:367*/
  4377. #line 8846 "./typica.w"
  4378. MeasurementList*newEntry;
  4379. int insertion;
  4380. if(i!=entries->end())
  4381. {
  4382. insertion= entries->indexOf(*i);
  4383. if((*i)->first().toTime()==measure.time())
  4384. {
  4385. /*369:*/
  4386. #line 8978 "./typica.w"
  4387. if((*i)->size()<tempcolumn+1)
  4388. {
  4389. for(int j= (*i)->size()-1;j<tempcolumn+1;j++)
  4390. {
  4391. (*i)->append(QVariant());
  4392. }
  4393. }
  4394. (*i)->replace(tempcolumn,measure);
  4395. lastInsertion= i;
  4396. emit dataChanged(createIndex(insertion,tempcolumn),
  4397. createIndex(insertion,tempcolumn));
  4398. lastTemperature->insert(tempcolumn,insertion);
  4399. /*:369*/
  4400. #line 8854 "./typica.w"
  4401. }
  4402. else
  4403. {
  4404. /*370:*/
  4405. #line 8996 "./typica.w"
  4406. beginInsertRows(QModelIndex(),insertion,insertion);
  4407. newEntry= new MeasurementList;
  4408. newEntry->append(QVariant(measure.time()));
  4409. for(int j= 0;j<tempcolumn+1;j++)
  4410. {
  4411. newEntry->append(QVariant());
  4412. }
  4413. newEntry->replace(tempcolumn,measure);
  4414. lastInsertion= entries->insert(i,newEntry);
  4415. endInsertRows();
  4416. lastTemperature->insert(tempcolumn,insertion);
  4417. /*:370*/
  4418. #line 8858 "./typica.w"
  4419. }
  4420. }
  4421. else
  4422. {
  4423. /*371:*/
  4424. #line 9014 "./typica.w"
  4425. insertion= entries->size();
  4426. /*370:*/
  4427. #line 8996 "./typica.w"
  4428. beginInsertRows(QModelIndex(),insertion,insertion);
  4429. newEntry= new MeasurementList;
  4430. newEntry->append(QVariant(measure.time()));
  4431. for(int j= 0;j<tempcolumn+1;j++)
  4432. {
  4433. newEntry->append(QVariant());
  4434. }
  4435. newEntry->replace(tempcolumn,measure);
  4436. lastInsertion= entries->insert(i,newEntry);
  4437. endInsertRows();
  4438. lastTemperature->insert(tempcolumn,insertion);
  4439. /*:370*/
  4440. #line 9016 "./typica.w"
  4441. /*:371*/
  4442. #line 8863 "./typica.w"
  4443. }
  4444. if(tempcolumn>=colcount)
  4445. {
  4446. colcount= tempcolumn+1;
  4447. }
  4448. emit rowChanged(insertion);
  4449. delete temp;
  4450. }
  4451. /*:366*//*372:*/
  4452. #line 9026 "./typica.w"
  4453. void MeasurementModel::newAnnotation(QString annotation,int tempcolumn,
  4454. int annotationColumn)
  4455. {
  4456. int r;
  4457. if(lastTemperature->contains(tempcolumn))
  4458. {
  4459. r= lastTemperature->value(tempcolumn);
  4460. }
  4461. else
  4462. {
  4463. r= 0;
  4464. }
  4465. if(r==0&&entries->size()==0)
  4466. {
  4467. /*373:*/
  4468. #line 9064 "./typica.w"
  4469. beginInsertRows(QModelIndex(),0,0);
  4470. MeasurementList*newEntry= new MeasurementList;
  4471. newEntry->append(QVariant(QTime(0,0,0,0)));
  4472. entries->append(newEntry);
  4473. endInsertRows();
  4474. /*:373*/
  4475. #line 9041 "./typica.w"
  4476. }
  4477. MeasurementList*row= entries->at(r);
  4478. if(row->size()<=annotationColumn)
  4479. {
  4480. for(int i= row->size()-1;i<annotationColumn+1;i++)
  4481. {
  4482. row->append(QVariant());
  4483. }
  4484. }
  4485. row->replace(annotationColumn,annotation);
  4486. emit dataChanged(createIndex(r,annotationColumn),
  4487. createIndex(r,annotationColumn));
  4488. emit rowChanged(r);
  4489. if(annotationColumn> colcount-1)
  4490. {
  4491. colcount= annotationColumn+1;
  4492. }
  4493. }
  4494. /*:372*//*374:*/
  4495. #line 9075 "./typica.w"
  4496. void MeasurementModel::clear()
  4497. {
  4498. beginRemoveRows(QModelIndex(),0,entries->size());
  4499. while(entries->size()!=0)
  4500. {
  4501. MeasurementList*row= entries->takeFirst();
  4502. delete row;
  4503. }
  4504. endRemoveRows();
  4505. colcount= hData->size();
  4506. lastTemperature->clear();
  4507. reset();
  4508. }
  4509. /*:374*//*375:*/
  4510. #line 9108 "./typica.w"
  4511. bool MeasurementModel::setData(const QModelIndex&index,
  4512. const QVariant&value,int role)
  4513. {
  4514. if(role!=Qt::EditRole&&role!=Qt::DisplayRole)
  4515. {
  4516. return false;
  4517. }
  4518. /*376:*/
  4519. #line 9140 "./typica.w"
  4520. bool valid= false;
  4521. if(index.isValid())
  4522. {
  4523. if(index.row()<entries->size())
  4524. {
  4525. if(index.column()<colcount)
  4526. {
  4527. valid= true;
  4528. }
  4529. }
  4530. }
  4531. /*:376*/
  4532. #line 9116 "./typica.w"
  4533. if(!valid)
  4534. {
  4535. return false;
  4536. }
  4537. MeasurementList*row= entries->at(index.row());
  4538. if(index.column()>=row->size())
  4539. {
  4540. /*377:*/
  4541. #line 9157 "./typica.w"
  4542. for(int i= row->size()-1;i<index.column();i++)
  4543. {
  4544. row->append(QVariant());
  4545. }
  4546. /*:377*/
  4547. #line 9124 "./typica.w"
  4548. }
  4549. if(index.column()==0)
  4550. {
  4551. /*378:*/
  4552. #line 9172 "./typica.w"
  4553. QTime time;
  4554. if(!(time= QTime::fromString(value.toString(),"m:s.z")).isValid())
  4555. {
  4556. if(!(time= QTime::fromString(value.toString(),"m:s")).isValid())
  4557. {
  4558. return false;
  4559. }
  4560. }
  4561. row= entries->takeAt(index.row());
  4562. row->replace(index.column(),QVariant(time));
  4563. MeasurementList*temp= row;
  4564. /*367:*/
  4565. #line 8891 "./typica.w"
  4566. /*368:*/
  4567. #line 8936 "./typica.w"
  4568. QList<MeasurementList*> ::iterator i= lastInsertion;
  4569. bool quickscan= false;
  4570. if(entries->size()> 5)
  4571. {
  4572. if(**i<*temp)
  4573. {
  4574. i+= 1;
  4575. for(int j= 10;j> 0;j--)
  4576. {
  4577. if(i!=entries->end())
  4578. {
  4579. if(**i<*temp)
  4580. {
  4581. i+= 1;
  4582. }
  4583. else
  4584. {
  4585. quickscan= true;
  4586. break;
  4587. }
  4588. }
  4589. else
  4590. {
  4591. quickscan= true;
  4592. break;
  4593. }
  4594. }
  4595. }
  4596. else
  4597. {
  4598. if(**i==*temp)
  4599. {
  4600. quickscan= true;
  4601. }
  4602. }
  4603. }
  4604. /*:368*/
  4605. #line 8892 "./typica.w"
  4606. if(quickscan==false)
  4607. {
  4608. i= entries->begin();
  4609. QList<MeasurementList*> ::iterator u= entries->end();
  4610. QList<MeasurementList*> ::iterator midpoint;
  4611. int n= u-i;
  4612. int rA;
  4613. while(n> 0)
  4614. {
  4615. rA= n>>1;
  4616. midpoint= i+rA;
  4617. if(**midpoint<*temp)
  4618. {
  4619. i= midpoint+1;
  4620. n-= rA+1;
  4621. }
  4622. else
  4623. {
  4624. n= rA;
  4625. }
  4626. }
  4627. }
  4628. /*:367*/
  4629. #line 9184 "./typica.w"
  4630. entries->insert(i,row);
  4631. int newRow= entries->indexOf(*i);
  4632. if(newRow<index.row())
  4633. {
  4634. emit dataChanged(createIndex(newRow,index.column()),index);
  4635. }
  4636. else
  4637. {
  4638. emit dataChanged(index,createIndex(newRow,index.column()));
  4639. }
  4640. /*:378*/
  4641. #line 9128 "./typica.w"
  4642. }
  4643. else
  4644. {
  4645. /*379:*/
  4646. #line 9198 "./typica.w"
  4647. row->replace(index.column(),value);
  4648. emit dataChanged(index,index);
  4649. /*:379*/
  4650. #line 9132 "./typica.w"
  4651. }
  4652. return true;
  4653. }
  4654. /*:375*//*380:*/
  4655. #line 9206 "./typica.w"
  4656. MeasurementModel::MeasurementModel(QObject*parent):QAbstractItemModel(parent),
  4657. unit(Units::Fahrenheit),hData(new QStringList),
  4658. lastTemperature(new QHash<int,int> ),
  4659. controlColumns(new QHash<int,bool> )
  4660. {
  4661. colcount= 1;
  4662. entries= new QList<MeasurementList*> ;
  4663. lastInsertion= entries->begin();
  4664. hData->append(tr("Time"));
  4665. }
  4666. /*:380*//*381:*/
  4667. #line 9220 "./typica.w"
  4668. MeasurementModel::~MeasurementModel()
  4669. {
  4670. clear();
  4671. delete entries;
  4672. delete hData;
  4673. }
  4674. /*:381*//*382:*/
  4675. #line 9232 "./typica.w"
  4676. int MeasurementModel::rowCount(const QModelIndex&parent)const
  4677. {
  4678. if(parent==QModelIndex())
  4679. {
  4680. return entries->size();
  4681. }
  4682. return 0;
  4683. }
  4684. int MeasurementModel::columnCount(const QModelIndex&parent)const
  4685. {
  4686. if(parent==QModelIndex())
  4687. {
  4688. return colcount;
  4689. }
  4690. return 0;
  4691. }
  4692. /*:382*//*383:*/
  4693. #line 9259 "./typica.w"
  4694. bool MeasurementModel::setHeaderData(int section,Qt::Orientation orientation,
  4695. const QVariant&value,int)
  4696. {
  4697. if(orientation==Qt::Horizontal)
  4698. {
  4699. if(hData->size()<section+1)
  4700. {
  4701. for(int i= hData->size();i<section+1;i++)
  4702. {
  4703. if(colcount<i)
  4704. {
  4705. beginInsertColumns(QModelIndex(),i,i);
  4706. }
  4707. hData->append(QString());
  4708. if(colcount<i)
  4709. {
  4710. endInsertColumns();
  4711. }
  4712. }
  4713. }
  4714. hData->replace(section,value.toString());
  4715. emit headerDataChanged(orientation,section,section);
  4716. if(colcount<section+1)
  4717. {
  4718. colcount= section+1;
  4719. }
  4720. return true;
  4721. }
  4722. return false;
  4723. }
  4724. /*:383*//*384:*/
  4725. #line 9299 "./typica.w"
  4726. void MeasurementModel::setDisplayUnits(Units::Unit scale)
  4727. {
  4728. beginResetModel();
  4729. unit= scale;
  4730. endResetModel();
  4731. }
  4732. Units::Unit MeasurementModel::displayUnits()
  4733. {
  4734. return unit;
  4735. }
  4736. /*:384*//*385:*/
  4737. #line 9325 "./typica.w"
  4738. QVariant MeasurementModel::data(const QModelIndex&index,int role)const
  4739. {
  4740. /*376:*/
  4741. #line 9140 "./typica.w"
  4742. bool valid= false;
  4743. if(index.isValid())
  4744. {
  4745. if(index.row()<entries->size())
  4746. {
  4747. if(index.column()<colcount)
  4748. {
  4749. valid= true;
  4750. }
  4751. }
  4752. }
  4753. /*:376*/
  4754. #line 9328 "./typica.w"
  4755. if(!valid)
  4756. {
  4757. return QVariant();
  4758. }
  4759. MeasurementList*row= entries->at(index.row());
  4760. if(role==Qt::UserRole)
  4761. {
  4762. return QVariant(row->at(index.column()));
  4763. }
  4764. if(role==Qt::DisplayRole||role==Qt::EditRole)
  4765. {
  4766. if(index.column()> row->size())
  4767. {
  4768. return QVariant();
  4769. }
  4770. else
  4771. {
  4772. if(index.column()==0)
  4773. {
  4774. return QVariant(row->at(0).toTime().toString("mm:ss.zzz"));
  4775. }
  4776. else if(lastTemperature->contains(index.column()))
  4777. {
  4778. QVariantMap v= row->at(index.column()).toMap();
  4779. if(!v.contains("measurement"))
  4780. {
  4781. return QVariant();
  4782. }
  4783. if((Units::Unit)(v.value("unit").toInt())==Units::Unitless)
  4784. {
  4785. return v.value("measurement");
  4786. }
  4787. else
  4788. {
  4789. if(v.contains("relative"))
  4790. {
  4791. if(v.value("relative").toBool())
  4792. {
  4793. return QVariant(QString("%1").arg(Units::convertRelativeTemperature(v.value("measurement").
  4794. toDouble(),(Units::Unit)(v.value("unit").toInt()),unit)));
  4795. }
  4796. }
  4797. return QVariant(QString("%1").
  4798. arg(Units::convertTemperature(v.value("measurement").toDouble(),
  4799. (Units::Unit)(v.value("unit").toInt()),unit)));
  4800. }
  4801. }
  4802. return QVariant(row->at(index.column()).toString());
  4803. }
  4804. }
  4805. return QVariant();
  4806. }
  4807. /*:385*//*386:*/
  4808. #line 9384 "./typica.w"
  4809. QVariant MeasurementModel::headerData(int section,Qt::Orientation orientation,
  4810. int role)const
  4811. {
  4812. if(orientation==Qt::Horizontal)
  4813. {
  4814. if(role==Qt::DisplayRole)
  4815. {
  4816. if(section<hData->size())
  4817. {
  4818. return QVariant(hData->at(section));
  4819. }
  4820. }
  4821. }
  4822. return QVariant();
  4823. }
  4824. /*:386*//*387:*/
  4825. #line 9411 "./typica.w"
  4826. Qt::ItemFlags MeasurementModel::flags(const QModelIndex&index)const
  4827. {
  4828. /*376:*/
  4829. #line 9140 "./typica.w"
  4830. bool valid= false;
  4831. if(index.isValid())
  4832. {
  4833. if(index.row()<entries->size())
  4834. {
  4835. if(index.column()<colcount)
  4836. {
  4837. valid= true;
  4838. }
  4839. }
  4840. }
  4841. /*:376*/
  4842. #line 9414 "./typica.w"
  4843. if(valid)
  4844. {
  4845. return Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable;
  4846. }
  4847. return 0;
  4848. }
  4849. /*:387*//*388:*/
  4850. #line 9426 "./typica.w"
  4851. QModelIndex MeasurementModel::index(int row,int column,
  4852. const QModelIndex&parent)const
  4853. {
  4854. if(parent==QModelIndex())
  4855. {
  4856. if(row<entries->size()&&entries->isEmpty()==false)
  4857. {
  4858. if(column<entries->at(row)->size())
  4859. {
  4860. return createIndex(row,column);
  4861. }
  4862. }
  4863. }
  4864. return QModelIndex();
  4865. }
  4866. /*:388*/
  4867. #line 548 "./typica.w"
  4868. /*390:*/
  4869. #line 9477 "./typica.w"
  4870. AnnotationButton::AnnotationButton(const QString&text,QWidget*parent):
  4871. QPushButton(text,parent),note(""),tc(0),ac(0),count(0)
  4872. {
  4873. connect(this,SIGNAL(clicked()),this,SLOT(annotate()));
  4874. }
  4875. /*:390*//*391:*/
  4876. #line 9492 "./typica.w"
  4877. void AnnotationButton::annotate()
  4878. {
  4879. if(note.contains("%1"))
  4880. {
  4881. count++;
  4882. emit annotation(note.arg(count),tc,ac);
  4883. }
  4884. else
  4885. {
  4886. emit annotation(note,tc,ac);
  4887. }
  4888. }
  4889. /*:391*//*392:*/
  4890. #line 9510 "./typica.w"
  4891. void AnnotationButton::setTemperatureColumn(int tempcolumn)
  4892. {
  4893. tc= tempcolumn;
  4894. }
  4895. void AnnotationButton::setAnnotationColumn(int annotationcolumn)
  4896. {
  4897. ac= annotationcolumn;
  4898. }
  4899. void AnnotationButton::setAnnotation(const QString&annotation)
  4900. {
  4901. note= annotation;
  4902. }
  4903. /*:392*//*393:*/
  4904. #line 9529 "./typica.w"
  4905. void AnnotationButton::resetCount()
  4906. {
  4907. count= 0;
  4908. }
  4909. /*:393*/
  4910. #line 549 "./typica.w"
  4911. /*398:*/
  4912. #line 9612 "./typica.w"
  4913. AnnotationSpinBox::AnnotationSpinBox(const QString&pret,
  4914. const QString&postt,
  4915. QWidget*parent)
  4916. :QDoubleSpinBox(parent),pretext(pret),posttext(postt)
  4917. {
  4918. resetChange();
  4919. connect(this,SIGNAL(editingFinished()),this,SLOT(annotate()));
  4920. connect(this,SIGNAL(valueChanged(double)),this,SLOT(resetChange()));
  4921. }
  4922. /*:398*//*399:*/
  4923. #line 9629 "./typica.w"
  4924. void AnnotationSpinBox::resetChange()
  4925. {
  4926. change= true;
  4927. }
  4928. /*:399*//*400:*/
  4929. #line 9640 "./typica.w"
  4930. void AnnotationSpinBox::annotate()
  4931. {
  4932. if(change)
  4933. {
  4934. change= false;
  4935. emit annotation(QString("%1%2%3").arg(pretext).
  4936. arg(value()).arg(posttext),tc,ac);
  4937. }
  4938. }
  4939. /*:400*//*401:*/
  4940. #line 9653 "./typica.w"
  4941. void AnnotationSpinBox::setTemperatureColumn(int tempcolumn)
  4942. {
  4943. tc= tempcolumn;
  4944. }
  4945. void AnnotationSpinBox::setAnnotationColumn(int annotationcolumn)
  4946. {
  4947. ac= annotationcolumn;
  4948. }
  4949. void AnnotationSpinBox::setPretext(const QString&pret)
  4950. {
  4951. pretext= pret;
  4952. }
  4953. void AnnotationSpinBox::setPosttext(const QString&postt)
  4954. {
  4955. posttext= postt;
  4956. }
  4957. /*:401*/
  4958. #line 550 "./typica.w"
  4959. /*408:*/
  4960. #line 9821 "./typica.w"
  4961. TimerDisplay::TimerDisplay(QWidget*parent):QLCDNumber(8,parent),
  4962. s(QTime(0,0,0)),r(QTime(0,0,0)),clock(NULL),m(TimerDisplay::CountUp),
  4963. running(false),ar(false),startAction(new QAction(tr("Start"),NULL)),
  4964. stopAction(new QAction(tr("Stop"),NULL)),
  4965. resetAction(new QAction(tr("Reset"),NULL)),f(QString("hh:mm:ss")),
  4966. relative(QTime::currentTime()),base(QTime(0,0,0))
  4967. {
  4968. connect(startAction,SIGNAL(triggered(bool)),this,SLOT(startTimer()));
  4969. connect(stopAction,SIGNAL(triggered(bool)),this,SLOT(stopTimer()));
  4970. connect(resetAction,SIGNAL(triggered(bool)),this,SLOT(reset()));
  4971. clock.setInterval(500);
  4972. clock.setSingleShot(false);
  4973. connect(&clock,SIGNAL(timeout()),this,SLOT(updateTime()));
  4974. setSegmentStyle(Filled);
  4975. updateDisplay();
  4976. }
  4977. /*:408*//*409:*/
  4978. #line 9842 "./typica.w"
  4979. void TimerDisplay::updateTime()
  4980. {
  4981. QTime time;
  4982. int cseconds= 0;
  4983. int oseconds= 0;
  4984. int r= 0;
  4985. QTime nt= QTime(0,0,0);
  4986. int n= 0;
  4987. int bseconds= 0;
  4988. switch(m)
  4989. {
  4990. case TimerDisplay::CountUp:
  4991. /*410:*/
  4992. #line 9874 "./typica.w"
  4993. /*411:*/
  4994. #line 9887 "./typica.w"
  4995. #define TIMETOINT(t) ((t.hour() * 60 * 60) + (t.minute() * 60) + (t.second()))
  4996. time= QTime::currentTime();
  4997. cseconds= TIMETOINT(time);
  4998. oseconds= TIMETOINT(relative);
  4999. r= cseconds-oseconds;
  5000. /*:411*/
  5001. #line 9875 "./typica.w"
  5002. nt= nt.addSecs(r);
  5003. if(nt!=s)
  5004. {
  5005. s= nt;
  5006. emit valueChanged(s);
  5007. }
  5008. /*:410*/
  5009. #line 9855 "./typica.w"
  5010. ;
  5011. break;
  5012. case TimerDisplay::CountDown:
  5013. /*412:*/
  5014. #line 9899 "./typica.w"
  5015. if(s> QTime(0,0,0))
  5016. {
  5017. /*411:*/
  5018. #line 9887 "./typica.w"
  5019. #define TIMETOINT(t) ((t.hour() * 60 * 60) + (t.minute() * 60) + (t.second()))
  5020. time= QTime::currentTime();
  5021. cseconds= TIMETOINT(time);
  5022. oseconds= TIMETOINT(relative);
  5023. r= cseconds-oseconds;
  5024. /*:411*/
  5025. #line 9902 "./typica.w"
  5026. bseconds= TIMETOINT(base);
  5027. n= bseconds-r;
  5028. nt= nt.addSecs(n);
  5029. if(nt!=s)
  5030. {
  5031. s= nt;
  5032. emit valueChanged(s);
  5033. }
  5034. }
  5035. /*:412*/
  5036. #line 9858 "./typica.w"
  5037. ;
  5038. break;
  5039. case TimerDisplay::Clock:
  5040. /*413:*/
  5041. #line 9916 "./typica.w"
  5042. time= QTime::currentTime();
  5043. if(time!=s)
  5044. {
  5045. s= time;
  5046. emit valueChanged(s);
  5047. }
  5048. /*:413*/
  5049. #line 9861 "./typica.w"
  5050. ;
  5051. break;
  5052. default:
  5053. Q_ASSERT_X(false,"updateTime","invalid timer mode");
  5054. break;
  5055. }
  5056. updateDisplay();
  5057. }
  5058. /*:409*//*414:*/
  5059. #line 9928 "./typica.w"
  5060. #define TIMESUBTRACT(t1, t2) (t1.addSecs(-(TIMETOINT(t2))).addSecs(-t2.msec()))
  5061. void TimerDisplay::startTimer()
  5062. {
  5063. if(!running)
  5064. {
  5065. relative= QTime::currentTime();
  5066. if(ar)
  5067. {
  5068. reset();
  5069. }
  5070. else
  5071. {
  5072. relative= TIMESUBTRACT(relative,s);
  5073. }
  5074. if(m==Clock)
  5075. {
  5076. updateTime();
  5077. }
  5078. base= s;
  5079. clock.start();
  5080. running= true;
  5081. emit runStateChanged(true);
  5082. }
  5083. }
  5084. /*:414*//*415:*/
  5085. #line 9958 "./typica.w"
  5086. void TimerDisplay::stopTimer()
  5087. {
  5088. if(running)
  5089. {
  5090. clock.stop();
  5091. running= false;
  5092. emit runStateChanged(false);
  5093. }
  5094. }
  5095. /*:415*//*416:*/
  5096. #line 9971 "./typica.w"
  5097. TimerDisplay::~TimerDisplay()
  5098. {
  5099. clock.stop();
  5100. }
  5101. /*:416*//*417:*/
  5102. #line 9980 "./typica.w"
  5103. void TimerDisplay::setCountUpMode()
  5104. {
  5105. m= TimerDisplay::CountUp;
  5106. }
  5107. void TimerDisplay::setCountDownMode()
  5108. {
  5109. m= TimerDisplay::CountDown;
  5110. }
  5111. void TimerDisplay::setClockMode()
  5112. {
  5113. m= TimerDisplay::Clock;
  5114. }
  5115. /*:417*//*418:*/
  5116. #line 9998 "./typica.w"
  5117. QString TimerDisplay::value()
  5118. {
  5119. return s.toString(f);
  5120. }
  5121. QTime TimerDisplay::seconds()
  5122. {
  5123. return s;
  5124. }
  5125. TimerDisplay::TimerMode TimerDisplay::mode()
  5126. {
  5127. return m;
  5128. }
  5129. bool TimerDisplay::isRunning()
  5130. {
  5131. return running;
  5132. }
  5133. QTime TimerDisplay::resetValue()
  5134. {
  5135. return r;
  5136. }
  5137. QString TimerDisplay::displayFormat()
  5138. {
  5139. return f;
  5140. }
  5141. bool TimerDisplay::autoReset()
  5142. {
  5143. return ar;
  5144. }
  5145. /*:418*//*419:*/
  5146. #line 10036 "./typica.w"
  5147. void TimerDisplay::setTimer(QTime value)
  5148. {
  5149. if(value.isValid())
  5150. {
  5151. s= value;
  5152. updateDisplay();
  5153. emit valueChanged(value);
  5154. }
  5155. }
  5156. void TimerDisplay::setMode(TimerDisplay::TimerMode mode)
  5157. {
  5158. m= mode;
  5159. }
  5160. void TimerDisplay::setResetValue(QTime value)
  5161. {
  5162. r= value;
  5163. }
  5164. void TimerDisplay::setDisplayFormat(QString format)
  5165. {
  5166. f= format;
  5167. setNumDigits(format.length());
  5168. }
  5169. void TimerDisplay::setAutoReset(bool reset)
  5170. {
  5171. ar= reset;
  5172. }
  5173. /*:419*//*420:*/
  5174. #line 10071 "./typica.w"
  5175. void TimerDisplay::copyTimer()
  5176. {
  5177. QApplication::clipboard()->setText(value());
  5178. }
  5179. /*:420*//*421:*/
  5180. #line 10080 "./typica.w"
  5181. void TimerDisplay::reset()
  5182. {
  5183. if(!running)
  5184. {
  5185. s= r;
  5186. updateDisplay();
  5187. }
  5188. }
  5189. /*:421*//*422:*/
  5190. #line 10093 "./typica.w"
  5191. void TimerDisplay::updateDisplay()
  5192. {
  5193. display(value());
  5194. }
  5195. /*:422*/
  5196. #line 551 "./typica.w"
  5197. /*428:*/
  5198. #line 10187 "./typica.w"
  5199. int PackLayout::doLayout(const QRect&rect,bool testOnly)const
  5200. {
  5201. int x= rect.x();
  5202. int y= rect.y();
  5203. QLayoutItem*item;
  5204. if(orientation==Qt::Horizontal)
  5205. {
  5206. /*429:*/
  5207. #line 10211 "./typica.w"
  5208. foreach(item,itemList)
  5209. {
  5210. int nextX= x+item->sizeHint().width()+spacing();
  5211. int right= x+item->sizeHint().width();
  5212. if(item==itemList.last())
  5213. {
  5214. right= rect.right();
  5215. }
  5216. int bottom= rect.bottom();
  5217. if(!testOnly)
  5218. {
  5219. item->setGeometry(QRect(QPoint(x,y),QPoint(right,bottom)));
  5220. }
  5221. x= nextX;
  5222. }
  5223. /*:429*/
  5224. #line 10195 "./typica.w"
  5225. }
  5226. else
  5227. {
  5228. /*430:*/
  5229. #line 10230 "./typica.w"
  5230. foreach(item,itemList)
  5231. {
  5232. int nextY= y+item->sizeHint().height()+spacing();
  5233. int bottom= y+item->sizeHint().height();
  5234. if(item==itemList.last())
  5235. {
  5236. bottom= rect.bottom();
  5237. }
  5238. int right= rect.right();
  5239. if(!testOnly)
  5240. {
  5241. item->setGeometry(QRect(QPoint(x,y),QPoint(right,bottom)));
  5242. }
  5243. y= nextY;
  5244. }
  5245. /*:430*/
  5246. #line 10199 "./typica.w"
  5247. }
  5248. return y;
  5249. }
  5250. /*:428*//*431:*/
  5251. #line 10254 "./typica.w"
  5252. QSize PackLayout::minimumSize()const
  5253. {
  5254. QSize size;
  5255. QLayoutItem*item;
  5256. foreach(item,itemList)
  5257. {
  5258. if(orientation==Qt::Horizontal)
  5259. {
  5260. size+= QSize(item->minimumSize().width(),0);
  5261. if(size.height()<item->minimumSize().height())
  5262. {
  5263. size.setHeight(item->minimumSize().height());
  5264. }
  5265. }
  5266. else
  5267. {
  5268. size+= QSize(0,item->minimumSize().height());
  5269. if(size.width()<item->minimumSize().width())
  5270. {
  5271. size.setWidth(item->minimumSize().width());
  5272. }
  5273. }
  5274. }
  5275. size+= QSize(2*margin(),2*margin());
  5276. return size;
  5277. }
  5278. /*:431*//*432:*/
  5279. #line 10286 "./typica.w"
  5280. PackLayout::PackLayout(QWidget*parent,int margin,int spacing):
  5281. QLayout(parent)
  5282. {
  5283. setMargin(margin);
  5284. setSpacing(spacing);
  5285. setOrientation(Qt::Horizontal);
  5286. }
  5287. PackLayout::PackLayout(int spacing)
  5288. {
  5289. setSpacing(spacing);
  5290. setOrientation(Qt::Horizontal);
  5291. }
  5292. /*:432*//*433:*/
  5293. #line 10304 "./typica.w"
  5294. PackLayout::~PackLayout()
  5295. {
  5296. QLayoutItem*item;
  5297. while((item= takeAt(0)))
  5298. {
  5299. delete item;
  5300. }
  5301. }
  5302. /*:433*//*434:*/
  5303. #line 10318 "./typica.w"
  5304. QLayoutItem*PackLayout::takeAt(int index)
  5305. {
  5306. if(index>=0&&index<itemList.size())
  5307. {
  5308. return itemList.takeAt(index);
  5309. }
  5310. else
  5311. {
  5312. return NULL;
  5313. }
  5314. }
  5315. /*:434*//*435:*/
  5316. #line 10334 "./typica.w"
  5317. QLayoutItem*PackLayout::itemAt(int index)const
  5318. {
  5319. if(index>=0&&index<itemList.size())
  5320. {
  5321. return itemList.at(index);
  5322. }
  5323. else
  5324. {
  5325. return NULL;
  5326. }
  5327. }
  5328. /*:435*//*436:*/
  5329. #line 10357 "./typica.w"
  5330. void PackLayout::addItem(QLayoutItem*item)
  5331. {
  5332. itemList.append(item);
  5333. }
  5334. /*:436*//*437:*/
  5335. #line 10365 "./typica.w"
  5336. int PackLayout::count()const
  5337. {
  5338. return itemList.size();
  5339. }
  5340. /*:437*//*438:*/
  5341. #line 10377 "./typica.w"
  5342. Qt::Orientations PackLayout::expandingDirections()const
  5343. {
  5344. return Qt::Vertical|Qt::Horizontal;
  5345. }
  5346. bool PackLayout::hasHeightForWidth()const
  5347. {
  5348. return false;
  5349. }
  5350. int PackLayout::heightForWidth(int width)const
  5351. {
  5352. return doLayout(QRect(0,0,width,0),true);
  5353. }
  5354. void PackLayout::setGeometry(const QRect&rect)
  5355. {
  5356. QLayout::setGeometry(rect);
  5357. doLayout(rect,false);
  5358. }
  5359. QSize PackLayout::sizeHint()const
  5360. {
  5361. return minimumSize();
  5362. }
  5363. /*:438*//*439:*/
  5364. #line 10408 "./typica.w"
  5365. void PackLayout::setOrientation(Qt::Orientations direction)
  5366. {
  5367. orientation= direction;
  5368. doLayout(geometry(),false);
  5369. }
  5370. /*:439*/
  5371. #line 552 "./typica.w"
  5372. /*441:*/
  5373. #line 10447 "./typica.w"
  5374. SceneButton::SceneButton():QGraphicsScene()
  5375. {
  5376. }
  5377. SceneButton::~SceneButton()
  5378. {
  5379. }
  5380. void SceneButton::mousePressEvent(QGraphicsSceneMouseEvent*mouseEvent)
  5381. {
  5382. emit clicked(mouseEvent->buttonDownScreenPos(mouseEvent->button()));
  5383. }
  5384. /*:441*/
  5385. #line 553 "./typica.w"
  5386. /*443:*/
  5387. #line 10493 "./typica.w"
  5388. WidgetDecorator::WidgetDecorator(QWidget*widget,const QString&labeltext,
  5389. Qt::Orientations orientation,
  5390. QWidget*parent,Qt::WindowFlags f):
  5391. QWidget(parent,f),label(new QGraphicsView()),
  5392. scene(new SceneButton())
  5393. {
  5394. layout= new PackLayout(this);
  5395. layout->setOrientation(orientation);
  5396. /*444:*/
  5397. #line 10513 "./typica.w"
  5398. label->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  5399. label->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  5400. label->setFrameShape(QFrame::NoFrame);
  5401. label->setInteractive(true);
  5402. /*:444*/
  5403. #line 10502 "./typica.w"
  5404. /*445:*/
  5405. #line 10524 "./typica.w"
  5406. scene->setBackgroundBrush(Qt::cyan);
  5407. text= scene->addText(labeltext);
  5408. if(orientation==Qt::Horizontal)
  5409. {
  5410. text->rotate(270.0);
  5411. }
  5412. label->setScene(scene);
  5413. /*:445*/
  5414. #line 10503 "./typica.w"
  5415. /*446:*/
  5416. #line 10542 "./typica.w"
  5417. if(orientation==Qt::Horizontal)
  5418. {
  5419. label->setMaximumWidth((int)(text->boundingRect().height()+1));
  5420. }
  5421. else
  5422. {
  5423. label->setMaximumHeight((int)(text->boundingRect().height()+1));
  5424. }
  5425. label->centerOn(text);
  5426. /*:446*/
  5427. #line 10504 "./typica.w"
  5428. /*447:*/
  5429. #line 10557 "./typica.w"
  5430. layout->addWidget(label);
  5431. layout->addWidget(widget);
  5432. if(orientation==Qt::Horizontal)
  5433. {
  5434. setMinimumSize(widget->sizeHint().width()+label->sizeHint().width(),
  5435. widget->sizeHint().height());
  5436. }
  5437. else
  5438. {
  5439. setMinimumSize(widget->sizeHint().width(),
  5440. widget->sizeHint().height()+label->sizeHint().height());
  5441. }
  5442. /*:447*/
  5443. #line 10505 "./typica.w"
  5444. }
  5445. /*:443*//*448:*/
  5446. #line 10574 "./typica.w"
  5447. void WidgetDecorator::setBackgroundBrush(QBrush background)
  5448. {
  5449. scene->setBackgroundBrush(background);
  5450. }
  5451. void WidgetDecorator::setTextColor(QColor color)
  5452. {
  5453. text->setDefaultTextColor(color);
  5454. }
  5455. /*:448*//*449:*/
  5456. #line 10587 "./typica.w"
  5457. WidgetDecorator::~WidgetDecorator()
  5458. {
  5459. }
  5460. /*:449*/
  5461. #line 554 "./typica.w"
  5462. /*454:*/
  5463. #line 10686 "./typica.w"
  5464. void LogEditWindow::addTheRows()
  5465. {
  5466. QTime s= startTime->time();
  5467. while(s<endTime->time())
  5468. {
  5469. model->newMeasurement(Measurement(0,s),1);
  5470. s= s.addSecs(interval->value());
  5471. }
  5472. model->newMeasurement(Measurement(0,endTime->time()),1);
  5473. }
  5474. /*:454*//*455:*/
  5475. #line 10700 "./typica.w"
  5476. LogEditWindow::LogEditWindow():QMainWindow(NULL),
  5477. centralWidget(new QWidget(NULL)),mainLayout(new PackLayout(0)),
  5478. addRowsLayout(new QHBoxLayout(NULL)),
  5479. startTimeLabel(new QLabel("Start Time")),
  5480. startTime(new QTimeEdit(QTime(0,0,0,0))),
  5481. endTimeLabel(new QLabel("End Time")),
  5482. endTime(new QTimeEdit(QTime(0,20,0,0))),
  5483. intervalLabel(new QLabel("Interval (seconds)")),
  5484. interval(new QSpinBox()),
  5485. addRows(new QPushButton("Add Rows")),
  5486. saveXml(new QAction(tr("Save Profile As..."),NULL)),
  5487. saveCsv(new QAction(tr("Export CSV"),NULL)),
  5488. openXml(new QAction(tr("Load Target Profile..."),NULL)),
  5489. model(new MeasurementModel()),
  5490. log(new QTableView())
  5491. {
  5492. /*456:*/
  5493. #line 10737 "./typica.w"
  5494. QSettings settings;
  5495. resize(settings.value("logSize",QSize(620,400)).toSize());
  5496. move(settings.value("logPos",QPoint(200,60)).toPoint());
  5497. /*:456*/
  5498. #line 10717 "./typica.w"
  5499. /*457:*/
  5500. #line 10750 "./typica.w"
  5501. mainLayout->setOrientation(Qt::Vertical);
  5502. addRowsLayout->addSpacing(10);
  5503. addRowsLayout->addWidget(startTimeLabel);
  5504. addRowsLayout->addWidget(startTime);
  5505. addRowsLayout->addSpacing(10);
  5506. startTime->setDisplayFormat("mm:ss");
  5507. addRowsLayout->addWidget(endTimeLabel);
  5508. addRowsLayout->addWidget(endTime);
  5509. addRowsLayout->addSpacing(10);
  5510. endTime->setDisplayFormat("mm:ss");
  5511. addRowsLayout->addWidget(intervalLabel);
  5512. addRowsLayout->addWidget(interval);
  5513. addRowsLayout->addSpacing(10);
  5514. interval->setRange(0,60);
  5515. interval->setValue(30);
  5516. addRowsLayout->addWidget(addRows);
  5517. addRowsLayout->addSpacing(10);
  5518. connect(addRows,SIGNAL(clicked()),this,SLOT(addTheRows()));
  5519. /*:457*/
  5520. #line 10718 "./typica.w"
  5521. /*458:*/
  5522. #line 10773 "./typica.w"
  5523. model->setHeaderData(0,Qt::Horizontal,"Time");
  5524. model->setHeaderData(1,Qt::Horizontal,"Temperature");
  5525. model->setHeaderData(2,Qt::Horizontal,"Annotation");
  5526. model->clear();
  5527. /*:458*/
  5528. #line 10719 "./typica.w"
  5529. /*459:*/
  5530. #line 10782 "./typica.w"
  5531. log->setModel(model);
  5532. log->setColumnWidth(0,100);
  5533. log->setColumnWidth(1,100);
  5534. log->setColumnWidth(2,100);
  5535. /*:459*/
  5536. #line 10720 "./typica.w"
  5537. mainLayout->addItem(addRowsLayout);
  5538. mainLayout->addWidget(log);
  5539. centralWidget->setLayout(mainLayout);
  5540. setCentralWidget(centralWidget);
  5541. QMenu*fileMenu= menuBar()->addMenu(tr("&File"));
  5542. fileMenu->addAction(openXml);
  5543. connect(openXml,SIGNAL(triggered()),this,SLOT(openXML()));
  5544. fileMenu->addAction(saveXml);
  5545. connect(saveXml,SIGNAL(triggered()),this,SLOT(saveXML()));
  5546. fileMenu->addAction(saveCsv);
  5547. connect(saveCsv,SIGNAL(triggered()),this,SLOT(saveCSV()));
  5548. }
  5549. /*:455*//*460:*/
  5550. #line 10793 "./typica.w"
  5551. void LogEditWindow::saveXML()
  5552. {
  5553. QSettings settings;
  5554. QString lastDir= settings.value("lastDirectory").toString();
  5555. QString filename= QFileDialog::getSaveFileName(this,tr("Save Log As..."),
  5556. lastDir,"",0);
  5557. QFile file(filename);
  5558. XMLOutput writer(model,&file,0);
  5559. writer.addTemperatureColumn("Temperature",1);
  5560. writer.addAnnotationColumn("Annotation",2);
  5561. if(writer.output())
  5562. {
  5563. QFileInfo info(filename);
  5564. QDir directory= info.dir();
  5565. lastDir= directory.path();
  5566. settings.setValue("lastDirectory",lastDir);
  5567. }
  5568. }
  5569. void LogEditWindow::saveCSV()
  5570. {
  5571. QSettings settings;
  5572. QString lastDir= settings.value("lastDirectory").toString();
  5573. QString filename= QFileDialog::getSaveFileName(this,tr("Export As..."),
  5574. lastDir,"",0);
  5575. QFile file(filename);
  5576. CSVOutput writer(model,&file,0);
  5577. writer.addTemperatureColumn("Temperature",1);
  5578. writer.addAnnotationColumn("Annotation",2);
  5579. if(writer.output())
  5580. {
  5581. QFileInfo info(filename);
  5582. QDir directory= info.dir();
  5583. lastDir= directory.path();
  5584. settings.setValue("lastDirectory",lastDir);
  5585. }
  5586. }
  5587. /*:460*//*461:*/
  5588. #line 10836 "./typica.w"
  5589. void LogEditWindow::openXML()
  5590. {
  5591. QSettings settings;
  5592. QString lastDir= settings.value("lastDirectory").toString();
  5593. QString filename= QFileDialog::getOpenFileName(this,tr("Open XML Log..."),
  5594. lastDir,"",0);
  5595. if(filename.isNull())
  5596. {
  5597. return;
  5598. }
  5599. QFile file(filename);
  5600. XMLInput reader(&file,1);
  5601. connect(&reader,SIGNAL(measure(Measurement,int)),
  5602. model,SLOT(newMeasurement(Measurement,int)));
  5603. connect(&reader,SIGNAL(annotation(QString,int,int)),
  5604. model,SLOT(newAnnotation(QString,int,int)));
  5605. if(reader.input())
  5606. {
  5607. QFileInfo info(filename);
  5608. setWindowTitle(QString(tr("%1 - %2")).
  5609. arg(QCoreApplication::applicationName()).arg(info.baseName()));
  5610. QDir directory= info.dir();
  5611. lastDir= directory.path();
  5612. settings.setValue("lastDirectory",lastDir);
  5613. }
  5614. }
  5615. /*:461*//*462:*/
  5616. #line 10867 "./typica.w"
  5617. void LogEditWindow::closeEvent(QCloseEvent*event)
  5618. {
  5619. QSettings settings;
  5620. settings.setValue("logSize",size());
  5621. settings.setValue("logPos",pos());
  5622. event->accept();
  5623. }
  5624. /*:462*/
  5625. #line 555 "./typica.w"
  5626. /*468:*/
  5627. #line 10982 "./typica.w"
  5628. bool XMLOutput::output()
  5629. {
  5630. if(!out->open(QIODevice::WriteOnly|QIODevice::Text))
  5631. {
  5632. return false;
  5633. }
  5634. QXmlStreamWriter xmlout(out);
  5635. xmlout.writeStartDocument("1.0");
  5636. xmlout.writeDTD("<!DOCTYPE roastlog3.0>");
  5637. xmlout.writeStartElement("roastlog");
  5638. /*469:*/
  5639. #line 11015 "./typica.w"
  5640. foreach(int c,temperatureColumns.keys())
  5641. {
  5642. xmlout.writeStartElement("tempseries");
  5643. xmlout.writeAttribute("name",temperatureColumns.value(c));
  5644. xmlout.writeEndElement();
  5645. }
  5646. foreach(int c,controlColumns.keys())
  5647. {
  5648. xmlout.writeStartElement("controlseries");
  5649. xmlout.writeAttribute("name",controlColumns.value(c));
  5650. xmlout.writeEndElement();
  5651. }
  5652. foreach(int c,annotationColumns.keys())
  5653. {
  5654. xmlout.writeStartElement("noteseries");
  5655. xmlout.writeAttribute("name",annotationColumns.value(c));
  5656. xmlout.writeEndElement();
  5657. }
  5658. /*:469*/
  5659. #line 10993 "./typica.w"
  5660. xmlout.writeStartElement("roast");
  5661. bool oresult;
  5662. for(int i= 0;i<data->rowCount();i++)
  5663. {
  5664. /*470:*/
  5665. #line 11040 "./typica.w"
  5666. oresult= false;
  5667. foreach(int c,temperatureColumns.keys())
  5668. {
  5669. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5670. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  5671. {
  5672. oresult= true;
  5673. break;
  5674. }
  5675. }
  5676. foreach(int c,controlColumns.keys())
  5677. {
  5678. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5679. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  5680. {
  5681. oresult= true;
  5682. break;
  5683. }
  5684. }
  5685. if(oresult==false)
  5686. {
  5687. foreach(int c,annotationColumns.keys())
  5688. {
  5689. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5690. !(data->data(data->index(i,c),Qt::DisplayRole).toString().
  5691. isEmpty()))
  5692. {
  5693. oresult= true;
  5694. break;
  5695. }
  5696. }
  5697. }
  5698. /*:470*/
  5699. #line 10998 "./typica.w"
  5700. if(oresult)
  5701. {
  5702. /*471:*/
  5703. #line 11079 "./typica.w"
  5704. xmlout.writeStartElement("tuple");
  5705. xmlout.writeTextElement("time",data->data(data->index(i,time),
  5706. Qt::DisplayRole).toString());
  5707. foreach(int c,temperatureColumns.keys())
  5708. {
  5709. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5710. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  5711. {
  5712. xmlout.writeStartElement("temperature");
  5713. xmlout.writeAttribute("series",temperatureColumns.value(c));
  5714. if(data->data(data->index(i,c),Qt::UserRole).toMap().contains("relative"))
  5715. {
  5716. if(data->data(data->index(i,c),Qt::UserRole).toMap().value("relative").toBool())
  5717. {
  5718. xmlout.writeAttribute("relative","true");
  5719. }
  5720. }
  5721. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).
  5722. toString());
  5723. xmlout.writeEndElement();
  5724. }
  5725. }
  5726. foreach(int c,controlColumns.keys())
  5727. {
  5728. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5729. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  5730. {
  5731. xmlout.writeStartElement("control");
  5732. xmlout.writeAttribute("series",controlColumns.value(c));
  5733. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).toString());
  5734. xmlout.writeEndElement();
  5735. }
  5736. }
  5737. foreach(int c,annotationColumns.keys())
  5738. {
  5739. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5740. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  5741. {
  5742. xmlout.writeStartElement("annotation");
  5743. xmlout.writeAttribute("series",annotationColumns.value(c));
  5744. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).
  5745. toString());
  5746. xmlout.writeEndElement();
  5747. }
  5748. }
  5749. xmlout.writeEndElement();
  5750. /*:471*/
  5751. #line 11001 "./typica.w"
  5752. }
  5753. }
  5754. xmlout.writeEndElement();
  5755. xmlout.writeEndElement();
  5756. xmlout.writeEndDocument();
  5757. out->close();
  5758. return true;
  5759. }
  5760. /*:468*//*472:*/
  5761. #line 11129 "./typica.w"
  5762. XMLOutput::XMLOutput(MeasurementModel*model,QIODevice*device,int timec)
  5763. :QObject(NULL),data(model),out(device),time(timec)
  5764. {
  5765. }
  5766. void XMLOutput::setModel(MeasurementModel*model)
  5767. {
  5768. data= model;
  5769. }
  5770. void XMLOutput::setTimeColumn(int column)
  5771. {
  5772. time= column;
  5773. }
  5774. void XMLOutput::setDevice(QIODevice*device)
  5775. {
  5776. out= device;
  5777. }
  5778. /*:472*//*473:*/
  5779. #line 11158 "./typica.w"
  5780. void XMLOutput::addTemperatureColumn(const QString&series,int column)
  5781. {
  5782. temperatureColumns.insert(column,series);
  5783. }
  5784. void XMLOutput::addControlColumn(const QString&series,int column)
  5785. {
  5786. controlColumns.insert(column,series);
  5787. }
  5788. void XMLOutput::addAnnotationColumn(const QString&series,int column)
  5789. {
  5790. annotationColumns.insert(column,series);
  5791. }
  5792. /*:473*/
  5793. #line 556 "./typica.w"
  5794. /*475:*/
  5795. #line 11215 "./typica.w"
  5796. bool XMLInput::input()
  5797. {
  5798. if(!in->open(QIODevice::ReadOnly|QIODevice::Text))
  5799. {
  5800. return false;
  5801. }
  5802. QXmlStreamReader xmlin(in);
  5803. QMap<QString,int> temperatureColumns;
  5804. QMap<QString,int> annotationColumns;
  5805. int nextColumn= firstc;
  5806. /*476:*/
  5807. #line 11246 "./typica.w"
  5808. while(!xmlin.isDTD())
  5809. {
  5810. xmlin.readNext();
  5811. }
  5812. if(xmlin.isDTD())
  5813. {
  5814. if(xmlin.text()=="<!DOCTYPE roastlog>")
  5815. {
  5816. /*477:*/
  5817. #line 11268 "./typica.w"
  5818. emit newTemperatureColumn(firstc,"Bean");
  5819. emit newAnnotationColumn(firstc+1,"Note");
  5820. emit lastColumn(firstc+1);
  5821. /*:477*/
  5822. #line 11255 "./typica.w"
  5823. }
  5824. else
  5825. {
  5826. xmlin.readNext();
  5827. /*478:*/
  5828. #line 11277 "./typica.w"
  5829. while(xmlin.name()!="roast")
  5830. {
  5831. if(xmlin.isStartElement())
  5832. {
  5833. if((xmlin.name()=="tempseries")||(xmlin.name()=="controlseries"))
  5834. {
  5835. temperatureColumns.insert(xmlin.attributes().value("name").
  5836. toString(),
  5837. nextColumn);
  5838. emit newTemperatureColumn(nextColumn,
  5839. xmlin.attributes().value("name").
  5840. toString());
  5841. nextColumn++;
  5842. }
  5843. else if(xmlin.name()=="noteseries")
  5844. {
  5845. annotationColumns.insert(xmlin.attributes().value("name").
  5846. toString(),nextColumn);
  5847. emit newAnnotationColumn(nextColumn,
  5848. xmlin.attributes().value("name").
  5849. toString());
  5850. nextColumn++;
  5851. }
  5852. }
  5853. xmlin.readNext();
  5854. }
  5855. emit lastColumn(nextColumn-1);
  5856. /*:478*/
  5857. #line 11260 "./typica.w"
  5858. }
  5859. }
  5860. /*:476*/
  5861. #line 11226 "./typica.w"
  5862. QTime timeval= QTime();
  5863. double tempval= 0;
  5864. QString noteval= QString();
  5865. int column;
  5866. int counter= 0;
  5867. while(!xmlin.atEnd())
  5868. {
  5869. /*479:*/
  5870. #line 11318 "./typica.w"
  5871. xmlin.readNext();
  5872. if(xmlin.isStartElement())
  5873. {
  5874. /*480:*/
  5875. #line 11344 "./typica.w"
  5876. if(xmlin.name()=="time")
  5877. {
  5878. timeval= QTime::fromString(xmlin.readElementText(),"mm:ss.zzz");
  5879. }
  5880. else if(xmlin.name()=="temperature")
  5881. {
  5882. column= xmlin.attributes().value("series").toString().isEmpty()?
  5883. firstc:temperatureColumns.value(xmlin.attributes().
  5884. value("series").toString());
  5885. bool relative= (xmlin.attributes().value("relative")=="true");
  5886. tempval= xmlin.readElementText().toDouble();
  5887. Measurement measurement(tempval,timeval);
  5888. if(relative)
  5889. {
  5890. measurement.insert("relative",true);
  5891. }
  5892. emit measure(measurement,column);
  5893. }
  5894. else if(xmlin.name()=="control")
  5895. {
  5896. column= xmlin.attributes().value("series").toString().isEmpty()?
  5897. firstc:temperatureColumns.value(xmlin.attributes().
  5898. value("series").toString());
  5899. tempval= xmlin.readElementText().toDouble();
  5900. Measurement measurement(tempval,timeval,Units::Unitless);
  5901. emit measure(measurement,column);
  5902. }
  5903. else if(xmlin.name()=="annotation")
  5904. {
  5905. column= xmlin.attributes().value("series").toString().isEmpty()?
  5906. firstc+1:annotationColumns.value(xmlin.attributes().
  5907. value("series").toString());
  5908. noteval= xmlin.readElementText();
  5909. if(!noteval.isEmpty())
  5910. {
  5911. emit annotation(noteval,firstc,column);
  5912. }
  5913. }
  5914. /*:480*/
  5915. #line 11322 "./typica.w"
  5916. }
  5917. counter++;
  5918. if(counter%100==0)
  5919. {
  5920. QCoreApplication::processEvents();
  5921. }
  5922. /*:479*/
  5923. #line 11234 "./typica.w"
  5924. }
  5925. return true;
  5926. }
  5927. /*:475*//*481:*/
  5928. #line 11386 "./typica.w"
  5929. XMLInput::XMLInput(QIODevice*input,int c):
  5930. firstc(c),in(input)
  5931. {
  5932. }
  5933. void XMLInput::setFirstColumn(int column)
  5934. {
  5935. firstc= column;
  5936. }
  5937. void XMLInput::setDevice(QIODevice*device)
  5938. {
  5939. in= device;
  5940. }
  5941. /*:481*/
  5942. #line 557 "./typica.w"
  5943. /*486:*/
  5944. #line 11477 "./typica.w"
  5945. bool CSVOutput::output()
  5946. {
  5947. if(!out->open(QIODevice::WriteOnly|QIODevice::Text))
  5948. {
  5949. return false;
  5950. }
  5951. QTextStream output(out);
  5952. /*487:*/
  5953. #line 11501 "./typica.w"
  5954. output<<"Time";
  5955. foreach(int c,temperatureColumns.keys())
  5956. {
  5957. output<<','<<temperatureColumns.value(c);
  5958. }
  5959. foreach(int c,controlColumns.keys())
  5960. {
  5961. output<<','<<controlColumns.value(c);
  5962. }
  5963. foreach(int c,annotationColumns.keys())
  5964. {
  5965. output<<','<<annotationColumns.value(c);
  5966. }
  5967. output<<'\n';
  5968. /*:487*/
  5969. #line 11485 "./typica.w"
  5970. bool oresult;
  5971. for(int i= 0;i<data->rowCount();i++)
  5972. {
  5973. /*470:*/
  5974. #line 11040 "./typica.w"
  5975. oresult= false;
  5976. foreach(int c,temperatureColumns.keys())
  5977. {
  5978. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5979. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  5980. {
  5981. oresult= true;
  5982. break;
  5983. }
  5984. }
  5985. foreach(int c,controlColumns.keys())
  5986. {
  5987. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5988. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  5989. {
  5990. oresult= true;
  5991. break;
  5992. }
  5993. }
  5994. if(oresult==false)
  5995. {
  5996. foreach(int c,annotationColumns.keys())
  5997. {
  5998. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  5999. !(data->data(data->index(i,c),Qt::DisplayRole).toString().
  6000. isEmpty()))
  6001. {
  6002. oresult= true;
  6003. break;
  6004. }
  6005. }
  6006. }
  6007. /*:470*/
  6008. #line 11489 "./typica.w"
  6009. if(oresult)
  6010. {
  6011. /*488:*/
  6012. #line 11526 "./typica.w"
  6013. output<<data->data(data->index(i,time),Qt::DisplayRole).toString();
  6014. foreach(int c,temperatureColumns.keys())
  6015. {
  6016. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  6017. }
  6018. foreach(int c,controlColumns.keys())
  6019. {
  6020. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  6021. }
  6022. foreach(int c,annotationColumns.keys())
  6023. {
  6024. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  6025. }
  6026. output<<'\n';
  6027. /*:488*/
  6028. #line 11492 "./typica.w"
  6029. }
  6030. }
  6031. out->close();
  6032. return true;
  6033. }
  6034. /*:486*//*489:*/
  6035. #line 11545 "./typica.w"
  6036. CSVOutput::CSVOutput(MeasurementModel*model,QIODevice*device,int timec):
  6037. data(model),out(device),time(timec)
  6038. {
  6039. }
  6040. void CSVOutput::setModel(MeasurementModel*model)
  6041. {
  6042. data= model;
  6043. }
  6044. void CSVOutput::setTimeColumn(int column)
  6045. {
  6046. time= column;
  6047. }
  6048. void CSVOutput::addTemperatureColumn(const QString&series,int column)
  6049. {
  6050. temperatureColumns.insert(column,series);
  6051. }
  6052. void CSVOutput::addControlColumn(const QString&series,int column)
  6053. {
  6054. controlColumns.insert(column,series);
  6055. }
  6056. void CSVOutput::addAnnotationColumn(const QString&series,int column)
  6057. {
  6058. annotationColumns.insert(column,series);
  6059. }
  6060. void CSVOutput::setDevice(QIODevice*device)
  6061. {
  6062. out= device;
  6063. }
  6064. #line 1 "./webview.w"
  6065. /*:489*/
  6066. #line 558 "./typica.w"
  6067. /*524:*/
  6068. #line 11806 "./typica.w"
  6069. QString SaltModel::arrayLiteral(int column,int role)const
  6070. {
  6071. QString literal= "'{";
  6072. for(int i= 0;i<rowCount();i++)
  6073. {
  6074. QString datum= data(index(i,column),role).toString();
  6075. if(!datum.isEmpty())
  6076. {
  6077. literal.append(datum);
  6078. literal.append(", ");
  6079. }
  6080. }
  6081. if(literal.size()> 2)
  6082. {
  6083. literal.chop(2);
  6084. }
  6085. literal.append("}'");
  6086. return literal;
  6087. }
  6088. QString SaltModel::quotedArrayLiteral(int column,int role)const
  6089. {
  6090. QString literal= "'{";
  6091. for(int i= 0;i<rowCount();i++)
  6092. {
  6093. QString datum= data(index(i,column),role).toString();
  6094. if(!datum.isEmpty())
  6095. {
  6096. literal.append("\"");
  6097. literal.append(datum);
  6098. literal.append("\", ");
  6099. }
  6100. }
  6101. if(literal.size()> 2)
  6102. {
  6103. literal.chop(2);
  6104. }
  6105. literal.append("}'");
  6106. return literal;
  6107. }
  6108. /*:524*//*525:*/
  6109. #line 11850 "./typica.w"
  6110. QModelIndex SaltModel::parent(const QModelIndex&)const
  6111. {
  6112. return QModelIndex();
  6113. }
  6114. /*:525*//*526:*/
  6115. #line 11869 "./typica.w"
  6116. bool SaltModel::setData(const QModelIndex&index,const QVariant&value,
  6117. int role)
  6118. {
  6119. /*527:*/
  6120. #line 11900 "./typica.w"
  6121. bool valid= false;
  6122. if(index.isValid())
  6123. {
  6124. if(index.row()<modelData.size())
  6125. {
  6126. if(index.column()<colcount)
  6127. {
  6128. valid= true;
  6129. }
  6130. }
  6131. }
  6132. /*:527*/
  6133. #line 11873 "./typica.w"
  6134. if(!valid)
  6135. {
  6136. return false;
  6137. }
  6138. if(index.row()==modelData.size()-1)
  6139. {
  6140. beginInsertRows(QModelIndex(),modelData.size(),modelData.size());
  6141. /*528:*/
  6142. #line 11916 "./typica.w"
  6143. QList<QMap<int,QVariant> > newRow;
  6144. QMap<int,QVariant> defaults;
  6145. for(int i= 0;i<colcount;i++)
  6146. {
  6147. newRow.append(defaults);
  6148. }
  6149. modelData.append(newRow);
  6150. /*:528*/
  6151. #line 11881 "./typica.w"
  6152. endInsertRows();
  6153. }
  6154. QList<QMap<int,QVariant> > row= modelData.at(index.row());
  6155. QMap<int,QVariant> cell= row.at(index.column());
  6156. cell.insert(role,value);
  6157. if(role==Qt::EditRole)
  6158. {
  6159. cell.insert(Qt::DisplayRole,value);
  6160. }
  6161. row.replace(index.column(),cell);
  6162. modelData.replace(index.row(),row);
  6163. emit dataChanged(index,index);
  6164. return true;
  6165. }
  6166. /*:526*//*529:*/
  6167. #line 11927 "./typica.w"
  6168. SaltModel::SaltModel(int columns):QAbstractItemModel(),colcount(columns)
  6169. {
  6170. for(int i= 0;i<columns;i++)
  6171. {
  6172. hData<<"";
  6173. }
  6174. /*528:*/
  6175. #line 11916 "./typica.w"
  6176. QList<QMap<int,QVariant> > newRow;
  6177. QMap<int,QVariant> defaults;
  6178. for(int i= 0;i<colcount;i++)
  6179. {
  6180. newRow.append(defaults);
  6181. }
  6182. modelData.append(newRow);
  6183. /*:528*/
  6184. #line 11934 "./typica.w"
  6185. }
  6186. /*:529*//*530:*/
  6187. #line 11939 "./typica.w"
  6188. SaltModel::~SaltModel()
  6189. {
  6190. }
  6191. /*:530*//*531:*/
  6192. #line 11949 "./typica.w"
  6193. int SaltModel::rowCount(const QModelIndex&parent)const
  6194. {
  6195. return(parent==QModelIndex()?modelData.size():0);
  6196. }
  6197. int SaltModel::columnCount(const QModelIndex&parent)const
  6198. {
  6199. return(parent==QModelIndex()?colcount:0);
  6200. }
  6201. /*:531*//*532:*/
  6202. #line 11962 "./typica.w"
  6203. bool SaltModel::setHeaderData(int section,Qt::Orientation orientation,
  6204. const QVariant&value,int)
  6205. {
  6206. if(orientation==Qt::Horizontal&&section<colcount)
  6207. {
  6208. hData.replace(section,value.toString());
  6209. emit headerDataChanged(orientation,section,section);
  6210. return true;
  6211. }
  6212. return false;
  6213. }
  6214. /*:532*//*533:*/
  6215. #line 11977 "./typica.w"
  6216. QVariant SaltModel::data(const QModelIndex&index,int role)const
  6217. {
  6218. /*527:*/
  6219. #line 11900 "./typica.w"
  6220. bool valid= false;
  6221. if(index.isValid())
  6222. {
  6223. if(index.row()<modelData.size())
  6224. {
  6225. if(index.column()<colcount)
  6226. {
  6227. valid= true;
  6228. }
  6229. }
  6230. }
  6231. /*:527*/
  6232. #line 11980 "./typica.w"
  6233. if(!valid)
  6234. {
  6235. return QVariant();
  6236. }
  6237. QList<QMap<int,QVariant> > row= modelData.at(index.row());
  6238. QMap<int,QVariant> cell= row.at(index.column());
  6239. return cell.value(role,QVariant());
  6240. }
  6241. QVariant SaltModel::headerData(int section,Qt::Orientation orientation,
  6242. int role)const
  6243. {
  6244. if(orientation==Qt::Horizontal&&role==Qt::DisplayRole&&
  6245. section<colcount)
  6246. {
  6247. return QVariant(hData.at(section));
  6248. }
  6249. return QVariant();
  6250. }
  6251. /*:533*//*534:*/
  6252. #line 12004 "./typica.w"
  6253. Qt::ItemFlags SaltModel::flags(const QModelIndex&index)const
  6254. {
  6255. /*527:*/
  6256. #line 11900 "./typica.w"
  6257. bool valid= false;
  6258. if(index.isValid())
  6259. {
  6260. if(index.row()<modelData.size())
  6261. {
  6262. if(index.column()<colcount)
  6263. {
  6264. valid= true;
  6265. }
  6266. }
  6267. }
  6268. /*:527*/
  6269. #line 12007 "./typica.w"
  6270. if(valid)
  6271. {
  6272. return Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable|Qt::ItemIsDropEnabled;
  6273. }
  6274. return 0;
  6275. }
  6276. /*:534*//*535:*/
  6277. #line 12018 "./typica.w"
  6278. QModelIndex SaltModel::index(int row,int column,
  6279. const QModelIndex&parent)const
  6280. {
  6281. if(parent==QModelIndex())
  6282. {
  6283. if(row<modelData.size()&&column<colcount)
  6284. {
  6285. return createIndex(row,column);
  6286. }
  6287. }
  6288. return QModelIndex();
  6289. }
  6290. /*:535*//*536:*/
  6291. #line 12036 "./typica.w"
  6292. void SaltModel::clear()
  6293. {
  6294. beginResetModel();
  6295. modelData.clear();
  6296. /*528:*/
  6297. #line 11916 "./typica.w"
  6298. QList<QMap<int,QVariant> > newRow;
  6299. QMap<int,QVariant> defaults;
  6300. for(int i= 0;i<colcount;i++)
  6301. {
  6302. newRow.append(defaults);
  6303. }
  6304. modelData.append(newRow);
  6305. /*:528*/
  6306. #line 12041 "./typica.w"
  6307. endResetModel();
  6308. }
  6309. /*:536*//*537:*/
  6310. #line 12050 "./typica.w"
  6311. bool SaltModel::removeRows(int row,int count,
  6312. const QModelIndex&parent)
  6313. {
  6314. if(parent==QModelIndex())
  6315. {
  6316. if(row>=0&&count> 0&&(row+count-1)<modelData.size())
  6317. {
  6318. beginRemoveRows(parent,row,row+count-1);
  6319. for(int i= 0;i<count;i++)
  6320. {
  6321. modelData.removeAt(row);
  6322. }
  6323. endRemoveRows();
  6324. if(modelData.size()==0)
  6325. {
  6326. beginInsertRows(parent,0,0);
  6327. /*528:*/
  6328. #line 11916 "./typica.w"
  6329. QList<QMap<int,QVariant> > newRow;
  6330. QMap<int,QVariant> defaults;
  6331. for(int i= 0;i<colcount;i++)
  6332. {
  6333. newRow.append(defaults);
  6334. }
  6335. modelData.append(newRow);
  6336. /*:528*/
  6337. #line 12067 "./typica.w"
  6338. endInsertRows();
  6339. }
  6340. return true;
  6341. }
  6342. }
  6343. return false;
  6344. }
  6345. /*:537*//*538:*/
  6346. #line 12081 "./typica.w"
  6347. int SaltModel::findData(const QVariant&value,int column,int role)
  6348. {
  6349. for(int i= 0;i<modelData.size();i++)
  6350. {
  6351. if(modelData.at(i).size()> column)
  6352. {
  6353. if(modelData.at(i).at(column).contains(role))
  6354. {
  6355. if(modelData.at(i).at(column).value(role)==value)
  6356. {
  6357. return i;
  6358. }
  6359. }
  6360. }
  6361. }
  6362. return-1;
  6363. }
  6364. /*:538*/
  6365. #line 559 "./typica.w"
  6366. /*540:*/
  6367. #line 12145 "./typica.w"
  6368. SqlComboBox*SqlComboBox::clone(QWidget*parent)
  6369. {
  6370. SqlComboBox*widget= new SqlComboBox();
  6371. widget->setParent(parent);
  6372. for(int i= 0;i<count();i++)
  6373. {
  6374. widget->addItem(itemText(i),itemData(i));
  6375. }
  6376. return widget;
  6377. }
  6378. /*:540*//*541:*/
  6379. #line 12162 "./typica.w"
  6380. void SqlComboBox::showData(bool show)
  6381. {
  6382. dataColumnShown= show;
  6383. }
  6384. /*:541*//*542:*/
  6385. #line 12176 "./typica.w"
  6386. void SqlComboBox::addNullOption()
  6387. {
  6388. addItem(specialNullText,specialNullData);
  6389. }
  6390. void SqlComboBox::setNullText(QString nullText)
  6391. {
  6392. specialNullText= nullText;
  6393. }
  6394. void SqlComboBox::setNullData(QVariant nullData)
  6395. {
  6396. specialNullData= nullData;
  6397. }
  6398. /*:542*//*543:*/
  6399. #line 12199 "./typica.w"
  6400. void SqlComboBox::setDataColumn(int column)
  6401. {
  6402. dataColumn= column;
  6403. }
  6404. void SqlComboBox::setDisplayColumn(int column)
  6405. {
  6406. displayColumn= column;
  6407. }
  6408. /*:543*//*544:*/
  6409. #line 12213 "./typica.w"
  6410. void SqlComboBox::addSqlOptions(QString query)
  6411. {
  6412. SqlQueryConnection h;
  6413. QSqlQuery*dbquery= h.operator->();
  6414. if(!dbquery->exec(query))
  6415. {
  6416. QSqlError error= dbquery->lastError();
  6417. qDebug()<<error.databaseText();
  6418. qDebug()<<error.driverText();
  6419. qDebug()<<error.text();
  6420. qDebug()<<dbquery->lastQuery();
  6421. }
  6422. while(dbquery->next())
  6423. {
  6424. QString displayValue(dbquery->value(displayColumn).toString());
  6425. QString dataValue(dbquery->value(dataColumn).toString());
  6426. if(dataColumnShown)
  6427. {
  6428. displayValue.append(QString(" (%1)").arg(dataValue));
  6429. }
  6430. addItem(displayValue,dataValue);
  6431. }
  6432. }
  6433. /*:544*//*545:*/
  6434. #line 12249 "./typica.w"
  6435. SqlComboBox::SqlComboBox():
  6436. dataColumn(0),displayColumn(0),dataColumnShown(false),
  6437. specialNullText(tr("Unknown")),specialNullData(QVariant::String)
  6438. {
  6439. view()->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
  6440. }
  6441. SqlComboBox::~SqlComboBox()
  6442. {
  6443. }
  6444. /*:545*/
  6445. #line 560 "./typica.w"
  6446. /*547:*/
  6447. #line 12288 "./typica.w"
  6448. void SqlComboBoxDelegate::setWidget(SqlComboBox*widget)
  6449. {
  6450. delegate= widget;
  6451. }
  6452. /*:547*//*548:*/
  6453. #line 12297 "./typica.w"
  6454. QWidget*SqlComboBoxDelegate::createEditor(QWidget*parent,
  6455. const QStyleOptionViewItem&,
  6456. const QModelIndex&)const
  6457. {
  6458. return delegate->clone(parent);
  6459. }
  6460. /*:548*//*549:*/
  6461. #line 12308 "./typica.w"
  6462. void SqlComboBoxDelegate::setEditorData(QWidget*editor,
  6463. const QModelIndex&index)const
  6464. {
  6465. SqlComboBox*self= qobject_cast<SqlComboBox*> (editor);
  6466. self->setCurrentIndex(self->findData(
  6467. index.model()->data(index,
  6468. Qt::UserRole).toString()));
  6469. }
  6470. /*:549*//*550:*/
  6471. #line 12321 "./typica.w"
  6472. void SqlComboBoxDelegate::setModelData(QWidget*editor,
  6473. QAbstractItemModel*model,
  6474. const QModelIndex&index)const
  6475. {
  6476. SqlComboBox*self= qobject_cast<SqlComboBox*> (editor);
  6477. model->setData(index,self->itemData(self->currentIndex(),Qt::UserRole),
  6478. Qt::UserRole);
  6479. model->setData(index,self->currentText(),Qt::DisplayRole);
  6480. }
  6481. /*:550*//*551:*/
  6482. #line 12334 "./typica.w"
  6483. void SqlComboBoxDelegate::updateEditorGeometry(QWidget*editor,
  6484. const QStyleOptionViewItem&option,
  6485. const QModelIndex&)const
  6486. {
  6487. editor->setGeometry(option.rect);
  6488. }
  6489. /*:551*//*552:*/
  6490. #line 12345 "./typica.w"
  6491. QSize SqlComboBoxDelegate::sizeHint()const
  6492. {
  6493. return delegate->sizeHint();
  6494. }
  6495. /*:552*//*553:*/
  6496. #line 12353 "./typica.w"
  6497. SqlComboBoxDelegate::SqlComboBoxDelegate(QObject*parent)
  6498. :QItemDelegate(parent)
  6499. {
  6500. }
  6501. /*:553*/
  6502. #line 561 "./typica.w"
  6503. /*516:*/
  6504. #line 11615 "./typica.w"
  6505. Application::Application(int&argc,char**argv):QApplication(argc,argv)
  6506. {
  6507. /*517:*/
  6508. #line 11630 "./typica.w"
  6509. setOrganizationName("Wilson's Coffee & Tea");
  6510. setOrganizationDomain("wilsonscoffee.com");
  6511. setApplicationName(PROGRAM_NAME);
  6512. /*:517*/
  6513. #line 11618 "./typica.w"
  6514. /*518:*/
  6515. #line 11639 "./typica.w"
  6516. QTranslator base;
  6517. if(base.load(QString("qt_%1").arg(QLocale::system().name())))
  6518. {
  6519. installTranslator(&base);
  6520. }
  6521. QTranslator app;
  6522. if(app.load(QString("%1_%2").arg("Typica").arg(QLocale::system().name())))
  6523. {
  6524. installTranslator(&app);
  6525. }
  6526. /*:518*/
  6527. #line 11619 "./typica.w"
  6528. /*242:*/
  6529. #line 123 "./measurement.w"
  6530. qRegisterMetaType<Measurement> ("Measurement");
  6531. #line 5658 "./typica.w"
  6532. /*:242*/
  6533. #line 11620 "./typica.w"
  6534. /*721:*/
  6535. #line 15527 "./typica.w"
  6536. NodeInserter*inserter= new NodeInserter(tr("NI DAQmx Base Device"),
  6537. tr("NI DAQmx Base"),
  6538. "nidaqmxbase",NULL);
  6539. topLevelNodeInserters.append(inserter);
  6540. /*:721*//*729:*/
  6541. #line 15758 "./typica.w"
  6542. #ifdef Q_OS_WIN32
  6543. inserter= new NodeInserter(tr("NI DAQmx Device"),tr("NI DAQmx"),"nidaqmx",NULL);
  6544. topLevelNodeInserters.append(inserter);
  6545. #endif
  6546. /*:729*//*753:*/
  6547. #line 16721 "./typica.w"
  6548. #if 0
  6549. inserter= new NodeInserter(tr("Modbus RTU Port"),tr("Modbus RTU Port"),"modbusrtuport",NULL);
  6550. topLevelNodeInserters.append(inserter);
  6551. #endif
  6552. /*:753*//*797:*/
  6553. #line 18203 "./typica.w"
  6554. inserter= new NodeInserter(tr("Modbus RTU Device"),tr("Modbus RTU Device"),"modbusrtu",NULL);
  6555. topLevelNodeInserters.append(inserter);
  6556. /*:797*//*861:*/
  6557. #line 1241 "./dataqsdk.w"
  6558. #ifdef Q_OS_WIN32
  6559. inserter= new NodeInserter(tr("DATAQ SDK Device"),tr("DATAQ Device"),
  6560. "dataqsdk",NULL);
  6561. topLevelNodeInserters.append(inserter);
  6562. #endif
  6563. #line 18423 "./typica.w"
  6564. #line 1 "./scales.w"
  6565. /*:861*//*886:*/
  6566. #line 495 "./scales.w"
  6567. inserter= new NodeInserter(tr("Serial Scale"),tr("Scale"),"scale",NULL);
  6568. topLevelNodeInserters.append(inserter);
  6569. #line 18425 "./typica.w"
  6570. #line 1 "./valueannotation.w"
  6571. /*:886*/
  6572. #line 11621 "./typica.w"
  6573. }
  6574. /*:516*//*520:*/
  6575. #line 11662 "./typica.w"
  6576. QDomDocument*Application::configuration()
  6577. {
  6578. return&conf;
  6579. }
  6580. /*:520*//*521:*/
  6581. #line 11671 "./typica.w"
  6582. QSqlDatabase Application::database()
  6583. {
  6584. QString connectionName;
  6585. QSqlDatabase connection=
  6586. QSqlDatabase::database(QLatin1String(QSqlDatabase::defaultConnection),false);
  6587. do
  6588. {
  6589. connectionName= QUuid::createUuid().toString();
  6590. }while(QSqlDatabase::connectionNames().contains(connectionName));
  6591. return QSqlDatabase::cloneDatabase(connection,QString(connectionName));
  6592. }
  6593. /*:521*//*656:*/
  6594. #line 14131 "./typica.w"
  6595. void Application::saveDeviceConfiguration()
  6596. {
  6597. QSettings settings;
  6598. settings.setValue("DeviceConfiguration",
  6599. QVariant(deviceConfigurationDocument.toByteArray()));
  6600. }
  6601. /*:656*//*657:*/
  6602. #line 14143 "./typica.w"
  6603. QDomDocument Application::deviceConfiguration()
  6604. {
  6605. if(deviceConfigurationDocument.isNull())
  6606. {
  6607. /*658:*/
  6608. #line 14157 "./typica.w"
  6609. QSettings settings;
  6610. QByteArray document= settings.value("DeviceConfiguration").toByteArray();
  6611. QString etext;
  6612. int eline;
  6613. int ecol;
  6614. if(document.length()==0)
  6615. {
  6616. qDebug()<<"Loaded settings length is 0. Creating new configuration.";
  6617. /*659:*/
  6618. #line 14181 "./typica.w"
  6619. QFile emptyDocument(":/resources/xml/EmptyDeviceConfiguration.xml");
  6620. emptyDocument.open(QIODevice::ReadOnly);
  6621. if(!deviceConfigurationDocument.setContent(&emptyDocument,false,
  6622. &etext,&eline,&ecol))
  6623. {
  6624. /*660:*/
  6625. #line 14198 "./typica.w"
  6626. qDebug()<<QString(tr("An error occurred loading device configuration."));
  6627. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  6628. qDebug()<<etext;
  6629. /*:660*/
  6630. #line 14187 "./typica.w"
  6631. }
  6632. else
  6633. {
  6634. saveDeviceConfiguration();
  6635. }
  6636. /*:659*/
  6637. #line 14166 "./typica.w"
  6638. }
  6639. else
  6640. {
  6641. if(!deviceConfigurationDocument.setContent(document,false,
  6642. &etext,&eline,&ecol))
  6643. {
  6644. /*660:*/
  6645. #line 14198 "./typica.w"
  6646. qDebug()<<QString(tr("An error occurred loading device configuration."));
  6647. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  6648. qDebug()<<etext;
  6649. /*:660*/
  6650. #line 14173 "./typica.w"
  6651. /*659:*/
  6652. #line 14181 "./typica.w"
  6653. QFile emptyDocument(":/resources/xml/EmptyDeviceConfiguration.xml");
  6654. emptyDocument.open(QIODevice::ReadOnly);
  6655. if(!deviceConfigurationDocument.setContent(&emptyDocument,false,
  6656. &etext,&eline,&ecol))
  6657. {
  6658. /*660:*/
  6659. #line 14198 "./typica.w"
  6660. qDebug()<<QString(tr("An error occurred loading device configuration."));
  6661. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  6662. qDebug()<<etext;
  6663. /*:660*/
  6664. #line 14187 "./typica.w"
  6665. }
  6666. else
  6667. {
  6668. saveDeviceConfiguration();
  6669. }
  6670. /*:659*/
  6671. #line 14174 "./typica.w"
  6672. }
  6673. }
  6674. /*:658*/
  6675. #line 14148 "./typica.w"
  6676. }
  6677. return deviceConfigurationDocument;
  6678. }
  6679. /*:657*//*688:*/
  6680. #line 14799 "./typica.w"
  6681. void Application::registerDeviceConfigurationWidget(QString driver,
  6682. QMetaObject widget)
  6683. {
  6684. deviceConfigurationWidgets.insert(driver,widget);
  6685. }
  6686. /*:688*//*689:*/
  6687. #line 14815 "./typica.w"
  6688. QWidget*Application::deviceConfigurationWidget(DeviceTreeModel*model,
  6689. const QModelIndex&index)
  6690. {
  6691. QVariant nodeReference= index.data(Qt::UserRole);
  6692. QDomElement referenceElement= model->referenceElement(
  6693. model->data(index,Qt::UserRole).toString());
  6694. QMetaObject metaObject=
  6695. deviceConfigurationWidgets.value(referenceElement.attribute("driver"),
  6696. QWidget::staticMetaObject);
  6697. QWidget*editor;
  6698. if(metaObject.className()==QWidget::staticMetaObject.className())
  6699. {
  6700. editor= NULL;
  6701. }
  6702. else
  6703. {
  6704. editor= qobject_cast<QWidget*> (
  6705. metaObject.newInstance(Q_ARG(DeviceTreeModel*,model),
  6706. Q_ARG(QModelIndex,index)));
  6707. }
  6708. return editor;
  6709. }
  6710. /*:689*/
  6711. #line 562 "./typica.w"
  6712. /*559:*/
  6713. #line 12474 "./typica.w"
  6714. SqlConnectionSetup::SqlConnectionSetup():
  6715. formLayout(new QFormLayout),driver(new QComboBox),hostname(new QLineEdit),
  6716. dbname(new QLineEdit),user(new QLineEdit),password(new QLineEdit),
  6717. layout(new QVBoxLayout),buttons(new QHBoxLayout),
  6718. cancelButton(new QPushButton(tr("Cancel"))),
  6719. connectButton(new QPushButton(tr("Connect")))
  6720. {
  6721. driver->addItem("PostgreSQL","QPSQL");
  6722. formLayout->addRow(tr("Database driver:"),driver);
  6723. formLayout->addRow(tr("Host name:"),hostname);
  6724. formLayout->addRow(tr("Database name:"),dbname);
  6725. formLayout->addRow(tr("User name:"),user);
  6726. password->setEchoMode(QLineEdit::Password);
  6727. formLayout->addRow(tr("Password:"),password);
  6728. layout->addLayout(formLayout);
  6729. buttons->addStretch(1);
  6730. buttons->addWidget(cancelButton);
  6731. connect(cancelButton,SIGNAL(clicked(bool)),this,SLOT(reject()));
  6732. buttons->addWidget(connectButton);
  6733. layout->addLayout(buttons);
  6734. connect(connectButton,SIGNAL(clicked(bool)),this,SLOT(testConnection()));
  6735. setLayout(layout);
  6736. setModal(true);
  6737. }
  6738. SqlConnectionSetup::~SqlConnectionSetup()
  6739. {
  6740. }
  6741. /*:559*//*560:*/
  6742. #line 12508 "./typica.w"
  6743. void SqlConnectionSetup::testConnection()
  6744. {
  6745. QSqlDatabase database=
  6746. QSqlDatabase::addDatabase(driver->itemData(driver->currentIndex()).
  6747. toString());
  6748. database.setConnectOptions("application_name=Typica");
  6749. database.setHostName(hostname->text());
  6750. database.setDatabaseName(dbname->text());
  6751. database.setUserName(user->text());
  6752. database.setPassword(password->text());
  6753. if(database.open())
  6754. {
  6755. QSettings settings;
  6756. settings.setValue("database/exists","true");
  6757. settings.setValue("database/driver",
  6758. driver->itemData(driver->currentIndex()).toString());
  6759. settings.setValue("database/hostname",hostname->text());
  6760. settings.setValue("database/dbname",dbname->text());
  6761. settings.setValue("database/user",user->text());
  6762. settings.setValue("database/password",password->text());
  6763. database.close();
  6764. accept();
  6765. }
  6766. else
  6767. {
  6768. QMessageBox::information(this,tr("Database connection failed"),
  6769. tr("Failed to connect to database."));
  6770. }
  6771. }
  6772. /*:560*/
  6773. #line 563 "./typica.w"
  6774. /*564:*/
  6775. #line 12610 "./typica.w"
  6776. SqlQueryView::SqlQueryView(QWidget*parent):QTableView(parent)
  6777. {
  6778. setModel(new QSqlQueryModel);
  6779. connect(this,SIGNAL(doubleClicked(QModelIndex)),
  6780. this,SLOT(openRow(QModelIndex)));
  6781. connect(horizontalHeader(),SIGNAL(sectionResized(int,int,int)),
  6782. this,SLOT(persistColumnResize(int,int,int)));
  6783. }
  6784. /*:564*//*565:*/
  6785. #line 12625 "./typica.w"
  6786. void SqlQueryView::persistColumnResize(int column,int,int newsize)
  6787. {
  6788. /*566:*/
  6789. #line 12634 "./typica.w"
  6790. QSettings settings;
  6791. /*567:*/
  6792. #line 12647 "./typica.w"
  6793. QWidget*topLevelWidget= this;
  6794. while(topLevelWidget->parentWidget())
  6795. {
  6796. topLevelWidget= topLevelWidget->parentWidget();
  6797. }
  6798. /*:567*/
  6799. #line 12636 "./typica.w"
  6800. settings.setValue(QString("columnWidths/%1/%2/%3").
  6801. arg(topLevelWidget->objectName()).
  6802. arg(objectName()).arg(column),
  6803. QVariant(newsize));
  6804. /*:566*/
  6805. #line 12628 "./typica.w"
  6806. }
  6807. /*:565*//*568:*/
  6808. #line 12657 "./typica.w"
  6809. void SqlQueryView::showEvent(QShowEvent*event)
  6810. {
  6811. /*569:*/
  6812. #line 12667 "./typica.w"
  6813. QSettings settings;
  6814. /*567:*/
  6815. #line 12647 "./typica.w"
  6816. QWidget*topLevelWidget= this;
  6817. while(topLevelWidget->parentWidget())
  6818. {
  6819. topLevelWidget= topLevelWidget->parentWidget();
  6820. }
  6821. /*:567*/
  6822. #line 12669 "./typica.w"
  6823. QString baseKey=
  6824. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  6825. arg(objectName());
  6826. for(int i= 0;i<model()->columnCount();i++)
  6827. {
  6828. QString key= QString("%1/%2").arg(baseKey).arg(i);
  6829. if(settings.contains(key))
  6830. {
  6831. setColumnWidth(i,settings.value(key).toInt());
  6832. }
  6833. }
  6834. /*:569*/
  6835. #line 12660 "./typica.w"
  6836. event->accept();
  6837. }
  6838. /*:568*//*570:*/
  6839. #line 12684 "./typica.w"
  6840. void SqlQueryView::openRow(const QModelIndex&index)
  6841. {
  6842. emit openEntry(((QSqlQueryModel*)model())->record(index.row()).value(0).toString());
  6843. emit openEntryRow(index.row());
  6844. }
  6845. /*:570*//*571:*/
  6846. #line 12693 "./typica.w"
  6847. void SqlQueryView::setQuery(const QString&query)
  6848. {
  6849. QSqlDatabase database= AppInstance->database();
  6850. database.open();
  6851. QSqlQuery q(query,database);
  6852. ((QSqlQueryModel*)model())->setQuery(q);
  6853. database.close();
  6854. }
  6855. bool SqlQueryView::setHeaderData(int section,Qt::Orientation orientation,
  6856. const QVariant&value,int role)
  6857. {
  6858. return model()->setHeaderData(section,orientation,value,role);
  6859. }
  6860. /*:571*//*572:*/
  6861. #line 12711 "./typica.w"
  6862. QVariant SqlQueryView::data(int row,int column,int role)
  6863. {
  6864. return model()->data(model()->index(row,column),role);
  6865. }
  6866. /*:572*/
  6867. #line 564 "./typica.w"
  6868. /*131:*/
  6869. #line 3158 "./typica.w"
  6870. SqlQueryConnection::SqlQueryConnection(const QString&query)
  6871. {
  6872. QSqlDatabase database= AppInstance->database();
  6873. database.open();
  6874. q= new QSqlQuery(query,database);
  6875. connection= database.connectionName();
  6876. }
  6877. /*:131*//*132:*/
  6878. #line 3171 "./typica.w"
  6879. SqlQueryConnection::~SqlQueryConnection()
  6880. {
  6881. delete q;
  6882. {
  6883. QSqlDatabase database= QSqlDatabase::database(connection);
  6884. database.close();
  6885. }
  6886. QSqlDatabase::removeDatabase(connection);
  6887. }
  6888. /*:132*//*133:*/
  6889. #line 3185 "./typica.w"
  6890. QSqlQuery*SqlQueryConnection::operator->()const
  6891. {
  6892. return q;
  6893. }
  6894. /*:133*/
  6895. #line 565 "./typica.w"
  6896. /*591:*/
  6897. #line 13068 "./typica.w"
  6898. ReportTable::ReportTable(QTextFrame*frame,QDomElement description):
  6899. area(frame),configuration(description)
  6900. {
  6901. refresh();
  6902. }
  6903. ReportTable::~ReportTable()
  6904. {
  6905. }
  6906. /*:591*//*592:*/
  6907. #line 13084 "./typica.w"
  6908. void ReportTable::bind(QString placeholder,QVariant value)
  6909. {
  6910. bindings.insert(placeholder,value);
  6911. }
  6912. /*:592*//*593:*/
  6913. #line 13094 "./typica.w"
  6914. void ReportTable::refresh()
  6915. {
  6916. /*594:*/
  6917. #line 13115 "./typica.w"
  6918. QTextCursor cursor= area->firstCursorPosition();
  6919. while(cursor<area->lastCursorPosition())
  6920. {
  6921. cursor.movePosition(QTextCursor::Right,QTextCursor::KeepAnchor);
  6922. }
  6923. cursor.removeSelectedText();
  6924. /*:594*/
  6925. #line 13097 "./typica.w"
  6926. int rows= 1;
  6927. int columns= 1;
  6928. int currentRow= 0;
  6929. QTextTable*table= cursor.insertTable(rows,columns);
  6930. /*595:*/
  6931. #line 13128 "./typica.w"
  6932. QTextTableFormat format= table->format();
  6933. format.setBorderStyle(QTextFrameFormat::BorderStyle_None);
  6934. if(configuration.hasAttribute("align"))
  6935. {
  6936. if(configuration.attribute("align")=="center")
  6937. {
  6938. format.setAlignment(Qt::AlignHCenter);
  6939. }
  6940. }
  6941. table->setFormat(format);
  6942. /*:595*/
  6943. #line 13102 "./typica.w"
  6944. /*596:*/
  6945. #line 13142 "./typica.w"
  6946. QDomNodeList children= configuration.childNodes();
  6947. for(int i= 0;i<children.count();i++)
  6948. {
  6949. QDomNode current;
  6950. QDomElement currentElement;
  6951. current= children.at(i);
  6952. if(current.isElement())
  6953. {
  6954. currentElement= current.toElement();
  6955. if(currentElement.tagName()=="query")
  6956. {
  6957. /*597:*/
  6958. #line 13169 "./typica.w"
  6959. SqlQueryConnection h;
  6960. QSqlQuery*query= h.operator->();
  6961. query->prepare(currentElement.text());
  6962. foreach(QString key,bindings.uniqueKeys())
  6963. {
  6964. if(currentElement.text().contains(key))
  6965. {
  6966. query->bindValue(key,bindings.value(key));
  6967. }
  6968. }
  6969. query->exec();
  6970. if(!query->next())
  6971. {
  6972. continue;
  6973. }
  6974. if(query->record().count()> columns)
  6975. {
  6976. table->appendColumns(query->record().count()-columns);
  6977. }
  6978. do
  6979. {
  6980. table->appendRows(1);
  6981. rows++;
  6982. currentRow++;
  6983. for(int j= 0;j<query->record().count();j++)
  6984. {
  6985. QTextTableCell cell= table->cellAt(currentRow,j);
  6986. cursor= cell.firstCursorPosition();
  6987. cursor.insertText(query->value(j).toString());
  6988. }
  6989. }while(query->next());
  6990. /*:597*/
  6991. #line 13154 "./typica.w"
  6992. }
  6993. else if(currentElement.tagName()=="row")
  6994. {
  6995. /*598:*/
  6996. #line 13209 "./typica.w"
  6997. table->appendRows(1);
  6998. currentRow++;
  6999. rows++;
  7000. QDomNodeList rowChildren= currentElement.childNodes();
  7001. int currentColumn= 0;
  7002. for(int j= 0;j<rowChildren.count();j++)
  7003. {
  7004. QDomNode node;
  7005. QDomElement nodeElement;
  7006. node= rowChildren.at(j);
  7007. if(node.isElement())
  7008. {
  7009. nodeElement= node.toElement();
  7010. if(nodeElement.tagName()=="cell")
  7011. {
  7012. if(currentColumn==columns)
  7013. {
  7014. table->appendColumns(1);
  7015. columns++;
  7016. }
  7017. QTextTableCell cell= table->cellAt(currentRow,currentColumn);
  7018. cursor= cell.firstCursorPosition();
  7019. cursor.insertText(nodeElement.text());
  7020. currentColumn++;
  7021. }
  7022. }
  7023. }
  7024. /*:598*/
  7025. #line 13158 "./typica.w"
  7026. }
  7027. }
  7028. }
  7029. /*:596*/
  7030. #line 13103 "./typica.w"
  7031. if(rows> 1)
  7032. {
  7033. table->removeRows(0,1);
  7034. }
  7035. }
  7036. /*:593*/
  7037. #line 566 "./typica.w"
  7038. /*624:*/
  7039. #line 13313 "./typica.w"
  7040. FormArray::FormArray(QDomElement description):configuration(description),
  7041. maxwidth(-1),maxheight(-1)
  7042. {
  7043. setWidget(&itemContainer);
  7044. itemContainer.setLayout(&itemLayout);
  7045. }
  7046. /*:624*//*625:*/
  7047. #line 13330 "./typica.w"
  7048. void FormArray::addElements(int copies)
  7049. {
  7050. QStack<QWidget*> *widgetStack= new QStack<QWidget*> ;
  7051. QStack<QLayout*> *layoutStack= new QStack<QLayout*> ;
  7052. QWidget*widget;
  7053. for(int i= 0;i<copies;i++)
  7054. {
  7055. widget= new QWidget;
  7056. if(maxwidth> -1)
  7057. {
  7058. widget->setMaximumWidth(maxwidth);
  7059. }
  7060. if(maxheight> -1)
  7061. {
  7062. widget->setMaximumHeight(maxheight);
  7063. }
  7064. if(configuration.hasChildNodes())
  7065. {
  7066. widgetStack->push(widget);
  7067. populateWidget(configuration,widgetStack,layoutStack);
  7068. widgetStack->pop();
  7069. widget->setMinimumHeight(widget->sizeHint().height());
  7070. itemLayout.addWidget(widget);
  7071. if(widget->sizeHint().height()> maxheight&&maxheight> -1)
  7072. {
  7073. itemContainer.setMinimumHeight(maxheight*elements()+50);
  7074. }
  7075. else
  7076. {
  7077. itemContainer.setMinimumHeight(itemContainer.sizeHint().height()
  7078. +widget->sizeHint().height());
  7079. }
  7080. if(maxwidth> -1)
  7081. {
  7082. itemContainer.setMinimumWidth(maxwidth+50);
  7083. }
  7084. else
  7085. {
  7086. itemContainer.setMinimumWidth(widget->sizeHint().width()+50);
  7087. }
  7088. }
  7089. }
  7090. }
  7091. /*:625*//*626:*/
  7092. #line 13380 "./typica.w"
  7093. QWidget*FormArray::elementAt(int index)
  7094. {
  7095. if(index<itemLayout.count())
  7096. {
  7097. QLayoutItem*item= itemLayout.itemAt(index);
  7098. return item->widget();
  7099. }
  7100. else
  7101. {
  7102. return NULL;
  7103. }
  7104. }
  7105. /*:626*//*627:*/
  7106. #line 13397 "./typica.w"
  7107. void FormArray::removeAllElements()
  7108. {
  7109. while(itemLayout.count()> 0)
  7110. {
  7111. QLayoutItem*item;
  7112. item= itemLayout.itemAt(0);
  7113. item->widget()->hide();
  7114. itemLayout.removeWidget(item->widget());
  7115. }
  7116. itemContainer.setMinimumHeight(0);
  7117. }
  7118. /*:627*//*628:*/
  7119. #line 13413 "./typica.w"
  7120. int FormArray::elements()
  7121. {
  7122. return itemLayout.count();
  7123. }
  7124. /*:628*//*629:*/
  7125. #line 13424 "./typica.w"
  7126. void FormArray::setMaximumElementWidth(int width)
  7127. {
  7128. maxwidth= width;
  7129. }
  7130. void FormArray::setMaximumElementHeight(int height)
  7131. {
  7132. maxheight= height;
  7133. }
  7134. /*:629*/
  7135. #line 567 "./typica.w"
  7136. /*635:*/
  7137. #line 13555 "./typica.w"
  7138. ScaleControl::ScaleControl():QGraphicsView(NULL,NULL),nonScoredValue(-1),
  7139. scoredValue(-1),initialSet(false),finalSet(false),scaleDown(false)
  7140. {
  7141. left<<QPointF(0,5)<<QPointF(10,0)<<QPointF(10,10)<<
  7142. QPointF(0,5);
  7143. right<<QPointF(10,5)<<QPointF(0,0)<<QPointF(0,10)<<
  7144. QPointF(10,5);
  7145. down<<QPointF(0,0)<<QPointF(-5,-10)<<QPointF(5,-10)<<
  7146. QPointF(0,0);
  7147. up<<QPointF(0,0)<<QPointF(-5,10)<<QPointF(4,10)<<QPointF(0,0);
  7148. initialBrush.setColor(QColor(170,170,255));
  7149. initialBrush.setStyle(Qt::SolidPattern);
  7150. finalBrush.setColor(Qt::blue);
  7151. finalBrush.setStyle(Qt::SolidPattern);
  7152. initialDecrement.setPolygon(left);
  7153. initialDecrement.setBrush(initialBrush);
  7154. initialDecrement.setPos(0,0);
  7155. scene.addItem(&initialDecrement);
  7156. initialIncrement.setPolygon(right);
  7157. initialIncrement.setBrush(initialBrush);
  7158. initialIncrement.setPos(122,0);
  7159. scene.addItem(&initialIncrement);
  7160. finalDecrement.setPolygon(left);
  7161. finalDecrement.setBrush(finalBrush);
  7162. finalDecrement.setPos(0,12);
  7163. scene.addItem(&finalDecrement);
  7164. finalIncrement.setPolygon(right);
  7165. finalIncrement.setBrush(finalBrush);
  7166. finalIncrement.setPos(122,12);
  7167. scene.addItem(&finalIncrement);
  7168. scalePath.moveTo(0,10);
  7169. scalePath.lineTo(100,10);
  7170. scalePath.moveTo(0,0);
  7171. scalePath.lineTo(0,20);
  7172. scalePath.moveTo(10,5);
  7173. scalePath.lineTo(10,15);
  7174. scalePath.moveTo(20,5);
  7175. scalePath.lineTo(20,15);
  7176. scalePath.moveTo(30,5);
  7177. scalePath.lineTo(30,15);
  7178. scalePath.moveTo(40,5);
  7179. scalePath.lineTo(40,15);
  7180. scalePath.moveTo(50,0);
  7181. scalePath.lineTo(50,20);
  7182. scalePath.moveTo(60,5);
  7183. scalePath.lineTo(60,15);
  7184. scalePath.moveTo(70,5);
  7185. scalePath.lineTo(70,15);
  7186. scalePath.moveTo(80,5);
  7187. scalePath.lineTo(80,15);
  7188. scalePath.moveTo(90,5);
  7189. scalePath.lineTo(90,15);
  7190. scalePath.moveTo(100,0);
  7191. scalePath.lineTo(100,20);
  7192. scaleLine.setPath(scalePath);
  7193. scaleLine.setPos(16,1);
  7194. scene.addItem(&scaleLine);
  7195. setScene(&scene);
  7196. initialIndicator.setPolygon(down);
  7197. initialIndicator.setBrush(initialBrush);
  7198. finalIndicator.setPolygon(up);
  7199. finalIndicator.setBrush(finalBrush);
  7200. setMinimumSize(sizeHint());
  7201. setMaximumSize(sizeHint());
  7202. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  7203. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  7204. setMinimumSize(sizeHint());
  7205. }
  7206. /*:635*//*636:*/
  7207. #line 13628 "./typica.w"
  7208. QSize ScaleControl::sizeHint()const
  7209. {
  7210. return QSize(140,30);
  7211. }
  7212. /*:636*//*637:*/
  7213. #line 13637 "./typica.w"
  7214. void ScaleControl::setInitialValue(double value)
  7215. {
  7216. if(value>=0&&value<=10)
  7217. {
  7218. nonScoredValue= value;
  7219. if(!initialSet)
  7220. {
  7221. scene.addItem(&initialIndicator);
  7222. }
  7223. initialSet= true;
  7224. initialIndicator.setPos(value*10+16,10);
  7225. emit initialChanged(value);
  7226. if(!finalSet)
  7227. {
  7228. setFinalValue(value);
  7229. }
  7230. }
  7231. }
  7232. void ScaleControl::setFinalValue(double value)
  7233. {
  7234. if(value>=0&&value<=10)
  7235. {
  7236. scoredValue= value;
  7237. if(!finalSet)
  7238. {
  7239. scene.addItem(&finalIndicator);
  7240. }
  7241. finalSet= true;
  7242. finalIndicator.setPos(value*10+16,11);
  7243. emit finalChanged(value);
  7244. }
  7245. }
  7246. /*:637*//*638:*/
  7247. #line 13674 "./typica.w"
  7248. double ScaleControl::initialValue(void)
  7249. {
  7250. return nonScoredValue;
  7251. }
  7252. double ScaleControl::finalValue(void)
  7253. {
  7254. return scoredValue;
  7255. }
  7256. /*:638*//*639:*/
  7257. #line 13695 "./typica.w"
  7258. void ScaleControl::mousePressEvent(QMouseEvent*event)
  7259. {
  7260. /*640:*/
  7261. #line 13707 "./typica.w"
  7262. if(event->button()!=Qt::LeftButton)
  7263. {
  7264. event->ignore();
  7265. return;
  7266. }
  7267. /*:640*/
  7268. #line 13698 "./typica.w"
  7269. scaleDown= true;
  7270. event->accept();
  7271. }
  7272. /*:639*//*641:*/
  7273. #line 13718 "./typica.w"
  7274. void ScaleControl::mouseReleaseEvent(QMouseEvent*event)
  7275. {
  7276. /*640:*/
  7277. #line 13707 "./typica.w"
  7278. if(event->button()!=Qt::LeftButton)
  7279. {
  7280. event->ignore();
  7281. return;
  7282. }
  7283. /*:640*/
  7284. #line 13721 "./typica.w"
  7285. if(!scaleDown)
  7286. {
  7287. event->ignore();
  7288. return;
  7289. }
  7290. scaleDown= false;
  7291. QPointF sceneCoordinate= mapToScene(event->x(),event->y());
  7292. /*642:*/
  7293. #line 13743 "./typica.w"
  7294. if(sceneCoordinate.x()>=0&&sceneCoordinate.x()<=10)
  7295. {
  7296. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  7297. {
  7298. if(initialSet)
  7299. {
  7300. setInitialValue(nonScoredValue-0.05);
  7301. }
  7302. event->accept();
  7303. return;
  7304. }
  7305. else if(sceneCoordinate.y()>=12&&sceneCoordinate.y()<=22)
  7306. {
  7307. if(finalSet)
  7308. {
  7309. setFinalValue(scoredValue-0.05);
  7310. event->accept();
  7311. return;
  7312. }
  7313. }
  7314. }
  7315. /*:642*/
  7316. #line 13729 "./typica.w"
  7317. /*643:*/
  7318. #line 13769 "./typica.w"
  7319. else if(sceneCoordinate.x()>=122&&sceneCoordinate.x()<=132)
  7320. {
  7321. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  7322. {
  7323. if(initialSet)
  7324. {
  7325. setInitialValue(nonScoredValue+0.05);
  7326. event->accept();
  7327. return;
  7328. }
  7329. }
  7330. else if(sceneCoordinate.y()>=12&&sceneCoordinate.y()<=22)
  7331. {
  7332. if(finalSet)
  7333. {
  7334. setFinalValue(scoredValue+0.05);
  7335. event->accept();
  7336. return;
  7337. }
  7338. }
  7339. }
  7340. /*:643*/
  7341. #line 13730 "./typica.w"
  7342. /*644:*/
  7343. #line 13795 "./typica.w"
  7344. double relativeX= sceneCoordinate.x()-16;
  7345. if(initialSet)
  7346. {
  7347. if(relativeX>=0&&relativeX<=100)
  7348. {
  7349. setFinalValue(relativeX/10.0);
  7350. event->accept();
  7351. return;
  7352. }
  7353. }
  7354. else
  7355. {
  7356. if(relativeX>=0&&relativeX<=100)
  7357. {
  7358. setInitialValue(relativeX/10.0);
  7359. event->accept();
  7360. return;
  7361. }
  7362. }
  7363. /*:644*/
  7364. #line 13731 "./typica.w"
  7365. event->ignore();
  7366. return;
  7367. }
  7368. /*:641*/
  7369. #line 568 "./typica.w"
  7370. /*646:*/
  7371. #line 13861 "./typica.w"
  7372. IntensityControl::IntensityControl():QGraphicsView(NULL,NULL),theValue(-1),
  7373. valueSet(false),scaleDown(false)
  7374. {
  7375. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  7376. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  7377. left<<QPointF(0,0)<<QPointF(10,-5)<<QPointF(10,5)<<QPointF(0,0);
  7378. down<<QPointF(0,0)<<QPointF(10,0)<<QPointF(5,10)<<QPointF(0,0);
  7379. up<<QPointF(0,10)<<QPointF(10,10)<<QPointF(5,0)<<QPointF(0,10);
  7380. theBrush.setColor(Qt::blue);
  7381. theBrush.setStyle(Qt::SolidPattern);
  7382. increment.setPolygon(up);
  7383. increment.setBrush(theBrush);
  7384. increment.setPos(0,0);
  7385. scene.addItem(&increment);
  7386. decrement.setPolygon(down);
  7387. decrement.setBrush(theBrush);
  7388. decrement.setPos(0,122);
  7389. scene.addItem(&decrement);
  7390. scalePath.moveTo(5,0);
  7391. scalePath.lineTo(5,100);
  7392. scalePath.moveTo(0,0);
  7393. scalePath.lineTo(10,0);
  7394. scalePath.moveTo(0,10);
  7395. scalePath.lineTo(10,10);
  7396. scalePath.moveTo(0,20);
  7397. scalePath.lineTo(10,20);
  7398. scalePath.moveTo(0,30);
  7399. scalePath.lineTo(10,30);
  7400. scalePath.moveTo(0,40);
  7401. scalePath.lineTo(10,40);
  7402. scalePath.moveTo(0,50);
  7403. scalePath.lineTo(10,50);
  7404. scalePath.moveTo(0,60);
  7405. scalePath.lineTo(10,60);
  7406. scalePath.moveTo(0,70);
  7407. scalePath.lineTo(10,70);
  7408. scalePath.moveTo(0,80);
  7409. scalePath.lineTo(10,80);
  7410. scalePath.moveTo(0,90);
  7411. scalePath.lineTo(10,90);
  7412. scalePath.moveTo(0,100);
  7413. scalePath.lineTo(10,100);
  7414. scaleLine.setPath(scalePath);
  7415. scaleLine.setPos(0,16);
  7416. scene.addItem(&scaleLine);
  7417. setScene(&scene);
  7418. indicator.setPolygon(left);
  7419. indicator.setBrush(theBrush);
  7420. setMinimumSize(sizeHint());
  7421. setMaximumSize(sizeHint());
  7422. }
  7423. /*:646*//*647:*/
  7424. #line 13916 "./typica.w"
  7425. QSize IntensityControl::sizeHint()const
  7426. {
  7427. return QSize(25,160);
  7428. }
  7429. /*:647*//*648:*/
  7430. #line 13931 "./typica.w"
  7431. void IntensityControl::setValue(double val)
  7432. {
  7433. if(val>=0&&val<=10)
  7434. {
  7435. theValue= val;
  7436. if(!valueSet)
  7437. {
  7438. scene.addItem(&indicator);
  7439. }
  7440. valueSet= true;
  7441. indicator.setPos(6,(100-(val*10))+16);
  7442. emit(valueChanged(val));
  7443. }
  7444. else if(val<1)
  7445. {
  7446. setValue(0);
  7447. }
  7448. else
  7449. {
  7450. setValue(10);
  7451. }
  7452. }
  7453. double IntensityControl::value()
  7454. {
  7455. return theValue;
  7456. }
  7457. /*:648*//*649:*/
  7458. #line 13963 "./typica.w"
  7459. void IntensityControl::mousePressEvent(QMouseEvent*event)
  7460. {
  7461. /*640:*/
  7462. #line 13707 "./typica.w"
  7463. if(event->button()!=Qt::LeftButton)
  7464. {
  7465. event->ignore();
  7466. return;
  7467. }
  7468. /*:640*/
  7469. #line 13966 "./typica.w"
  7470. scaleDown= true;
  7471. event->accept();
  7472. }
  7473. /*:649*//*650:*/
  7474. #line 13977 "./typica.w"
  7475. void IntensityControl::mouseReleaseEvent(QMouseEvent*event)
  7476. {
  7477. /*640:*/
  7478. #line 13707 "./typica.w"
  7479. if(event->button()!=Qt::LeftButton)
  7480. {
  7481. event->ignore();
  7482. return;
  7483. }
  7484. /*:640*/
  7485. #line 13980 "./typica.w"
  7486. if(!scaleDown)
  7487. {
  7488. event->ignore();
  7489. return;
  7490. }
  7491. scaleDown= false;
  7492. QPointF sceneCoordinate= mapToScene(event->x(),event->y());
  7493. if(sceneCoordinate.x()>=0&&sceneCoordinate.x()<=16)
  7494. {
  7495. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  7496. {
  7497. if(valueSet)
  7498. {
  7499. setValue(theValue+0.05);
  7500. }
  7501. event->accept();
  7502. return;
  7503. }
  7504. else if(sceneCoordinate.y()>=122&&sceneCoordinate.y()<=132)
  7505. {
  7506. if(valueSet)
  7507. {
  7508. setValue(theValue-0.05);
  7509. }
  7510. event->accept();
  7511. return;
  7512. }
  7513. else if(sceneCoordinate.y()>=16&&sceneCoordinate.y()<=116)
  7514. {
  7515. setValue(10-((sceneCoordinate.y()-16)/10.0));
  7516. event->accept();
  7517. return;
  7518. }
  7519. }
  7520. }
  7521. /*:650*/
  7522. #line 569 "./typica.w"
  7523. /*305:*/
  7524. #line 7275 "./typica.w"
  7525. void ThresholdDetector::newMeasurement(Measurement measure)
  7526. {
  7527. if((currentDirection==Ascending&&previousValue<threshold&&
  7528. previousValue>=0)||(currentDirection==Descending&&
  7529. previousValue> threshold&&previousValue>=0))
  7530. {
  7531. if((currentDirection==Ascending&&measure.temperature()>=threshold)||
  7532. (currentDirection==Descending&&measure.temperature()<=threshold))
  7533. {
  7534. double offset= measure.time().hour()*60*60;
  7535. offset+= measure.time().minute()*60;
  7536. offset+= measure.time().second();
  7537. offset+= measure.time().msec()/1000;
  7538. emit timeForValue(offset);
  7539. }
  7540. }
  7541. previousValue= measure.temperature();
  7542. }
  7543. ThresholdDetector::ThresholdDetector(double value):QObject(NULL),
  7544. previousValue(-1),threshold(value),currentDirection(Ascending)
  7545. {
  7546. }
  7547. void ThresholdDetector::setThreshold(double value)
  7548. {
  7549. threshold= value;
  7550. }
  7551. void ThresholdDetector::setEdgeDirection(EdgeDirection direction)
  7552. {
  7553. currentDirection= direction;
  7554. }
  7555. /*:305*/
  7556. #line 570 "./typica.w"
  7557. /*732:*/
  7558. #line 15798 "./typica.w"
  7559. PortSelector::PortSelector(QWidget*parent):QComboBox(parent),
  7560. lister(new QextSerialEnumerator)
  7561. {
  7562. QList<QextPortInfo> ports= QextSerialEnumerator::getPorts();
  7563. QextPortInfo port;
  7564. foreach(port,ports)
  7565. {
  7566. #ifdef Q_OS_WIN32
  7567. addItem(port.portName);
  7568. #else
  7569. addItem(port.physName);
  7570. #endif
  7571. }
  7572. lister->setUpNotifications();
  7573. connect(lister,SIGNAL(deviceDiscovered(QextPortInfo)),
  7574. this,SLOT(addDevice(QextPortInfo)));
  7575. setEditable(true);
  7576. }
  7577. void PortSelector::addDevice(QextPortInfo port)
  7578. {
  7579. addItem(port.portName);
  7580. }
  7581. /*:732*/
  7582. #line 571 "./typica.w"
  7583. /*734:*/
  7584. #line 15890 "./typica.w"
  7585. BaudSelector::BaudSelector(QWidget*parent):QComboBox(parent)
  7586. {
  7587. QMetaObject meta= BaudSelector::staticMetaObject;
  7588. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("BaudRateType"));
  7589. for(int i= 0;i<type.keyCount();i++)
  7590. {
  7591. addItem(QString("%1").arg(type.value(i)));
  7592. }
  7593. }
  7594. /*:734*/
  7595. #line 572 "./typica.w"
  7596. /*736:*/
  7597. #line 15928 "./typica.w"
  7598. ParitySelector::ParitySelector(QWidget*parent):QComboBox(parent)
  7599. {
  7600. QMetaObject meta= ParitySelector::staticMetaObject;
  7601. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("ParityType"));
  7602. for(int i= 0;i<type.keyCount();i++)
  7603. {
  7604. addItem(QString(type.key(i)),QVariant(type.value(i)));
  7605. }
  7606. }
  7607. /*:736*/
  7608. #line 573 "./typica.w"
  7609. /*738:*/
  7610. #line 15958 "./typica.w"
  7611. FlowSelector::FlowSelector(QWidget*parent):QComboBox(parent)
  7612. {
  7613. QMetaObject meta= FlowSelector::staticMetaObject;
  7614. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("FlowType"));
  7615. for(int i= 0;i<type.keyCount();i++)
  7616. {
  7617. addItem(QString(type.key(i)),QVariant(type.value(i)));
  7618. }
  7619. }
  7620. /*:738*/
  7621. #line 574 "./typica.w"
  7622. /*740:*/
  7623. #line 15993 "./typica.w"
  7624. StopSelector::StopSelector(QWidget*parent):QComboBox(parent)
  7625. {
  7626. QMetaObject meta= StopSelector::staticMetaObject;
  7627. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("StopBitsType"));
  7628. for(int i= 0;i<type.keyCount();i++)
  7629. {
  7630. addItem(QString(type.key(i)),QVariant(type.value(i)));
  7631. }
  7632. }
  7633. /*:740*/
  7634. #line 575 "./typica.w"
  7635. /*795:*/
  7636. #line 17744 "./typica.w"
  7637. ModbusConfigurator::ModbusConfigurator(DeviceTreeModel*model,const QModelIndex&index)
  7638. :BasicDeviceConfigurationWidget(model,index),
  7639. port(new PortSelector),baud(new BaudSelector),parity(new ParitySelector),
  7640. flow(new FlowSelector),stop(new StopSelector),station(new QSpinBox),
  7641. decimalQuery(new QCheckBox(tr("Enable"))),
  7642. decimalAddress(new ShortHexSpinBox),decimalPosition(new QSpinBox),
  7643. unitQuery(new QCheckBox(tr("Enable"))),
  7644. unitAddress(new ShortHexSpinBox),valueF(new QSpinBox),
  7645. valueC(new QSpinBox),fixedUnit(new QComboBox),
  7646. pVAddress(new ShortHexSpinBox),
  7647. sVEnabled(new QCheckBox(tr("Enable"))),
  7648. sVReadAddress(new ShortHexSpinBox),
  7649. deviceLimit(new QCheckBox(tr("Enable"))),
  7650. sVLowerAddr(new ShortHexSpinBox),sVUpperAddr(new ShortHexSpinBox),
  7651. sVLower(new QDoubleSpinBox),sVUpper(new QDoubleSpinBox),
  7652. sVWritable(new QCheckBox(tr("Enable"))),
  7653. sVOutputAddr(new ShortHexSpinBox),
  7654. pVColumnName(new QLineEdit),sVColumnName(new QLineEdit)
  7655. {
  7656. QHBoxLayout*layout= new QHBoxLayout;
  7657. QWidget*form= new QWidget;
  7658. QHBoxLayout*masterLayout= new QHBoxLayout;
  7659. QVBoxLayout*portAndDeviceLayout= new QVBoxLayout;
  7660. QVBoxLayout*seriesLayout= new QVBoxLayout;
  7661. QFormLayout*serialSection= new QFormLayout;
  7662. serialSection->addRow(QString(tr("Port:")),port);
  7663. serialSection->addRow(QString(tr("Baud rate:")),baud);
  7664. serialSection->addRow(QString(tr("Parity:")),parity);
  7665. serialSection->addRow(QString(tr("Flow control:")),flow);
  7666. serialSection->addRow(QString(tr("Stop bits:")),stop);
  7667. QGroupBox*serialSectionBox= new QGroupBox(tr("Serial Port Configuration"));
  7668. serialSectionBox->setLayout(serialSection);
  7669. portAndDeviceLayout->addWidget(serialSectionBox);
  7670. QFormLayout*deviceSection= new QFormLayout;
  7671. station->setMinimum(1);
  7672. station->setMaximum(255);
  7673. decimalPosition->setMinimum(0);
  7674. decimalPosition->setMaximum(9);
  7675. valueF->setMinimum(0);
  7676. valueF->setMaximum(0xFFFF);
  7677. valueC->setMinimum(0);
  7678. valueC->setMaximum(0xFFFF);
  7679. fixedUnit->addItem(tr("Fahrenheit"),QVariant(QString("F")));
  7680. fixedUnit->addItem(tr("Celsius"),QVariant(QString("C")));
  7681. deviceSection->addRow(tr("Station:"),station);
  7682. deviceSection->addRow(tr("Decimal position from device:"),decimalQuery);
  7683. deviceSection->addRow(tr("Decimal position relative address:"),decimalAddress);
  7684. deviceSection->addRow(tr("Fixed decimal position:"),decimalPosition);
  7685. deviceSection->addRow(tr("Measurement unit from device:"),unitQuery);
  7686. deviceSection->addRow(tr("Current unit relative address:"),unitAddress);
  7687. deviceSection->addRow(tr("Value for Fahrenheit:"),valueF);
  7688. deviceSection->addRow(tr("Value for Celsius:"),valueC);
  7689. deviceSection->addRow(tr("Fixed unit:"),fixedUnit);
  7690. QGroupBox*deviceSectionBox= new QGroupBox(tr("Device Configuration"));
  7691. deviceSectionBox->setLayout(deviceSection);
  7692. portAndDeviceLayout->addWidget(deviceSectionBox);
  7693. QFormLayout*pVSection= new QFormLayout;
  7694. pVSection->addRow(tr("Value relative address:"),pVAddress);
  7695. pVSection->addRow(tr("PV column name:"),pVColumnName);
  7696. QCheckBox*pVHideBox= new QCheckBox(tr("Hide this channel"));
  7697. pVSection->addRow(pVHideBox);
  7698. QGroupBox*processValueBox= new QGroupBox(tr("Process Value"));
  7699. processValueBox->setLayout(pVSection);
  7700. seriesLayout->addWidget(processValueBox);
  7701. QFormLayout*sVSection= new QFormLayout;
  7702. sVLower->setDecimals(1);
  7703. sVLower->setMinimum(0.0);
  7704. sVLower->setMaximum(999.9);
  7705. sVUpper->setDecimals(1);
  7706. sVUpper->setMinimum(0.0);
  7707. sVUpper->setMaximum(999.9);
  7708. sVSection->addRow(tr("Set value:"),sVEnabled);
  7709. sVSection->addRow(tr("Read relative address:"),sVReadAddress);
  7710. sVSection->addRow(tr("SV column name:"),sVColumnName);
  7711. sVSection->addRow(tr("Limits from device:"),deviceLimit);
  7712. sVSection->addRow(tr("Lower limit relative address:"),sVLowerAddr);
  7713. sVSection->addRow(tr("Upper limit relative address:"),sVUpperAddr);
  7714. sVSection->addRow(tr("Lower limit:"),sVLower);
  7715. sVSection->addRow(tr("Upper limit:"),sVUpper);
  7716. sVSection->addRow(tr("Output set value:"),sVWritable);
  7717. sVSection->addRow(tr("Output relative address:"),sVOutputAddr);
  7718. QCheckBox*sVHideBox= new QCheckBox(tr("Hide this channel"));
  7719. sVSection->addRow(sVHideBox);
  7720. QGroupBox*setValueBox= new QGroupBox(tr("Set Value"));
  7721. setValueBox->setLayout(sVSection);
  7722. seriesLayout->addWidget(setValueBox);
  7723. masterLayout->addLayout(portAndDeviceLayout);
  7724. masterLayout->addLayout(seriesLayout);
  7725. form->setLayout(masterLayout);
  7726. /*708:*/
  7727. #line 15254 "./typica.w"
  7728. QDomElement referenceElement=
  7729. model->referenceElement(model->data(index,Qt::UserRole).toString());
  7730. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  7731. QDomElement node;
  7732. /*:708*/
  7733. #line 17834 "./typica.w"
  7734. for(int i= 0;i<configData.size();i++)
  7735. {
  7736. node= configData.at(i).toElement();
  7737. if(node.attribute("name")=="port")
  7738. {
  7739. QString portname= node.attribute("value");
  7740. int idx= port->findText(portname);
  7741. if(idx>=0)
  7742. {
  7743. port->setCurrentIndex(idx);
  7744. }
  7745. else
  7746. {
  7747. port->addItem(portname);
  7748. }
  7749. }
  7750. else if(node.attribute("name")=="baud")
  7751. {
  7752. baud->setCurrentIndex(baud->findText(node.attribute("value")));
  7753. }
  7754. else if(node.attribute("name")=="parity")
  7755. {
  7756. parity->setCurrentIndex(parity->findData(node.attribute("value")));
  7757. }
  7758. else if(node.attribute("name")=="flow")
  7759. {
  7760. flow->setCurrentIndex(flow->findData(node.attribute("value")));
  7761. }
  7762. else if(node.attribute("name")=="stop")
  7763. {
  7764. stop->setCurrentIndex(stop->findData(node.attribute("value")));
  7765. }
  7766. else if(node.attribute("name")=="station")
  7767. {
  7768. station->setValue(node.attribute("value").toInt());
  7769. }
  7770. else if(node.attribute("name")=="decimalQuery")
  7771. {
  7772. if(node.attribute("value")=="true")
  7773. {
  7774. decimalQuery->setChecked(true);
  7775. }
  7776. else
  7777. {
  7778. decimalQuery->setChecked(false);
  7779. }
  7780. }
  7781. else if(node.attribute("name")=="decimalAddress")
  7782. {
  7783. decimalAddress->setValue(node.attribute("value").toInt());
  7784. }
  7785. else if(node.attribute("name")=="decimalPosition")
  7786. {
  7787. decimalPosition->setValue(node.attribute("value").toInt());
  7788. }
  7789. else if(node.attribute("name")=="unitQuery")
  7790. {
  7791. if(node.attribute("value")=="true")
  7792. {
  7793. unitQuery->setChecked(true);
  7794. }
  7795. else
  7796. {
  7797. unitQuery->setChecked(false);
  7798. }
  7799. }
  7800. else if(node.attribute("name")=="unitAddress")
  7801. {
  7802. unitAddress->setValue(node.attribute("value").toInt());
  7803. }
  7804. else if(node.attribute("name")=="valueF")
  7805. {
  7806. valueF->setValue(node.attribute("value").toInt());
  7807. }
  7808. else if(node.attribute("name")=="valueC")
  7809. {
  7810. valueC->setValue(node.attribute("value").toInt());
  7811. }
  7812. else if(node.attribute("name")=="fixedUnit")
  7813. {
  7814. fixedUnit->setCurrentIndex(fixedUnit->findText(node.attribute("value")));
  7815. }
  7816. else if(node.attribute("name")=="pVAddress")
  7817. {
  7818. pVAddress->setValue(node.attribute("value").toInt());
  7819. }
  7820. else if(node.attribute("name")=="sVEnabled")
  7821. {
  7822. if(node.attribute("value")=="true")
  7823. {
  7824. sVEnabled->setChecked(true);
  7825. }
  7826. else
  7827. {
  7828. sVEnabled->setChecked(false);
  7829. }
  7830. }
  7831. else if(node.attribute("name")=="sVReadAddress")
  7832. {
  7833. sVReadAddress->setValue(node.attribute("value").toInt());
  7834. }
  7835. else if(node.attribute("name")=="deviceLimit")
  7836. {
  7837. if(node.attribute("value")=="true")
  7838. {
  7839. deviceLimit->setChecked(true);
  7840. }
  7841. else
  7842. {
  7843. deviceLimit->setChecked(false);
  7844. }
  7845. }
  7846. else if(node.attribute("name")=="sVLowerAddr")
  7847. {
  7848. sVLowerAddr->setValue(node.attribute("value").toInt());
  7849. }
  7850. else if(node.attribute("name")=="sVUpperAddr")
  7851. {
  7852. sVUpperAddr->setValue(node.attribute("value").toInt());
  7853. }
  7854. else if(node.attribute("name")=="sVLower")
  7855. {
  7856. sVLower->setValue(node.attribute("value").toDouble());
  7857. }
  7858. else if(node.attribute("name")=="sVUpper")
  7859. {
  7860. sVUpper->setValue(node.attribute("value").toDouble());
  7861. }
  7862. else if(node.attribute("name")=="sVWritable")
  7863. {
  7864. if(node.attribute("value")=="true")
  7865. {
  7866. sVWritable->setChecked(true);
  7867. }
  7868. else
  7869. {
  7870. sVWritable->setChecked(false);
  7871. }
  7872. }
  7873. else if(node.attribute("name")=="sVOutputAddr")
  7874. {
  7875. sVOutputAddr->setValue(node.attribute("value").toInt());
  7876. }
  7877. else if(node.attribute("name")=="pvcolname")
  7878. {
  7879. pVColumnName->setText(node.attribute("value"));
  7880. }
  7881. else if(node.attribute("name")=="svcolname")
  7882. {
  7883. sVColumnName->setText(node.attribute("value"));
  7884. }
  7885. else if(node.attribute("name")=="pvhidden")
  7886. {
  7887. pVHideBox->setChecked(node.attribute("value")=="true");
  7888. }
  7889. else if(node.attribute("name")=="svhidden")
  7890. {
  7891. sVHideBox->setChecked(node.attribute("value")=="true");
  7892. }
  7893. }
  7894. updatePort(port->currentText());
  7895. updateBaudRate(baud->currentText());
  7896. updateParity(parity->itemData(parity->currentIndex()).toString());
  7897. updateFlowControl(flow->itemData(flow->currentIndex()).toString());
  7898. updateStopBits(stop->itemData(stop->currentIndex()).toString());
  7899. updateStation(station->value());
  7900. updateFixedDecimal(decimalQuery->isChecked());
  7901. updateDecimalAddress(decimalAddress->value());
  7902. updateDecimalPosition(decimalPosition->value());
  7903. updateFixedUnit(unitQuery->isChecked());
  7904. updateUnitAddress(unitAddress->value());
  7905. updateValueForF(valueF->value());
  7906. updateValueForC(valueC->value());
  7907. updateUnit(fixedUnit->currentText());
  7908. updatePVAddress(pVAddress->value());
  7909. updateSVEnabled(sVEnabled->isChecked());
  7910. updateSVReadAddress(sVReadAddress->value());
  7911. updateDeviceLimit(deviceLimit->isChecked());
  7912. updateSVLowerAddress(sVLowerAddr->value());
  7913. updateSVUpperAddress(sVUpperAddr->value());
  7914. updateSVLower(sVLower->value());
  7915. updateSVUpper(sVUpper->value());
  7916. updateSVWritable(sVWritable->isChecked());
  7917. updateSVWriteAddress(sVOutputAddr->value());
  7918. updatePVColumnName(pVColumnName->text());
  7919. updateSVColumnName(sVColumnName->text());
  7920. updatePVHidden(pVHideBox->isChecked());
  7921. updateSVHidden(sVHideBox->isChecked());
  7922. connect(port,SIGNAL(currentIndexChanged(QString)),this,SLOT(updatePort(QString)));
  7923. connect(port,SIGNAL(editTextChanged(QString)),this,SLOT(updatePort(QString)));
  7924. connect(baud,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateBaudRate(QString)));
  7925. connect(parity,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateParity(QString)));
  7926. connect(flow,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateFlowControl(QString)));
  7927. connect(stop,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateStopBits(QString)));
  7928. connect(station,SIGNAL(valueChanged(int)),this,SLOT(updateStation(int)));
  7929. connect(decimalQuery,SIGNAL(toggled(bool)),this,SLOT(updateFixedDecimal(bool)));
  7930. connect(decimalAddress,SIGNAL(valueChanged(int)),this,SLOT(updateDecimalAddress(int)));
  7931. connect(decimalPosition,SIGNAL(valueChanged(int)),this,SLOT(updateDecimalPosition(int)));
  7932. connect(unitQuery,SIGNAL(toggled(bool)),this,SLOT(updateFixedUnit(bool)));
  7933. connect(unitAddress,SIGNAL(valueChanged(int)),this,SLOT(updateUnitAddress(int)));
  7934. connect(valueF,SIGNAL(valueChanged(int)),this,SLOT(updateValueForF(int)));
  7935. connect(valueC,SIGNAL(valueChanged(int)),this,SLOT(updateValueForC(int)));
  7936. connect(fixedUnit,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateUnit(QString)));
  7937. connect(pVAddress,SIGNAL(valueChanged(int)),this,SLOT(updatePVAddress(int)));
  7938. connect(sVEnabled,SIGNAL(toggled(bool)),this,SLOT(updateSVEnabled(bool)));
  7939. connect(sVReadAddress,SIGNAL(valueChanged(int)),this,SLOT(updateSVReadAddress(int)));
  7940. connect(deviceLimit,SIGNAL(toggled(bool)),this,SLOT(updateDeviceLimit(bool)));
  7941. connect(sVLowerAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVLowerAddress(int)));
  7942. connect(sVUpperAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVUpperAddress(int)));
  7943. connect(sVLower,SIGNAL(valueChanged(double)),this,SLOT(updateSVLower(double)));
  7944. connect(sVUpper,SIGNAL(valueChanged(double)),this,SLOT(updateSVUpper(double)));
  7945. connect(sVWritable,SIGNAL(toggled(bool)),this,SLOT(updateSVWritable(bool)));
  7946. connect(sVOutputAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVWriteAddress(int)));
  7947. connect(pVColumnName,SIGNAL(textEdited(QString)),this,SLOT(updatePVColumnName(QString)));
  7948. connect(sVColumnName,SIGNAL(textEdited(QString)),this,SLOT(updateSVColumnName(QString)));
  7949. connect(pVHideBox,SIGNAL(toggled(bool)),this,SLOT(updatePVHidden(bool)));
  7950. connect(sVHideBox,SIGNAL(toggled(bool)),this,SLOT(updateSVHidden(bool)));
  7951. layout->addWidget(form);
  7952. setLayout(layout);
  7953. }
  7954. void ModbusConfigurator::updatePort(const QString&newPort)
  7955. {
  7956. updateAttribute("port",newPort);
  7957. }
  7958. void ModbusConfigurator::updateBaudRate(const QString&newRate)
  7959. {
  7960. updateAttribute("baud",newRate);
  7961. }
  7962. void ModbusConfigurator::updateParity(const QString&)
  7963. {
  7964. updateAttribute("parity",parity->itemData(parity->currentIndex()).toString());
  7965. }
  7966. void ModbusConfigurator::updateFlowControl(const QString&)
  7967. {
  7968. updateAttribute("flow",flow->itemData(flow->currentIndex()).toString());
  7969. }
  7970. void ModbusConfigurator::updateStopBits(const QString&)
  7971. {
  7972. updateAttribute("stop",stop->itemData(stop->currentIndex()).toString());
  7973. }
  7974. void ModbusConfigurator::updateStation(int station)
  7975. {
  7976. updateAttribute("station",QString("%1").arg(station));
  7977. }
  7978. void ModbusConfigurator::updateFixedDecimal(bool fixed)
  7979. {
  7980. updateAttribute("decimalQuery",fixed?"true":"false");
  7981. }
  7982. void ModbusConfigurator::updateDecimalAddress(int address)
  7983. {
  7984. updateAttribute("decimalAddress",QString("%1").arg(address));
  7985. }
  7986. void ModbusConfigurator::updateDecimalPosition(int position)
  7987. {
  7988. updateAttribute("decimalPosition",QString("%1").arg(position));
  7989. }
  7990. void ModbusConfigurator::updateFixedUnit(bool fixed)
  7991. {
  7992. updateAttribute("unitQuery",fixed?"true":"false");
  7993. }
  7994. void ModbusConfigurator::updateUnitAddress(int address)
  7995. {
  7996. updateAttribute("unitAddress",QString("%1").arg(address));
  7997. }
  7998. void ModbusConfigurator::updateValueForF(int value)
  7999. {
  8000. updateAttribute("valueF",QString("%1").arg(value));
  8001. }
  8002. void ModbusConfigurator::updateValueForC(int value)
  8003. {
  8004. updateAttribute("valueC",QString("%1").arg(value));
  8005. }
  8006. void ModbusConfigurator::updateUnit(const QString&newUnit)
  8007. {
  8008. updateAttribute("fixedUnit",newUnit);
  8009. }
  8010. void ModbusConfigurator::updatePVAddress(int address)
  8011. {
  8012. updateAttribute("pVAddress",QString("%1").arg(address));
  8013. }
  8014. void ModbusConfigurator::updateSVEnabled(bool enabled)
  8015. {
  8016. updateAttribute("sVEnabled",enabled?"true":"false");
  8017. }
  8018. void ModbusConfigurator::updateSVReadAddress(int address)
  8019. {
  8020. updateAttribute("sVReadAddress",QString("%1").arg(address));
  8021. }
  8022. void ModbusConfigurator::updateDeviceLimit(bool query)
  8023. {
  8024. updateAttribute("deviceLimit",query?"true":"false");
  8025. }
  8026. void ModbusConfigurator::updateSVLowerAddress(int address)
  8027. {
  8028. updateAttribute("sVLowerAddr",QString("%1").arg(address));
  8029. }
  8030. void ModbusConfigurator::updateSVUpperAddress(int address)
  8031. {
  8032. updateAttribute("sVUpperAddr",QString("%1").arg(address));
  8033. }
  8034. void ModbusConfigurator::updateSVLower(double value)
  8035. {
  8036. updateAttribute("sVLower",QString("%1").arg(value));
  8037. }
  8038. void ModbusConfigurator::updateSVUpper(double value)
  8039. {
  8040. updateAttribute("sVUpper",QString("%1").arg(value));
  8041. }
  8042. void ModbusConfigurator::updateSVWritable(bool canWriteSV)
  8043. {
  8044. updateAttribute("sVWritable",canWriteSV?"true":"false");
  8045. }
  8046. void ModbusConfigurator::updateSVWriteAddress(int address)
  8047. {
  8048. updateAttribute("sVOutputAddr",QString("%1").arg(address));
  8049. }
  8050. void ModbusConfigurator::updatePVColumnName(const QString&name)
  8051. {
  8052. updateAttribute("pvcolname",name);
  8053. }
  8054. void ModbusConfigurator::updateSVColumnName(const QString&name)
  8055. {
  8056. updateAttribute("svcolname",name);
  8057. }
  8058. void ModbusConfigurator::updatePVHidden(bool hidden)
  8059. {
  8060. updateAttribute("pvhidden",hidden?"true":"false");
  8061. }
  8062. void ModbusConfigurator::updateSVHidden(bool hidden)
  8063. {
  8064. updateAttribute("svhidden",hidden?"true":"false");
  8065. }
  8066. /*:795*/
  8067. #line 576 "./typica.w"
  8068. /*743:*/
  8069. #line 16042 "./typica.w"
  8070. ShortHexSpinBox::ShortHexSpinBox(QWidget*parent):QSpinBox(parent)
  8071. {
  8072. setMinimum(0);
  8073. setMaximum(0xFFFF);
  8074. setPrefix("0x");
  8075. setMinimumWidth(65);
  8076. }
  8077. QValidator::State ShortHexSpinBox::validate(QString&input,int&)const
  8078. {
  8079. if(input.size()==2)
  8080. {
  8081. return QValidator::Intermediate;
  8082. }
  8083. bool okay;
  8084. input.toInt(&okay,16);
  8085. if(okay)
  8086. {
  8087. return QValidator::Acceptable;
  8088. }
  8089. return QValidator::Invalid;
  8090. }
  8091. int ShortHexSpinBox::valueFromText(const QString&text)const
  8092. {
  8093. return text.toInt(NULL,16);
  8094. }
  8095. QString ShortHexSpinBox::textFromValue(int value)const
  8096. {
  8097. QString retval;
  8098. retval.setNum(value,16);
  8099. while(retval.size()<4)
  8100. {
  8101. retval.prepend("0");
  8102. }
  8103. return retval.toUpper();
  8104. }
  8105. /*:743*/
  8106. #line 577 "./typica.w"
  8107. /*780:*/
  8108. #line 17072 "./typica.w"
  8109. ModbusRTUDevice::ModbusRTUDevice(DeviceTreeModel*model,const QModelIndex&index)
  8110. :QObject(NULL),messageDelayTimer(new QTimer),unitIsF(true),readingsv(false),
  8111. waiting(false)
  8112. {
  8113. QDomElement portReferenceElement= model->referenceElement(model->data(index,
  8114. Qt::UserRole).toString());
  8115. QDomNodeList portConfigData= portReferenceElement.elementsByTagName("attribute");
  8116. QDomElement node;
  8117. QVariantMap attributes;
  8118. for(int i= 0;i<portConfigData.size();i++)
  8119. {
  8120. node= portConfigData.at(i).toElement();
  8121. attributes.insert(node.attribute("name"),node.attribute("value"));
  8122. }
  8123. port= new QextSerialPort(attributes.value("port").toString(),
  8124. QextSerialPort::EventDriven);
  8125. int baudRate= attributes.value("baud").toInt();
  8126. port->setBaudRate((BaudRateType)baudRate);
  8127. double temp= ((double)(1)/(double)(baudRate))*48;
  8128. delayTime= (int)(temp*3000);
  8129. messageDelayTimer->setSingleShot(true);
  8130. connect(messageDelayTimer,SIGNAL(timeout()),this,SLOT(sendNextMessage()));
  8131. port->setDataBits(DATA_8);
  8132. port->setParity((ParityType)attributes.value("parity").toInt());
  8133. port->setStopBits((StopBitsType)attributes.value("stop").toInt());
  8134. port->setFlowControl((FlowType)attributes.value("flow").toInt());
  8135. connect(port,SIGNAL(readyRead()),this,SLOT(dataAvailable()));
  8136. port->open(QIODevice::ReadWrite);
  8137. station= (char)attributes.value("station").toInt();
  8138. if(attributes.value("decimalQuery")=="true")
  8139. {
  8140. decimalPosition= 0;
  8141. QByteArray message;
  8142. message.append(station);
  8143. message.append((char)0x03);
  8144. quint16 address= (quint16)attributes.value("decimalAddress").toInt();
  8145. char*addressBytes= (char*)&address;
  8146. message.append(addressBytes[1]);
  8147. message.append(addressBytes[0]);
  8148. message.append((char)0x00);
  8149. message.append((char)0x01);
  8150. queueMessage(message,this,"decimalResponse(QByteArray)");
  8151. }
  8152. else
  8153. {
  8154. decimalPosition= attributes.value("decimalPosition").toInt();
  8155. }
  8156. valueF= attributes.value("valueF").toInt();
  8157. valueC= attributes.value("valueC").toInt();
  8158. if(attributes.value("unitQuery")=="true")
  8159. {
  8160. QByteArray message;
  8161. message.append(station);
  8162. message.append((char)0x03);
  8163. quint16 address= (quint16)attributes.value("unitAddress").toInt();
  8164. char*addressBytes= (char*)&address;
  8165. message.append(addressBytes[1]);
  8166. message.append(addressBytes[0]);
  8167. message.append((char)0x00);
  8168. message.append((char)0x01);
  8169. queueMessage(message,this,"unitResponse(QByteArray)");
  8170. }
  8171. else
  8172. {
  8173. if(attributes.value("fixedUnit")=="Celsius")
  8174. {
  8175. unitIsF= false;
  8176. }
  8177. }
  8178. if(attributes.value("sVWritable")=="true")
  8179. {
  8180. if(attributes.value("deviceLimit")=="true")
  8181. {
  8182. QByteArray lmessage;
  8183. lmessage.append(station);
  8184. lmessage.append((char)0x03);
  8185. quint16 laddress= (quint16)attributes.value("sVLowerAddr").toInt();
  8186. char*addressBytes= (char*)&laddress;
  8187. lmessage.append(addressBytes[1]);
  8188. lmessage.append(addressBytes[0]);
  8189. lmessage.append((char)0x00);
  8190. lmessage.append((char)0x01);
  8191. queueMessage(lmessage,this,"svlResponse(QByteArray)");
  8192. QByteArray umessage;
  8193. umessage.append(station);
  8194. umessage.append((char)0x03);
  8195. quint16 uaddress= (quint16)attributes.value("sVUpperAddr").toInt();
  8196. addressBytes= (char*)&uaddress;
  8197. umessage.append(addressBytes[1]);
  8198. umessage.append(addressBytes[0]);
  8199. umessage.append((char)0x00);
  8200. umessage.append((char)0x01);
  8201. queueMessage(umessage,this,"svuResponse(QByteArray)");
  8202. }
  8203. else
  8204. {
  8205. outputSVLower= attributes.value("sVLower").toDouble();
  8206. outputSVUpper= attributes.value("sVUpper").toDouble();
  8207. }
  8208. outputSVStub.append(station);
  8209. outputSVStub.append((char)0x06);
  8210. quint16 address= (quint16)attributes.value("sVOutputAddr").toInt();
  8211. char*addressBytes= (char*)&address;
  8212. outputSVStub.append(addressBytes[1]);
  8213. outputSVStub.append(addressBytes[0]);
  8214. }
  8215. Channel*pv= new Channel;
  8216. channels.append(pv);
  8217. pvStub.append(station);
  8218. pvStub.append((char)0x04);
  8219. pvaddress= (quint16)attributes.value("pVAddress").toInt();
  8220. char*pvac= (char*)&pvaddress;
  8221. pvStub.append(pvac[1]);
  8222. pvStub.append(pvac[0]);
  8223. pvStub.append((char)0x00);
  8224. pvStub.append((char)0x01);
  8225. svenabled= attributes.value("sVEnabled").toBool();
  8226. if(svenabled)
  8227. {
  8228. Channel*sv= new Channel;
  8229. channels.append(sv);
  8230. svStub.append(station);
  8231. svStub.append((char)0x04);
  8232. svaddress= (quint16)attributes.value("sVReadAddress").toInt();
  8233. char*svac= (char*)&svaddress;
  8234. svStub.append(svac[1]);
  8235. svStub.append(svac[0]);
  8236. svStub.append((char)0x00);
  8237. svStub.append((char)0x01);
  8238. if(svaddress-pvaddress==1)
  8239. {
  8240. mStub.append(station);
  8241. mStub.append((char)0x04);
  8242. mStub.append(pvac[1]);
  8243. mStub.append(pvac[0]);
  8244. mStub.append((char)0x00);
  8245. mStub.append((char)0x02);
  8246. }
  8247. }
  8248. connect(this,SIGNAL(queueEmpty()),this,SLOT(requestMeasurement()));
  8249. requestMeasurement();
  8250. }
  8251. double ModbusRTUDevice::SVLower()
  8252. {
  8253. return outputSVLower;
  8254. }
  8255. double ModbusRTUDevice::SVUpper()
  8256. {
  8257. return outputSVUpper;
  8258. }
  8259. int ModbusRTUDevice::decimals()
  8260. {
  8261. return decimalPosition;
  8262. }
  8263. void ModbusRTUDevice::decimalResponse(QByteArray response)
  8264. {
  8265. quint16 temp;
  8266. char*tchar= (char*)&temp;
  8267. tchar[1]= response.at(3);
  8268. tchar[0]= response.at(4);
  8269. decimalPosition= temp;
  8270. emit SVDecimalChanged(decimalPosition);
  8271. qDebug()<<"Received decimal response";
  8272. }
  8273. void ModbusRTUDevice::unitResponse(QByteArray response)
  8274. {
  8275. quint16 temp;
  8276. char*tchar= (char*)&temp;
  8277. tchar[1]= response.at(3);
  8278. tchar[0]= response.at(4);
  8279. int value= temp;
  8280. if(value==valueF)
  8281. {
  8282. unitIsF= true;
  8283. }
  8284. else
  8285. {
  8286. unitIsF= false;
  8287. }
  8288. }
  8289. void ModbusRTUDevice::svlResponse(QByteArray response)
  8290. {
  8291. quint16 temp;
  8292. char*tchar= (char*)&temp;
  8293. tchar[1]= response.at(3);
  8294. tchar[0]= response.at(4);
  8295. outputSVLower= (double)temp;
  8296. for(int i= 0;i<decimalPosition;i++)
  8297. {
  8298. outputSVLower/= 10;
  8299. }
  8300. emit SVLowerChanged(outputSVLower);
  8301. }
  8302. void ModbusRTUDevice::svuResponse(QByteArray response)
  8303. {
  8304. quint16 temp;
  8305. char*tchar= (char*)&temp;
  8306. tchar[1]= response.at(3);
  8307. tchar[0]= response.at(4);
  8308. outputSVUpper= (double)temp;
  8309. for(int i= 0;i<decimalPosition;i++)
  8310. {
  8311. outputSVUpper/= 10;
  8312. }
  8313. emit SVUpperChanged(outputSVUpper);
  8314. }
  8315. void ModbusRTUDevice::requestMeasurement()
  8316. {
  8317. if(mStub.length()> 0)
  8318. {
  8319. queueMessage(mStub,this,"mResponse(QByteArray)");
  8320. }
  8321. else
  8322. {
  8323. queueMessage(pvStub,this,"mResponse(QByteArray)");
  8324. if(svenabled)
  8325. {
  8326. queueMessage(svStub,this,"mResponse(QByteArray)");
  8327. }
  8328. }
  8329. }
  8330. void ModbusRTUDevice::mResponse(QByteArray response)
  8331. {
  8332. QTime time= QTime::currentTime();
  8333. if(response.at(2)==0x04)
  8334. {
  8335. /*781:*/
  8336. #line 17321 "./typica.w"
  8337. quint16 pv;
  8338. quint16 sv;
  8339. char*pvBytes= (char*)&pv;
  8340. char*svBytes= (char*)&sv;
  8341. pvBytes[1]= response.at(3);
  8342. pvBytes[0]= response.at(4);
  8343. svBytes[1]= response.at(5);
  8344. svBytes[0]= response.at(6);
  8345. double pvOut= (double)pv;
  8346. double svOut= (double)sv;
  8347. for(int i= 0;i<decimalPosition;i++)
  8348. {
  8349. pvOut/= 10;
  8350. svOut/= 10;
  8351. }
  8352. if(!unitIsF)
  8353. {
  8354. pvOut= pvOut*9/5+32;
  8355. svOut= svOut*9/5+32;
  8356. }
  8357. Measurement pvm(pvOut,time,Units::Fahrenheit);
  8358. Measurement svm(svOut,time,Units::Fahrenheit);
  8359. channels.at(0)->input(pvm);
  8360. channels.at(1)->input(svm);
  8361. /*:781*/
  8362. #line 17308 "./typica.w"
  8363. }
  8364. else
  8365. {
  8366. /*782:*/
  8367. #line 17351 "./typica.w"
  8368. quint16 value;
  8369. char*valueBytes= (char*)&value;
  8370. valueBytes[1]= response.at(3);
  8371. valueBytes[0]= response.at(4);
  8372. double valueOut= (double)value;
  8373. for(int i= 0;i<decimalPosition;i++)
  8374. {
  8375. valueOut/= 10;
  8376. }
  8377. if(!unitIsF)
  8378. {
  8379. valueOut= valueOut*9/5+32;
  8380. }
  8381. if(!svenabled)
  8382. {
  8383. Measurement vm(valueOut,time,Units::Fahrenheit);
  8384. channels.at(0)->input(vm);
  8385. }
  8386. else
  8387. {
  8388. if(readingsv)
  8389. {
  8390. Measurement pvm(savedpv,time,Units::Fahrenheit);
  8391. Measurement svm(valueOut,time,Units::Fahrenheit);
  8392. channels.at(0)->input(pvm);
  8393. channels.at(1)->input(svm);
  8394. readingsv= false;
  8395. }
  8396. else
  8397. {
  8398. savedpv= valueOut;
  8399. readingsv= true;
  8400. }
  8401. }
  8402. /*:782*/
  8403. #line 17312 "./typica.w"
  8404. }
  8405. }
  8406. /*:780*//*783:*/
  8407. #line 17389 "./typica.w"
  8408. ModbusRTUDevice::~ModbusRTUDevice()
  8409. {
  8410. messageDelayTimer->stop();
  8411. port->close();
  8412. }
  8413. /*:783*//*784:*/
  8414. #line 17411 "./typica.w"
  8415. void ModbusRTUDevice::dataAvailable()
  8416. {
  8417. if(messageDelayTimer->isActive())
  8418. {
  8419. messageDelayTimer->stop();
  8420. }
  8421. responseBuffer.append(port->readAll());
  8422. /*785:*/
  8423. #line 17456 "./typica.w"
  8424. if(responseBuffer.size()<5)
  8425. {
  8426. return;
  8427. }
  8428. switch(responseBuffer.at(1))
  8429. {
  8430. case 0x01:
  8431. case 0x02:
  8432. if(responseBuffer.size()<6)
  8433. {
  8434. return;
  8435. }
  8436. responseBuffer= responseBuffer.left(6);
  8437. break;
  8438. case 0x03:
  8439. case 0x04:
  8440. if(responseBuffer.size()<5+responseBuffer.at(2))
  8441. {
  8442. return;
  8443. }
  8444. responseBuffer= responseBuffer.left(5+responseBuffer.at(2));
  8445. break;
  8446. case 0x05:
  8447. case 0x06:
  8448. case 0x10:
  8449. if(responseBuffer.size()<8)
  8450. {
  8451. return;
  8452. }
  8453. responseBuffer= responseBuffer.left(8);
  8454. break;
  8455. }
  8456. /*:785*/
  8457. #line 17419 "./typica.w"
  8458. if(calculateCRC(responseBuffer)==0)
  8459. {
  8460. QObject*object= retObjQueue.at(0);
  8461. char*method= callbackQueue.at(0);
  8462. QMetaMethod metamethod= object->metaObject()->
  8463. method(object->metaObject()->
  8464. indexOfMethod(QMetaObject::normalizedSignature(method)));
  8465. metamethod.invoke(object,Qt::QueuedConnection,
  8466. Q_ARG(QByteArray,responseBuffer));
  8467. messageQueue.removeAt(0);
  8468. retObjQueue.removeAt(0);
  8469. callbackQueue.removeAt(0);
  8470. messageDelayTimer->start(delayTime);
  8471. }
  8472. else
  8473. {
  8474. qDebug()<<"CRC failed";
  8475. }
  8476. waiting= false;
  8477. responseBuffer.clear();
  8478. }
  8479. /*:784*//*786:*/
  8480. #line 17498 "./typica.w"
  8481. quint16 ModbusRTUDevice::calculateCRC(QByteArray data)
  8482. {
  8483. quint16 retval= 0xFFFF;
  8484. int i= 0;
  8485. while(i<data.size())
  8486. {
  8487. retval^= 0x00FF&(quint16)data.at(i);
  8488. for(int j= 0;j<8;j++)
  8489. {
  8490. if(retval&1)
  8491. {
  8492. retval= (retval>>1)^0xA001;
  8493. }
  8494. else
  8495. {
  8496. retval>>= 1;
  8497. }
  8498. }
  8499. i++;
  8500. }
  8501. return retval;
  8502. }
  8503. /*:786*//*787:*/
  8504. #line 17529 "./typica.w"
  8505. void ModbusRTUDevice::queueMessage(QByteArray request,QObject*object,
  8506. const char*callback)
  8507. {
  8508. messageQueue.append(request);
  8509. retObjQueue.append(object);
  8510. callbackQueue.append(const_cast<char*> (callback));
  8511. if(messageQueue.size()==1&&!(messageDelayTimer->isActive()))
  8512. {
  8513. sendNextMessage();
  8514. }
  8515. }
  8516. void ModbusRTUDevice::sendNextMessage()
  8517. {
  8518. if(messageQueue.size()> 0&&!waiting)
  8519. {
  8520. QByteArray message= messageQueue.at(0);
  8521. quint16 crc= calculateCRC(message);
  8522. char*check= (char*)&crc;
  8523. message.append(check[0]);
  8524. message.append(check[1]);
  8525. port->write(message);
  8526. messageDelayTimer->start(delayTime);
  8527. waiting= true;
  8528. }
  8529. else
  8530. {
  8531. emit queueEmpty();
  8532. }
  8533. }
  8534. void ModbusRTUDevice::outputSV(double value)
  8535. {
  8536. for(int i= 0;i<decimalPosition;i++)
  8537. {
  8538. value*= 10;
  8539. }
  8540. quint16 outval= (quint16)value;
  8541. QByteArray message(outputSVStub);
  8542. char*valBytes= (char*)&outval;
  8543. message.append(valBytes[1]);
  8544. message.append(valBytes[0]);
  8545. queueMessage(message,this,"ignore(QByteArray)");
  8546. }
  8547. /*:787*//*788:*/
  8548. #line 17577 "./typica.w"
  8549. void ModbusRTUDevice::ignore(QByteArray)
  8550. {
  8551. return;
  8552. }
  8553. /*:788*/
  8554. #line 578 "./typica.w"
  8555. /*662:*/
  8556. #line 14235 "./typica.w"
  8557. DeviceTreeModelNode::DeviceTreeModelNode(QDomNode&node,int row,
  8558. DeviceTreeModelNode*parent)
  8559. :domNode(node),rowNumber(row),parentItem(parent)
  8560. {
  8561. }
  8562. DeviceTreeModelNode::~DeviceTreeModelNode()
  8563. {
  8564. QHash<int,DeviceTreeModelNode*> ::iterator i;
  8565. for(i= children.begin();i!=children.end();i++)
  8566. {
  8567. delete i.value();
  8568. }
  8569. }
  8570. DeviceTreeModelNode*DeviceTreeModelNode::parent()
  8571. {
  8572. return parentItem;
  8573. }
  8574. int DeviceTreeModelNode::row()
  8575. {
  8576. return rowNumber;
  8577. }
  8578. QDomNode DeviceTreeModelNode::node()const
  8579. {
  8580. return domNode;
  8581. }
  8582. DeviceTreeModelNode*DeviceTreeModelNode::child(int index)
  8583. {
  8584. if(children.contains(index))
  8585. {
  8586. return children[index];
  8587. }
  8588. if(index>=0&&index<domNode.childNodes().count())
  8589. {
  8590. QDomNode childNode= domNode.childNodes().item(index);
  8591. DeviceTreeModelNode*childItem= new DeviceTreeModelNode(childNode,
  8592. index,this);
  8593. children[index]= childItem;
  8594. return childItem;
  8595. }
  8596. return NULL;
  8597. }
  8598. /*:662*/
  8599. #line 579 "./typica.w"
  8600. /*664:*/
  8601. #line 14324 "./typica.w"
  8602. DeviceTreeModel::DeviceTreeModel(QObject*parent)
  8603. :QAbstractItemModel(parent)
  8604. {
  8605. document= AppInstance->deviceConfiguration();
  8606. QDomNodeList elements= document.elementsByTagName("devices");
  8607. if(elements.size()!=1)
  8608. {
  8609. qDebug()<<"Unexpected result when loading device map.";
  8610. }
  8611. treeRoot= elements.at(0);
  8612. root= new DeviceTreeModelNode(treeRoot,0);
  8613. elements= document.elementsByTagName("references");
  8614. if(elements.size()!=1)
  8615. {
  8616. qDebug()<<"No references section. Creating.";
  8617. referenceSection= document.createElement("references");
  8618. document.appendChild(referenceSection);
  8619. }
  8620. else
  8621. {
  8622. referenceSection= elements.at(0);
  8623. }
  8624. connect(this,SIGNAL(dataChanged(QModelIndex,QModelIndex)),
  8625. AppInstance,SLOT(saveDeviceConfiguration()));
  8626. connect(this,SIGNAL(modelReset()),
  8627. AppInstance,SLOT(saveDeviceConfiguration()));
  8628. connect(this,SIGNAL(rowsInserted(QModelIndex,int,int)),
  8629. AppInstance,SLOT(saveDeviceConfiguration()));
  8630. }
  8631. /*:664*//*665:*/
  8632. #line 14359 "./typica.w"
  8633. int DeviceTreeModel::columnCount(const QModelIndex&)const
  8634. {
  8635. return 1;
  8636. }
  8637. int DeviceTreeModel::rowCount(const QModelIndex&parent)const
  8638. {
  8639. if(parent.column()> 0)
  8640. {
  8641. return 0;
  8642. }
  8643. /*666:*/
  8644. #line 14378 "./typica.w"
  8645. DeviceTreeModelNode*parentItem;
  8646. if(!parent.isValid())
  8647. {
  8648. parentItem= root;
  8649. }
  8650. else
  8651. {
  8652. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  8653. }
  8654. /*:666*/
  8655. #line 14371 "./typica.w"
  8656. return parentItem->node().childNodes().count();
  8657. }
  8658. /*:665*//*667:*/
  8659. #line 14392 "./typica.w"
  8660. QModelIndex DeviceTreeModel::index(int row,int column,
  8661. const QModelIndex&parent)const
  8662. {
  8663. if(!hasIndex(row,column,parent))
  8664. {
  8665. return QModelIndex();
  8666. }
  8667. /*666:*/
  8668. #line 14378 "./typica.w"
  8669. DeviceTreeModelNode*parentItem;
  8670. if(!parent.isValid())
  8671. {
  8672. parentItem= root;
  8673. }
  8674. else
  8675. {
  8676. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  8677. }
  8678. /*:666*/
  8679. #line 14400 "./typica.w"
  8680. DeviceTreeModelNode*childItem= parentItem->child(row);
  8681. if(childItem)
  8682. {
  8683. return createIndex(row,column,childItem);
  8684. }
  8685. return QModelIndex();
  8686. }
  8687. /*:667*//*668:*/
  8688. #line 14411 "./typica.w"
  8689. QModelIndex DeviceTreeModel::parent(const QModelIndex&child)const
  8690. {
  8691. if(!child.isValid())
  8692. {
  8693. return QModelIndex();
  8694. }
  8695. DeviceTreeModelNode*childItem=
  8696. static_cast<DeviceTreeModelNode*> (child.internalPointer());
  8697. DeviceTreeModelNode*parentItem= childItem->parent();
  8698. if(!parentItem||parentItem==root)
  8699. {
  8700. return QModelIndex();
  8701. }
  8702. return createIndex(parentItem->row(),0,parentItem);
  8703. }
  8704. /*:668*//*669:*/
  8705. #line 14430 "./typica.w"
  8706. Qt::ItemFlags DeviceTreeModel::flags(const QModelIndex&index)const
  8707. {
  8708. if(!index.isValid())
  8709. {
  8710. return 0;
  8711. }
  8712. return Qt::ItemIsEnabled|Qt::ItemIsSelectable|Qt::ItemIsEditable;
  8713. }
  8714. /*:669*//*670:*/
  8715. #line 14445 "./typica.w"
  8716. QVariant DeviceTreeModel::data(const QModelIndex&index,int role)const
  8717. {
  8718. if(!index.isValid())
  8719. {
  8720. return QVariant();
  8721. }
  8722. if(role!=Qt::DisplayRole&&role!=Qt::UserRole&&role!=Qt::EditRole)
  8723. {
  8724. return QVariant();
  8725. }
  8726. DeviceTreeModelNode*item=
  8727. static_cast<DeviceTreeModelNode*> (index.internalPointer());
  8728. QDomNode node= item->node();
  8729. QDomElement element= node.toElement();
  8730. switch(role)
  8731. {
  8732. case Qt::DisplayRole:
  8733. case Qt::EditRole:
  8734. return QVariant(element.attribute("name"));
  8735. case Qt::UserRole:
  8736. return QVariant(element.attribute("reference"));
  8737. default:
  8738. return QVariant();
  8739. }
  8740. return QVariant();
  8741. }
  8742. /*:670*//*671:*/
  8743. #line 14477 "./typica.w"
  8744. bool DeviceTreeModel::setData(const QModelIndex&index,
  8745. const QVariant&value,int)
  8746. {
  8747. if(!index.isValid())
  8748. {
  8749. return false;
  8750. }
  8751. DeviceTreeModelNode*item=
  8752. static_cast<DeviceTreeModelNode*> (index.internalPointer());
  8753. QDomNode node= item->node();
  8754. QDomElement element= node.toElement();
  8755. element.setAttribute("name",value.toString());
  8756. emit dataChanged(index,index);
  8757. return true;
  8758. }
  8759. /*:671*//*672:*/
  8760. #line 14500 "./typica.w"
  8761. void DeviceTreeModel::newNode(const QString&name,const QString&driver,
  8762. const QModelIndex&parent)
  8763. {
  8764. QString referenceID= QUuid::createUuid().toString();
  8765. /*666:*/
  8766. #line 14378 "./typica.w"
  8767. DeviceTreeModelNode*parentItem;
  8768. if(!parent.isValid())
  8769. {
  8770. parentItem= root;
  8771. }
  8772. else
  8773. {
  8774. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  8775. }
  8776. /*:666*/
  8777. #line 14505 "./typica.w"
  8778. QDomNode parentNode= parentItem->node();
  8779. int newRowNumber= rowCount(parent);
  8780. beginInsertRows(parent,newRowNumber,newRowNumber);
  8781. QDomElement deviceElement= document.createElement("node");
  8782. deviceElement.setAttribute("name",name);
  8783. deviceElement.setAttribute("reference",referenceID);
  8784. parentNode.appendChild(deviceElement);
  8785. QDomElement referenceElement= document.createElement("reference");
  8786. referenceElement.setAttribute("id",referenceID);
  8787. referenceElement.setAttribute("driver",driver);
  8788. referenceSection.appendChild(referenceElement);
  8789. endInsertRows();
  8790. }
  8791. /*:672*//*673:*/
  8792. #line 14523 "./typica.w"
  8793. bool DeviceTreeModel::removeRows(int row,int count,const QModelIndex&parent)
  8794. {
  8795. /*666:*/
  8796. #line 14378 "./typica.w"
  8797. DeviceTreeModelNode*parentItem;
  8798. if(!parent.isValid())
  8799. {
  8800. parentItem= root;
  8801. }
  8802. else
  8803. {
  8804. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  8805. }
  8806. /*:666*/
  8807. #line 14526 "./typica.w"
  8808. QDomNode parentNode= parentItem->node();
  8809. QDomNodeList childNodes= parentNode.childNodes();
  8810. if(childNodes.size()<row+count)
  8811. {
  8812. return false;
  8813. }
  8814. beginRemoveRows(parent,row,row+count-1);
  8815. QList<QDomElement> removalList;
  8816. for(int i= row;i<row+count;i++)
  8817. {
  8818. removalList.append(childNodes.at(i).toElement());
  8819. }
  8820. QDomElement element;
  8821. QDomElement reference;
  8822. for(int i= 0;i<count;i++)
  8823. {
  8824. element= removalList.at(i);
  8825. if(element.hasAttribute("reference"))
  8826. {
  8827. reference= referenceElement(element.attribute("reference"));
  8828. if(!reference.isNull())
  8829. {
  8830. referenceSection.removeChild(reference);
  8831. }
  8832. }
  8833. parentNode.removeChild(element);
  8834. }
  8835. endRemoveRows();
  8836. beginResetModel();
  8837. delete root;
  8838. root= new DeviceTreeModelNode(treeRoot,0);
  8839. endResetModel();
  8840. return true;
  8841. }
  8842. /*:673*//*674:*/
  8843. #line 14565 "./typica.w"
  8844. QDomElement DeviceTreeModel::referenceElement(const QString&id)
  8845. {
  8846. QDomNodeList childNodes= referenceSection.childNodes();
  8847. QDomElement element;
  8848. for(int i= 0;i<childNodes.size();i++)
  8849. {
  8850. element= childNodes.at(i).toElement();
  8851. if(element.hasAttribute("id"))
  8852. {
  8853. if(element.attribute("id")==id)
  8854. {
  8855. return element;
  8856. }
  8857. }
  8858. }
  8859. return QDomElement();
  8860. }
  8861. /*:674*//*675:*/
  8862. #line 14586 "./typica.w"
  8863. QVariant DeviceTreeModel::headerData(int,Qt::Orientation,int)const
  8864. {
  8865. return QVariant();
  8866. }
  8867. /*:675*//*676:*/
  8868. #line 14595 "./typica.w"
  8869. DeviceTreeModel::~DeviceTreeModel()
  8870. {
  8871. delete root;
  8872. }
  8873. /*:676*/
  8874. #line 580 "./typica.w"
  8875. /*703:*/
  8876. #line 15094 "./typica.w"
  8877. BasicDeviceConfigurationWidget::BasicDeviceConfigurationWidget(
  8878. DeviceTreeModel*model,const QModelIndex&index)
  8879. :QWidget(NULL),deviceModel(model),currentNode(index)
  8880. {
  8881. }
  8882. /*:703*//*704:*/
  8883. #line 15106 "./typica.w"
  8884. void BasicDeviceConfigurationWidget::updateAttribute(const QString&name,
  8885. const QString&value)
  8886. {
  8887. QDomElement referenceElement= deviceModel->referenceElement(
  8888. deviceModel->data(currentNode,Qt::UserRole).toString());
  8889. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8890. QDomElement node;
  8891. bool found= false;
  8892. for(int i= 0;i<configData.size();i++)
  8893. {
  8894. node= configData.at(i).toElement();
  8895. if(node.attribute("name")==name)
  8896. {
  8897. node.setAttribute("value",value);
  8898. found= true;
  8899. break;
  8900. }
  8901. }
  8902. if(!found)
  8903. {
  8904. node= AppInstance->deviceConfiguration().createElement("attribute");
  8905. node.setAttribute("name",name);
  8906. node.setAttribute("value",value);
  8907. referenceElement.appendChild(node);
  8908. }
  8909. AppInstance->saveDeviceConfiguration();
  8910. }
  8911. /*:704*//*705:*/
  8912. #line 15140 "./typica.w"
  8913. void BasicDeviceConfigurationWidget::insertChildNode(const QString&name,
  8914. const QString&driver)
  8915. {
  8916. deviceModel->newNode(name,driver,currentNode);
  8917. }
  8918. /*:705*/
  8919. #line 581 "./typica.w"
  8920. /*694:*/
  8921. #line 14939 "./typica.w"
  8922. DeviceConfigurationWindow::DeviceConfigurationWindow():QWidget(NULL),
  8923. view(new QTreeView),configArea(new QScrollArea)
  8924. {
  8925. QSplitter*splitter= new QSplitter;
  8926. QWidget*leftWidget= new QWidget;
  8927. leftWidget->setMinimumWidth(200);
  8928. QVBoxLayout*left= new QVBoxLayout;
  8929. view->setAnimated(true);
  8930. view->setSelectionMode(QAbstractItemView::SingleSelection);
  8931. document= AppInstance->deviceConfiguration();
  8932. model= new DeviceTreeModel;
  8933. view->setModel(model);
  8934. view->setTextElideMode(Qt::ElideNone);
  8935. view->expandAll();
  8936. view->resizeColumnToContents(0);
  8937. connect(model,SIGNAL(modelReset()),view,SLOT(expandAll()));
  8938. QHBoxLayout*treeButtons= new QHBoxLayout;
  8939. QToolButton*addDeviceButton= new QToolButton;
  8940. addDeviceButton->setIcon(QIcon::fromTheme("list-add"));
  8941. addDeviceButton->setToolTip(tr("New Roaster"));
  8942. connect(addDeviceButton,SIGNAL(clicked()),
  8943. this,SLOT(addDevice()));
  8944. QToolButton*removeNodeButton= new QToolButton;
  8945. removeNodeButton->setIcon(QIcon::fromTheme("list-remove"));
  8946. removeNodeButton->setToolTip(tr("Delete Selection"));
  8947. connect(removeNodeButton,SIGNAL(clicked()),this,SLOT(removeNode()));
  8948. treeButtons->addWidget(addDeviceButton);
  8949. treeButtons->addWidget(removeNodeButton);
  8950. left->addWidget(view);
  8951. left->addLayout(treeButtons);
  8952. leftWidget->setLayout(left);
  8953. splitter->addWidget(leftWidget);
  8954. configArea->setMinimumWidth(580);
  8955. configArea->setMinimumHeight(460);
  8956. splitter->addWidget(configArea);
  8957. QVBoxLayout*centralLayout= new QVBoxLayout;
  8958. centralLayout->addWidget(splitter);
  8959. setLayout(centralLayout);
  8960. connect(view,SIGNAL(activated(QModelIndex)),
  8961. this,SLOT(newSelection(QModelIndex)));
  8962. connect(view,SIGNAL(clicked(QModelIndex)),
  8963. this,SLOT(newSelection(QModelIndex)));
  8964. connect(model,SIGNAL(rowsInserted(QModelIndex,int,int)),
  8965. view,SLOT(expand(QModelIndex)));
  8966. connect(model,SIGNAL(rowsInserted(QModelIndex,int,int)),
  8967. this,SLOT(resizeColumn()));
  8968. connect(model,SIGNAL(rowsRemoved(QModelIndex,int,int)),
  8969. this,SLOT(resizeColumn()));
  8970. }
  8971. /*:694*//*695:*/
  8972. #line 14993 "./typica.w"
  8973. void DeviceConfigurationWindow::addDevice()
  8974. {
  8975. model->newNode(tr("New Roaster"),"roaster",QModelIndex());
  8976. }
  8977. /*:695*//*696:*/
  8978. #line 15001 "./typica.w"
  8979. void DeviceConfigurationWindow::removeNode()
  8980. {
  8981. QModelIndex index= view->currentIndex();
  8982. if(index.isValid())
  8983. {
  8984. int row= index.row();
  8985. QModelIndex parent= index.parent();
  8986. model->removeRow(row,parent);
  8987. }
  8988. }
  8989. /*:696*//*697:*/
  8990. #line 15017 "./typica.w"
  8991. void DeviceConfigurationWindow::newSelection(const QModelIndex&index)
  8992. {
  8993. QWidget*editor= AppInstance->deviceConfigurationWidget(model,index);
  8994. if(editor)
  8995. {
  8996. configArea->setWidget(editor);
  8997. editor->show();
  8998. }
  8999. }
  9000. /*:697*//*698:*/
  9001. #line 15034 "./typica.w"
  9002. void DeviceConfigurationWindow::resizeColumn()
  9003. {
  9004. view->resizeColumnToContents(0);
  9005. }
  9006. /*:698*/
  9007. #line 582 "./typica.w"
  9008. /*718:*/
  9009. #line 15445 "./typica.w"
  9010. Ni9211TcConfWidget::Ni9211TcConfWidget(DeviceTreeModel*model,
  9011. const QModelIndex&index):
  9012. BasicDeviceConfigurationWidget(model,index)
  9013. {
  9014. QFormLayout*layout= new QFormLayout;
  9015. QLineEdit*columnName= new QLineEdit;
  9016. layout->addRow(tr("Column Name:"),columnName);
  9017. QComboBox*typeSelector= new QComboBox;
  9018. typeSelector->addItem("J");
  9019. typeSelector->addItem("K");
  9020. typeSelector->addItem("T");
  9021. typeSelector->addItem("B");
  9022. typeSelector->addItem("E");
  9023. typeSelector->addItem("N");
  9024. typeSelector->addItem("R");
  9025. typeSelector->addItem("S");
  9026. layout->addRow(tr("Thermocouple Type:"),typeSelector);
  9027. QCheckBox*hideSeries= new QCheckBox("Hide this channel");
  9028. layout->addRow(hideSeries);
  9029. setLayout(layout);
  9030. /*708:*/
  9031. #line 15254 "./typica.w"
  9032. QDomElement referenceElement=
  9033. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9034. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9035. QDomElement node;
  9036. /*:708*/
  9037. #line 15466 "./typica.w"
  9038. for(int i= 0;i<configData.size();i++)
  9039. {
  9040. node= configData.at(i).toElement();
  9041. if(node.attribute("name")=="type")
  9042. {
  9043. typeSelector->setCurrentIndex(
  9044. typeSelector->findText(node.attribute("value")));
  9045. }
  9046. else if(node.attribute("name")=="columnname")
  9047. {
  9048. columnName->setText(node.attribute("value"));
  9049. }
  9050. else if(node.attribute("name")=="hidden")
  9051. {
  9052. hideSeries->setChecked(node.attribute("value")=="true");
  9053. }
  9054. }
  9055. updateThermocoupleType(typeSelector->currentText());
  9056. updateColumnName(columnName->text());
  9057. updateHidden(hideSeries->isChecked());
  9058. connect(typeSelector,SIGNAL(currentIndexChanged(QString)),
  9059. this,SLOT(updateThermocoupleType(QString)));
  9060. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  9061. connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  9062. }
  9063. /*:718*//*719:*/
  9064. #line 15496 "./typica.w"
  9065. void Ni9211TcConfWidget::updateThermocoupleType(const QString&type)
  9066. {
  9067. updateAttribute("type",type);
  9068. }
  9069. void Ni9211TcConfWidget::updateColumnName(const QString&name)
  9070. {
  9071. updateAttribute("columnname",name);
  9072. }
  9073. void Ni9211TcConfWidget::updateHidden(bool hidden)
  9074. {
  9075. updateAttribute("hidden",hidden?"true":"false");
  9076. }
  9077. /*:719*/
  9078. #line 583 "./typica.w"
  9079. /*714:*/
  9080. #line 15359 "./typica.w"
  9081. NiDaqMxBase9211ConfWidget::NiDaqMxBase9211ConfWidget(DeviceTreeModel*model,
  9082. const QModelIndex&index)
  9083. :BasicDeviceConfigurationWidget(model,index)
  9084. {
  9085. QVBoxLayout*layout= new QVBoxLayout;
  9086. QHBoxLayout*deviceIdLayout= new QHBoxLayout;
  9087. QLabel*label= new QLabel(tr("Device ID:"));
  9088. QLineEdit*deviceId= new QLineEdit;
  9089. deviceIdLayout->addWidget(label);
  9090. deviceIdLayout->addWidget(deviceId);
  9091. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  9092. layout->addLayout(deviceIdLayout);
  9093. layout->addWidget(addChannelButton);
  9094. /*708:*/
  9095. #line 15254 "./typica.w"
  9096. QDomElement referenceElement=
  9097. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9098. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9099. QDomElement node;
  9100. /*:708*/
  9101. #line 15373 "./typica.w"
  9102. for(int i= 0;i<configData.size();i++)
  9103. {
  9104. node= configData.at(i).toElement();
  9105. if(node.attribute("name")=="deviceID")
  9106. {
  9107. deviceId->setText(node.attribute("value","Dev1"));
  9108. break;
  9109. }
  9110. }
  9111. updateDeviceId(deviceId->text());
  9112. connect(addChannelButton,SIGNAL(clicked()),
  9113. this,SLOT(addChannel()));
  9114. connect(deviceId,SIGNAL(textEdited(QString)),
  9115. this,SLOT(updateDeviceId(QString)));
  9116. setLayout(layout);
  9117. }
  9118. /*:714*//*715:*/
  9119. #line 15395 "./typica.w"
  9120. void NiDaqMxBase9211ConfWidget::updateDeviceId(const QString&newId)
  9121. {
  9122. updateAttribute("deviceID",newId);
  9123. }
  9124. /*:715*//*716:*/
  9125. #line 15403 "./typica.w"
  9126. void NiDaqMxBase9211ConfWidget::addChannel()
  9127. {
  9128. insertChildNode(tr("Thermocouple channel"),"ni9211seriestc");
  9129. }
  9130. /*:716*/
  9131. #line 584 "./typica.w"
  9132. /*712:*/
  9133. #line 15310 "./typica.w"
  9134. NiDaqMxBaseDriverConfWidget::NiDaqMxBaseDriverConfWidget(
  9135. DeviceTreeModel*model,const QModelIndex&index):
  9136. BasicDeviceConfigurationWidget(model,index)
  9137. {
  9138. QHBoxLayout*layout= new QHBoxLayout;
  9139. QToolButton*addDeviceButton= new QToolButton;
  9140. addDeviceButton->setText(tr("Add Device"));
  9141. NodeInserter*add9211= new NodeInserter("NI USB 9211","NI USB 9211",
  9142. "nidaqmxbase9211series");
  9143. NodeInserter*add9211a= new NodeInserter("NI USB 9211A","NI USB 9211A",
  9144. "nidaqmxbase9211series");
  9145. connect(add9211,SIGNAL(triggered(QString,QString)),
  9146. this,SLOT(insertChildNode(QString,QString)));
  9147. connect(add9211a,SIGNAL(triggered(QString,QString)),
  9148. this,SLOT(insertChildNode(QString,QString)));
  9149. QMenu*deviceMenu= new QMenu;
  9150. deviceMenu->addAction(add9211);
  9151. deviceMenu->addAction(add9211a);
  9152. addDeviceButton->setMenu(deviceMenu);
  9153. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  9154. layout->addWidget(addDeviceButton);
  9155. setLayout(layout);
  9156. }
  9157. /*:712*/
  9158. #line 585 "./typica.w"
  9159. /*579:*/
  9160. #line 12857 "./typica.w"
  9161. ReportAction::ReportAction(const QString&fileName,const QString&reportName,
  9162. QObject*parent):
  9163. QAction(reportName,parent),reportFile(fileName)
  9164. {
  9165. connect(this,SIGNAL(triggered()),this,SLOT(createReport()));
  9166. }
  9167. /*:579*//*580:*/
  9168. #line 12873 "./typica.w"
  9169. void ReportAction::createReport()
  9170. {
  9171. QFile file(reportFile);
  9172. QDomDocument document;
  9173. if(file.open(QIODevice::ReadOnly))
  9174. {
  9175. document.setContent(&file,true);
  9176. QDomElement element= document.documentElement();
  9177. QScriptEngine*engine= AppInstance->engine;
  9178. QScriptContext*context= engine->pushContext();
  9179. QScriptValue object;
  9180. QString targetID= reportFile;
  9181. /*157:*/
  9182. #line 3806 "./typica.w"
  9183. ScriptQMainWindow*window= new ScriptQMainWindow;
  9184. window->setObjectName(targetID);
  9185. object= engine->newQObject(window);
  9186. setQMainWindowProperties(object,engine);
  9187. QWidget*central= new(QWidget);
  9188. central->setParent(window);
  9189. central->setObjectName("centralWidget");
  9190. window->setCentralWidget(central);
  9191. if(element.hasChildNodes())
  9192. {
  9193. /*158:*/
  9194. #line 3841 "./typica.w"
  9195. QStack<QWidget*> widgetStack;
  9196. QStack<QLayout*> layoutStack;
  9197. QString windowScript;
  9198. widgetStack.push(central);
  9199. QDomNodeList windowChildren= element.childNodes();
  9200. int i= 0;
  9201. while(i<windowChildren.count())
  9202. {
  9203. QDomNode current;
  9204. QDomElement element;
  9205. current= windowChildren.at(i);
  9206. if(current.isElement())
  9207. {
  9208. element= current.toElement();
  9209. if(element.tagName()=="program")
  9210. {
  9211. windowScript.append(element.text());
  9212. }
  9213. else if(element.tagName()=="layout")
  9214. {
  9215. addLayoutToWidget(element,&widgetStack,&layoutStack);
  9216. }
  9217. else if(element.tagName()=="menu")
  9218. {
  9219. /*159:*/
  9220. #line 3888 "./typica.w"
  9221. QMenuBar*bar= window->menuBar();
  9222. bar->setParent(window);
  9223. bar->setObjectName("menuBar");
  9224. if(element.hasAttribute("name"))
  9225. {
  9226. QMenu*menu= bar->addMenu(element.attribute("name"));
  9227. menu->setParent(bar);
  9228. if(element.hasAttribute("type"))
  9229. {
  9230. if(element.attribute("type")=="reports")
  9231. {
  9232. if(element.hasAttribute("src"))
  9233. {
  9234. /*577:*/
  9235. #line 12817 "./typica.w"
  9236. QSettings settings;
  9237. QString reportDirectory= QString("%1/%2").arg(settings.value("config").
  9238. toString()).
  9239. arg(element.attribute("src"));
  9240. QDir::addSearchPath("reports",reportDirectory);
  9241. QDir directory(reportDirectory);
  9242. directory.setFilter(QDir::Files);
  9243. directory.setSorting(QDir::Name);
  9244. QStringList nameFilter;
  9245. nameFilter<<"*.xml";
  9246. directory.setNameFilters(nameFilter);
  9247. QFileInfoList reportFiles= directory.entryInfoList();
  9248. for(int i= 0;i<reportFiles.size();i++)
  9249. {
  9250. QFileInfo reportFile= reportFiles.at(i);
  9251. /*581:*/
  9252. #line 12897 "./typica.w"
  9253. QString path= reportFile.absoluteFilePath();
  9254. QFile file(path);
  9255. if(file.open(QIODevice::ReadOnly))
  9256. {
  9257. QDomDocument document;
  9258. document.setContent(&file,true);
  9259. QDomElement root= document.documentElement();
  9260. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  9261. if(!titleNode.isNull())
  9262. {
  9263. QDomElement titleElement= titleNode.toElement();
  9264. QString title= titleElement.text();
  9265. if(!title.isEmpty())
  9266. {
  9267. QStringList hierarchy= title.split(":->");
  9268. QMenu*insertionPoint= menu;
  9269. /*582:*/
  9270. #line 12924 "./typica.w"
  9271. for(int j= 0;j<hierarchy.size()-1;j++)
  9272. {
  9273. QObjectList menuList= insertionPoint->children();
  9274. bool menuFound= false;
  9275. for(int k= 0;k<menuList.size();k++)
  9276. {
  9277. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  9278. if(currentItem)
  9279. {
  9280. if(currentItem->title()==hierarchy.at(j))
  9281. {
  9282. menuFound= true;
  9283. insertionPoint= currentItem;
  9284. break;
  9285. }
  9286. }
  9287. }
  9288. if(!menuFound)
  9289. {
  9290. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  9291. }
  9292. }
  9293. /*:582*/
  9294. #line 12914 "./typica.w"
  9295. ReportAction*action= new ReportAction(path,hierarchy.last());
  9296. insertionPoint->addAction(action);
  9297. }
  9298. }
  9299. }
  9300. /*:581*/
  9301. #line 12833 "./typica.w"
  9302. }
  9303. /*:577*/
  9304. #line 3902 "./typica.w"
  9305. }
  9306. }
  9307. }
  9308. if(element.hasChildNodes())
  9309. {
  9310. /*160:*/
  9311. #line 3915 "./typica.w"
  9312. QDomNodeList menuItems= element.childNodes();
  9313. int j= 0;
  9314. while(j<menuItems.count())
  9315. {
  9316. QDomNode item= menuItems.at(j);
  9317. if(item.isElement())
  9318. {
  9319. QDomElement itemElement= item.toElement();
  9320. if(itemElement.tagName()=="item")
  9321. {
  9322. QAction*itemAction= new QAction(itemElement.text(),menu);
  9323. if(itemElement.hasAttribute("id"))
  9324. {
  9325. itemAction->setObjectName(itemElement.attribute("id"));
  9326. }
  9327. if(itemElement.hasAttribute("shortcut"))
  9328. {
  9329. itemAction->setShortcut(itemElement.attribute("shortcut"));
  9330. }
  9331. menu->addAction(itemAction);
  9332. }
  9333. else if(itemElement.tagName()=="separator")
  9334. {
  9335. menu->addSeparator();
  9336. }
  9337. }
  9338. j++;
  9339. }
  9340. #line 1 "./helpmenu.w"
  9341. /*:160*/
  9342. #line 3908 "./typica.w"
  9343. }
  9344. }
  9345. /*:159*/
  9346. #line 3866 "./typica.w"
  9347. }
  9348. }
  9349. i++;
  9350. }
  9351. QScriptValue oldThis= context->thisObject();
  9352. context->setThisObject(object);
  9353. QScriptValue result= engine->evaluate(windowScript);
  9354. /*151:*/
  9355. #line 3623 "./typica.w"
  9356. if(engine->hasUncaughtException())
  9357. {
  9358. int line= engine->uncaughtExceptionLineNumber();
  9359. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  9360. result.toString();
  9361. QString trace;
  9362. foreach(trace,engine->uncaughtExceptionBacktrace())
  9363. {
  9364. qDebug()<<trace;
  9365. }
  9366. }
  9367. /*:151*/
  9368. #line 3874 "./typica.w"
  9369. context->setThisObject(oldThis);
  9370. /*:158*/
  9371. #line 3817 "./typica.w"
  9372. }
  9373. /*161:*/
  9374. #line 9 "./helpmenu.w"
  9375. HelpMenu*helpMenu= new HelpMenu();
  9376. window->menuBar()->addMenu(helpMenu);
  9377. /*:161*/
  9378. #line 3819 "./typica.w"
  9379. window->show();
  9380. /*:157*/
  9381. #line 12886 "./typica.w"
  9382. file.close();
  9383. engine->popContext();
  9384. }
  9385. }
  9386. /*:580*/
  9387. #line 586 "./typica.w"
  9388. /*193:*/
  9389. #line 4981 "./typica.w"
  9390. NumericDelegate::NumericDelegate(QObject*parent):
  9391. QItemDelegate(parent)
  9392. {
  9393. }
  9394. /*:193*//*194:*/
  9395. #line 4993 "./typica.w"
  9396. void NumericDelegate::setEditorData(QWidget*editor,
  9397. const QModelIndex&index)const
  9398. {
  9399. QString value= index.model()->data(index,Qt::EditRole).toString();
  9400. QLineEdit*line= static_cast<QLineEdit*> (editor);
  9401. line->setText(value);
  9402. }
  9403. /*:194*//*195:*/
  9404. #line 5008 "./typica.w"
  9405. void NumericDelegate::setModelData(QWidget*editor,QAbstractItemModel*model,
  9406. const QModelIndex&index)const
  9407. {
  9408. QLineEdit*line= static_cast<QLineEdit*> (editor);
  9409. model->setData(index,line->text(),Qt::EditRole);
  9410. QScriptEngine*engine= AppInstance->engine;
  9411. engine->pushContext();
  9412. QString script= QString("Number(%1)").arg(line->text());
  9413. QScriptValue result= engine->evaluate(line->text());
  9414. if(result.isNumber())
  9415. {
  9416. model->setData(index,result.toVariant(),Qt::DisplayRole);
  9417. }
  9418. else
  9419. {
  9420. model->setData(index,QVariant(),Qt::DisplayRole);
  9421. }
  9422. engine->popContext();
  9423. }
  9424. /*:195*//*196:*/
  9425. #line 5031 "./typica.w"
  9426. QWidget*NumericDelegate::createEditor(QWidget*parent,
  9427. const QStyleOptionViewItem&,
  9428. const QModelIndex&)const
  9429. {
  9430. return(new QLineEdit(parent));
  9431. }
  9432. /*:196*//*197:*/
  9433. #line 5042 "./typica.w"
  9434. void NumericDelegate::updateEditorGeometry(QWidget*editor,
  9435. const QStyleOptionViewItem&option,
  9436. const QModelIndex&)const
  9437. {
  9438. editor->setGeometry(option.rect);
  9439. }
  9440. /*:197*/
  9441. #line 587 "./typica.w"
  9442. /*723:*/
  9443. #line 15555 "./typica.w"
  9444. NiDaqMxDriverConfWidget::NiDaqMxDriverConfWidget(DeviceTreeModel*model,
  9445. const QModelIndex&index)
  9446. :BasicDeviceConfigurationWidget(model,index)
  9447. {
  9448. QHBoxLayout*layout= new QHBoxLayout;
  9449. QToolButton*addDeviceButton= new QToolButton;
  9450. addDeviceButton->setText(tr("Add Device"));
  9451. NodeInserter*add9211a= new NodeInserter("NI USB 9211A","NI USB 9211A",
  9452. "nidaqmx9211series");
  9453. NodeInserter*addtc01= new NodeInserter("NI USB TC01","NI USB TC01",
  9454. "nidaqmxtc01");
  9455. connect(add9211a,SIGNAL(triggered(QString,QString)),
  9456. this,SLOT(insertChildNode(QString,QString)));
  9457. connect(addtc01,SIGNAL(triggered(QString,QString)),
  9458. this,SLOT(insertChildNode(QString,QString)));
  9459. QMenu*deviceMenu= new QMenu;
  9460. deviceMenu->addAction(add9211a);
  9461. deviceMenu->addAction(addtc01);
  9462. addDeviceButton->setMenu(deviceMenu);
  9463. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  9464. layout->addWidget(addDeviceButton);
  9465. setLayout(layout);
  9466. }
  9467. /*:723*/
  9468. #line 588 "./typica.w"
  9469. /*725:*/
  9470. #line 15604 "./typica.w"
  9471. NiDaqMx9211ConfWidget::NiDaqMx9211ConfWidget(DeviceTreeModel*model,
  9472. const QModelIndex&index)
  9473. :BasicDeviceConfigurationWidget(model,index)
  9474. {
  9475. QVBoxLayout*layout= new QVBoxLayout;
  9476. QHBoxLayout*deviceIdLayout= new QHBoxLayout;
  9477. QLabel*label= new QLabel(tr("Device ID:"));
  9478. QLineEdit*deviceId= new QLineEdit;
  9479. deviceIdLayout->addWidget(label);
  9480. deviceIdLayout->addWidget(deviceId);
  9481. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  9482. layout->addLayout(deviceIdLayout);
  9483. layout->addWidget(addChannelButton);
  9484. /*708:*/
  9485. #line 15254 "./typica.w"
  9486. QDomElement referenceElement=
  9487. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9488. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9489. QDomElement node;
  9490. /*:708*/
  9491. #line 15618 "./typica.w"
  9492. for(int i= 0;i<configData.size();i++)
  9493. {
  9494. node= configData.at(i).toElement();
  9495. if(node.attribute("name")=="deviceID")
  9496. {
  9497. deviceId->setText(node.attribute("value","Dev1"));
  9498. break;
  9499. }
  9500. }
  9501. updateDeviceId(deviceId->text());
  9502. connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
  9503. connect(deviceId,SIGNAL(textEdited(QString)),
  9504. this,SLOT(updateDeviceId(QString)));
  9505. setLayout(layout);
  9506. }
  9507. void NiDaqMx9211ConfWidget::updateDeviceId(const QString&newId)
  9508. {
  9509. updateAttribute("deviceID",newId);
  9510. }
  9511. void NiDaqMx9211ConfWidget::addChannel()
  9512. {
  9513. insertChildNode(tr("Thermocouple channel"),"ni9211seriestc");
  9514. }
  9515. /*:725*/
  9516. #line 589 "./typica.w"
  9517. /*727:*/
  9518. #line 15669 "./typica.w"
  9519. NiDaqMxTc01ConfWidget::NiDaqMxTc01ConfWidget(DeviceTreeModel*model,
  9520. const QModelIndex&index)
  9521. :BasicDeviceConfigurationWidget(model,index)
  9522. {
  9523. QFormLayout*layout= new QFormLayout;
  9524. QLineEdit*deviceId= new QLineEdit;
  9525. layout->addRow(tr("Device ID:"),deviceId);
  9526. QLineEdit*columnName= new QLineEdit;
  9527. layout->addRow(tr("Column Name:"),columnName);
  9528. QComboBox*typeSelector= new QComboBox;
  9529. typeSelector->addItem("J");
  9530. typeSelector->addItem("K");
  9531. typeSelector->addItem("T");
  9532. typeSelector->addItem("B");
  9533. typeSelector->addItem("E");
  9534. typeSelector->addItem("N");
  9535. typeSelector->addItem("R");
  9536. typeSelector->addItem("S");
  9537. layout->addRow(tr("Thermocouple Type:"),typeSelector);
  9538. QCheckBox*hideSeries= new QCheckBox(tr("Hide this channel"));
  9539. layout->addRow(hideSeries);
  9540. /*708:*/
  9541. #line 15254 "./typica.w"
  9542. QDomElement referenceElement=
  9543. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9544. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9545. QDomElement node;
  9546. /*:708*/
  9547. #line 15691 "./typica.w"
  9548. for(int i= 0;i<configData.size();i++)
  9549. {
  9550. node= configData.at(i).toElement();
  9551. if(node.attribute("name")=="deviceID")
  9552. {
  9553. deviceId->setText(node.attribute("value"));
  9554. }
  9555. else if(node.attribute("name")=="type")
  9556. {
  9557. typeSelector->setCurrentIndex(typeSelector->findText(node.attribute("value")));
  9558. }
  9559. else if(node.attribute("name")=="columnname")
  9560. {
  9561. columnName->setText(node.attribute("value"));
  9562. }
  9563. else if(node.attribute("name")=="hidden")
  9564. {
  9565. hideSeries->setChecked(node.attribute("value")=="true");
  9566. }
  9567. }
  9568. updateDeviceId(deviceId->text());
  9569. updateThermocoupleType(typeSelector->currentText());
  9570. updateColumnName(columnName->text());
  9571. updateHidden(hideSeries->isChecked());
  9572. connect(deviceId,SIGNAL(textEdited(QString)),this,SLOT(updateDeviceId(QString)));
  9573. connect(typeSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateThermocoupleType(QString)));
  9574. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  9575. setLayout(layout);
  9576. connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  9577. }
  9578. void NiDaqMxTc01ConfWidget::updateDeviceId(const QString&newId)
  9579. {
  9580. updateAttribute("deviceID",newId);
  9581. }
  9582. void NiDaqMxTc01ConfWidget::updateThermocoupleType(const QString&type)
  9583. {
  9584. updateAttribute("type",type);
  9585. }
  9586. void NiDaqMxTc01ConfWidget::updateColumnName(const QString&name)
  9587. {
  9588. updateAttribute("columnname",name);
  9589. }
  9590. void NiDaqMxTc01ConfWidget::updateHidden(bool hidden)
  9591. {
  9592. updateAttribute("hidden",hidden?"true":"false");
  9593. }
  9594. /*:727*/
  9595. #line 590 "./typica.w"
  9596. /*745:*/
  9597. #line 16107 "./typica.w"
  9598. ModbusRtuPortConfWidget::ModbusRtuPortConfWidget(DeviceTreeModel*model,
  9599. const QModelIndex&index)
  9600. :BasicDeviceConfigurationWidget(model,index)
  9601. {
  9602. QFormLayout*layout= new QFormLayout;
  9603. QToolButton*addDeviceButton= new QToolButton;
  9604. addDeviceButton->setText(tr("Add Device"));
  9605. NodeInserter*addModbusRtuDevice= new NodeInserter("Modbus RTU Device",
  9606. "Modbus RTU Device",
  9607. "modbusrtudevice");
  9608. connect(addModbusRtuDevice,SIGNAL(triggered(QString,QString)),
  9609. this,SLOT(insertChildNode(QString,QString)));
  9610. QMenu*deviceMenu= new QMenu;
  9611. deviceMenu->addAction(addModbusRtuDevice);
  9612. addDeviceButton->setMenu(deviceMenu);
  9613. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  9614. layout->addRow(QString(),addDeviceButton);
  9615. PortSelector*port= new PortSelector;
  9616. layout->addRow(tr("Port:"),port);
  9617. connect(port,SIGNAL(currentIndexChanged(QString)),
  9618. this,SLOT(updatePort(QString)));
  9619. connect(port,SIGNAL(editTextChanged(QString)),
  9620. this,SLOT(updatePort(QString)));
  9621. BaudSelector*rate= new BaudSelector;
  9622. layout->addRow(tr("Baud:"),rate);
  9623. connect(rate,SIGNAL(currentIndexChanged(QString)),
  9624. this,SLOT(updateBaudRate(QString)));
  9625. ParitySelector*parity= new ParitySelector;
  9626. layout->addRow(tr("Parity:"),parity);
  9627. connect(parity,SIGNAL(currentIndexChanged(QString)),
  9628. this,SLOT(updateParity(QString)));
  9629. FlowSelector*flow= new FlowSelector;
  9630. layout->addRow(tr("Flow Control:"),flow);
  9631. connect(flow,SIGNAL(currentIndexChanged(QString)),
  9632. this,SLOT(updateFlowControl(QString)));
  9633. StopSelector*stop= new StopSelector;
  9634. layout->addRow(tr("Stop Bits:"),stop);
  9635. connect(stop,SIGNAL(currentIndexChanged(QString)),
  9636. this,SLOT(updateStopBits(QString)));
  9637. /*708:*/
  9638. #line 15254 "./typica.w"
  9639. QDomElement referenceElement=
  9640. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9641. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9642. QDomElement node;
  9643. /*:708*/
  9644. #line 16147 "./typica.w"
  9645. for(int i= 0;i<configData.size();i++)
  9646. {
  9647. node= configData.at(i).toElement();
  9648. if(node.attribute("name")=="port")
  9649. {
  9650. int j= port->findText(node.attribute("value"));
  9651. if(j>=0)
  9652. {
  9653. port->setCurrentIndex(j);
  9654. }
  9655. else
  9656. {
  9657. port->insertItem(0,node.attribute("value"));
  9658. port->setCurrentIndex(0);
  9659. }
  9660. }
  9661. else if(node.attribute("name")=="baudrate")
  9662. {
  9663. rate->setCurrentIndex(rate->findText(node.attribute("value")));
  9664. }
  9665. else if(node.attribute("name")=="parity")
  9666. {
  9667. parity->setCurrentIndex(parity->findText(node.attribute("value")));
  9668. }
  9669. else if(node.attribute("name")=="flowcontrol")
  9670. {
  9671. flow->setCurrentIndex(flow->findText(node.attribute("value")));
  9672. }
  9673. else if(node.attribute("name")=="stopbits")
  9674. {
  9675. stop->setCurrentIndex(stop->findText(node.attribute("value")));
  9676. }
  9677. }
  9678. updatePort(port->currentText());
  9679. updateBaudRate(rate->currentText());
  9680. updateParity(parity->currentText());
  9681. updateFlowControl(flow->currentText());
  9682. updateStopBits(stop->currentText());
  9683. setLayout(layout);
  9684. }
  9685. void ModbusRtuPortConfWidget::updatePort(const QString&newPort)
  9686. {
  9687. updateAttribute("port",newPort);
  9688. }
  9689. void ModbusRtuPortConfWidget::updateBaudRate(const QString&newRate)
  9690. {
  9691. updateAttribute("baudrate",newRate);
  9692. }
  9693. void ModbusRtuPortConfWidget::updateParity(const QString&newParity)
  9694. {
  9695. updateAttribute("parity",newParity);
  9696. }
  9697. void ModbusRtuPortConfWidget::updateFlowControl(const QString&newFlow)
  9698. {
  9699. updateAttribute("flowcontrol",newFlow);
  9700. }
  9701. void ModbusRtuPortConfWidget::updateStopBits(const QString&newStopBits)
  9702. {
  9703. updateAttribute("stopbits",newStopBits);
  9704. }
  9705. /*:745*/
  9706. #line 591 "./typica.w"
  9707. /*747:*/
  9708. #line 16270 "./typica.w"
  9709. ModbusRtuDeviceConfWidget::ModbusRtuDeviceConfWidget(DeviceTreeModel*model,
  9710. const QModelIndex&index)
  9711. :BasicDeviceConfigurationWidget(model,index),
  9712. unitSpecificationLayout(new QStackedLayout),
  9713. decimalSpecificationLayout(new QStackedLayout)
  9714. {
  9715. QVBoxLayout*layout= new QVBoxLayout;
  9716. QToolButton*addChannelButton= new QToolButton;
  9717. addChannelButton->setText(tr("Add Channel"));
  9718. NodeInserter*addTemperaturePV= new NodeInserter("Temperature Process Value",
  9719. "Temperature Process Value",
  9720. "modbustemperaturepv");
  9721. NodeInserter*addTemperatureSV= new NodeInserter("Temperature Set Value",
  9722. "Temperature Set Value",
  9723. "modbustemperaturesv");
  9724. connect(addTemperaturePV,SIGNAL(triggered(QString,QString)),
  9725. this,SLOT(insertChildNode(QString,QString)));
  9726. connect(addTemperatureSV,SIGNAL(triggered(QString,QString)),
  9727. this,SLOT(insertChildNode(QString,QString)));
  9728. QMenu*channelMenu= new QMenu;
  9729. channelMenu->addAction(addTemperaturePV);
  9730. channelMenu->addAction(addTemperatureSV);
  9731. addChannelButton->setMenu(channelMenu);
  9732. addChannelButton->setPopupMode(QToolButton::InstantPopup);
  9733. layout->addWidget(addChannelButton);
  9734. QHBoxLayout*stationLayout= new QHBoxLayout;
  9735. QLabel*stationLabel= new QLabel(tr("Station:"));
  9736. QSpinBox*stationNumber= new QSpinBox;
  9737. stationNumber->setMinimum(0);
  9738. stationNumber->setMaximum(255);
  9739. stationLayout->addWidget(stationLabel);
  9740. stationLayout->addWidget(stationNumber);
  9741. layout->addLayout(stationLayout);
  9742. QCheckBox*fixedUnit= new QCheckBox(tr("Fixed Temperature Unit"));
  9743. layout->addWidget(fixedUnit);
  9744. QWidget*fixedUnitPlaceholder= new QWidget(this);
  9745. QHBoxLayout*fixedUnitLayout= new QHBoxLayout;
  9746. QLabel*fixedUnitLabel= new QLabel(tr("Temperature Unit:"));
  9747. QComboBox*fixedUnitSelector= new QComboBox;
  9748. fixedUnitSelector->addItem("Fahrenheit");
  9749. fixedUnitSelector->addItem("Celsius");
  9750. fixedUnitLayout->addWidget(fixedUnitLabel);
  9751. fixedUnitLayout->addWidget(fixedUnitSelector);
  9752. fixedUnitPlaceholder->setLayout(fixedUnitLayout);
  9753. unitSpecificationLayout->addWidget(fixedUnitPlaceholder);
  9754. QWidget*queriedUnitPlaceholder= new QWidget(this);
  9755. QFormLayout*queriedUnitLayout= new QFormLayout;
  9756. ShortHexSpinBox*unitAddress= new ShortHexSpinBox;
  9757. queriedUnitLayout->addRow(tr("Function 0x03 Unit Address:"),unitAddress);
  9758. QSpinBox*valueF= new QSpinBox;
  9759. valueF->setMinimum(0);
  9760. valueF->setMaximum(65535);
  9761. queriedUnitLayout->addRow(tr("Value for Fahrenheit"),valueF);
  9762. QSpinBox*valueC= new QSpinBox;
  9763. valueC->setMinimum(0);
  9764. valueC->setMaximum(65535);
  9765. queriedUnitLayout->addRow(tr("Value for Celsius"),valueC);
  9766. queriedUnitPlaceholder->setLayout(queriedUnitLayout);
  9767. unitSpecificationLayout->addWidget(queriedUnitPlaceholder);
  9768. layout->addLayout(unitSpecificationLayout);
  9769. QCheckBox*fixedPrecision= new QCheckBox(tr("Fixed Precision"));
  9770. layout->addWidget(fixedPrecision);
  9771. QWidget*fixedPrecisionPlaceholder= new QWidget(this);
  9772. QFormLayout*fixedPrecisionLayout= new QFormLayout;
  9773. QSpinBox*fixedPrecisionValue= new QSpinBox;
  9774. fixedPrecisionValue->setMinimum(0);
  9775. fixedPrecisionValue->setMaximum(9);
  9776. fixedPrecisionLayout->addRow("Places after the decimal point:",
  9777. fixedPrecisionValue);
  9778. fixedPrecisionPlaceholder->setLayout(fixedPrecisionLayout);
  9779. decimalSpecificationLayout->addWidget(fixedPrecisionPlaceholder);
  9780. QWidget*queriedPrecisionPlaceholder= new QWidget(this);
  9781. QFormLayout*queriedPrecisionLayout= new QFormLayout;
  9782. ShortHexSpinBox*precisionAddress= new ShortHexSpinBox;
  9783. queriedPrecisionLayout->addRow("Function 0x03 Decimal Position Address:",
  9784. precisionAddress);
  9785. queriedPrecisionPlaceholder->setLayout(queriedPrecisionLayout);
  9786. decimalSpecificationLayout->addWidget(queriedPrecisionPlaceholder);
  9787. layout->addLayout(decimalSpecificationLayout);
  9788. /*708:*/
  9789. #line 15254 "./typica.w"
  9790. QDomElement referenceElement=
  9791. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9792. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9793. QDomElement node;
  9794. /*:708*/
  9795. #line 16350 "./typica.w"
  9796. for(int i= 0;i<configData.size();i++)
  9797. {
  9798. node= configData.at(i).toElement();
  9799. if(node.attribute("name")=="station")
  9800. {
  9801. stationNumber->setValue(node.attribute("value").toInt());
  9802. }
  9803. else if(node.attribute("name")=="fixedunit")
  9804. {
  9805. if(node.attribute("value")=="true")
  9806. {
  9807. fixedUnit->setCheckState(Qt::Checked);
  9808. }
  9809. else if(node.attribute("value")=="false")
  9810. {
  9811. fixedUnit->setCheckState(Qt::Unchecked);
  9812. }
  9813. }
  9814. else if(node.attribute("name")=="fixedprecision")
  9815. {
  9816. fixedPrecisionValue->setValue(node.attribute("value").toInt());
  9817. }
  9818. else if(node.attribute("name")=="unit")
  9819. {
  9820. fixedUnitSelector->setCurrentIndex(fixedUnitSelector->findText(node.attribute("value")));
  9821. }
  9822. else if(node.attribute("name")=="unitaddress")
  9823. {
  9824. unitAddress->setValue(node.attribute("value").toInt());
  9825. }
  9826. else if(node.attribute("name")=="fvalue")
  9827. {
  9828. valueF->setValue(node.attribute("value").toInt());
  9829. }
  9830. else if(node.attribute("name")=="cvalue")
  9831. {
  9832. valueC->setValue(node.attribute("value").toInt());
  9833. }
  9834. else if(node.attribute("name")=="precisionaddress")
  9835. {
  9836. precisionAddress->setValue(node.attribute("value").toInt());
  9837. }
  9838. else if(node.attribute("name")=="precision")
  9839. {
  9840. fixedPrecisionValue->setValue(node.attribute("value").toInt());
  9841. }
  9842. }
  9843. updateStationNumber(stationNumber->value());
  9844. updateFixedUnit(fixedUnit->isChecked());
  9845. updateFixedDecimal(fixedPrecision->isChecked());
  9846. updateUnit(fixedUnitSelector->currentText());
  9847. updateUnitAddress(unitAddress->value());
  9848. updateValueF(valueF->value());
  9849. updateValueC(valueC->value());
  9850. updatePrecisionAddress(precisionAddress->value());
  9851. updatePrecisionValue(fixedPrecisionValue->value());
  9852. connect(stationNumber,SIGNAL(valueChanged(int)),
  9853. this,SLOT(updateStationNumber(int)));
  9854. connect(fixedUnitSelector,SIGNAL(currentIndexChanged(QString)),
  9855. this,SLOT(updateUnit(QString)));
  9856. connect(unitAddress,SIGNAL(valueChanged(int)),
  9857. this,SLOT(updateUnitAddress(int)));
  9858. connect(valueF,SIGNAL(valueChanged(int)),
  9859. this,SLOT(updateValueF(int)));
  9860. connect(valueC,SIGNAL(valueChanged(int)),
  9861. this,SLOT(updateValueC(int)));
  9862. connect(fixedUnit,SIGNAL(toggled(bool)),
  9863. this,SLOT(updateFixedUnit(bool)));
  9864. connect(fixedPrecision,SIGNAL(toggled(bool)),
  9865. this,SLOT(updateFixedDecimal(bool)));
  9866. connect(fixedPrecisionValue,SIGNAL(valueChanged(int)),
  9867. this,SLOT(updatePrecisionValue(int)));
  9868. connect(precisionAddress,SIGNAL(valueChanged(int)),
  9869. this,SLOT(updatePrecisionAddress(int)));
  9870. setLayout(layout);
  9871. }
  9872. void ModbusRtuDeviceConfWidget::updateStationNumber(int newStation)
  9873. {
  9874. updateAttribute("station",QString("%1").arg(newStation));
  9875. }
  9876. void ModbusRtuDeviceConfWidget::updateFixedUnit(bool newFixed)
  9877. {
  9878. if(newFixed)
  9879. {
  9880. unitSpecificationLayout->setCurrentIndex(0);
  9881. updateAttribute("fixedunit","true");
  9882. }
  9883. else
  9884. {
  9885. unitSpecificationLayout->setCurrentIndex(1);
  9886. updateAttribute("fixedunit","false");
  9887. }
  9888. }
  9889. void ModbusRtuDeviceConfWidget::updateFixedDecimal(bool newFixed)
  9890. {
  9891. if(newFixed)
  9892. {
  9893. decimalSpecificationLayout->setCurrentIndex(0);
  9894. updateAttribute("fixedprecision","true");
  9895. }
  9896. else
  9897. {
  9898. decimalSpecificationLayout->setCurrentIndex(1);
  9899. updateAttribute("fixedprecision","false");
  9900. }
  9901. }
  9902. void ModbusRtuDeviceConfWidget::updateUnit(const QString&newUnit)
  9903. {
  9904. updateAttribute("unit",newUnit);
  9905. }
  9906. void ModbusRtuDeviceConfWidget::updateUnitAddress(int newAddress)
  9907. {
  9908. updateAttribute("unitaddress",QString("%1").arg(newAddress));
  9909. }
  9910. void ModbusRtuDeviceConfWidget::updateValueF(int newValue)
  9911. {
  9912. updateAttribute("fvalue",QString("%1").arg(newValue));
  9913. }
  9914. void ModbusRtuDeviceConfWidget::updateValueC(int newValue)
  9915. {
  9916. updateAttribute("cvalue",QString("%1").arg(newValue));
  9917. }
  9918. void ModbusRtuDeviceConfWidget::updatePrecisionAddress(int newAddress)
  9919. {
  9920. updateAttribute("precisionaddress",QString("%1").arg(newAddress));
  9921. }
  9922. void ModbusRtuDeviceConfWidget::updatePrecisionValue(int newValue)
  9923. {
  9924. updateAttribute("precision",QString("%1").arg(newValue));
  9925. }
  9926. /*:747*/
  9927. #line 592 "./typica.w"
  9928. /*749:*/
  9929. #line 16513 "./typica.w"
  9930. ModbusRtuDeviceTPvConfWidget::ModbusRtuDeviceTPvConfWidget(DeviceTreeModel*model,
  9931. const QModelIndex&index)
  9932. :BasicDeviceConfigurationWidget(model,index)
  9933. {
  9934. QFormLayout*layout= new QFormLayout;
  9935. ShortHexSpinBox*address= new ShortHexSpinBox;
  9936. layout->addRow(tr("Function 0x04 Process Value Address"),address);
  9937. /*708:*/
  9938. #line 15254 "./typica.w"
  9939. QDomElement referenceElement=
  9940. model->referenceElement(model->data(index,Qt::UserRole).toString());
  9941. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9942. QDomElement node;
  9943. /*:708*/
  9944. #line 16521 "./typica.w"
  9945. for(int i= 0;i<configData.size();i++)
  9946. {
  9947. node= configData.at(i).toElement();
  9948. if(node.attribute("name")=="address")
  9949. {
  9950. address->setValue(node.attribute("value").toInt());
  9951. break;
  9952. }
  9953. }
  9954. updateAddress(address->value());
  9955. connect(address,SIGNAL(valueChanged(int)),this,SLOT(updateAddress(int)));
  9956. setLayout(layout);
  9957. }
  9958. void ModbusRtuDeviceTPvConfWidget::updateAddress(int newAddress)
  9959. {
  9960. updateAttribute("address",QString("%1").arg(newAddress));
  9961. }
  9962. /*:749*/
  9963. #line 593 "./typica.w"
  9964. /*751:*/
  9965. #line 16569 "./typica.w"
  9966. ModbusRtuDeviceTSvConfWidget::ModbusRtuDeviceTSvConfWidget(DeviceTreeModel*model,
  9967. const QModelIndex&index)
  9968. :BasicDeviceConfigurationWidget(model,index),boundsLayout(new QStackedLayout)
  9969. {
  9970. QVBoxLayout*layout= new QVBoxLayout;
  9971. QFormLayout*addressLayout= new QFormLayout;
  9972. ShortHexSpinBox*readAddress= new ShortHexSpinBox;
  9973. ShortHexSpinBox*writeAddress= new ShortHexSpinBox;
  9974. addressLayout->addRow(tr("Function 0x04 Read Set Value Address:"),readAddress);
  9975. addressLayout->addRow(tr("Function 0x06 Write Set Value Address:"),writeAddress);
  9976. layout->addLayout(addressLayout);
  9977. QCheckBox*fixedRange= new QCheckBox(tr("Fixed Set Value Range"));
  9978. layout->addWidget(fixedRange);
  9979. QWidget*queriedRangePlaceholder= new QWidget(this);
  9980. QFormLayout*queriedRangeLayout= new QFormLayout;
  9981. ShortHexSpinBox*lowerAddress= new ShortHexSpinBox;
  9982. ShortHexSpinBox*upperAddress= new ShortHexSpinBox;
  9983. queriedRangeLayout->addRow(tr("Function 0x03 Minimum Set Value Address"),
  9984. lowerAddress);
  9985. queriedRangeLayout->addRow(tr("Function 0x03 Maximum Set Value Address"),
  9986. upperAddress);
  9987. queriedRangePlaceholder->setLayout(queriedRangeLayout);
  9988. boundsLayout->addWidget(queriedRangePlaceholder);
  9989. QWidget*fixedRangePlaceholder= new QWidget(this);
  9990. QFormLayout*fixedRangeLayout= new QFormLayout;
  9991. QLineEdit*fixedLower= new QLineEdit;
  9992. QLineEdit*fixedUpper= new QLineEdit;
  9993. fixedRangeLayout->addRow(tr("Minimum Set Value:"),fixedLower);
  9994. fixedRangeLayout->addRow(tr("Maximum Set Value:"),fixedUpper);
  9995. fixedRangePlaceholder->setLayout(fixedRangeLayout);
  9996. boundsLayout->addWidget(fixedRangePlaceholder);
  9997. layout->addLayout(boundsLayout);
  9998. /*708:*/
  9999. #line 15254 "./typica.w"
  10000. QDomElement referenceElement=
  10001. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10002. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10003. QDomElement node;
  10004. /*:708*/
  10005. #line 16602 "./typica.w"
  10006. for(int i= 0;i<configData.size();i++)
  10007. {
  10008. node= configData.at(i).toElement();
  10009. if(node.attribute("name")=="readaddress")
  10010. {
  10011. readAddress->setValue(node.attribute("value").toInt());
  10012. }
  10013. else if(node.attribute("name")=="writeaddress")
  10014. {
  10015. writeAddress->setValue(node.attribute("value").toInt());
  10016. }
  10017. else if(node.attribute("name")=="fixedrange")
  10018. {
  10019. if(node.attribute("value")=="true")
  10020. {
  10021. fixedRange->setCheckState(Qt::Checked);
  10022. }
  10023. else if(node.attribute("value")=="false")
  10024. {
  10025. fixedRange->setCheckState(Qt::Unchecked);
  10026. }
  10027. }
  10028. else if(node.attribute("name")=="fixedlower")
  10029. {
  10030. fixedLower->setText(node.attribute("value"));
  10031. }
  10032. else if(node.attribute("name")=="fixedupper")
  10033. {
  10034. fixedUpper->setText(node.attribute("value"));
  10035. }
  10036. else if(node.attribute("name")=="loweraddress")
  10037. {
  10038. lowerAddress->setValue(node.attribute("value").toInt());
  10039. }
  10040. else if(node.attribute("name")=="upperaddress")
  10041. {
  10042. upperAddress->setValue(node.attribute("value").toInt());
  10043. }
  10044. }
  10045. updateReadAddress(readAddress->value());
  10046. updateWriteAddress(writeAddress->value());
  10047. updateFixedRange(fixedRange->isChecked());
  10048. updateLower(fixedLower->text());
  10049. updateUpper(fixedUpper->text());
  10050. updateLowerAddress(lowerAddress->value());
  10051. updateUpperAddress(upperAddress->value());
  10052. connect(readAddress,SIGNAL(valueChanged(int)),
  10053. this,SLOT(updateReadAddress(int)));
  10054. connect(writeAddress,SIGNAL(valueChanged(int)),
  10055. this,SLOT(updateWriteAddress(int)));
  10056. connect(fixedRange,SIGNAL(toggled(bool)),this,SLOT(updateFixedRange(bool)));
  10057. connect(fixedLower,SIGNAL(textChanged(QString)),
  10058. this,SLOT(updateLower(QString)));
  10059. connect(fixedUpper,SIGNAL(textChanged(QString)),
  10060. this,SLOT(updateUpper(QString)));
  10061. connect(lowerAddress,SIGNAL(valueChanged(int)),
  10062. this,SLOT(updateLowerAddress(int)));
  10063. connect(upperAddress,SIGNAL(valueChanged(int)),
  10064. this,SLOT(updateUpperAddress(int)));
  10065. setLayout(layout);
  10066. }
  10067. void ModbusRtuDeviceTSvConfWidget::updateReadAddress(int newAddress)
  10068. {
  10069. updateAttribute("readaddress",QString("%1").arg(newAddress));
  10070. }
  10071. void ModbusRtuDeviceTSvConfWidget::updateWriteAddress(int newAddress)
  10072. {
  10073. updateAttribute("writeaddress",QString("%1").arg(newAddress));
  10074. }
  10075. void ModbusRtuDeviceTSvConfWidget::updateFixedRange(bool fixed)
  10076. {
  10077. if(fixed)
  10078. {
  10079. updateAttribute("fixedrange","true");
  10080. boundsLayout->setCurrentIndex(1);
  10081. }
  10082. else
  10083. {
  10084. updateAttribute("fixedrange","false");
  10085. boundsLayout->setCurrentIndex(0);
  10086. }
  10087. }
  10088. void ModbusRtuDeviceTSvConfWidget::updateLower(const QString&lower)
  10089. {
  10090. updateAttribute("fixedlower",lower);
  10091. }
  10092. void ModbusRtuDeviceTSvConfWidget::updateUpper(const QString&upper)
  10093. {
  10094. updateAttribute("fixedupper",upper);
  10095. }
  10096. void ModbusRtuDeviceTSvConfWidget::updateLowerAddress(int newAddress)
  10097. {
  10098. updateAttribute("loweraddress",QString("%1").arg(newAddress));
  10099. }
  10100. void ModbusRtuDeviceTSvConfWidget::updateUpperAddress(int newAddress)
  10101. {
  10102. updateAttribute("upperaddress",QString("%1").arg(newAddress));
  10103. }
  10104. /*:751*/
  10105. #line 594 "./typica.w"
  10106. /*707:*/
  10107. #line 15176 "./typica.w"
  10108. RoasterConfWidget::RoasterConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  10109. :BasicDeviceConfigurationWidget(model,index)
  10110. {
  10111. QVBoxLayout*layout= new QVBoxLayout;
  10112. QPushButton*addDeviceButton= new QPushButton(tr("Add Device"));
  10113. QMenu*deviceMenu= new QMenu;
  10114. NodeInserter*insertAction;
  10115. foreach(insertAction,AppInstance->topLevelNodeInserters)
  10116. {
  10117. connect(insertAction,SIGNAL(triggered(QString,QString)),
  10118. this,SLOT(insertChildNode(QString,QString)));
  10119. deviceMenu->addAction(insertAction);
  10120. }
  10121. addDeviceButton->setMenu(deviceMenu);
  10122. layout->addWidget(addDeviceButton);
  10123. QPushButton*addAnnotationControlButton= new QPushButton(tr("Add Annotation Control"));
  10124. QMenu*annotationMenu= new QMenu;
  10125. NodeInserter*basicButtonInserter= new NodeInserter(tr("Annotation Button"),tr("Annotation Button"),"annotationbutton");
  10126. NodeInserter*countingButtonInserter= new NodeInserter(tr("Counting Button"),tr("Counting Button"),"reconfigurablebutton");
  10127. NodeInserter*spinBoxInserter= new NodeInserter(tr("Numeric Entry"),tr("Numeric Entry"),"annotationspinbox");
  10128. NodeInserter*freeAnnotationInserter= new NodeInserter(tr("Free Text"),
  10129. tr("Free Text"),
  10130. "freeannotation");
  10131. annotationMenu->addAction(basicButtonInserter);
  10132. annotationMenu->addAction(countingButtonInserter);
  10133. annotationMenu->addAction(spinBoxInserter);
  10134. annotationMenu->addAction(freeAnnotationInserter);
  10135. connect(basicButtonInserter,SIGNAL(triggered(QString,QString)),
  10136. this,SLOT(insertChildNode(QString,QString)));
  10137. connect(countingButtonInserter,SIGNAL(triggered(QString,QString)),
  10138. this,SLOT(insertChildNode(QString,QString)));
  10139. connect(spinBoxInserter,SIGNAL(triggered(QString,QString)),
  10140. this,SLOT(insertChildNode(QString,QString)));
  10141. connect(freeAnnotationInserter,SIGNAL(triggered(QString,QString)),
  10142. this,SLOT(insertChildNode(QString,QString)));
  10143. /*894:*/
  10144. #line 144 "./valueannotation.w"
  10145. NodeInserter*valueAnnotationInserter= new NodeInserter(tr("Value Annotation"),
  10146. tr("Value Annotation"),
  10147. "valueannotation");
  10148. annotationMenu->addAction(valueAnnotationInserter);
  10149. connect(valueAnnotationInserter,SIGNAL(triggered(QString,QString)),
  10150. this,SLOT(insertChildNode(QString,QString)));
  10151. /*:894*/
  10152. #line 15212 "./typica.w"
  10153. addAnnotationControlButton->setMenu(annotationMenu);
  10154. layout->addWidget(addAnnotationControlButton);
  10155. QPushButton*advancedButton= new QPushButton(tr("Advanced Features"));
  10156. QMenu*advancedMenu= new QMenu;
  10157. NodeInserter*linearsplineinserter= new NodeInserter(tr("Linear Spline Interpolated Series"),tr("Linear Spline Interpolated Series"),"linearspline");
  10158. advancedMenu->addAction(linearsplineinserter);
  10159. NodeInserter*translationinserter= new NodeInserter(tr("Profile Translation"),tr("Profile Translation"),"translation");
  10160. advancedMenu->addAction(translationinserter);
  10161. connect(linearsplineinserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  10162. connect(translationinserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  10163. /*820:*/
  10164. #line 258 "./rate.w"
  10165. NodeInserter*rateOfChangeInserter= new NodeInserter(tr("Rate of Change"),tr("Rate of Change"),"rate");
  10166. connect(rateOfChangeInserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  10167. advancedMenu->addAction(rateOfChangeInserter);
  10168. /*:820*/
  10169. #line 15223 "./typica.w"
  10170. advancedButton->setMenu(advancedMenu);
  10171. layout->addWidget(advancedButton);
  10172. QHBoxLayout*idLayout= new QHBoxLayout;
  10173. QLabel*idLabel= new QLabel(tr("Machine ID for database:"));
  10174. idLayout->addWidget(idLabel);
  10175. QSpinBox*id= new QSpinBox;
  10176. idLayout->addWidget(id);
  10177. layout->addLayout(idLayout);
  10178. /*708:*/
  10179. #line 15254 "./typica.w"
  10180. QDomElement referenceElement=
  10181. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10182. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10183. QDomElement node;
  10184. /*:708*/
  10185. #line 15232 "./typica.w"
  10186. for(int i= 0;i<configData.size();i++)
  10187. {
  10188. node= configData.at(i).toElement();
  10189. if(node.attribute("name")=="databaseid")
  10190. {
  10191. id->setValue(node.attribute("value").toInt());
  10192. break;
  10193. }
  10194. }
  10195. updateRoasterId(id->value());
  10196. connect(id,SIGNAL(valueChanged(int)),this,SLOT(updateRoasterId(int)));
  10197. setLayout(layout);
  10198. }
  10199. /*:707*//*709:*/
  10200. #line 15264 "./typica.w"
  10201. void RoasterConfWidget::updateRoasterId(int id)
  10202. {
  10203. updateAttribute("databaseid",QString("%1").arg(id));
  10204. }
  10205. /*:709*/
  10206. #line 595 "./typica.w"
  10207. /*755:*/
  10208. #line 16752 "./typica.w"
  10209. AnnotationButtonConfWidget::AnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  10210. :BasicDeviceConfigurationWidget(model,index)
  10211. {
  10212. QFormLayout*layout= new QFormLayout;
  10213. QLineEdit*buttonTextEdit= new QLineEdit;
  10214. QLineEdit*annotationTextEdit= new QLineEdit;
  10215. layout->addRow(tr("Button Text:"),buttonTextEdit);
  10216. layout->addRow(tr("Annotation Text:"),annotationTextEdit);
  10217. /*708:*/
  10218. #line 15254 "./typica.w"
  10219. QDomElement referenceElement=
  10220. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10221. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10222. QDomElement node;
  10223. /*:708*/
  10224. #line 16761 "./typica.w"
  10225. for(int i= 0;i<configData.size();i++)
  10226. {
  10227. node= configData.at(i).toElement();
  10228. if(node.attribute("name")=="buttontext")
  10229. {
  10230. buttonTextEdit->setText(node.attribute("value"));
  10231. }
  10232. else if(node.attribute("name")=="annotationtext")
  10233. {
  10234. annotationTextEdit->setText(node.attribute("value"));
  10235. }
  10236. }
  10237. updateButtonText(buttonTextEdit->text());
  10238. updateAnnotationText(annotationTextEdit->text());
  10239. connect(buttonTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateButtonText(QString)));
  10240. connect(annotationTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateAnnotationText(QString)));
  10241. setLayout(layout);
  10242. }
  10243. /*:755*//*756:*/
  10244. #line 16783 "./typica.w"
  10245. void AnnotationButtonConfWidget::updateButtonText(const QString&text)
  10246. {
  10247. updateAttribute("buttontext",text);
  10248. }
  10249. void AnnotationButtonConfWidget::updateAnnotationText(const QString&text)
  10250. {
  10251. updateAttribute("annotationtext",text);
  10252. }
  10253. /*:756*//*759:*/
  10254. #line 16821 "./typica.w"
  10255. ReconfigurableAnnotationButtonConfWidget::ReconfigurableAnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  10256. :BasicDeviceConfigurationWidget(model,index)
  10257. {
  10258. QFormLayout*layout= new QFormLayout;
  10259. QLineEdit*buttonTextEdit= new QLineEdit;
  10260. QLineEdit*annotationTextEdit= new QLineEdit;
  10261. layout->addRow(tr("Button Text:"),buttonTextEdit);
  10262. layout->addRow(tr("Annotation Text:"),annotationTextEdit);
  10263. /*708:*/
  10264. #line 15254 "./typica.w"
  10265. QDomElement referenceElement=
  10266. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10267. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10268. QDomElement node;
  10269. /*:708*/
  10270. #line 16830 "./typica.w"
  10271. for(int i= 0;i<configData.size();i++)
  10272. {
  10273. node= configData.at(i).toElement();
  10274. if(node.attribute("name")=="buttontext")
  10275. {
  10276. buttonTextEdit->setText(node.attribute("value"));
  10277. }
  10278. else if(node.attribute("name")=="annotationtext")
  10279. {
  10280. annotationTextEdit->setText(node.attribute("value"));
  10281. }
  10282. }
  10283. updateButtonText(buttonTextEdit->text());
  10284. updateAnnotationText(annotationTextEdit->text());
  10285. connect(buttonTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateButtonText(QString)));
  10286. connect(annotationTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateAnnotationText(QString)));
  10287. QTextEdit*documentation= new QTextEdit;
  10288. 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."));
  10289. documentation->setReadOnly(true);
  10290. layout->addRow("",documentation);
  10291. setLayout(layout);
  10292. }
  10293. void ReconfigurableAnnotationButtonConfWidget::updateButtonText(const QString&text)
  10294. {
  10295. updateAttribute("buttontext",text);
  10296. }
  10297. void ReconfigurableAnnotationButtonConfWidget::updateAnnotationText(const QString&text)
  10298. {
  10299. updateAttribute("annotationtext",text);
  10300. }
  10301. /*:759*/
  10302. #line 596 "./typica.w"
  10303. /*762:*/
  10304. #line 16898 "./typica.w"
  10305. NoteSpinConfWidget::NoteSpinConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  10306. :BasicDeviceConfigurationWidget(model,index)
  10307. {
  10308. QFormLayout*layout= new QFormLayout;
  10309. QLineEdit*labelEdit= new QLineEdit;
  10310. layout->addRow(tr("Control Label: "),labelEdit);
  10311. QLineEdit*minimumEdit= new QLineEdit;
  10312. layout->addRow(tr("Minimum Value: "),minimumEdit);
  10313. QLineEdit*maximumEdit= new QLineEdit;
  10314. layout->addRow(tr("Maximum Value: "),maximumEdit);
  10315. QSpinBox*precisionEdit= new QSpinBox;
  10316. precisionEdit->setMinimum(0);
  10317. precisionEdit->setMaximum(9);
  10318. layout->addRow(tr("Precision"),precisionEdit);
  10319. QLineEdit*pretext= new QLineEdit;
  10320. layout->addRow(tr("Prefix text"),pretext);
  10321. QLineEdit*posttext= new QLineEdit;
  10322. layout->addRow(tr("Suffix text"),posttext);
  10323. /*708:*/
  10324. #line 15254 "./typica.w"
  10325. QDomElement referenceElement=
  10326. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10327. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10328. QDomElement node;
  10329. /*:708*/
  10330. #line 16917 "./typica.w"
  10331. for(int i= 0;i<configData.size();i++)
  10332. {
  10333. node= configData.at(i).toElement();
  10334. if(node.attribute("name")=="label")
  10335. {
  10336. labelEdit->setText(node.attribute("value"));
  10337. }
  10338. else if(node.attribute("name")=="minimum")
  10339. {
  10340. minimumEdit->setText(node.attribute("value"));
  10341. }
  10342. else if(node.attribute("name")=="maximum")
  10343. {
  10344. maximumEdit->setText(node.attribute("value"));
  10345. }
  10346. else if(node.attribute("name")=="precision")
  10347. {
  10348. precisionEdit->setValue(node.attribute("value").toInt());
  10349. }
  10350. else if(node.attribute("name")=="pretext")
  10351. {
  10352. pretext->setText(node.attribute("value"));
  10353. }
  10354. else if(node.attribute("name")=="posttext")
  10355. {
  10356. posttext->setText(node.attribute("value"));
  10357. }
  10358. }
  10359. updateLabel(labelEdit->text());
  10360. updateMinimum(minimumEdit->text());
  10361. updateMaximum(maximumEdit->text());
  10362. updatePrecision(precisionEdit->value());
  10363. updatePretext(pretext->text());
  10364. updatePosttext(posttext->text());
  10365. connect(labelEdit,SIGNAL(textEdited(QString)),this,SLOT(updateLabel(QString)));
  10366. connect(minimumEdit,SIGNAL(textEdited(QString)),this,SLOT(updateMinimum(QString)));
  10367. connect(maximumEdit,SIGNAL(textEdited(QString)),this,SLOT(updateMaximum(QString)));
  10368. connect(precisionEdit,SIGNAL(valueChanged(int)),this,SLOT(updatePrecision(int)));
  10369. connect(pretext,SIGNAL(textEdited(QString)),this,SLOT(updatePretext(QString)));
  10370. connect(posttext,SIGNAL(textEdited(QString)),this,SLOT(updatePosttext(QString)));
  10371. setLayout(layout);
  10372. }
  10373. void NoteSpinConfWidget::updateLabel(const QString&text)
  10374. {
  10375. updateAttribute("label",text);
  10376. }
  10377. void NoteSpinConfWidget::updateMinimum(const QString&minimum)
  10378. {
  10379. updateAttribute("minimum",minimum);
  10380. }
  10381. void NoteSpinConfWidget::updateMaximum(const QString&maximum)
  10382. {
  10383. updateAttribute("maximum",maximum);
  10384. }
  10385. void NoteSpinConfWidget::updatePrecision(int precision)
  10386. {
  10387. updateAttribute("precision",QString("%1").arg(precision));
  10388. }
  10389. void NoteSpinConfWidget::updatePretext(const QString&text)
  10390. {
  10391. updateAttribute("pretext",text);
  10392. }
  10393. void NoteSpinConfWidget::updatePosttext(const QString&text)
  10394. {
  10395. updateAttribute("posttext",text);
  10396. }
  10397. /*:762*/
  10398. #line 597 "./typica.w"
  10399. /*275:*/
  10400. #line 6594 "./typica.w"
  10401. LinearCalibrator::LinearCalibrator(QObject*parent):
  10402. QObject(parent),Lo1(0),Lo2(0),Up1(1),Up2(1),sensitivitySetting(0.0),clamp(false)
  10403. {
  10404. connect(this,SIGNAL(measurement(Measurement)),this,SIGNAL(newData(Measurement)));
  10405. }
  10406. /*:275*//*276:*/
  10407. #line 6608 "./typica.w"
  10408. Measurement LinearCalibrator::newMeasurement(Measurement measure)
  10409. {
  10410. double outval= Lo1+(measure.temperature()-Lo2)*(Up1-Lo1)/(Up2-Lo2);
  10411. if(clamp)
  10412. {
  10413. if(outval<Lo1)
  10414. {
  10415. outval= Lo1;
  10416. }
  10417. else if(outval> Up1)
  10418. {
  10419. outval= Up1;
  10420. }
  10421. }
  10422. if(sensitivitySetting>=0.05)
  10423. {
  10424. int temp= qRound(outval/sensitivitySetting);
  10425. outval= temp*sensitivitySetting;
  10426. }
  10427. Measurement adjusted(outval,measure.time(),measure.scale());
  10428. emit measurement(adjusted);
  10429. return adjusted;
  10430. }
  10431. /*:276*//*277:*/
  10432. #line 6635 "./typica.w"
  10433. double LinearCalibrator::measuredLower()
  10434. {
  10435. return Lo2;
  10436. }
  10437. double LinearCalibrator::measuredUpper()
  10438. {
  10439. return Up2;
  10440. }
  10441. double LinearCalibrator::mappedLower()
  10442. {
  10443. return Lo1;
  10444. }
  10445. double LinearCalibrator::mappedUpper()
  10446. {
  10447. return Up1;
  10448. }
  10449. bool LinearCalibrator::isClosedRange()
  10450. {
  10451. return clamp;
  10452. }
  10453. void LinearCalibrator::setMeasuredLower(double lower)
  10454. {
  10455. Lo2= lower;
  10456. }
  10457. void LinearCalibrator::setMeasuredUpper(double upper)
  10458. {
  10459. Up2= upper;
  10460. }
  10461. void LinearCalibrator::setMappedLower(double lower)
  10462. {
  10463. Lo1= lower;
  10464. }
  10465. void LinearCalibrator::setMappedUpper(double upper)
  10466. {
  10467. Up1= upper;
  10468. }
  10469. void LinearCalibrator::setClosedRange(bool closed)
  10470. {
  10471. clamp= closed;
  10472. }
  10473. void LinearCalibrator::setSensitivity(double sensitivity)
  10474. {
  10475. sensitivitySetting= sensitivity;
  10476. }
  10477. double LinearCalibrator::sensitivity()
  10478. {
  10479. return sensitivitySetting;
  10480. }
  10481. /*:277*/
  10482. #line 598 "./typica.w"
  10483. /*282:*/
  10484. #line 6768 "./typica.w"
  10485. void LinearSplineInterpolator::add_pair(double source,double destination)
  10486. {
  10487. pairs->insert(source,destination);
  10488. make_interpolators();
  10489. }
  10490. void LinearSplineInterpolator::make_interpolators()
  10491. {
  10492. if(pairs->size()> 1)
  10493. {
  10494. while(interpolators->size()> 0)
  10495. {
  10496. LinearCalibrator*removed= interpolators->takeFirst();
  10497. removed->deleteLater();
  10498. }
  10499. QMap<double,double> ::const_iterator i= pairs->constBegin();
  10500. QMap<double,double> ::const_iterator j= i+1;
  10501. while(j!=pairs->constEnd())
  10502. {
  10503. LinearCalibrator*segment= new LinearCalibrator();
  10504. segment->setMeasuredLower(i.key());
  10505. segment->setMappedLower(i.value());
  10506. segment->setMeasuredUpper(j.key());
  10507. segment->setMappedUpper(j.value());
  10508. segment->setClosedRange(false);
  10509. interpolators->append(segment);
  10510. connect(segment,SIGNAL(measurement(Measurement)),this,SIGNAL(newData(Measurement)));
  10511. i++;
  10512. j++;
  10513. }
  10514. }
  10515. }
  10516. LinearSplineInterpolator::LinearSplineInterpolator(QObject*parent):
  10517. QObject(parent),pairs(new QMap<double,double> ),
  10518. interpolators(new QList<LinearCalibrator*> )
  10519. {
  10520. }
  10521. Measurement LinearSplineInterpolator::newMeasurement(Measurement measure)
  10522. {
  10523. QMap<double,double> ::const_iterator i= pairs->constBegin();
  10524. int index= -1;
  10525. while(i!=pairs->constEnd())
  10526. {
  10527. if(measure.temperature()<=i.key())
  10528. {
  10529. break;
  10530. }
  10531. i++;
  10532. index++;
  10533. }
  10534. if(index<0)
  10535. {
  10536. index= 0;
  10537. }
  10538. if(index>=interpolators->size())
  10539. {
  10540. index= interpolators->size()-1;
  10541. }
  10542. if(interpolators->at(index)!=NULL)
  10543. {
  10544. return interpolators->at(index)->newMeasurement(measure);
  10545. }
  10546. return Measurement();
  10547. }
  10548. /*:282*/
  10549. #line 599 "./typica.w"
  10550. /*799:*/
  10551. #line 18231 "./typica.w"
  10552. LinearSplineInterpolationConfWidget::LinearSplineInterpolationConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  10553. :BasicDeviceConfigurationWidget(model,index),tablemodel(new SaltModel(2))
  10554. {
  10555. QFormLayout*layout= new QFormLayout;
  10556. QLineEdit*source= new QLineEdit;
  10557. layout->addRow(tr("Source column name:"),source);
  10558. QLineEdit*destination= new QLineEdit;
  10559. layout->addRow(tr("Destination column name:"),destination);
  10560. tablemodel->setHeaderData(0,Qt::Horizontal,"Input");
  10561. tablemodel->setHeaderData(1,Qt::Horizontal,"Output");
  10562. QTableView*mappingTable= new QTableView;
  10563. mappingTable->setModel(tablemodel);
  10564. NumericDelegate*delegate= new NumericDelegate;
  10565. mappingTable->setItemDelegate(delegate);
  10566. layout->addRow(tr("Mapping data:"),mappingTable);
  10567. /*708:*/
  10568. #line 15254 "./typica.w"
  10569. QDomElement referenceElement=
  10570. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10571. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10572. QDomElement node;
  10573. /*:708*/
  10574. #line 18247 "./typica.w"
  10575. for(int i= 0;i<configData.size();i++)
  10576. {
  10577. node= configData.at(i).toElement();
  10578. if(node.attribute("name")=="source")
  10579. {
  10580. source->setText(node.attribute("value"));
  10581. }
  10582. else if(node.attribute("name")=="destination")
  10583. {
  10584. destination->setText(node.attribute("value"));
  10585. }
  10586. else if(node.attribute("name")=="sourcevalues")
  10587. {
  10588. /*800:*/
  10589. #line 18286 "./typica.w"
  10590. QString data= node.attribute("value");
  10591. if(data.length()> 3)
  10592. {
  10593. data.chop(2);
  10594. data= data.remove(0,2);
  10595. }
  10596. QStringList itemList= data.split(",");
  10597. /*:800*/
  10598. #line 18261 "./typica.w"
  10599. int column= 0;
  10600. /*801:*/
  10601. #line 18298 "./typica.w"
  10602. for(int i= 0;i<itemList.size();i++)
  10603. {
  10604. tablemodel->setData(tablemodel->index(i,column),
  10605. QVariant(itemList.at(i).toDouble()),
  10606. Qt::DisplayRole);
  10607. }
  10608. /*:801*/
  10609. #line 18263 "./typica.w"
  10610. }
  10611. else if(node.attribute("name")=="destinationvalues")
  10612. {
  10613. /*800:*/
  10614. #line 18286 "./typica.w"
  10615. QString data= node.attribute("value");
  10616. if(data.length()> 3)
  10617. {
  10618. data.chop(2);
  10619. data= data.remove(0,2);
  10620. }
  10621. QStringList itemList= data.split(",");
  10622. /*:800*/
  10623. #line 18268 "./typica.w"
  10624. int column= 1;
  10625. /*801:*/
  10626. #line 18298 "./typica.w"
  10627. for(int i= 0;i<itemList.size();i++)
  10628. {
  10629. tablemodel->setData(tablemodel->index(i,column),
  10630. QVariant(itemList.at(i).toDouble()),
  10631. Qt::DisplayRole);
  10632. }
  10633. /*:801*/
  10634. #line 18270 "./typica.w"
  10635. }
  10636. }
  10637. updateSourceColumn(source->text());
  10638. updateDestinationColumn(destination->text());
  10639. updateKnots();
  10640. connect(source,SIGNAL(textEdited(QString)),this,SLOT(updateSourceColumn(QString)));
  10641. connect(destination,SIGNAL(textEdited(QString)),this,SLOT(updateDestinationColumn(QString)));
  10642. connect(tablemodel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(updateKnots()));
  10643. setLayout(layout);
  10644. }
  10645. /*:799*//*802:*/
  10646. #line 18309 "./typica.w"
  10647. void LinearSplineInterpolationConfWidget::updateKnots()
  10648. {
  10649. updateAttribute("sourcevalues",tablemodel->arrayLiteral(0,Qt::DisplayRole));
  10650. updateAttribute("destinationvalues",tablemodel->arrayLiteral(1,Qt::DisplayRole));
  10651. }
  10652. void LinearSplineInterpolationConfWidget::updateSourceColumn(const QString&source)
  10653. {
  10654. updateAttribute("source",source);
  10655. }
  10656. void LinearSplineInterpolationConfWidget::updateDestinationColumn(const QString&dest)
  10657. {
  10658. updateAttribute("destination",dest);
  10659. }
  10660. /*:802*/
  10661. #line 600 "./typica.w"
  10662. /*805:*/
  10663. #line 18352 "./typica.w"
  10664. TranslationConfWidget::TranslationConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  10665. :BasicDeviceConfigurationWidget(model,index),
  10666. temperatureValue(new QDoubleSpinBox),unitSelector(new QComboBox)
  10667. {
  10668. unitSelector->addItem("Fahrenheit");
  10669. unitSelector->addItem("Celsius");
  10670. temperatureValue->setMinimum(0);
  10671. temperatureValue->setMaximum(1000);
  10672. QFormLayout*layout= new QFormLayout;
  10673. QLineEdit*column= new QLineEdit;
  10674. layout->addRow(tr("Column to match:"),column);
  10675. layout->addRow(tr("Unit:"),unitSelector);
  10676. layout->addRow(tr("Value:"),temperatureValue);
  10677. /*708:*/
  10678. #line 15254 "./typica.w"
  10679. QDomElement referenceElement=
  10680. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10681. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10682. QDomElement node;
  10683. /*:708*/
  10684. #line 18366 "./typica.w"
  10685. for(int i= 0;i<configData.size();i++)
  10686. {
  10687. node= configData.at(i).toElement();
  10688. if(node.attribute("name")=="column")
  10689. {
  10690. column->setText(node.attribute("value"));
  10691. }
  10692. else if(node.attribute("name")=="unit")
  10693. {
  10694. unitSelector->setCurrentIndex(unitSelector->findText(node.attribute("value")));
  10695. }
  10696. else if(node.attribute("name")=="value")
  10697. {
  10698. temperatureValue->setValue(node.attribute("value").toDouble());
  10699. }
  10700. }
  10701. updateMatchingColumn(column->text());
  10702. updateTemperature();
  10703. connect(column,SIGNAL(textEdited(QString)),this,SLOT(updateMatchingColumn(QString)));
  10704. connect(unitSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateTemperature()));
  10705. connect(temperatureValue,SIGNAL(valueChanged(double)),this,SLOT(updateTemperature()));
  10706. setLayout(layout);
  10707. }
  10708. /*:805*//*806:*/
  10709. #line 18395 "./typica.w"
  10710. void TranslationConfWidget::updateTemperature()
  10711. {
  10712. updateAttribute("unit",unitSelector->currentText());
  10713. updateAttribute("value",QString("%1").arg(temperatureValue->value()));
  10714. if(unitSelector->currentText()=="Fahrenheit")
  10715. {
  10716. updateAttribute("FValue",QString("%1").arg(temperatureValue->value()));
  10717. }
  10718. else
  10719. {
  10720. updateAttribute("FValue",QString("%1").arg(temperatureValue->value()*9/5+32));
  10721. }
  10722. }
  10723. void TranslationConfWidget::updateMatchingColumn(const QString&column)
  10724. {
  10725. updateAttribute("column",column);
  10726. }
  10727. /*:806*/
  10728. #line 601 "./typica.w"
  10729. /*765:*/
  10730. #line 24 "./freeannotation.w"
  10731. FreeAnnotationConfWidget::FreeAnnotationConfWidget(DeviceTreeModel*model,
  10732. const QModelIndex&index)
  10733. :BasicDeviceConfigurationWidget(model,index)
  10734. {
  10735. QFormLayout*layout= new QFormLayout;
  10736. QLineEdit*labelEdit= new QLineEdit;
  10737. layout->addRow(tr("Label Text:"),labelEdit);
  10738. /*708:*/
  10739. #line 15254 "./typica.w"
  10740. QDomElement referenceElement=
  10741. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10742. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10743. QDomElement node;
  10744. /*:708*/
  10745. #line 32 "./freeannotation.w"
  10746. for(int i= 0;i<configData.size();i++)
  10747. {
  10748. node= configData.at(i).toElement();
  10749. if(node.attribute("name")=="labeltext")
  10750. {
  10751. labelEdit->setText(node.attribute("value"));
  10752. }
  10753. }
  10754. updateLabel(labelEdit->text());
  10755. connect(labelEdit,SIGNAL(textEdited(QString)),
  10756. this,SLOT(updateLabel(QString)));
  10757. setLayout(layout);
  10758. }
  10759. /*:765*//*766:*/
  10760. #line 49 "./freeannotation.w"
  10761. void FreeAnnotationConfWidget::updateLabel(const QString&text)
  10762. {
  10763. updateAttribute("labeltext",text);
  10764. }
  10765. /*:766*/
  10766. #line 602 "./typica.w"
  10767. /*809:*/
  10768. #line 39 "./rate.w"
  10769. void RateOfChange::newMeasurement(Measurement measure)
  10770. {
  10771. cache.append(measure);
  10772. /*810:*/
  10773. #line 64 "./rate.w"
  10774. if(cache.size()> 2)
  10775. {
  10776. bool done= false;
  10777. while(!done)
  10778. {
  10779. if(cache.front().time().secsTo(cache.back().time())> ct)
  10780. {
  10781. cache.removeFirst();
  10782. }
  10783. else if(cache.back().time()<cache.front().time())
  10784. {
  10785. cache.removeFirst();
  10786. done= true;
  10787. }
  10788. else
  10789. {
  10790. done= true;
  10791. }
  10792. if(cache.size()<3)
  10793. {
  10794. done= true;
  10795. }
  10796. }
  10797. }
  10798. /*:810*/
  10799. #line 43 "./rate.w"
  10800. if(cache.size()>=2)
  10801. {
  10802. /*811:*/
  10803. #line 96 "./rate.w"
  10804. int N= cache.size();
  10805. double SXY= 0;
  10806. double SX= 0;
  10807. double SXX= 0;
  10808. double SY= 0;
  10809. double y;
  10810. double x;
  10811. for(int i= 0;i<N;i++)
  10812. {
  10813. y= cache.at(i).temperature();
  10814. SY+= y;
  10815. x= cache.at(0).time().msecsTo(cache.at(i).time())/1000.0;
  10816. SX+= x;
  10817. SXX+= (x*x);
  10818. SXY+= (x*y);
  10819. }
  10820. double M= ((N*SXY)-(SX*SY))/((N*SXX)-(SX*SX));
  10821. Measurement value(M*st,cache.back().time(),cache.back().scale());
  10822. value.insert("relative",true);
  10823. emit newData(value);
  10824. /*:811*/
  10825. #line 46 "./rate.w"
  10826. }
  10827. }
  10828. /*:809*//*812:*/
  10829. #line 120 "./rate.w"
  10830. RateOfChange::RateOfChange(int cachetime,int scaletime):ct(cachetime),st(1)
  10831. {
  10832. setScaleTime(scaletime);
  10833. }
  10834. void RateOfChange::setCacheTime(int seconds)
  10835. {
  10836. ct= seconds;
  10837. }
  10838. void RateOfChange::setScaleTime(int seconds)
  10839. {
  10840. st= (seconds> 0?seconds:1);
  10841. }
  10842. /*:812*/
  10843. #line 603 "./typica.w"
  10844. /*769:*/
  10845. #line 26 "./settings.w"
  10846. SettingsWindow::SettingsWindow():QMainWindow(NULL)
  10847. {
  10848. QTabWidget*settingsTab= new QTabWidget;
  10849. DeviceConfigurationWindow*deviceSettings= new DeviceConfigurationWindow;
  10850. settingsTab->addTab(deviceSettings,tr("Roasters"));
  10851. GraphSettingsWidget*graphSettings= new GraphSettingsWidget;
  10852. settingsTab->addTab(graphSettings,tr("Graph"));
  10853. setCentralWidget(settingsTab);
  10854. }
  10855. /*:769*/
  10856. #line 604 "./typica.w"
  10857. /*774:*/
  10858. #line 27 "./graphsettings.w"
  10859. GraphSettingsWidget::GraphSettingsWidget():QWidget(NULL)
  10860. {
  10861. QTabWidget*graphCategories= new QTabWidget;
  10862. GraphSettingsRelativeTab*relative= new GraphSettingsRelativeTab;
  10863. graphCategories->addTab(relative,tr("Relative Temperatures"));
  10864. QVBoxLayout*layout= new QVBoxLayout;
  10865. layout->addWidget(graphCategories);
  10866. setLayout(layout);
  10867. }
  10868. /*:774*//*776:*/
  10869. #line 65 "./graphsettings.w"
  10870. GraphSettingsRelativeTab::GraphSettingsRelativeTab():QWidget(NULL),
  10871. colorEdit(new QLineEdit)
  10872. {
  10873. QSettings settings;
  10874. QVBoxLayout*layout= new QVBoxLayout;
  10875. QCheckBox*enable= new QCheckBox(tr("Graph relative temperatures"));
  10876. enable->setChecked(settings.value("settings/graph/relative/enable",true).toBool());
  10877. updateEnableSetting(enable->isChecked());
  10878. connect(enable,SIGNAL(toggled(bool)),this,SLOT(updateEnableSetting(bool)));
  10879. layout->addWidget(enable);
  10880. QHBoxLayout*colorLayout= new QHBoxLayout;
  10881. QLabel*colorLabel= new QLabel(tr("Axis color:"));
  10882. colorEdit->setText(settings.value("settings/graph/relative/color","#000000").toString());
  10883. updateColorSetting(colorEdit->text());
  10884. connect(colorEdit,SIGNAL(textChanged(QString)),this,SLOT(updateColorSetting(QString)));
  10885. QToolButton*colorPickerButton= new QToolButton();
  10886. colorPickerButton->setIcon(QIcon::fromTheme("applications-graphics"));
  10887. connect(colorPickerButton,SIGNAL(clicked()),this,SLOT(showColorPicker()));
  10888. colorLayout->addWidget(colorLabel);
  10889. colorLayout->addWidget(colorEdit);
  10890. colorLayout->addWidget(colorPickerButton);
  10891. colorLayout->addStretch();
  10892. layout->addLayout(colorLayout);
  10893. QHBoxLayout*unitLayout= new QHBoxLayout;
  10894. QLabel*unitLabel= new QLabel(tr("Unit"));
  10895. QComboBox*unitSelector= new QComboBox;
  10896. unitSelector->addItem(tr("Fahrenheit"));
  10897. unitSelector->addItem(tr("Celsius"));
  10898. unitSelector->setCurrentIndex(settings.value("settings/graph/relative/unit",0).toInt());
  10899. updateUnit(unitSelector->currentIndex());
  10900. connect(unitSelector,SIGNAL(currentIndexChanged(int)),this,SLOT(updateUnit(int)));
  10901. unitLayout->addWidget(unitLabel);
  10902. unitLayout->addWidget(unitSelector);
  10903. unitLayout->addStretch();
  10904. layout->addLayout(unitLayout);
  10905. QHBoxLayout*axisLayout= new QHBoxLayout;
  10906. QLabel*axisLabel= new QLabel(tr("Grid line positions (comma separated):"));
  10907. QLineEdit*axisEdit= new QLineEdit;
  10908. axisEdit->setText(settings.value("settings/graph/relative/grid","-300, -100, -10, 0, 10, 30, 50").toString());
  10909. updateAxisSetting(axisEdit->text());
  10910. connect(axisEdit,SIGNAL(textChanged(QString)),this,SLOT(updateAxisSetting(QString)));
  10911. axisLayout->addWidget(axisLabel);
  10912. axisLayout->addWidget(axisEdit);
  10913. layout->addLayout(axisLayout);
  10914. layout->addStretch();
  10915. setLayout(layout);
  10916. }
  10917. /*:776*//*777:*/
  10918. #line 116 "./graphsettings.w"
  10919. void GraphSettingsRelativeTab::updateEnableSetting(bool enabled)
  10920. {
  10921. QSettings settings;
  10922. settings.setValue("settings/graph/relative/enable",enabled);
  10923. }
  10924. void GraphSettingsRelativeTab::updateColorSetting(const QString&color)
  10925. {
  10926. QSettings settings;
  10927. settings.setValue("settings/graph/relative/color",color);
  10928. }
  10929. void GraphSettingsRelativeTab::updateAxisSetting(const QString&gridList)
  10930. {
  10931. QSettings settings;
  10932. QString settingValue;
  10933. QStringList points= gridList.split(QRegExp("[\\s,]+"),QString::SkipEmptyParts);
  10934. QStringList numbers;
  10935. foreach(QString text,points)
  10936. {
  10937. bool okay= false;
  10938. text.toDouble(&okay);
  10939. if(okay)
  10940. {
  10941. numbers.append(text);
  10942. }
  10943. }
  10944. numbers.removeDuplicates();
  10945. settings.setValue("settings/graph/relative/grid",numbers.join(","));
  10946. }
  10947. void GraphSettingsRelativeTab::updateUnit(int unit)
  10948. {
  10949. QSettings settings;
  10950. settings.setValue("settings/graph/relative/unit",unit);
  10951. }
  10952. /*:777*//*778:*/
  10953. #line 159 "./graphsettings.w"
  10954. void GraphSettingsRelativeTab::showColorPicker()
  10955. {
  10956. QColor color= QColorDialog::getColor(QColor(colorEdit->text()),this);
  10957. colorEdit->setText(color.name());
  10958. }
  10959. #line 16999 "./typica.w"
  10960. /*:778*/
  10961. #line 605 "./typica.w"
  10962. /*844:*/
  10963. #line 682 "./dataqsdk.w"
  10964. DataqSdkDeviceConfWidget::DataqSdkDeviceConfWidget(DeviceTreeModel*model,
  10965. const QModelIndex&index)
  10966. :BasicDeviceConfigurationWidget(model,index),
  10967. deviceIdStack(new QStackedWidget)
  10968. {
  10969. QVBoxLayout*layout= new QVBoxLayout;
  10970. QCheckBox*autoDetect= new QCheckBox("Automatically select device");
  10971. layout->addWidget(autoDetect);
  10972. QWidget*autoLayerWidget= new QWidget;
  10973. QHBoxLayout*autoLayerLayout= new QHBoxLayout;
  10974. QLabel*autoLabel= new QLabel(tr("Device number"));
  10975. QSpinBox*autoNumber= new QSpinBox;
  10976. autoNumber->setMinimum(1);
  10977. autoNumber->setMaximum(99);
  10978. autoLayerLayout->addWidget(autoLabel);
  10979. autoLayerLayout->addWidget(autoNumber);
  10980. autoLayerWidget->setLayout(autoLayerLayout);
  10981. QWidget*fixedLayerWidget= new QWidget;
  10982. QHBoxLayout*fixedLayerLayout= new QHBoxLayout;
  10983. QLabel*fixedLabel= new QLabel(tr("Device port"));
  10984. QComboBox*portSelection= new QComboBox;
  10985. portSelection->setEditable(true);
  10986. portSelection->addItems(DataqSdkDevice::detectHardware());
  10987. fixedLayerLayout->addWidget(fixedLabel);
  10988. fixedLayerLayout->addWidget(portSelection);
  10989. fixedLayerWidget->setLayout(fixedLayerLayout);
  10990. deviceIdStack->addWidget(autoLayerWidget);
  10991. deviceIdStack->addWidget(fixedLayerWidget);
  10992. layout->addWidget(deviceIdStack);
  10993. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  10994. layout->addWidget(addChannelButton);
  10995. /*708:*/
  10996. #line 15254 "./typica.w"
  10997. QDomElement referenceElement=
  10998. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10999. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11000. QDomElement node;
  11001. /*:708*/
  11002. #line 714 "./dataqsdk.w"
  11003. for(int i= 0;i<configData.size();i++)
  11004. {
  11005. node= configData.at(i).toElement();
  11006. if(node.attribute("name")=="autoSelect")
  11007. {
  11008. autoDetect->setChecked(node.attribute("value")=="true"?true:false);
  11009. }
  11010. else if(node.attribute("name")=="deviceNumber")
  11011. {
  11012. autoNumber->setValue(node.attribute("value").toInt());
  11013. }
  11014. else if(node.attribute("name")=="port")
  11015. {
  11016. int index= portSelection->findText(node.attribute("value"));
  11017. if(index> -1)
  11018. {
  11019. portSelection->setCurrentIndex(index);
  11020. }
  11021. else
  11022. {
  11023. portSelection->setEditText(node.attribute("value"));
  11024. }
  11025. }
  11026. }
  11027. updateAutoSelect(autoDetect->isChecked());
  11028. updateDeviceNumber(autoNumber->value());
  11029. updatePort(portSelection->currentText());
  11030. connect(autoDetect,SIGNAL(toggled(bool)),this,SLOT(updateAutoSelect(bool)));
  11031. connect(autoNumber,SIGNAL(valueChanged(int)),this,SLOT(updateDeviceNumber(int)));
  11032. connect(portSelection,SIGNAL(currentIndexChanged(QString)),this,SLOT(updatePort(QString)));
  11033. connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
  11034. setLayout(layout);
  11035. }
  11036. /*:844*//*845:*/
  11037. #line 758 "./dataqsdk.w"
  11038. void DataqSdkDeviceConfWidget::updateAutoSelect(bool automatic)
  11039. {
  11040. if(automatic)
  11041. {
  11042. updateAttribute("autoSelect","true");
  11043. deviceIdStack->setCurrentIndex(0);
  11044. }
  11045. else
  11046. {
  11047. updateAttribute("autoSelect","false");
  11048. deviceIdStack->setCurrentIndex(1);
  11049. }
  11050. }
  11051. /*:845*//*846:*/
  11052. #line 775 "./dataqsdk.w"
  11053. void DataqSdkDeviceConfWidget::updateDeviceNumber(int deviceNumber)
  11054. {
  11055. updateAttribute("deviceNumber",QString("%1").arg(deviceNumber));
  11056. }
  11057. void DataqSdkDeviceConfWidget::updatePort(QString portId)
  11058. {
  11059. updateAttribute("port",portId);
  11060. }
  11061. /*:846*//*847:*/
  11062. #line 788 "./dataqsdk.w"
  11063. void DataqSdkDeviceConfWidget::addChannel()
  11064. {
  11065. insertChildNode(tr("Channel"),"dataqsdkchannel");
  11066. }
  11067. /*:847*//*850:*/
  11068. #line 868 "./dataqsdk.w"
  11069. DataqSdkChannelConfWidget::DataqSdkChannelConfWidget(DeviceTreeModel*model,
  11070. const QModelIndex&index)
  11071. :BasicDeviceConfigurationWidget(model,index),
  11072. startButton(new QPushButton(tr("Start"))),
  11073. resetButton(new QPushButton(tr("Reset"))),
  11074. stopButton(new QPushButton(tr("Stop"))),
  11075. calibrator(new LinearCalibrator),
  11076. currentMeasurement(new QLineEdit),minimumMeasurement(new QLineEdit),
  11077. maximumMeasurement(new QLineEdit),averageMeasurement(new QLineEdit),
  11078. currentMapped(new QLineEdit),minimumMapped(new QLineEdit),
  11079. maximumMapped(new QLineEdit),averageMapped(new QLineEdit),
  11080. rmCount(0),cmCount(0),
  11081. rmin(std::numeric_limits<double> ::max()),
  11082. rmax(std::numeric_limits<double> ::min()),rmean(0),
  11083. cmin(std::numeric_limits<double> ::max()),
  11084. cmax(std::numeric_limits<double> ::min()),cmean(0)
  11085. {
  11086. /*854:*/
  11087. #line 1107 "./dataqsdk.w"
  11088. QDomElement parentReference= model->referenceElement(model->data(index.parent(),Qt::UserRole).toString());
  11089. QDomNodeList deviceConfigData= parentReference.elementsByTagName("attribute");
  11090. QDomElement deviceNode;
  11091. QString configPort;
  11092. QString configAuto;
  11093. for(int i= 0;i<deviceConfigData.size();i++)
  11094. {
  11095. deviceNode= deviceConfigData.at(i).toElement();
  11096. if(deviceNode.attribute("name")=="autoSelect")
  11097. {
  11098. autoSelect= (deviceNode.attribute("value")=="true");
  11099. }
  11100. else if(deviceNode.attribute("name")=="deviceNumber")
  11101. {
  11102. configAuto= deviceNode.attribute("value");
  11103. }
  11104. else if(deviceNode.attribute("name")=="port")
  11105. {
  11106. configPort= deviceNode.attribute("value");
  11107. }
  11108. }
  11109. deviceID= autoSelect?configAuto:configPort;
  11110. channelOfInterest= index.row();
  11111. /*:854*/
  11112. #line 886 "./dataqsdk.w"
  11113. resetButton->setEnabled(false);
  11114. stopButton->setEnabled(false);
  11115. connect(startButton,SIGNAL(clicked()),this,SLOT(startCalibration()));
  11116. connect(resetButton,SIGNAL(clicked()),this,SLOT(resetCalibration()));
  11117. connect(stopButton,SIGNAL(clicked()),this,SLOT(stopCalibration()));
  11118. QVBoxLayout*layout= new QVBoxLayout;
  11119. QFormLayout*topLayout= new QFormLayout;
  11120. QLineEdit*columnEdit= new QLineEdit;
  11121. topLayout->addRow(tr("Column name"),columnEdit);
  11122. QComboBox*unitSelector= new QComboBox;
  11123. unitSelector->addItem(tr("Temperature"));
  11124. unitSelector->addItem(tr("Control"));
  11125. topLayout->addRow(tr("Measurement type"),unitSelector);
  11126. QCheckBox*smoothingBox= new QCheckBox(tr("Enable smoothing"));
  11127. topLayout->addRow(smoothingBox);
  11128. layout->addLayout(topLayout);
  11129. QCheckBox*hideSeries= new QCheckBox(tr("Hide this channel"));
  11130. topLayout->addRow(hideSeries);
  11131. QLabel*calibrationLabel= new QLabel(tr("Calibration settings"));
  11132. layout->addWidget(calibrationLabel);
  11133. QHBoxLayout*calibrationLayout= new QHBoxLayout;
  11134. QFormLayout*calibrationControlsLayout= new QFormLayout;
  11135. QLineEdit*measuredLowerEdit= new QLineEdit;
  11136. measuredLowerEdit->setText("0");
  11137. QLineEdit*measuredUpperEdit= new QLineEdit;
  11138. measuredUpperEdit->setText("10");
  11139. QLineEdit*mappedLowerEdit= new QLineEdit;
  11140. mappedLowerEdit->setText("0");
  11141. QLineEdit*mappedUpperEdit= new QLineEdit;
  11142. mappedUpperEdit->setText("10");
  11143. calibrationControlsLayout->addRow(tr("Measured lower value"),measuredLowerEdit);
  11144. calibrationControlsLayout->addRow(tr("Mapped lower value"),mappedLowerEdit);
  11145. calibrationControlsLayout->addRow(tr("Measured upper value"),measuredUpperEdit);
  11146. calibrationControlsLayout->addRow(tr("Mapped upper value"),mappedUpperEdit);
  11147. QCheckBox*closedBox= new QCheckBox(tr("Closed range"));
  11148. calibrationControlsLayout->addRow(closedBox);
  11149. QLineEdit*sensitivityEdit= new QLineEdit;
  11150. sensitivityEdit->setText("0");
  11151. calibrationControlsLayout->addRow(tr("Discrete interval skip"),sensitivityEdit);
  11152. QVBoxLayout*calibrationTestLayout= new QVBoxLayout;
  11153. QHBoxLayout*deviceControlLayout= new QHBoxLayout;
  11154. deviceControlLayout->addWidget(startButton);
  11155. deviceControlLayout->addWidget(resetButton);
  11156. deviceControlLayout->addWidget(stopButton);
  11157. QFormLayout*indicatorLayout= new QFormLayout;
  11158. currentMeasurement->setReadOnly(true);
  11159. minimumMeasurement->setReadOnly(true);
  11160. maximumMeasurement->setReadOnly(true);
  11161. averageMeasurement->setReadOnly(true);
  11162. currentMapped->setReadOnly(true);
  11163. minimumMapped->setReadOnly(true);
  11164. maximumMapped->setReadOnly(true);
  11165. averageMapped->setReadOnly(true);
  11166. indicatorLayout->addRow(tr("Measured Values"),new QWidget);
  11167. indicatorLayout->addRow(tr("Current"),currentMeasurement);
  11168. indicatorLayout->addRow(tr("Minimum"),minimumMeasurement);
  11169. indicatorLayout->addRow(tr("Maximum"),maximumMeasurement);
  11170. indicatorLayout->addRow(tr("Mean"),averageMeasurement);
  11171. indicatorLayout->addRow(tr("Mapped Values"),new QWidget);
  11172. indicatorLayout->addRow(tr("Current Mapped"),currentMapped);
  11173. indicatorLayout->addRow(tr("Minimum Mapped"),minimumMapped);
  11174. indicatorLayout->addRow(tr("Maximum Mapped"),maximumMapped);
  11175. indicatorLayout->addRow(tr("Mean Mapped"),averageMapped);
  11176. calibrationTestLayout->addLayout(deviceControlLayout);
  11177. calibrationTestLayout->addLayout(indicatorLayout);
  11178. calibrationLayout->addLayout(calibrationControlsLayout);
  11179. calibrationLayout->addLayout(calibrationTestLayout);
  11180. layout->addLayout(calibrationLayout);
  11181. /*708:*/
  11182. #line 15254 "./typica.w"
  11183. QDomElement referenceElement=
  11184. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11185. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11186. QDomElement node;
  11187. /*:708*/
  11188. #line 955 "./dataqsdk.w"
  11189. for(int i= 0;i<configData.size();i++)
  11190. {
  11191. node= configData.at(i).toElement();
  11192. if(node.attribute("name")=="column")
  11193. {
  11194. columnEdit->setText(node.attribute("value"));
  11195. }
  11196. else if(node.attribute("name")=="type")
  11197. {
  11198. unitSelector->setCurrentIndex(unitSelector->findText(node.attribute("value")));
  11199. }
  11200. else if(node.attribute("name")=="smoothing")
  11201. {
  11202. smoothingBox->setChecked(node.attribute("value")=="true");
  11203. }
  11204. else if(node.attribute("name")=="calibrationMeasuredLower")
  11205. {
  11206. measuredLowerEdit->setText(node.attribute("value"));
  11207. }
  11208. else if(node.attribute("name")=="calibrationMeasuredUpper")
  11209. {
  11210. measuredUpperEdit->setText(node.attribute("value"));
  11211. }
  11212. else if(node.attribute("name")=="calibrationMappedLower")
  11213. {
  11214. mappedLowerEdit->setText(node.attribute("value"));
  11215. }
  11216. else if(node.attribute("name")=="calibrationMappedUpper")
  11217. {
  11218. mappedUpperEdit->setText(node.attribute("value"));
  11219. }
  11220. else if(node.attribute("name")=="calibrationClosedInterval")
  11221. {
  11222. closedBox->setChecked(node.attribute("value")=="true");
  11223. }
  11224. else if(node.attribute("name")=="calibrationSensitivity")
  11225. {
  11226. sensitivityEdit->setText(node.attribute("value"));
  11227. }
  11228. else if(node.attribute("name")=="hidden")
  11229. {
  11230. hideSeries->setChecked(node.attribute("value")=="true");
  11231. }
  11232. }
  11233. updateColumnName(columnEdit->text());
  11234. updateUnits(unitSelector->currentText());
  11235. updateSmoothingEnabled(smoothingBox->isChecked());
  11236. updateMeasuredLower(measuredLowerEdit->text());
  11237. updateMeasuredUpper(measuredUpperEdit->text());
  11238. updateMappedLower(mappedLowerEdit->text());
  11239. updateMappedUpper(mappedUpperEdit->text());
  11240. updateClosedInterval(closedBox->isChecked());
  11241. updateSensitivity(sensitivityEdit->text());
  11242. updateHidden(hideSeries->isChecked());
  11243. connect(columnEdit,SIGNAL(textChanged(QString)),
  11244. this,SLOT(updateColumnName(QString)));
  11245. connect(unitSelector,SIGNAL(currentIndexChanged(QString)),
  11246. this,SLOT(updateUnits(QString)));
  11247. connect(smoothingBox,SIGNAL(toggled(bool)),
  11248. this,SLOT(updateSmoothingEnabled(bool)));
  11249. connect(measuredLowerEdit,SIGNAL(textChanged(QString)),
  11250. this,SLOT(updateMeasuredLower(QString)));
  11251. connect(mappedLowerEdit,SIGNAL(textChanged(QString)),
  11252. this,SLOT(updateMappedLower(QString)));
  11253. connect(measuredUpperEdit,SIGNAL(textChanged(QString)),
  11254. this,SLOT(updateMeasuredUpper(QString)));
  11255. connect(mappedUpperEdit,SIGNAL(textChanged(QString)),
  11256. this,SLOT(updateMappedUpper(QString)));
  11257. connect(closedBox,SIGNAL(toggled(bool)),
  11258. this,SLOT(updateClosedInterval(bool)));
  11259. connect(sensitivityEdit,SIGNAL(textChanged(QString)),
  11260. this,SLOT(updateSensitivity(QString)));
  11261. connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  11262. setLayout(layout);
  11263. }
  11264. /*:850*//*851:*/
  11265. #line 1038 "./dataqsdk.w"
  11266. void DataqSdkChannelConfWidget::updateUnits(const QString&unit)
  11267. {
  11268. updateAttribute("type",unit);
  11269. }
  11270. /*:851*//*852:*/
  11271. #line 1047 "./dataqsdk.w"
  11272. void DataqSdkChannelConfWidget::updateMeasuredLower(const QString&value)
  11273. {
  11274. updateAttribute("calibrationMeasuredLower",value);
  11275. calibrator->setMeasuredLower(value.toDouble());
  11276. }
  11277. void DataqSdkChannelConfWidget::updateMeasuredUpper(const QString&value)
  11278. {
  11279. updateAttribute("calibrationMeasuredUpper",value);
  11280. calibrator->setMeasuredUpper(value.toDouble());
  11281. }
  11282. void DataqSdkChannelConfWidget::updateMappedLower(const QString&value)
  11283. {
  11284. updateAttribute("calibrationMappedLower",value);
  11285. calibrator->setMappedLower(value.toDouble());
  11286. }
  11287. void DataqSdkChannelConfWidget::updateMappedUpper(const QString&value)
  11288. {
  11289. updateAttribute("calibrationMappedUpper",value);
  11290. calibrator->setMappedUpper(value.toDouble());
  11291. }
  11292. void DataqSdkChannelConfWidget::updateClosedInterval(bool closed)
  11293. {
  11294. updateAttribute("calibrationClosedInterval",closed?"true":"false");
  11295. calibrator->setClosedRange(closed);
  11296. }
  11297. void DataqSdkChannelConfWidget::updateSmoothingEnabled(bool enabled)
  11298. {
  11299. updateAttribute("smoothing",enabled?"true":"false");
  11300. }
  11301. void DataqSdkChannelConfWidget::updateSensitivity(const QString&value)
  11302. {
  11303. updateAttribute("calibrationSensitivity",value);
  11304. calibrator->setSensitivity(value.toDouble());
  11305. }
  11306. void DataqSdkChannelConfWidget::updateHidden(bool hidden)
  11307. {
  11308. updateAttribute("hidden",hidden?"true":"false");
  11309. }
  11310. /*:852*//*855:*/
  11311. #line 1136 "./dataqsdk.w"
  11312. void DataqSdkChannelConfWidget::startCalibration()
  11313. {
  11314. startButton->setEnabled(false);
  11315. stopButton->setEnabled(true);
  11316. resetButton->setEnabled(true);
  11317. calibrationDevice= new DataqSdkDevice(deviceID);
  11318. Channel*channel;
  11319. for(unsigned int i= 0;i<=channelOfInterest;i++)
  11320. {
  11321. channel= calibrationDevice->newChannel(Units::Unitless);
  11322. }
  11323. connect(channel,SIGNAL(newData(Measurement)),this,SLOT(updateInput(Measurement)));
  11324. connect(channel,SIGNAL(newData(Measurement)),calibrator,SLOT(newMeasurement(Measurement)));
  11325. connect(calibrator,SIGNAL(newData(Measurement)),this,SLOT(updateOutput(Measurement)));
  11326. calibrationDevice->setClockRate(6.0/(1.0+channelOfInterest));
  11327. calibrationDevice->start();
  11328. }
  11329. void DataqSdkChannelConfWidget::stopCalibration()
  11330. {
  11331. startButton->setEnabled(true);
  11332. stopButton->setEnabled(false);
  11333. resetButton->setEnabled(false);
  11334. calibrationDevice->deleteLater();
  11335. /*857:*/
  11336. #line 1181 "./dataqsdk.w"
  11337. rmCount= 0;
  11338. cmCount= 0;
  11339. rmin= std::numeric_limits<double> ::max();
  11340. rmax= std::numeric_limits<double> ::min();
  11341. rmean= 0;
  11342. cmin= std::numeric_limits<double> ::max();
  11343. cmax= std::numeric_limits<double> ::min();
  11344. cmean= 0;
  11345. /*:857*/
  11346. #line 1161 "./dataqsdk.w"
  11347. }
  11348. /*:855*//*856:*/
  11349. #line 1172 "./dataqsdk.w"
  11350. void DataqSdkChannelConfWidget::resetCalibration()
  11351. {
  11352. /*857:*/
  11353. #line 1181 "./dataqsdk.w"
  11354. rmCount= 0;
  11355. cmCount= 0;
  11356. rmin= std::numeric_limits<double> ::max();
  11357. rmax= std::numeric_limits<double> ::min();
  11358. rmean= 0;
  11359. cmin= std::numeric_limits<double> ::max();
  11360. cmax= std::numeric_limits<double> ::min();
  11361. cmean= 0;
  11362. /*:857*/
  11363. #line 1175 "./dataqsdk.w"
  11364. }
  11365. /*:856*//*858:*/
  11366. #line 1195 "./dataqsdk.w"
  11367. void DataqSdkChannelConfWidget::updateInput(Measurement measure)
  11368. {
  11369. double nv= measure.temperature();
  11370. currentMeasurement->setText(QString("%1").arg(nv));
  11371. rmin= qMin(nv,rmin);
  11372. minimumMeasurement->setText(QString("%1").arg(rmin));
  11373. rmax= qMax(nv,rmax);
  11374. maximumMeasurement->setText(QString("%1").arg(rmax));
  11375. rmean= ((rmean*rmCount)+nv)/(rmCount+1);
  11376. rmCount++;
  11377. averageMeasurement->setText(QString("%1").arg(rmean));
  11378. }
  11379. void DataqSdkChannelConfWidget::updateOutput(Measurement measure)
  11380. {
  11381. double nv= measure.temperature();
  11382. currentMapped->setText(QString("%1").arg(nv));
  11383. cmin= qMin(nv,cmin);
  11384. minimumMapped->setText(QString("%1").arg(cmin));
  11385. cmax= qMax(nv,cmax);
  11386. maximumMapped->setText(QString("%1").arg(cmax));
  11387. cmean= ((cmean*cmCount)+nv)/(cmCount+1);
  11388. cmCount++;
  11389. averageMapped->setText(QString("%1").arg(cmean));
  11390. }
  11391. /*:858*//*859:*/
  11392. #line 1224 "./dataqsdk.w"
  11393. void DataqSdkChannelConfWidget::updateColumnName(const QString&value)
  11394. {
  11395. updateAttribute("column",value);
  11396. }
  11397. /*:859*/
  11398. #line 606 "./typica.w"
  11399. /*883:*/
  11400. #line 393 "./scales.w"
  11401. SerialScaleConfWidget::SerialScaleConfWidget(DeviceTreeModel*model,
  11402. const QModelIndex&index)
  11403. :BasicDeviceConfigurationWidget(model,index),
  11404. port(new PortSelector),baud(new BaudSelector),parity(new ParitySelector),
  11405. flow(new FlowSelector),stop(new StopSelector)
  11406. {
  11407. QFormLayout*layout= new QFormLayout;
  11408. layout->addRow(tr("Port:"),port);
  11409. connect(port,SIGNAL(currentIndexChanged(QString)),
  11410. this,SLOT(updatePort(QString)));
  11411. connect(port,SIGNAL(editTextChanged(QString)),
  11412. this,SLOT(updatePort(QString)));
  11413. layout->addRow(tr("Baud:"),baud);
  11414. connect(baud,SIGNAL(currentIndexChanged(QString)),
  11415. this,SLOT(updateBaudRate(QString)));
  11416. layout->addRow(tr("Parity:"),parity);
  11417. connect(parity,SIGNAL(currentIndexChanged(int)),
  11418. this,SLOT(updateParity(int)));
  11419. layout->addRow(tr("Flow Control:"),flow);
  11420. connect(flow,SIGNAL(currentIndexChanged(int)),
  11421. this,SLOT(updateFlowControl(int)));
  11422. layout->addRow(tr("Stop Bits:"),stop);
  11423. connect(stop,SIGNAL(currentIndexChanged(int)),
  11424. this,SLOT(updateStopBits(int)));
  11425. /*708:*/
  11426. #line 15254 "./typica.w"
  11427. QDomElement referenceElement=
  11428. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11429. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11430. QDomElement node;
  11431. /*:708*/
  11432. #line 418 "./scales.w"
  11433. for(int i= 0;i<configData.size();i++)
  11434. {
  11435. node= configData.at(i).toElement();
  11436. if(node.attribute("name")=="port")
  11437. {
  11438. int j= port->findText(node.attribute("value"));
  11439. if(j>=0)
  11440. {
  11441. port->setCurrentIndex(j);
  11442. }
  11443. else
  11444. {
  11445. port->insertItem(0,node.attribute("value"));
  11446. port->setCurrentIndex(0);
  11447. }
  11448. }
  11449. else if(node.attribute("name")=="baudrate")
  11450. {
  11451. baud->setCurrentIndex(baud->findText(node.attribute("value")));
  11452. }
  11453. else if(node.attribute("name")=="parity")
  11454. {
  11455. parity->setCurrentIndex(parity->findData(node.attribute("value")));
  11456. }
  11457. else if(node.attribute("name")=="flowcontrol")
  11458. {
  11459. flow->setCurrentIndex(flow->findData(node.attribute("value")));
  11460. }
  11461. else if(node.attribute("name")=="stopbits")
  11462. {
  11463. stop->setCurrentIndex(stop->findData(node.attribute("value")));
  11464. }
  11465. }
  11466. updatePort(port->currentText());
  11467. updateBaudRate(baud->currentText());
  11468. updateParity(parity->currentIndex());
  11469. updateFlowControl(flow->currentIndex());
  11470. updateStopBits(stop->currentIndex());
  11471. setLayout(layout);
  11472. }
  11473. /*:883*//*884:*/
  11474. #line 462 "./scales.w"
  11475. void SerialScaleConfWidget::updatePort(const QString&newPort)
  11476. {
  11477. updateAttribute("port",newPort);
  11478. }
  11479. void SerialScaleConfWidget::updateBaudRate(const QString&rate)
  11480. {
  11481. updateAttribute("baudrate",rate);
  11482. }
  11483. void SerialScaleConfWidget::updateParity(int index)
  11484. {
  11485. updateAttribute("parity",parity->itemData(index).toString());
  11486. }
  11487. void SerialScaleConfWidget::updateFlowControl(int index)
  11488. {
  11489. updateAttribute("flowcontrol",flow->itemData(index).toString());
  11490. }
  11491. void SerialScaleConfWidget::updateStopBits(int index)
  11492. {
  11493. updateAttribute("stopbits",stop->itemData(index).toString());
  11494. }
  11495. /*:884*/
  11496. #line 607 "./typica.w"
  11497. /*896:*/
  11498. #line 195 "./valueannotation.w"
  11499. void ValueAnnotation::newMeasurement(Measurement measure)
  11500. {
  11501. for(int i= 0;i<values.size();i++)
  11502. {
  11503. if(measure.temperature()> values.at(i)-tolerance&&
  11504. measure.temperature()<values.at(i)+tolerance)
  11505. {
  11506. if(i!=lastIndex)
  11507. {
  11508. lastIndex= i;
  11509. emit annotation(annotations.at(i),measurementColumn,annotationColumn);
  11510. }
  11511. }
  11512. }
  11513. }
  11514. /*:896*//*897:*/
  11515. #line 216 "./valueannotation.w"
  11516. void ValueAnnotation::annotate()
  11517. {
  11518. if(lastIndex> -1)
  11519. {
  11520. emit annotation(annotations.at(lastIndex),measurementColumn,annotationColumn);
  11521. }
  11522. }
  11523. /*:897*//*898:*/
  11524. #line 228 "./valueannotation.w"
  11525. void ValueAnnotation::setAnnotation(double value,const QString&annotation)
  11526. {
  11527. values.append(value);
  11528. annotations.append(annotation);
  11529. }
  11530. /*:898*//*899:*/
  11531. #line 237 "./valueannotation.w"
  11532. void ValueAnnotation::setAnnotationColumn(int column)
  11533. {
  11534. annotationColumn= column;
  11535. }
  11536. void ValueAnnotation::setTemperatureColumn(int column)
  11537. {
  11538. measurementColumn= column;
  11539. }
  11540. void ValueAnnotation::setTolerance(double epsilon)
  11541. {
  11542. tolerance= epsilon;
  11543. }
  11544. /*:899*//*900:*/
  11545. #line 255 "./valueannotation.w"
  11546. ValueAnnotation::ValueAnnotation():QObject(),
  11547. lastIndex(-1),annotationColumn(2),measurementColumn(1),tolerance(0.05)
  11548. {
  11549. }
  11550. /*:900*/
  11551. #line 608 "./typica.w"
  11552. /*888:*/
  11553. #line 33 "./valueannotation.w"
  11554. ValueAnnotationConfWidget::ValueAnnotationConfWidget(DeviceTreeModel*model,
  11555. const QModelIndex&index)
  11556. :BasicDeviceConfigurationWidget(model,index),
  11557. tablemodel(new SaltModel(2))
  11558. {
  11559. QFormLayout*layout= new QFormLayout;
  11560. QLineEdit*source= new QLineEdit;
  11561. layout->addRow(tr("Source column name:"),source);
  11562. QCheckBox*noteOnStart= new QCheckBox(tr("Produce Start State Annotation"));
  11563. noteOnStart->setChecked(true);
  11564. layout->addRow(noteOnStart);
  11565. tablemodel->setHeaderData(0,Qt::Horizontal,"Value");
  11566. tablemodel->setHeaderData(1,Qt::Horizontal,"Annotation");
  11567. QTableView*annotationTable= new QTableView;
  11568. annotationTable->setModel(tablemodel);
  11569. NumericDelegate*delegate= new NumericDelegate;
  11570. annotationTable->setItemDelegateForColumn(0,delegate);
  11571. layout->addRow(tr("Annotations for values:"),annotationTable);
  11572. /*708:*/
  11573. #line 15254 "./typica.w"
  11574. QDomElement referenceElement=
  11575. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11576. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11577. QDomElement node;
  11578. /*:708*/
  11579. #line 52 "./valueannotation.w"
  11580. for(int i= 0;i<configData.size();i++)
  11581. {
  11582. node= configData.at(i).toElement();
  11583. if(node.attribute("name")=="source")
  11584. {
  11585. source->setText(node.attribute("value"));
  11586. }
  11587. else if(node.attribute("name")=="emitOnStart")
  11588. {
  11589. noteOnStart->setChecked(node.attribute("value")=="true"?true:false);
  11590. }
  11591. else if(node.attribute("name")=="measuredValues")
  11592. {
  11593. /*800:*/
  11594. #line 18286 "./typica.w"
  11595. QString data= node.attribute("value");
  11596. if(data.length()> 3)
  11597. {
  11598. data.chop(2);
  11599. data= data.remove(0,2);
  11600. }
  11601. QStringList itemList= data.split(",");
  11602. /*:800*/
  11603. #line 66 "./valueannotation.w"
  11604. int column= 0;
  11605. /*801:*/
  11606. #line 18298 "./typica.w"
  11607. for(int i= 0;i<itemList.size();i++)
  11608. {
  11609. tablemodel->setData(tablemodel->index(i,column),
  11610. QVariant(itemList.at(i).toDouble()),
  11611. Qt::DisplayRole);
  11612. }
  11613. /*:801*/
  11614. #line 68 "./valueannotation.w"
  11615. }
  11616. else if(node.attribute("name")=="annotations")
  11617. {
  11618. /*889:*/
  11619. #line 89 "./valueannotation.w"
  11620. QString data= node.attribute("value");
  11621. if(data.length()> 3)
  11622. {
  11623. data.chop(2);
  11624. data= data.remove(0,2);
  11625. }
  11626. QStringList itemList= data.split(",");
  11627. for(int i= 0;i<itemList.size();i++)
  11628. {
  11629. itemList[i]= itemList[i].simplified();
  11630. }
  11631. /*:889*/
  11632. #line 72 "./valueannotation.w"
  11633. int column= 1;
  11634. /*890:*/
  11635. #line 104 "./valueannotation.w"
  11636. for(int i= 0;i<itemList.size();i++)
  11637. {
  11638. tablemodel->setData(tablemodel->index(i,column),
  11639. QVariant(itemList.at(i)),
  11640. Qt::DisplayRole);
  11641. }
  11642. /*:890*/
  11643. #line 74 "./valueannotation.w"
  11644. }
  11645. }
  11646. updateSourceColumn(source->text());
  11647. updateStart(noteOnStart->isChecked());
  11648. updateAnnotations();
  11649. connect(source,SIGNAL(textEdited(QString)),this,SLOT(updateSourceColumn(QString)));
  11650. connect(noteOnStart,SIGNAL(toggled(bool)),this,SLOT(updateStart(bool)));
  11651. connect(tablemodel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(updateAnnotations()));
  11652. setLayout(layout);
  11653. }
  11654. /*:888*//*891:*/
  11655. #line 115 "./valueannotation.w"
  11656. void ValueAnnotationConfWidget::updateAnnotations()
  11657. {
  11658. updateAttribute("measuredValues",tablemodel->arrayLiteral(0,Qt::DisplayRole));
  11659. updateAttribute("annotations",tablemodel->arrayLiteral(1,Qt::DisplayRole));
  11660. }
  11661. /*:891*//*892:*/
  11662. #line 125 "./valueannotation.w"
  11663. void ValueAnnotationConfWidget::updateSourceColumn(const QString&source)
  11664. {
  11665. updateAttribute("source",source);
  11666. }
  11667. void ValueAnnotationConfWidget::updateStart(bool noteOnStart)
  11668. {
  11669. updateAttribute("emitOnStart",noteOnStart?"true":"false");
  11670. }
  11671. /*:892*/
  11672. #line 609 "./typica.w"
  11673. /*:4*//*821:*/
  11674. #line 265 "./rate.w"
  11675. /*817:*/
  11676. #line 191 "./rate.w"
  11677. RateOfChangeConfWidget::RateOfChangeConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  11678. :BasicDeviceConfigurationWidget(model,index)
  11679. {
  11680. QFormLayout*layout= new QFormLayout;
  11681. QLineEdit*column= new QLineEdit;
  11682. layout->addRow(tr("Primary series column name:"),column);
  11683. QSpinBox*cacheTime= new QSpinBox;
  11684. cacheTime->setMinimum(0);
  11685. cacheTime->setMaximum(300);
  11686. layout->addRow(tr("Cache time:"),cacheTime);
  11687. QSpinBox*scaleTime= new QSpinBox;
  11688. scaleTime->setMinimum(1);
  11689. scaleTime->setMaximum(300);
  11690. layout->addRow(tr("Scale time:"),scaleTime);
  11691. /*708:*/
  11692. #line 15254 "./typica.w"
  11693. QDomElement referenceElement=
  11694. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11695. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11696. QDomElement node;
  11697. /*:708*/
  11698. #line 206 "./rate.w"
  11699. for(int i= 0;i<configData.size();i++)
  11700. {
  11701. node= configData.at(i).toElement();
  11702. if(node.attribute("name")=="column")
  11703. {
  11704. column->setText(node.attribute("value"));
  11705. }
  11706. else if(node.attribute("name")=="cache")
  11707. {
  11708. cacheTime->setValue(node.attribute("value").toInt());
  11709. }
  11710. else if(node.attribute("name")=="scale")
  11711. {
  11712. scaleTime->setValue(node.attribute("value").toInt());
  11713. }
  11714. }
  11715. updateColumn(column->text());
  11716. updateCacheTime(cacheTime->text());
  11717. updateScaleTime(scaleTime->text());
  11718. connect(column,SIGNAL(textEdited(QString)),this,SLOT(updateColumn(QString)));
  11719. connect(cacheTime,SIGNAL(valueChanged(QString)),this,SLOT(updateCacheTime(QString)));
  11720. connect(scaleTime,SIGNAL(valueChanged(QString)),this,SLOT(updateScaleTime(QString)));
  11721. setLayout(layout);
  11722. }
  11723. /*:817*//*818:*/
  11724. #line 235 "./rate.w"
  11725. void RateOfChangeConfWidget::updateColumn(const QString&column)
  11726. {
  11727. updateAttribute("column",column);
  11728. }
  11729. void RateOfChangeConfWidget::updateCacheTime(const QString&seconds)
  11730. {
  11731. updateAttribute("cache",seconds);
  11732. }
  11733. void RateOfChangeConfWidget::updateScaleTime(const QString&seconds)
  11734. {
  11735. updateAttribute("scale",seconds);
  11736. }
  11737. /*:818*/
  11738. #line 266 "./rate.w"
  11739. #line 18421 "./typica.w"
  11740. #line 1 "./dataqsdk.w"
  11741. /*:821*/
  11742. #line 528 "./typica.w"
  11743. /*8:*/
  11744. #line 669 "./typica.w"
  11745. template<class TYPE> TYPE getself(QScriptContext*context)
  11746. {
  11747. TYPE self= qobject_cast<TYPE> (context->thisObject().toQObject());
  11748. return self;
  11749. }
  11750. template<> QTime getself(QScriptContext*context)
  11751. {
  11752. QTime self= context->thisObject().toVariant().toTime();
  11753. return self;
  11754. }
  11755. template<> SqlQueryConnection*getself(QScriptContext*context)
  11756. {
  11757. SqlQueryConnection*self=
  11758. (SqlQueryConnection*)qscriptvalue_cast<void*> (context->thisObject());
  11759. return self;
  11760. }
  11761. template<> QXmlQuery*getself(QScriptContext*context)
  11762. {
  11763. QXmlQuery*self=
  11764. (QXmlQuery*)qscriptvalue_cast<void*> (context->thisObject());
  11765. return self;
  11766. }
  11767. template<> QXmlStreamWriter*getself(QScriptContext*context)
  11768. {
  11769. QXmlStreamWriter*self=
  11770. (QXmlStreamWriter*)qscriptvalue_cast<void*> (context->thisObject());
  11771. return self;
  11772. }
  11773. template<> QXmlStreamReader*getself(QScriptContext*context)
  11774. {
  11775. QXmlStreamReader*self=
  11776. (QXmlStreamReader*)qscriptvalue_cast<void*> (context->thisObject());
  11777. return self;
  11778. }
  11779. /*:8*//*9:*/
  11780. #line 714 "./typica.w"
  11781. template<class TYPE> TYPE argument(int arg,QScriptContext*context)
  11782. {
  11783. TYPE argument= qobject_cast<TYPE> (context->argument(arg).toQObject());
  11784. return argument;
  11785. }
  11786. template<> QString argument(int arg,QScriptContext*context)
  11787. {
  11788. return context->argument(arg).toString();
  11789. }
  11790. template<> QVariant argument(int arg,QScriptContext*context)
  11791. {
  11792. return context->argument(arg).toVariant();
  11793. }
  11794. template<> int argument(int arg,QScriptContext*context)
  11795. {
  11796. return context->argument(arg).toInt32();
  11797. }
  11798. template<> SqlQueryConnection*argument(int arg,QScriptContext*context)
  11799. {
  11800. return(SqlQueryConnection*)
  11801. qscriptvalue_cast<void*> (context->argument(arg));
  11802. }
  11803. template<> QModelIndex argument(int arg,QScriptContext*context)
  11804. {
  11805. return qscriptvalue_cast<QModelIndex> (context->argument(arg));
  11806. }
  11807. template<> double argument(int arg,QScriptContext*context)
  11808. {
  11809. return(double)(context->argument(arg).toNumber());
  11810. }
  11811. template<> Units::Unit argument(int arg,QScriptContext*context)
  11812. {
  11813. return(Units::Unit)(context->argument(arg).toInt32());
  11814. }
  11815. /*:9*//*13:*/
  11816. #line 801 "./typica.w"
  11817. void setQObjectProperties(QScriptValue,QScriptEngine*)
  11818. {
  11819. }
  11820. /*:13*//*15:*/
  11821. #line 815 "./typica.w"
  11822. void setQPaintDeviceProperties(QScriptValue,QScriptEngine*)
  11823. {
  11824. }
  11825. void setQLayoutItemProperties(QScriptValue,QScriptEngine*)
  11826. {
  11827. }
  11828. /*:15*//*18:*/
  11829. #line 854 "./typica.w"
  11830. QScriptValue constructQWidget(QScriptContext*,QScriptEngine*engine)
  11831. {
  11832. QScriptValue object= engine->newQObject(new QWidget);
  11833. setQWidgetProperties(object,engine);
  11834. return object;
  11835. }
  11836. void setQWidgetProperties(QScriptValue value,QScriptEngine*engine)
  11837. {
  11838. setQObjectProperties(value,engine);
  11839. setQPaintDeviceProperties(value,engine);
  11840. value.setProperty("setLayout",engine->newFunction(QWidget_setLayout));
  11841. value.setProperty("activateWindow",
  11842. engine->newFunction(QWidget_activateWindow));
  11843. }
  11844. /*:18*//*19:*/
  11845. #line 876 "./typica.w"
  11846. QScriptValue QWidget_setLayout(QScriptContext*context,QScriptEngine*)
  11847. {
  11848. if(context->argumentCount()==1)
  11849. {
  11850. QWidget*self= getself<QWidget*> (context);
  11851. QLayout*layout= argument<QLayout*> (0,context);
  11852. if(layout)
  11853. {
  11854. self->setLayout(layout);
  11855. }
  11856. else
  11857. {
  11858. context->throwError("Incorrect argument type passed to "
  11859. "QWidget::setLayout(). This method requires "
  11860. "a QLayout.");
  11861. }
  11862. }
  11863. else
  11864. {
  11865. context->throwError("Incorrect number of arguments passed to "
  11866. "QWidget::setLayout(). This method takes one "
  11867. "QLayout as an argument.");
  11868. }
  11869. return QScriptValue();
  11870. }
  11871. QScriptValue QWidget_activateWindow(QScriptContext*context,
  11872. QScriptEngine*)
  11873. {
  11874. QWidget*self= getself<QWidget*> (context);
  11875. self->activateWindow();
  11876. return QScriptValue();
  11877. }
  11878. /*:19*//*21:*/
  11879. #line 958 "./typica.w"
  11880. ScriptQMainWindow::ScriptQMainWindow():QMainWindow(NULL),
  11881. cprompt(tr("Closing this window may result in loss of data. Continue?"))
  11882. {
  11883. }
  11884. void ScriptQMainWindow::saveSizeAndPosition(const QString&key)
  11885. {
  11886. QSettings settings;
  11887. settings.beginGroup(key);
  11888. settings.setValue("pos",pos());
  11889. settings.setValue("size",size());
  11890. settings.endGroup();
  11891. }
  11892. void ScriptQMainWindow::restoreSizeAndPosition(const QString&key)
  11893. {
  11894. QSettings settings;
  11895. settings.beginGroup(key);
  11896. if(settings.contains("size"))
  11897. {
  11898. resize(settings.value("size").toSize());
  11899. }
  11900. if(settings.contains("pos"))
  11901. {
  11902. move(settings.value("pos").toPoint());
  11903. }
  11904. settings.endGroup();
  11905. }
  11906. void ScriptQMainWindow::displayStatus(const QString&message)
  11907. {
  11908. statusBar()->showMessage(message);
  11909. }
  11910. void ScriptQMainWindow::showEvent(QShowEvent*event)
  11911. {
  11912. if(!event->spontaneous())
  11913. {
  11914. /*26:*/
  11915. #line 1070 "./typica.w"
  11916. QSettings settings;
  11917. restoreGeometry(settings.value(QString("geometries/%1").arg(objectName())).
  11918. toByteArray());
  11919. /*:26*/
  11920. #line 998 "./typica.w"
  11921. event->accept();
  11922. }
  11923. else
  11924. {
  11925. event->ignore();
  11926. }
  11927. }
  11928. void ScriptQMainWindow::show()
  11929. {
  11930. QMainWindow::show();
  11931. }
  11932. /*:21*//*22:*/
  11933. #line 1019 "./typica.w"
  11934. void ScriptQMainWindow::closeEvent(QCloseEvent*event)
  11935. {
  11936. if(isWindowModified()){
  11937. /*23:*/
  11938. #line 1033 "./typica.w"
  11939. QMessageBox::StandardButton result;
  11940. result= QMessageBox::warning(this,"Typica",closePrompt(),
  11941. QMessageBox::Ok|QMessageBox::Cancel);
  11942. if(result==QMessageBox::Cancel)
  11943. {
  11944. event->ignore();
  11945. return;
  11946. }
  11947. /*:23*/
  11948. #line 1023 "./typica.w"
  11949. }
  11950. emit aboutToClose();
  11951. /*25:*/
  11952. #line 1064 "./typica.w"
  11953. QSettings settings;
  11954. settings.setValue(QString("geometries/%1").arg(objectName()),saveGeometry());
  11955. /*:25*/
  11956. #line 1026 "./typica.w"
  11957. event->accept();
  11958. }
  11959. /*:22*//*24:*/
  11960. #line 1045 "./typica.w"
  11961. QString ScriptQMainWindow::closePrompt()
  11962. {
  11963. return cprompt;
  11964. }
  11965. void ScriptQMainWindow::setClosePrompt(QString prompt)
  11966. {
  11967. cprompt= prompt;
  11968. }
  11969. /*:24*//*29:*/
  11970. #line 1098 "./typica.w"
  11971. QScriptValue constructQMainWindow(QScriptContext*,QScriptEngine*engine)
  11972. {
  11973. QScriptValue object= engine->newQObject(new ScriptQMainWindow);
  11974. setQMainWindowProperties(object,engine);
  11975. return object;
  11976. }
  11977. void setQMainWindowProperties(QScriptValue value,QScriptEngine*engine)
  11978. {
  11979. setQWidgetProperties(value,engine);
  11980. value.setProperty("setCentralWidget",
  11981. engine->newFunction(QMainWindow_setCentralWidget));
  11982. value.setProperty("menuBar",engine->newFunction(QMainWindow_menuBar));
  11983. }
  11984. /*:29*//*30:*/
  11985. #line 1120 "./typica.w"
  11986. QScriptValue QMainWindow_setCentralWidget(QScriptContext*context,
  11987. QScriptEngine*)
  11988. {
  11989. if(context->argumentCount()==1)
  11990. {
  11991. QMainWindow*self= getself<QMainWindow*> (context);
  11992. QWidget*widget= argument<QWidget*> (0,context);
  11993. if(widget)
  11994. {
  11995. self->setCentralWidget(widget);
  11996. }
  11997. else
  11998. {
  11999. context->throwError("Incorrect argument type passed to "
  12000. "QMainWindow::setCentralWidget(). This "
  12001. "method requires a QWidget.");
  12002. }
  12003. }
  12004. else
  12005. {
  12006. context->throwError("Incorrect number of arguments passed to "
  12007. "QMainWindow::setCentralWidget(). This method "
  12008. "takes one QWidget as an argument.");
  12009. }
  12010. return QScriptValue();
  12011. }
  12012. /*:30*//*31:*/
  12013. #line 1154 "./typica.w"
  12014. QScriptValue QMainWindow_menuBar(QScriptContext*context,QScriptEngine*engine)
  12015. {
  12016. QScriptValue object;
  12017. if(context->argumentCount()==0)
  12018. {
  12019. QMainWindow*self= getself<QMainWindow*> (context);
  12020. QMenuBar*bar= self->menuBar();
  12021. object= engine->newQObject(bar);
  12022. setQMenuBarProperties(object,engine);
  12023. }
  12024. else
  12025. {
  12026. context->throwError("Incorrect number of arguments passed to "
  12027. "QMainWindow::menuBar(). This method takes no "
  12028. "arguments.");
  12029. }
  12030. return object;
  12031. }
  12032. /*:31*//*33:*/
  12033. #line 1184 "./typica.w"
  12034. void setQMenuBarProperties(QScriptValue value,QScriptEngine*engine)
  12035. {
  12036. setQWidgetProperties(value,engine);
  12037. value.setProperty("addMenu",engine->newFunction(QMenuBar_addMenu));
  12038. }
  12039. /*:33*//*34:*/
  12040. #line 1199 "./typica.w"
  12041. QScriptValue QMenuBar_addMenu(QScriptContext*context,QScriptEngine*engine)
  12042. {
  12043. QScriptValue object;
  12044. if(context->argumentCount()==1)
  12045. {
  12046. QMenuBar*self= getself<QMenuBar*> (context);
  12047. QString title= argument<QString> (0,context);
  12048. object= engine->newQObject(self->addMenu(title));
  12049. setQMenuProperties(object,engine);
  12050. }
  12051. else
  12052. {
  12053. context->throwError("Incorrect number of arguments passed to "
  12054. "QMenuBar::addMenu(). This method takes one "
  12055. "string as an argument.");
  12056. }
  12057. return object;
  12058. }
  12059. /*:34*//*36:*/
  12060. #line 1229 "./typica.w"
  12061. void setQMenuProperties(QScriptValue value,QScriptEngine*engine)
  12062. {
  12063. setQWidgetProperties(value,engine);
  12064. value.setProperty("addAction",engine->newFunction(QMenu_addAction));
  12065. value.setProperty("addSeparator",engine->newFunction(QMenu_addSeparator));
  12066. }
  12067. /*:36*//*37:*/
  12068. #line 1239 "./typica.w"
  12069. QScriptValue QMenu_addAction(QScriptContext*context,QScriptEngine*)
  12070. {
  12071. if(context->argumentCount()==1)
  12072. {
  12073. QMenu*self= getself<QMenu*> (context);
  12074. QAction*action= argument<QAction*> (0,context);
  12075. if(action)
  12076. {
  12077. self->addAction(action);
  12078. }
  12079. else
  12080. {
  12081. context->throwError("Incorrect argument type passed to "
  12082. "QMenu::addAction(). This method requires a "
  12083. "QAction.");
  12084. }
  12085. }
  12086. else
  12087. {
  12088. context->throwError("Incorrect number of arguments passed to "
  12089. "QMenu::addAction(). This method takes one "
  12090. "QAction as an argument.");
  12091. }
  12092. return QScriptValue();
  12093. }
  12094. QScriptValue QMenu_addSeparator(QScriptContext*context,QScriptEngine*)
  12095. {
  12096. if(context->argumentCount()==0)
  12097. {
  12098. QMenu*self= getself<QMenu*> (context);
  12099. self->addSeparator();
  12100. }
  12101. else
  12102. {
  12103. context->throwError("Incorrect number of arguments passed to "
  12104. "QMenu::addSeparator(). This method takes no "
  12105. "arguments.");
  12106. }
  12107. return QScriptValue();
  12108. }
  12109. /*:37*//*40:*/
  12110. #line 1301 "./typica.w"
  12111. QScriptValue constructQFrame(QScriptContext*,QScriptEngine*engine)
  12112. {
  12113. QScriptValue object= engine->newQObject(new QFrame);
  12114. setQFrameProperties(object,engine);
  12115. return object;
  12116. }
  12117. void setQFrameProperties(QScriptValue value,QScriptEngine*engine)
  12118. {
  12119. setQWidgetProperties(value,engine);
  12120. }
  12121. /*:40*//*43:*/
  12122. #line 1335 "./typica.w"
  12123. QScriptValue constructQLabel(QScriptContext*context,QScriptEngine*engine)
  12124. {
  12125. QString text;
  12126. if(context->argumentCount()==1)
  12127. {
  12128. text= argument<QString> (0,context);
  12129. }
  12130. QScriptValue object= engine->newQObject(new QLabel(text));
  12131. setQLabelProperties(object,engine);
  12132. return object;
  12133. }
  12134. void setQLabelProperties(QScriptValue value,QScriptEngine*engine)
  12135. {
  12136. setQFrameProperties(value,engine);
  12137. }
  12138. /*:43*//*46:*/
  12139. #line 1372 "./typica.w"
  12140. QScriptValue constructQLineEdit(QScriptContext*,QScriptEngine*engine)
  12141. {
  12142. QScriptValue object= engine->newQObject(new QLineEdit());
  12143. setQLineEditProperties(object,engine);
  12144. return object;
  12145. }
  12146. /*:46*//*47:*/
  12147. #line 1383 "./typica.w"
  12148. void setQLineEditProperties(QScriptValue value,QScriptEngine*engine)
  12149. {
  12150. setQWidgetProperties(value,engine);
  12151. }
  12152. /*:47*//*50:*/
  12153. #line 1417 "./typica.w"
  12154. QScriptValue constructQSplitter(QScriptContext*,QScriptEngine*engine)
  12155. {
  12156. QScriptValue object= engine->newQObject(new QSplitter);
  12157. setQSplitterProperties(object,engine);
  12158. return object;
  12159. }
  12160. void setQSplitterProperties(QScriptValue value,QScriptEngine*engine)
  12161. {
  12162. setQFrameProperties(value,engine);
  12163. value.setProperty("addWidget",engine->newFunction(QSplitter_addWidget));
  12164. value.setProperty("saveState",engine->newFunction(QSplitter_saveState));
  12165. value.setProperty("restoreState",
  12166. engine->newFunction(QSplitter_restoreState));
  12167. }
  12168. /*:50*//*51:*/
  12169. #line 1437 "./typica.w"
  12170. QScriptValue QSplitter_addWidget(QScriptContext*context,QScriptEngine*)
  12171. {
  12172. if(context->argumentCount()==1)
  12173. {
  12174. QSplitter*self= getself<QSplitter*> (context);
  12175. QWidget*widget= argument<QWidget*> (0,context);
  12176. if(widget)
  12177. {
  12178. self->addWidget(widget);
  12179. }
  12180. else
  12181. {
  12182. context->throwError("Incorrect argument type passed to "
  12183. "QSplitter::addWidget(). This method "
  12184. "requires a QWidget.");
  12185. }
  12186. }
  12187. else
  12188. {
  12189. context->throwError("Incorrect number of arguments passed to "
  12190. "QSplitter::addWidget(). This method takes one "
  12191. "QWidget as an argument.");
  12192. }
  12193. return QScriptValue();
  12194. }
  12195. /*:51*//*52:*/
  12196. #line 1470 "./typica.w"
  12197. QScriptValue QSplitter_saveState(QScriptContext*context,QScriptEngine*)
  12198. {
  12199. if(context->argumentCount()==1)
  12200. {
  12201. QSplitter*self= getself<QSplitter*> (context);
  12202. QString key= argument<QString> (0,context);
  12203. QSettings settings;
  12204. settings.setValue(key,self->saveState());
  12205. }
  12206. else
  12207. {
  12208. context->throwError("Incorrect number of arguments passed to "
  12209. "QSplitter::saveState(). This method takes one "
  12210. "string as an argument.");
  12211. }
  12212. return QScriptValue();
  12213. }
  12214. QScriptValue QSplitter_restoreState(QScriptContext*context,QScriptEngine*)
  12215. {
  12216. if(context->argumentCount()==1)
  12217. {
  12218. QSplitter*self= getself<QSplitter*> (context);
  12219. QString key= argument<QString> (0,context);
  12220. QSettings settings;
  12221. self->restoreState(settings.value(key).toByteArray());
  12222. }
  12223. else
  12224. {
  12225. context->throwError("Incorrect number of arguments passed to "
  12226. "QSplitter::restoreState(). This method takes "
  12227. "one string as an argument.");
  12228. }
  12229. return QScriptValue();
  12230. }
  12231. /*:52*//*54:*/
  12232. #line 1523 "./typica.w"
  12233. void setQLayoutProperties(QScriptValue value,QScriptEngine*engine)
  12234. {
  12235. setQLayoutItemProperties(value,engine);
  12236. value.setProperty("addWidget",engine->newFunction(QLayout_addWidget));
  12237. }
  12238. QScriptValue QLayout_addWidget(QScriptContext*context,QScriptEngine*)
  12239. {
  12240. if(context->argumentCount()==1)
  12241. {
  12242. QLayout*self= getself<QLayout*> (context);
  12243. QWidget*widget= argument<QWidget*> (0,context);
  12244. if(widget)
  12245. {
  12246. self->addWidget(widget);
  12247. }
  12248. else
  12249. {
  12250. context->throwError("Incorrect argument type passed to "
  12251. "QLayout::addWidget(). This method requires "
  12252. "a QWidget.");
  12253. }
  12254. }
  12255. else
  12256. {
  12257. context->throwError("Incorrect number of arguments passed to "
  12258. "QLayout::addWidget(). This method takes one "
  12259. "QWidget as an argument.");
  12260. }
  12261. return QScriptValue();
  12262. }
  12263. /*:54*//*57:*/
  12264. #line 1590 "./typica.w"
  12265. QScriptValue constructQBoxLayout(QScriptContext*,QScriptEngine*engine)
  12266. {
  12267. QScriptValue object=
  12268. engine->newQObject(new QBoxLayout(QBoxLayout::LeftToRight));
  12269. setQBoxLayoutProperties(object,engine);
  12270. return object;
  12271. }
  12272. void setQBoxLayoutProperties(QScriptValue value,QScriptEngine*engine)
  12273. {
  12274. setQLayoutProperties(value,engine);
  12275. value.setProperty("addLayout",engine->newFunction(QBoxLayout_addLayout));
  12276. value.setProperty("addWidget",engine->newFunction(QBoxLayout_addWidget));
  12277. }
  12278. QScriptValue QBoxLayout_addLayout(QScriptContext*context,QScriptEngine*)
  12279. {
  12280. if(context->argumentCount()> 0&&context->argumentCount()<3)
  12281. {
  12282. QBoxLayout*self= getself<QBoxLayout*> (context);
  12283. QLayout*layout= argument<QLayout*> (0,context);
  12284. int stretch= 0;
  12285. if(context->argumentCount()==2)
  12286. {
  12287. stretch= argument<int> (1,context);
  12288. }
  12289. if(layout)
  12290. {
  12291. self->addLayout(layout,stretch);
  12292. }
  12293. else
  12294. {
  12295. context->throwError("Incorrect argument type passed to "
  12296. "QLayout::addLayout(). This method requires "
  12297. "a QLayout.");
  12298. }
  12299. }
  12300. else
  12301. {
  12302. context->throwError("Incorrect number of arguments passed to "
  12303. "QLayout::addLayout(). This method takes one "
  12304. "QLayout as an argument and optionally one integer.");
  12305. }
  12306. return QScriptValue();
  12307. }
  12308. /*:57*//*58:*/
  12309. #line 1641 "./typica.w"
  12310. QScriptValue QBoxLayout_addWidget(QScriptContext*context,QScriptEngine*)
  12311. {
  12312. if(context->argumentCount()> 0&&context->argumentCount()<4)
  12313. {
  12314. QBoxLayout*self= getself<QBoxLayout*> (context);
  12315. QWidget*widget= argument<QWidget*> (0,context);
  12316. int stretch= 0;
  12317. Qt::Alignment alignment= 0;
  12318. if(context->argumentCount()> 1)
  12319. {
  12320. stretch= argument<int> (1,context);
  12321. }
  12322. if(context->argumentCount()> 2)
  12323. {
  12324. alignment= (Qt::Alignment)(argument<int> (2,context));
  12325. }
  12326. if(widget)
  12327. {
  12328. self->addWidget(widget,stretch,alignment);
  12329. }
  12330. else
  12331. {
  12332. context->throwError("Incorrect argument type passed to "
  12333. "QBoxLayout::addWidget(). This method requires "
  12334. "a QWidget.");
  12335. }
  12336. }
  12337. else
  12338. {
  12339. context->throwError("Incorrect number of arguments passed to "
  12340. "QBoxLayout::addWidget(). This method takes one "
  12341. "QWidget and optionally up to two integers as "
  12342. "arguments.");
  12343. }
  12344. return QScriptValue();
  12345. }
  12346. /*:58*//*61:*/
  12347. #line 1705 "./typica.w"
  12348. QScriptValue constructQAction(QScriptContext*,QScriptEngine*engine)
  12349. {
  12350. QScriptValue object= engine->newQObject(new QAction(NULL));
  12351. setQActionProperties(object,engine);
  12352. return object;
  12353. }
  12354. void setQActionProperties(QScriptValue value,QScriptEngine*engine)
  12355. {
  12356. setQObjectProperties(value,engine);
  12357. value.setProperty("setShortcut",engine->newFunction(QAction_setShortcut));
  12358. }
  12359. QScriptValue QAction_setShortcut(QScriptContext*context,QScriptEngine*)
  12360. {
  12361. if(context->argumentCount()==1)
  12362. {
  12363. QAction*self= getself<QAction*> (context);
  12364. self->setShortcut(argument<QString> (0,context));
  12365. }
  12366. else
  12367. {
  12368. context->throwError("Incorrect number of arguments passed to "
  12369. "QAction::setShortcut(). This method takes one "
  12370. "string as an argument.");
  12371. }
  12372. return QScriptValue();
  12373. }
  12374. /*:61*//*64:*/
  12375. #line 1763 "./typica.w"
  12376. QScriptValue QFileDialog_getOpenFileName(QScriptContext*context,
  12377. QScriptEngine*engine)
  12378. {
  12379. QScriptValue retval;
  12380. if(context->argumentCount()==3)
  12381. {
  12382. QWidget*widget= argument<QWidget*> (0,context);
  12383. if(widget)
  12384. {
  12385. QString caption= argument<QString> (1,context);
  12386. QString dir= argument<QString> (2,context);
  12387. retval= QScriptValue(engine,
  12388. QFileDialog::getOpenFileName(widget,caption,
  12389. dir,"",0,0));
  12390. setQFileDialogProperties(retval,engine);
  12391. }
  12392. else
  12393. {
  12394. context->throwError("Incorrect argument type passed to "
  12395. "QFileDialog::getOpenFileName(). The first "
  12396. "argument to this method must be a QWidget.");
  12397. }
  12398. }
  12399. else
  12400. {
  12401. context->throwError("Incorrect number of arguments passed to "
  12402. "QFileDialog::getOpenFileName(). This method "
  12403. "takes one QWidget followed by two strings for a "
  12404. "total of three arguments.");
  12405. }
  12406. return retval;
  12407. }
  12408. /*:64*//*65:*/
  12409. #line 1799 "./typica.w"
  12410. QScriptValue QFileDialog_getSaveFileName(QScriptContext*context,
  12411. QScriptEngine*engine)
  12412. {
  12413. QScriptValue retval;
  12414. if(context->argumentCount()==3)
  12415. {
  12416. QWidget*widget= argument<QWidget*> (0,context);
  12417. if(widget)
  12418. {
  12419. QString caption= argument<QString> (1,context);
  12420. QString dir= argument<QString> (2,context);
  12421. retval= QScriptValue(engine,
  12422. QFileDialog::getSaveFileName(widget,caption,
  12423. dir,"",0,0));
  12424. setQFileDialogProperties(retval,engine);
  12425. }
  12426. else
  12427. {
  12428. context->throwError("Incorrect argument type passed to "
  12429. "QFileDialog::getSaveFileName(). The first "
  12430. "argument to this method must be a QWidget.");
  12431. }
  12432. }
  12433. else
  12434. {
  12435. context->throwError("Incorrect number of arguments passed to "
  12436. "QFileDialog::getSaveFileName(). This method "
  12437. "takes one QWidget followed by two strings for a "
  12438. "total of three arguments.");
  12439. }
  12440. return retval;
  12441. }
  12442. /*:65*//*66:*/
  12443. #line 1836 "./typica.w"
  12444. void setQFileDialogProperties(QScriptValue value,QScriptEngine*engine)
  12445. {
  12446. setQDialogProperties(value,engine);
  12447. }
  12448. void setQDialogProperties(QScriptValue value,QScriptEngine*engine)
  12449. {
  12450. setQWidgetProperties(value,engine);
  12451. }
  12452. /*:66*//*69:*/
  12453. #line 1871 "./typica.w"
  12454. QScriptValue constructQFile(QScriptContext*context,QScriptEngine*engine)
  12455. {
  12456. QScriptValue object=
  12457. engine->newQObject(new QFile(argument<QString> (0,context)));
  12458. setQFileProperties(object,engine);
  12459. return object;
  12460. }
  12461. /*:69*//*70:*/
  12462. #line 1882 "./typica.w"
  12463. void setQFileProperties(QScriptValue value,QScriptEngine*engine)
  12464. {
  12465. setQIODeviceProperties(value,engine);
  12466. value.setProperty("remove",engine->newFunction(QFile_remove));
  12467. }
  12468. QScriptValue QFile_remove(QScriptContext*context,QScriptEngine*engine)
  12469. {
  12470. QFile*self= getself<QFile*> (context);
  12471. bool retval= self->remove();
  12472. return QScriptValue(engine,retval);
  12473. }
  12474. /*:70*//*71:*/
  12475. #line 1904 "./typica.w"
  12476. void setQIODeviceProperties(QScriptValue value,QScriptEngine*engine)
  12477. {
  12478. setQObjectProperties(value,engine);
  12479. value.setProperty("open",engine->newFunction(QIODevice_open));
  12480. value.setProperty("close",engine->newFunction(QIODevice_close));
  12481. value.setProperty("readToString",
  12482. engine->newFunction(QIODevice_readToString));
  12483. }
  12484. /*:71*//*72:*/
  12485. #line 1919 "./typica.w"
  12486. QScriptValue QIODevice_open(QScriptContext*context,QScriptEngine*)
  12487. {
  12488. QIODevice*self= getself<QIODevice*> (context);
  12489. if(context->argumentCount()==1)
  12490. {
  12491. switch(argument<int> (0,context))
  12492. {
  12493. case 1:
  12494. self->open(QIODevice::ReadOnly);
  12495. break;
  12496. case 2:
  12497. self->open(QIODevice::WriteOnly);
  12498. break;
  12499. case 3:
  12500. self->open(QIODevice::ReadWrite);
  12501. break;
  12502. default:
  12503. break;
  12504. }
  12505. }
  12506. else
  12507. {
  12508. self->open(QIODevice::ReadWrite);
  12509. }
  12510. return QScriptValue();
  12511. }
  12512. QScriptValue QIODevice_close(QScriptContext*context,QScriptEngine*)
  12513. {
  12514. QIODevice*self= getself<QIODevice*> (context);
  12515. self->close();
  12516. return QScriptValue();
  12517. }
  12518. /*:72*//*73:*/
  12519. #line 1958 "./typica.w"
  12520. QScriptValue QIODevice_readToString(QScriptContext*context,QScriptEngine*)
  12521. {
  12522. QIODevice*self= getself<QIODevice*> (context);
  12523. self->reset();
  12524. return QScriptValue(QString(self->readAll()));
  12525. }
  12526. /*:73*//*76:*/
  12527. #line 1988 "./typica.w"
  12528. QScriptValue constructQBuffer(QScriptContext*context,QScriptEngine*engine)
  12529. {
  12530. QByteArray*array= new QByteArray(argument<QString> (0,context).toAscii());
  12531. QScriptValue object= engine->newQObject(new QBuffer(array));
  12532. setQBufferProperties(object,engine);
  12533. return object;
  12534. }
  12535. void setQBufferProperties(QScriptValue value,QScriptEngine*engine)
  12536. {
  12537. setQIODeviceProperties(value,engine);
  12538. value.setProperty("setData",engine->newFunction(QBuffer_setData));
  12539. }
  12540. QScriptValue QBuffer_setData(QScriptContext*context,QScriptEngine*)
  12541. {
  12542. QBuffer*self= getself<QBuffer*> (context);
  12543. self->setData(argument<QString> (0,context).toAscii());
  12544. return QScriptValue();
  12545. }
  12546. /*:76*//*79:*/
  12547. #line 2037 "./typica.w"
  12548. QScriptValue constructXQuery(QScriptContext*,QScriptEngine*engine)
  12549. {
  12550. QScriptValue object= engine->toScriptValue<void*> (new QXmlQuery);
  12551. setXQueryProperties(object,engine);
  12552. return object;
  12553. }
  12554. QScriptValue XQuery_invalidate(QScriptContext*context,QScriptEngine*)
  12555. {
  12556. QXmlQuery*self= getself<QXmlQuery*> (context);
  12557. delete self;
  12558. return QScriptValue();
  12559. }
  12560. void setXQueryProperties(QScriptValue value,QScriptEngine*engine)
  12561. {
  12562. value.setProperty("bind",engine->newFunction(XQuery_bind));
  12563. value.setProperty("exec",engine->newFunction(XQuery_exec));
  12564. value.setProperty("setQuery",engine->newFunction(XQuery_setQuery));
  12565. value.setProperty("invalidate",engine->newFunction(XQuery_invalidate));
  12566. }
  12567. /*:79*//*80:*/
  12568. #line 2063 "./typica.w"
  12569. QScriptValue XQuery_bind(QScriptContext*context,QScriptEngine*)
  12570. {
  12571. QXmlQuery*self= getself<QXmlQuery*> (context);
  12572. QIODevice*buffer= argument<QIODevice*> (1,context);
  12573. self->bindVariable(argument<QString> (0,context),buffer);
  12574. return QScriptValue();
  12575. }
  12576. /*:80*//*81:*/
  12577. #line 2074 "./typica.w"
  12578. QScriptValue XQuery_setQuery(QScriptContext*context,QScriptEngine*)
  12579. {
  12580. QXmlQuery*self= getself<QXmlQuery*> (context);
  12581. self->setQuery(argument<QString> (0,context));
  12582. return QScriptValue();
  12583. }
  12584. /*:81*//*82:*/
  12585. #line 2084 "./typica.w"
  12586. QScriptValue XQuery_exec(QScriptContext*context,QScriptEngine*)
  12587. {
  12588. QXmlQuery*self= getself<QXmlQuery*> (context);
  12589. QString result;
  12590. self->evaluateTo(&result);
  12591. return QScriptValue(result);
  12592. }
  12593. /*:82*//*85:*/
  12594. #line 2139 "./typica.w"
  12595. QScriptValue constructXmlWriter(QScriptContext*context,QScriptEngine*engine)
  12596. {
  12597. QXmlStreamWriter*retval;
  12598. if(context->argumentCount()==1)
  12599. {
  12600. retval= new QXmlStreamWriter(argument<QIODevice*> (0,context));
  12601. }
  12602. else
  12603. {
  12604. retval= new QXmlStreamWriter;
  12605. }
  12606. QScriptValue object= engine->toScriptValue<void*> (retval);
  12607. setXmlWriterProperties(object,engine);
  12608. return object;
  12609. }
  12610. void setXmlWriterProperties(QScriptValue value,QScriptEngine*engine)
  12611. {
  12612. value.setProperty("setDevice",engine->newFunction(XmlWriter_setDevice));
  12613. value.setProperty("writeAttribute",
  12614. engine->newFunction(XmlWriter_writeAttribute));
  12615. value.setProperty("writeCDATA",engine->newFunction(XmlWriter_writeCDATA));
  12616. value.setProperty("writeCharacters",
  12617. engine->newFunction(XmlWriter_writeCharacters));
  12618. value.setProperty("writeDTD",engine->newFunction(XmlWriter_writeDTD));
  12619. value.setProperty("writeEmptyElement",
  12620. engine->newFunction(XmlWriter_writeEmptyElement));
  12621. value.setProperty("writeEndDocument",
  12622. engine->newFunction(XmlWriter_writeEndDocument));
  12623. value.setProperty("writeEndElement",
  12624. engine->newFunction(XmlWriter_writeEndElement));
  12625. value.setProperty("writeEntityReference",
  12626. engine->newFunction(XmlWriter_writeEntityReference));
  12627. value.setProperty("writeProcessingInstruction",
  12628. engine->newFunction(XmlWriter_writeProcessingInstruction));
  12629. value.setProperty("writeStartDocument",
  12630. engine->newFunction(XmlWriter_writeStartDocument));
  12631. value.setProperty("writeStartElement",
  12632. engine->newFunction(XmlWriter_writeStartElement));
  12633. value.setProperty("writeTextElement",
  12634. engine->newFunction(XmlWriter_writeTextElement));
  12635. }
  12636. /*:85*//*86:*/
  12637. #line 2186 "./typica.w"
  12638. QScriptValue XmlWriter_setDevice(QScriptContext*context,QScriptEngine*)
  12639. {
  12640. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  12641. QIODevice*device= argument<QIODevice*> (0,context);
  12642. self->setDevice(device);
  12643. return QScriptValue();
  12644. }
  12645. /*:86*//*87:*/
  12646. #line 2200 "./typica.w"
  12647. QScriptValue XmlWriter_writeStartDocument(QScriptContext*context,
  12648. QScriptEngine*)
  12649. {
  12650. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  12651. self->writeStartDocument(argument<QString> (0,context));
  12652. return QScriptValue();
  12653. }
  12654. QScriptValue XmlWriter_writeEndDocument(QScriptContext*context,
  12655. QScriptEngine*)
  12656. {
  12657. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  12658. self->writeEndDocument();
  12659. return QScriptValue();
  12660. }
  12661. /*:87*//*88:*/
  12662. #line 2219 "./typica.w"
  12663. QScriptValue XmlWriter_writeDTD(QScriptContext*context,QScriptEngine*)
  12664. {
  12665. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  12666. self->writeDTD(argument<QString> (0,context));
  12667. return QScriptValue();
  12668. }
  12669. /*:88*//*89:*/
  12670. #line 2230 "./typica.w"
  12671. QScriptValue XmlWriter_writeStartElement(QScriptContext*context,
  12672. QScriptEngine*)
  12673. {
  12674. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  12675. self->writeStartElement(argument<QString> (0,context));
  12676. return QScriptValue();
  12677. }
  12678. QScriptValue XmlWriter_writeAttribute(QScriptContext*context,QScriptEngine*)
  12679. {
  12680. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  12681. self->writeAttribute(argument<QString> (0,context),
  12682. argument<QString> (1,context));
  12683. return QScriptValue();
  12684. }
  12685. QScriptValue XmlWriter_writeCharacters(QScriptContext*context,QScriptEngine*)
  12686. {
  12687. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  12688. self->writeCharacters(argument<QString> (0,context));
  12689. return QScriptValue();
  12690. }
  12691. QScriptValue XmlWriter_writeEndElement(QScriptContext*context,QScriptEngine*)
  12692. {
  12693. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  12694. self->writeEndElement();
  12695. return QScriptValue();
  12696. }
  12697. /*:89*//*90:*/
  12698. #line 2266 "./typica.w"
  12699. QScriptValue XmlWriter_writeEmptyElement(QScriptContext*context,
  12700. QScriptEngine*)
  12701. {
  12702. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  12703. self->writeEmptyElement(argument<QString> (0,context));
  12704. return QScriptValue();
  12705. }
  12706. QScriptValue XmlWriter_writeTextElement(QScriptContext*context,
  12707. QScriptEngine*)
  12708. {
  12709. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  12710. self->writeTextElement(argument<QString> (0,context),
  12711. argument<QString> (1,context));
  12712. return QScriptValue();
  12713. }
  12714. /*:90*//*91:*/
  12715. #line 2287 "./typica.w"
  12716. QScriptValue XmlWriter_writeCDATA(QScriptContext*context,QScriptEngine*)
  12717. {
  12718. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  12719. self->writeCDATA(argument<QString> (0,context));
  12720. return QScriptValue();
  12721. }
  12722. QScriptValue XmlWriter_writeEntityReference(QScriptContext*context,
  12723. QScriptEngine*)
  12724. {
  12725. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  12726. self->writeEntityReference(argument<QString> (0,context));
  12727. return QScriptValue();
  12728. }
  12729. QScriptValue XmlWriter_writeProcessingInstruction(QScriptContext*context,
  12730. QScriptEngine*)
  12731. {
  12732. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  12733. self->writeProcessingInstruction(argument<QString> (0,context),
  12734. argument<QString> (1,context));
  12735. return QScriptValue();
  12736. }
  12737. /*:91*//*94:*/
  12738. #line 2346 "./typica.w"
  12739. QScriptValue constructXmlReader(QScriptContext*context,QScriptEngine*engine)
  12740. {
  12741. QXmlStreamReader*retval=
  12742. new QXmlStreamReader(argument<QIODevice*> (0,context));
  12743. QScriptValue object= engine->toScriptValue<void*> (retval);
  12744. setXmlReaderProperties(object,engine);
  12745. return object;
  12746. }
  12747. void setXmlReaderProperties(QScriptValue value,QScriptEngine*engine)
  12748. {
  12749. value.setProperty("atEnd",engine->newFunction(XmlReader_atEnd));
  12750. value.setProperty("attribute",engine->newFunction(XmlReader_attribute));
  12751. value.setProperty("hasAttribute",
  12752. engine->newFunction(XmlReader_hasAttribute));
  12753. value.setProperty("isDTD",engine->newFunction(XmlReader_isDTD));
  12754. value.setProperty("isStartElement",
  12755. engine->newFunction(XmlReader_isStartElement));
  12756. value.setProperty("name",engine->newFunction(XmlReader_name));
  12757. value.setProperty("readElementText",
  12758. engine->newFunction(XmlReader_readElementText));
  12759. value.setProperty("readNext",
  12760. engine->newFunction(XmlReader_readNext));
  12761. value.setProperty("text",engine->newFunction(XmlReader_text));
  12762. }
  12763. /*:94*//*95:*/
  12764. #line 2376 "./typica.w"
  12765. QScriptValue XmlReader_attribute(QScriptContext*context,QScriptEngine*)
  12766. {
  12767. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  12768. QString retval=
  12769. self->attributes().value(argument<QString> (0,context)).toString();
  12770. return QScriptValue(retval);
  12771. }
  12772. QScriptValue XmlReader_hasAttribute(QScriptContext*context,QScriptEngine*)
  12773. {
  12774. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  12775. bool retval=
  12776. self->attributes().hasAttribute(argument<QString> (0,context));
  12777. return QScriptValue(retval);
  12778. }
  12779. /*:95*//*96:*/
  12780. #line 2396 "./typica.w"
  12781. QScriptValue XmlReader_atEnd(QScriptContext*context,QScriptEngine*)
  12782. {
  12783. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  12784. return QScriptValue(self->atEnd());
  12785. }
  12786. QScriptValue XmlReader_isDTD(QScriptContext*context,QScriptEngine*)
  12787. {
  12788. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  12789. return QScriptValue(self->isDTD());
  12790. }
  12791. QScriptValue XmlReader_isStartElement(QScriptContext*context,QScriptEngine*)
  12792. {
  12793. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  12794. return QScriptValue(self->isStartElement());
  12795. }
  12796. /*:96*//*97:*/
  12797. #line 2417 "./typica.w"
  12798. QScriptValue XmlReader_readNext(QScriptContext*context,QScriptEngine*)
  12799. {
  12800. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  12801. self->readNext();
  12802. return QScriptValue();
  12803. }
  12804. /*:97*//*98:*/
  12805. #line 2427 "./typica.w"
  12806. QScriptValue XmlReader_name(QScriptContext*context,QScriptEngine*)
  12807. {
  12808. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  12809. return QScriptValue(self->name().toString());
  12810. }
  12811. QScriptValue XmlReader_readElementText(QScriptContext*context,QScriptEngine*)
  12812. {
  12813. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  12814. return QScriptValue(self->readElementText());
  12815. }
  12816. QScriptValue XmlReader_text(QScriptContext*context,QScriptEngine*)
  12817. {
  12818. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  12819. return QScriptValue(self->text().toString());
  12820. }
  12821. /*:98*//*101:*/
  12822. #line 2469 "./typica.w"
  12823. void setQSettingsProperties(QScriptValue value,QScriptEngine*engine)
  12824. {
  12825. setQObjectProperties(value,engine);
  12826. value.setProperty("value",engine->newFunction(QSettings_value));
  12827. value.setProperty("setValue",engine->newFunction(QSettings_setValue));
  12828. }
  12829. /*:101*//*102:*/
  12830. #line 2481 "./typica.w"
  12831. QScriptValue QSettings_value(QScriptContext*context,QScriptEngine*engine)
  12832. {
  12833. QScriptValue object;
  12834. if(context->argumentCount()==1||context->argumentCount()==2)
  12835. {
  12836. QSettings settings;
  12837. QString key= argument<QString> (0,context);
  12838. QVariant value;
  12839. QVariant retval;
  12840. if(context->argumentCount()> 1)
  12841. {
  12842. value= argument<QVariant> (1,context);
  12843. retval= settings.value(key,value);
  12844. }
  12845. else
  12846. {
  12847. retval= settings.value(key);
  12848. }
  12849. object= engine->newVariant(retval);
  12850. }
  12851. else
  12852. {
  12853. context->throwError("Incorrect number of arguments passed to "
  12854. "QSettings::value(). This method takes one "
  12855. "string and one optional variant type.");
  12856. }
  12857. return object;
  12858. }
  12859. QScriptValue QSettings_setValue(QScriptContext*context,QScriptEngine*)
  12860. {
  12861. if(context->argumentCount()==2)
  12862. {
  12863. QSettings settings;
  12864. QString key= argument<QString> (0,context);
  12865. QVariant value= argument<QVariant> (1,context);
  12866. settings.setValue(key,value);
  12867. }
  12868. else
  12869. {
  12870. context->throwError("Incorrect number of arguments passed to "
  12871. "QSettings::setValue(). This method takes one "
  12872. "string and one variant type for a total of two "
  12873. "arguments.");
  12874. }
  12875. return QScriptValue();
  12876. }
  12877. /*:102*//*105:*/
  12878. #line 2550 "./typica.w"
  12879. QScriptValue constructQLCDNumber(QScriptContext*,QScriptEngine*engine)
  12880. {
  12881. QScriptValue object= engine->newQObject(new QLCDNumber());
  12882. setQLCDNumberProperties(object,engine);
  12883. return object;
  12884. }
  12885. void setQLCDNumberProperties(QScriptValue value,QScriptEngine*engine)
  12886. {
  12887. setQFrameProperties(value,engine);
  12888. }
  12889. /*:105*//*108:*/
  12890. #line 2608 "./typica.w"
  12891. QScriptValue constructQTime(QScriptContext*context,
  12892. QScriptEngine*engine)
  12893. {
  12894. QScriptValue object;
  12895. if(context->argumentCount()==0||
  12896. (context->argumentCount()>=2&&context->argumentCount()<=4))
  12897. {
  12898. int arg1= 0;
  12899. int arg2= 0;
  12900. int arg3= 0;
  12901. int arg4= 0;
  12902. switch(context->argumentCount())
  12903. {
  12904. case 4:
  12905. arg4= argument<int> (3,context);
  12906. case 3:
  12907. arg3= argument<int> (2,context);
  12908. case 2:
  12909. arg2= argument<int> (1,context);
  12910. arg1= argument<int> (0,context);
  12911. default:
  12912. break;
  12913. }
  12914. if(context->argumentCount())
  12915. {
  12916. object= engine->toScriptValue<QTime> (QTime(arg1,arg2,arg3,
  12917. arg4));
  12918. }
  12919. else
  12920. {
  12921. object= engine->toScriptValue<QTime> (QTime());
  12922. }
  12923. setQTimeProperties(object,engine);
  12924. }
  12925. else
  12926. {
  12927. context->throwError("Incorrect number of arguments passed to "
  12928. "QTime::QTime(). This method takes zero, two, "
  12929. "three, or four integer arguments.");
  12930. }
  12931. return object;
  12932. }
  12933. /*:108*//*109:*/
  12934. #line 2656 "./typica.w"
  12935. void setQTimeProperties(QScriptValue value,QScriptEngine*engine)
  12936. {
  12937. value.setProperty("addMSecs",engine->newFunction(QTime_addMSecs));
  12938. value.setProperty("addSecs",engine->newFunction(QTime_addSecs));
  12939. value.setProperty("elapsed",engine->newFunction(QTime_elapsed));
  12940. value.setProperty("hour",engine->newFunction(QTime_hour));
  12941. value.setProperty("isNull",engine->newFunction(QTime_isNull));
  12942. value.setProperty("isValid",engine->newFunction(QTime_isValid));
  12943. value.setProperty("minute",engine->newFunction(QTime_minute));
  12944. value.setProperty("msec",engine->newFunction(QTime_msec));
  12945. value.setProperty("msecsTo",engine->newFunction(QTime_msecsTo));
  12946. value.setProperty("restart",engine->newFunction(QTime_restart));
  12947. value.setProperty("second",engine->newFunction(QTime_second));
  12948. value.setProperty("secsTo",engine->newFunction(QTime_secsTo));
  12949. value.setProperty("setHMS",engine->newFunction(QTime_setHMS));
  12950. value.setProperty("start",engine->newFunction(QTime_start));
  12951. value.setProperty("toString",engine->newFunction(QTime_toString));
  12952. value.setProperty("currentTime",engine->newFunction(QTime_currentTime));
  12953. value.setProperty("fromString",engine->newFunction(QTime_fromString));
  12954. value.setProperty("valueOf",engine->newFunction(QTime_valueOf));
  12955. }
  12956. /*:109*//*110:*/
  12957. #line 2685 "./typica.w"
  12958. QScriptValue QTime_valueOf(QScriptContext*context,QScriptEngine*)
  12959. {
  12960. QTime self= getself<QTime> (context);
  12961. int retval= (self.hour()*60*60*1000)+(self.minute()*60*1000)+
  12962. (self.second()*1000)+self.msec();
  12963. return QScriptValue(retval);
  12964. }
  12965. /*:110*//*111:*/
  12966. #line 2699 "./typica.w"
  12967. QScriptValue QTime_addMSecs(QScriptContext*context,QScriptEngine*engine)
  12968. {
  12969. QTime time;
  12970. QScriptValue retval;
  12971. if(context->argumentCount()==1)
  12972. {
  12973. QTime self= getself<QTime> (context);
  12974. time= self.addMSecs(argument<int> (0,context));
  12975. retval= engine->toScriptValue<QTime> (time);
  12976. setQTimeProperties(retval,engine);
  12977. }
  12978. else
  12979. {
  12980. context->throwError("Incorrect number of arguments passed to "
  12981. "QTime::addMSecs(). This method takes one "
  12982. "integer as an argument.");
  12983. }
  12984. return retval;
  12985. }
  12986. QScriptValue QTime_addSecs(QScriptContext*context,QScriptEngine*engine)
  12987. {
  12988. QTime time;
  12989. QScriptValue retval;
  12990. if(context->argumentCount()==1)
  12991. {
  12992. QTime self= getself<QTime> (context);
  12993. time= self.addSecs(argument<int> (0,context));
  12994. retval= engine->toScriptValue<QTime> (time);
  12995. setQTimeProperties(retval,engine);
  12996. }
  12997. else
  12998. {
  12999. context->throwError("Incorrect number of arguments passed to "
  13000. "QTime::addSecs(). This method takes one "
  13001. "integer as an argument.");
  13002. }
  13003. return retval;
  13004. }
  13005. /*:111*//*112:*/
  13006. #line 2742 "./typica.w"
  13007. QScriptValue QTime_elapsed(QScriptContext*context,QScriptEngine*engine)
  13008. {
  13009. QScriptValue retval;
  13010. if(context->argumentCount()==0)
  13011. {
  13012. QTime self= getself<QTime> (context);
  13013. retval= QScriptValue(engine,self.elapsed());
  13014. }
  13015. else
  13016. {
  13017. context->throwError("Incorrect number of arguments passed to "
  13018. "QTime::elapsed(). This method takes no "
  13019. "arguments.");
  13020. }
  13021. return retval;
  13022. }
  13023. /*:112*//*113:*/
  13024. #line 2763 "./typica.w"
  13025. QScriptValue QTime_hour(QScriptContext*context,QScriptEngine*engine)
  13026. {
  13027. QScriptValue retval;
  13028. if(context->argumentCount()==0)
  13029. {
  13030. QTime self= getself<QTime> (context);
  13031. retval= QScriptValue(engine,self.hour());
  13032. }
  13033. else
  13034. {
  13035. context->throwError("Incorrect number of arguments passed to "
  13036. "QTime::hour(). This method takes no "
  13037. "arguments.");
  13038. }
  13039. return retval;
  13040. }
  13041. /*:113*//*114:*/
  13042. #line 2783 "./typica.w"
  13043. QScriptValue QTime_minute(QScriptContext*context,QScriptEngine*engine)
  13044. {
  13045. QScriptValue retval;
  13046. if(context->argumentCount()==0)
  13047. {
  13048. QTime self= getself<QTime> (context);
  13049. retval= QScriptValue(engine,self.minute());
  13050. }
  13051. else
  13052. {
  13053. context->throwError("Incorrect number of arguments passed to "
  13054. "QTime::minute(). This method takes no "
  13055. "arguments.");
  13056. }
  13057. return retval;
  13058. }
  13059. QScriptValue QTime_second(QScriptContext*context,QScriptEngine*engine)
  13060. {
  13061. QScriptValue retval;
  13062. if(context->argumentCount()==0)
  13063. {
  13064. QTime self= getself<QTime> (context);
  13065. retval= QScriptValue(engine,self.second());
  13066. }
  13067. else
  13068. {
  13069. context->throwError("Incorrect number of arguments passed to "
  13070. "QTime::second(). This method takes no "
  13071. "arguments.");
  13072. }
  13073. return retval;
  13074. }
  13075. QScriptValue QTime_msec(QScriptContext*context,QScriptEngine*engine)
  13076. {
  13077. QScriptValue retval;
  13078. if(context->argumentCount()==0)
  13079. {
  13080. QTime self= getself<QTime> (context);
  13081. retval= QScriptValue(engine,self.msec());
  13082. }
  13083. else
  13084. {
  13085. context->throwError("Incorrect number of arguments passed to "
  13086. "QTime::msec(). This method takes no "
  13087. "arguments.");
  13088. }
  13089. return retval;
  13090. }
  13091. /*:114*//*115:*/
  13092. #line 2839 "./typica.w"
  13093. QScriptValue QTime_isNull(QScriptContext*context,QScriptEngine*engine)
  13094. {
  13095. QScriptValue retval;
  13096. if(context->argumentCount()==0)
  13097. {
  13098. QTime self= getself<QTime> (context);
  13099. retval= QScriptValue(engine,self.isNull());
  13100. }
  13101. else
  13102. {
  13103. context->throwError("Incorrect number of arguments passed to "
  13104. "QTime::isNull(). This method takes no "
  13105. "arguments.");
  13106. }
  13107. return retval;
  13108. }
  13109. QScriptValue QTime_isValid(QScriptContext*context,QScriptEngine*engine)
  13110. {
  13111. QScriptValue retval;
  13112. if(context->argumentCount()==0)
  13113. {
  13114. QTime self= getself<QTime> (context);
  13115. retval= QScriptValue(engine,self.isValid());
  13116. }
  13117. else
  13118. {
  13119. context->throwError("Incorrect number of arguments passed to "
  13120. "QTime::isValid(). This method takes no "
  13121. "arguments.");
  13122. }
  13123. return retval;
  13124. }
  13125. /*:115*//*116:*/
  13126. #line 2877 "./typica.w"
  13127. QScriptValue QTime_msecsTo(QScriptContext*context,QScriptEngine*engine)
  13128. {
  13129. QScriptValue retval;
  13130. if(context->argumentCount()==1)
  13131. {
  13132. QTime self= getself<QTime> (context);
  13133. QTime arg= argument<QVariant> (0,context).toTime();
  13134. retval= QScriptValue(engine,self.msecsTo(arg));
  13135. }
  13136. else
  13137. {
  13138. context->throwError("Incorrect number of arguments passed to "
  13139. "QTime::msecsTo(). This method takes one QTime.");
  13140. }
  13141. return retval;
  13142. }
  13143. QScriptValue QTime_secsTo(QScriptContext*context,QScriptEngine*engine)
  13144. {
  13145. QScriptValue retval;
  13146. if(context->argumentCount()==1)
  13147. {
  13148. QTime self= getself<QTime> (context);
  13149. QTime arg= argument<QVariant> (0,context).toTime();
  13150. retval= QScriptValue(engine,self.secsTo(arg));
  13151. }
  13152. else
  13153. {
  13154. context->throwError("Incorrect number of arguments passed to "
  13155. "QTime::secsTo(). This method takes one QTime.");
  13156. }
  13157. return retval;
  13158. }
  13159. /*:116*//*117:*/
  13160. #line 2916 "./typica.w"
  13161. QScriptValue QTime_restart(QScriptContext*context,QScriptEngine*engine)
  13162. {
  13163. QScriptValue retval;
  13164. if(context->argumentCount()==0)
  13165. {
  13166. QTime self= getself<QTime> (context);
  13167. retval= QScriptValue(engine,self.restart());
  13168. }
  13169. else
  13170. {
  13171. context->throwError("Incorrect number of arguments passed to "
  13172. "QTime::restart(). This method takes no "
  13173. "arguments.");
  13174. }
  13175. return retval;
  13176. }
  13177. QScriptValue QTime_start(QScriptContext*context,QScriptEngine*)
  13178. {
  13179. if(context->argumentCount()==0)
  13180. {
  13181. QTime self= getself<QTime> (context);
  13182. self.start();
  13183. }
  13184. else
  13185. {
  13186. context->throwError("Incorrect number of arguments passed to "
  13187. "QTime::start(). This method takes no arguments.");
  13188. }
  13189. return QScriptValue();
  13190. }
  13191. /*:117*//*118:*/
  13192. #line 2952 "./typica.w"
  13193. QScriptValue QTime_setHMS(QScriptContext*context,QScriptEngine*engine)
  13194. {
  13195. QScriptValue retval;
  13196. if(context->argumentCount()==3||context->argumentCount()==4)
  13197. {
  13198. QTime self= getself<QTime> (context);
  13199. int arg1= 0;
  13200. int arg2= 0;
  13201. int arg3= 0;
  13202. int arg4= 0;
  13203. switch(context->argumentCount())
  13204. {
  13205. case 4:
  13206. arg4= argument<int> (3,context);
  13207. case 3:
  13208. arg3= argument<int> (2,context);
  13209. arg2= argument<int> (1,context);
  13210. arg1= argument<int> (0,context);
  13211. default:
  13212. break;
  13213. }
  13214. retval= QScriptValue(engine,self.setHMS(arg1,arg2,arg3,arg4));
  13215. }
  13216. else
  13217. {
  13218. context->throwError("Incorrect number of arguments passed to "
  13219. "QTime::setHMS(). This method takes three or "
  13220. "four integer arguments.");
  13221. }
  13222. return retval;
  13223. }
  13224. /*:118*//*119:*/
  13225. #line 2988 "./typica.w"
  13226. QScriptValue QTime_toString(QScriptContext*context,QScriptEngine*engine)
  13227. {
  13228. QScriptValue retval;
  13229. if(context->argumentCount()==1)
  13230. {
  13231. QTime self= getself<QTime> (context);
  13232. retval= QScriptValue(engine,self.toString(argument<QString> (0,context)));
  13233. }
  13234. else
  13235. {
  13236. context->throwError("Incorrect number of arguments passed to "
  13237. "QTime::toString(). This method takes one QString "
  13238. "as an argument.");
  13239. }
  13240. return retval;
  13241. }
  13242. /*:119*//*120:*/
  13243. #line 3009 "./typica.w"
  13244. QScriptValue QTime_currentTime(QScriptContext*,QScriptEngine*engine)
  13245. {
  13246. QScriptValue object;
  13247. object= engine->toScriptValue<QTime> (QTime::currentTime());
  13248. setQTimeProperties(object,engine);
  13249. return object;
  13250. }
  13251. QScriptValue QTime_fromString(QScriptContext*context,QScriptEngine*engine)
  13252. {
  13253. QScriptValue object;
  13254. if(context->argumentCount()==2)
  13255. {
  13256. QString time= argument<QString> (0,context);
  13257. QString format= argument<QString> (1,context);
  13258. object= engine->toScriptValue<QTime> (QTime::fromString(time,format));
  13259. setQTimeProperties(object,engine);
  13260. }
  13261. else
  13262. {
  13263. context->throwError("Incorrect number of arguments passed to "
  13264. "QTime::fromString(). This method takes two "
  13265. "string arguments.");
  13266. }
  13267. return object;
  13268. }
  13269. /*:120*//*122:*/
  13270. #line 3049 "./typica.w"
  13271. void setQAbstractScrollAreaProperties(QScriptValue value,QScriptEngine*engine)
  13272. {
  13273. setQFrameProperties(value,engine);
  13274. }
  13275. /*:122*//*124:*/
  13276. #line 3063 "./typica.w"
  13277. void setQAbstractItemViewProperties(QScriptValue value,QScriptEngine*engine)
  13278. {
  13279. setQAbstractScrollAreaProperties(value,engine);
  13280. }
  13281. /*:124*//*126:*/
  13282. #line 3077 "./typica.w"
  13283. void setQGraphicsViewProperties(QScriptValue value,QScriptEngine*engine)
  13284. {
  13285. setQAbstractScrollAreaProperties(value,engine);
  13286. }
  13287. void setQTableViewProperties(QScriptValue value,QScriptEngine*engine)
  13288. {
  13289. setQAbstractItemViewProperties(value,engine);
  13290. }
  13291. /*:126*//*129:*/
  13292. #line 3110 "./typica.w"
  13293. QScriptValue constructQPushButton(QScriptContext*,QScriptEngine*engine)
  13294. {
  13295. QScriptValue object= engine->newQObject(new QPushButton());
  13296. setQPushButtonProperties(object,engine);
  13297. return object;
  13298. }
  13299. void setQPushButtonProperties(QScriptValue value,QScriptEngine*engine)
  13300. {
  13301. setQAbstractButtonProperties(value,engine);
  13302. }
  13303. void setQAbstractButtonProperties(QScriptValue value,QScriptEngine*engine)
  13304. {
  13305. setQWidgetProperties(value,engine);
  13306. }
  13307. /*:129*//*136:*/
  13308. #line 3222 "./typica.w"
  13309. QScriptValue constructQSqlQuery(QScriptContext*,QScriptEngine*engine)
  13310. {
  13311. SqlQueryConnection*obj= new SqlQueryConnection();
  13312. QScriptValue object=
  13313. engine->toScriptValue<void*> (obj);
  13314. setQSqlQueryProperties(object,engine);
  13315. return object;
  13316. }
  13317. /*:136*//*137:*/
  13318. #line 3235 "./typica.w"
  13319. void setQSqlQueryProperties(QScriptValue value,QScriptEngine*engine)
  13320. {
  13321. value.setProperty("bind",engine->newFunction(QSqlQuery_bind));
  13322. value.setProperty("bindFileData",
  13323. engine->newFunction(QSqlQuery_bindFileData));
  13324. value.setProperty("bindDeviceData",
  13325. engine->newFunction(QSqlQuery_bindDeviceData));
  13326. value.setProperty("exec",engine->newFunction(QSqlQuery_exec));
  13327. value.setProperty("executedQuery",engine->newFunction(QSqlQuery_executedQuery));
  13328. value.setProperty("invalidate",engine->newFunction(QSqlQuery_invalidate));
  13329. value.setProperty("next",engine->newFunction(QSqlQuery_next));
  13330. value.setProperty("prepare",engine->newFunction(QSqlQuery_prepare));
  13331. value.setProperty("value",engine->newFunction(QSqlQuery_value));
  13332. }
  13333. /*:137*//*138:*/
  13334. #line 3253 "./typica.w"
  13335. QScriptValue QSqlQuery_exec(QScriptContext*context,QScriptEngine*engine)
  13336. {
  13337. QSqlQuery*q= getself<SqlQueryConnection*> (context)->operator->();
  13338. QScriptValue retval;
  13339. if(context->argumentCount()==1)
  13340. {
  13341. retval= QScriptValue(engine,
  13342. q->exec(argument<QString> (0,context)));
  13343. }
  13344. else
  13345. {
  13346. retval= QScriptValue(engine,q->exec());
  13347. }
  13348. if(q->lastError().isValid())
  13349. {
  13350. qDebug()<<q->lastQuery();
  13351. qDebug()<<q->lastError().text();
  13352. }
  13353. return retval;
  13354. }
  13355. QScriptValue QSqlQuery_executedQuery(QScriptContext*context,QScriptEngine*)
  13356. {
  13357. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  13358. return QScriptValue(query->lastQuery());
  13359. }
  13360. QScriptValue QSqlQuery_next(QScriptContext*context,QScriptEngine*engine)
  13361. {
  13362. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  13363. return QScriptValue(engine,query->next());
  13364. }
  13365. QScriptValue QSqlQuery_value(QScriptContext*context,QScriptEngine*engine)
  13366. {
  13367. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  13368. return QScriptValue(engine,
  13369. query->value(argument<int> (0,context)).toString());
  13370. }
  13371. /*:138*//*139:*/
  13372. #line 3297 "./typica.w"
  13373. QScriptValue QSqlQuery_prepare(QScriptContext*context,QScriptEngine*engine)
  13374. {
  13375. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  13376. return QScriptValue(engine,query->prepare(argument<QString> (0,context)));
  13377. }
  13378. QScriptValue QSqlQuery_bind(QScriptContext*context,QScriptEngine*)
  13379. {
  13380. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  13381. query->bindValue(argument<QString> (0,context),
  13382. argument<QVariant> (1,context));
  13383. return QScriptValue();
  13384. }
  13385. QScriptValue QSqlQuery_bindFileData(QScriptContext*context,
  13386. QScriptEngine*)
  13387. {
  13388. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  13389. QString placeholder= argument<QString> (0,context);
  13390. QString filename= argument<QString> (1,context);
  13391. QFile file(filename);
  13392. QByteArray data;
  13393. if(file.open(QIODevice::ReadOnly))
  13394. {
  13395. data= file.readAll();
  13396. file.close();
  13397. }
  13398. query->bindValue(placeholder,data);
  13399. return QScriptValue();
  13400. }
  13401. QScriptValue QSqlQuery_bindDeviceData(QScriptContext*context,
  13402. QScriptEngine*)
  13403. {
  13404. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  13405. QString placeholder= argument<QString> (0,context);
  13406. QIODevice*device= argument<QIODevice*> (1,context);
  13407. device->reset();
  13408. QByteArray data;
  13409. data= device->readAll();
  13410. query->bindValue(placeholder,data);
  13411. return QScriptValue();
  13412. }
  13413. /*:139*//*140:*/
  13414. #line 3349 "./typica.w"
  13415. QScriptValue QSqlQuery_invalidate(QScriptContext*context,QScriptEngine*)
  13416. {
  13417. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  13418. delete query;
  13419. return QScriptValue::UndefinedValue;
  13420. }
  13421. /*:140*//*143:*/
  13422. #line 3390 "./typica.w"
  13423. QScriptValue baseName(QScriptContext*context,QScriptEngine*engine)
  13424. {
  13425. QFileInfo info(argument<QString> (0,context));
  13426. QScriptValue retval(engine,info.baseName());
  13427. return retval;
  13428. }
  13429. QScriptValue dir(QScriptContext*context,QScriptEngine*engine)
  13430. {
  13431. QFileInfo info(argument<QString> (0,context));
  13432. QDir dir= info.dir();
  13433. QScriptValue retval(engine,dir.path());
  13434. return retval;
  13435. }
  13436. /*:143*//*144:*/
  13437. #line 3409 "./typica.w"
  13438. QScriptValue sqlToArray(QScriptContext*context,QScriptEngine*engine)
  13439. {
  13440. QString source= argument<QString> (0,context);
  13441. source.remove(0,1);
  13442. source.chop(1);
  13443. QStringList elements= source.split(",");
  13444. QString element;
  13445. QScriptValue dest= engine->newArray(elements.size());
  13446. int i= 0;
  13447. foreach(element,elements)
  13448. {
  13449. if(element.startsWith("\"")&&element.endsWith("\""))
  13450. {
  13451. element.chop(1);
  13452. element= element.remove(0,1);
  13453. }
  13454. dest.setProperty(i,QScriptValue(engine,element));
  13455. i++;
  13456. }
  13457. return dest;
  13458. }
  13459. /*:144*//*145:*/
  13460. #line 3435 "./typica.w"
  13461. QScriptValue setFont(QScriptContext*context,QScriptEngine*)
  13462. {
  13463. QString font= argument<QString> (0,context);
  13464. QString classname;
  13465. if(context->argumentCount()> 1)
  13466. {
  13467. classname= argument<QString> (1,context);
  13468. QApplication::setFont(QFont(font),classname.toLatin1().constData());
  13469. }
  13470. else
  13471. {
  13472. QApplication::setFont(QFont(font));
  13473. }
  13474. return QScriptValue();
  13475. }
  13476. /*:145*//*146:*/
  13477. #line 3455 "./typica.w"
  13478. QScriptValue annotationFromRecord(QScriptContext*context,QScriptEngine*)
  13479. {
  13480. SqlQueryConnection h;
  13481. QSqlQuery*query= h.operator->();
  13482. QString q= "SELECT file FROM files WHERE id = :file";
  13483. query->prepare(q);
  13484. query->bindValue(":file",argument<int> (0,context));
  13485. query->exec();
  13486. query->next();
  13487. QByteArray array= query->value(0).toByteArray();
  13488. QBuffer buffer(&array);
  13489. buffer.open(QIODevice::ReadOnly);
  13490. QXmlQuery xquery;
  13491. xquery.bindVariable("profile",&buffer);
  13492. QString xq;
  13493. xq= "for $b in doc($profile) //tuple where exists($b/annotation) return $b";
  13494. xquery.setQuery(xq);
  13495. QString result;
  13496. xquery.evaluateTo(&result);
  13497. return QScriptValue(result);
  13498. }
  13499. /*:146*//*147:*/
  13500. #line 3482 "./typica.w"
  13501. QScriptValue setTabOrder(QScriptContext*context,QScriptEngine*)
  13502. {
  13503. QWidget::setTabOrder(argument<QWidget*> (0,context),
  13504. argument<QWidget*> (1,context));
  13505. return QScriptValue();
  13506. }
  13507. /*:147*//*154:*/
  13508. #line 3727 "./typica.w"
  13509. QScriptValue createWindow(QScriptContext*context,QScriptEngine*engine)
  13510. {
  13511. QString targetID= argument<QString> (0,context);
  13512. QDomNode element;
  13513. QScriptValue object;
  13514. /*156:*/
  13515. #line 3774 "./typica.w"
  13516. QDomNodeList windows=
  13517. AppInstance->configuration()->documentElement().elementsByTagName("window");
  13518. QDomNode nullNode;
  13519. int i= 0;
  13520. element= nullNode;
  13521. while(i<windows.count())
  13522. {
  13523. element= windows.at(i);
  13524. QDomNamedNodeMap attributes= element.attributes();
  13525. if(attributes.contains("id"))
  13526. {
  13527. if(attributes.namedItem("id").toAttr().value()==targetID)
  13528. {
  13529. break;
  13530. }
  13531. }
  13532. element= nullNode;
  13533. i++;
  13534. }
  13535. /*:156*/
  13536. #line 3733 "./typica.w"
  13537. if(!element.isNull())
  13538. {
  13539. /*157:*/
  13540. #line 3806 "./typica.w"
  13541. ScriptQMainWindow*window= new ScriptQMainWindow;
  13542. window->setObjectName(targetID);
  13543. object= engine->newQObject(window);
  13544. setQMainWindowProperties(object,engine);
  13545. QWidget*central= new(QWidget);
  13546. central->setParent(window);
  13547. central->setObjectName("centralWidget");
  13548. window->setCentralWidget(central);
  13549. if(element.hasChildNodes())
  13550. {
  13551. /*158:*/
  13552. #line 3841 "./typica.w"
  13553. QStack<QWidget*> widgetStack;
  13554. QStack<QLayout*> layoutStack;
  13555. QString windowScript;
  13556. widgetStack.push(central);
  13557. QDomNodeList windowChildren= element.childNodes();
  13558. int i= 0;
  13559. while(i<windowChildren.count())
  13560. {
  13561. QDomNode current;
  13562. QDomElement element;
  13563. current= windowChildren.at(i);
  13564. if(current.isElement())
  13565. {
  13566. element= current.toElement();
  13567. if(element.tagName()=="program")
  13568. {
  13569. windowScript.append(element.text());
  13570. }
  13571. else if(element.tagName()=="layout")
  13572. {
  13573. addLayoutToWidget(element,&widgetStack,&layoutStack);
  13574. }
  13575. else if(element.tagName()=="menu")
  13576. {
  13577. /*159:*/
  13578. #line 3888 "./typica.w"
  13579. QMenuBar*bar= window->menuBar();
  13580. bar->setParent(window);
  13581. bar->setObjectName("menuBar");
  13582. if(element.hasAttribute("name"))
  13583. {
  13584. QMenu*menu= bar->addMenu(element.attribute("name"));
  13585. menu->setParent(bar);
  13586. if(element.hasAttribute("type"))
  13587. {
  13588. if(element.attribute("type")=="reports")
  13589. {
  13590. if(element.hasAttribute("src"))
  13591. {
  13592. /*577:*/
  13593. #line 12817 "./typica.w"
  13594. QSettings settings;
  13595. QString reportDirectory= QString("%1/%2").arg(settings.value("config").
  13596. toString()).
  13597. arg(element.attribute("src"));
  13598. QDir::addSearchPath("reports",reportDirectory);
  13599. QDir directory(reportDirectory);
  13600. directory.setFilter(QDir::Files);
  13601. directory.setSorting(QDir::Name);
  13602. QStringList nameFilter;
  13603. nameFilter<<"*.xml";
  13604. directory.setNameFilters(nameFilter);
  13605. QFileInfoList reportFiles= directory.entryInfoList();
  13606. for(int i= 0;i<reportFiles.size();i++)
  13607. {
  13608. QFileInfo reportFile= reportFiles.at(i);
  13609. /*581:*/
  13610. #line 12897 "./typica.w"
  13611. QString path= reportFile.absoluteFilePath();
  13612. QFile file(path);
  13613. if(file.open(QIODevice::ReadOnly))
  13614. {
  13615. QDomDocument document;
  13616. document.setContent(&file,true);
  13617. QDomElement root= document.documentElement();
  13618. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  13619. if(!titleNode.isNull())
  13620. {
  13621. QDomElement titleElement= titleNode.toElement();
  13622. QString title= titleElement.text();
  13623. if(!title.isEmpty())
  13624. {
  13625. QStringList hierarchy= title.split(":->");
  13626. QMenu*insertionPoint= menu;
  13627. /*582:*/
  13628. #line 12924 "./typica.w"
  13629. for(int j= 0;j<hierarchy.size()-1;j++)
  13630. {
  13631. QObjectList menuList= insertionPoint->children();
  13632. bool menuFound= false;
  13633. for(int k= 0;k<menuList.size();k++)
  13634. {
  13635. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  13636. if(currentItem)
  13637. {
  13638. if(currentItem->title()==hierarchy.at(j))
  13639. {
  13640. menuFound= true;
  13641. insertionPoint= currentItem;
  13642. break;
  13643. }
  13644. }
  13645. }
  13646. if(!menuFound)
  13647. {
  13648. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  13649. }
  13650. }
  13651. /*:582*/
  13652. #line 12914 "./typica.w"
  13653. ReportAction*action= new ReportAction(path,hierarchy.last());
  13654. insertionPoint->addAction(action);
  13655. }
  13656. }
  13657. }
  13658. /*:581*/
  13659. #line 12833 "./typica.w"
  13660. }
  13661. /*:577*/
  13662. #line 3902 "./typica.w"
  13663. }
  13664. }
  13665. }
  13666. if(element.hasChildNodes())
  13667. {
  13668. /*160:*/
  13669. #line 3915 "./typica.w"
  13670. QDomNodeList menuItems= element.childNodes();
  13671. int j= 0;
  13672. while(j<menuItems.count())
  13673. {
  13674. QDomNode item= menuItems.at(j);
  13675. if(item.isElement())
  13676. {
  13677. QDomElement itemElement= item.toElement();
  13678. if(itemElement.tagName()=="item")
  13679. {
  13680. QAction*itemAction= new QAction(itemElement.text(),menu);
  13681. if(itemElement.hasAttribute("id"))
  13682. {
  13683. itemAction->setObjectName(itemElement.attribute("id"));
  13684. }
  13685. if(itemElement.hasAttribute("shortcut"))
  13686. {
  13687. itemAction->setShortcut(itemElement.attribute("shortcut"));
  13688. }
  13689. menu->addAction(itemAction);
  13690. }
  13691. else if(itemElement.tagName()=="separator")
  13692. {
  13693. menu->addSeparator();
  13694. }
  13695. }
  13696. j++;
  13697. }
  13698. #line 1 "./helpmenu.w"
  13699. /*:160*/
  13700. #line 3908 "./typica.w"
  13701. }
  13702. }
  13703. /*:159*/
  13704. #line 3866 "./typica.w"
  13705. }
  13706. }
  13707. i++;
  13708. }
  13709. QScriptValue oldThis= context->thisObject();
  13710. context->setThisObject(object);
  13711. QScriptValue result= engine->evaluate(windowScript);
  13712. /*151:*/
  13713. #line 3623 "./typica.w"
  13714. if(engine->hasUncaughtException())
  13715. {
  13716. int line= engine->uncaughtExceptionLineNumber();
  13717. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  13718. result.toString();
  13719. QString trace;
  13720. foreach(trace,engine->uncaughtExceptionBacktrace())
  13721. {
  13722. qDebug()<<trace;
  13723. }
  13724. }
  13725. /*:151*/
  13726. #line 3874 "./typica.w"
  13727. context->setThisObject(oldThis);
  13728. /*:158*/
  13729. #line 3817 "./typica.w"
  13730. }
  13731. /*161:*/
  13732. #line 9 "./helpmenu.w"
  13733. HelpMenu*helpMenu= new HelpMenu();
  13734. window->menuBar()->addMenu(helpMenu);
  13735. /*:161*/
  13736. #line 3819 "./typica.w"
  13737. window->show();
  13738. /*:157*/
  13739. #line 3736 "./typica.w"
  13740. }
  13741. return object;
  13742. }
  13743. /*:154*//*155:*/
  13744. #line 3747 "./typica.w"
  13745. QScriptValue createReport(QScriptContext*context,QScriptEngine*engine)
  13746. {
  13747. QString targetID= argument<QString> (0,context);
  13748. QFile file(QString("reports:%1").arg(targetID));
  13749. QScriptValue object;
  13750. if(file.open(QIODevice::ReadOnly))
  13751. {
  13752. QDomDocument document;
  13753. document.setContent(&file,true);
  13754. QDomElement element= document.documentElement();
  13755. if(!element.isNull())
  13756. {
  13757. /*157:*/
  13758. #line 3806 "./typica.w"
  13759. ScriptQMainWindow*window= new ScriptQMainWindow;
  13760. window->setObjectName(targetID);
  13761. object= engine->newQObject(window);
  13762. setQMainWindowProperties(object,engine);
  13763. QWidget*central= new(QWidget);
  13764. central->setParent(window);
  13765. central->setObjectName("centralWidget");
  13766. window->setCentralWidget(central);
  13767. if(element.hasChildNodes())
  13768. {
  13769. /*158:*/
  13770. #line 3841 "./typica.w"
  13771. QStack<QWidget*> widgetStack;
  13772. QStack<QLayout*> layoutStack;
  13773. QString windowScript;
  13774. widgetStack.push(central);
  13775. QDomNodeList windowChildren= element.childNodes();
  13776. int i= 0;
  13777. while(i<windowChildren.count())
  13778. {
  13779. QDomNode current;
  13780. QDomElement element;
  13781. current= windowChildren.at(i);
  13782. if(current.isElement())
  13783. {
  13784. element= current.toElement();
  13785. if(element.tagName()=="program")
  13786. {
  13787. windowScript.append(element.text());
  13788. }
  13789. else if(element.tagName()=="layout")
  13790. {
  13791. addLayoutToWidget(element,&widgetStack,&layoutStack);
  13792. }
  13793. else if(element.tagName()=="menu")
  13794. {
  13795. /*159:*/
  13796. #line 3888 "./typica.w"
  13797. QMenuBar*bar= window->menuBar();
  13798. bar->setParent(window);
  13799. bar->setObjectName("menuBar");
  13800. if(element.hasAttribute("name"))
  13801. {
  13802. QMenu*menu= bar->addMenu(element.attribute("name"));
  13803. menu->setParent(bar);
  13804. if(element.hasAttribute("type"))
  13805. {
  13806. if(element.attribute("type")=="reports")
  13807. {
  13808. if(element.hasAttribute("src"))
  13809. {
  13810. /*577:*/
  13811. #line 12817 "./typica.w"
  13812. QSettings settings;
  13813. QString reportDirectory= QString("%1/%2").arg(settings.value("config").
  13814. toString()).
  13815. arg(element.attribute("src"));
  13816. QDir::addSearchPath("reports",reportDirectory);
  13817. QDir directory(reportDirectory);
  13818. directory.setFilter(QDir::Files);
  13819. directory.setSorting(QDir::Name);
  13820. QStringList nameFilter;
  13821. nameFilter<<"*.xml";
  13822. directory.setNameFilters(nameFilter);
  13823. QFileInfoList reportFiles= directory.entryInfoList();
  13824. for(int i= 0;i<reportFiles.size();i++)
  13825. {
  13826. QFileInfo reportFile= reportFiles.at(i);
  13827. /*581:*/
  13828. #line 12897 "./typica.w"
  13829. QString path= reportFile.absoluteFilePath();
  13830. QFile file(path);
  13831. if(file.open(QIODevice::ReadOnly))
  13832. {
  13833. QDomDocument document;
  13834. document.setContent(&file,true);
  13835. QDomElement root= document.documentElement();
  13836. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  13837. if(!titleNode.isNull())
  13838. {
  13839. QDomElement titleElement= titleNode.toElement();
  13840. QString title= titleElement.text();
  13841. if(!title.isEmpty())
  13842. {
  13843. QStringList hierarchy= title.split(":->");
  13844. QMenu*insertionPoint= menu;
  13845. /*582:*/
  13846. #line 12924 "./typica.w"
  13847. for(int j= 0;j<hierarchy.size()-1;j++)
  13848. {
  13849. QObjectList menuList= insertionPoint->children();
  13850. bool menuFound= false;
  13851. for(int k= 0;k<menuList.size();k++)
  13852. {
  13853. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  13854. if(currentItem)
  13855. {
  13856. if(currentItem->title()==hierarchy.at(j))
  13857. {
  13858. menuFound= true;
  13859. insertionPoint= currentItem;
  13860. break;
  13861. }
  13862. }
  13863. }
  13864. if(!menuFound)
  13865. {
  13866. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  13867. }
  13868. }
  13869. /*:582*/
  13870. #line 12914 "./typica.w"
  13871. ReportAction*action= new ReportAction(path,hierarchy.last());
  13872. insertionPoint->addAction(action);
  13873. }
  13874. }
  13875. }
  13876. /*:581*/
  13877. #line 12833 "./typica.w"
  13878. }
  13879. /*:577*/
  13880. #line 3902 "./typica.w"
  13881. }
  13882. }
  13883. }
  13884. if(element.hasChildNodes())
  13885. {
  13886. /*160:*/
  13887. #line 3915 "./typica.w"
  13888. QDomNodeList menuItems= element.childNodes();
  13889. int j= 0;
  13890. while(j<menuItems.count())
  13891. {
  13892. QDomNode item= menuItems.at(j);
  13893. if(item.isElement())
  13894. {
  13895. QDomElement itemElement= item.toElement();
  13896. if(itemElement.tagName()=="item")
  13897. {
  13898. QAction*itemAction= new QAction(itemElement.text(),menu);
  13899. if(itemElement.hasAttribute("id"))
  13900. {
  13901. itemAction->setObjectName(itemElement.attribute("id"));
  13902. }
  13903. if(itemElement.hasAttribute("shortcut"))
  13904. {
  13905. itemAction->setShortcut(itemElement.attribute("shortcut"));
  13906. }
  13907. menu->addAction(itemAction);
  13908. }
  13909. else if(itemElement.tagName()=="separator")
  13910. {
  13911. menu->addSeparator();
  13912. }
  13913. }
  13914. j++;
  13915. }
  13916. #line 1 "./helpmenu.w"
  13917. /*:160*/
  13918. #line 3908 "./typica.w"
  13919. }
  13920. }
  13921. /*:159*/
  13922. #line 3866 "./typica.w"
  13923. }
  13924. }
  13925. i++;
  13926. }
  13927. QScriptValue oldThis= context->thisObject();
  13928. context->setThisObject(object);
  13929. QScriptValue result= engine->evaluate(windowScript);
  13930. /*151:*/
  13931. #line 3623 "./typica.w"
  13932. if(engine->hasUncaughtException())
  13933. {
  13934. int line= engine->uncaughtExceptionLineNumber();
  13935. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  13936. result.toString();
  13937. QString trace;
  13938. foreach(trace,engine->uncaughtExceptionBacktrace())
  13939. {
  13940. qDebug()<<trace;
  13941. }
  13942. }
  13943. /*:151*/
  13944. #line 3874 "./typica.w"
  13945. context->setThisObject(oldThis);
  13946. /*:158*/
  13947. #line 3817 "./typica.w"
  13948. }
  13949. /*161:*/
  13950. #line 9 "./helpmenu.w"
  13951. HelpMenu*helpMenu= new HelpMenu();
  13952. window->menuBar()->addMenu(helpMenu);
  13953. /*:161*/
  13954. #line 3819 "./typica.w"
  13955. window->show();
  13956. /*:157*/
  13957. #line 3760 "./typica.w"
  13958. }
  13959. file.close();
  13960. }
  13961. return object;
  13962. }
  13963. /*:155*//*166:*/
  13964. #line 3957 "./typica.w"
  13965. void addLayoutToWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  13966. QStack<QLayout*> *layoutStack)
  13967. {
  13968. if(element.hasAttribute("type"))
  13969. {
  13970. /*167:*/
  13971. #line 3978 "./typica.w"
  13972. QLayout*layout;
  13973. QString layoutType= element.attribute("type");
  13974. if(layoutType=="horizontal")
  13975. {
  13976. layout= new QHBoxLayout;
  13977. layoutStack->push(layout);
  13978. populateBoxLayout(element,widgetStack,layoutStack);
  13979. }
  13980. else if(layoutType=="vertical")
  13981. {
  13982. layout= new QVBoxLayout;
  13983. layoutStack->push(layout);
  13984. populateBoxLayout(element,widgetStack,layoutStack);
  13985. }
  13986. else if(layoutType=="grid")
  13987. {
  13988. layout= new QGridLayout;
  13989. layoutStack->push(layout);
  13990. populateGridLayout(element,widgetStack,layoutStack);
  13991. }
  13992. else if(layoutType=="stack")
  13993. {
  13994. layout= new QStackedLayout;
  13995. layoutStack->push(layout);
  13996. populateStackedLayout(element,widgetStack,layoutStack);
  13997. }
  13998. if(element.hasAttribute("id"))
  13999. {
  14000. layout->setObjectName(element.attribute("id"));
  14001. }
  14002. if(element.hasAttribute("spacing"))
  14003. {
  14004. layout->setSpacing(element.attribute("spacing").toInt());
  14005. }
  14006. if(element.hasAttribute("margin"))
  14007. {
  14008. int m= element.attribute("margin").toInt();
  14009. layout->setContentsMargins(m,m,m,m);
  14010. }
  14011. /*:167*/
  14012. #line 3963 "./typica.w"
  14013. QWidget*widget= widgetStack->top();
  14014. if(layout)
  14015. {
  14016. widget->setLayout(layout);
  14017. }
  14018. layoutStack->pop();
  14019. }
  14020. }
  14021. /*:166*//*168:*/
  14022. #line 4025 "./typica.w"
  14023. void populateStackedLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  14024. QStack<QLayout*> *layoutStack)
  14025. {
  14026. QDomNodeList children= element.childNodes();
  14027. QStackedLayout*layout= qobject_cast<QStackedLayout*> (layoutStack->top());
  14028. for(int i= 0;i<children.count();i++)
  14029. {
  14030. QDomNode current;
  14031. QDomElement currentElement;
  14032. current= children.at(i);
  14033. if(current.isElement())
  14034. {
  14035. currentElement= current.toElement();
  14036. if(currentElement.tagName()=="page")
  14037. {
  14038. QWidget*widget= new QWidget;
  14039. layout->addWidget(widget);
  14040. widgetStack->push(widget);
  14041. populateWidget(currentElement,widgetStack,layoutStack);
  14042. widgetStack->pop();
  14043. }
  14044. }
  14045. }
  14046. }
  14047. /*:168*//*169:*/
  14048. #line 4057 "./typica.w"
  14049. void populateGridLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  14050. QStack<QLayout*> *layoutStack)
  14051. {
  14052. QDomNodeList children= element.childNodes();
  14053. int row= -1;
  14054. QGridLayout*layout= qobject_cast<QGridLayout*> (layoutStack->top());
  14055. for(int i= 0;i<children.count();i++)
  14056. {
  14057. QDomNode current;
  14058. QDomElement currentElement;
  14059. current= children.at(i);
  14060. if(current.isElement())
  14061. {
  14062. currentElement= current.toElement();
  14063. if(currentElement.tagName()=="row")
  14064. {
  14065. row++;
  14066. if(currentElement.hasAttribute("height"))
  14067. {
  14068. layout->setRowMinimumHeight(row,
  14069. currentElement.attribute("height").toInt());
  14070. }
  14071. if(currentElement.hasAttribute("stretch"))
  14072. {
  14073. layout->setRowStretch(row,
  14074. currentElement.attribute("stretch").toInt());
  14075. }
  14076. /*170:*/
  14077. #line 4113 "./typica.w"
  14078. int column= -1;
  14079. QDomNodeList rowChildren= currentElement.childNodes();
  14080. for(int j= 0;j<rowChildren.count();j++)
  14081. {
  14082. QDomNode columnNode;
  14083. QDomElement columnElement;
  14084. columnNode= rowChildren.at(j);
  14085. if(columnNode.isElement())
  14086. {
  14087. columnElement= columnNode.toElement();
  14088. if(columnElement.tagName()=="column")
  14089. {
  14090. column++;
  14091. if(columnElement.hasAttribute("column"))
  14092. {
  14093. column= columnElement.attribute("column").toInt();
  14094. }
  14095. if(columnElement.hasAttribute("width"))
  14096. {
  14097. layout->setColumnMinimumWidth(column,
  14098. columnElement.attribute("width").toInt());
  14099. }
  14100. if(columnElement.hasAttribute("stretch"))
  14101. {
  14102. layout->setColumnStretch(column,
  14103. columnElement.attribute("stretch").toInt());
  14104. }
  14105. int hspan= 1;
  14106. int vspan= 1;
  14107. if(columnElement.hasAttribute("rowspan"))
  14108. {
  14109. vspan= columnElement.attribute("rowspan").toInt();
  14110. }
  14111. if(columnElement.hasAttribute("colspan"))
  14112. {
  14113. hspan= columnElement.attribute("colspan").toInt();
  14114. }
  14115. QHBoxLayout*cell= new QHBoxLayout;
  14116. layout->addLayout(cell,row,column,vspan,hspan);
  14117. layoutStack->push(cell);
  14118. populateBoxLayout(columnElement,widgetStack,layoutStack);
  14119. layoutStack->pop();
  14120. }
  14121. }
  14122. }
  14123. /*:170*/
  14124. #line 4085 "./typica.w"
  14125. }
  14126. }
  14127. }
  14128. }
  14129. /*:169*//*171:*/
  14130. #line 4163 "./typica.w"
  14131. void populateBoxLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  14132. QStack<QLayout*> *layoutStack)
  14133. {
  14134. QDomNodeList children= element.childNodes();
  14135. for(int i= 0;i<children.count();i++)
  14136. {
  14137. QDomNode current;
  14138. QDomElement currentElement;
  14139. current= children.at(i);
  14140. if(current.isElement())
  14141. {
  14142. currentElement= current.toElement();
  14143. if(currentElement.tagName()=="button")
  14144. {
  14145. addButtonToLayout(currentElement,widgetStack,layoutStack);
  14146. }
  14147. else if(currentElement.tagName()=="calendar")
  14148. {
  14149. addCalendarToLayout(currentElement,widgetStack,layoutStack);
  14150. }
  14151. else if(currentElement.tagName()=="decoration")
  14152. {
  14153. addDecorationToLayout(currentElement,widgetStack,
  14154. layoutStack);
  14155. }
  14156. else if(currentElement.tagName()=="layout")
  14157. {
  14158. addLayoutToLayout(currentElement,widgetStack,layoutStack);
  14159. }
  14160. else if(currentElement.tagName()=="splitter")
  14161. {
  14162. addSplitterToLayout(currentElement,widgetStack,layoutStack);
  14163. }
  14164. else if(currentElement.tagName()=="label")
  14165. {
  14166. QBoxLayout*layout=
  14167. qobject_cast<QBoxLayout*> (layoutStack->top());
  14168. QLabel*label= new QLabel(currentElement.text());
  14169. layout->addWidget(label);
  14170. }
  14171. else if(currentElement.tagName()=="lcdtemperature")
  14172. {
  14173. addTemperatureDisplayToLayout(currentElement,widgetStack,
  14174. layoutStack);
  14175. }
  14176. else if(currentElement.tagName()=="lcdtimer")
  14177. {
  14178. addTimerDisplayToLayout(currentElement,widgetStack,
  14179. layoutStack);
  14180. }
  14181. else if(currentElement.tagName()=="line")
  14182. {
  14183. addLineToLayout(currentElement,widgetStack,layoutStack);
  14184. }
  14185. else if(currentElement.tagName()=="report")
  14186. {
  14187. addReportToLayout(currentElement,widgetStack,layoutStack);
  14188. }
  14189. else if(currentElement.tagName()=="sqldrop")
  14190. {
  14191. addSqlDropToLayout(currentElement,widgetStack,layoutStack);
  14192. }
  14193. else if(currentElement.tagName()=="sqltablearray")
  14194. {
  14195. addSaltToLayout(currentElement,widgetStack,layoutStack);
  14196. }
  14197. else if(currentElement.tagName()=="sqlview")
  14198. {
  14199. addSqlQueryViewToLayout(currentElement,widgetStack,
  14200. layoutStack);
  14201. }
  14202. else if(currentElement.tagName()=="textarea")
  14203. {
  14204. addTextToLayout(currentElement,widgetStack,layoutStack);
  14205. }
  14206. else if(currentElement.tagName()=="spinbox")
  14207. {
  14208. addSpinBoxToLayout(currentElement,widgetStack,layoutStack);
  14209. }
  14210. else if(currentElement.tagName()=="formarray")
  14211. {
  14212. addFormArrayToLayout(currentElement,widgetStack,layoutStack);
  14213. }
  14214. else if(currentElement.tagName()=="hscale")
  14215. {
  14216. addScaleControlToLayout(currentElement,widgetStack,
  14217. layoutStack);
  14218. }
  14219. else if(currentElement.tagName()=="vscale")
  14220. {
  14221. addIntensityControlToLayout(currentElement,widgetStack,
  14222. layoutStack);
  14223. }
  14224. else if(currentElement.tagName()=="webview")
  14225. {
  14226. addWebViewToLayout(currentElement,widgetStack,layoutStack);
  14227. }
  14228. else if(currentElement.tagName()=="stretch")
  14229. {
  14230. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  14231. layout->addStretch();
  14232. }
  14233. /*619:*/
  14234. #line 441 "./daterangeselector.w"
  14235. else if(currentElement.tagName()=="daterange")
  14236. {
  14237. addDateRangeToLayout(currentElement,widgetStack,layoutStack);
  14238. }
  14239. /*:619*/
  14240. #line 4266 "./typica.w"
  14241. }
  14242. }
  14243. }
  14244. /*:171*//*172:*/
  14245. #line 4274 "./typica.w"
  14246. void addLayoutToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  14247. QStack<QLayout*> *layoutStack)
  14248. {
  14249. QLayout*targetLayout= layoutStack->pop();
  14250. QBoxLayout*boxLayout= qobject_cast<QBoxLayout*> (targetLayout);
  14251. if(element.hasAttribute("type"))
  14252. {
  14253. /*167:*/
  14254. #line 3978 "./typica.w"
  14255. QLayout*layout;
  14256. QString layoutType= element.attribute("type");
  14257. if(layoutType=="horizontal")
  14258. {
  14259. layout= new QHBoxLayout;
  14260. layoutStack->push(layout);
  14261. populateBoxLayout(element,widgetStack,layoutStack);
  14262. }
  14263. else if(layoutType=="vertical")
  14264. {
  14265. layout= new QVBoxLayout;
  14266. layoutStack->push(layout);
  14267. populateBoxLayout(element,widgetStack,layoutStack);
  14268. }
  14269. else if(layoutType=="grid")
  14270. {
  14271. layout= new QGridLayout;
  14272. layoutStack->push(layout);
  14273. populateGridLayout(element,widgetStack,layoutStack);
  14274. }
  14275. else if(layoutType=="stack")
  14276. {
  14277. layout= new QStackedLayout;
  14278. layoutStack->push(layout);
  14279. populateStackedLayout(element,widgetStack,layoutStack);
  14280. }
  14281. if(element.hasAttribute("id"))
  14282. {
  14283. layout->setObjectName(element.attribute("id"));
  14284. }
  14285. if(element.hasAttribute("spacing"))
  14286. {
  14287. layout->setSpacing(element.attribute("spacing").toInt());
  14288. }
  14289. if(element.hasAttribute("margin"))
  14290. {
  14291. int m= element.attribute("margin").toInt();
  14292. layout->setContentsMargins(m,m,m,m);
  14293. }
  14294. /*:167*/
  14295. #line 4282 "./typica.w"
  14296. boxLayout->addLayout(layout);
  14297. layoutStack->pop();
  14298. }
  14299. layoutStack->push(targetLayout);
  14300. }
  14301. /*:172*//*173:*/
  14302. #line 4293 "./typica.w"
  14303. void addSplitterToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  14304. QStack<QLayout*> *layoutStack)
  14305. {
  14306. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  14307. QSplitter*splitter= new(QSplitter);
  14308. layout->addWidget(splitter);
  14309. /*174:*/
  14310. #line 4306 "./typica.w"
  14311. QString orientation= element.attribute("type");
  14312. if(orientation=="horizontal")
  14313. {
  14314. splitter->setOrientation(Qt::Horizontal);
  14315. }
  14316. else if(orientation=="vertical")
  14317. {
  14318. splitter->setOrientation(Qt::Vertical);
  14319. }
  14320. QString id= element.attribute("id");
  14321. if(!id.isEmpty())
  14322. {
  14323. splitter->setObjectName(id);
  14324. }
  14325. if(element.hasChildNodes())
  14326. {
  14327. widgetStack->push(splitter);
  14328. populateSplitter(element,widgetStack,layoutStack);
  14329. widgetStack->pop();
  14330. }
  14331. /*:174*/
  14332. #line 4300 "./typica.w"
  14333. }
  14334. /*:173*//*175:*/
  14335. #line 4332 "./typica.w"
  14336. void populateSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  14337. QStack<QLayout*> *layoutStack)
  14338. {
  14339. QDomNodeList children= element.childNodes();
  14340. for(int i= 0;i<children.count();i++)
  14341. {
  14342. QDomNode current;
  14343. QDomElement currentElement;
  14344. current= children.at(i);
  14345. if(current.isElement())
  14346. {
  14347. currentElement= current.toElement();
  14348. if(currentElement.tagName()=="decoration")
  14349. {
  14350. addDecorationToSplitter(currentElement,widgetStack,
  14351. layoutStack);
  14352. }
  14353. else if(currentElement.tagName()=="graph")
  14354. {
  14355. addGraphToSplitter(currentElement,widgetStack,layoutStack);
  14356. }
  14357. else if(currentElement.tagName()=="splitter")
  14358. {
  14359. addSplitterToSplitter(currentElement,widgetStack,layoutStack);
  14360. }
  14361. else if(currentElement.tagName()=="lcdtemperature")
  14362. {
  14363. addTemperatureDisplayToSplitter(currentElement,widgetStack,
  14364. layoutStack);
  14365. }
  14366. else if(currentElement.tagName()=="lcdtimer")
  14367. {
  14368. addTimerDisplayToSplitter(currentElement,widgetStack,
  14369. layoutStack);
  14370. }
  14371. else if(currentElement.tagName()=="measurementtable")
  14372. {
  14373. addZoomLogToSplitter(currentElement,widgetStack,layoutStack);
  14374. }
  14375. else if(currentElement.tagName()=="widget")
  14376. {
  14377. addWidgetToSplitter(currentElement,widgetStack,layoutStack);
  14378. }
  14379. }
  14380. }
  14381. }
  14382. /*:175*//*176:*/
  14383. #line 4382 "./typica.w"
  14384. void addSplitterToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  14385. QStack<QLayout*> *layoutStack)
  14386. {
  14387. QSplitter*parent= qobject_cast<QSplitter*> (widgetStack->top());
  14388. QSplitter*splitter= new(QSplitter);
  14389. splitter->setParent(parent);
  14390. parent->addWidget(splitter);
  14391. /*174:*/
  14392. #line 4306 "./typica.w"
  14393. QString orientation= element.attribute("type");
  14394. if(orientation=="horizontal")
  14395. {
  14396. splitter->setOrientation(Qt::Horizontal);
  14397. }
  14398. else if(orientation=="vertical")
  14399. {
  14400. splitter->setOrientation(Qt::Vertical);
  14401. }
  14402. QString id= element.attribute("id");
  14403. if(!id.isEmpty())
  14404. {
  14405. splitter->setObjectName(id);
  14406. }
  14407. if(element.hasChildNodes())
  14408. {
  14409. widgetStack->push(splitter);
  14410. populateSplitter(element,widgetStack,layoutStack);
  14411. widgetStack->pop();
  14412. }
  14413. /*:174*/
  14414. #line 4390 "./typica.w"
  14415. }
  14416. /*:176*//*177:*/
  14417. #line 4399 "./typica.w"
  14418. void addTemperatureDisplayToSplitter(QDomElement element,
  14419. QStack<QWidget*> *widgetStack,
  14420. QStack<QLayout*> *)
  14421. {
  14422. TemperatureDisplay*display= new(TemperatureDisplay);
  14423. if(element.hasAttribute("id"))
  14424. {
  14425. display->setObjectName(element.attribute("id"));
  14426. }
  14427. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  14428. splitter->addWidget(display);
  14429. }
  14430. void addTemperatureDisplayToLayout(QDomElement element,
  14431. QStack<QWidget*> *,
  14432. QStack<QLayout*> *layoutStack)
  14433. {
  14434. TemperatureDisplay*display= new(TemperatureDisplay);
  14435. if(element.hasAttribute("id"))
  14436. {
  14437. display->setObjectName(element.attribute("id"));
  14438. }
  14439. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  14440. layout->addWidget(display);
  14441. }
  14442. /*:177*//*178:*/
  14443. #line 4430 "./typica.w"
  14444. void addTimerDisplayToSplitter(QDomElement element,
  14445. QStack<QWidget*> *widgetStack,
  14446. QStack<QLayout*> *)
  14447. {
  14448. TimerDisplay*display= new(TimerDisplay);
  14449. if(element.hasAttribute("id"))
  14450. {
  14451. display->setObjectName(element.attribute("id"));
  14452. }
  14453. if(element.hasAttribute("format"))
  14454. {
  14455. display->setDisplayFormat(element.attribute("format"));
  14456. }
  14457. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  14458. splitter->addWidget(display);
  14459. }
  14460. void addTimerDisplayToLayout(QDomElement element,
  14461. QStack<QWidget*> *,
  14462. QStack<QLayout*> *layoutStack)
  14463. {
  14464. TimerDisplay*display= new(TimerDisplay);
  14465. if(element.hasAttribute("id"))
  14466. {
  14467. display->setObjectName(element.attribute("id"));
  14468. }
  14469. if(element.hasAttribute("format"))
  14470. {
  14471. display->setDisplayFormat(element.attribute("format"));
  14472. }
  14473. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  14474. layout->addWidget(display);
  14475. }
  14476. /*:178*//*179:*/
  14477. #line 4468 "./typica.w"
  14478. void addDecorationToLayout(QDomElement element,QStack<QWidget*> *,
  14479. QStack<QLayout*> *layoutStack)
  14480. {
  14481. /*180:*/
  14482. #line 4489 "./typica.w"
  14483. QString labelText= element.attribute("name");
  14484. Qt::Orientations orientation= Qt::Horizontal;
  14485. if(element.hasAttribute("type"))
  14486. {
  14487. if(element.attribute("type")=="horizontal")
  14488. {
  14489. orientation= Qt::Horizontal;
  14490. }
  14491. else if(element.attribute("type")=="vertical")
  14492. {
  14493. orientation= Qt::Vertical;
  14494. }
  14495. }
  14496. /*181:*/
  14497. #line 4514 "./typica.w"
  14498. QWidget*theWidget= NULL;
  14499. QDomNodeList children= element.childNodes();
  14500. for(int i= 0;i<children.count();i++)
  14501. {
  14502. QDomNode item= children.at(i);
  14503. if(item.isElement())
  14504. {
  14505. QDomElement itemElement= item.toElement();
  14506. if(itemElement.tagName()=="lcdtemperature")
  14507. {
  14508. TemperatureDisplay*display= new TemperatureDisplay;
  14509. if(itemElement.hasAttribute("id"))
  14510. {
  14511. display->setObjectName(itemElement.attribute("id"));
  14512. }
  14513. theWidget= display;
  14514. }
  14515. else if(itemElement.tagName()=="lcdtimer")
  14516. {
  14517. TimerDisplay*display= new TimerDisplay;
  14518. if(itemElement.hasAttribute("id"))
  14519. {
  14520. display->setObjectName(itemElement.attribute("id"));
  14521. }
  14522. if(itemElement.hasAttribute("format"))
  14523. {
  14524. display->setDisplayFormat(itemElement.attribute("format"));
  14525. }
  14526. theWidget= display;
  14527. }
  14528. }
  14529. }
  14530. /*:181*/
  14531. #line 4503 "./typica.w"
  14532. WidgetDecorator*decoration= new WidgetDecorator(theWidget,labelText,
  14533. orientation);
  14534. if(element.hasAttribute("id"))
  14535. {
  14536. decoration->setObjectName(element.attribute("id"));
  14537. }
  14538. /*:180*/
  14539. #line 4472 "./typica.w"
  14540. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  14541. layout->addWidget(decoration);
  14542. }
  14543. void addDecorationToSplitter(QDomElement element,
  14544. QStack<QWidget*> *widgetStack,
  14545. QStack<QLayout*> *)
  14546. {
  14547. /*180:*/
  14548. #line 4489 "./typica.w"
  14549. QString labelText= element.attribute("name");
  14550. Qt::Orientations orientation= Qt::Horizontal;
  14551. if(element.hasAttribute("type"))
  14552. {
  14553. if(element.attribute("type")=="horizontal")
  14554. {
  14555. orientation= Qt::Horizontal;
  14556. }
  14557. else if(element.attribute("type")=="vertical")
  14558. {
  14559. orientation= Qt::Vertical;
  14560. }
  14561. }
  14562. /*181:*/
  14563. #line 4514 "./typica.w"
  14564. QWidget*theWidget= NULL;
  14565. QDomNodeList children= element.childNodes();
  14566. for(int i= 0;i<children.count();i++)
  14567. {
  14568. QDomNode item= children.at(i);
  14569. if(item.isElement())
  14570. {
  14571. QDomElement itemElement= item.toElement();
  14572. if(itemElement.tagName()=="lcdtemperature")
  14573. {
  14574. TemperatureDisplay*display= new TemperatureDisplay;
  14575. if(itemElement.hasAttribute("id"))
  14576. {
  14577. display->setObjectName(itemElement.attribute("id"));
  14578. }
  14579. theWidget= display;
  14580. }
  14581. else if(itemElement.tagName()=="lcdtimer")
  14582. {
  14583. TimerDisplay*display= new TimerDisplay;
  14584. if(itemElement.hasAttribute("id"))
  14585. {
  14586. display->setObjectName(itemElement.attribute("id"));
  14587. }
  14588. if(itemElement.hasAttribute("format"))
  14589. {
  14590. display->setDisplayFormat(itemElement.attribute("format"));
  14591. }
  14592. theWidget= display;
  14593. }
  14594. }
  14595. }
  14596. /*:181*/
  14597. #line 4503 "./typica.w"
  14598. WidgetDecorator*decoration= new WidgetDecorator(theWidget,labelText,
  14599. orientation);
  14600. if(element.hasAttribute("id"))
  14601. {
  14602. decoration->setObjectName(element.attribute("id"));
  14603. }
  14604. /*:180*/
  14605. #line 4481 "./typica.w"
  14606. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  14607. splitter->addWidget(decoration);
  14608. }
  14609. /*:179*//*182:*/
  14610. #line 4553 "./typica.w"
  14611. void addWidgetToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  14612. QStack<QLayout*> *layoutStack)
  14613. {
  14614. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  14615. QWidget*widget= new QWidget;
  14616. if(element.hasAttribute("id"))
  14617. {
  14618. widget->setObjectName(element.attribute("id"));
  14619. }
  14620. splitter->addWidget(widget);
  14621. if(element.hasChildNodes())
  14622. {
  14623. widgetStack->push(widget);
  14624. populateWidget(element,widgetStack,layoutStack);
  14625. widgetStack->pop();
  14626. }
  14627. }
  14628. void populateWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  14629. QStack<QLayout*> *layoutStack)
  14630. {
  14631. QDomNodeList children= element.childNodes();
  14632. for(int i= 0;i<children.count();i++)
  14633. {
  14634. QDomNode current;
  14635. QDomElement currentElement;
  14636. current= children.at(i);
  14637. if(current.isElement())
  14638. {
  14639. currentElement= current.toElement();
  14640. if(currentElement.tagName()=="layout")
  14641. {
  14642. addLayoutToWidget(currentElement,widgetStack,layoutStack);
  14643. }
  14644. }
  14645. }
  14646. }
  14647. /*:182*//*183:*/
  14648. #line 4596 "./typica.w"
  14649. void addButtonToLayout(QDomElement element,QStack<QWidget*> *,
  14650. QStack<QLayout*> *layoutStack)
  14651. {
  14652. QAbstractButton*button= NULL;
  14653. QString text= element.attribute("name");
  14654. if(element.hasAttribute("type"))
  14655. {
  14656. QString type= element.attribute("type");
  14657. if(type=="annotation")
  14658. {
  14659. AnnotationButton*abutton= new AnnotationButton(text);
  14660. if(element.hasAttribute("annotation"))
  14661. {
  14662. abutton->setAnnotation(element.attribute("annotation"));
  14663. }
  14664. if(element.hasAttribute("series"))
  14665. {
  14666. abutton->setTemperatureColumn(element.attribute("series").
  14667. toInt());
  14668. }
  14669. if(element.hasAttribute("column"))
  14670. {
  14671. abutton->setAnnotationColumn(element.attribute("column").
  14672. toInt());
  14673. }
  14674. button= abutton;
  14675. }
  14676. else if(type=="check")
  14677. {
  14678. button= new QCheckBox(text);
  14679. }
  14680. else if(type=="push")
  14681. {
  14682. button= new QPushButton(text);
  14683. }
  14684. }
  14685. if(element.hasAttribute("id"))
  14686. {
  14687. button->setObjectName(element.attribute("id"));
  14688. }
  14689. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  14690. layout->addWidget(button);
  14691. }
  14692. /*:183*//*184:*/
  14693. #line 4648 "./typica.w"
  14694. void addSpinBoxToLayout(QDomElement element,QStack<QWidget*> *,
  14695. QStack<QLayout*> *layoutStack)
  14696. {
  14697. AnnotationSpinBox*box= new AnnotationSpinBox("","",NULL);
  14698. if(element.hasAttribute("pretext"))
  14699. {
  14700. box->setPretext(element.attribute("pretext"));
  14701. }
  14702. if(element.hasAttribute("posttext"))
  14703. {
  14704. box->setPosttext(element.attribute("posttext"));
  14705. }
  14706. if(element.hasAttribute("series"))
  14707. {
  14708. box->setTemperatureColumn(element.attribute("series").toInt());
  14709. }
  14710. if(element.hasAttribute("column"))
  14711. {
  14712. box->setAnnotationColumn(element.attribute("column").toInt());
  14713. }
  14714. if(element.hasAttribute("min"))
  14715. {
  14716. box->setMinimum(element.attribute("min").toDouble());
  14717. }
  14718. if(element.hasAttribute("max"))
  14719. {
  14720. box->setMaximum(element.attribute("max").toDouble());
  14721. }
  14722. if(element.hasAttribute("decimals"))
  14723. {
  14724. box->setDecimals(element.attribute("decimals").toInt());
  14725. }
  14726. if(element.hasAttribute("step"))
  14727. {
  14728. box->setSingleStep(element.attribute("step").toDouble());
  14729. }
  14730. if(element.hasAttribute("id"))
  14731. {
  14732. box->setObjectName(element.attribute("id"));
  14733. }
  14734. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  14735. layout->addWidget(box);
  14736. }
  14737. /*:184*//*185:*/
  14738. #line 4704 "./typica.w"
  14739. void addZoomLogToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  14740. QStack<QLayout*> *)
  14741. {
  14742. ZoomLog*widget= new ZoomLog;
  14743. if(!widget)
  14744. {
  14745. qDebug()<<"Error constructing widget!";
  14746. }
  14747. if(element.hasAttribute("id"))
  14748. {
  14749. widget->setObjectName(element.attribute("id"));
  14750. }
  14751. if(element.hasChildNodes())
  14752. {
  14753. QDomNodeList children= element.childNodes();
  14754. int column= 0;
  14755. for(int i= 0;i<children.count();i++)
  14756. {
  14757. QDomNode current;
  14758. QDomElement currentElement;
  14759. current= children.at(i);
  14760. if(current.isElement())
  14761. {
  14762. currentElement= current.toElement();
  14763. if(currentElement.tagName()=="column")
  14764. {
  14765. QString text= currentElement.text();
  14766. widget->setHeaderData(column,text);
  14767. column++;
  14768. }
  14769. }
  14770. }
  14771. }
  14772. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  14773. if(splitter)
  14774. {
  14775. splitter->addWidget(widget);
  14776. }
  14777. else
  14778. {
  14779. qDebug()<<"Splitter not found at top of widget stack!";
  14780. }
  14781. }
  14782. /*:185*//*186:*/
  14783. #line 4752 "./typica.w"
  14784. void addGraphToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  14785. QStack<QLayout*> *)
  14786. {
  14787. GraphView*view= new GraphView;
  14788. if(element.hasAttribute("id"))
  14789. {
  14790. view->setObjectName(element.attribute("id"));
  14791. }
  14792. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  14793. splitter->addWidget(view);
  14794. }
  14795. /*:186*//*187:*/
  14796. #line 4769 "./typica.w"
  14797. void addSqlDropToLayout(QDomElement element,QStack<QWidget*> *,
  14798. QStack<QLayout*> *layoutStack)
  14799. {
  14800. SqlComboBox*box= new SqlComboBox();
  14801. if(element.hasAttribute("data"))
  14802. {
  14803. box->setDataColumn(element.attribute("data").toInt());
  14804. }
  14805. if(element.hasAttribute("display"))
  14806. {
  14807. box->setDisplayColumn(element.attribute("display").toInt());
  14808. }
  14809. if(element.hasAttribute("showdata"))
  14810. {
  14811. if(element.attribute("showdata")=="true")
  14812. {
  14813. box->showData(true);
  14814. }
  14815. }
  14816. if(element.hasAttribute("editable"))
  14817. {
  14818. if(element.attribute("editable")=="true")
  14819. {
  14820. box->setEditable(true);
  14821. }
  14822. }
  14823. if(element.hasChildNodes())
  14824. {
  14825. QDomNodeList children= element.childNodes();
  14826. for(int i= 0;i<children.count();i++)
  14827. {
  14828. QDomNode current;
  14829. QDomElement currentElement;
  14830. current= children.at(i);
  14831. if(current.isElement())
  14832. {
  14833. currentElement= current.toElement();
  14834. if(currentElement.tagName()=="null")
  14835. {
  14836. box->addNullOption();
  14837. }
  14838. else if(currentElement.tagName()=="query")
  14839. {
  14840. box->addSqlOptions(currentElement.text());
  14841. }
  14842. }
  14843. }
  14844. }
  14845. if(element.hasAttribute("id"))
  14846. {
  14847. box->setObjectName(element.attribute("id"));
  14848. }
  14849. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  14850. layout->addWidget(box);
  14851. }
  14852. /*:187*//*188:*/
  14853. #line 4848 "./typica.w"
  14854. void addSaltToLayout(QDomElement element,QStack<QWidget*> *,
  14855. QStack<QLayout*> *layoutStack)
  14856. {
  14857. QTableView*view= new QTableView;
  14858. view->setProperty("tabletype",QVariant(QString("SaltTable")));
  14859. SaltModel*model= new SaltModel(element.childNodes().count());
  14860. if(element.hasAttribute("id"))
  14861. {
  14862. view->setObjectName(element.attribute("id"));
  14863. }
  14864. if(element.hasChildNodes())
  14865. {
  14866. QDomNodeList children= element.childNodes();
  14867. int currentColumn= 0;
  14868. for(int i= 0;i<children.count();i++)
  14869. {
  14870. QDomNode current;
  14871. QDomElement currentElement;
  14872. current= children.at(i);
  14873. if(current.isElement())
  14874. {
  14875. currentElement= current.toElement();
  14876. if(currentElement.tagName()=="column")
  14877. {
  14878. if(currentElement.hasAttribute("name"))
  14879. {
  14880. model->setHeaderData(currentColumn,Qt::Horizontal,
  14881. currentElement.attribute("name"));
  14882. }
  14883. if(currentElement.hasAttribute("delegate"))
  14884. {
  14885. /*189:*/
  14886. #line 4896 "./typica.w"
  14887. if(currentElement.attribute("delegate")=="sql")
  14888. {
  14889. /*190:*/
  14890. #line 4912 "./typica.w"
  14891. SqlComboBoxDelegate*delegate= new SqlComboBoxDelegate;
  14892. SqlComboBox*widget= new SqlComboBox();
  14893. if(currentElement.hasAttribute("nulltext"))
  14894. {
  14895. widget->setNullText(currentElement.attribute("nulltext"));
  14896. }
  14897. if(currentElement.hasAttribute("nulldata"))
  14898. {
  14899. widget->setNullData(QVariant(currentElement.attribute("nulldata")));
  14900. }
  14901. if(currentElement.hasAttribute("null"))
  14902. {
  14903. if(currentElement.attribute("null")=="true")
  14904. {
  14905. widget->addNullOption();
  14906. }
  14907. }
  14908. if(currentElement.hasAttribute("showdata"))
  14909. {
  14910. if(currentElement.attribute("showdata")=="true")
  14911. {
  14912. widget->showData(true);
  14913. }
  14914. }
  14915. if(currentElement.hasAttribute("data"))
  14916. {
  14917. widget->setDataColumn(currentElement.attribute("data").toInt());
  14918. }
  14919. if(currentElement.hasAttribute("display"))
  14920. {
  14921. widget->setDisplayColumn(currentElement.attribute("display").toInt());
  14922. }
  14923. widget->addSqlOptions(currentElement.text());
  14924. delegate->setWidget(widget);
  14925. view->setItemDelegateForColumn(currentColumn,delegate);
  14926. /*:190*/
  14927. #line 4899 "./typica.w"
  14928. }
  14929. else if(currentElement.attribute("delegate")=="numeric")
  14930. {
  14931. /*191:*/
  14932. #line 4953 "./typica.w"
  14933. NumericDelegate*delegate= new NumericDelegate;
  14934. view->setItemDelegateForColumn(currentColumn,delegate);
  14935. /*:191*/
  14936. #line 4903 "./typica.w"
  14937. }
  14938. /*:189*/
  14939. #line 4880 "./typica.w"
  14940. }
  14941. currentColumn++;
  14942. }
  14943. }
  14944. }
  14945. }
  14946. view->setModel(model);
  14947. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  14948. layout->addWidget(view);
  14949. }
  14950. /*:188*//*198:*/
  14951. #line 5063 "./typica.w"
  14952. void addLineToLayout(QDomElement element,QStack<QWidget*> *,
  14953. QStack<QLayout*> *layoutStack)
  14954. {
  14955. QLineEdit*widget= new QLineEdit(element.text());
  14956. if(element.hasAttribute("id"))
  14957. {
  14958. widget->setObjectName(element.attribute("id"));
  14959. }
  14960. if(element.hasAttribute("writable"))
  14961. {
  14962. if(element.attribute("writable")=="false")
  14963. {
  14964. widget->setReadOnly(true);
  14965. }
  14966. }
  14967. if(element.hasAttribute("validator"))
  14968. {
  14969. if(element.attribute("validator")=="numeric")
  14970. {
  14971. widget->setValidator(new QDoubleValidator(NULL));
  14972. }
  14973. else if(element.attribute("validator")=="integer")
  14974. {
  14975. widget->setValidator(new QIntValidator(NULL));
  14976. }
  14977. else if(element.attribute("validator")=="expression"&&
  14978. element.hasAttribute("expression"))
  14979. {
  14980. widget->setValidator(new QRegExpValidator(
  14981. QRegExp(element.attribute("expression")),
  14982. NULL));
  14983. }
  14984. }
  14985. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  14986. layout->addWidget(widget);
  14987. }
  14988. /*:198*//*199:*/
  14989. #line 5104 "./typica.w"
  14990. void addTextToLayout(QDomElement element,QStack<QWidget*> *,
  14991. QStack<QLayout*> *layoutStack)
  14992. {
  14993. QTextEdit*widget= new QTextEdit;
  14994. if(element.hasAttribute("id"))
  14995. {
  14996. widget->setObjectName(element.attribute("id"));
  14997. }
  14998. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  14999. layout->addWidget(widget);
  15000. }
  15001. /*:199*//*200:*/
  15002. #line 5121 "./typica.w"
  15003. void addSqlQueryViewToLayout(QDomElement element,
  15004. QStack<QWidget*> *,
  15005. QStack<QLayout*> *layoutStack)
  15006. {
  15007. SqlQueryView*view= new SqlQueryView;
  15008. if(element.hasAttribute("id"))
  15009. {
  15010. view->setObjectName(element.attribute("id"));
  15011. }
  15012. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  15013. layout->addWidget(view);
  15014. }
  15015. /*:200*//*201:*/
  15016. #line 5138 "./typica.w"
  15017. void addCalendarToLayout(QDomElement element,QStack<QWidget*> *,
  15018. QStack<QLayout*> *layoutStack)
  15019. {
  15020. QDateEdit*widget= new QDateEdit;
  15021. widget->setCalendarPopup(true);
  15022. if(element.hasAttribute("id"))
  15023. {
  15024. widget->setObjectName(element.attribute("id"));
  15025. }
  15026. widget->setDate(QDate::currentDate());
  15027. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  15028. layout->addWidget(widget);
  15029. }
  15030. /*:201*//*202:*/
  15031. #line 5156 "./typica.w"
  15032. void setQDateEditProperties(QScriptValue value,QScriptEngine*engine)
  15033. {
  15034. setQDateTimeEditProperties(value,engine);
  15035. }
  15036. void setQDateTimeEditProperties(QScriptValue value,QScriptEngine*engine)
  15037. {
  15038. setQAbstractSpinBoxProperties(value,engine);
  15039. value.setProperty("setDate",engine->newFunction(QDateTimeEdit_setDate));
  15040. value.setProperty("day",engine->newFunction(QDateTimeEdit_day));
  15041. value.setProperty("month",engine->newFunction(QDateTimeEdit_month));
  15042. value.setProperty("year",engine->newFunction(QDateTimeEdit_year));
  15043. }
  15044. /*:202*//*203:*/
  15045. #line 5176 "./typica.w"
  15046. QScriptValue QDateTimeEdit_setDate(QScriptContext*context,QScriptEngine*)
  15047. {
  15048. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  15049. if(context->argumentCount()==3)
  15050. {
  15051. self->setDate(QDate(argument<int> (0,context),
  15052. argument<int> (1,context),
  15053. argument<int> (2,context)));
  15054. }
  15055. else
  15056. {
  15057. context->throwError("Incorrect number of arguments passed to "
  15058. "QDateTimeEdit::setDate(). This method takes three integer arguments "
  15059. "specifying the year, month, and day.");
  15060. }
  15061. return QScriptValue();
  15062. }
  15063. QScriptValue QDateTimeEdit_day(QScriptContext*context,QScriptEngine*)
  15064. {
  15065. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  15066. return QScriptValue(self->date().day());
  15067. }
  15068. QScriptValue QDateTimeEdit_month(QScriptContext*context,QScriptEngine*)
  15069. {
  15070. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  15071. return QScriptValue(self->date().month());
  15072. }
  15073. QScriptValue QDateTimeEdit_year(QScriptContext*context,QScriptEngine*)
  15074. {
  15075. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  15076. return QScriptValue(self->date().year());
  15077. }
  15078. /*:203*//*207:*/
  15079. #line 5243 "./typica.w"
  15080. QScriptValue findChildObject(QScriptContext*context,QScriptEngine*engine)
  15081. {
  15082. QObject*parent= argument<QObject*> (0,context);
  15083. QString name= argument<QString> (1,context);
  15084. QObject*object= parent->findChild<QObject*> (name);
  15085. QScriptValue value;
  15086. if(object)
  15087. {
  15088. value= engine->newQObject(object);
  15089. QString className= object->metaObject()->className();
  15090. /*208:*/
  15091. #line 5261 "./typica.w"
  15092. if(className=="TemperatureDisplay")
  15093. {
  15094. setTemperatureDisplayProperties(value,engine);
  15095. }
  15096. else if(className=="TimerDisplay")
  15097. {
  15098. setTimerDisplayProperties(value,engine);
  15099. }
  15100. else if(className=="QAction")
  15101. {
  15102. setQActionProperties(value,engine);
  15103. }
  15104. else if(className=="QBoxLayout")
  15105. {
  15106. setQBoxLayoutProperties(value,engine);
  15107. }
  15108. else if(className=="QDateEdit")
  15109. {
  15110. setQDateEditProperties(value,engine);
  15111. }
  15112. else if(className=="QFrame")
  15113. {
  15114. setQFrameProperties(value,engine);
  15115. }
  15116. else if(className=="QHBoxLayout")
  15117. {
  15118. setQBoxLayoutProperties(value,engine);
  15119. }
  15120. else if(className=="QLCDNumber")
  15121. {
  15122. setQLCDNumberProperties(value,engine);
  15123. }
  15124. else if(className=="QMenu")
  15125. {
  15126. setQMenuProperties(value,engine);
  15127. }
  15128. else if(className=="QMenuBar")
  15129. {
  15130. setQMenuBarProperties(value,engine);
  15131. }
  15132. else if(className=="QPushButton")
  15133. {
  15134. setQPushButtonProperties(value,engine);
  15135. }
  15136. else if(className=="QSplitter")
  15137. {
  15138. setQSplitterProperties(value,engine);
  15139. }
  15140. else if(className=="QTableView")
  15141. {
  15142. if(object->property("tabletype").isValid())
  15143. {
  15144. if(object->property("tabletype").toString()=="SaltTable")
  15145. {
  15146. setSaltTableProperties(value,engine);
  15147. }
  15148. }
  15149. }
  15150. else if(className=="QVBoxLayout")
  15151. {
  15152. setQBoxLayoutProperties(value,engine);
  15153. }
  15154. else if(className=="QWidget")
  15155. {
  15156. setQWidgetProperties(value,engine);
  15157. }
  15158. else if(className=="ScriptQMainWindow")
  15159. {
  15160. setQMainWindowProperties(value,engine);
  15161. }
  15162. else if(className=="SqlComboBox")
  15163. {
  15164. setSqlComboBoxProperties(value,engine);
  15165. }
  15166. else if(className=="SqlQueryView")
  15167. {
  15168. setSqlQueryViewProperties(value,engine);
  15169. }
  15170. else if(className=="ZoomLog")
  15171. {
  15172. setZoomLogProperties(value,engine);
  15173. }
  15174. else if(className=="QTextEdit")
  15175. {
  15176. setQTextEditProperties(value,engine);
  15177. }
  15178. else if(className=="QWebView")
  15179. {
  15180. setQWebViewProperties(value,engine);
  15181. }
  15182. else if(className=="QLineEdit")
  15183. {
  15184. setQLineEditProperties(value,engine);
  15185. }
  15186. /*:208*/
  15187. #line 5254 "./typica.w"
  15188. }
  15189. return value;
  15190. }
  15191. /*:207*//*210:*/
  15192. #line 5386 "./typica.w"
  15193. QScriptValue SaltTable_columnSum(QScriptContext*context,QScriptEngine*engine)
  15194. {
  15195. QTableView*self= getself<QTableView*> (context);
  15196. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  15197. QString datum;
  15198. double total= 0.0;
  15199. int column= argument<int> (0,context);
  15200. int role= argument<int> (1,context);
  15201. for(int i= 0;i<model->rowCount();i++)
  15202. {
  15203. datum= model->data(model->index(i,column),role).toString();
  15204. if(!datum.isEmpty())
  15205. {
  15206. total+= datum.toDouble();
  15207. }
  15208. }
  15209. return QScriptValue(engine,total);
  15210. }
  15211. /*:210*//*211:*/
  15212. #line 5410 "./typica.w"
  15213. QScriptValue SaltTable_columnArray(QScriptContext*context,
  15214. QScriptEngine*engine)
  15215. {
  15216. QTableView*self= getself<QTableView*> (context);
  15217. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  15218. int column= argument<int> (0,context);
  15219. int role= argument<int> (1,context);
  15220. QString literal= model->arrayLiteral(column,role);
  15221. return QScriptValue(engine,literal);
  15222. }
  15223. QScriptValue SaltTable_quotedColumnArray(QScriptContext*context,
  15224. QScriptEngine*engine)
  15225. {
  15226. QTableView*self= getself<QTableView*> (context);
  15227. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  15228. int column= argument<int> (0,context);
  15229. int role= argument<int> (1,context);
  15230. QString literal= model->quotedArrayLiteral(column,role);
  15231. return QScriptValue(engine,literal);
  15232. }
  15233. QScriptValue SaltTable_bindableColumnArray(QScriptContext*context,
  15234. QScriptEngine*engine)
  15235. {
  15236. QTableView*self= getself<QTableView*> (context);
  15237. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  15238. int column= argument<int> (0,context);
  15239. int role= argument<int> (1,context);
  15240. QString literal= model->arrayLiteral(column,role);
  15241. literal.chop(1);
  15242. literal= literal.remove(0,1);
  15243. return QScriptValue(engine,literal);
  15244. }
  15245. QScriptValue SaltTable_bindableQuotedColumnArray(QScriptContext*context,
  15246. QScriptEngine*engine)
  15247. {
  15248. QTableView*self= getself<QTableView*> (context);
  15249. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  15250. int column= argument<int> (0,context);
  15251. int role= argument<int> (1,context);
  15252. QString literal= model->quotedArrayLiteral(column,role);
  15253. literal.chop(1);
  15254. literal= literal.remove(0,1);
  15255. return QScriptValue(engine,literal);
  15256. }
  15257. /*:211*//*212:*/
  15258. #line 5462 "./typica.w"
  15259. QScriptValue SaltTable_model(QScriptContext*context,QScriptEngine*engine)
  15260. {
  15261. QTableView*self= getself<QTableView*> (context);
  15262. QScriptValue value= engine->newQObject(self->model());
  15263. return value;
  15264. }
  15265. /*:212*//*213:*/
  15266. #line 5476 "./typica.w"
  15267. QScriptValue SaltTable_setData(QScriptContext*context,QScriptEngine*)
  15268. {
  15269. QTableView*self= getself<QTableView*> (context);
  15270. int row= argument<int> (0,context);
  15271. int column= argument<int> (1,context);
  15272. QVariant value= argument<QVariant> (2,context);
  15273. int role= argument<int> (3,context);
  15274. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  15275. QModelIndex cell= model->index(row,column);
  15276. model->setData(cell,value,role);
  15277. self->update(cell);
  15278. return QScriptValue();
  15279. }
  15280. /*:213*//*214:*/
  15281. #line 5494 "./typica.w"
  15282. QScriptValue SaltTable_data(QScriptContext*context,QScriptEngine*engine)
  15283. {
  15284. QTableView*self= getself<QTableView*> (context);
  15285. int row= argument<int> (0,context);
  15286. int column= argument<int> (1,context);
  15287. int role= argument<int> (2,context);
  15288. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  15289. QModelIndex cell= model->index(row,column);
  15290. QVariant value= model->data(cell,role);
  15291. QScriptValue retval= engine->newVariant(value);
  15292. retval.setProperty("value",QScriptValue(value.toString()));
  15293. return retval;
  15294. }
  15295. /*:214*//*215:*/
  15296. #line 5514 "./typica.w"
  15297. QScriptValue SaltTable_clear(QScriptContext*context,QScriptEngine*)
  15298. {
  15299. QTableView*self= getself<QTableView*> (context);
  15300. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  15301. model->clear();
  15302. return QScriptValue();
  15303. }
  15304. /*:215*//*216:*/
  15305. #line 5526 "./typica.w"
  15306. QScriptValue SaltTable_removeRow(QScriptContext*context,QScriptEngine*engine)
  15307. {
  15308. QTableView*self= getself<QTableView*> (context);
  15309. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  15310. int row= argument<int> (0,context);
  15311. return engine->newVariant(model->removeRow(row));
  15312. }
  15313. /*:216*//*217:*/
  15314. #line 5539 "./typica.w"
  15315. QScriptValue SaltTable_findData(QScriptContext*context,QScriptEngine*engine)
  15316. {
  15317. QTableView*self= getself<QTableView*> (context);
  15318. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  15319. QVariant value= argument<QVariant> (0,context);
  15320. int column= argument<int> (1,context);
  15321. return engine->newVariant(model->findData(value,column));
  15322. }
  15323. /*:217*//*218:*/
  15324. #line 5552 "./typica.w"
  15325. void setSaltTableProperties(QScriptValue value,QScriptEngine*engine)
  15326. {
  15327. setQWidgetProperties(value,engine);
  15328. value.setProperty("columnArray",
  15329. engine->newFunction(SaltTable_columnArray));
  15330. value.setProperty("quotedColumnArray",
  15331. engine->newFunction(SaltTable_quotedColumnArray));
  15332. value.setProperty("bindableColumnArray",
  15333. engine->newFunction(SaltTable_bindableColumnArray));
  15334. value.setProperty("bindableQuotedColumnArray",
  15335. engine->newFunction(SaltTable_bindableQuotedColumnArray));
  15336. value.setProperty("columnSum",engine->newFunction(SaltTable_columnSum));
  15337. value.setProperty("data",engine->newFunction(SaltTable_data));
  15338. value.setProperty("model",engine->newFunction(SaltTable_model));
  15339. value.setProperty("setData",engine->newFunction(SaltTable_setData));
  15340. value.setProperty("clear",engine->newFunction(SaltTable_clear));
  15341. value.setProperty("removeRow",engine->newFunction(SaltTable_removeRow));
  15342. value.setProperty("findData",engine->newFunction(SaltTable_findData));
  15343. }
  15344. /*:218*//*220:*/
  15345. #line 5589 "./typica.w"
  15346. void setSqlComboBoxProperties(QScriptValue value,QScriptEngine*engine)
  15347. {
  15348. setQComboBoxProperties(value,engine);
  15349. }
  15350. void setQComboBoxProperties(QScriptValue value,QScriptEngine*engine)
  15351. {
  15352. setQWidgetProperties(value,engine);
  15353. value.setProperty("currentData",
  15354. engine->newFunction(QComboBox_currentData));
  15355. value.setProperty("addItem",engine->newFunction(QComboBox_addItem));
  15356. value.setProperty("setModel",engine->newFunction(QComboBox_setModel));
  15357. value.setProperty("findText",engine->newFunction(QComboBox_findText));
  15358. value.setProperty("findData",engine->newFunction(QComboBox_findData));
  15359. }
  15360. QScriptValue QComboBox_currentData(QScriptContext*context,
  15361. QScriptEngine*engine)
  15362. {
  15363. QComboBox*self= getself<QComboBox*> (context);
  15364. return QScriptValue(engine,
  15365. self->itemData(self->currentIndex()).toString());
  15366. }
  15367. QScriptValue QComboBox_addItem(QScriptContext*context,QScriptEngine*)
  15368. {
  15369. QComboBox*self= getself<QComboBox*> (context);
  15370. self->addItem(argument<QString> (0,context));
  15371. return QScriptValue();
  15372. }
  15373. QScriptValue QComboBox_setModel(QScriptContext*context,QScriptEngine*)
  15374. {
  15375. QComboBox*self= getself<QComboBox*> (context);
  15376. self->setModel(argument<QAbstractItemModel*> (0,context));
  15377. return QScriptValue();
  15378. }
  15379. QScriptValue QComboBox_findText(QScriptContext*context,QScriptEngine*engine)
  15380. {
  15381. QComboBox*self= getself<QComboBox*> (context);
  15382. return QScriptValue(engine,self->findText(argument<QString> (0,context)));
  15383. }
  15384. QScriptValue QComboBox_findData(QScriptContext*context,QScriptEngine*engine)
  15385. {
  15386. QComboBox*self= getself<QComboBox*> (context);
  15387. return QScriptValue(engine,self->findData(argument<QVariant> (0,context)));
  15388. }
  15389. #line 1 "./abouttypica.w"
  15390. /*:220*//*233:*/
  15391. #line 388 "./units.w"
  15392. QScriptValue Units_convertTemperature(QScriptContext*context,QScriptEngine*)
  15393. {
  15394. return QScriptValue(Units::convertTemperature(argument<double> (0,context),
  15395. argument<Units::Unit> (1,context),
  15396. argument<Units::Unit> (2,context)));
  15397. }
  15398. QScriptValue Units_convertRelativeTemperature(QScriptContext*context,
  15399. QScriptEngine*)
  15400. {
  15401. return QScriptValue(Units::convertRelativeTemperature(
  15402. argument<double> (0,context),
  15403. argument<Units::Unit> (1,context),
  15404. argument<Units::Unit> (2,context)));
  15405. }
  15406. QScriptValue Units_isTemperatureUnit(QScriptContext*context,QScriptEngine*)
  15407. {
  15408. return QScriptValue(Units::isTemperatureUnit(argument<Units::Unit> (0,context)));
  15409. }
  15410. QScriptValue Units_convertWeight(QScriptContext*context,QScriptEngine*)
  15411. {
  15412. return QScriptValue(Units::convertWeight(argument<double> (0,context),
  15413. argument<Units::Unit> (1,context),
  15414. argument<Units::Unit> (2,context)));
  15415. }
  15416. QScriptValue Units_isWeightUnit(QScriptContext*context,QScriptEngine*)
  15417. {
  15418. return QScriptValue(Units::isWeightUnit(argument<Units::Unit> (0,context)));
  15419. }
  15420. /*:233*//*236:*/
  15421. #line 436 "./units.w"
  15422. QScriptValue Unit_toScriptValue(QScriptEngine*engine,const Units::Unit&value)
  15423. {
  15424. return engine->newVariant(QVariant(value));
  15425. }
  15426. void Unit_fromScriptValue(const QScriptValue&sv,Units::Unit&value)
  15427. {
  15428. value= sv.toVariant().value<Units::Unit> ();
  15429. }
  15430. /*:236*//*260:*/
  15431. #line 6235 "./typica.w"
  15432. QScriptValue constructDAQ(QScriptContext*context,QScriptEngine*engine)
  15433. {
  15434. QScriptValue object;
  15435. if(context->argumentCount()==1)
  15436. {
  15437. object= engine->newQObject(new DAQ(argument<QString> (0,context)),
  15438. QScriptEngine::ScriptOwnership);
  15439. setDAQProperties(object,engine);
  15440. }
  15441. else if(context->argumentCount()==2)
  15442. {
  15443. object= engine->newQObject(new DAQ(argument<QString> (0,context),
  15444. argument<QString> (1,context)),
  15445. QScriptEngine::ScriptOwnership);
  15446. setDAQProperties(object,engine);
  15447. }
  15448. else
  15449. {
  15450. context->throwError("Incorrect number of arguments passed to DAQ"
  15451. "constructor. The DAQ constructor takes one"
  15452. "string as an argument specifying a device name."
  15453. "Example: Dev1");
  15454. }
  15455. return object;
  15456. }
  15457. /*:260*//*261:*/
  15458. #line 6265 "./typica.w"
  15459. void setDAQProperties(QScriptValue value,QScriptEngine*engine)
  15460. {
  15461. setQObjectProperties(value,engine);
  15462. value.setProperty("newChannel",engine->newFunction(DAQ_newChannel));
  15463. }
  15464. /*:261*//*262:*/
  15465. #line 6275 "./typica.w"
  15466. QScriptValue DAQ_newChannel(QScriptContext*context,QScriptEngine*engine)
  15467. {
  15468. DAQ*self= getself<DAQ*> (context);
  15469. QScriptValue object;
  15470. if(self)
  15471. {
  15472. object=
  15473. engine->newQObject(self->newChannel(argument<int> (0,context),
  15474. argument<int> (1,context)));
  15475. setChannelProperties(object,engine);
  15476. }
  15477. return object;
  15478. }
  15479. /*:262*//*269:*/
  15480. #line 6431 "./typica.w"
  15481. QScriptValue constructFakeDAQ(QScriptContext*context,
  15482. QScriptEngine*engine)
  15483. {
  15484. QScriptValue object;
  15485. if(context->argumentCount()==1)
  15486. {
  15487. object=
  15488. engine->newQObject(new FakeDAQ(argument<QString> (0,context)),
  15489. QScriptEngine::ScriptOwnership);
  15490. setFakeDAQProperties(object,engine);
  15491. }
  15492. else
  15493. {
  15494. context->throwError("Incorrect number of arguments passed to DAQ"
  15495. "constructor. The DAQ constructor takes one"
  15496. "string as an argument specifying a device name."
  15497. "Example: Dev1");
  15498. }
  15499. return object;
  15500. }
  15501. void setFakeDAQProperties(QScriptValue value,QScriptEngine*engine)
  15502. {
  15503. setQObjectProperties(value,engine);
  15504. value.setProperty("newChannel",engine->newFunction(FakeDAQ_newChannel));
  15505. }
  15506. QScriptValue FakeDAQ_newChannel(QScriptContext*context,QScriptEngine*engine)
  15507. {
  15508. FakeDAQ*self= getself<FakeDAQ*> (context);
  15509. QScriptValue object;
  15510. if(self)
  15511. {
  15512. object=
  15513. engine->newQObject(self->newChannel(argument<int> (0,context),
  15514. argument<int> (1,context)));
  15515. setChannelProperties(object,engine);
  15516. }
  15517. return object;
  15518. }
  15519. /*:269*//*273:*/
  15520. #line 6522 "./typica.w"
  15521. void setChannelProperties(QScriptValue value,QScriptEngine*engine)
  15522. {
  15523. setQObjectProperties(value,engine);
  15524. }
  15525. /*:273*//*280:*/
  15526. #line 6714 "./typica.w"
  15527. QScriptValue constructLinearCalibrator(QScriptContext*,QScriptEngine*engine)
  15528. {
  15529. QScriptValue object= engine->newQObject(new LinearCalibrator(NULL));
  15530. setLinearCalibratorProperties(object,engine);
  15531. return object;
  15532. }
  15533. void setLinearCalibratorProperties(QScriptValue value,QScriptEngine*engine)
  15534. {
  15535. setQObjectProperties(value,engine);
  15536. }
  15537. /*:280*//*285:*/
  15538. #line 6852 "./typica.w"
  15539. QScriptValue constructLinearSplineInterpolator(QScriptContext*,QScriptEngine*engine)
  15540. {
  15541. QScriptValue object= engine->newQObject(new LinearSplineInterpolator(NULL));
  15542. setLinearSplineInterpolatorProperties(object,engine);
  15543. return object;
  15544. }
  15545. void setLinearSplineInterpolatorProperties(QScriptValue value,QScriptEngine*engine)
  15546. {
  15547. setQObjectProperties(value,engine);
  15548. }
  15549. /*:285*//*295:*/
  15550. #line 7058 "./typica.w"
  15551. QScriptValue constructTemperatureDisplay(QScriptContext*,
  15552. QScriptEngine*engine)
  15553. {
  15554. QScriptValue object= engine->newQObject(new TemperatureDisplay);
  15555. setTemperatureDisplayProperties(object,engine);
  15556. return object;
  15557. }
  15558. void setTemperatureDisplayProperties(QScriptValue value,QScriptEngine*engine)
  15559. {
  15560. setQLCDNumberProperties(value,engine);
  15561. value.setProperty("setDisplayUnits",
  15562. engine->newFunction(TemperatureDisplay_setDisplayUnits));
  15563. }
  15564. /*:295*//*296:*/
  15565. #line 7082 "./typica.w"
  15566. QScriptValue TemperatureDisplay_setDisplayUnits(QScriptContext*context,QScriptEngine*)
  15567. {
  15568. TemperatureDisplay*self= getself<TemperatureDisplay*> (context);
  15569. self->setDisplayUnits((Units::Unit)argument<int> (0,context));
  15570. return QScriptValue();
  15571. }
  15572. /*:296*//*303:*/
  15573. #line 7219 "./typica.w"
  15574. QScriptValue constructMeasurementTimeOffset(QScriptContext*,
  15575. QScriptEngine*engine)
  15576. {
  15577. QScriptValue object=
  15578. engine->newQObject(new MeasurementTimeOffset(QTime::currentTime()));
  15579. setMeasurementTimeOffsetProperties(object,engine);
  15580. return object;
  15581. }
  15582. void setMeasurementTimeOffsetProperties(QScriptValue value,
  15583. QScriptEngine*engine)
  15584. {
  15585. setQObjectProperties(value,engine);
  15586. }
  15587. /*:303*//*308:*/
  15588. #line 7328 "./typica.w"
  15589. QScriptValue constructThresholdDetector(QScriptContext*,QScriptEngine*engine)
  15590. {
  15591. QScriptValue object= engine->newQObject(new ThresholdDetector(300));
  15592. return object;
  15593. }
  15594. void setThresholdDetectorProperties(QScriptValue value,QScriptEngine*engine)
  15595. {
  15596. setQObjectProperties(value,engine);
  15597. }
  15598. /*:308*//*313:*/
  15599. #line 7425 "./typica.w"
  15600. QScriptValue constructZeroEmitter(QScriptContext*context,
  15601. QScriptEngine*engine)
  15602. {
  15603. QScriptValue object=
  15604. engine->newQObject(new ZeroEmitter(argument<int> (0,context)));
  15605. setZeroEmitterProperties(object,engine);
  15606. return object;
  15607. }
  15608. void setZeroEmitterProperties(QScriptValue value,QScriptEngine*engine)
  15609. {
  15610. setQObjectProperties(value,engine);
  15611. }
  15612. /*:313*//*318:*/
  15613. #line 7505 "./typica.w"
  15614. QScriptValue constructMeasurementAdapter(QScriptContext*context,
  15615. QScriptEngine*engine)
  15616. {
  15617. QScriptValue object=
  15618. engine->newQObject(new MeasurementAdapter(argument<int> (0,context)));
  15619. setMeasurementAdapterProperties(object,engine);
  15620. return object;
  15621. }
  15622. void setMeasurementAdapterProperties(QScriptValue value,QScriptEngine*engine)
  15623. {
  15624. setQObjectProperties(value,engine);
  15625. }
  15626. /*:318*//*335:*/
  15627. #line 7967 "./typica.w"
  15628. QScriptValue constructGraphView(QScriptContext*,QScriptEngine*engine)
  15629. {
  15630. QScriptValue object= engine->newQObject(new GraphView);
  15631. setGraphViewProperties(object,engine);
  15632. return object;
  15633. }
  15634. void setGraphViewProperties(QScriptValue value,QScriptEngine*engine)
  15635. {
  15636. setQGraphicsViewProperties(value,engine);
  15637. }
  15638. /*:335*//*358:*/
  15639. #line 8605 "./typica.w"
  15640. QScriptValue constructZoomLog(QScriptContext*,QScriptEngine*engine)
  15641. {
  15642. QScriptValue object= engine->newQObject(new ZoomLog);
  15643. setZoomLogProperties(object,engine);
  15644. return object;
  15645. }
  15646. void setZoomLogProperties(QScriptValue value,QScriptEngine*engine)
  15647. {
  15648. setQTableViewProperties(value,engine);
  15649. value.setProperty("saveXML",engine->newFunction(ZoomLog_saveXML));
  15650. value.setProperty("saveCSV",engine->newFunction(ZoomLog_saveCSV));
  15651. value.setProperty("saveState",engine->newFunction(ZoomLog_saveState));
  15652. value.setProperty("restoreState",
  15653. engine->newFunction(ZoomLog_restoreState));
  15654. value.setProperty("lastTime",engine->newFunction(ZoomLog_lastTime));
  15655. value.setProperty("saveTemporary",
  15656. engine->newFunction(ZoomLog_saveTemporary));
  15657. value.setProperty("setDisplayUnits",engine->newFunction(ZoomLog_setDisplayUnits));
  15658. }
  15659. /*:358*//*359:*/
  15660. #line 8632 "./typica.w"
  15661. QScriptValue ZoomLog_saveXML(QScriptContext*context,QScriptEngine*engine)
  15662. {
  15663. ZoomLog*self= getself<ZoomLog*> (context);
  15664. bool retval= self->saveXML(argument<QIODevice*> (0,context));
  15665. return QScriptValue(engine,retval);
  15666. }
  15667. QScriptValue ZoomLog_saveCSV(QScriptContext*context,QScriptEngine*engine)
  15668. {
  15669. ZoomLog*self= getself<ZoomLog*> (context);
  15670. bool retval= self->saveCSV(argument<QIODevice*> (0,context));
  15671. return QScriptValue(engine,retval);
  15672. }
  15673. QScriptValue ZoomLog_saveTemporary(QScriptContext*context,
  15674. QScriptEngine*engine)
  15675. {
  15676. ZoomLog*self= getself<ZoomLog*> (context);
  15677. QString filename= QDir::tempPath();
  15678. filename.append("/");
  15679. filename.append(QUuid::createUuid().toString());
  15680. filename.append(".xml");
  15681. QFile*file= new QFile(filename);
  15682. self->saveXML(file);
  15683. file->close();
  15684. delete file;
  15685. return QScriptValue(engine,filename);
  15686. }
  15687. /*:359*//*360:*/
  15688. #line 8680 "./typica.w"
  15689. QScriptValue ZoomLog_saveState(QScriptContext*context,QScriptEngine*)
  15690. {
  15691. ZoomLog*self= getself<ZoomLog*> (context);
  15692. QString key= argument<QString> (0,context);
  15693. int columns= argument<int> (1,context);
  15694. QSettings settings;
  15695. for(int i= 0;i<columns;i++)
  15696. {
  15697. if(self->columnWidth(i))
  15698. {
  15699. settings.beginGroup(key);
  15700. settings.setValue(QString("%1").arg(i),self->columnWidth(i));
  15701. settings.endGroup();
  15702. }
  15703. }
  15704. return QScriptValue();
  15705. }
  15706. QScriptValue ZoomLog_restoreState(QScriptContext*context,QScriptEngine*)
  15707. {
  15708. ZoomLog*self= getself<ZoomLog*> (context);
  15709. QString key= argument<QString> (0,context);
  15710. int columns= argument<int> (1,context);
  15711. QSettings settings;
  15712. for(int i= 0;i<columns;i++)
  15713. {
  15714. settings.beginGroup(key);
  15715. self->setColumnWidth(i,
  15716. settings.value(QString("%1").arg(i),80).toInt());
  15717. if(settings.value(QString("%1").arg(i),80).toInt()==0)
  15718. {
  15719. self->setColumnWidth(i,80);
  15720. }
  15721. settings.endGroup();
  15722. }
  15723. return QScriptValue();
  15724. }
  15725. QScriptValue ZoomLog_lastTime(QScriptContext*context,QScriptEngine*engine)
  15726. {
  15727. ZoomLog*self= getself<ZoomLog*> (context);
  15728. return QScriptValue(engine,self->lastTime(argument<int> (0,context)));
  15729. }
  15730. /*:360*//*361:*/
  15731. #line 8733 "./typica.w"
  15732. QScriptValue ZoomLog_setDisplayUnits(QScriptContext*context,QScriptEngine*)
  15733. {
  15734. ZoomLog*self= getself<ZoomLog*> (context);
  15735. self->setDisplayUnits((Units::Unit)argument<int> (0,context));
  15736. return QScriptValue();
  15737. }
  15738. /*:361*//*396:*/
  15739. #line 9553 "./typica.w"
  15740. QScriptValue constructAnnotationButton(QScriptContext*context,
  15741. QScriptEngine*engine)
  15742. {
  15743. QScriptValue object=
  15744. engine->newQObject(new AnnotationButton(argument<QString> (0,context)));
  15745. setAnnotationButtonProperties(object,engine);
  15746. return object;
  15747. }
  15748. void setAnnotationButtonProperties(QScriptValue value,QScriptEngine*engine)
  15749. {
  15750. setQPushButtonProperties(value,engine);
  15751. }
  15752. /*:396*//*404:*/
  15753. #line 9696 "./typica.w"
  15754. QScriptValue constructAnnotationSpinBox(QScriptContext*context,
  15755. QScriptEngine*engine)
  15756. {
  15757. QScriptValue object= engine->newQObject(new AnnotationSpinBox(
  15758. argument<QString> (0,context),argument<QString> (1,context)));
  15759. setAnnotationSpinBoxProperties(object,engine);
  15760. return object;
  15761. }
  15762. void setAnnotationSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  15763. {
  15764. setQDoubleSpinBoxProperties(value,engine);
  15765. }
  15766. void setQDoubleSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  15767. {
  15768. setQAbstractSpinBoxProperties(value,engine);
  15769. }
  15770. void setQAbstractSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  15771. {
  15772. setQWidgetProperties(value,engine);
  15773. }
  15774. /*:404*//*425:*/
  15775. #line 10115 "./typica.w"
  15776. QScriptValue constructTimerDisplay(QScriptContext*,QScriptEngine*engine)
  15777. {
  15778. QScriptValue object= engine->newQObject(new TimerDisplay);
  15779. setTimerDisplayProperties(object,engine);
  15780. return object;
  15781. }
  15782. void setTimerDisplayProperties(QScriptValue value,QScriptEngine*engine)
  15783. {
  15784. setQLCDNumberProperties(value,engine);
  15785. }
  15786. /*:425*//*452:*/
  15787. #line 10610 "./typica.w"
  15788. QScriptValue constructWidgetDecorator(QScriptContext*context,
  15789. QScriptEngine*engine)
  15790. {
  15791. QWidget*widget= argument<QWidget*> (0,context);
  15792. QString text= argument<QString> (1,context);
  15793. Qt::Orientations orientation;
  15794. switch(argument<int> (2,context))
  15795. {
  15796. case 2:
  15797. orientation= Qt::Vertical;
  15798. break;
  15799. default:
  15800. orientation= Qt::Horizontal;
  15801. break;
  15802. }
  15803. QScriptValue object=
  15804. engine->newQObject(new WidgetDecorator(widget,text,orientation));
  15805. setWidgetDecoratorProperties(object,engine);
  15806. return object;
  15807. }
  15808. void setWidgetDecoratorProperties(QScriptValue value,QScriptEngine*engine)
  15809. {
  15810. setQWidgetProperties(value,engine);
  15811. }
  15812. /*:452*//*465:*/
  15813. #line 10891 "./typica.w"
  15814. QScriptValue constructLogEditWindow(QScriptContext*,QScriptEngine*engine)
  15815. {
  15816. QScriptValue object= engine->newQObject(new LogEditWindow);
  15817. return object;
  15818. }
  15819. /*:465*//*484:*/
  15820. #line 11419 "./typica.w"
  15821. QScriptValue constructXMLInput(QScriptContext*context,QScriptEngine*engine)
  15822. {
  15823. QIODevice*device= argument<QIODevice*> (0,context);
  15824. QScriptValue object= engine->newQObject(new XMLInput(&*device,
  15825. argument<int> (1,context)));
  15826. object.setProperty("input",engine->newFunction(XMLInput_input));
  15827. return object;
  15828. }
  15829. QScriptValue XMLInput_input(QScriptContext*context,QScriptEngine*)
  15830. {
  15831. XMLInput*self= getself<XMLInput*> (context);
  15832. self->input();
  15833. return QScriptValue();
  15834. }
  15835. /*:484*//*498:*/
  15836. #line 154 "./webview.w"
  15837. QScriptValue constructWebView(QScriptContext*,QScriptEngine*engine)
  15838. {
  15839. QScriptValue object= engine->newQObject(new TypicaWebView);
  15840. setQWebViewProperties(object,engine);
  15841. return object;
  15842. }
  15843. void setQWebViewProperties(QScriptValue value,QScriptEngine*engine)
  15844. {
  15845. setQWidgetProperties(value,engine);
  15846. }
  15847. /*:498*//*499:*/
  15848. #line 171 "./webview.w"
  15849. void addWebViewToLayout(QDomElement element,QStack<QWidget*> *,
  15850. QStack<QLayout*> *layoutStack)
  15851. {
  15852. TypicaWebView*view= new TypicaWebView;
  15853. if(element.hasAttribute("id"))
  15854. {
  15855. view->setObjectName(element.attribute("id"));
  15856. }
  15857. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  15858. layout->addWidget(view);
  15859. }
  15860. /*:499*//*504:*/
  15861. #line 222 "./webview.w"
  15862. QScriptValue QWebElement_toScriptValue(QScriptEngine*engine,const QWebElement&element)
  15863. {
  15864. QVariant var;
  15865. var.setValue(element);
  15866. QScriptValue object= engine->newVariant(var);
  15867. return object;
  15868. }
  15869. void QWebElement_fromScriptValue(const QScriptValue&value,QWebElement&element)
  15870. {
  15871. element= value.toVariant().value<QWebElement> ();
  15872. }
  15873. /*:504*//*509:*/
  15874. #line 287 "./webview.w"
  15875. template<> QWebElement argument(int arg,QScriptContext*context)
  15876. {
  15877. return qscriptvalue_cast<QWebElement> (context->argument(arg));
  15878. }
  15879. /*:509*//*510:*/
  15880. #line 296 "./webview.w"
  15881. QScriptValue constructWebElement(QScriptContext*context,
  15882. QScriptEngine*engine)
  15883. {
  15884. QWebElement element= argument<QWebElement> (0,context);
  15885. QScriptValue object= engine->newQObject(new TypicaWebElement(element));
  15886. return object;
  15887. }
  15888. /*:510*//*575:*/
  15889. #line 12738 "./typica.w"
  15890. QScriptValue constructSqlQueryView(QScriptContext*,QScriptEngine*engine)
  15891. {
  15892. QScriptValue object= engine->newQObject(new SqlQueryView);
  15893. setSqlQueryViewProperties(object,engine);
  15894. return object;
  15895. }
  15896. void setSqlQueryViewProperties(QScriptValue value,QScriptEngine*engine)
  15897. {
  15898. setQTableViewProperties(value,engine);
  15899. value.setProperty("setHeaderData",
  15900. engine->newFunction(SqlQueryView_setHeaderData));
  15901. value.setProperty("setQuery",engine->newFunction(SqlQueryView_setQuery));
  15902. }
  15903. /*:575*//*576:*/
  15904. #line 12756 "./typica.w"
  15905. QScriptValue SqlQueryView_setQuery(QScriptContext*context,QScriptEngine*)
  15906. {
  15907. SqlQueryView*self= getself<SqlQueryView*> (context);
  15908. QString query= argument<QString> (0,context);
  15909. self->setQuery(query);
  15910. self->reset();
  15911. return QScriptValue();
  15912. }
  15913. QScriptValue SqlQueryView_setHeaderData(QScriptContext*context,
  15914. QScriptEngine*)
  15915. {
  15916. SqlQueryView*self= getself<SqlQueryView*> (context);
  15917. int section= argument<int> (0,context);
  15918. QString data= argument<QString> (1,context);
  15919. self->setHeaderData(section,Qt::Horizontal,data,Qt::DisplayRole);
  15920. return QScriptValue();
  15921. }
  15922. /*:576*//*584:*/
  15923. #line 12963 "./typica.w"
  15924. void addReportToLayout(QDomElement element,QStack<QWidget*> *,
  15925. QStack<QLayout*> *layoutStack)
  15926. {
  15927. QTextEdit*widget= new QTextEdit;
  15928. if(element.hasAttribute("id"))
  15929. {
  15930. widget->setObjectName(element.attribute("id"));
  15931. }
  15932. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  15933. layout->addWidget(widget);
  15934. QTextDocument*document= new QTextDocument;
  15935. QFont defaultFont;
  15936. defaultFont.setPointSize(11);
  15937. document->setDefaultFont(defaultFont);
  15938. QTextCursor cursor(document);
  15939. /*585:*/
  15940. #line 12986 "./typica.w"
  15941. QDomNodeList children= element.childNodes();
  15942. for(int i= 0;i<children.count();i++)
  15943. {
  15944. QDomNode current;
  15945. QDomElement currentElement;
  15946. current= children.at(i);
  15947. if(current.isElement())
  15948. {
  15949. currentElement= current.toElement();
  15950. /*586:*/
  15951. #line 13003 "./typica.w"
  15952. if(currentElement.tagName()=="style")
  15953. {
  15954. document->setDefaultStyleSheet(currentElement.text());
  15955. }
  15956. /*:586*//*587:*/
  15957. #line 13014 "./typica.w"
  15958. if(currentElement.tagName()=="html")
  15959. {
  15960. cursor.insertHtml(currentElement.text());
  15961. }
  15962. /*:587*//*588:*/
  15963. #line 13024 "./typica.w"
  15964. if(currentElement.tagName()=="text")
  15965. {
  15966. cursor.insertText(currentElement.text());
  15967. }
  15968. /*:588*//*589:*/
  15969. #line 13034 "./typica.w"
  15970. if(currentElement.tagName()=="table")
  15971. {
  15972. QTextFrame*frame= cursor.insertFrame(QTextFrameFormat());
  15973. ReportTable*table= new ReportTable(frame,currentElement);
  15974. table->setParent(widget);
  15975. if(currentElement.hasAttribute("id"))
  15976. {
  15977. table->setObjectName(currentElement.attribute("id"));
  15978. }
  15979. }
  15980. /*:589*/
  15981. #line 12996 "./typica.w"
  15982. }
  15983. }
  15984. /*:585*/
  15985. #line 12979 "./typica.w"
  15986. widget->setDocument(document);
  15987. }
  15988. /*:584*//*600:*/
  15989. #line 13247 "./typica.w"
  15990. QScriptValue QTextEdit_print(QScriptContext*context,QScriptEngine*)
  15991. {
  15992. QTextEdit*self= getself<QTextEdit*> (context);
  15993. QTextDocument*document= self->document();
  15994. QPrinter printer;
  15995. QPrintDialog printwindow(&printer,self);
  15996. if(printwindow.exec()!=QDialog::Accepted)
  15997. {
  15998. return QScriptValue();
  15999. }
  16000. document->print(&printer);
  16001. return QScriptValue();
  16002. }
  16003. /*:600*//*601:*/
  16004. #line 13265 "./typica.w"
  16005. void setQTextEditProperties(QScriptValue value,QScriptEngine*engine)
  16006. {
  16007. setQAbstractScrollAreaProperties(value,engine);
  16008. value.setProperty("print",engine->newFunction(QTextEdit_print));
  16009. }
  16010. #line 1 "./daterangeselector.w"
  16011. /*:601*//*620:*/
  16012. #line 451 "./daterangeselector.w"
  16013. void addDateRangeToLayout(QDomElement element,QStack<QWidget*> *,
  16014. QStack<QLayout*> *layoutStack)
  16015. {
  16016. DateRangeSelector*widget= new DateRangeSelector;
  16017. if(element.hasAttribute("id"))
  16018. {
  16019. widget->setObjectName(element.attribute("id"));
  16020. }
  16021. if(element.hasAttribute("initial"))
  16022. {
  16023. widget->setCurrentIndex(element.attribute("initial").toInt());
  16024. }
  16025. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16026. layout->addWidget(widget);
  16027. }
  16028. /*:620*//*631:*/
  16029. #line 13445 "./typica.w"
  16030. void addFormArrayToLayout(QDomElement element,QStack<QWidget*> *,
  16031. QStack<QLayout*> *layoutStack)
  16032. {
  16033. FormArray*widget= new FormArray(element);
  16034. if(element.hasAttribute("id"))
  16035. {
  16036. widget->setObjectName(element.attribute("id"));
  16037. }
  16038. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16039. layout->addWidget(widget);
  16040. }
  16041. /*:631*//*652:*/
  16042. #line 14032 "./typica.w"
  16043. void addScaleControlToLayout(QDomElement element,QStack<QWidget*> *,
  16044. QStack<QLayout*> *layoutStack)
  16045. {
  16046. ScaleControl*scale= new ScaleControl;
  16047. if(element.hasAttribute("id"))
  16048. {
  16049. scale->setObjectName(element.attribute("id"));
  16050. }
  16051. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16052. layout->addWidget(scale);
  16053. }
  16054. void addIntensityControlToLayout(QDomElement element,QStack<QWidget*> *,
  16055. QStack<QLayout*> *layoutStack)
  16056. {
  16057. IntensityControl*scale= new IntensityControl;
  16058. if(element.hasAttribute("id"))
  16059. {
  16060. scale->setObjectName(element.attribute("id"));
  16061. }
  16062. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16063. layout->addWidget(scale);
  16064. }
  16065. /*:652*//*678:*/
  16066. #line 14622 "./typica.w"
  16067. QScriptValue constructDeviceTreeModel(QScriptContext*,QScriptEngine*engine)
  16068. {
  16069. QScriptValue object= engine->newQObject(new DeviceTreeModel);
  16070. setDeviceTreeModelProperties(object,engine);
  16071. return object;
  16072. }
  16073. /*:678*//*680:*/
  16074. #line 14645 "./typica.w"
  16075. void setDeviceTreeModelProperties(QScriptValue value,QScriptEngine*engine)
  16076. {
  16077. setQAbstractItemModelProperties(value,engine);
  16078. value.setProperty("referenceElement",
  16079. engine->newFunction(DeviceTreeModel_referenceElement));
  16080. }
  16081. void setQAbstractItemModelProperties(QScriptValue value,QScriptEngine*engine)
  16082. {
  16083. setQObjectProperties(value,engine);
  16084. value.setProperty("data",engine->newFunction(QAbstractItemModel_data));
  16085. value.setProperty("index",engine->newFunction(QAbstractItemModel_index));
  16086. value.setProperty("rowCount",engine->newFunction(QAbstractItemModel_rowCount));
  16087. value.setProperty("hasChildren",engine->newFunction(QAbstractItemModel_hasChildren));
  16088. }
  16089. /*:680*//*681:*/
  16090. #line 14672 "./typica.w"
  16091. QScriptValue DeviceTreeModel_referenceElement(QScriptContext*context,
  16092. QScriptEngine*engine)
  16093. {
  16094. DeviceTreeModel*model= getself<DeviceTreeModel*> (context);
  16095. QDomElement referenceElement= model->referenceElement(argument<QString> (0,context));
  16096. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  16097. QDomElement node;
  16098. QVariantMap retval;
  16099. retval.insert("driver",referenceElement.attribute("driver"));
  16100. for(int i= 0;i<configData.size();i++)
  16101. {
  16102. node= configData.at(i).toElement();
  16103. retval.insert(node.attribute("name"),node.attribute("value"));
  16104. }
  16105. return engine->toScriptValue(retval);
  16106. }
  16107. QScriptValue QAbstractItemModel_data(QScriptContext*context,QScriptEngine*engine)
  16108. {
  16109. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  16110. QModelIndex index= argument<QModelIndex> (0,context);
  16111. int role= argument<int> (1,context);
  16112. return engine->toScriptValue(model->data(index,role));
  16113. }
  16114. QScriptValue QAbstractItemModel_index(QScriptContext*context,QScriptEngine*engine)
  16115. {
  16116. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  16117. int row= 0;
  16118. int column= 0;
  16119. QModelIndex index;
  16120. if(context->argumentCount()> 1)
  16121. {
  16122. row= argument<int> (0,context);
  16123. column= argument<int> (1,context);
  16124. }
  16125. if(context->argumentCount()> 2)
  16126. {
  16127. index= argument<QModelIndex> (2,context);
  16128. }
  16129. QModelIndex retval= model->index(row,column,index);
  16130. return engine->toScriptValue(retval);
  16131. }
  16132. QScriptValue QAbstractItemModel_rowCount(QScriptContext*context,
  16133. QScriptEngine*)
  16134. {
  16135. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  16136. QModelIndex index;
  16137. if(context->argumentCount()==1)
  16138. {
  16139. index= argument<QModelIndex> (0,context);
  16140. }
  16141. return QScriptValue(model->rowCount(index));
  16142. }
  16143. QScriptValue QAbstractItemModel_hasChildren(QScriptContext*context,
  16144. QScriptEngine*engine)
  16145. {
  16146. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  16147. QModelIndex index;
  16148. if(context->argumentCount()==1)
  16149. {
  16150. index= argument<QModelIndex> (0,context);
  16151. }
  16152. return QScriptValue(engine,model->hasChildren(index));
  16153. }
  16154. /*:681*//*684:*/
  16155. #line 14756 "./typica.w"
  16156. QScriptValue QModelIndex_toScriptValue(QScriptEngine*engine,const QModelIndex&index)
  16157. {
  16158. QVariant var;
  16159. var.setValue(index);
  16160. QScriptValue object= engine->newVariant(var);
  16161. return object;
  16162. }
  16163. void QModelIndex_fromScriptValue(const QScriptValue&value,QModelIndex&index)
  16164. {
  16165. index= value.toVariant().value<QModelIndex> ();
  16166. }
  16167. /*:684*//*700:*/
  16168. #line 15053 "./typica.w"
  16169. QScriptValue constructDeviceConfigurationWindow(QScriptContext*,
  16170. QScriptEngine*engine)
  16171. {
  16172. QScriptValue object= engine->newQObject(new DeviceConfigurationWindow);
  16173. return object;
  16174. }
  16175. /*:700*//*771:*/
  16176. #line 45 "./settings.w"
  16177. QScriptValue constructSettingsWindow(QScriptContext*,QScriptEngine*engine)
  16178. {
  16179. QScriptValue object= engine->newQObject(new SettingsWindow);
  16180. return object;
  16181. }
  16182. /*:771*//*791:*/
  16183. #line 17602 "./typica.w"
  16184. QScriptValue constructModbusRTUDevice(QScriptContext*context,QScriptEngine*engine)
  16185. {
  16186. QScriptValue object;
  16187. if(context->argumentCount()==2)
  16188. {
  16189. object= engine->newQObject(new ModbusRTUDevice(argument<DeviceTreeModel*> (0,context),
  16190. argument<QModelIndex> (1,context)),
  16191. QScriptEngine::ScriptOwnership);
  16192. setModbusRTUDeviceProperties(object,engine);
  16193. }
  16194. else
  16195. {
  16196. context->throwError("Incorrect number of arguments passed to "
  16197. "ModbusRTUDevice constructor. This takes the configuration model "
  16198. "and an index.");
  16199. }
  16200. return object;
  16201. }
  16202. /*:791*//*792:*/
  16203. #line 17624 "./typica.w"
  16204. QScriptValue ModbusRTUDevice_pVChannel(QScriptContext*context,QScriptEngine*engine)
  16205. {
  16206. ModbusRTUDevice*self= getself<ModbusRTUDevice*> (context);
  16207. QScriptValue object;
  16208. if(self)
  16209. {
  16210. if(self->channels.size()> 0)
  16211. {
  16212. object= engine->newQObject(self->channels.at(0));
  16213. setChannelProperties(object,engine);
  16214. }
  16215. }
  16216. return object;
  16217. }
  16218. QScriptValue ModbusRTUDevice_sVChannel(QScriptContext*context,QScriptEngine*engine)
  16219. {
  16220. ModbusRTUDevice*self= getself<ModbusRTUDevice*> (context);
  16221. QScriptValue object;
  16222. if(self)
  16223. {
  16224. if(self->channels.size()> 1)
  16225. {
  16226. object= engine->newQObject(self->channels.at(1));
  16227. setChannelProperties(object,engine);
  16228. }
  16229. }
  16230. return object;
  16231. }
  16232. /*:792*//*793:*/
  16233. #line 17657 "./typica.w"
  16234. void setModbusRTUDeviceProperties(QScriptValue value,QScriptEngine*engine)
  16235. {
  16236. setQObjectProperties(value,engine);
  16237. value.setProperty("pVChannel",engine->newFunction(ModbusRTUDevice_pVChannel));
  16238. value.setProperty("sVChannel",engine->newFunction(ModbusRTUDevice_sVChannel));
  16239. }
  16240. /*:793*//*815:*/
  16241. #line 151 "./rate.w"
  16242. QScriptValue constructRateOfChange(QScriptContext*context,QScriptEngine*engine)
  16243. {
  16244. int cachetime= 1;
  16245. int scaletime= 1;
  16246. if(context->argumentCount()> 0)
  16247. {
  16248. cachetime= argument<int> (0,context);
  16249. if(context->argumentCount()> 1)
  16250. {
  16251. scaletime= argument<int> (1,context);
  16252. }
  16253. }
  16254. QScriptValue object= engine->newQObject(new RateOfChange(cachetime,scaletime));
  16255. setRateOfChangeProperties(object,engine);
  16256. return object;
  16257. }
  16258. void setRateOfChangeProperties(QScriptValue value,QScriptEngine*engine)
  16259. {
  16260. setQObjectProperties(value,engine);
  16261. }
  16262. /*:815*//*840:*/
  16263. #line 614 "./dataqsdk.w"
  16264. QScriptValue constructDataqSdkDevice(QScriptContext*context,QScriptEngine*engine)
  16265. {
  16266. QScriptValue object;
  16267. if(context->argumentCount()==1)
  16268. {
  16269. object= engine->newQObject(new DataqSdkDevice(argument<QString> (0,context)),
  16270. QScriptEngine::ScriptOwnership);
  16271. setDataqSdkDeviceProperties(object,engine);
  16272. }
  16273. else
  16274. {
  16275. context->throwError("Incorrect number of arguments passed to "
  16276. "DataqSdkDevice. The constructor takes one string "
  16277. "as an argument specifying a device name. "
  16278. "Example: Dev1");
  16279. }
  16280. return object;
  16281. }
  16282. /*:840*//*841:*/
  16283. #line 637 "./dataqsdk.w"
  16284. void setDataqSdkDeviceProperties(QScriptValue value,QScriptEngine*engine)
  16285. {
  16286. setQObjectProperties(value,engine);
  16287. value.setProperty("newChannel",engine->newFunction(DataqSdkDevice_newChannel));
  16288. }
  16289. /*:841*//*842:*/
  16290. #line 647 "./dataqsdk.w"
  16291. QScriptValue DataqSdkDevice_newChannel(QScriptContext*context,QScriptEngine*engine)
  16292. {
  16293. DataqSdkDevice*self= getself<DataqSdkDevice*> (context);
  16294. QScriptValue object;
  16295. if(self)
  16296. {
  16297. object= engine->newQObject(self->newChannel((Units::Unit)argument<int> (0,context)));
  16298. setChannelProperties(object,engine);
  16299. }
  16300. return object;
  16301. }
  16302. /*:842*//*867:*/
  16303. #line 80 "./scales.w"
  16304. QScriptValue constructDragLabel(QScriptContext*context,QScriptEngine*engine)
  16305. {
  16306. QScriptValue object;
  16307. QString labelText= "";
  16308. if(context->argumentCount()==1)
  16309. {
  16310. labelText= argument<QString> (0,context);
  16311. }
  16312. object= engine->newQObject(new DragLabel(labelText));
  16313. setDragLabelProperties(object,engine);
  16314. return object;
  16315. }
  16316. void setDragLabelProperties(QScriptValue value,QScriptEngine*engine)
  16317. {
  16318. setQLabelProperties(value,engine);
  16319. }
  16320. /*:867*//*877:*/
  16321. #line 272 "./scales.w"
  16322. QScriptValue BaudRateType_toScriptValue(QScriptEngine*engine,const BaudRateType&value)
  16323. {
  16324. return engine->newVariant(QVariant((int)(value)));
  16325. }
  16326. void BaudRateType_fromScriptValue(const QScriptValue&sv,BaudRateType&value)
  16327. {
  16328. value= (BaudRateType)(sv.toVariant().toInt());
  16329. }
  16330. QScriptValue DataBitsType_toScriptValue(QScriptEngine*engine,const DataBitsType&value)
  16331. {
  16332. return engine->newVariant(QVariant((int)(value)));
  16333. }
  16334. void DataBitsType_fromScriptValue(const QScriptValue&sv,DataBitsType&value)
  16335. {
  16336. value= (DataBitsType)(sv.toVariant().toInt());
  16337. }
  16338. QScriptValue ParityType_toScriptValue(QScriptEngine*engine,const ParityType&value)
  16339. {
  16340. return engine->newVariant(QVariant((int)(value)));
  16341. }
  16342. void ParityType_fromScriptValue(const QScriptValue&sv,ParityType&value)
  16343. {
  16344. value= (ParityType)(sv.toVariant().toInt());
  16345. }
  16346. QScriptValue StopBitsType_toScriptValue(QScriptEngine*engine,const StopBitsType&value)
  16347. {
  16348. return engine->newVariant(QVariant((int)(value)));
  16349. }
  16350. void StopBitsType_fromScriptValue(const QScriptValue&sv,StopBitsType&value)
  16351. {
  16352. value= (StopBitsType)(sv.toVariant().toInt());
  16353. }
  16354. QScriptValue FlowType_toScriptValue(QScriptEngine*engine,const FlowType&value)
  16355. {
  16356. return engine->newVariant(QVariant((int)(value)));
  16357. }
  16358. void FlowType_fromScriptValue(const QScriptValue&sv,FlowType&value)
  16359. {
  16360. value= (FlowType)(sv.toVariant().toInt());
  16361. }
  16362. /*:877*//*880:*/
  16363. #line 341 "./scales.w"
  16364. void setSerialScaleProperties(QScriptValue value,QScriptEngine*engine)
  16365. {
  16366. setQIODeviceProperties(value,engine);
  16367. }
  16368. /*:880*//*881:*/
  16369. #line 349 "./scales.w"
  16370. QScriptValue constructSerialScale(QScriptContext*context,QScriptEngine*engine)
  16371. {
  16372. QScriptValue object;
  16373. if(context->argumentCount()==1)
  16374. {
  16375. object= engine->newQObject(new SerialScale(argument<QString> (0,context)));
  16376. setSerialScaleProperties(object,engine);
  16377. }
  16378. else
  16379. {
  16380. context->throwError("Incorrect number of arguments passed to "
  16381. "SerialScale. The constructor takes one string "
  16382. "as an argument specifying a port name.");
  16383. }
  16384. return object;
  16385. }
  16386. /*:881*//*903:*/
  16387. #line 278 "./valueannotation.w"
  16388. QScriptValue constructValueAnnotation(QScriptContext*,QScriptEngine*engine)
  16389. {
  16390. QScriptValue object= engine->newQObject(new ValueAnnotation);
  16391. setValueAnnotationProperties(object,engine);
  16392. return object;
  16393. }
  16394. void setValueAnnotationProperties(QScriptValue value,QScriptEngine*engine)
  16395. {
  16396. setQObjectProperties(value,engine);
  16397. }
  16398. #line 18427 "./typica.w"
  16399. /*:903*/
  16400. #line 529 "./typica.w"
  16401. /*554:*/
  16402. #line 12368 "./typica.w"
  16403. int main(int argc,char**argv)
  16404. {
  16405. int*c= &argc;
  16406. Application app(*c,argv);
  16407. /*555:*/
  16408. #line 12394 "./typica.w"
  16409. QStringList themeSearchPath= QIcon::themeSearchPaths();
  16410. themeSearchPath.append(":/resources/icons/tango");
  16411. QIcon::setThemeSearchPaths(themeSearchPath);
  16412. QIcon::setThemeName(":/resources/icons/tango");
  16413. app.setWindowIcon(QIcon(":/resources/icons/appicons/logo.svg"));
  16414. /*:555*/
  16415. #line 12373 "./typica.w"
  16416. /*556:*/
  16417. #line 12414 "./typica.w"
  16418. QFile entypo(":/resources/fonts/entypo.ttf");
  16419. entypo.open(QIODevice::ReadOnly);
  16420. QFontDatabase::addApplicationFontFromData(entypo.readAll());
  16421. entypo.close();
  16422. QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-regular.otf");
  16423. QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-bold.otf");
  16424. QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-bolditalic.otf");
  16425. QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-italic.otf");
  16426. QWebSettings::globalSettings()->setFontFamily(QWebSettings::StandardFont,"Tex Gyre Pagella");
  16427. /*:556*/
  16428. #line 12374 "./typica.w"
  16429. QSettings settings;
  16430. /*710:*/
  16431. #line 15273 "./typica.w"
  16432. app.registerDeviceConfigurationWidget("roaster",RoasterConfWidget::staticMetaObject);
  16433. /*:710*//*720:*/
  16434. #line 15515 "./typica.w"
  16435. app.registerDeviceConfigurationWidget("nidaqmxbase",
  16436. NiDaqMxBaseDriverConfWidget::staticMetaObject);
  16437. app.registerDeviceConfigurationWidget("nidaqmxbase9211series",
  16438. NiDaqMxBase9211ConfWidget::staticMetaObject);
  16439. app.registerDeviceConfigurationWidget("ni9211seriestc",
  16440. Ni9211TcConfWidget::staticMetaObject);
  16441. /*:720*//*728:*/
  16442. #line 15746 "./typica.w"
  16443. app.registerDeviceConfigurationWidget("nidaqmx",NiDaqMxDriverConfWidget::staticMetaObject);
  16444. app.registerDeviceConfigurationWidget("nidaqmx9211series",NiDaqMx9211ConfWidget::staticMetaObject);
  16445. app.registerDeviceConfigurationWidget("nidaqmxtc01",NiDaqMxTc01ConfWidget::staticMetaObject);
  16446. /*:728*//*752:*/
  16447. #line 16711 "./typica.w"
  16448. app.registerDeviceConfigurationWidget("modbusrtuport",ModbusRtuPortConfWidget::staticMetaObject);
  16449. app.registerDeviceConfigurationWidget("modbusrtudevice",ModbusRtuDeviceConfWidget::staticMetaObject);
  16450. app.registerDeviceConfigurationWidget("modbustemperaturepv",ModbusRtuDeviceTPvConfWidget::staticMetaObject);
  16451. app.registerDeviceConfigurationWidget("modbustemperaturesv",ModbusRtuDeviceTSvConfWidget::staticMetaObject);
  16452. /*:752*//*757:*/
  16453. #line 16796 "./typica.w"
  16454. app.registerDeviceConfigurationWidget("annotationbutton",AnnotationButtonConfWidget::staticMetaObject);
  16455. /*:757*//*760:*/
  16456. #line 16866 "./typica.w"
  16457. app.registerDeviceConfigurationWidget("reconfigurablebutton",ReconfigurableAnnotationButtonConfWidget::staticMetaObject);
  16458. /*:760*//*763:*/
  16459. #line 16993 "./typica.w"
  16460. app.registerDeviceConfigurationWidget("annotationspinbox",NoteSpinConfWidget::staticMetaObject);
  16461. #line 1 "./freeannotation.w"
  16462. /*:763*//*767:*/
  16463. #line 57 "./freeannotation.w"
  16464. app.registerDeviceConfigurationWidget("freeannotation",
  16465. FreeAnnotationConfWidget::staticMetaObject);
  16466. #line 16997 "./typica.w"
  16467. #line 1 "./settings.w"
  16468. /*:767*//*796:*/
  16469. #line 18198 "./typica.w"
  16470. app.registerDeviceConfigurationWidget("modbusrtu",ModbusConfigurator::staticMetaObject);
  16471. /*:796*//*803:*/
  16472. #line 18328 "./typica.w"
  16473. app.registerDeviceConfigurationWidget("linearspline",LinearSplineInterpolationConfWidget::staticMetaObject);
  16474. /*:803*//*807:*/
  16475. #line 18417 "./typica.w"
  16476. app.registerDeviceConfigurationWidget("translation",TranslationConfWidget::staticMetaObject);
  16477. #line 1 "./rate.w"
  16478. /*:807*//*819:*/
  16479. #line 253 "./rate.w"
  16480. app.registerDeviceConfigurationWidget("rate",RateOfChangeConfWidget::staticMetaObject);
  16481. /*:819*//*860:*/
  16482. #line 1233 "./dataqsdk.w"
  16483. app.registerDeviceConfigurationWidget("dataqsdk",DataqSdkDeviceConfWidget::staticMetaObject);
  16484. app.registerDeviceConfigurationWidget("dataqsdkchannel",
  16485. DataqSdkChannelConfWidget::staticMetaObject);
  16486. /*:860*//*885:*/
  16487. #line 490 "./scales.w"
  16488. app.registerDeviceConfigurationWidget("scale",SerialScaleConfWidget::staticMetaObject);
  16489. /*:885*//*893:*/
  16490. #line 138 "./valueannotation.w"
  16491. app.registerDeviceConfigurationWidget("valueannotation",
  16492. ValueAnnotationConfWidget::staticMetaObject);
  16493. /*:893*/
  16494. #line 12378 "./typica.w"
  16495. /*557:*/
  16496. #line 12431 "./typica.w"
  16497. if(settings.value("database/exists","false").toString()=="true")
  16498. {
  16499. /*562:*/
  16500. #line 12553 "./typica.w"
  16501. QSqlDatabase database=
  16502. QSqlDatabase::addDatabase(settings.value("database/driver").toString());
  16503. database.setConnectOptions("application_name=Typica");
  16504. database.setHostName(settings.value("database/hostname").toString());
  16505. database.setDatabaseName(settings.value("database/dbname").toString());
  16506. database.setUserName(settings.value("database/user").toString());
  16507. database.setPassword(settings.value("database/password").toString());
  16508. if(!database.open())
  16509. {
  16510. settings.setValue("database/exists","false");
  16511. }
  16512. else
  16513. {
  16514. database.close();
  16515. }
  16516. /*:562*/
  16517. #line 12434 "./typica.w"
  16518. }
  16519. if(settings.value("database/exists","false").toString()=="false")
  16520. {
  16521. /*561:*/
  16522. #line 12544 "./typica.w"
  16523. SqlConnectionSetup dialog;
  16524. dialog.exec();
  16525. /*:561*/
  16526. #line 12438 "./typica.w"
  16527. }
  16528. /*:557*/
  16529. #line 12379 "./typica.w"
  16530. /*148:*/
  16531. #line 3516 "./typica.w"
  16532. QStringList arguments= QCoreApplication::arguments();
  16533. int position= arguments.indexOf("-c");
  16534. QString filename= QString();
  16535. if(position!=-1)
  16536. {
  16537. if(arguments.size()>=position+1)
  16538. {
  16539. filename= arguments.at(position+1);
  16540. }
  16541. }
  16542. if(filename.isEmpty())
  16543. {
  16544. filename= QFileDialog::getOpenFileName(NULL,"Open Configuration File",
  16545. settings.value("config","").toString());
  16546. }
  16547. QDir directory;
  16548. if(!filename.isEmpty())
  16549. {
  16550. QFile file(filename);
  16551. QFileInfo info(filename);
  16552. directory= info.dir();
  16553. settings.setValue("config",directory.path());
  16554. if(file.open(QIODevice::ReadOnly))
  16555. {
  16556. app.configuration()->setContent(&file,true);
  16557. }
  16558. }
  16559. /*149:*/
  16560. #line 3550 "./typica.w"
  16561. QDomElement root= app.configuration()->documentElement();
  16562. QDomNodeList children= root.childNodes();
  16563. QString replacementDoc;
  16564. QDomDocument includedDoc;
  16565. QDomDocumentFragment fragment;
  16566. for(int i= 0;i<children.size();i++)
  16567. {
  16568. QDomNode currentNode= children.at(i);
  16569. QDomElement currentElement;
  16570. if(currentNode.nodeName()=="include")
  16571. {
  16572. currentElement= currentNode.toElement();
  16573. if(currentElement.hasAttribute("src"))
  16574. {
  16575. replacementDoc= directory.path();
  16576. replacementDoc.append('/');
  16577. replacementDoc.append(currentElement.attribute("src"));
  16578. QFile doc(replacementDoc);
  16579. if(doc.open(QIODevice::ReadOnly))
  16580. {
  16581. includedDoc.setContent(&doc,true);
  16582. fragment= includedDoc.createDocumentFragment();
  16583. fragment.appendChild(includedDoc.documentElement());
  16584. root.replaceChild(fragment,currentNode);
  16585. doc.close();
  16586. }
  16587. }
  16588. }
  16589. }
  16590. /*:149*/
  16591. #line 3544 "./typica.w"
  16592. /*:148*/
  16593. #line 12380 "./typica.w"
  16594. /*7:*/
  16595. #line 657 "./typica.w"
  16596. QScriptEngine*engine= new QScriptEngine;
  16597. QScriptValue constructor;
  16598. QScriptValue value;
  16599. /*:7*//*17:*/
  16600. #line 843 "./typica.w"
  16601. constructor= engine->newFunction(constructQWidget);
  16602. value= engine->newQMetaObject(&QWidget::staticMetaObject,constructor);
  16603. engine->globalObject().setProperty("QWidget",value);
  16604. /*:17*//*28:*/
  16605. #line 1089 "./typica.w"
  16606. constructor= engine->newFunction(constructQMainWindow);
  16607. value= engine->newQMetaObject(&ScriptQMainWindow::staticMetaObject,
  16608. constructor);
  16609. engine->globalObject().setProperty("QMainWindow",value);
  16610. /*:28*//*39:*/
  16611. #line 1294 "./typica.w"
  16612. constructor= engine->newFunction(constructQFrame);
  16613. value= engine->newQMetaObject(&QFrame::staticMetaObject,constructor);
  16614. engine->globalObject().setProperty("QFrame",value);
  16615. /*:39*//*42:*/
  16616. #line 1327 "./typica.w"
  16617. constructor= engine->newFunction(constructQLabel);
  16618. value= engine->newQMetaObject(&QLabel::staticMetaObject,constructor);
  16619. engine->globalObject().setProperty("QLabel",value);
  16620. /*:42*//*45:*/
  16621. #line 1365 "./typica.w"
  16622. constructor= engine->newFunction(constructQLineEdit);
  16623. value= engine->newQMetaObject(&QLineEdit::staticMetaObject,constructor);
  16624. engine->globalObject().setProperty("QLineEdit",value);
  16625. /*:45*//*49:*/
  16626. #line 1410 "./typica.w"
  16627. constructor= engine->newFunction(constructQSplitter);
  16628. value= engine->newQMetaObject(&QSplitter::staticMetaObject,constructor);
  16629. engine->globalObject().setProperty("QSplitter",value);
  16630. /*:49*//*56:*/
  16631. #line 1581 "./typica.w"
  16632. constructor= engine->newFunction(constructQBoxLayout);
  16633. value= engine->newQMetaObject(&QBoxLayout::staticMetaObject,constructor);
  16634. engine->globalObject().setProperty("QBoxLayout",value);
  16635. /*:56*//*60:*/
  16636. #line 1693 "./typica.w"
  16637. constructor= engine->newFunction(constructQAction);
  16638. value= engine->newQMetaObject(&QAction::staticMetaObject,constructor);
  16639. engine->globalObject().setProperty("QAction",value);
  16640. /*:60*//*63:*/
  16641. #line 1752 "./typica.w"
  16642. value= engine->newQMetaObject(&QFileDialog::staticMetaObject);
  16643. value.setProperty("getOpenFileName",
  16644. engine->newFunction(QFileDialog_getOpenFileName));
  16645. value.setProperty("getSaveFileName",
  16646. engine->newFunction(QFileDialog_getSaveFileName));
  16647. engine->globalObject().setProperty("QFileDialog",value);
  16648. /*:63*//*68:*/
  16649. #line 1864 "./typica.w"
  16650. constructor= engine->newFunction(constructQFile);
  16651. value= engine->newQMetaObject(&QFile::staticMetaObject,constructor);
  16652. engine->globalObject().setProperty("QFile",value);
  16653. /*:68*//*75:*/
  16654. #line 1981 "./typica.w"
  16655. constructor= engine->newFunction(constructQBuffer);
  16656. value= engine->newQMetaObject(&QBuffer::staticMetaObject,constructor);
  16657. engine->globalObject().setProperty("QBuffer",value);
  16658. /*:75*//*78:*/
  16659. #line 2030 "./typica.w"
  16660. constructor= engine->newFunction(constructXQuery);
  16661. engine->globalObject().setProperty("XQuery",constructor);
  16662. /*:78*//*84:*/
  16663. #line 2132 "./typica.w"
  16664. constructor= engine->newFunction(constructXmlWriter);
  16665. engine->globalObject().setProperty("XmlWriter",constructor);
  16666. /*:84*//*93:*/
  16667. #line 2338 "./typica.w"
  16668. constructor= engine->newFunction(constructXmlReader);
  16669. engine->globalObject().setProperty("XmlReader",constructor);
  16670. /*:93*//*100:*/
  16671. #line 2462 "./typica.w"
  16672. value= engine->newQObject(&settings);
  16673. setQSettingsProperties(value,engine);
  16674. engine->globalObject().setProperty("QSettings",value);
  16675. /*:100*//*104:*/
  16676. #line 2543 "./typica.w"
  16677. constructor= engine->newFunction(constructQLCDNumber);
  16678. value= engine->newQMetaObject(&QLCDNumber::staticMetaObject,constructor);
  16679. engine->globalObject().setProperty("QLCDNumber",value);
  16680. /*:104*//*107:*/
  16681. #line 2599 "./typica.w"
  16682. constructor= engine->newFunction(constructQTime);
  16683. engine->globalObject().setProperty("QTime",constructor);
  16684. /*:107*//*128:*/
  16685. #line 3103 "./typica.w"
  16686. constructor= engine->newFunction(constructQPushButton);
  16687. value= engine->newQMetaObject(&QPushButton::staticMetaObject,constructor);
  16688. engine->globalObject().setProperty("QPushButton",value);
  16689. /*:128*//*135:*/
  16690. #line 3214 "./typica.w"
  16691. constructor= engine->newFunction(constructQSqlQuery);
  16692. engine->globalObject().setProperty("QSqlQuery",constructor);
  16693. /*:135*//*142:*/
  16694. #line 3376 "./typica.w"
  16695. engine->globalObject().setProperty("baseName",engine->newFunction(baseName));
  16696. engine->globalObject().setProperty("dir",engine->newFunction(dir));
  16697. engine->globalObject().setProperty("sqlToArray",
  16698. engine->newFunction(sqlToArray));
  16699. engine->globalObject().setProperty("setFont",engine->newFunction(setFont));
  16700. engine->globalObject().setProperty("annotationFromRecord",
  16701. engine->newFunction(annotationFromRecord));
  16702. engine->globalObject().setProperty("setTabOrder",engine->newFunction(setTabOrder));
  16703. /*:142*//*153:*/
  16704. #line 3717 "./typica.w"
  16705. engine->globalObject().setProperty("createWindow",
  16706. engine->newFunction(createWindow));
  16707. engine->globalObject().setProperty("createReport",
  16708. engine->newFunction(createReport));
  16709. /*:153*//*206:*/
  16710. #line 5235 "./typica.w"
  16711. engine->globalObject().setProperty("findChildObject",
  16712. engine->newFunction(findChildObject));
  16713. /*:206*//*232:*/
  16714. #line 376 "./units.w"
  16715. value= engine->newQMetaObject(&Units::staticMetaObject);
  16716. value.setProperty("convertTemperature",engine->newFunction(Units_convertTemperature));
  16717. value.setProperty("convertRelativeTemperature",
  16718. engine->newFunction(Units_convertRelativeTemperature));
  16719. value.setProperty("isTemperatureUnit",engine->newFunction(Units_isTemperatureUnit));
  16720. value.setProperty("convertWeight",engine->newFunction(Units_convertWeight));
  16721. value.setProperty("isWeightUnit",engine->newFunction(Units_isWeightUnit));
  16722. engine->globalObject().setProperty("Units",value);
  16723. /*:232*//*237:*/
  16724. #line 449 "./units.w"
  16725. qScriptRegisterMetaType(engine,Unit_toScriptValue,Unit_fromScriptValue);
  16726. #line 5651 "./typica.w"
  16727. /*:237*//*259:*/
  16728. #line 6221 "./typica.w"
  16729. constructor= engine->newFunction(constructDAQ);
  16730. value= engine->newQMetaObject(&DAQ::staticMetaObject,constructor);
  16731. value.setProperty("Fahrenheit",Units::Fahrenheit);
  16732. value.setProperty("Celsius",Units::Celsius);
  16733. value.setProperty("Kelvin",Units::Kelvin);
  16734. value.setProperty("Rankine",Units::Rankine);
  16735. engine->globalObject().setProperty("DAQ",value);
  16736. /*:259*//*268:*/
  16737. #line 6423 "./typica.w"
  16738. constructor= engine->newFunction(constructFakeDAQ);
  16739. value= engine->newQMetaObject(&FakeDAQ::staticMetaObject,constructor);
  16740. engine->globalObject().setProperty("FakeDAQ",value);
  16741. /*:268*//*279:*/
  16742. #line 6706 "./typica.w"
  16743. constructor= engine->newFunction(constructLinearCalibrator);
  16744. value= engine->newQMetaObject(&LinearCalibrator::staticMetaObject,
  16745. constructor);
  16746. engine->globalObject().setProperty("LinearCalibrator",value);
  16747. /*:279*//*284:*/
  16748. #line 6845 "./typica.w"
  16749. constructor= engine->newFunction(constructLinearSplineInterpolator);
  16750. value= engine->newQMetaObject(&LinearSplineInterpolator::staticMetaObject,constructor);
  16751. engine->globalObject().setProperty("LinearSplineInterpolator",value);
  16752. /*:284*//*294:*/
  16753. #line 7050 "./typica.w"
  16754. constructor= engine->newFunction(constructTemperatureDisplay);
  16755. value= engine->newQMetaObject(&TemperatureDisplay::staticMetaObject,
  16756. constructor);
  16757. engine->globalObject().setProperty("TemperatureDisplay",value);
  16758. /*:294*//*302:*/
  16759. #line 7208 "./typica.w"
  16760. constructor= engine->newFunction(constructMeasurementTimeOffset);
  16761. value= engine->newQMetaObject(&MeasurementTimeOffset::staticMetaObject,
  16762. constructor);
  16763. engine->globalObject().setProperty("MeasurementTimeOffset",value);
  16764. /*:302*//*307:*/
  16765. #line 7319 "./typica.w"
  16766. constructor= engine->newFunction(constructThresholdDetector);
  16767. value= engine->newQMetaObject(&ThresholdDetector::staticMetaObject,constructor);
  16768. engine->globalObject().setProperty("ThresholdDetector",value);
  16769. /*:307*//*312:*/
  16770. #line 7418 "./typica.w"
  16771. constructor= engine->newFunction(constructZeroEmitter);
  16772. value= engine->newQMetaObject(&ZeroEmitter::staticMetaObject,constructor);
  16773. engine->globalObject().setProperty("ZeroEmitter",value);
  16774. /*:312*//*317:*/
  16775. #line 7497 "./typica.w"
  16776. constructor= engine->newFunction(constructMeasurementAdapter);
  16777. value= engine->newQMetaObject(&MeasurementAdapter::staticMetaObject,
  16778. constructor);
  16779. engine->globalObject().setProperty("MeasurementAdapter",value);
  16780. /*:317*//*334:*/
  16781. #line 7960 "./typica.w"
  16782. constructor= engine->newFunction(constructGraphView);
  16783. value= engine->newQMetaObject(&GraphView::staticMetaObject,constructor);
  16784. engine->globalObject().setProperty("GraphView",value);
  16785. /*:334*//*357:*/
  16786. #line 8597 "./typica.w"
  16787. constructor= engine->newFunction(constructZoomLog);
  16788. value= engine->newQMetaObject(&ZoomLog::staticMetaObject,constructor);
  16789. engine->globalObject().setProperty("ZoomLog",value);
  16790. /*:357*//*395:*/
  16791. #line 9545 "./typica.w"
  16792. constructor= engine->newFunction(constructAnnotationButton);
  16793. value= engine->newQMetaObject(&AnnotationButton::staticMetaObject,
  16794. constructor);
  16795. engine->globalObject().setProperty("AnnotationButton",value);
  16796. /*:395*//*403:*/
  16797. #line 9687 "./typica.w"
  16798. constructor= engine->newFunction(constructAnnotationSpinBox);
  16799. value= engine->newQMetaObject(&AnnotationSpinBox::staticMetaObject,
  16800. constructor);
  16801. engine->globalObject().setProperty("AnnotationSpinBox",value);
  16802. /*:403*//*424:*/
  16803. #line 10108 "./typica.w"
  16804. constructor= engine->newFunction(constructTimerDisplay);
  16805. value= engine->newQMetaObject(&TimerDisplay::staticMetaObject,constructor);
  16806. engine->globalObject().setProperty("TimerDisplay",value);
  16807. /*:424*//*451:*/
  16808. #line 10602 "./typica.w"
  16809. constructor= engine->newFunction(constructWidgetDecorator);
  16810. value= engine->newQMetaObject(&WidgetDecorator::staticMetaObject,constructor);
  16811. engine->globalObject().setProperty("WidgetDecorator",value);
  16812. /*:451*//*464:*/
  16813. #line 10884 "./typica.w"
  16814. constructor= engine->newFunction(constructLogEditWindow);
  16815. value= engine->newQMetaObject(&LogEditWindow::staticMetaObject,constructor);
  16816. engine->globalObject().setProperty("LogEditWindow",value);
  16817. /*:464*//*483:*/
  16818. #line 11412 "./typica.w"
  16819. constructor= engine->newFunction(constructXMLInput);
  16820. value= engine->newQMetaObject(&XMLInput::staticMetaObject,constructor);
  16821. engine->globalObject().setProperty("XMLInput",value);
  16822. /*:483*//*497:*/
  16823. #line 146 "./webview.w"
  16824. constructor= engine->newFunction(constructWebView);
  16825. value= engine->newQMetaObject(&TypicaWebView::staticMetaObject,constructor);
  16826. engine->globalObject().setProperty("WebView",value);
  16827. /*:497*//*505:*/
  16828. #line 238 "./webview.w"
  16829. qScriptRegisterMetaType(engine,QWebElement_toScriptValue,QWebElement_fromScriptValue);
  16830. /*:505*//*508:*/
  16831. #line 280 "./webview.w"
  16832. constructor= engine->newFunction(constructWebElement);
  16833. engine->globalObject().setProperty("WebElement",constructor);
  16834. /*:508*//*519:*/
  16835. #line 11655 "./typica.w"
  16836. value= engine->newQObject(AppInstance);
  16837. engine->globalObject().setProperty("Application",value);
  16838. /*:519*//*574:*/
  16839. #line 12730 "./typica.w"
  16840. constructor= engine->newFunction(constructSqlQueryView);
  16841. value= engine->newQMetaObject(&SqlQueryView::staticMetaObject,constructor);
  16842. engine->globalObject().setProperty("SqlQueryView",value);
  16843. /*:574*//*679:*/
  16844. #line 14632 "./typica.w"
  16845. constructor= engine->newFunction(constructDeviceTreeModel);
  16846. value= engine->newQMetaObject(&DeviceTreeModel::staticMetaObject,
  16847. constructor);
  16848. engine->globalObject().setProperty("DeviceTreeModel",value);
  16849. /*:679*//*685:*/
  16850. #line 14772 "./typica.w"
  16851. qScriptRegisterMetaType(engine,QModelIndex_toScriptValue,QModelIndex_fromScriptValue);
  16852. /*:685*//*701:*/
  16853. #line 15063 "./typica.w"
  16854. constructor= engine->newFunction(constructDeviceConfigurationWindow);
  16855. value= engine->newQMetaObject(&DeviceConfigurationWindow::staticMetaObject,
  16856. constructor);
  16857. engine->globalObject().setProperty("DeviceConfigurationWindow",value);
  16858. /*:701*//*772:*/
  16859. #line 54 "./settings.w"
  16860. constructor= engine->newFunction(constructSettingsWindow);
  16861. value= engine->newQMetaObject(&DeviceConfigurationWindow::staticMetaObject,constructor);
  16862. engine->globalObject().setProperty("SettingsWindow",value);
  16863. #line 1 "./graphsettings.w"
  16864. /*:772*//*790:*/
  16865. #line 17593 "./typica.w"
  16866. constructor= engine->newFunction(constructModbusRTUDevice);
  16867. value= engine->newQMetaObject(&ModbusRTUDevice::staticMetaObject,constructor);
  16868. engine->globalObject().setProperty("ModbusRTUDevice",value);
  16869. /*:790*//*814:*/
  16870. #line 144 "./rate.w"
  16871. constructor= engine->newFunction(constructRateOfChange);
  16872. value= engine->newQMetaObject(&RateOfChange::staticMetaObject,constructor);
  16873. engine->globalObject().setProperty("RateOfChange",value);
  16874. /*:814*//*839:*/
  16875. #line 604 "./dataqsdk.w"
  16876. constructor= engine->newFunction(constructDataqSdkDevice);
  16877. value= engine->newQMetaObject(&DataqSdkDevice::staticMetaObject,constructor);
  16878. engine->globalObject().setProperty("DataqSdkDevice",value);
  16879. /*:839*//*866:*/
  16880. #line 73 "./scales.w"
  16881. constructor= engine->newFunction(constructDragLabel);
  16882. value= engine->newQMetaObject(&DragLabel::staticMetaObject,constructor);
  16883. engine->globalObject().setProperty("DragLabel",value);
  16884. /*:866*//*874:*/
  16885. #line 239 "./scales.w"
  16886. constructor= engine->newFunction(constructSerialScale);
  16887. value= engine->newQMetaObject(&SerialScale::staticMetaObject,constructor);
  16888. engine->globalObject().setProperty("SerialScale",value);
  16889. /*:874*//*878:*/
  16890. #line 325 "./scales.w"
  16891. qScriptRegisterMetaType(engine,BaudRateType_toScriptValue,BaudRateType_fromScriptValue);
  16892. qScriptRegisterMetaType(engine,DataBitsType_toScriptValue,DataBitsType_fromScriptValue);
  16893. qScriptRegisterMetaType(engine,ParityType_toScriptValue,ParityType_fromScriptValue);
  16894. qScriptRegisterMetaType(engine,StopBitsType_toScriptValue,StopBitsType_fromScriptValue);
  16895. qScriptRegisterMetaType(engine,FlowType_toScriptValue,FlowType_fromScriptValue);
  16896. /*:878*//*902:*/
  16897. #line 271 "./valueannotation.w"
  16898. constructor= engine->newFunction(constructValueAnnotation);
  16899. value= engine->newQMetaObject(&ValueAnnotation::staticMetaObject,constructor);
  16900. engine->globalObject().setProperty("ValueAnnotation",value);
  16901. /*:902*/
  16902. #line 12381 "./typica.w"
  16903. app.engine= engine;
  16904. /*150:*/
  16905. #line 3598 "./typica.w"
  16906. QString styleText;
  16907. QString programText;
  16908. QDomElement currentElement;
  16909. for(int i= 0;i<children.size();i++)
  16910. {
  16911. QDomNode currentNode= children.at(i);
  16912. if(currentNode.nodeName()=="style")
  16913. {
  16914. currentElement= currentNode.toElement();
  16915. styleText.append(currentElement.text());
  16916. }
  16917. else if(currentNode.nodeName()=="program")
  16918. {
  16919. currentElement= currentNode.toElement();
  16920. programText.append(currentElement.text());
  16921. }
  16922. }
  16923. app.setStyleSheet(styleText);
  16924. QScriptValue result= engine->evaluate(programText);
  16925. /*151:*/
  16926. #line 3623 "./typica.w"
  16927. if(engine->hasUncaughtException())
  16928. {
  16929. int line= engine->uncaughtExceptionLineNumber();
  16930. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  16931. result.toString();
  16932. QString trace;
  16933. foreach(trace,engine->uncaughtExceptionBacktrace())
  16934. {
  16935. qDebug()<<trace;
  16936. }
  16937. }
  16938. /*:151*/
  16939. #line 3618 "./typica.w"
  16940. /*:150*/
  16941. #line 12383 "./typica.w"
  16942. int retval= app.exec();
  16943. delete engine;
  16944. return retval;
  16945. }
  16946. /*:554*/
  16947. #line 530 "./typica.w"
  16948. #include "moc_typica.cpp"
  16949. /*:3*/