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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467
  1. /*3:*/
  2. #line 522 "./typica.w"
  3. #define PROGRAM_NAME "Typica"
  4. /*5:*/
  5. #line 622 "./typica.w"
  6. #include <QtCore>
  7. #include <QtGui>
  8. #include <QtScript>
  9. #include <QtScriptTools>
  10. #include <QtXml>
  11. #include <QtSql>
  12. #include <QtDebug>
  13. #include <QtXmlPatterns>
  14. #include <QtWebKit>
  15. #include <QtSvg>
  16. #include <QtNetwork>
  17. /*:5*//*6:*/
  18. #line 639 "./typica.w"
  19. #include "helpmenu.h"
  20. /*:6*//*304:*/
  21. #line 6879 "./typica.w"
  22. #include "units.h"
  23. #line 1 "./measurement.w"
  24. /*:304*//*575:*/
  25. #line 212 "./webview.w"
  26. #include "webview.h"
  27. /*:575*//*588:*/
  28. #line 390 "./webview.w"
  29. #include "webelement.h"
  30. #line 12867 "./typica.w"
  31. #line 1 "./printerselector.w"
  32. /*:588*//*590:*/
  33. #line 40 "./printerselector.w"
  34. #include "printerselector.h"
  35. /*:590*//*715:*/
  36. #line 487 "./daterangeselector.w"
  37. #include "daterangeselector.h"
  38. #line 14631 "./typica.w"
  39. /*:715*//*823:*/
  40. #line 17202 "./typica.w"
  41. #include "qextserialport.h"
  42. #include "qextserialenumerator.h"
  43. /*:823*//*1053:*/
  44. #line 124 "./dataqsdk.w"
  45. #ifdef Q_OS_WIN32
  46. #include <windef.h>
  47. #else
  48. #define PASCAL
  49. #endif
  50. /*:1053*//*1077:*/
  51. #line 862 "./dataqsdk.w"
  52. #include <limits>
  53. /*:1077*//*1092:*/
  54. #line 62 "./scales.w"
  55. #include "draglabel.h"
  56. /*:1092*//*1107:*/
  57. #line 361 "./scales.w"
  58. #include "scale.h"
  59. /*:1107*/
  60. #line 525 "./typica.w"
  61. /*971:*/
  62. #line 114 "./phidget22.w"
  63. #if defined(__stdcall)
  64. #define CCONV __stdcall
  65. #else
  66. #if defined(_MSC_VER)
  67. #define CCONV __stdcall
  68. #else
  69. #define CCONV
  70. #endif
  71. #endif
  72. typedef int(CCONV*PhidgetPointer)(void*);
  73. typedef int(CCONV*PhidgetPointerStringOut)(void*,char**);
  74. typedef int(CCONV*PhidgetPointerIntOut)(void*,int*);
  75. typedef void(CCONV*PhidgetManagerCallback)(void*,void*,void*);
  76. typedef void(CCONV*PhidgetValueCallback)(void*,void*,double);
  77. typedef int(CCONV*PhidgetPointerCallbackPointer)(void*,
  78. PhidgetManagerCallback,
  79. void*);
  80. typedef int(CCONV*PhidgetPointerVCPointer)(void*,
  81. PhidgetValueCallback,
  82. void*);
  83. typedef int(CCONV*PhidgetPointerIntIn)(void*,int);
  84. /*:971*/
  85. #line 526 "./typica.w"
  86. /*976:*/
  87. #line 220 "./phidget22.w"
  88. void CCONV ChannelListAddChannel(void*manager,void*context,void*device);
  89. void CCONV ChannelListRemoveChannel(void*manager,void*context,
  90. void*device);
  91. /*:976*//*991:*/
  92. #line 773 "./phidget22.w"
  93. void CCONV Phidget22ValueCallback(void*device,void*context,double value);
  94. /*:991*/
  95. #line 527 "./typica.w"
  96. /*26:*/
  97. #line 1070 "./typica.w"
  98. class ScriptQMainWindow:public QMainWindow
  99. {
  100. Q_OBJECT
  101. Q_PROPERTY(QString closePrompt READ closePrompt WRITE setClosePrompt)
  102. public:
  103. ScriptQMainWindow();
  104. QString closePrompt();
  105. public slots:
  106. void show();
  107. void saveSizeAndPosition(const QString&key);
  108. void restoreSizeAndPosition(const QString&key);
  109. void displayStatus(const QString&message= QString());
  110. void setClosePrompt(QString prompt);
  111. void setupFinished();
  112. signals:
  113. void aboutToClose(void);
  114. void windowReady(void);
  115. protected:
  116. void closeEvent(QCloseEvent*event);
  117. void showEvent(QShowEvent*event);
  118. private:
  119. QString cprompt;
  120. };
  121. /*:26*//*173:*/
  122. #line 4030 "./typica.w"
  123. class SqlQueryConnection:public QSqlQuery
  124. {
  125. public:
  126. SqlQueryConnection(const QString&query= QString());
  127. ~SqlQueryConnection();
  128. QSqlQuery*operator->()const;
  129. private:
  130. QString connection;
  131. QSqlQuery*q;
  132. };
  133. /*:173*//*250:*/
  134. #line 6036 "./typica.w"
  135. class NumericDelegate:public QItemDelegate
  136. {
  137. Q_OBJECT
  138. public:
  139. NumericDelegate(QObject*parent= NULL);
  140. QWidget*createEditor(QWidget*parent,
  141. const QStyleOptionViewItem&option,
  142. const QModelIndex&index)const;
  143. void setEditorData(QWidget*editor,const QModelIndex&index)const;
  144. void setModelData(QWidget*editor,QAbstractItemModel*model,
  145. const QModelIndex&index)const;
  146. void updateEditorGeometry(QWidget*editor,
  147. const QStyleOptionViewItem&option,
  148. const QModelIndex&index)const;
  149. };
  150. /*:250*//*256:*/
  151. #line 6129 "./typica.w"
  152. class ScriptValidator:public QValidator
  153. {
  154. Q_OBJECT
  155. public:
  156. ScriptValidator(QValidator*validator,QObject*parent= NULL);
  157. void fixup(QString&input)const;
  158. QValidator::State validate(QString&input,int&pos)const;
  159. private:
  160. QValidator*v;
  161. };
  162. /*:256*//*300:*/
  163. #line 438 "./units.w"
  164. Q_DECLARE_METATYPE(Units::Unit)
  165. /*:300*//*305:*/
  166. #line 19 "./measurement.w"
  167. class Measurement:public QVariantMap
  168. {
  169. public:
  170. Measurement(double temperature= 0,QTime time= QTime(),
  171. Units::Unit sc= Units::Fahrenheit);
  172. Measurement(double temperature);
  173. double temperature()const;
  174. QTime time()const;
  175. void setTemperature(double temperature);
  176. void setTime(QTime time);
  177. void setUnit(Units::Unit scale);
  178. Units::Unit scale()const;
  179. Measurement toFahrenheit();
  180. Measurement toCelsius();
  181. Measurement toKelvin();
  182. Measurement toRankine();
  183. };
  184. /*:305*//*309:*/
  185. #line 128 "./measurement.w"
  186. Q_DECLARE_METATYPE(Measurement)
  187. /*:309*//*316:*/
  188. #line 6943 "./typica.w"
  189. class Channel;
  190. class DAQImplementation;
  191. class DAQ:public QObject
  192. {
  193. Q_OBJECT
  194. Q_ENUMS(ThermocoupleType)
  195. DAQImplementation*imp;
  196. private slots:
  197. void threadFinished();
  198. public:
  199. DAQ(QString device,const QString&driver= QString("nidaqmxbase"));
  200. ~DAQ();
  201. Channel*newChannel(int units,int thermocouple);
  202. Q_INVOKABLE void setClockRate(double Hz);
  203. Q_INVOKABLE void start();
  204. Q_INVOKABLE void stop();
  205. enum ThermocoupleType
  206. {
  207. TypeJ= 10072,
  208. TypeK= 10073,
  209. TypeN= 10077,
  210. TypeR= 10082,
  211. TypeS= 10085,
  212. TypeT= 10086,
  213. TypeB= 10047,
  214. TypeE= 10055
  215. };
  216. };
  217. /*:316*//*317:*/
  218. #line 6981 "./typica.w"
  219. class DAQImplementation:public QThread
  220. {
  221. Q_OBJECT
  222. public:
  223. DAQImplementation(const QString&driverinfo);
  224. ~DAQImplementation();
  225. void run();
  226. void measure();
  227. /*318:*/
  228. #line 7001 "./typica.w"
  229. typedef int(*daqfp)(...);
  230. daqfp read;
  231. daqfp errorInfo;
  232. daqfp startTask;
  233. daqfp createTask;
  234. daqfp createChannel;
  235. daqfp setClock;
  236. daqfp stopTask;
  237. daqfp clearTask;
  238. daqfp resetDevice;
  239. daqfp waitForMeasurement;
  240. /*:318*/
  241. #line 6990 "./typica.w"
  242. /*319:*/
  243. #line 7017 "./typica.w"
  244. bool useBase;
  245. QString device;
  246. QVector<Channel*> channelMap;
  247. unsigned int handle;
  248. int error;
  249. int channels;
  250. bool ready;
  251. QLibrary driver;
  252. QVector<Units::Unit> unitMap;
  253. /*:319*/
  254. #line 6991 "./typica.w"
  255. };
  256. /*:317*//*335:*/
  257. #line 7522 "./typica.w"
  258. class FakeDAQImplementation:public QThread
  259. {
  260. Q_OBJECT
  261. public:
  262. FakeDAQImplementation();
  263. ~FakeDAQImplementation();
  264. void run();
  265. void measure();
  266. QVector<Channel*> channelMap;
  267. int channels;
  268. bool ready;
  269. double clockRate;
  270. };
  271. class FakeDAQ:public QObject
  272. {
  273. Q_OBJECT
  274. FakeDAQImplementation*imp;
  275. public:
  276. FakeDAQ(QString device);
  277. ~FakeDAQ();
  278. Channel*newChannel(int units,int thermocouple);
  279. Q_INVOKABLE void setClockRate(double Hz);
  280. Q_INVOKABLE void start();
  281. };
  282. /*:335*//*342:*/
  283. #line 7709 "./typica.w"
  284. class Channel:public QObject
  285. {
  286. Q_OBJECT
  287. public:
  288. Channel();
  289. ~Channel();
  290. public slots:
  291. void input(Measurement measurement);
  292. signals:
  293. void newData(Measurement);
  294. };
  295. /*:342*//*346:*/
  296. #line 7776 "./typica.w"
  297. class LinearCalibrator:public QObject
  298. {
  299. Q_OBJECT
  300. Q_PROPERTY(double measuredLower READ measuredLower
  301. WRITE setMeasuredLower)
  302. Q_PROPERTY(double measuredUpper READ measuredUpper
  303. WRITE setMeasuredUpper)
  304. Q_PROPERTY(double mappedLower READ mappedLower WRITE setMappedLower)
  305. Q_PROPERTY(double mappedUpper READ mappedUpper WRITE setMappedUpper)
  306. Q_PROPERTY(bool closedRange READ isClosedRange WRITE setClosedRange)
  307. Q_PROPERTY(double sensitivity READ sensitivity WRITE setSensitivity)
  308. public:
  309. LinearCalibrator(QObject*parent= NULL);
  310. double measuredLower();
  311. double measuredUpper();
  312. double mappedLower();
  313. double mappedUpper();
  314. bool isClosedRange();
  315. double sensitivity();
  316. public slots:
  317. void setMeasuredLower(double lower);
  318. void setMeasuredUpper(double upper);
  319. void setMappedLower(double lower);
  320. void setMappedUpper(double upper);
  321. void setClosedRange(bool closed);
  322. void setSensitivity(double sensitivity);
  323. Measurement newMeasurement(Measurement measure);
  324. signals:
  325. void measurement(Measurement measure);
  326. void newData(Measurement measure);
  327. private:
  328. double Lo1;
  329. double Lo2;
  330. double Up1;
  331. double Up2;
  332. double sensitivitySetting;
  333. bool clamp;
  334. };
  335. /*:346*//*353:*/
  336. #line 7972 "./typica.w"
  337. class LinearSplineInterpolator:public QObject
  338. {
  339. Q_OBJECT
  340. public:
  341. LinearSplineInterpolator(QObject*parent= NULL);
  342. Q_INVOKABLE void add_pair(double source,double destination);
  343. public slots:
  344. Measurement newMeasurement(Measurement measure);
  345. signals:
  346. void newData(Measurement measure);
  347. private:
  348. void make_interpolators();
  349. QMap<double,double> *pairs;
  350. QList<LinearCalibrator*> *interpolators;
  351. };
  352. /*:353*//*358:*/
  353. #line 8108 "./typica.w"
  354. class TemperatureDisplay:public QLCDNumber
  355. {
  356. Q_OBJECT
  357. int unit;
  358. bool r;
  359. public:
  360. TemperatureDisplay(QWidget*parent= NULL);
  361. ~TemperatureDisplay();
  362. public slots:
  363. void setValue(Measurement temperature);
  364. void invalidate();
  365. void setDisplayUnits(Units::Unit scale);
  366. void setRelativeMode(bool relative);
  367. };
  368. /*:358*//*369:*/
  369. #line 8327 "./typica.w"
  370. class MeasurementTimeOffset:public QObject
  371. {
  372. Q_OBJECT
  373. QTime epoch;
  374. QTime previous;
  375. bool hasPrevious;
  376. public:
  377. MeasurementTimeOffset(QTime zero);
  378. QTime zeroTime();
  379. public slots:
  380. void newMeasurement(Measurement measure);
  381. void setZeroTime(QTime zero);
  382. signals:
  383. void measurement(Measurement measure);
  384. };
  385. /*:369*//*376:*/
  386. #line 8479 "./typica.w"
  387. class ThresholdDetector:public QObject
  388. {
  389. Q_OBJECT
  390. Q_ENUMS(EdgeDirection)
  391. public:
  392. enum EdgeDirection{
  393. Ascending,Descending
  394. };
  395. ThresholdDetector(double value);
  396. public slots:
  397. void newMeasurement(Measurement measure);
  398. void setThreshold(double value);
  399. void setEdgeDirection(EdgeDirection direction);
  400. signals:
  401. void timeForValue(double);
  402. private:
  403. bool previousValueValid;
  404. double previousValue;
  405. double threshold;
  406. EdgeDirection currentDirection;
  407. };
  408. /*:376*//*381:*/
  409. #line 8595 "./typica.w"
  410. class ZeroEmitter:public QObject
  411. {
  412. Q_OBJECT
  413. Q_PROPERTY(int column READ column WRITE setColumn)
  414. Measurement cache;
  415. int col;
  416. public:
  417. ZeroEmitter(int tempcolumn= 1);
  418. int column();
  419. double lastTemperature();
  420. public slots:
  421. void newMeasurement(Measurement measure);
  422. void setColumn(int column);
  423. void emitZero();
  424. signals:
  425. void measurement(Measurement measure,int tempcolumn);
  426. };
  427. /*:381*//*386:*/
  428. #line 8689 "./typica.w"
  429. class MeasurementAdapter:public QObject
  430. {
  431. Q_OBJECT
  432. int col;
  433. public:
  434. MeasurementAdapter(int tempcolumn);
  435. int column();
  436. public slots:
  437. void newMeasurement(Measurement measure);
  438. void setColumn(int column);
  439. signals:
  440. void measurement(Measurement measure,int tempcolumn);
  441. };
  442. /*:386*//*391:*/
  443. #line 8778 "./typica.w"
  444. class GraphView:public QGraphicsView
  445. {
  446. Q_OBJECT
  447. QGraphicsScene*theScene;
  448. QMap<int,QList<QGraphicsLineItem*> *> *graphLines;
  449. QMap<int,QPointF> *prevPoints;
  450. QMap<int,double> *translations;
  451. QList<QGraphicsItem*> *gridLinesF;
  452. QList<QGraphicsItem*> *gridLinesC;
  453. QList<QGraphicsItem*> *relativeGridLines;
  454. bool relativeEnabled;
  455. bool timeIndicatorEnabled;
  456. QGraphicsLineItem*timeLine;
  457. LinearSplineInterpolator*relativeAdjuster;
  458. public:
  459. GraphView(QWidget*parent= NULL);
  460. void removeSeries(int column);
  461. protected:
  462. void resizeEvent(QResizeEvent*event);
  463. public slots:
  464. void newMeasurement(Measurement measure,int tempcolumn);
  465. void setSeriesTranslation(int column,double offset);
  466. void setTimeIndicatorEnabled(bool enabled);
  467. void clear();
  468. void showF();
  469. void showC();
  470. };
  471. /*:391*//*408:*/
  472. #line 9246 "./typica.w"
  473. class MeasurementModel;
  474. class ZoomLog:public QTableView
  475. {
  476. Q_OBJECT
  477. /*409:*/
  478. #line 9295 "./typica.w"
  479. MeasurementModel*model_ms;
  480. MeasurementModel*model_1s;
  481. MeasurementModel*model_5s;
  482. MeasurementModel*model_10s;
  483. MeasurementModel*model_15s;
  484. MeasurementModel*model_30s;
  485. MeasurementModel*model_1m;
  486. QList<MeasurementModel*> modelSet;
  487. QHash<int,Measurement> lastMeasurement;
  488. MeasurementModel*currentModel;
  489. QList<int> saveTempCols;
  490. QList<int> saveControlCols;
  491. QList<int> saveNoteCols;
  492. QList<int> currentColumnSet;
  493. /*:409*/
  494. #line 9251 "./typica.w"
  495. void switchLOD(MeasurementModel*m);
  496. private slots:
  497. void centerOn(int row);
  498. void persistColumnResize(int column,int oldsize,int newsize);
  499. void restoreColumnWidths();
  500. public:
  501. ZoomLog();
  502. QVariant data(int row,int column)const;
  503. Q_INVOKABLE int rowCount();
  504. bool saveXML(QIODevice*device);
  505. bool saveCSV(QIODevice*device);
  506. QString lastTime(int series);
  507. Q_INVOKABLE Units::Unit displayUnits();
  508. public slots:
  509. void setVisible(bool visibility);
  510. void setHeaderData(int section,QString text);
  511. void LOD_ms();
  512. void LOD_1s();
  513. void LOD_5s();
  514. void LOD_10s();
  515. void LOD_15s();
  516. void LOD_30s();
  517. void LOD_1m();
  518. void newMeasurement(Measurement measure,int tempcolumn);
  519. void newAnnotation(QString annotation,int tempcolumn,
  520. int annotationcolumn);
  521. void clear();
  522. void addOutputTemperatureColumn(int column);
  523. void addOutputControlColumn(int column);
  524. void addOutputAnnotationColumn(int column);
  525. void clearOutputColumns();
  526. void setDisplayUnits(Units::Unit scale);
  527. void addToCurrentColumnSet(int column);
  528. void clearCurrentColumnSet();
  529. protected:
  530. virtual void showEvent(QShowEvent*event);
  531. };
  532. /*:408*//*434:*/
  533. #line 10000 "./typica.w"
  534. class MeasurementList;
  535. class MeasurementModel:public QAbstractItemModel
  536. {
  537. Q_OBJECT
  538. Units::Unit unit;
  539. QList<MeasurementList*> *entries;
  540. QStringList*hData;
  541. int colcount;
  542. QHash<int,int> *lastTemperature;
  543. QList<MeasurementList*> ::iterator lastInsertion;
  544. QHash<int,bool> *controlColumns;
  545. public:
  546. MeasurementModel(QObject*parent= NULL);
  547. ~MeasurementModel();
  548. int rowCount(const QModelIndex&parent= QModelIndex())const;
  549. int columnCount(const QModelIndex&parent= QModelIndex())const;
  550. bool setHeaderData(int section,Qt::Orientation orientation,
  551. const QVariant&value,int role= Qt::DisplayRole);
  552. QVariant data(const QModelIndex&index,int role)const;
  553. bool setData(const QModelIndex&index,const QVariant&value,
  554. int role= Qt::EditRole);
  555. Qt::ItemFlags flags(const QModelIndex&index)const;
  556. QVariant headerData(int section,Qt::Orientation orientation,
  557. int role= Qt::DisplayRole)const;
  558. QModelIndex index(int row,int column,
  559. const QModelIndex&parent= QModelIndex())const;
  560. QModelIndex parent(const QModelIndex&index)const;
  561. Units::Unit displayUnits();
  562. public slots:
  563. void newMeasurement(Measurement measure,int tempcolumn);
  564. void newAnnotation(QString annotation,int tempcolumn,
  565. int annotationColumn);
  566. void clear();
  567. void setDisplayUnits(Units::Unit scale);
  568. signals:
  569. void rowChanged(int);
  570. };
  571. /*:434*//*435:*/
  572. #line 10044 "./typica.w"
  573. class MeasurementList:public QVariantList
  574. {
  575. public:
  576. bool operator<(const MeasurementList&other)const;
  577. bool operator==(const MeasurementList&other)const;
  578. };
  579. /*:435*//*461:*/
  580. #line 10702 "./typica.w"
  581. class AnnotationButton:public QPushButton
  582. {
  583. Q_OBJECT
  584. QString note;
  585. int tc;
  586. int ac;
  587. int count;
  588. public:
  589. AnnotationButton(const QString&text,QWidget*parent= NULL);
  590. public slots:
  591. void setAnnotation(const QString&annotation);
  592. void setTemperatureColumn(int tempcolumn);
  593. void setAnnotationColumn(int annotationcolumn);
  594. void annotate();
  595. void resetCount();
  596. signals:
  597. void annotation(QString annotation,int tempcolumn,
  598. int notecolumn);
  599. };
  600. /*:461*//*469:*/
  601. #line 10827 "./typica.w"
  602. class AnnotationSpinBox:public QDoubleSpinBox
  603. {
  604. Q_OBJECT
  605. QString pretext;
  606. QString posttext;
  607. int tc;
  608. int ac;
  609. bool change;
  610. public:
  611. AnnotationSpinBox(const QString&pret,const QString&postt,
  612. QWidget*parent= NULL);
  613. public slots:
  614. void setPretext(const QString&pret);
  615. void setPosttext(const QString&postt);
  616. void setTemperatureColumn(int tempcolumn);
  617. void setAnnotationColumn(int annotationcolumn);
  618. void annotate();
  619. void resetChange();
  620. signals:
  621. void annotation(QString annotation,int tempcolumn,
  622. int notecolumn);
  623. };
  624. /*:469*//*477:*/
  625. #line 10986 "./typica.w"
  626. class TimerDisplay:public QLCDNumber
  627. {
  628. Q_OBJECT
  629. /*478:*/
  630. #line 11036 "./typica.w"
  631. Q_PROPERTY(QTime seconds READ seconds WRITE setTimer)
  632. Q_PROPERTY(TimerMode mode READ mode WRITE setMode)
  633. Q_PROPERTY(bool running READ isRunning)
  634. Q_PROPERTY(QTime resetValue READ resetValue WRITE setResetValue)
  635. Q_PROPERTY(QString displayFormat READ displayFormat WRITE setDisplayFormat)
  636. Q_PROPERTY(bool autoReset READ autoReset WRITE setAutoReset)
  637. Q_PROPERTY(QString value READ value)
  638. /*:478*/
  639. #line 10990 "./typica.w"
  640. private slots:
  641. void updateTime();
  642. void setCountUpMode();
  643. void setCountDownMode();
  644. void setClockMode();
  645. public:
  646. TimerDisplay(QWidget*parent= NULL);
  647. ~TimerDisplay();
  648. enum TimerMode
  649. {
  650. CountUp,
  651. CountDown,
  652. Clock
  653. };
  654. QString value();
  655. QTime seconds();
  656. TimerMode mode();
  657. bool isRunning();
  658. QTime resetValue();
  659. QString displayFormat();
  660. bool autoReset();
  661. public slots:
  662. void setTimer(QTime value= QTime(0,0,0));
  663. void setMode(TimerMode mode);
  664. void startTimer();
  665. void stopTimer();
  666. void copyTimer();
  667. void setResetValue(QTime value= QTime(0,0,0));
  668. void reset();
  669. void setDisplayFormat(QString format);
  670. void setAutoReset(bool reset);
  671. void updateDisplay();
  672. signals:
  673. void valueChanged(QTime);
  674. void runStateChanged(bool);
  675. private:
  676. /*479:*/
  677. #line 11047 "./typica.w"
  678. QTime s;
  679. QTime r;
  680. QTimer clock;
  681. TimerDisplay::TimerMode m;
  682. bool running;
  683. bool ar;
  684. QAction*startAction;
  685. QAction*stopAction;
  686. QAction*resetAction;
  687. QString f;
  688. QTime relative;
  689. QTime base;
  690. /*:479*/
  691. #line 11027 "./typica.w"
  692. };
  693. /*:477*//*500:*/
  694. #line 11439 "./typica.w"
  695. class PackLayout:public QLayout
  696. {
  697. int doLayout(const QRect&rect,bool testOnly)const;
  698. QList<QLayoutItem*> itemList;
  699. Qt::Orientations orientation;
  700. public:
  701. PackLayout(QWidget*parent,int margin= 0,int spacing= -1);
  702. PackLayout(int spacing= -1);
  703. ~PackLayout();
  704. void addItem(QLayoutItem*item);
  705. Qt::Orientations expandingDirections()const;
  706. bool hasHeightForWidth()const;
  707. int heightForWidth(int width)const;
  708. int count()const;
  709. QLayoutItem*itemAt(int index)const;
  710. QSize minimumSize()const;
  711. void setGeometry(const QRect&rect);
  712. void setOrientation(Qt::Orientations direction);
  713. QSize sizeHint()const;
  714. QLayoutItem*takeAt(int index);
  715. };
  716. /*:500*//*513:*/
  717. #line 11717 "./typica.w"
  718. class SceneButton:public QGraphicsScene
  719. {
  720. Q_OBJECT
  721. public:
  722. SceneButton();
  723. ~SceneButton();
  724. protected:
  725. void mousePressEvent(QGraphicsSceneMouseEvent*mouseEvent);
  726. signals:
  727. void clicked(QPoint pos);
  728. };
  729. /*:513*//*515:*/
  730. #line 11759 "./typica.w"
  731. class WidgetDecorator:public QWidget
  732. {
  733. Q_OBJECT
  734. PackLayout*layout;
  735. QGraphicsView*label;
  736. QGraphicsTextItem*text;
  737. SceneButton*scene;
  738. public:
  739. WidgetDecorator(QWidget*widget,const QString&labeltext,
  740. Qt::Orientations orientation= Qt::Horizontal,
  741. QWidget*parent= NULL,Qt::WindowFlags f= 0);
  742. ~WidgetDecorator();
  743. void setBackgroundBrush(QBrush background);
  744. void setTextColor(QColor color);
  745. };
  746. /*:515*//*526:*/
  747. #line 11934 "./typica.w"
  748. class LogEditWindow:public QMainWindow
  749. {
  750. Q_OBJECT
  751. QWidget*centralWidget;
  752. PackLayout*mainLayout;
  753. QHBoxLayout*addRowsLayout;
  754. QLabel*startTimeLabel;
  755. QTimeEdit*startTime;
  756. QLabel*endTimeLabel;
  757. QTimeEdit*endTime;
  758. QLabel*intervalLabel;
  759. QSpinBox*interval;
  760. QPushButton*addRows;
  761. QAction*saveXml;
  762. QAction*saveCsv;
  763. QAction*openXml;
  764. MeasurementModel*model;
  765. QTableView*log;
  766. private slots:
  767. void addTheRows();
  768. void saveXML();
  769. void saveCSV();
  770. void openXML();
  771. protected:
  772. void closeEvent(QCloseEvent*event);
  773. public:
  774. LogEditWindow();
  775. };
  776. /*:526*//*540:*/
  777. #line 12242 "./typica.w"
  778. class XMLOutput:public QObject
  779. {
  780. Q_OBJECT
  781. MeasurementModel*data;
  782. QIODevice*out;
  783. int time;
  784. QMap<int,QString> temperatureColumns;
  785. QMap<int,QString> controlColumns;
  786. QMap<int,QString> annotationColumns;
  787. public:
  788. XMLOutput(MeasurementModel*model,QIODevice*device,int timec= 0);
  789. void addTemperatureColumn(const QString&series,int column);
  790. void addControlColumn(const QString&series,int column);
  791. void addAnnotationColumn(const QString&series,int column);
  792. void setModel(MeasurementModel*model);
  793. void setTimeColumn(int column);
  794. void setDevice(QIODevice*device);
  795. bool output();
  796. };
  797. /*:540*//*547:*/
  798. #line 12478 "./typica.w"
  799. class XMLInput:public QObject
  800. {
  801. Q_OBJECT
  802. int firstc;
  803. QIODevice*in;
  804. public:
  805. XMLInput(QIODevice*input,int c);
  806. void setFirstColumn(int column);
  807. void setDevice(QIODevice*device);
  808. bool input();
  809. signals:
  810. void measure(Measurement,int);
  811. void annotation(QString,int,int);
  812. void newTemperatureColumn(int,QString);
  813. void newAnnotationColumn(int,QString);
  814. void lastColumn(int);
  815. };
  816. /*:547*//*558:*/
  817. #line 12732 "./typica.w"
  818. class CSVOutput
  819. {
  820. MeasurementModel*data;
  821. QIODevice*out;
  822. int time;
  823. QMap<int,QString> temperatureColumns;
  824. QMap<int,QString> controlColumns;
  825. QMap<int,QString> annotationColumns;
  826. public:
  827. CSVOutput(MeasurementModel*model,QIODevice*device,int timec= 0);
  828. void addTemperatureColumn(const QString&series,int column);
  829. void addControlColumn(const QString&series,int column);
  830. void addAnnotationColumn(const QString&series,int column);
  831. void setModel(MeasurementModel*model);
  832. void setTimeColumn(int column);
  833. void setDevice(QIODevice*device);
  834. bool output();
  835. };
  836. /*:558*//*598:*/
  837. #line 12877 "./typica.w"
  838. #define AppInstance (qobject_cast<Application *> (qApp))
  839. class NodeInserter;
  840. class DeviceTreeModel;
  841. class Application:public QApplication
  842. {
  843. Q_OBJECT
  844. public:
  845. Application(int&argc,char**argv);
  846. QDomDocument*configuration();
  847. /*747:*/
  848. #line 15477 "./typica.w"
  849. QDomDocument deviceConfiguration();
  850. /*:747*//*780:*/
  851. #line 16150 "./typica.w"
  852. void registerDeviceConfigurationWidget(QString driver,QMetaObject widget);
  853. QWidget*deviceConfigurationWidget(DeviceTreeModel*model,
  854. const QModelIndex&index);
  855. /*:780*//*785:*/
  856. #line 16254 "./typica.w"
  857. QList<NodeInserter*> topLevelNodeInserters;
  858. /*:785*/
  859. #line 12888 "./typica.w"
  860. QSqlDatabase database();
  861. Q_INVOKABLE bool databaseConnected();
  862. Q_INVOKABLE QString currentTypicaUser();
  863. Q_INVOKABLE bool login(const QString&user,const QString&password);
  864. Q_INVOKABLE bool autoLogin();
  865. QScriptEngine*engine;
  866. QNetworkAccessManager*network;
  867. public slots:
  868. void setDatabaseConnected(bool status);
  869. void setCurrentTypicaUser(const QString&user);
  870. /*748:*/
  871. #line 15484 "./typica.w"
  872. void saveDeviceConfiguration();
  873. /*:748*/
  874. #line 12899 "./typica.w"
  875. signals:
  876. void userChanged(const QString&user);
  877. private:
  878. /*746:*/
  879. #line 15468 "./typica.w"
  880. QDomDocument deviceConfigurationDocument;
  881. /*:746*//*779:*/
  882. #line 16144 "./typica.w"
  883. QHash<QString,QMetaObject> deviceConfigurationWidgets;
  884. /*:779*/
  885. #line 12903 "./typica.w"
  886. QDomDocument conf;
  887. bool connectionStatus;
  888. QString currentUser;
  889. };
  890. /*:598*//*607:*/
  891. #line 13046 "./typica.w"
  892. class SaltModel:public QAbstractItemModel
  893. {
  894. Q_OBJECT
  895. QList<QList<QMap<int,QVariant> > > modelData;
  896. QStringList hData;
  897. int colcount;
  898. public:
  899. SaltModel(int columns);
  900. ~SaltModel();
  901. int rowCount(const QModelIndex&parent= QModelIndex())const;
  902. int columnCount(const QModelIndex&parent= QModelIndex())const;
  903. bool setHeaderData(int section,Qt::Orientation orientation,
  904. const QVariant&value,int role= Qt::DisplayRole);
  905. QVariant data(const QModelIndex&index,int role)const;
  906. bool setData(const QModelIndex&index,const QVariant&value,
  907. int role= Qt::EditRole);
  908. Qt::ItemFlags flags(const QModelIndex&index)const;
  909. QVariant headerData(int section,Qt::Orientation orientation,
  910. int role= Qt::DisplayRole)const;
  911. QModelIndex index(int row,int column,
  912. const QModelIndex&parent= QModelIndex())const;
  913. QModelIndex parent(const QModelIndex&index)const;
  914. QString arrayLiteral(int column,int role)const;
  915. QString quotedArrayLiteral(int column,int role)const;
  916. void clear();
  917. bool removeRows(int row,int count,
  918. const QModelIndex&parent= QModelIndex());
  919. int findData(const QVariant&value,int column,int role= Qt::UserRole);
  920. };
  921. /*:607*//*623:*/
  922. #line 13431 "./typica.w"
  923. class SqlComboBox:public QComboBox
  924. {
  925. Q_OBJECT
  926. int dataColumn;
  927. int displayColumn;
  928. bool dataColumnShown;
  929. QString specialNullText;
  930. QVariant specialNullData;
  931. public:
  932. SqlComboBox();
  933. ~SqlComboBox();
  934. SqlComboBox*clone(QWidget*parent);
  935. public slots:
  936. void addNullOption();
  937. void addSqlOptions(QString query);
  938. void setDataColumn(int column);
  939. void setDisplayColumn(int column);
  940. void showData(bool show);
  941. void setNullText(QString nullText);
  942. void setNullData(QVariant nullData);
  943. };
  944. /*:623*//*630:*/
  945. #line 13578 "./typica.w"
  946. class SqlComboBoxDelegate:public QItemDelegate
  947. {
  948. Q_OBJECT
  949. SqlComboBox*delegate;
  950. public:
  951. SqlComboBoxDelegate(QObject*parent= NULL);
  952. QWidget*createEditor(QWidget*parent,
  953. const QStyleOptionViewItem&option,
  954. const QModelIndex&index)const;
  955. void setEditorData(QWidget*editor,const QModelIndex&index)const;
  956. void setModelData(QWidget*editor,QAbstractItemModel*model,
  957. const QModelIndex&index)const;
  958. void setWidget(SqlComboBox*widget);
  959. virtual QSize sizeHint()const;
  960. void updateEditorGeometry(QWidget*editor,
  961. const QStyleOptionViewItem&option,
  962. const QModelIndex&index)const;
  963. };
  964. /*:630*//*645:*/
  965. #line 13789 "./typica.w"
  966. class SqlConnectionSetup:public QDialog
  967. {
  968. Q_OBJECT
  969. public:
  970. SqlConnectionSetup();
  971. ~SqlConnectionSetup();
  972. public slots:
  973. void testConnection();
  974. private:
  975. QFormLayout*formLayout;
  976. QComboBox*driver;
  977. QLineEdit*hostname;
  978. QLineEdit*portnumber;
  979. QLineEdit*dbname;
  980. QLineEdit*user;
  981. QLineEdit*password;
  982. QVBoxLayout*layout;
  983. QHBoxLayout*buttons;
  984. QPushButton*cancelButton;
  985. QPushButton*connectButton;
  986. };
  987. /*:645*//*650:*/
  988. #line 13939 "./typica.w"
  989. class SqlQueryView:public QTableView
  990. {
  991. Q_OBJECT
  992. public:
  993. SqlQueryView(QWidget*parent= NULL);
  994. void setQuery(const QString&query);
  995. bool setHeaderData(int section,Qt::Orientation orientation,
  996. const QVariant&value,int role);
  997. Q_INVOKABLE QVariant data(int row,int column,
  998. int role= Qt::DisplayRole);
  999. signals:
  1000. void openEntry(QString key);
  1001. void openEntryRow(int row);
  1002. protected:
  1003. virtual void showEvent(QShowEvent*event);
  1004. private slots:
  1005. void openRow(const QModelIndex&index);
  1006. void persistColumnResize(int column,int oldsize,int newsize);
  1007. };
  1008. /*:650*//*665:*/
  1009. #line 14194 "./typica.w"
  1010. class ReportAction:public QAction
  1011. {
  1012. Q_OBJECT
  1013. public:
  1014. ReportAction(const QString&fileName,const QString&reportName,
  1015. QObject*parent= NULL);
  1016. private slots:
  1017. void createReport();
  1018. private:
  1019. QString reportFile;
  1020. };
  1021. /*:665*//*677:*/
  1022. #line 14405 "./typica.w"
  1023. class ReportTable:public QObject
  1024. {
  1025. Q_OBJECT
  1026. QTextFrame*area;
  1027. QDomElement configuration;
  1028. QMap<QString,QVariant> bindings;
  1029. public:
  1030. ReportTable(QTextFrame*frame,QDomElement description);
  1031. ~ReportTable();
  1032. Q_INVOKABLE void bind(QString placeholder,QVariant value);
  1033. public slots:
  1034. void refresh();
  1035. };
  1036. /*:677*//*690:*/
  1037. #line 63 "./plugins.w"
  1038. class PluginAction:public QAction
  1039. {
  1040. Q_OBJECT
  1041. Q_PROPERTY(QString preRun READ preRun WRITE setPreRun);
  1042. Q_PROPERTY(QString postRun READ postRun WRITE setPostRun);
  1043. public:
  1044. PluginAction(const QFileInfo&info,QObject*parent);
  1045. QString preRun();
  1046. QString postRun();
  1047. public slots:
  1048. void setPreRun(const QString&script);
  1049. void setPostRun(const QString&script);
  1050. private slots:
  1051. void runScript();
  1052. private:
  1053. QString pluginFile;
  1054. QString preRunScript;
  1055. QString postRunScript;
  1056. };
  1057. /*:690*//*693:*/
  1058. #line 155 "./plugins.w"
  1059. Q_DECLARE_METATYPE(QScriptValue)
  1060. /*:693*//*716:*/
  1061. #line 14646 "./typica.w"
  1062. class FormArray:public QScrollArea
  1063. {
  1064. Q_OBJECT
  1065. QDomElement configuration;
  1066. QWidget itemContainer;
  1067. QVBoxLayout itemLayout;
  1068. int maxwidth;
  1069. int maxheight;
  1070. public:
  1071. FormArray(QDomElement description);
  1072. Q_INVOKABLE QWidget*elementAt(int index);
  1073. Q_INVOKABLE int elements();
  1074. public slots:
  1075. void addElements(int copies= 1);
  1076. void removeAllElements();
  1077. void setMaximumElementWidth(int width);
  1078. void setMaximumElementHeight(int height);
  1079. };
  1080. /*:716*//*726:*/
  1081. #line 14862 "./typica.w"
  1082. class ScaleControl:public QGraphicsView
  1083. {
  1084. Q_OBJECT
  1085. Q_PROPERTY(double initialValue READ initialValue WRITE setInitialValue)
  1086. Q_PROPERTY(double finalValue READ finalValue WRITE setFinalValue)
  1087. /*727:*/
  1088. #line 14888 "./typica.w"
  1089. QGraphicsScene scene;
  1090. QGraphicsPolygonItem initialDecrement;
  1091. QGraphicsPolygonItem initialIncrement;
  1092. QGraphicsPolygonItem finalDecrement;
  1093. QGraphicsPolygonItem finalIncrement;
  1094. QGraphicsPolygonItem initialIndicator;
  1095. QGraphicsPolygonItem finalIndicator;
  1096. QGraphicsPathItem scaleLine;
  1097. QPolygonF left;
  1098. QPolygonF right;
  1099. QPolygonF down;
  1100. QPolygonF up;
  1101. QPainterPath scalePath;
  1102. QBrush initialBrush;
  1103. QBrush finalBrush;
  1104. double nonScoredValue;
  1105. double scoredValue;
  1106. bool initialSet;
  1107. bool finalSet;
  1108. bool scaleDown;
  1109. /*:727*/
  1110. #line 14868 "./typica.w"
  1111. public:
  1112. ScaleControl();
  1113. double initialValue(void);
  1114. double finalValue(void);
  1115. virtual QSize sizeHint()const;
  1116. public slots:
  1117. void setInitialValue(double value);
  1118. void setFinalValue(double value);
  1119. signals:
  1120. void initialChanged(double);
  1121. void finalChanged(double);
  1122. protected:
  1123. virtual void mousePressEvent(QMouseEvent*event);
  1124. virtual void mouseReleaseEvent(QMouseEvent*event);
  1125. };
  1126. /*:726*//*738:*/
  1127. #line 15185 "./typica.w"
  1128. class IntensityControl:public QGraphicsView
  1129. {
  1130. Q_OBJECT
  1131. Q_PROPERTY(double value READ value WRITE setValue)
  1132. QGraphicsScene scene;
  1133. QGraphicsPolygonItem decrement;
  1134. QGraphicsPolygonItem increment;
  1135. QGraphicsPolygonItem indicator;
  1136. QGraphicsPathItem scaleLine;
  1137. QPolygonF left;
  1138. QPolygonF up;
  1139. QPolygonF down;
  1140. QPainterPath scalePath;
  1141. QBrush theBrush;
  1142. double theValue;
  1143. bool valueSet;
  1144. bool scaleDown;
  1145. public:
  1146. IntensityControl();
  1147. double value();
  1148. virtual QSize sizeHint()const;
  1149. public slots:
  1150. void setValue(double val);
  1151. signals:
  1152. void valueChanged(double);
  1153. protected:
  1154. virtual void mousePressEvent(QMouseEvent*event);
  1155. virtual void mouseReleaseEvent(QMouseEvent*event);
  1156. };
  1157. /*:738*//*754:*/
  1158. #line 15573 "./typica.w"
  1159. class DeviceTreeModelNode
  1160. {
  1161. public:
  1162. DeviceTreeModelNode(QDomNode&node,int row,
  1163. DeviceTreeModelNode*parent= NULL);
  1164. ~DeviceTreeModelNode();
  1165. DeviceTreeModelNode*child(int index);
  1166. DeviceTreeModelNode*parent();
  1167. QDomNode node()const;
  1168. int row();
  1169. private:
  1170. QDomNode domNode;
  1171. QHash<int,DeviceTreeModelNode*> children;
  1172. int rowNumber;
  1173. DeviceTreeModelNode*parentItem;
  1174. };
  1175. /*:754*//*756:*/
  1176. #line 15648 "./typica.w"
  1177. class DeviceTreeModel:public QAbstractItemModel
  1178. {
  1179. Q_OBJECT
  1180. public:
  1181. DeviceTreeModel(QObject*parent= NULL);
  1182. ~DeviceTreeModel();
  1183. QVariant data(const QModelIndex&index,int role)const;
  1184. Qt::ItemFlags flags(const QModelIndex&index)const;
  1185. QVariant headerData(int section,Qt::Orientation orientation,
  1186. int role= Qt::DisplayRole)const;
  1187. QModelIndex index(int row,int column,
  1188. const QModelIndex&parent= QModelIndex())const;
  1189. QModelIndex parent(const QModelIndex&child)const;
  1190. Q_INVOKABLE int rowCount(const QModelIndex&parent= QModelIndex())const;
  1191. int columnCount(const QModelIndex&parent= QModelIndex())const;
  1192. bool setData(const QModelIndex&index,const QVariant&value,
  1193. int role);
  1194. bool removeRows(int row,int count,const QModelIndex&parent);
  1195. QDomElement referenceElement(const QString&id);
  1196. public slots:
  1197. void newNode(const QString&name,const QString&driver,
  1198. const QModelIndex&parent);
  1199. private:
  1200. QDomDocument document;
  1201. DeviceTreeModelNode*root;
  1202. QDomNode referenceSection;
  1203. QDomNode treeRoot;
  1204. };
  1205. /*:756*//*775:*/
  1206. #line 16102 "./typica.w"
  1207. Q_DECLARE_METATYPE(QModelIndex)
  1208. /*:775*//*783:*/
  1209. #line 16209 "./typica.w"
  1210. class NodeInserter:public QAction
  1211. {
  1212. Q_OBJECT
  1213. public:
  1214. NodeInserter(const QString&title,const QString&name,
  1215. const QString&driver,QObject*parent= NULL);
  1216. signals:
  1217. void triggered(QString name,QString driver);
  1218. private slots:
  1219. void onTriggered();
  1220. private:
  1221. QString defaultNodeName;
  1222. QString driverString;
  1223. };
  1224. /*:783*//*786:*/
  1225. #line 16264 "./typica.w"
  1226. class DeviceConfigurationWindow:public QWidget
  1227. {
  1228. Q_OBJECT
  1229. public:
  1230. DeviceConfigurationWindow();
  1231. public slots:
  1232. void addDevice();
  1233. void removeNode();
  1234. void newSelection(const QModelIndex&index);
  1235. private slots:
  1236. void resizeColumn();
  1237. private:
  1238. QDomDocument document;
  1239. DeviceTreeModel*model;
  1240. QTreeView*view;
  1241. QScrollArea*configArea;
  1242. };
  1243. /*:786*//*795:*/
  1244. #line 16434 "./typica.w"
  1245. class BasicDeviceConfigurationWidget:public QWidget
  1246. {
  1247. Q_OBJECT
  1248. public:
  1249. BasicDeviceConfigurationWidget(DeviceTreeModel*model,
  1250. const QModelIndex&index);
  1251. public slots:
  1252. void insertChildNode(const QString&name,const QString&driver);
  1253. void updateAttribute(const QString&name,const QString&value);
  1254. protected:
  1255. DeviceTreeModel*deviceModel;
  1256. QModelIndex currentNode;
  1257. };
  1258. /*:795*//*799:*/
  1259. #line 16519 "./typica.w"
  1260. class RoasterConfWidget:public BasicDeviceConfigurationWidget
  1261. {
  1262. Q_OBJECT
  1263. public:
  1264. Q_INVOKABLE RoasterConfWidget(DeviceTreeModel*model,
  1265. const QModelIndex&index);
  1266. private slots:
  1267. void updateRoasterId(int id);
  1268. void updateCapacityCheck(int value);
  1269. void updateCapacity(const QString&value);
  1270. void updateCapacityUnit(const QString&value);
  1271. };
  1272. /*:799*//*804:*/
  1273. #line 16724 "./typica.w"
  1274. class NiDaqMxBaseDriverConfWidget:public BasicDeviceConfigurationWidget
  1275. {
  1276. Q_OBJECT
  1277. public:
  1278. Q_INVOKABLE NiDaqMxBaseDriverConfWidget(DeviceTreeModel*model,
  1279. const QModelIndex&index);
  1280. };
  1281. /*:804*//*806:*/
  1282. #line 16770 "./typica.w"
  1283. class NiDaqMxBase9211ConfWidget:public BasicDeviceConfigurationWidget
  1284. {
  1285. Q_OBJECT
  1286. public:
  1287. Q_INVOKABLE NiDaqMxBase9211ConfWidget(DeviceTreeModel*device,
  1288. const QModelIndex&index);
  1289. private slots:
  1290. void addChannel();
  1291. void updateDeviceId(const QString&newId);
  1292. };
  1293. /*:806*//*810:*/
  1294. #line 16856 "./typica.w"
  1295. class Ni9211TcConfWidget:public BasicDeviceConfigurationWidget
  1296. {
  1297. Q_OBJECT
  1298. public:
  1299. Q_INVOKABLE Ni9211TcConfWidget(DeviceTreeModel*device,
  1300. const QModelIndex&index);
  1301. private slots:
  1302. void updateThermocoupleType(const QString&type);
  1303. void updateColumnName(const QString&name);
  1304. void updateHidden(bool hidden);
  1305. };
  1306. /*:810*//*815:*/
  1307. #line 16972 "./typica.w"
  1308. class NiDaqMxDriverConfWidget:public BasicDeviceConfigurationWidget
  1309. {
  1310. Q_OBJECT
  1311. public:
  1312. Q_INVOKABLE NiDaqMxDriverConfWidget(DeviceTreeModel*model,
  1313. const QModelIndex&index);
  1314. };
  1315. /*:815*//*817:*/
  1316. #line 17013 "./typica.w"
  1317. class NiDaqMx9211ConfWidget:public BasicDeviceConfigurationWidget
  1318. {
  1319. Q_OBJECT
  1320. public:
  1321. Q_INVOKABLE NiDaqMx9211ConfWidget(DeviceTreeModel*model,
  1322. const QModelIndex&index);
  1323. private slots:
  1324. void addChannel();
  1325. void updateDeviceId(const QString&newId);
  1326. };
  1327. /*:817*//*819:*/
  1328. #line 17082 "./typica.w"
  1329. class NiDaqMxTc01ConfWidget:public BasicDeviceConfigurationWidget
  1330. {
  1331. Q_OBJECT
  1332. public:
  1333. Q_INVOKABLE NiDaqMxTc01ConfWidget(DeviceTreeModel*model,
  1334. const QModelIndex&index);
  1335. private slots:
  1336. void updateDeviceId(const QString&newId);
  1337. void updateThermocoupleType(const QString&type);
  1338. void updateColumnName(const QString&name);
  1339. void updateHidden(bool hidden);
  1340. };
  1341. /*:819*//*824:*/
  1342. #line 17213 "./typica.w"
  1343. class PortSelector:public QComboBox
  1344. {
  1345. Q_OBJECT
  1346. public:
  1347. PortSelector(QWidget*parent= NULL);
  1348. private slots:
  1349. void addDevice(QextPortInfo port);
  1350. private:
  1351. QextSerialEnumerator*lister;
  1352. };
  1353. /*:824*//*826:*/
  1354. #line 17261 "./typica.w"
  1355. class BaudSelector:public QComboBox
  1356. {
  1357. Q_OBJECT
  1358. Q_ENUMS(BaudRateType)
  1359. public:
  1360. BaudSelector(QWidget*parent= NULL);
  1361. enum BaudRateType
  1362. {
  1363. #if defined(Q_OS_UNIX) || defined(qdoc)
  1364. BAUD50= 50,
  1365. BAUD75= 75,
  1366. BAUD134= 134,
  1367. BAUD150= 150,
  1368. BAUD200= 200,
  1369. BAUD1800= 1800,
  1370. #if defined(B76800) || defined(qdoc)
  1371. BAUD76800= 76800,
  1372. #endif
  1373. #if (defined(B230400) && defined(B4000000)) || defined(qdoc)
  1374. BAUD230400= 230400,
  1375. BAUD460800= 460800,
  1376. BAUD500000= 500000,
  1377. BAUD576000= 576000,
  1378. BAUD921600= 921600,
  1379. BAUD1000000= 1000000,
  1380. BAUD1152000= 1152000,
  1381. BAUD1500000= 1500000,
  1382. BAUD2000000= 2000000,
  1383. BAUD2500000= 2500000,
  1384. BAUD3000000= 3000000,
  1385. BAUD3500000= 3500000,
  1386. BAUD4000000= 4000000,
  1387. #endif
  1388. #endif
  1389. #if defined(Q_OS_WIN) || defined(qdoc)
  1390. BAUD14400= 14400,
  1391. BAUD56000= 56000,
  1392. BAUD128000= 128000,
  1393. BAUD256000= 256000,
  1394. #endif
  1395. BAUD110= 110,
  1396. BAUD300= 300,
  1397. BAUD600= 600,
  1398. BAUD1200= 1200,
  1399. BAUD2400= 2400,
  1400. BAUD4800= 4800,
  1401. BAUD9600= 9600,
  1402. BAUD19200= 19200,
  1403. BAUD38400= 38400,
  1404. BAUD57600= 57600,
  1405. BAUD115200= 115200
  1406. };
  1407. };
  1408. /*:826*//*828:*/
  1409. #line 17332 "./typica.w"
  1410. class ParitySelector:public QComboBox
  1411. {
  1412. Q_OBJECT
  1413. Q_ENUMS(ParityType)
  1414. public:
  1415. ParitySelector(QWidget*parent= NULL);
  1416. enum ParityType
  1417. {
  1418. PAR_NONE,
  1419. PAR_ODD,
  1420. PAR_EVEN,
  1421. #if defined(Q_OS_WIN) || defined(qdoc)
  1422. PAR_MARK,
  1423. #endif
  1424. PAR_SPACE
  1425. };
  1426. };
  1427. /*:828*//*830:*/
  1428. #line 17370 "./typica.w"
  1429. class FlowSelector:public QComboBox
  1430. {
  1431. Q_OBJECT
  1432. Q_ENUMS(FlowType)
  1433. public:
  1434. FlowSelector(QWidget*parent= NULL);
  1435. enum FlowType
  1436. {
  1437. FLOW_OFF,
  1438. FLOW_HARDWARE,
  1439. FLOW_XONXOFF
  1440. };
  1441. };
  1442. /*:830*//*832:*/
  1443. #line 17403 "./typica.w"
  1444. class StopSelector:public QComboBox
  1445. {
  1446. Q_OBJECT
  1447. Q_ENUMS(StopBitsType)
  1448. public:
  1449. StopSelector(QWidget*parent= NULL);
  1450. enum StopBitsType
  1451. {
  1452. STOP_1,
  1453. #if defined(Q_OS_WIN) || defined(qdoc)
  1454. STOP_1_5,
  1455. #endif
  1456. STOP_2
  1457. };
  1458. };
  1459. /*:832*//*835:*/
  1460. #line 17460 "./typica.w"
  1461. class ShortHexSpinBox:public QSpinBox
  1462. {
  1463. Q_OBJECT
  1464. public:
  1465. ShortHexSpinBox(QWidget*parent= NULL);
  1466. virtual QValidator::State validate(QString&input,int&pos)const;
  1467. protected:
  1468. virtual int valueFromText(const QString&text)const;
  1469. virtual QString textFromValue(int value)const;
  1470. };
  1471. /*:835*//*837:*/
  1472. #line 17522 "./typica.w"
  1473. class ModbusRtuPortConfWidget:public BasicDeviceConfigurationWidget
  1474. {
  1475. Q_OBJECT
  1476. public:
  1477. Q_INVOKABLE ModbusRtuPortConfWidget(DeviceTreeModel*model,
  1478. const QModelIndex&index);
  1479. private slots:
  1480. void updatePort(const QString&newPort);
  1481. void updateBaudRate(const QString&newRate);
  1482. void updateParity(const QString&newParity);
  1483. void updateFlowControl(const QString&newFlow);
  1484. void updateStopBits(const QString&newStopBits);
  1485. };
  1486. /*:837*//*839:*/
  1487. #line 17673 "./typica.w"
  1488. class ModbusRtuDeviceConfWidget:public BasicDeviceConfigurationWidget
  1489. {
  1490. Q_OBJECT
  1491. public:
  1492. Q_INVOKABLE ModbusRtuDeviceConfWidget(DeviceTreeModel*model,
  1493. const QModelIndex&index);
  1494. private slots:
  1495. void updateStationNumber(int newStation);
  1496. void updateFixedUnit(bool newFixed);
  1497. void updateFixedDecimal(bool newFixed);
  1498. void updateUnit(const QString&newUnit);
  1499. void updateUnitAddress(int newAddress);
  1500. void updateValueF(int newValue);
  1501. void updateValueC(int newValue);
  1502. void updatePrecisionAddress(int newAddress);
  1503. void updatePrecisionValue(int newValue);
  1504. private:
  1505. QStackedLayout*unitSpecificationLayout;
  1506. QStackedLayout*decimalSpecificationLayout;
  1507. };
  1508. /*:839*//*841:*/
  1509. #line 17932 "./typica.w"
  1510. class ModbusRtuDeviceTPvConfWidget:public BasicDeviceConfigurationWidget
  1511. {
  1512. Q_OBJECT
  1513. public:
  1514. Q_INVOKABLE ModbusRtuDeviceTPvConfWidget(DeviceTreeModel*model,
  1515. const QModelIndex&index);
  1516. private slots:
  1517. void updateAddress(int newAddress);
  1518. };
  1519. /*:841*//*843:*/
  1520. #line 17978 "./typica.w"
  1521. class ModbusRtuDeviceTSvConfWidget:public BasicDeviceConfigurationWidget
  1522. {
  1523. Q_OBJECT
  1524. public:
  1525. Q_INVOKABLE ModbusRtuDeviceTSvConfWidget(DeviceTreeModel*model,
  1526. const QModelIndex&index);
  1527. private slots:
  1528. void updateReadAddress(int newAddress);
  1529. void updateWriteAddress(int newAddress);
  1530. void updateFixedRange(bool fixed);
  1531. void updateLower(const QString&lower);
  1532. void updateUpper(const QString&upper);
  1533. void updateLowerAddress(int newAddress);
  1534. void updateUpperAddress(int newAddress);
  1535. private:
  1536. QStackedLayout*boundsLayout;
  1537. };
  1538. /*:843*//*847:*/
  1539. #line 18172 "./typica.w"
  1540. class AnnotationButtonConfWidget:public BasicDeviceConfigurationWidget
  1541. {
  1542. Q_OBJECT
  1543. public:
  1544. Q_INVOKABLE AnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1545. private slots:
  1546. void updateButtonText(const QString&text);
  1547. void updateAnnotationText(const QString&text);
  1548. };
  1549. /*:847*//*851:*/
  1550. #line 18240 "./typica.w"
  1551. class ReconfigurableAnnotationButtonConfWidget:public BasicDeviceConfigurationWidget
  1552. {
  1553. Q_OBJECT
  1554. public:
  1555. Q_INVOKABLE ReconfigurableAnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1556. private slots:
  1557. void updateButtonText(const QString&text);
  1558. void updateAnnotationText(const QString&text);
  1559. };
  1560. /*:851*//*854:*/
  1561. #line 18314 "./typica.w"
  1562. class NoteSpinConfWidget:public BasicDeviceConfigurationWidget
  1563. {
  1564. Q_OBJECT
  1565. public:
  1566. Q_INVOKABLE NoteSpinConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1567. private slots:
  1568. void updateLabel(const QString&text);
  1569. void updateMinimum(const QString&minimum);
  1570. void updateMaximum(const QString&maximum);
  1571. void updatePrecision(int precision);
  1572. void updatePretext(const QString&text);
  1573. void updatePosttext(const QString&text);
  1574. };
  1575. /*:854*//*857:*/
  1576. #line 12 "./freeannotation.w"
  1577. class FreeAnnotationConfWidget:public BasicDeviceConfigurationWidget
  1578. {
  1579. Q_OBJECT
  1580. public:
  1581. Q_INVOKABLE FreeAnnotationConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1582. private slots:
  1583. void updateLabel(const QString&text);
  1584. };
  1585. /*:857*//*861:*/
  1586. #line 11 "./settings.w"
  1587. class SettingsWindow:public QMainWindow
  1588. {
  1589. Q_OBJECT
  1590. public:
  1591. SettingsWindow();
  1592. };
  1593. /*:861*//*866:*/
  1594. #line 8 "./graphsettings.w"
  1595. class GraphSettingsWidget:public QWidget
  1596. {
  1597. Q_OBJECT
  1598. public:
  1599. GraphSettingsWidget();
  1600. };
  1601. /*:866*//*868:*/
  1602. #line 46 "./graphsettings.w"
  1603. class GraphSettingsRelativeTab:public QWidget
  1604. {
  1605. Q_OBJECT
  1606. public:
  1607. GraphSettingsRelativeTab();
  1608. public slots:
  1609. void updateEnableSetting(bool enable);
  1610. void updateColorSetting(const QString&color);
  1611. void updateAxisSetting(const QString&gridList);
  1612. void updateUnit(int unit);
  1613. void showColorPicker();
  1614. private:
  1615. QLineEdit*colorEdit;
  1616. };
  1617. /*:868*//*872:*/
  1618. #line 15 "./colorsettings.w"
  1619. class ColorSettingsWidget:public QWidget
  1620. {
  1621. Q_OBJECT
  1622. public:
  1623. ColorSettingsWidget();
  1624. public slots:
  1625. void updateEnable(bool enable);
  1626. void updateAddress(const QString&address);
  1627. void updateScale(int sccale);
  1628. };
  1629. /*:872*//*876:*/
  1630. #line 7 "./advancedsettings.w"
  1631. class AdvancedSettingsWidget:public QWidget
  1632. {
  1633. Q_OBJECT
  1634. public:
  1635. AdvancedSettingsWidget();
  1636. public slots:
  1637. void enableDiagnosticLogging(bool enabled);
  1638. };
  1639. /*:876*//*880:*/
  1640. #line 18439 "./typica.w"
  1641. class ModbusRTUDevice:public QObject
  1642. {
  1643. Q_OBJECT
  1644. public:
  1645. ModbusRTUDevice(DeviceTreeModel*model,const QModelIndex&index);
  1646. ~ModbusRTUDevice();
  1647. void queueMessage(QByteArray request,QObject*object,const char*callback);
  1648. Q_INVOKABLE double SVLower();
  1649. Q_INVOKABLE double SVUpper();
  1650. Q_INVOKABLE int decimals();
  1651. QList<Channel*> channels;
  1652. public slots:
  1653. void outputSV(double sv);
  1654. signals:
  1655. void SVLowerChanged(double);
  1656. void SVUpperChanged(double);
  1657. void SVDecimalChanged(int);
  1658. void queueEmpty();
  1659. private slots:
  1660. void dataAvailable();
  1661. void sendNextMessage();
  1662. void decimalResponse(QByteArray response);
  1663. void unitResponse(QByteArray response);
  1664. void svlResponse(QByteArray response);
  1665. void svuResponse(QByteArray response);
  1666. void requestMeasurement();
  1667. void mResponse(QByteArray response);
  1668. void ignore(QByteArray response);
  1669. void timeout();
  1670. private:
  1671. QextSerialPort*port;
  1672. QByteArray responseBuffer;
  1673. QList<QByteArray> messageQueue;
  1674. QList<QObject*> retObjQueue;
  1675. QList<char*> callbackQueue;
  1676. quint16 calculateCRC(QByteArray data);
  1677. QTimer*messageDelayTimer;
  1678. QTimer*commTimeout;
  1679. int delayTime;
  1680. char station;
  1681. int decimalPosition;
  1682. int valueF;
  1683. int valueC;
  1684. bool unitIsF;
  1685. double outputSVLower;
  1686. double outputSVUpper;
  1687. QByteArray outputSVStub;
  1688. QByteArray pvStub;
  1689. QByteArray svStub;
  1690. QByteArray mStub;
  1691. quint16 pvaddress;
  1692. quint16 svaddress;
  1693. bool svenabled;
  1694. bool readingsv;
  1695. double savedpv;
  1696. bool waiting;
  1697. };
  1698. /*:880*//*896:*/
  1699. #line 19142 "./typica.w"
  1700. class ModbusConfigurator:public BasicDeviceConfigurationWidget
  1701. {
  1702. Q_OBJECT
  1703. public:
  1704. Q_INVOKABLE ModbusConfigurator(DeviceTreeModel*model,const QModelIndex&index);
  1705. private slots:
  1706. void updatePort(const QString&newPort);
  1707. void updateBaudRate(const QString&newRate);
  1708. void updateParity(const QString&newParity);
  1709. void updateFlowControl(const QString&newFlow);
  1710. void updateStopBits(const QString&newStopBits);
  1711. void updateStation(int station);
  1712. void updateFixedDecimal(bool fixed);
  1713. void updateDecimalAddress(int address);
  1714. void updateDecimalPosition(int position);
  1715. void updateFixedUnit(bool fixed);
  1716. void updateUnitAddress(int address);
  1717. void updateValueForF(int value);
  1718. void updateValueForC(int value);
  1719. void updateUnit(const QString&newUnit);
  1720. void updatePVAddress(int address);
  1721. void updateSVEnabled(bool enabled);
  1722. void updateSVReadAddress(int address);
  1723. void updateDeviceLimit(bool query);
  1724. void updateSVLowerAddress(int address);
  1725. void updateSVUpperAddress(int address);
  1726. void updateSVLower(double value);
  1727. void updateSVUpper(double value);
  1728. void updateSVWritable(bool canWriteSV);
  1729. void updateSVWriteAddress(int address);
  1730. void updatePVColumnName(const QString&name);
  1731. void updateSVColumnName(const QString&name);
  1732. void updatePVHidden(bool hidden);
  1733. void updateSVHidden(bool hidden);
  1734. private:
  1735. PortSelector*port;
  1736. BaudSelector*baud;
  1737. ParitySelector*parity;
  1738. FlowSelector*flow;
  1739. StopSelector*stop;
  1740. QSpinBox*station;
  1741. QCheckBox*decimalQuery;
  1742. ShortHexSpinBox*decimalAddress;
  1743. QSpinBox*decimalPosition;
  1744. QCheckBox*unitQuery;
  1745. ShortHexSpinBox*unitAddress;
  1746. QSpinBox*valueF;
  1747. QSpinBox*valueC;
  1748. QComboBox*fixedUnit;
  1749. ShortHexSpinBox*pVAddress;
  1750. QCheckBox*sVEnabled;
  1751. ShortHexSpinBox*sVReadAddress;
  1752. QCheckBox*deviceLimit;
  1753. ShortHexSpinBox*sVLowerAddr;
  1754. ShortHexSpinBox*sVUpperAddr;
  1755. QDoubleSpinBox*sVLower;
  1756. QDoubleSpinBox*sVUpper;
  1757. QCheckBox*sVWritable;
  1758. ShortHexSpinBox*sVOutputAddr;
  1759. QLineEdit*pVColumnName;
  1760. QLineEdit*sVColumnName;
  1761. };
  1762. /*:896*//*900:*/
  1763. #line 22 "./modbus.w"
  1764. class ModbusNGConfWidget:public BasicDeviceConfigurationWidget
  1765. {
  1766. Q_OBJECT
  1767. public:
  1768. Q_INVOKABLE ModbusNGConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1769. private slots:
  1770. void updatePort(const QString&value);
  1771. void updateBaudRate(const QString&value);
  1772. void updateParity(int value);
  1773. void updateFlowControl(int value);
  1774. void updateStopBits(int value);
  1775. void addInput();
  1776. private:
  1777. ParitySelector*m_parity;
  1778. FlowSelector*m_flow;
  1779. StopSelector*m_stop;
  1780. };
  1781. /*:900*//*902:*/
  1782. #line 144 "./modbus.w"
  1783. class ModbusNGInputConfWidget:public BasicDeviceConfigurationWidget
  1784. {
  1785. Q_OBJECT
  1786. public:
  1787. Q_INVOKABLE ModbusNGInputConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  1788. private slots:
  1789. void updateStation(int value);
  1790. void updateAddress(int value);
  1791. void updateFunction(int value);
  1792. void updateFormat(int value);
  1793. void updateDecimals(int value);
  1794. void updateUnit(int value);
  1795. void updateColumnName(const QString&value);
  1796. void updateHidden(bool value);
  1797. };
  1798. /*:902*//*906:*/
  1799. #line 342 "./modbus.w"
  1800. enum ModbusDataFormat
  1801. {
  1802. Int16,
  1803. FloatHL,
  1804. FloatLH
  1805. };
  1806. struct ModbusScanItem
  1807. {
  1808. QByteArray request;
  1809. ModbusDataFormat format;
  1810. int decimalPosition;
  1811. Units::Unit unit;
  1812. mutable double lastValue;
  1813. };
  1814. /*:906*//*907:*/
  1815. #line 362 "./modbus.w"
  1816. class ModbusNG:public QObject
  1817. {
  1818. Q_OBJECT
  1819. public:
  1820. ModbusNG(DeviceTreeModel*model,const QModelIndex&index);
  1821. ~ModbusNG();
  1822. Q_INVOKABLE int channelCount();
  1823. Channel*getChannel(int);
  1824. Q_INVOKABLE QString channelColumnName(int);
  1825. Q_INVOKABLE QString channelIndicatorText(int);
  1826. Q_INVOKABLE bool isChannelHidden(int);
  1827. Q_INVOKABLE QString channelType(int);
  1828. private slots:
  1829. void sendNextMessage();
  1830. void timeout();
  1831. void dataAvailable();
  1832. void rateLimitTimeout();
  1833. private:
  1834. quint16 calculateCRC(QByteArray data);
  1835. QextSerialPort*port;
  1836. int delayTime;
  1837. QTimer*messageDelayTimer;
  1838. QTimer*commTimeout;
  1839. QTimer*rateLimiter;
  1840. int scanPosition;
  1841. bool waiting;
  1842. QByteArray responseBuffer;
  1843. QList<Channel*> channels;
  1844. QList<ModbusScanItem> scanList;
  1845. QList<QString> channelNames;
  1846. QList<QString> channelLabels;
  1847. QList<bool> hiddenStates;
  1848. QList<QString> channelTypeList;
  1849. QVector<double> lastMeasurement;
  1850. };
  1851. /*:907*//*912:*/
  1852. #line 36 "./unsupportedserial.w"
  1853. class UnsupportedSerialDeviceConfWidget:public BasicDeviceConfigurationWidget
  1854. {
  1855. Q_OBJECT
  1856. public:
  1857. Q_INVOKABLE UnsupportedSerialDeviceConfWidget(DeviceTreeModel*model,
  1858. const QModelIndex&index);
  1859. private slots:
  1860. void updateConfiguration();
  1861. void saveScript();
  1862. void addChannel();
  1863. private:
  1864. SaltModel*deviceSettingsModel;
  1865. QTextEdit*scriptEditor;
  1866. };
  1867. /*:912*//*917:*/
  1868. #line 166 "./unsupportedserial.w"
  1869. class UnsupportedDeviceChannelConfWidget:public BasicDeviceConfigurationWidget
  1870. {
  1871. Q_OBJECT
  1872. public:
  1873. Q_INVOKABLE UnsupportedDeviceChannelConfWidget(DeviceTreeModel*model,
  1874. const QModelIndex&index);
  1875. private slots:
  1876. void updateColumnName(const QString&value);
  1877. void updateHidden(bool hidden);
  1878. void updateConfiguration();
  1879. private:
  1880. SaltModel*channelSettingsModel;
  1881. };
  1882. /*:917*//*922:*/
  1883. #line 298 "./unsupportedserial.w"
  1884. class JavaScriptDevice:public QObject
  1885. {
  1886. Q_OBJECT
  1887. public:
  1888. Q_INVOKABLE JavaScriptDevice(const QModelIndex&deviceIndex,
  1889. QScriptEngine*engine);
  1890. Q_INVOKABLE int channelCount();
  1891. Channel*getChannel(int channel);
  1892. Q_INVOKABLE bool isChannelHidden(int channel);
  1893. Q_INVOKABLE Units::Unit expectedChannelUnit(int channel);
  1894. Q_INVOKABLE QString channelColumnName(int channel);
  1895. Q_INVOKABLE QString channelIndicatorText(int channel);
  1896. public slots:
  1897. void setTemperatureColumn(int tcol);
  1898. void setAnnotationColumn(int ncol);
  1899. void start();
  1900. void stop();
  1901. signals:
  1902. void annotation(QString note,int tcol,int ncol);
  1903. void triggerStartBatch();
  1904. void triggerStopBatch();
  1905. void deviceStopRequested();
  1906. private:
  1907. QVariantMap deviceSettings;
  1908. QString deviceScript;
  1909. QList<Channel*> channelList;
  1910. QList<bool> hiddenState;
  1911. QList<Units::Unit> channelUnits;
  1912. QList<QString> columnNames;
  1913. QList<QString> indicatorTexts;
  1914. QList<QVariantMap> channelSettings;
  1915. int annotationTemperatureColumn;
  1916. int annotationNoteColumn;
  1917. QScriptEngine*scriptengine;
  1918. };
  1919. /*:922*//*944:*/
  1920. #line 11 "./phidgets.w"
  1921. class PhidgetsTemperatureSensorConfWidget:public BasicDeviceConfigurationWidget
  1922. {
  1923. Q_OBJECT
  1924. public:
  1925. Q_INVOKABLE PhidgetsTemperatureSensorConfWidget(DeviceTreeModel*model,
  1926. const QModelIndex&index);
  1927. private slots:
  1928. void addChannel();
  1929. void updateRate(int ms);
  1930. };
  1931. /*:944*//*948:*/
  1932. #line 82 "./phidgets.w"
  1933. class PhidgetTemperatureSensorChannelConfWidget:public BasicDeviceConfigurationWidget
  1934. {
  1935. Q_OBJECT
  1936. public:
  1937. Q_INVOKABLE PhidgetTemperatureSensorChannelConfWidget(DeviceTreeModel*model,
  1938. const QModelIndex&index);
  1939. private slots:
  1940. void updateColumnName(const QString&value);
  1941. void updateHidden(bool hidden);
  1942. void updateTC(int index);
  1943. void updateChannel(int channel);
  1944. private:
  1945. QComboBox*tcType;
  1946. };
  1947. /*:948*//*953:*/
  1948. #line 213 "./phidgets.w"
  1949. class PhidgetsTemperatureSensor:public QObject
  1950. {
  1951. Q_OBJECT
  1952. public:
  1953. Q_INVOKABLE PhidgetsTemperatureSensor(const QModelIndex&deviceIndex);
  1954. Q_INVOKABLE int channelCount();
  1955. Channel*getChannel(int channel);
  1956. Q_INVOKABLE bool isChannelHidden(int channel);
  1957. Q_INVOKABLE QString channelColumnName(int channel);
  1958. Q_INVOKABLE QString channelIndicatorText(int channel);
  1959. public slots:
  1960. void start();
  1961. void stop();
  1962. private slots:
  1963. void getMeasurements();
  1964. private:
  1965. QList<int> channelIndices;
  1966. QList<int> tctypes;
  1967. QList<Channel*> channelList;
  1968. QMap<int,Channel*> channelMap;
  1969. QList<bool> hiddenState;
  1970. QList<QString> columnNames;
  1971. QList<QString> indicatorTexts;
  1972. QLibrary driver;
  1973. QTimer sampleTimer;
  1974. void*device;
  1975. /*957:*/
  1976. #line 349 "./phidgets.w"
  1977. #ifdef _WIN32
  1978. typedef int(__stdcall*PhidgetHandleOnly)(void*);
  1979. typedef int(__stdcall*PhidgetHandleInt)(void*,int);
  1980. typedef int(__stdcall*PhidgetHandleIntInt)(void*,int,int);
  1981. typedef int(__stdcall*PhidgetHandleIntDoubleOut)(void*,int,double*);
  1982. #else
  1983. typedef int(*PhidgetHandleOnly)(void*);
  1984. typedef int(*PhidgetHandleInt)(void*,int);
  1985. typedef int(*PhidgetHandleIntInt)(void*,int,int);
  1986. typedef int(*PhidgetHandleIntDoubleOut)(void*,int,double*);
  1987. #endif
  1988. PhidgetHandleOnly createDevice;
  1989. PhidgetHandleInt openDevice;
  1990. PhidgetHandleInt waitForOpen;
  1991. PhidgetHandleIntInt setTCType;
  1992. PhidgetHandleIntDoubleOut getTemperature;
  1993. PhidgetHandleOnly closeDevice;
  1994. PhidgetHandleOnly deleteDevice;
  1995. /*:957*/
  1996. #line 240 "./phidgets.w"
  1997. };
  1998. /*:953*//*968:*/
  1999. #line 46 "./phidget22.w"
  2000. class PhidgetConfWidget:public BasicDeviceConfigurationWidget
  2001. {
  2002. Q_OBJECT
  2003. public:
  2004. Q_INVOKABLE PhidgetConfWidget(DeviceTreeModel*model,
  2005. const QModelIndex&index);
  2006. private slots:
  2007. void addChannel();
  2008. };
  2009. /*:968*//*970:*/
  2010. #line 96 "./phidget22.w"
  2011. class PhidgetChannelSelector:public QComboBox
  2012. {
  2013. Q_OBJECT
  2014. public:
  2015. PhidgetChannelSelector();
  2016. ~PhidgetChannelSelector();
  2017. void addChannel(void*device);
  2018. void removeChannel(void*device);
  2019. private:
  2020. QLibrary driver;
  2021. void*manager;
  2022. /*972:*/
  2023. #line 141 "./phidget22.w"
  2024. PhidgetPointer createManager;
  2025. PhidgetPointerCallbackPointer setOnAttachManager;
  2026. PhidgetPointerCallbackPointer setOnDetachManager;
  2027. PhidgetPointer openManager;
  2028. PhidgetPointerStringOut getDeviceName;
  2029. PhidgetPointerIntOut getDeviceSerialNumber;
  2030. PhidgetPointerIntOut getChannel;
  2031. PhidgetPointerIntOut getChannelClass;
  2032. PhidgetPointerIntOut getChannelSubclass;
  2033. PhidgetPointerIntOut getHubPort;
  2034. PhidgetPointer closeManager;
  2035. PhidgetPointer deleteManager;
  2036. /*:972*/
  2037. #line 108 "./phidget22.w"
  2038. };
  2039. /*:970*//*980:*/
  2040. #line 298 "./phidget22.w"
  2041. class PhidgetChannelConfWidget:public BasicDeviceConfigurationWidget
  2042. {
  2043. Q_OBJECT
  2044. public:
  2045. Q_INVOKABLE PhidgetChannelConfWidget(DeviceTreeModel*model,
  2046. const QModelIndex&index);
  2047. public slots:
  2048. void changeSelectedChannel(int index);
  2049. void updateSerialNumber(const QString&value);
  2050. void updateChannel(const QString&value);
  2051. void updateHubPort(const QString&value);
  2052. void updateColumnName(const QString&value);
  2053. void updateChannelType(int value);
  2054. void updateTCType(int value);
  2055. void updateRTDType(int value);
  2056. void updateRTDWiring(int value);
  2057. void updateHidden(int value);
  2058. private:
  2059. PhidgetChannelSelector*channelSelector;
  2060. QLineEdit*serialNumber;
  2061. QLineEdit*channel;
  2062. QLineEdit*hubPort;
  2063. QComboBox*subtype;
  2064. QStackedLayout*subtypeLayout;
  2065. QComboBox*tctype;
  2066. QComboBox*rtdtype;
  2067. QComboBox*rtdwiring;
  2068. };
  2069. /*:980*//*984:*/
  2070. #line 538 "./phidget22.w"
  2071. struct PhidgetChannelData
  2072. {
  2073. Channel*channel;
  2074. QString columnName;
  2075. QString indicatorLabel;
  2076. int serialNumber;
  2077. int channelNumber;
  2078. int channelType;
  2079. int hubPort;
  2080. int tcType;
  2081. int rtdType;
  2082. int wiring;
  2083. bool hidden;
  2084. void*device;
  2085. };
  2086. /*:984*//*985:*/
  2087. #line 559 "./phidget22.w"
  2088. class Phidget22:public QObject
  2089. {
  2090. Q_OBJECT
  2091. public:
  2092. Q_INVOKABLE Phidget22(const QModelIndex&deviceIndex);
  2093. Q_INVOKABLE int channelCount();
  2094. Channel*getChannel(int channel);
  2095. Q_INVOKABLE bool isChannelHidden(int channel);
  2096. Q_INVOKABLE QString channelColumnName(int channel);
  2097. Q_INVOKABLE QString channelIndicatorText(int channel);
  2098. public slots:
  2099. void start();
  2100. void stop();
  2101. private:
  2102. QList<PhidgetChannelData*> channelConfiguration;
  2103. QLibrary driver;
  2104. PhidgetPointer p_createTemperatureSensor;
  2105. PhidgetPointerIntIn p_setSerialNumber;
  2106. PhidgetPointerIntIn p_setChannelNumber;
  2107. PhidgetPointerIntIn p_setHubPort;
  2108. PhidgetPointerIntIn p_setTCType;
  2109. PhidgetPointerIntIn p_setRTDType;
  2110. PhidgetPointerIntIn p_setRTDWiring;
  2111. PhidgetPointerVCPointer p_setNewDataCallback;
  2112. PhidgetPointerIntIn p_open;
  2113. PhidgetPointer p_close;
  2114. PhidgetPointer p_delete;
  2115. };
  2116. /*:985*//*998:*/
  2117. #line 19684 "./typica.w"
  2118. class LinearSplineInterpolationConfWidget:public BasicDeviceConfigurationWidget
  2119. {
  2120. Q_OBJECT
  2121. public:
  2122. Q_INVOKABLE LinearSplineInterpolationConfWidget(DeviceTreeModel*model,
  2123. const QModelIndex&index);
  2124. private slots:
  2125. void updateSourceColumn(const QString&source);
  2126. void updateDestinationColumn(const QString&dest);
  2127. void updateKnots();
  2128. private:
  2129. SaltModel*tablemodel;
  2130. };
  2131. /*:998*//*1004:*/
  2132. #line 19814 "./typica.w"
  2133. class CoolingTimerConfWidget:public BasicDeviceConfigurationWidget
  2134. {
  2135. Q_OBJECT
  2136. public:
  2137. Q_INVOKABLE CoolingTimerConfWidget(DeviceTreeModel*model,
  2138. const QModelIndex&index);
  2139. private slots:
  2140. void updateResetTime(QTime time);
  2141. };
  2142. /*:1004*//*1008:*/
  2143. #line 19880 "./typica.w"
  2144. class RangeTimerConfWidget:public BasicDeviceConfigurationWidget
  2145. {
  2146. Q_OBJECT
  2147. public:
  2148. Q_INVOKABLE RangeTimerConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  2149. private slots:
  2150. void updateStartButtonText(const QString&text);
  2151. void updateStopButtonText(const QString&text);
  2152. void updateStartColumnName(const QString&text);
  2153. void updateStopColumnName(const QString&text);
  2154. void updateStartValue(const QString&text);
  2155. void updateStopValue(const QString&text);
  2156. void updateStartTrigger(int option);
  2157. void updateStopTrigger(int option);
  2158. };
  2159. /*:1008*//*1013:*/
  2160. #line 20132 "./typica.w"
  2161. class MultiRangeTimerConfWidget:public BasicDeviceConfigurationWidget
  2162. {
  2163. Q_OBJECT
  2164. public:
  2165. Q_INVOKABLE MultiRangeTimerConfWidget(DeviceTreeModel*model,
  2166. const QModelIndex&index);
  2167. private slots:
  2168. void updateColumnName(const QString&text);
  2169. void updateRangeData();
  2170. private:
  2171. SaltModel*tablemodel;
  2172. };
  2173. /*:1013*//*1018:*/
  2174. #line 20234 "./typica.w"
  2175. class TranslationConfWidget:public BasicDeviceConfigurationWidget
  2176. {
  2177. Q_OBJECT
  2178. public:
  2179. Q_INVOKABLE TranslationConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  2180. private slots:
  2181. void updateMatchingColumn(const QString&column);
  2182. void updateTemperature();
  2183. void updateDelay();
  2184. private:
  2185. QDoubleSpinBox*temperatureValue;
  2186. QComboBox*unitSelector;
  2187. QSpinBox*delaySelector;
  2188. };
  2189. /*:1018*//*1022:*/
  2190. #line 16 "./rate.w"
  2191. class RateOfChange:public QObject
  2192. {
  2193. Q_OBJECT
  2194. public:
  2195. RateOfChange(int cachetime= 1,int scaletime= 1);
  2196. public slots:
  2197. void newMeasurement(Measurement measure);
  2198. void setCacheTime(int seconds);
  2199. void setScaleTime(int seconds);
  2200. signals:
  2201. void newData(Measurement measure);
  2202. private:
  2203. int ct;
  2204. int st;
  2205. QList<Measurement> cache;
  2206. };
  2207. /*:1022*//*1030:*/
  2208. #line 177 "./rate.w"
  2209. class RateOfChangeConfWidget:public BasicDeviceConfigurationWidget
  2210. {
  2211. Q_OBJECT
  2212. public:
  2213. Q_INVOKABLE RateOfChangeConfWidget(DeviceTreeModel*model,const QModelIndex&index);
  2214. private slots:
  2215. void updateColumn(const QString&column);
  2216. void updateCacheTime(const QString&seconds);
  2217. void updateScaleTime(const QString&seconds);
  2218. };
  2219. /*:1030*//*1036:*/
  2220. #line 15 "./mergeseries.w"
  2221. class MergeSeries:public QObject
  2222. {
  2223. Q_OBJECT
  2224. public:
  2225. MergeSeries();
  2226. public slots:
  2227. void in1(Measurement measure);
  2228. void in2(Measurement measure);
  2229. signals:
  2230. void newData(Measurement measure);
  2231. protected:
  2232. virtual void calculate(Measurement m1,Measurement m2)= 0;
  2233. private:
  2234. Measurement last1;
  2235. Measurement last2;
  2236. bool received1;
  2237. bool received2;
  2238. };
  2239. class DifferenceSeries:public MergeSeries
  2240. {
  2241. Q_OBJECT
  2242. public:
  2243. DifferenceSeries();
  2244. protected:
  2245. void calculate(Measurement m1,Measurement m2);
  2246. };
  2247. class MeanSeries:public MergeSeries
  2248. {
  2249. Q_OBJECT
  2250. public:
  2251. MeanSeries();
  2252. protected:
  2253. void calculate(Measurement m1,Measurement m2);
  2254. };
  2255. /*:1036*//*1044:*/
  2256. #line 167 "./mergeseries.w"
  2257. class MergeSeriesConfWidget:public BasicDeviceConfigurationWidget
  2258. {
  2259. Q_OBJECT
  2260. public:
  2261. Q_INVOKABLE MergeSeriesConfWidget(DeviceTreeModel*model,
  2262. const QModelIndex&index);
  2263. private slots:
  2264. void updateColumn1(const QString&column);
  2265. void updateColumn2(const QString&column);
  2266. void updateOutput(const QString&column);
  2267. void updateType(int type);
  2268. };
  2269. /*:1044*//*1050:*/
  2270. #line 19 "./dataqsdk.w"
  2271. class DataqSdkDeviceImplementation;
  2272. class DataqSdkDevice:public QObject
  2273. {
  2274. Q_OBJECT
  2275. DataqSdkDeviceImplementation*imp;
  2276. private slots:
  2277. void threadFinished();
  2278. public:
  2279. DataqSdkDevice(QString device);
  2280. ~DataqSdkDevice();
  2281. Channel*newChannel(Units::Unit scale);
  2282. Q_INVOKABLE void setClockRate(double Hz);
  2283. Q_INVOKABLE void start();
  2284. static QStringList detectPorts();
  2285. static QStringList detectHardware();
  2286. };
  2287. /*:1050*//*1051:*/
  2288. #line 49 "./dataqsdk.w"
  2289. class DataqSdkDeviceImplementation:public QThread
  2290. {
  2291. Q_OBJECT
  2292. public:
  2293. DataqSdkDeviceImplementation();
  2294. ~DataqSdkDeviceImplementation();
  2295. void run();
  2296. /*1052:*/
  2297. #line 70 "./dataqsdk.w"
  2298. typedef struct di_inlist_struct{
  2299. unsigned short chan;
  2300. unsigned short diff;
  2301. unsigned short gain;
  2302. unsigned short unipolar;
  2303. unsigned short dig_out_enable;
  2304. unsigned short dig_out;
  2305. unsigned short ave;
  2306. unsigned short counter;
  2307. }DI_INLIST_STRUCT;
  2308. typedef int(PASCAL*FPDIOPEN)(unsigned);
  2309. typedef int(PASCAL*FPDICLOSE)(void);
  2310. typedef double(PASCAL*FPDISAMPLERATE)(double,long*,long*);
  2311. typedef double(PASCAL*FPDIMAXIMUMRATE)(double);
  2312. typedef int(PASCAL*FPDILISTLENGTH)(unsigned,unsigned);
  2313. typedef int(PASCAL*FPDIINLIST)(di_inlist_struct*);
  2314. typedef int*(PASCAL*FPDIBUFFERALLOC)(unsigned,unsigned);
  2315. typedef int(PASCAL*FPDISTARTSCAN)(void);
  2316. typedef unsigned(PASCAL*FPDISTATUSREAD)(short*,unsigned);
  2317. typedef unsigned(PASCAL*FPDIBUFFERSTATUS)(unsigned);
  2318. typedef int(PASCAL*FPDIBURSTRATE)(unsigned);
  2319. typedef int(PASCAL*FPDISTOPSCAN)(void);
  2320. FPDIOPEN di_open;
  2321. FPDICLOSE di_close;
  2322. FPDISAMPLERATE di_sample_rate;
  2323. FPDIMAXIMUMRATE di_maximum_rate;
  2324. FPDILISTLENGTH di_list_length;
  2325. FPDIINLIST di_inlist;
  2326. FPDIBUFFERALLOC di_buffer_alloc;
  2327. FPDISTARTSCAN di_start_scan;
  2328. FPDISTATUSREAD di_status_read;
  2329. FPDIBUFFERSTATUS di_buffer_status;
  2330. FPDIBURSTRATE di_burst_rate;
  2331. FPDISTOPSCAN di_stop_scan;
  2332. /*:1052*/
  2333. #line 57 "./dataqsdk.w"
  2334. /*1054:*/
  2335. #line 134 "./dataqsdk.w"
  2336. bool isOpen;
  2337. double sampleRate;
  2338. long oversample;
  2339. long burstDivisor;
  2340. QString device;
  2341. unsigned deviceNumber;
  2342. QVector<Channel*> channelMap;
  2343. int error;
  2344. int channels;
  2345. bool ready;
  2346. QLibrary*driver;
  2347. QVector<Units::Unit> unitMap;
  2348. int*input_buffer;
  2349. QTimer*eventClock;
  2350. QMultiMap<int,double> smoother;
  2351. /*:1054*/
  2352. #line 58 "./dataqsdk.w"
  2353. public slots:
  2354. void measure();
  2355. private:
  2356. qint16*buffer;
  2357. };
  2358. /*:1051*//*1071:*/
  2359. #line 663 "./dataqsdk.w"
  2360. class DataqSdkDeviceConfWidget:public BasicDeviceConfigurationWidget
  2361. {
  2362. Q_OBJECT
  2363. public:
  2364. Q_INVOKABLE DataqSdkDeviceConfWidget(DeviceTreeModel*model,
  2365. const QModelIndex&index);
  2366. private slots:
  2367. void updateAutoSelect(bool automatic);
  2368. void updateDeviceNumber(int deviceNumber);
  2369. void updatePort(QString portId);
  2370. void addChannel();
  2371. private:
  2372. QStackedWidget*deviceIdStack;
  2373. };
  2374. /*:1071*//*1076:*/
  2375. #line 808 "./dataqsdk.w"
  2376. class DataqSdkChannelConfWidget:public BasicDeviceConfigurationWidget
  2377. {
  2378. Q_OBJECT
  2379. public:
  2380. Q_INVOKABLE DataqSdkChannelConfWidget(DeviceTreeModel*model,
  2381. const QModelIndex&index);
  2382. private slots:
  2383. void updateUnits(const QString&unit);
  2384. void updateColumnName(const QString&value);
  2385. void updateMeasuredLower(const QString&value);
  2386. void updateMeasuredUpper(const QString&value);
  2387. void updateMappedLower(const QString&value);
  2388. void updateMappedUpper(const QString&value);
  2389. void updateClosedInterval(bool closed);
  2390. void updateSmoothingEnabled(bool enabled);
  2391. void updateSensitivity(const QString&value);
  2392. void startCalibration();
  2393. void stopCalibration();
  2394. void resetCalibration();
  2395. void updateInput(Measurement measure);
  2396. void updateOutput(Measurement measure);
  2397. void updateHidden(bool hidden);
  2398. private:
  2399. QPushButton*startButton;
  2400. QPushButton*resetButton;
  2401. QPushButton*stopButton;
  2402. /*1081:*/
  2403. #line 1098 "./dataqsdk.w"
  2404. bool autoSelect;
  2405. QString deviceID;
  2406. unsigned int channelOfInterest;
  2407. /*:1081*/
  2408. #line 835 "./dataqsdk.w"
  2409. DataqSdkDevice*calibrationDevice;
  2410. LinearCalibrator*calibrator;
  2411. QLineEdit*currentMeasurement;
  2412. QLineEdit*minimumMeasurement;
  2413. QLineEdit*maximumMeasurement;
  2414. QLineEdit*averageMeasurement;
  2415. QLineEdit*currentMapped;
  2416. QLineEdit*minimumMapped;
  2417. QLineEdit*maximumMapped;
  2418. QLineEdit*averageMapped;
  2419. int rmCount;
  2420. int cmCount;
  2421. double rmin;
  2422. double rmax;
  2423. double rmean;
  2424. double cmin;
  2425. double cmax;
  2426. double cmean;
  2427. };
  2428. /*:1076*//*1103:*/
  2429. #line 273 "./scales.w"
  2430. Q_DECLARE_METATYPE(BaudRateType)
  2431. Q_DECLARE_METATYPE(DataBitsType)
  2432. Q_DECLARE_METATYPE(ParityType)
  2433. Q_DECLARE_METATYPE(StopBitsType)
  2434. Q_DECLARE_METATYPE(FlowType)
  2435. /*:1103*//*1110:*/
  2436. #line 396 "./scales.w"
  2437. class SerialScaleConfWidget:public BasicDeviceConfigurationWidget
  2438. {
  2439. Q_OBJECT
  2440. public:
  2441. Q_INVOKABLE SerialScaleConfWidget(DeviceTreeModel*model,
  2442. const QModelIndex&index);
  2443. private slots:
  2444. void updatePort(const QString&newPort);
  2445. void updateBaudRate(const QString&rate);
  2446. void updateParity(int index);
  2447. void updateFlowControl(int index);
  2448. void updateStopBits(int index);
  2449. void updateWeighCommand(const QString&command);
  2450. void updateCommandTerminator(const QString&terminator);
  2451. private:
  2452. PortSelector*port;
  2453. BaudSelector*baud;
  2454. ParitySelector*parity;
  2455. FlowSelector*flow;
  2456. StopSelector*stop;
  2457. QLineEdit*weighcommand;
  2458. QComboBox*commandterminator;
  2459. };
  2460. /*:1110*//*1115:*/
  2461. #line 14 "./valueannotation.w"
  2462. class ValueAnnotationConfWidget:public BasicDeviceConfigurationWidget
  2463. {
  2464. Q_OBJECT
  2465. public:
  2466. Q_INVOKABLE ValueAnnotationConfWidget(DeviceTreeModel*model,
  2467. const QModelIndex&index);
  2468. private slots:
  2469. void updateSourceColumn(const QString&source);
  2470. void updateAnnotations();
  2471. void updateStart(bool noteOnStart);
  2472. private:
  2473. SaltModel*tablemodel;
  2474. };
  2475. /*:1115*//*1123:*/
  2476. #line 165 "./valueannotation.w"
  2477. class ValueAnnotation:public QObject
  2478. {
  2479. Q_OBJECT
  2480. public:
  2481. ValueAnnotation();
  2482. Q_INVOKABLE void setAnnotation(double value,const QString&annotation);
  2483. public slots:
  2484. void newMeasurement(Measurement measure);
  2485. void annotate();
  2486. void setAnnotationColumn(int column);
  2487. void setTemperatureColumn(int column);
  2488. void setTolerance(double epsilon);
  2489. signals:
  2490. void annotation(QString annotation,int tempcolumn,int notecolumn);
  2491. private:
  2492. int lastIndex;
  2493. int annotationColumn;
  2494. int measurementColumn;
  2495. QList<double> values;
  2496. QStringList annotations;
  2497. double tolerance;
  2498. };
  2499. /*:1123*//*1132:*/
  2500. #line 14 "./thresholdannotation.w"
  2501. class ThresholdAnnotationConfWidget:public BasicDeviceConfigurationWidget
  2502. {
  2503. Q_OBJECT
  2504. public:
  2505. Q_INVOKABLE ThresholdAnnotationConfWidget(DeviceTreeModel*model,
  2506. const QModelIndex&index);
  2507. private slots:
  2508. void updateSourceColumn(const QString&source);
  2509. void updateThreshold(double value);
  2510. void updateDirection(int index);
  2511. void updateAnnotation(const QString&note);
  2512. };
  2513. /*:1132*//*1137:*/
  2514. #line 127 "./thresholdannotation.w"
  2515. class Annotator:public QObject
  2516. {
  2517. Q_OBJECT
  2518. QString note;
  2519. int tc;
  2520. int ac;
  2521. QTimer t;
  2522. public:
  2523. Annotator(const QString&text);
  2524. public slots:
  2525. void setAnnotation(const QString&annotation);
  2526. void setTemperatureColumn(int tempcolumn);
  2527. void setAnnotationColumn(int annotationcolumn);
  2528. void annotate();
  2529. private slots:
  2530. void catchTimer();
  2531. signals:
  2532. void annotation(QString annotation,int tempcolumn,int notecolumn);
  2533. };
  2534. /*:1137*//*1148:*/
  2535. #line 78 "./user.w"
  2536. class LoginDialog:public QDialog
  2537. {
  2538. Q_OBJECT
  2539. public:
  2540. LoginDialog();
  2541. public slots:
  2542. void attemptLogin();
  2543. private:
  2544. QLineEdit*user;
  2545. QLineEdit*password;
  2546. QLabel*warning;
  2547. QPushButton*login;
  2548. };
  2549. /*:1148*//*1154:*/
  2550. #line 162 "./user.w"
  2551. class UserLabel:public QLabel
  2552. {
  2553. Q_OBJECT
  2554. public:
  2555. UserLabel();
  2556. public slots:
  2557. void updateLabel(const QString&user);
  2558. protected:
  2559. void mouseReleaseEvent(QMouseEvent*event);
  2560. };
  2561. /*:1154*//*1158:*/
  2562. #line 209 "./user.w"
  2563. class NewTypicaUser:public QDialog
  2564. {
  2565. Q_OBJECT
  2566. public:
  2567. NewTypicaUser();
  2568. public slots:
  2569. void createAndReset();
  2570. void createAndClose();
  2571. void validate();
  2572. void cancelValidate();
  2573. private:
  2574. void createNewUser();
  2575. QLineEdit*userField;
  2576. QLineEdit*passwordField;
  2577. QCheckBox*autoLogin;
  2578. QPushButton*saveAndCloseButton;
  2579. QPushButton*saveAndNewButton;
  2580. QPushButton*cancelButton;
  2581. };
  2582. /*:1158*//*1165:*/
  2583. #line 9 "./roastcoloredit.w"
  2584. class RoastColorEdit:public QWidget
  2585. {
  2586. Q_OBJECT
  2587. Q_PROPERTY(QString value READ value WRITE setValue)
  2588. public:
  2589. RoastColorEdit();
  2590. QString value();
  2591. public slots:
  2592. void setValue(const QString&color);
  2593. private slots:
  2594. void readColor();
  2595. void measureFinished();
  2596. void readFinished();
  2597. private:
  2598. QLineEdit*edit;
  2599. QNetworkReply*networkReply;
  2600. };
  2601. /*:1165*/
  2602. #line 528 "./typica.w"
  2603. /*975:*/
  2604. #line 203 "./phidget22.w"
  2605. void CCONV ChannelListAddChannel(void*,void*context,void*device)
  2606. {
  2607. PhidgetChannelSelector*list=
  2608. qobject_cast<PhidgetChannelSelector*> ((QObject*)context);
  2609. list->addChannel(device);
  2610. }
  2611. void CCONV ChannelListRemoveChannel(void*,void*context,void*device)
  2612. {
  2613. PhidgetChannelSelector*list=
  2614. qobject_cast<PhidgetChannelSelector*> ((QObject*)context);
  2615. list->removeChannel(device);
  2616. }
  2617. /*:975*//*990:*/
  2618. #line 762 "./phidget22.w"
  2619. void CCONV Phidget22ValueCallback(void*,void*context,double value)
  2620. {
  2621. Channel*channel= (Channel*)context;
  2622. QTime time= QTime::currentTime();
  2623. Measurement measure(value*9.0/5.0+32.0,time);
  2624. channel->input(measure);
  2625. }
  2626. /*:990*/
  2627. #line 529 "./typica.w"
  2628. /*12:*/
  2629. #line 820 "./typica.w"
  2630. void setQObjectProperties(QScriptValue value,QScriptEngine*engine);
  2631. QScriptValue QObject_setProperty(QScriptContext*context,QScriptEngine*engine);
  2632. /*:12*//*14:*/
  2633. #line 845 "./typica.w"
  2634. void setQPaintDeviceProperties(QScriptValue value,QScriptEngine*engine);
  2635. void setQLayoutItemProperties(QScriptValue value,QScriptEngine*engine);
  2636. /*:14*//*19:*/
  2637. #line 905 "./typica.w"
  2638. void setQWidgetProperties(QScriptValue value,QScriptEngine*engine);
  2639. QScriptValue constructQWidget(QScriptContext*context,QScriptEngine*engine);
  2640. QScriptValue QWidget_setLayout(QScriptContext*context,QScriptEngine*engine);
  2641. QScriptValue QWidget_activateWindow(QScriptContext*context,
  2642. QScriptEngine*engine);
  2643. /*:19*//*23:*/
  2644. #line 995 "./typica.w"
  2645. QScriptValue displayWarning(QScriptContext*context,QScriptEngine*engine);
  2646. QScriptValue displayError(QScriptContext*context,QScriptEngine*engine);
  2647. QScriptValue displayInfo(QScriptContext*context,QScriptEngine*engine);
  2648. /*:23*//*33:*/
  2649. #line 1229 "./typica.w"
  2650. QScriptValue constructQMainWindow(QScriptContext*context,
  2651. QScriptEngine*engine);
  2652. QScriptValue QMainWindow_setCentralWidget(QScriptContext*context,
  2653. QScriptEngine*engine);
  2654. QScriptValue QMainWindow_menuBar(QScriptContext*context,
  2655. QScriptEngine*engine);
  2656. void setQMainWindowProperties(QScriptValue value,QScriptEngine*engine);
  2657. /*:33*//*38:*/
  2658. #line 1328 "./typica.w"
  2659. void setQMenuBarProperties(QScriptValue value,QScriptEngine*engine);
  2660. QScriptValue QMenuBar_addMenu(QScriptContext*context,QScriptEngine*engine);
  2661. /*:38*//*41:*/
  2662. #line 1373 "./typica.w"
  2663. void setQMenuProperties(QScriptValue value,QScriptEngine*engine);
  2664. QScriptValue QMenu_addAction(QScriptContext*context,QScriptEngine*engine);
  2665. QScriptValue QMenu_addSeparator(QScriptContext*context,QScriptEngine*engine);
  2666. /*:41*//*44:*/
  2667. #line 1439 "./typica.w"
  2668. void setQFrameProperties(QScriptValue value,QScriptEngine*engine);
  2669. QScriptValue constructQFrame(QScriptContext*context,QScriptEngine*engine);
  2670. /*:44*//*47:*/
  2671. #line 1472 "./typica.w"
  2672. void setQLabelProperties(QScriptValue value,QScriptEngine*engine);
  2673. QScriptValue constructQLabel(QScriptContext*context,QScriptEngine*engine);
  2674. /*:47*//*50:*/
  2675. #line 1510 "./typica.w"
  2676. void setQSvgWidgetProperties(QScriptValue value,QScriptEngine*engine);
  2677. QScriptValue constructQSvgWidget(QScriptContext*context,
  2678. QScriptEngine*engine);
  2679. QScriptValue QSvgWidget_loadDevice(QScriptContext*context,
  2680. QScriptEngine*engine);
  2681. void addSvgWidgetToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2682. QStack<QLayout*> *layoutStack);
  2683. /*:50*//*56:*/
  2684. #line 1597 "./typica.w"
  2685. void setQLineEditProperties(QScriptValue value,QScriptEngine*engine);
  2686. QScriptValue constructQLineEdit(QScriptContext*context,QScriptEngine*engine);
  2687. /*:56*//*60:*/
  2688. #line 1636 "./typica.w"
  2689. QScriptValue constructQSplitter(QScriptContext*context,QScriptEngine*engine);
  2690. QScriptValue QSplitter_addWidget(QScriptContext*context,
  2691. QScriptEngine*engine);
  2692. QScriptValue QSplitter_saveState(QScriptContext*context,
  2693. QScriptEngine*engine);
  2694. QScriptValue QSplitter_restoreState(QScriptContext*context,
  2695. QScriptEngine*engine);
  2696. QScriptValue QSplitter_count(QScriptContext*context,
  2697. QScriptEngine*engine);
  2698. QScriptValue QSplitter_setCollapsible(QScriptContext*context,
  2699. QScriptEngine*engine);
  2700. void setQSplitterProperties(QScriptValue value,QScriptEngine*engine);
  2701. /*:60*//*67:*/
  2702. #line 1797 "./typica.w"
  2703. void setQLayoutProperties(QScriptValue value,QScriptEngine*engine);
  2704. QScriptValue QLayout_addWidget(QScriptContext*context,QScriptEngine*engine);
  2705. /*:67*//*69:*/
  2706. #line 1852 "./typica.w"
  2707. QScriptValue constructQBoxLayout(QScriptContext*context,
  2708. QScriptEngine*engine);
  2709. void setQBoxLayoutProperties(QScriptValue value,QScriptEngine*engine);
  2710. QScriptValue QBoxLayout_addLayout(QScriptContext*context,QScriptEngine*engine);
  2711. QScriptValue QBoxLayout_addWidget(QScriptContext*context,QScriptEngine*engine);
  2712. /*:69*//*73:*/
  2713. #line 1965 "./typica.w"
  2714. QScriptValue constructQAction(QScriptContext*context,QScriptEngine*engine);
  2715. QScriptValue QAction_setShortcut(QScriptContext*context,
  2716. QScriptEngine*engine);
  2717. void setQActionProperties(QScriptValue value,QScriptEngine*engine);
  2718. /*:73*//*76:*/
  2719. #line 2021 "./typica.w"
  2720. QScriptValue QFileDialog_getOpenFileName(QScriptContext*context,
  2721. QScriptEngine*engine);
  2722. QScriptValue QFileDialog_getSaveFileName(QScriptContext*context,
  2723. QScriptEngine*engine);
  2724. void setQFileDialogProperties(QScriptValue value,QScriptEngine*engine);
  2725. void setQDialogProperties(QScriptValue value,QScriptEngine*engine);
  2726. /*:76*//*81:*/
  2727. #line 2132 "./typica.w"
  2728. QScriptValue constructQFile(QScriptContext*context,QScriptEngine*engine);
  2729. void setQFileProperties(QScriptValue value,QScriptEngine*engine);
  2730. QScriptValue QFile_remove(QScriptContext*context,QScriptEngine*engine);
  2731. void setQIODeviceProperties(QScriptValue value,QScriptEngine*engine);
  2732. QScriptValue QIODevice_open(QScriptContext*context,QScriptEngine*engine);
  2733. QScriptValue QIODevice_close(QScriptContext*context,QScriptEngine*engine);
  2734. QScriptValue QIODevice_readToString(QScriptContext*context,
  2735. QScriptEngine*engine);
  2736. QScriptValue QIODevice_putChar(QScriptContext*context,QScriptEngine*engine);
  2737. QScriptValue QIODevice_writeString(QScriptContext*context,QScriptEngine*engine);
  2738. QScriptValue QIODevice_writeBytes(QScriptContext*context,QScriptEngine*engine);
  2739. QScriptValue QIODevice_readBytes(QScriptContext*context,QScriptEngine*engine);
  2740. QScriptValue QIODevice_peek(QScriptContext*context,QScriptEngine*engine);
  2741. QScriptValue QIODevice_read(QScriptContext*context,QScriptEngine*engine);
  2742. /*:81*//*92:*/
  2743. #line 2358 "./typica.w"
  2744. QScriptValue constructQProcess(QScriptContext*context,QScriptEngine*engine);
  2745. void setQProcessProperties(QScriptValue value,QScriptEngine*engine);
  2746. QScriptValue QProcess_execute(QScriptContext*context,QScriptEngine*engine);
  2747. QScriptValue QProcess_startDetached(QScriptContext*context,QScriptEngine*engine);
  2748. QScriptValue QProcess_setWorkingDirectory(QScriptContext*context,QScriptEngine*engine);
  2749. QScriptValue QProcess_start(QScriptContext*context,QScriptEngine*engine);
  2750. /*:92*//*100:*/
  2751. #line 2476 "./typica.w"
  2752. QScriptValue QByteArray_toScriptValue(QScriptEngine*engine,const QByteArray&bytes);
  2753. void QByteArray_fromScriptValue(const QScriptValue&value,QByteArray&bytes);
  2754. QScriptValue constructQByteArray(QScriptContext*context,QScriptEngine*engine);
  2755. void setQByteArrayProperties(QScriptValue value,QScriptEngine*engine);
  2756. QScriptValue QByteArray_fromHex(QScriptContext*context,QScriptEngine*engine);
  2757. QScriptValue QByteArray_getAt(QScriptContext*context,QScriptEngine*engine);
  2758. QScriptValue QByteArray_setAt(QScriptContext*context,QScriptEngine*engine);
  2759. QScriptValue QByteArray_appendBytes(QScriptContext*context,QScriptEngine*engine);
  2760. QScriptValue QByteArray_appendString(QScriptContext*context,QScriptEngine*engine);
  2761. QScriptValue QByteArray_size(QScriptContext*context,QScriptEngine*engine);
  2762. QScriptValue QByteArray_left(QScriptContext*context,QScriptEngine*engine);
  2763. QScriptValue QByteArray_right(QScriptContext*context,QScriptEngine*engine);
  2764. QScriptValue QByteArray_mid(QScriptContext*context,QScriptEngine*engine);
  2765. QScriptValue QByteArray_chop(QScriptContext*context,QScriptEngine*engine);
  2766. QScriptValue QByteArray_remove(QScriptContext*context,QScriptEngine*engine);
  2767. QScriptValue QByteArray_toInt8(QScriptContext*context,QScriptEngine*engine);
  2768. QScriptValue QByteArray_toInt16(QScriptContext*context,QScriptEngine*engine);
  2769. QScriptValue QByteArray_toInt32(QScriptContext*context,QScriptEngine*engine);
  2770. QScriptValue QByteArray_toFloat(QScriptContext*context,QScriptEngine*engine);
  2771. QScriptValue QByteArray_toDouble(QScriptContext*context,QScriptEngine*engine);
  2772. /*:100*//*113:*/
  2773. #line 2750 "./typica.w"
  2774. QScriptValue bytesFromInt8(QScriptContext*context,QScriptEngine*engine);
  2775. QScriptValue bytesFromInt16(QScriptContext*context,QScriptEngine*engine);
  2776. QScriptValue bytesFromInt32(QScriptContext*context,QScriptEngine*engine);
  2777. QScriptValue bytesFromFloat(QScriptContext*context,QScriptEngine*engine);
  2778. QScriptValue bytesFromDouble(QScriptContext*context,QScriptEngine*engine);
  2779. /*:113*//*116:*/
  2780. #line 2855 "./typica.w"
  2781. QScriptValue constructQBuffer(QScriptContext*context,QScriptEngine*engine);
  2782. void setQBufferProperties(QScriptValue value,QScriptEngine*engine);
  2783. QScriptValue QBuffer_setData(QScriptContext*context,QScriptEngine*engine);
  2784. /*:116*//*119:*/
  2785. #line 2900 "./typica.w"
  2786. QScriptValue constructXQuery(QScriptContext*context,QScriptEngine*engine);
  2787. QScriptValue XQuery_bind(QScriptContext*context,QScriptEngine*engine);
  2788. QScriptValue XQuery_exec(QScriptContext*context,QScriptEngine*engine);
  2789. QScriptValue XQuery_setQuery(QScriptContext*context,QScriptEngine*engine);
  2790. QScriptValue XQuery_invalidate(QScriptContext*context,QScriptEngine*engine);
  2791. void setXQueryProperties(QScriptValue value,QScriptEngine*engine);
  2792. /*:119*//*125:*/
  2793. #line 2982 "./typica.w"
  2794. QScriptValue constructXmlWriter(QScriptContext*context,QScriptEngine*engine);
  2795. QScriptValue XmlWriter_setDevice(QScriptContext*context,
  2796. QScriptEngine*engine);
  2797. QScriptValue XmlWriter_writeAttribute(QScriptContext*context,
  2798. QScriptEngine*engine);
  2799. QScriptValue XmlWriter_writeCDATA(QScriptContext*context,
  2800. QScriptEngine*engine);
  2801. QScriptValue XmlWriter_writeCharacters(QScriptContext*context,
  2802. QScriptEngine*engine);
  2803. QScriptValue XmlWriter_writeDTD(QScriptContext*context,QScriptEngine*engine);
  2804. QScriptValue XmlWriter_writeEmptyElement(QScriptContext*context,
  2805. QScriptEngine*engine);
  2806. QScriptValue XmlWriter_writeEndDocument(QScriptContext*context,
  2807. QScriptEngine*engine);
  2808. QScriptValue XmlWriter_writeEndElement(QScriptContext*context,
  2809. QScriptEngine*engine);
  2810. QScriptValue XmlWriter_writeEntityReference(QScriptContext*context,
  2811. QScriptEngine*engine);
  2812. QScriptValue XmlWriter_writeProcessingInstruction(QScriptContext*context,
  2813. QScriptEngine*engine);
  2814. QScriptValue XmlWriter_writeStartDocument(QScriptContext*context,
  2815. QScriptEngine*engine);
  2816. QScriptValue XmlWriter_writeStartElement(QScriptContext*context,
  2817. QScriptEngine*engine);
  2818. QScriptValue XmlWriter_writeTextElement(QScriptContext*context,
  2819. QScriptEngine*engine);
  2820. void setXmlWriterProperties(QScriptValue value,QScriptEngine*engine);
  2821. /*:125*//*134:*/
  2822. #line 3200 "./typica.w"
  2823. QScriptValue constructXmlReader(QScriptContext*context,QScriptEngine*engine);
  2824. QScriptValue XmlReader_atEnd(QScriptContext*context,QScriptEngine*engine);
  2825. QScriptValue XmlReader_attribute(QScriptContext*context,
  2826. QScriptEngine*engine);
  2827. QScriptValue XmlReader_hasAttribute(QScriptContext*context,
  2828. QScriptEngine*engine);
  2829. QScriptValue XmlReader_isDTD(QScriptContext*context,QScriptEngine*engine);
  2830. QScriptValue XmlReader_isStartElement(QScriptContext*context,
  2831. QScriptEngine*engine);
  2832. QScriptValue XmlReader_name(QScriptContext*context,QScriptEngine*engine);
  2833. QScriptValue XmlReader_readElementText(QScriptContext*context,
  2834. QScriptEngine*engine);
  2835. QScriptValue XmlReader_readNext(QScriptContext*context,QScriptEngine*engine);
  2836. QScriptValue XmlReader_text(QScriptContext*context,QScriptEngine*engine);
  2837. void setXmlReaderProperties(QScriptValue value,QScriptEngine*engine);
  2838. /*:134*//*141:*/
  2839. #line 3335 "./typica.w"
  2840. QScriptValue QSettings_value(QScriptContext*context,QScriptEngine*engine);
  2841. QScriptValue QSettings_setValue(QScriptContext*context,QScriptEngine*engine);
  2842. void setQSettingsProperties(QScriptValue value,QScriptEngine*engine);
  2843. /*:141*//*145:*/
  2844. #line 3417 "./typica.w"
  2845. QScriptValue constructQLCDNumber(QScriptContext*context,
  2846. QScriptEngine*engine);
  2847. void setQLCDNumberProperties(QScriptValue value,QScriptEngine*engine);
  2848. /*:145*//*148:*/
  2849. #line 3455 "./typica.w"
  2850. QScriptValue constructQTime(QScriptContext*context,QScriptEngine*engine);
  2851. QScriptValue QTime_addMSecs(QScriptContext*context,QScriptEngine*engine);
  2852. QScriptValue QTime_addSecs(QScriptContext*context,QScriptEngine*engine);
  2853. QScriptValue QTime_elapsed(QScriptContext*context,QScriptEngine*engine);
  2854. QScriptValue QTime_hour(QScriptContext*context,QScriptEngine*engine);
  2855. QScriptValue QTime_isNull(QScriptContext*context,QScriptEngine*engine);
  2856. QScriptValue QTime_isValid(QScriptContext*context,QScriptEngine*engine);
  2857. QScriptValue QTime_minute(QScriptContext*context,QScriptEngine*engine);
  2858. QScriptValue QTime_msec(QScriptContext*context,QScriptEngine*engine);
  2859. QScriptValue QTime_msecsTo(QScriptContext*context,QScriptEngine*engine);
  2860. QScriptValue QTime_restart(QScriptContext*context,QScriptEngine*engine);
  2861. QScriptValue QTime_second(QScriptContext*context,QScriptEngine*engine);
  2862. QScriptValue QTime_secsTo(QScriptContext*context,QScriptEngine*engine);
  2863. QScriptValue QTime_setHMS(QScriptContext*context,QScriptEngine*engine);
  2864. QScriptValue QTime_start(QScriptContext*context,QScriptEngine*engine);
  2865. QScriptValue QTime_toString(QScriptContext*context,QScriptEngine*engine);
  2866. QScriptValue QTime_currentTime(QScriptContext*context,QScriptEngine*engine);
  2867. QScriptValue QTime_fromString(QScriptContext*context,QScriptEngine*engine);
  2868. QScriptValue QTime_valueOf(QScriptContext*context,QScriptEngine*engine);
  2869. void setQTimeProperties(QScriptValue value,QScriptEngine*engine);
  2870. /*:148*//*164:*/
  2871. #line 3933 "./typica.w"
  2872. void setQAbstractScrollAreaProperties(QScriptValue value,
  2873. QScriptEngine*engine);
  2874. /*:164*//*166:*/
  2875. #line 3948 "./typica.w"
  2876. void setQAbstractItemViewProperties(QScriptValue value,QScriptEngine*engine);
  2877. /*:166*//*168:*/
  2878. #line 3961 "./typica.w"
  2879. void setQGraphicsViewProperties(QScriptValue value,QScriptEngine*engine);
  2880. void setQTableViewProperties(QScriptValue value,QScriptEngine*engine);
  2881. /*:168*//*170:*/
  2882. #line 3985 "./typica.w"
  2883. void setQAbstractButtonProperties(QScriptValue value,QScriptEngine*engine);
  2884. void setQPushButtonProperties(QScriptValue value,QScriptEngine*engine);
  2885. QScriptValue constructQPushButton(QScriptContext*context,
  2886. QScriptEngine*engine);
  2887. /*:170*//*177:*/
  2888. #line 4084 "./typica.w"
  2889. void setQSqlQueryProperties(QScriptValue value,QScriptEngine*engine);
  2890. QScriptValue constructQSqlQuery(QScriptContext*context,QScriptEngine*engine);
  2891. QScriptValue QSqlQuery_bind(QScriptContext*context,QScriptEngine*engine);
  2892. QScriptValue QSqlQuery_bindDeviceData(QScriptContext*context,
  2893. QScriptEngine*engine);
  2894. QScriptValue QSqlQuery_bindFileData(QScriptContext*context,
  2895. QScriptEngine*engine);
  2896. QScriptValue QSqlQuery_exec(QScriptContext*context,
  2897. QScriptEngine*engine);
  2898. QScriptValue QSqlQuery_executedQuery(QScriptContext*context,
  2899. QScriptEngine*engine);
  2900. QScriptValue QSqlQuery_invalidate(QScriptContext*context,QScriptEngine*engine);
  2901. QScriptValue QSqlQuery_next(QScriptContext*context,QScriptEngine*engine);
  2902. QScriptValue QSqlQuery_prepare(QScriptContext*context,QScriptEngine*engine);
  2903. QScriptValue QSqlQuery_value(QScriptContext*context,QScriptEngine*engine);
  2904. /*:177*//*184:*/
  2905. #line 4255 "./typica.w"
  2906. QScriptValue baseName(QScriptContext*context,QScriptEngine*engine);
  2907. QScriptValue dir(QScriptContext*context,QScriptEngine*engine);
  2908. QScriptValue sqlToArray(QScriptContext*context,QScriptEngine*engine);
  2909. QScriptValue setFont(QScriptContext*context,QScriptEngine*engine);
  2910. QScriptValue annotationFromRecord(QScriptContext*context,
  2911. QScriptEngine*engine);
  2912. QScriptValue setTabOrder(QScriptContext*context,QScriptEngine*engine);
  2913. QScriptValue saveFileFromDatabase(QScriptContext*context,QScriptEngine*engine);
  2914. QScriptValue scriptTr(QScriptContext*context,QScriptEngine*engine);
  2915. /*:184*//*197:*/
  2916. #line 4602 "./typica.w"
  2917. QScriptValue createWindow(QScriptContext*context,QScriptEngine*engine);
  2918. QScriptValue createReport(QScriptContext*context,QScriptEngine*engine);
  2919. void addLayoutToWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  2920. QStack<QLayout*> *layoutStack);
  2921. void addLayoutToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2922. QStack<QLayout*> *layoutStack);
  2923. void addSplitterToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2924. QStack<QLayout*> *layoutStack);
  2925. void addSplitterToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2926. QStack<QLayout*> *layoutStack);
  2927. void populateGridLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2928. QStack<QLayout*> *layoutStack);
  2929. void populateBoxLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2930. QStack<QLayout*> *layoutStack);
  2931. void populateSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2932. QStack<QLayout*> *layoutStack);
  2933. void populateWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  2934. QStack<QLayout*> *layoutStack);
  2935. void populateStackedLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2936. QStack<QLayout*> *layoutStack);
  2937. void addTemperatureDisplayToSplitter(QDomElement element,
  2938. QStack<QWidget*> *widgetStack,
  2939. QStack<QLayout*> *layoutStack);
  2940. void addTemperatureDisplayToLayout(QDomElement element,
  2941. QStack<QWidget*> *widgetStack,
  2942. QStack<QLayout*> *layoutStack);
  2943. void addTimerDisplayToSplitter(QDomElement element,
  2944. QStack<QWidget*> *widgetStack,
  2945. QStack<QLayout*> *layoutStack);
  2946. void addTimerDisplayToLayout(QDomElement element,
  2947. QStack<QWidget*> *widgetStack,
  2948. QStack<QLayout*> *layoutStack);
  2949. void addDecorationToSplitter(QDomElement element,
  2950. QStack<QWidget*> *widgetStack,
  2951. QStack<QLayout*> *layoutStack);
  2952. void addDecorationToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2953. QStack<QLayout*> *layoutStack);
  2954. void addWidgetToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2955. QStack<QLayout*> *layoutStack);
  2956. void addButtonToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2957. QStack<QLayout*> *layoutStack);
  2958. void addZoomLogToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2959. QStack<QLayout*> *layoutStack);
  2960. void addGraphToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  2961. QStack<QLayout*> *layoutStack);
  2962. void addSqlDropToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2963. QStack<QLayout*> *layoutStack);
  2964. void addSaltToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2965. QStack<QLayout*> *layoutStack);
  2966. void addLineToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2967. QStack<QLayout*> *layoutStack);
  2968. void addTextToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2969. QStack<QLayout*> *layoutStack);
  2970. void addSqlQueryViewToLayout(QDomElement element,
  2971. QStack<QWidget*> *widgetStack,
  2972. QStack<QLayout*> *layoutStack);
  2973. void addCalendarToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2974. QStack<QLayout*> *layoutStack);
  2975. void addSpinBoxToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2976. QStack<QLayout*> *layoutStack);
  2977. void addTimeEditToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  2978. QStack<QLayout*> *layoutStack);
  2979. /*:197*//*226:*/
  2980. #line 5083 "./typica.w"
  2981. QScriptValue constructQTabBar(QScriptContext*context,QScriptEngine*engine);
  2982. void setQTabBarProperties(QScriptValue value,QScriptEngine*engine);
  2983. QScriptValue QTabBar_addTab(QScriptContext*context,QScriptEngine*engine);
  2984. /*:226*//*267:*/
  2985. #line 6386 "./typica.w"
  2986. void setQDateEditProperties(QScriptValue value,QScriptEngine*engine);
  2987. void setQDateTimeEditProperties(QScriptValue value,QScriptEngine*engine);
  2988. QScriptValue QDateTimeEdit_setDate(QScriptContext*context,
  2989. QScriptEngine*engine);
  2990. QScriptValue QDateTimeEdit_day(QScriptContext*context,QScriptEngine*engine);
  2991. QScriptValue QDateTimeEdit_month(QScriptContext*context,
  2992. QScriptEngine*engine);
  2993. QScriptValue QDateTimeEdit_year(QScriptContext*context,QScriptEngine*engine);
  2994. QScriptValue QDateTimeEdit_setToCurrentTime(QScriptContext*context,QScriptEngine*engine);
  2995. /*:267*//*270:*/
  2996. #line 6431 "./typica.w"
  2997. void setQTimeEditProperties(QScriptValue value,QScriptEngine*engine);
  2998. /*:270*//*271:*/
  2999. #line 6439 "./typica.w"
  3000. QScriptValue findChildObject(QScriptContext*context,QScriptEngine*engine);
  3001. /*:271*//*275:*/
  3002. #line 6586 "./typica.w"
  3003. void setSaltTableProperties(QScriptValue value,QScriptEngine*engine);
  3004. QScriptValue SaltTable_bindableColumnArray(QScriptContext*context,
  3005. QScriptEngine*engine);
  3006. QScriptValue SaltTable_bindableQuotedColumnArray(QScriptContext*context,
  3007. QScriptEngine*engine);
  3008. QScriptValue SaltTable_columnSum(QScriptContext*context,
  3009. QScriptEngine*engine);
  3010. QScriptValue SaltTable_columnArray(QScriptContext*context,
  3011. QScriptEngine*engine);
  3012. QScriptValue SaltTable_data(QScriptContext*context,QScriptEngine*engine);
  3013. QScriptValue SaltTable_model(QScriptContext*context,QScriptEngine*engine);
  3014. QScriptValue SaltTable_quotedColumnArray(QScriptContext*context,
  3015. QScriptEngine*engine);
  3016. QScriptValue SaltTable_setData(QScriptContext*context,QScriptEngine*engine);
  3017. QScriptValue SaltTable_clear(QScriptContext*context,QScriptEngine*engine);
  3018. QScriptValue SaltTable_removeRow(QScriptContext*context,QScriptEngine*engine);
  3019. QScriptValue SaltTable_findData(QScriptContext*context,QScriptEngine*engine);
  3020. /*:275*//*285:*/
  3021. #line 6802 "./typica.w"
  3022. void setSqlComboBoxProperties(QScriptValue value,QScriptEngine*engine);
  3023. void setQComboBoxProperties(QScriptValue value,QScriptEngine*engine);
  3024. QScriptValue QComboBox_currentData(QScriptContext*context,
  3025. QScriptEngine*engine);
  3026. QScriptValue QComboBox_addItem(QScriptContext*context,QScriptEngine*engine);
  3027. QScriptValue QComboBox_setModel(QScriptContext*context,QScriptEngine*engine);
  3028. QScriptValue QComboBox_findText(QScriptContext*context,QScriptEngine*engine);
  3029. QScriptValue QComboBox_findData(QScriptContext*context,QScriptEngine*engine);
  3030. /*:285*//*297:*/
  3031. #line 379 "./units.w"
  3032. QScriptValue Units_convertTemperature(QScriptContext*context,QScriptEngine*engine);
  3033. QScriptValue Units_convertRelativeTemperature(QScriptContext*context,
  3034. QScriptEngine*engine);
  3035. QScriptValue Units_isTemperatureUnit(QScriptContext*context,QScriptEngine*engine);
  3036. QScriptValue Units_convertWeight(QScriptContext*context,QScriptEngine*engine);
  3037. QScriptValue Units_isWeightUnit(QScriptContext*context,QScriptEngine*engine);
  3038. /*:297*//*301:*/
  3039. #line 443 "./units.w"
  3040. QScriptValue Unit_toScriptValue(QScriptEngine*engine,const Units::Unit&value);
  3041. void Unit_fromScriptValue(const QScriptValue&sv,Units::Unit&value);
  3042. /*:301*//*310:*/
  3043. #line 133 "./measurement.w"
  3044. QScriptValue constructMeasurement(QScriptContext*context,QScriptEngine*engine);
  3045. void setMeasurementProperties(QScriptValue value,QScriptEngine*engine);
  3046. QScriptValue Measurement_toScriptValue(QScriptEngine*engine,const Measurement&measurement);
  3047. void Measurement_fromScriptValue(const QScriptValue&value,Measurement&measurement);
  3048. /*:310*//*330:*/
  3049. #line 7437 "./typica.w"
  3050. QScriptValue constructDAQ(QScriptContext*context,QScriptEngine*engine);
  3051. QScriptValue DAQ_newChannel(QScriptContext*context,QScriptEngine*engine);
  3052. void setDAQProperties(QScriptValue value,QScriptEngine*engine);
  3053. /*:330*//*339:*/
  3054. #line 7642 "./typica.w"
  3055. QScriptValue constructFakeDAQ(QScriptContext*context,QScriptEngine*engine);
  3056. QScriptValue FakeDAQ_newChannel(QScriptContext*context,QScriptEngine*engine);
  3057. void setFakeDAQProperties(QScriptValue value,QScriptEngine*engine);
  3058. /*:339*//*344:*/
  3059. #line 7743 "./typica.w"
  3060. void setChannelProperties(QScriptValue value,QScriptEngine*engine);
  3061. /*:344*//*350:*/
  3062. #line 7925 "./typica.w"
  3063. QScriptValue constructLinearCalibrator(QScriptContext*context,
  3064. QScriptEngine*engine);
  3065. void setLinearCalibratorProperties(QScriptValue value,QScriptEngine*engine);
  3066. /*:350*//*355:*/
  3067. #line 8065 "./typica.w"
  3068. QScriptValue constructLinearSplineInterpolator(QScriptContext*context,QScriptEngine*engine);
  3069. void setLinearSplineInterpolatorProperties(QScriptValue value,QScriptEngine*engine);
  3070. /*:355*//*365:*/
  3071. #line 8270 "./typica.w"
  3072. QScriptValue constructTemperatureDisplay(QScriptContext*context,
  3073. QScriptEngine*engine);
  3074. void setTemperatureDisplayProperties(QScriptValue value,QScriptEngine*engine);
  3075. QScriptValue TemperatureDisplay_setDisplayUnits(QScriptContext*context,
  3076. QScriptEngine*engine);
  3077. /*:365*//*373:*/
  3078. #line 8429 "./typica.w"
  3079. QScriptValue constructMeasurementTimeOffset(QScriptContext*context,
  3080. QScriptEngine*engine);
  3081. void setMeasurementTimeOffsetProperties(QScriptValue value,
  3082. QScriptEngine*engine);
  3083. /*:373*//*378:*/
  3084. #line 8552 "./typica.w"
  3085. QScriptValue constructThresholdDetector(QScriptContext*context,QScriptEngine*engine);
  3086. void setThresholdDetectorProperties(QScriptValue value,QScriptEngine*engine);
  3087. /*:378*//*383:*/
  3088. #line 8650 "./typica.w"
  3089. QScriptValue constructZeroEmitter(QScriptContext*context,
  3090. QScriptEngine*engine);
  3091. void setZeroEmitterProperties(QScriptValue value,QScriptEngine*engine);
  3092. /*:383*//*388:*/
  3093. #line 8729 "./typica.w"
  3094. QScriptValue constructMeasurementAdapter(QScriptContext*context,
  3095. QScriptEngine*engine);
  3096. void setMeasurementAdapterProperties(QScriptValue value,QScriptEngine*engine);
  3097. /*:388*//*405:*/
  3098. #line 9193 "./typica.w"
  3099. void setGraphViewProperties(QScriptValue value,QScriptEngine*engine);
  3100. QScriptValue constructGraphView(QScriptContext*context,QScriptEngine*engine);
  3101. /*:405*//*428:*/
  3102. #line 9832 "./typica.w"
  3103. void setZoomLogProperties(QScriptValue value,QScriptEngine*engine);
  3104. QScriptValue constructZoomLog(QScriptContext*context,QScriptEngine*engine);
  3105. QScriptValue ZoomLog_saveXML(QScriptContext*context,QScriptEngine*engine);
  3106. QScriptValue ZoomLog_saveCSV(QScriptContext*context,QScriptEngine*engine);
  3107. QScriptValue ZoomLog_saveState(QScriptContext*context,QScriptEngine*engine);
  3108. QScriptValue ZoomLog_restoreState(QScriptContext*context,
  3109. QScriptEngine*engine);
  3110. QScriptValue ZoomLog_lastTime(QScriptContext*context,QScriptEngine*engine);
  3111. QScriptValue ZoomLog_saveTemporary(QScriptContext*context,
  3112. QScriptEngine*engnie);
  3113. QScriptValue ZoomLog_setDisplayUnits(QScriptContext*context,
  3114. QScriptEngine*engine);
  3115. /*:428*//*466:*/
  3116. #line 10789 "./typica.w"
  3117. QScriptValue constructAnnotationButton(QScriptContext*context,
  3118. QScriptEngine*engine);
  3119. void setAnnotationButtonProperties(QScriptValue value,QScriptEngine*engine);
  3120. /*:466*//*474:*/
  3121. #line 10929 "./typica.w"
  3122. QScriptValue constructAnnotationSpinBox(QScriptContext*context,
  3123. QScriptEngine*engine);
  3124. void setAnnotationSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  3125. void setQDoubleSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  3126. void setQAbstractSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
  3127. /*:474*//*495:*/
  3128. #line 11355 "./typica.w"
  3129. QScriptValue constructTimerDisplay(QScriptContext*context,
  3130. QScriptEngine*engine);
  3131. void setTimerDisplayProperties(QScriptValue value,QScriptEngine*engine);
  3132. QScriptValue TimerDisplay_setTimerMode(QScriptContext*context,QScriptEngine*engine);
  3133. /*:495*//*523:*/
  3134. #line 11880 "./typica.w"
  3135. void setWidgetDecoratorProperties(QScriptValue value,QScriptEngine*engine);
  3136. QScriptValue constructWidgetDecorator(QScriptContext*context,
  3137. QScriptEngine*engine);
  3138. /*:523*//*536:*/
  3139. #line 12163 "./typica.w"
  3140. QScriptValue constructLogEditWindow(QScriptContext*context,
  3141. QScriptEngine*engine);
  3142. /*:536*//*555:*/
  3143. #line 12690 "./typica.w"
  3144. QScriptValue constructXMLInput(QScriptContext*context,QScriptEngine*engine);
  3145. QScriptValue XMLInput_input(QScriptContext*context,QScriptEngine*engine);
  3146. /*:555*//*574:*/
  3147. #line 204 "./webview.w"
  3148. QScriptValue constructWebView(QScriptContext*context,QScriptEngine*engine);
  3149. void setQWebViewProperties(QScriptValue value,QScriptEngine*engine);
  3150. void addWebViewToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  3151. QStack<QLayout*> *layoutStack);
  3152. /*:574*//*577:*/
  3153. #line 234 "./webview.w"
  3154. QScriptValue QWebElement_toScriptValue(QScriptEngine*engine,const QWebElement&element);
  3155. void QWebElement_fromScriptValue(const QScriptValue&value,QWebElement&element);
  3156. /*:577*//*581:*/
  3157. #line 292 "./webview.w"
  3158. QScriptValue constructWebElement(QScriptContext*context,
  3159. QScriptEngine*engine);
  3160. /*:581*//*593:*/
  3161. #line 67 "./printerselector.w"
  3162. QScriptValue constructPrinterSelector(QScriptContext*context,
  3163. QScriptEngine*engine);
  3164. void addPrinterSelectorToLayout(QDomElement element,
  3165. QStack<QWidget*> *widgetStack,
  3166. QStack<QLayout*> *layoutStack);
  3167. /*:593*//*660:*/
  3168. #line 14073 "./typica.w"
  3169. void setSqlQueryViewProperties(QScriptValue value,QScriptEngine*engine);
  3170. QScriptValue constructSqlQueryView(QScriptContext*context,
  3171. QScriptEngine*engine);
  3172. QScriptValue SqlQueryView_setQuery(QScriptContext*context,
  3173. QScriptEngine*engine);
  3174. QScriptValue SqlQueryView_setHeaderData(QScriptContext*context,
  3175. QScriptEngine*engine);
  3176. /*:660*//*670:*/
  3177. #line 14312 "./typica.w"
  3178. void addReportToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  3179. QStack<QLayout*> *layoutStack);
  3180. /*:670*//*686:*/
  3181. #line 14597 "./typica.w"
  3182. void setQTextEditProperties(QScriptValue value,QScriptEngine*engine);
  3183. QScriptValue QTextEdit_print(QScriptContext*context,QScriptEngine*engine);
  3184. /*:686*//*714:*/
  3185. #line 480 "./daterangeselector.w"
  3186. void addDateRangeToLayout(QDomElement element,
  3187. QStack<QWidget*> *widgetStack,
  3188. QStack<QLayout*> *layoutStack);
  3189. /*:714*//*723:*/
  3190. #line 14796 "./typica.w"
  3191. void addFormArrayToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  3192. QStack<QLayout*> *layoutStack);
  3193. /*:723*//*744:*/
  3194. #line 15380 "./typica.w"
  3195. void addScaleControlToLayout(QDomElement element,
  3196. QStack<QWidget*> *widgetStack,
  3197. QStack<QLayout*> *layoutStack);
  3198. void addIntensityControlToLayout(QDomElement element,
  3199. QStack<QWidget*> *widgetStack,
  3200. QStack<QLayout*> *layoutStack);
  3201. /*:744*//*770:*/
  3202. #line 15966 "./typica.w"
  3203. QScriptValue constructDeviceTreeModel(QScriptContext*context,
  3204. QScriptEngine*engine);
  3205. void setDeviceTreeModelProperties(QScriptValue value,QScriptEngine*engine);
  3206. void setQAbstractItemModelProperties(QScriptValue value,QScriptEngine*engine);
  3207. QScriptValue DeviceTreeModel_referenceElement(QScriptContext*context,
  3208. QScriptEngine*engine);
  3209. QScriptValue QAbstractItemModel_data(QScriptContext*context,QScriptEngine*engine);
  3210. QScriptValue QAbstractItemModel_index(QScriptContext*context,QScriptEngine*engine);
  3211. QScriptValue QAbstractItemModel_rowCount(QScriptContext*context,QScriptEngine*engine);
  3212. QScriptValue QAbstractItemModel_hasChildren(QScriptContext*context,QScriptEngine*engine);
  3213. /*:770*//*776:*/
  3214. #line 16108 "./typica.w"
  3215. QScriptValue QModelIndex_toScriptValue(QScriptEngine*engine,const QModelIndex&index);
  3216. void QModelIndex_fromScriptValue(const QScriptValue&value,QModelIndex&index);
  3217. /*:776*//*792:*/
  3218. #line 16406 "./typica.w"
  3219. QScriptValue constructDeviceConfigurationWindow(QScriptContext*context,
  3220. QScriptEngine*engine);
  3221. /*:792*//*863:*/
  3222. #line 44 "./settings.w"
  3223. QScriptValue constructSettingsWindow(QScriptContext*context,QScriptEngine*engine);
  3224. /*:863*//*891:*/
  3225. #line 19049 "./typica.w"
  3226. QScriptValue constructModbusRTUDevice(QScriptContext*context,QScriptEngine*engine);
  3227. QScriptValue ModbusRTUDevice_pVChannel(QScriptContext*context,QScriptEngine*engine);
  3228. QScriptValue ModbusRTUDevice_sVChannel(QScriptContext*context,QScriptEngine*engine);
  3229. void setModbusRTUDeviceProperties(QScriptValue value,QScriptEngine*engine);
  3230. /*:891*//*909:*/
  3231. #line 698 "./modbus.w"
  3232. QScriptValue constructModbusNG(QScriptContext*context,QScriptEngine*engine);
  3233. void setModbusNGProperties(QScriptValue value,QScriptEngine*engine);
  3234. QScriptValue ModbusNG_getChannel(QScriptContext*context,QScriptEngine*engine);
  3235. /*:909*//*923:*/
  3236. #line 345 "./unsupportedserial.w"
  3237. QScriptValue createDevice(QScriptContext*context,QScriptEngine*engine);
  3238. /*:923*//*929:*/
  3239. #line 425 "./unsupportedserial.w"
  3240. QScriptValue JavaScriptDevice_getChannel(QScriptContext*context,QScriptEngine*engine);
  3241. /*:929*//*935:*/
  3242. #line 617 "./unsupportedserial.w"
  3243. QScriptValue getMeasurementTimestamp(QScriptContext*context,QScriptEngine*engine);
  3244. /*:935*//*939:*/
  3245. #line 651 "./unsupportedserial.w"
  3246. QScriptValue constructSerialPort(QScriptContext*context,QScriptEngine*engine);
  3247. void setSerialPortProperties(QScriptValue value,QScriptEngine*engine);
  3248. QScriptValue SerialPort_flush(QScriptContext*context,QScriptEngine*engine);
  3249. /*:939*//*963:*/
  3250. #line 457 "./phidgets.w"
  3251. QScriptValue constructPhidgetsTemperatureSensor(QScriptContext*context,QScriptEngine*engine);
  3252. QScriptValue Phidgets_getChannel(QScriptContext*context,QScriptEngine*engine);
  3253. /*:963*//*995:*/
  3254. #line 805 "./phidget22.w"
  3255. QScriptValue constructPhidget22(QScriptContext*context,QScriptEngine*engine);
  3256. QScriptValue Phidget22_getChannel(QScriptContext*context,QScriptEngine*engine);
  3257. /*:995*//*1027:*/
  3258. #line 138 "./rate.w"
  3259. QScriptValue constructRateOfChange(QScriptContext*context,QScriptEngine*engine);
  3260. void setRateOfChangeProperties(QScriptValue value,QScriptEngine*engine);
  3261. /*:1027*//*1041:*/
  3262. #line 129 "./mergeseries.w"
  3263. QScriptValue constructDifferenceSeries(QScriptContext*context,
  3264. QScriptEngine*engine);
  3265. QScriptValue constructMeanSeries(QScriptContext*context,
  3266. QScriptEngine*engine);
  3267. /*:1041*//*1066:*/
  3268. #line 597 "./dataqsdk.w"
  3269. QScriptValue constructDataqSdkDevice(QScriptContext*context,QScriptEngine*engine);
  3270. QScriptValue DataqSdkDevice_newChannel(QScriptContext*context,QScriptEngine*engine);
  3271. void setDataqSdkDeviceProperties(QScriptValue value,QScriptEngine*engine);
  3272. /*:1066*//*1093:*/
  3273. #line 67 "./scales.w"
  3274. QScriptValue constructDragLabel(QScriptContext*context,QScriptEngine*engine);
  3275. void setDragLabelProperties(QScriptValue value,QScriptEngine*engine);
  3276. /*:1093*//*1101:*/
  3277. #line 259 "./scales.w"
  3278. QScriptValue constructSerialScale(QScriptContext*context,QScriptEngine*engine);
  3279. void setSerialScaleProperties(QScriptValue value,QScriptEngine*engine);
  3280. /*:1101*//*1104:*/
  3281. #line 284 "./scales.w"
  3282. QScriptValue BaudRateType_toScriptValue(QScriptEngine*engine,const BaudRateType&value);
  3283. void BaudRateType_fromScriptValue(const QScriptValue&sv,BaudRateType&value);
  3284. QScriptValue DataBitsType_toScriptValue(QScriptEngine*engine,const DataBitsType&value);
  3285. void DataBitsType_fromScriptValue(const QScriptValue&sv,DataBitsType&value);
  3286. QScriptValue ParityType_toScriptValue(QScriptEngine*engine,const ParityType&value);
  3287. void ParityType_fromScriptValue(const QScriptValue&sv,ParityType&value);
  3288. QScriptValue StopBitsType_toScriptValue(QScriptEngine*engine,const StopBitsType&value);
  3289. void StopBitsType_fromScriptValue(const QScriptValue&sv,StopBitsType&value);
  3290. QScriptValue FlowType_toScriptValue(QScriptEngine*engine,const FlowType&value);
  3291. void FlowType_fromScriptValue(const QScriptValue&sv,FlowType&value);
  3292. /*:1104*//*1129:*/
  3293. #line 265 "./valueannotation.w"
  3294. QScriptValue constructValueAnnotation(QScriptContext*context,QScriptEngine*engine);
  3295. void setValueAnnotationProperties(QScriptValue value,QScriptEngine*engine);
  3296. /*:1129*//*1140:*/
  3297. #line 194 "./thresholdannotation.w"
  3298. QScriptValue constructAnnotator(QScriptContext*context,
  3299. QScriptEngine*engine);
  3300. void setAnnotatorProperties(QScriptValue value,QScriptEngine*engine);
  3301. /*:1140*//*1153:*/
  3302. #line 151 "./user.w"
  3303. QScriptValue constructLoginDialog(QScriptContext*context,QScriptEngine*engine);
  3304. /*:1153*//*1163:*/
  3305. #line 339 "./user.w"
  3306. QScriptValue constructNewTypicaUser(QScriptContext*context,QScriptEngine*engine);
  3307. /*:1163*/
  3308. #line 530 "./typica.w"
  3309. /*640:*/
  3310. #line 13715 "./typica.w"
  3311. void messageFileOutput(QtMsgType type,const char*msg);
  3312. /*:640*/
  3313. #line 531 "./typica.w"
  3314. /*4:*/
  3315. #line 540 "./typica.w"
  3316. /*784:*/
  3317. #line 16229 "./typica.w"
  3318. NodeInserter::NodeInserter(const QString&title,const QString&name,
  3319. const QString&driver,QObject*parent):
  3320. QAction(title,parent),defaultNodeName(name),driverString(driver)
  3321. {
  3322. connect(this,SIGNAL(triggered()),this,SLOT(onTriggered()));
  3323. }
  3324. void NodeInserter::onTriggered()
  3325. {
  3326. emit triggered(defaultNodeName,driverString);
  3327. }
  3328. /*:784*/
  3329. #line 541 "./typica.w"
  3330. /*306:*/
  3331. #line 40 "./measurement.w"
  3332. Measurement::Measurement(double temperature,QTime time,Units::Unit sc)
  3333. {
  3334. insert("measurement",temperature);
  3335. insert("time",time);
  3336. insert("unit",sc);
  3337. }
  3338. Measurement::Measurement(double temperature)
  3339. {
  3340. insert("measurement",temperature);
  3341. insert("time",QTime::currentTime());
  3342. insert("unit",Units::Fahrenheit);
  3343. }
  3344. void Measurement::setTemperature(double temperature)
  3345. {
  3346. insert("measurement",temperature);
  3347. }
  3348. void Measurement::setTime(QTime time)
  3349. {
  3350. insert("time",time);
  3351. }
  3352. void Measurement::setUnit(Units::Unit scale)
  3353. {
  3354. insert("unit",scale);
  3355. }
  3356. double Measurement::temperature()const
  3357. {
  3358. return value("measurement").toDouble();
  3359. }
  3360. QTime Measurement::time()const
  3361. {
  3362. return value("time").toTime();
  3363. }
  3364. Units::Unit Measurement::scale()const
  3365. {
  3366. return(Units::Unit)(value("unit").toInt());
  3367. }
  3368. /*:306*//*307:*/
  3369. #line 88 "./measurement.w"
  3370. Measurement Measurement::toFahrenheit()
  3371. {
  3372. return Measurement(Units::convertTemperature(this->temperature(),
  3373. this->scale(),Units::Fahrenheit),
  3374. this->time(),Units::Fahrenheit);
  3375. }
  3376. Measurement Measurement::toCelsius()
  3377. {
  3378. return Measurement(Units::convertTemperature(this->temperature(),
  3379. this->scale(),Units::Celsius),
  3380. this->time(),Units::Celsius);
  3381. }
  3382. Measurement Measurement::toKelvin()
  3383. {
  3384. return Measurement(Units::convertTemperature(this->temperature(),
  3385. this->scale(),Units::Kelvin),
  3386. this->time(),Units::Kelvin);
  3387. }
  3388. Measurement Measurement::toRankine()
  3389. {
  3390. return Measurement(Units::convertTemperature(this->temperature(),
  3391. this->scale(),Units::Rankine),
  3392. this->time(),Units::Rankine);
  3393. }
  3394. /*:307*/
  3395. #line 542 "./typica.w"
  3396. /*320:*/
  3397. #line 7042 "./typica.w"
  3398. void DAQImplementation::measure()
  3399. {
  3400. int samplesRead= 0;
  3401. double buffer[channels];
  3402. error= read((unsigned int)(handle),(signed long)(1),(double)(10.0),
  3403. (unsigned long)(0),buffer,(unsigned long)(channels),
  3404. &samplesRead,(signed long)(0));
  3405. if(error)
  3406. {
  3407. ready= false;
  3408. }
  3409. else
  3410. {
  3411. if(samplesRead)
  3412. {
  3413. QTime time= QTime::currentTime();
  3414. for(int i= 0;i<samplesRead;i++)
  3415. {
  3416. for(int j= 0;j<channels;j++)
  3417. {
  3418. double measuredValue= buffer[j+(i*channels)];
  3419. Measurement measure(measuredValue,time,
  3420. unitMap[j]);
  3421. channelMap[j]->input(measure);
  3422. }
  3423. }
  3424. }
  3425. }
  3426. }
  3427. /*:320*//*321:*/
  3428. #line 7085 "./typica.w"
  3429. void DAQImplementation::run()
  3430. {
  3431. setPriority(QThread::TimeCriticalPriority);
  3432. while(ready)
  3433. {
  3434. measure();
  3435. }
  3436. }
  3437. /*:321*//*322:*/
  3438. #line 7101 "./typica.w"
  3439. void DAQ::threadFinished()
  3440. {
  3441. if(imp->error)
  3442. {
  3443. /*323:*/
  3444. #line 7152 "./typica.w"
  3445. imp->ready= false;
  3446. QMessageBox warning;
  3447. warning.setStandardButtons(QMessageBox::Cancel);
  3448. warning.setIcon(QMessageBox::Warning);
  3449. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  3450. unsigned long bytes= imp->errorInfo(NULL,0);
  3451. char string[bytes];
  3452. imp->errorInfo(string,bytes);
  3453. warning.setInformativeText(QString(string));
  3454. warning.setWindowTitle(QString(PROGRAM_NAME));
  3455. warning.exec();
  3456. /*:323*/
  3457. #line 7106 "./typica.w"
  3458. }
  3459. }
  3460. /*:322*//*324:*/
  3461. #line 7177 "./typica.w"
  3462. void DAQ::start()
  3463. {
  3464. if(imp->ready)
  3465. {
  3466. imp->error= imp->startTask(imp->handle);
  3467. if(imp->error)
  3468. {
  3469. /*323:*/
  3470. #line 7152 "./typica.w"
  3471. imp->ready= false;
  3472. QMessageBox warning;
  3473. warning.setStandardButtons(QMessageBox::Cancel);
  3474. warning.setIcon(QMessageBox::Warning);
  3475. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  3476. unsigned long bytes= imp->errorInfo(NULL,0);
  3477. char string[bytes];
  3478. imp->errorInfo(string,bytes);
  3479. warning.setInformativeText(QString(string));
  3480. warning.setWindowTitle(QString(PROGRAM_NAME));
  3481. warning.exec();
  3482. /*:323*/
  3483. #line 7185 "./typica.w"
  3484. }
  3485. else
  3486. {
  3487. connect(imp,SIGNAL(finished()),this,SLOT(threadFinished()));
  3488. imp->start();
  3489. }
  3490. }
  3491. }
  3492. void DAQ::stop()
  3493. {
  3494. if(imp->useBase)
  3495. {
  3496. imp->ready= false;
  3497. imp->wait(ULONG_MAX);
  3498. imp->stopTask(imp->handle);
  3499. }
  3500. else
  3501. {
  3502. imp->ready= false;
  3503. imp->error= imp->stopTask(imp->handle);
  3504. if(imp->error)
  3505. {
  3506. /*323:*/
  3507. #line 7152 "./typica.w"
  3508. imp->ready= false;
  3509. QMessageBox warning;
  3510. warning.setStandardButtons(QMessageBox::Cancel);
  3511. warning.setIcon(QMessageBox::Warning);
  3512. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  3513. unsigned long bytes= imp->errorInfo(NULL,0);
  3514. char string[bytes];
  3515. imp->errorInfo(string,bytes);
  3516. warning.setInformativeText(QString(string));
  3517. warning.setWindowTitle(QString(PROGRAM_NAME));
  3518. warning.exec();
  3519. /*:323*/
  3520. #line 7209 "./typica.w"
  3521. }
  3522. imp->error= imp->clearTask(imp->handle);
  3523. if(imp->error)
  3524. {
  3525. /*323:*/
  3526. #line 7152 "./typica.w"
  3527. imp->ready= false;
  3528. QMessageBox warning;
  3529. warning.setStandardButtons(QMessageBox::Cancel);
  3530. warning.setIcon(QMessageBox::Warning);
  3531. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  3532. unsigned long bytes= imp->errorInfo(NULL,0);
  3533. char string[bytes];
  3534. imp->errorInfo(string,bytes);
  3535. warning.setInformativeText(QString(string));
  3536. warning.setWindowTitle(QString(PROGRAM_NAME));
  3537. warning.exec();
  3538. /*:323*/
  3539. #line 7214 "./typica.w"
  3540. }
  3541. }
  3542. }
  3543. /*:324*//*325:*/
  3544. #line 7224 "./typica.w"
  3545. DAQ::DAQ(QString device,const QString&driver):imp(new DAQImplementation(driver))
  3546. {
  3547. imp->device= device;
  3548. imp->error= imp->createTask(device.toAscii().data(),&(imp->handle));
  3549. if(imp->error)
  3550. {
  3551. /*323:*/
  3552. #line 7152 "./typica.w"
  3553. imp->ready= false;
  3554. QMessageBox warning;
  3555. warning.setStandardButtons(QMessageBox::Cancel);
  3556. warning.setIcon(QMessageBox::Warning);
  3557. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  3558. unsigned long bytes= imp->errorInfo(NULL,0);
  3559. char string[bytes];
  3560. imp->errorInfo(string,bytes);
  3561. warning.setInformativeText(QString(string));
  3562. warning.setWindowTitle(QString(PROGRAM_NAME));
  3563. warning.exec();
  3564. /*:323*/
  3565. #line 7231 "./typica.w"
  3566. }
  3567. else
  3568. {
  3569. imp->ready= true;
  3570. }
  3571. }
  3572. /*:325*//*326:*/
  3573. #line 7245 "./typica.w"
  3574. Channel*DAQ::newChannel(int units,int thermocouple)
  3575. {
  3576. Channel*retval= new Channel();
  3577. imp->channelMap[imp->channels]= retval;
  3578. imp->unitMap[imp->channels]= (Units::Unit)units;
  3579. imp->channels++;
  3580. if(imp->ready)
  3581. {
  3582. if(imp->useBase)
  3583. {
  3584. imp->error= imp->createChannel(imp->handle,
  3585. QString("%1/ai%2").arg(imp->device).
  3586. arg(imp->channels-1).
  3587. toAscii().data(),
  3588. "",(double)(-1.0),(double)(100.0),
  3589. (signed long)(units),
  3590. (signed long)(thermocouple),
  3591. (signed long)(10200),(double)(0),
  3592. "");
  3593. }
  3594. else
  3595. {
  3596. imp->error= imp->createChannel(imp->handle,
  3597. QString("%1/ai%2").arg(imp->device).
  3598. arg(imp->channels-1).
  3599. toAscii().data(),
  3600. "",(double)(50.0),(double)(500.0),
  3601. (signed long)(units),
  3602. (signed long)(thermocouple),
  3603. (signed long)(10200),(double)(0),
  3604. "");
  3605. }
  3606. if(imp->error)
  3607. {
  3608. /*323:*/
  3609. #line 7152 "./typica.w"
  3610. imp->ready= false;
  3611. QMessageBox warning;
  3612. warning.setStandardButtons(QMessageBox::Cancel);
  3613. warning.setIcon(QMessageBox::Warning);
  3614. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  3615. unsigned long bytes= imp->errorInfo(NULL,0);
  3616. char string[bytes];
  3617. imp->errorInfo(string,bytes);
  3618. warning.setInformativeText(QString(string));
  3619. warning.setWindowTitle(QString(PROGRAM_NAME));
  3620. warning.exec();
  3621. /*:323*/
  3622. #line 7280 "./typica.w"
  3623. }
  3624. }
  3625. return retval;
  3626. }
  3627. /*:326*//*327:*/
  3628. #line 7294 "./typica.w"
  3629. void DAQ::setClockRate(double Hz)
  3630. {
  3631. if(imp->ready)
  3632. {
  3633. imp->error= imp->setClock(imp->handle,"OnboardClock",Hz,
  3634. (signed long)(10280),(signed long)(10123),
  3635. (unsigned long long)(1));
  3636. if(imp->error)
  3637. {
  3638. /*323:*/
  3639. #line 7152 "./typica.w"
  3640. imp->ready= false;
  3641. QMessageBox warning;
  3642. warning.setStandardButtons(QMessageBox::Cancel);
  3643. warning.setIcon(QMessageBox::Warning);
  3644. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  3645. unsigned long bytes= imp->errorInfo(NULL,0);
  3646. char string[bytes];
  3647. imp->errorInfo(string,bytes);
  3648. warning.setInformativeText(QString(string));
  3649. warning.setWindowTitle(QString(PROGRAM_NAME));
  3650. warning.exec();
  3651. /*:323*/
  3652. #line 7304 "./typica.w"
  3653. }
  3654. }
  3655. }
  3656. /*:327*//*328:*/
  3657. #line 7314 "./typica.w"
  3658. DAQ::~DAQ()
  3659. {
  3660. if(imp->useBase)
  3661. {
  3662. imp->resetDevice(imp->device.toAscii().data());
  3663. imp->clearTask(imp->handle);
  3664. }
  3665. else
  3666. {
  3667. if(imp->ready)
  3668. {
  3669. imp->ready= false;
  3670. imp->wait(ULONG_MAX);
  3671. imp->stopTask(imp->handle);
  3672. imp->resetDevice(imp->device.toAscii().data());
  3673. imp->clearTask(imp->handle);
  3674. }
  3675. }
  3676. delete imp;
  3677. }
  3678. /*:328*//*329:*/
  3679. #line 7345 "./typica.w"
  3680. DAQImplementation::DAQImplementation(const QString&driverinfo)
  3681. :QThread(NULL),channelMap(4),handle(0),error(0),channels(0),ready(false),
  3682. unitMap(4)
  3683. {
  3684. if(driverinfo=="nidaqmxbase")
  3685. {
  3686. useBase= true;
  3687. }
  3688. else
  3689. {
  3690. useBase= false;
  3691. }
  3692. if(useBase)
  3693. {
  3694. driver.setFileName("nidaqmxbase.framework/nidaqmxbase");
  3695. if(!driver.load())
  3696. {
  3697. driver.setFileName("nidaqmxbase");
  3698. if(!driver.load())
  3699. {
  3700. QMessageBox::critical(NULL,tr("Typica: Driver not found"),
  3701. tr("Failed to find nidaqmxbase. Please install it."));
  3702. QApplication::quit();
  3703. }
  3704. }
  3705. }
  3706. else
  3707. {
  3708. driver.setFileName("nicaiu");
  3709. if(!driver.load())
  3710. {
  3711. QMessageBox::critical(NULL,tr("Typica: Driver not found"),
  3712. tr("Failed to find nidaqmx. Please install it."));
  3713. QApplication::quit();
  3714. }
  3715. }
  3716. if(useBase)
  3717. {
  3718. if((createTask= (daqfp)driver.resolve("DAQmxBaseCreateTask"))==0||
  3719. (startTask= (daqfp)driver.resolve("DAQmxBaseStartTask"))==0||
  3720. (stopTask= (daqfp)driver.resolve("DAQmxBaseStopTask"))==0||
  3721. (clearTask= (daqfp)driver.resolve("DAQmxBaseClearTask"))==0||
  3722. (createChannel= (daqfp)driver.resolve("DAQmxBaseCreateAIThrmcplChan"))
  3723. ==0||
  3724. (setClock= (daqfp)driver.resolve("DAQmxBaseCfgSampClkTiming"))==
  3725. 0||
  3726. (read= (daqfp)driver.resolve("DAQmxBaseReadAnalogF64"))==0||
  3727. (errorInfo= (daqfp)driver.resolve("DAQmxBaseGetExtendedErrorInfo"))==
  3728. 0||
  3729. (resetDevice= (daqfp)driver.resolve("DAQmxBaseResetDevice"))==0)
  3730. {
  3731. waitForMeasurement= NULL;
  3732. QMessageBox::critical(NULL,tr("Typica: Link error"),
  3733. tr("Failed to link a required symbol in NI-DAQmxBase."));
  3734. QApplication::quit();
  3735. }
  3736. }
  3737. else
  3738. {
  3739. if((createTask= (daqfp)driver.resolve("DAQmxCreateTask"))==0||
  3740. (startTask= (daqfp)driver.resolve("DAQmxStartTask"))==0||
  3741. (stopTask= (daqfp)driver.resolve("DAQmxStopTask"))==0||
  3742. (clearTask= (daqfp)driver.resolve("DAQmxClearTask"))==0||
  3743. (createChannel= (daqfp)driver.resolve("DAQmxCreateAIThrmcplChan"))
  3744. ==0||
  3745. (setClock= (daqfp)driver.resolve("DAQmxCfgSampClkTiming"))==0||
  3746. (read= (daqfp)driver.resolve("DAQmxReadAnalogF64"))==0||
  3747. (errorInfo= (daqfp)driver.resolve("DAQmxGetExtendedErrorInfo"))==
  3748. 0||
  3749. (resetDevice= (daqfp)driver.resolve("DAQmxResetDevice"))==0||
  3750. (waitForMeasurement= (daqfp)driver.resolve("DAQmxWaitUntilTaskDone"))==0)
  3751. {
  3752. QMessageBox::critical(NULL,tr("Typica: Link error"),
  3753. tr("Failed to link a required symbol in NI-DAQmx."));
  3754. QApplication::quit();
  3755. }
  3756. }
  3757. }
  3758. DAQImplementation::~DAQImplementation()
  3759. {
  3760. driver.unload();
  3761. }
  3762. /*:329*/
  3763. #line 543 "./typica.w"
  3764. /*1055:*/
  3765. #line 197 "./dataqsdk.w"
  3766. void DataqSdkDeviceImplementation::measure()
  3767. {
  3768. unsigned count= channels*40;
  3769. di_status_read(buffer,count);
  3770. QTime time= QTime::currentTime();
  3771. for(unsigned int i= 0;i<count;i++)
  3772. {
  3773. buffer[i]= buffer[i]&0xFFFC;
  3774. }
  3775. QList<int> countList;
  3776. for(unsigned int i= 0;i<(unsigned)channels;i++)
  3777. {
  3778. QList<double> channelBuffer;
  3779. for(unsigned int j= 0;j<40;j++)
  3780. {
  3781. channelBuffer<<((double)buffer[i+(channels*j)]*10.0)/32768.0;
  3782. if(i==0)
  3783. {
  3784. countList<<buffer[i+(channels*j)];
  3785. }
  3786. }
  3787. double value= 0.0;
  3788. for(unsigned int j= 0;j<40;j++)
  3789. {
  3790. value+= channelBuffer[j];
  3791. }
  3792. value/= 40.0;
  3793. if(i==0)
  3794. {
  3795. QList<double> smoothingList;
  3796. smoothingList<<value;
  3797. QList<int> smoothingKeys= smoother.uniqueKeys();
  3798. for(int j= 0;j<smoothingKeys.size();j++)
  3799. {
  3800. if(countList.contains(smoothingKeys[j]))
  3801. {
  3802. QList<double> keyValues= smoother.values(smoothingKeys[j]);
  3803. for(int k= 0;k<keyValues.size();k++)
  3804. {
  3805. smoothingList<<keyValues[k];
  3806. }
  3807. }
  3808. else
  3809. {
  3810. smoother.remove(smoothingKeys[j]);
  3811. }
  3812. }
  3813. qSort(countList);
  3814. int lastCount= 0;
  3815. for(int j= 0;j<countList.size();j++)
  3816. {
  3817. if(j==0||countList[j]!=lastCount)
  3818. {
  3819. smoother.insert(countList[j],value);
  3820. lastCount= countList[j];
  3821. }
  3822. }
  3823. value= 0.0;
  3824. for(int j= 0;j<smoothingList.size();j++)
  3825. {
  3826. value+= smoothingList[j];
  3827. }
  3828. value/= smoothingList.size();
  3829. }
  3830. Measurement measure(value,time,unitMap[i]);
  3831. channelMap[i]->input(measure);
  3832. }
  3833. }
  3834. /*:1055*//*1056:*/
  3835. #line 290 "./dataqsdk.w"
  3836. void DataqSdkDeviceImplementation::run()
  3837. {
  3838. if(!ready)
  3839. {
  3840. error= 9;
  3841. return;
  3842. }
  3843. driver= new QLibrary(device);
  3844. if(!driver->load())
  3845. {
  3846. error= 1;
  3847. qDebug()<<"Failed to load driver: "<<device;
  3848. return;
  3849. }
  3850. di_open= (FPDIOPEN)driver->resolve("di_open");
  3851. di_close= (FPDICLOSE)driver->resolve("di_close");
  3852. di_sample_rate= (FPDISAMPLERATE)driver->resolve("di_sample_rate");
  3853. di_maximum_rate= (FPDIMAXIMUMRATE)driver->resolve("di_maximum_rate");
  3854. di_list_length= (FPDILISTLENGTH)driver->resolve("di_list_length");
  3855. di_inlist= (FPDIINLIST)driver->resolve("di_inlist");
  3856. di_buffer_alloc= (FPDIBUFFERALLOC)driver->resolve("di_buffer_alloc");
  3857. di_start_scan= (FPDISTARTSCAN)driver->resolve("di_start_scan");
  3858. di_status_read= (FPDISTATUSREAD)driver->resolve("di_status_read");
  3859. di_buffer_status= (FPDIBUFFERSTATUS)driver->resolve("di_buffer_status");
  3860. di_burst_rate= (FPDIBURSTRATE)driver->resolve("di_burst_rate");
  3861. di_stop_scan= (FPDISTOPSCAN)driver->resolve("di_stop_scan");
  3862. if((!di_open)||(!di_close)||(!di_sample_rate)||(!di_maximum_rate)||
  3863. (!di_list_length)||(!di_inlist)||(!di_buffer_alloc)||
  3864. (!di_start_scan)||(!di_status_read)||(!di_buffer_status)||
  3865. (!di_burst_rate)||(!di_stop_scan))
  3866. {
  3867. error= 2;
  3868. return;
  3869. }
  3870. error= di_open(deviceNumber);
  3871. if(error)
  3872. {
  3873. di_close();
  3874. error= di_open(deviceNumber);
  3875. if(error)
  3876. {
  3877. error= 3;
  3878. di_close();
  3879. return;
  3880. }
  3881. }
  3882. isOpen= true;
  3883. di_maximum_rate(240.0);
  3884. sampleRate= di_sample_rate(sampleRate*channels*40,&oversample,
  3885. &burstDivisor);
  3886. buffer= new qint16[(int)sampleRate];
  3887. di_inlist_struct inlist[16]= {{0,0,0,0,0,0,0,0}};
  3888. for(unsigned short i= 0;i<channels;i++)
  3889. {
  3890. inlist[i].chan= i;
  3891. inlist[i].gain= 0;
  3892. inlist[i].ave= 1;
  3893. inlist[i].counter= (oversample-1);
  3894. }
  3895. error= di_list_length(channels,0);
  3896. if(error)
  3897. {
  3898. error= 4;
  3899. return;
  3900. }
  3901. error= di_inlist(inlist);
  3902. if(error)
  3903. {
  3904. error= 5;
  3905. return;
  3906. }
  3907. input_buffer= di_buffer_alloc(0,4096);
  3908. if(input_buffer==NULL)
  3909. {
  3910. error= 6;
  3911. return;
  3912. }
  3913. error= di_start_scan();
  3914. if(error)
  3915. {
  3916. error= 7;
  3917. return;
  3918. }
  3919. while(ready)
  3920. {
  3921. measure();
  3922. }
  3923. }
  3924. /*:1056*//*1057:*/
  3925. #line 386 "./dataqsdk.w"
  3926. void DataqSdkDevice::threadFinished()
  3927. {
  3928. if(imp->error)
  3929. {
  3930. /*1058:*/
  3931. #line 400 "./dataqsdk.w"
  3932. imp->ready= false;
  3933. QMessageBox warning;
  3934. warning.setStandardButtons(QMessageBox::Cancel);
  3935. warning.setIcon(QMessageBox::Warning);
  3936. warning.setText(QString(tr("Error: %1")).arg(imp->error));
  3937. warning.setInformativeText(tr("An error occurred"));
  3938. warning.setWindowTitle(QString(PROGRAM_NAME));
  3939. warning.exec();
  3940. /*:1058*/
  3941. #line 391 "./dataqsdk.w"
  3942. }
  3943. }
  3944. /*:1057*//*1059:*/
  3945. #line 417 "./dataqsdk.w"
  3946. void DataqSdkDevice::start()
  3947. {
  3948. connect(imp,SIGNAL(finished()),this,SLOT(threadFinished()));
  3949. imp->start();
  3950. }
  3951. /*:1059*//*1060:*/
  3952. #line 428 "./dataqsdk.w"
  3953. QStringList DataqSdkDevice::detectHardware()
  3954. {
  3955. QSettings deviceLookup("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\services\\usbser\\Enum",
  3956. QSettings::NativeFormat);
  3957. QStringList keys= deviceLookup.childKeys();
  3958. QStringList devices;
  3959. for(int i= 0;i<keys.size();i++)
  3960. {
  3961. QString value= deviceLookup.value(keys.at(i)).toString();
  3962. if(value.startsWith("USB\\VID_0683&PID_1450\\"))
  3963. {
  3964. devices.append(value.split("\\").at(2));
  3965. }
  3966. }
  3967. QStringList portList;
  3968. foreach(QString device,devices)
  3969. {
  3970. QString deviceKey= QString("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\USB\\VID_0683&PID_1450\\%1").arg(device);
  3971. QSettings deviceEntry(deviceKey,QSettings::NativeFormat);
  3972. portList.append(deviceEntry.value("FriendlyName").toString());
  3973. }
  3974. return portList;
  3975. }
  3976. QStringList DataqSdkDevice::detectPorts()
  3977. {
  3978. QStringList friendlyNames= detectHardware();
  3979. QStringList portList;
  3980. foreach(QString name,friendlyNames)
  3981. {
  3982. name.remove(0,name.indexOf("COM"));
  3983. name.chop(1);
  3984. portList.append(name);
  3985. }
  3986. return portList;
  3987. }
  3988. /*:1060*//*1061:*/
  3989. #line 473 "./dataqsdk.w"
  3990. DataqSdkDevice::DataqSdkDevice(QString device):imp(new DataqSdkDeviceImplementation)
  3991. {
  3992. bool usesAuto= false;
  3993. int autoIndex= device.toInt(&usesAuto);
  3994. QString finalizedPort;
  3995. if(usesAuto)
  3996. {
  3997. QStringList portList= detectPorts();
  3998. if(autoIndex> 0&&autoIndex<=portList.size())
  3999. {
  4000. finalizedPort= portList.at(autoIndex-1);
  4001. }
  4002. else
  4003. {
  4004. imp->error= 8;
  4005. qDebug()<<"Failed to detect port.";
  4006. }
  4007. }
  4008. else
  4009. {
  4010. finalizedPort= device;
  4011. }
  4012. int rstart= finalizedPort.indexOf("COM");
  4013. finalizedPort.remove(0,rstart+3);
  4014. bool chopFinished= false;
  4015. int finalizedPortNumber= 0;
  4016. while(finalizedPort.size()> 0&&!chopFinished)
  4017. {
  4018. finalizedPortNumber= finalizedPort.toInt(&chopFinished);
  4019. if(!chopFinished)
  4020. {
  4021. finalizedPort.chop(1);
  4022. }
  4023. }
  4024. if(finalizedPortNumber<10)
  4025. {
  4026. imp->device= QString("DI10%1NT.DLL").arg(finalizedPort);
  4027. }
  4028. else
  4029. {
  4030. imp->device= QString("DI1%1NT.DLL").arg(finalizedPort);
  4031. }
  4032. imp->deviceNumber= 0x12C02D00;
  4033. imp->deviceNumber+= finalizedPortNumber;
  4034. imp->ready= true;
  4035. }
  4036. /*:1061*//*1062:*/
  4037. #line 523 "./dataqsdk.w"
  4038. Channel*DataqSdkDevice::newChannel(Units::Unit scale)
  4039. {
  4040. Channel*retval= NULL;
  4041. if(imp->ready)
  4042. {
  4043. retval= new Channel();
  4044. imp->channelMap[imp->channels]= retval;
  4045. imp->unitMap[imp->channels]= scale;
  4046. imp->channels++;
  4047. }
  4048. return retval;
  4049. }
  4050. /*:1062*//*1063:*/
  4051. #line 547 "./dataqsdk.w"
  4052. void DataqSdkDevice::setClockRate(double Hz)
  4053. {
  4054. imp->sampleRate= Hz;
  4055. }
  4056. /*:1063*//*1064:*/
  4057. #line 557 "./dataqsdk.w"
  4058. DataqSdkDevice::~DataqSdkDevice()
  4059. {
  4060. if(imp->ready)
  4061. {
  4062. imp->ready= false;
  4063. }
  4064. imp->wait(ULONG_MAX);
  4065. delete imp;
  4066. }
  4067. /*:1064*//*1065:*/
  4068. #line 575 "./dataqsdk.w"
  4069. DataqSdkDeviceImplementation::DataqSdkDeviceImplementation():QThread(NULL),
  4070. channelMap(4),error(0),channels(0),ready(false),unitMap(4)
  4071. {
  4072. }
  4073. DataqSdkDeviceImplementation::~DataqSdkDeviceImplementation()
  4074. {
  4075. if(isOpen)
  4076. {
  4077. di_stop_scan();
  4078. di_close();
  4079. }
  4080. if(driver->isLoaded())
  4081. {
  4082. driver->unload();
  4083. }
  4084. }
  4085. /*:1065*/
  4086. #line 544 "./typica.w"
  4087. /*336:*/
  4088. #line 7554 "./typica.w"
  4089. void FakeDAQImplementation::measure()
  4090. {
  4091. msleep((int)(1000/clockRate));
  4092. QTime time= QTime::currentTime();
  4093. for(int i= 0;i<channels;i++)
  4094. {
  4095. Measurement measure(qrand()%500,time);
  4096. channelMap[i]->input(measure);
  4097. }
  4098. }
  4099. /*:336*//*337:*/
  4100. #line 7568 "./typica.w"
  4101. void FakeDAQImplementation::run()
  4102. {
  4103. setPriority(QThread::TimeCriticalPriority);
  4104. while(ready)
  4105. {
  4106. measure();
  4107. }
  4108. }
  4109. FakeDAQImplementation::FakeDAQImplementation():QThread(NULL),channelMap(4),
  4110. channels(0),ready(false),clockRate(1)
  4111. {
  4112. }
  4113. FakeDAQImplementation::~FakeDAQImplementation()
  4114. {
  4115. }
  4116. /*:337*//*338:*/
  4117. #line 7593 "./typica.w"
  4118. void FakeDAQ::start()
  4119. {
  4120. if(imp->ready)
  4121. {
  4122. imp->start();
  4123. }
  4124. }
  4125. FakeDAQ::FakeDAQ(QString):imp(new FakeDAQImplementation())
  4126. {
  4127. imp->ready= true;
  4128. }
  4129. Channel*FakeDAQ::newChannel(int,int)
  4130. {
  4131. Channel*retval;
  4132. if(imp->ready)
  4133. {
  4134. retval= new Channel();
  4135. imp->channelMap[imp->channels]= retval;
  4136. imp->channels++;
  4137. }
  4138. else
  4139. {
  4140. return NULL;
  4141. }
  4142. return retval;
  4143. }
  4144. void FakeDAQ::setClockRate(double Hz)
  4145. {
  4146. if(imp->ready)
  4147. {
  4148. imp->clockRate= Hz;
  4149. }
  4150. }
  4151. FakeDAQ::~FakeDAQ()
  4152. {
  4153. imp->ready= false;
  4154. imp->wait(ULONG_MAX);
  4155. delete imp;
  4156. }
  4157. /*:338*/
  4158. #line 545 "./typica.w"
  4159. /*343:*/
  4160. #line 7724 "./typica.w"
  4161. Channel::Channel():QObject(NULL)
  4162. {
  4163. }
  4164. Channel::~Channel()
  4165. {
  4166. }
  4167. void Channel::input(Measurement measurement)
  4168. {
  4169. emit newData(measurement);
  4170. }
  4171. /*:343*/
  4172. #line 546 "./typica.w"
  4173. /*359:*/
  4174. #line 8129 "./typica.w"
  4175. void TemperatureDisplay::setRelativeMode(bool relative)
  4176. {
  4177. r= relative;
  4178. }
  4179. /*:359*//*360:*/
  4180. #line 8146 "./typica.w"
  4181. void TemperatureDisplay::setValue(Measurement temperature)
  4182. {
  4183. QString number;
  4184. switch(unit)
  4185. {
  4186. case Units::Fahrenheit:
  4187. display(QString("%1'F").
  4188. arg(number.setNum(temperature.toFahrenheit().temperature(),'f',
  4189. 2)));
  4190. break;
  4191. case Units::Celsius:
  4192. if(!r){
  4193. display(QString("%1'C").
  4194. arg(number.setNum(temperature.toCelsius().temperature(),'f',
  4195. 2)));
  4196. }else{
  4197. number.setNum(temperature.temperature()*(5.0/9.0),'f',2);
  4198. display(QString("%1'C").arg(number));
  4199. }
  4200. break;
  4201. case Units::Kelvin:
  4202. if(!r){
  4203. display(QString("%1").
  4204. arg(number.setNum(temperature.toKelvin().temperature(),'f',
  4205. 2)));
  4206. }else{
  4207. number.setNum(temperature.temperature()*(5.0/9.0),'f',2);
  4208. display(QString("%1").arg(number));
  4209. }
  4210. break;
  4211. case Units::Rankine:
  4212. display(QString("%1'r").
  4213. arg(number.setNum(temperature.toRankine().temperature(),'f',
  4214. 2)));
  4215. break;
  4216. case Units::Unitless:
  4217. display(QString("%1").arg(number.setNum(temperature.temperature(),'f',0)));
  4218. break;
  4219. default:
  4220. switch(temperature.scale())
  4221. {
  4222. case Units::Fahrenheit:
  4223. display(QString("%1'F").
  4224. arg(number.setNum(temperature.temperature(),'f',2)));
  4225. break;
  4226. case Units::Celsius:
  4227. display(QString("%1'C").
  4228. arg(number.setNum(temperature.temperature(),'f',2)));
  4229. break;
  4230. case Units::Kelvin:
  4231. display(QString("%1").
  4232. arg(number.setNum(temperature.temperature(),'f',2)));
  4233. break;
  4234. case Units::Rankine:
  4235. display(QString("%1'r").
  4236. arg(number.setNum(temperature.temperature(),'f',2)));
  4237. break;
  4238. case Units::Unitless:
  4239. display(QString("%1").arg(number.setNum(temperature.temperature(),'f',0)));
  4240. break;
  4241. default:
  4242. qDebug()<<"Warning: Attempting to convert a non-temperature unit to a temperature unit";
  4243. break;
  4244. }
  4245. break;
  4246. }
  4247. }
  4248. /*:360*//*361:*/
  4249. #line 8225 "./typica.w"
  4250. TemperatureDisplay::TemperatureDisplay(QWidget*parent):
  4251. QLCDNumber(8,parent),unit(Units::Fahrenheit),r(false)
  4252. {
  4253. setSegmentStyle(Filled);
  4254. display("---.--'F");
  4255. }
  4256. /*:361*//*362:*/
  4257. #line 8241 "./typica.w"
  4258. void TemperatureDisplay::invalidate()
  4259. {
  4260. display("---.--'F");
  4261. }
  4262. /*:362*//*363:*/
  4263. #line 8253 "./typica.w"
  4264. void TemperatureDisplay::setDisplayUnits(Units::Unit scale)
  4265. {
  4266. unit= scale;
  4267. }
  4268. /*:363*//*364:*/
  4269. #line 8261 "./typica.w"
  4270. TemperatureDisplay::~TemperatureDisplay()
  4271. {
  4272. }
  4273. /*:364*/
  4274. #line 547 "./typica.w"
  4275. /*370:*/
  4276. #line 8361 "./typica.w"
  4277. void MeasurementTimeOffset::newMeasurement(Measurement measure)
  4278. {
  4279. if(measure.time()<epoch)
  4280. {
  4281. if(hasPrevious)
  4282. {
  4283. QTime jitBase(epoch.hour()-1,epoch.minute(),epoch.second(),
  4284. epoch.msec());
  4285. QTime jitComp(epoch.hour(),measure.time().minute(),
  4286. measure.time().second(),measure.time().msec());
  4287. int relTime= jitBase.msecsTo(jitComp);
  4288. /*371:*/
  4289. #line 8395 "./typica.w"
  4290. QTime newTime(0,0,0,0);
  4291. newTime= newTime.addMSecs(relTime);
  4292. if(newTime.hour()> 0)
  4293. {
  4294. newTime.setHMS(0,newTime.minute(),newTime.second(),newTime.msec());
  4295. }
  4296. Measurement rel= measure;
  4297. rel.setTime(newTime);
  4298. emit measurement(rel);
  4299. /*:371*/
  4300. #line 8373 "./typica.w"
  4301. }
  4302. else
  4303. {
  4304. Measurement rel= measure;
  4305. rel.setTime(QTime(0,0,0,0));
  4306. emit measurement(rel);
  4307. }
  4308. }
  4309. else
  4310. {
  4311. int relTime= epoch.msecsTo(measure.time());
  4312. /*371:*/
  4313. #line 8395 "./typica.w"
  4314. QTime newTime(0,0,0,0);
  4315. newTime= newTime.addMSecs(relTime);
  4316. if(newTime.hour()> 0)
  4317. {
  4318. newTime.setHMS(0,newTime.minute(),newTime.second(),newTime.msec());
  4319. }
  4320. Measurement rel= measure;
  4321. rel.setTime(newTime);
  4322. emit measurement(rel);
  4323. /*:371*/
  4324. #line 8385 "./typica.w"
  4325. }
  4326. hasPrevious= true;
  4327. previous= measure.time();
  4328. }
  4329. /*:370*//*372:*/
  4330. #line 8408 "./typica.w"
  4331. MeasurementTimeOffset::MeasurementTimeOffset(QTime zero):epoch(zero),
  4332. previous(0,0,0,0),hasPrevious(false)
  4333. {
  4334. }
  4335. QTime MeasurementTimeOffset::zeroTime()
  4336. {
  4337. return epoch;
  4338. }
  4339. void MeasurementTimeOffset::setZeroTime(QTime zero)
  4340. {
  4341. epoch= zero;
  4342. hasPrevious= false;
  4343. }
  4344. /*:372*/
  4345. #line 548 "./typica.w"
  4346. /*382:*/
  4347. #line 8616 "./typica.w"
  4348. ZeroEmitter::ZeroEmitter(int tempcolumn):QObject(NULL),col(tempcolumn)
  4349. {
  4350. }
  4351. int ZeroEmitter::column()
  4352. {
  4353. return col;
  4354. }
  4355. double ZeroEmitter::lastTemperature()
  4356. {
  4357. return cache.temperature();
  4358. }
  4359. void ZeroEmitter::newMeasurement(Measurement measure)
  4360. {
  4361. cache= measure;
  4362. }
  4363. void ZeroEmitter::setColumn(int column)
  4364. {
  4365. col= column;
  4366. }
  4367. void ZeroEmitter::emitZero()
  4368. {
  4369. cache.setTime(QTime(0,0,0,0));
  4370. emit measurement(cache,col);
  4371. }
  4372. /*:382*/
  4373. #line 549 "./typica.w"
  4374. /*387:*/
  4375. #line 8706 "./typica.w"
  4376. MeasurementAdapter::MeasurementAdapter(int tempcolumn):col(tempcolumn)
  4377. {
  4378. }
  4379. int MeasurementAdapter::column()
  4380. {
  4381. return col;
  4382. }
  4383. void MeasurementAdapter::newMeasurement(Measurement measure)
  4384. {
  4385. emit measurement(measure,col);
  4386. }
  4387. void MeasurementAdapter::setColumn(int column)
  4388. {
  4389. col= column;
  4390. }
  4391. /*:387*/
  4392. #line 550 "./typica.w"
  4393. /*392:*/
  4394. #line 8828 "./typica.w"
  4395. GraphView::GraphView(QWidget*parent):QGraphicsView(parent),
  4396. theScene(new QGraphicsScene),
  4397. graphLines(new QMap<int,QList<QGraphicsLineItem*> *> ),
  4398. prevPoints(new QMap<int,QPointF> ),
  4399. translations(new QMap<int,double> ),
  4400. gridLinesF(new QList<QGraphicsItem*> ),
  4401. gridLinesC(new QList<QGraphicsItem*> ),
  4402. relativeGridLines(new QList<QGraphicsItem*> ),
  4403. relativeEnabled(false),
  4404. timeIndicatorEnabled(false),
  4405. timeLine(new QGraphicsLineItem),
  4406. relativeAdjuster(new LinearSplineInterpolator)
  4407. {
  4408. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  4409. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  4410. setScene(theScene);
  4411. setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
  4412. QPen timePen;
  4413. timePen.setColor(QColor(160,160,164,127));
  4414. timeLine->setPen(timePen);
  4415. timeLine->setLine(0,0,0,-500);
  4416. timeLine->hide();
  4417. theScene->addItem(timeLine);
  4418. /*393:*/
  4419. #line 8868 "./typica.w"
  4420. QGraphicsLineItem*tempaxis= new QGraphicsLineItem;
  4421. tempaxis->setLine(-10,-500,-10,0);
  4422. theScene->addItem(tempaxis);
  4423. QGraphicsLineItem*gridLine;
  4424. QGraphicsTextItem*label;
  4425. for(int y= -100;y> -600;y-= 100)
  4426. {
  4427. gridLine= new QGraphicsLineItem;
  4428. gridLine->setLine(0,y,1200,y);
  4429. theScene->addItem(gridLine);
  4430. label= new QGraphicsTextItem;
  4431. label->setHtml(QString("%1&deg;F").arg(-y));
  4432. label->setPos(-55,y-(label->boundingRect().height()/2));
  4433. theScene->addItem(label);
  4434. gridLinesF->append(gridLine);
  4435. gridLinesF->append(label);
  4436. }
  4437. for(int degC= 50;degC<=250;degC+= 50)
  4438. {
  4439. gridLine= new QGraphicsLineItem;
  4440. int y= -(degC*(9.0/5.0)+32);
  4441. gridLine->setLine(0,y,1200,y);
  4442. gridLine->hide();
  4443. theScene->addItem(gridLine);
  4444. gridLinesC->append(gridLine);
  4445. label= new QGraphicsTextItem;
  4446. label->setHtml(QString("%1&deg;C").arg(degC));
  4447. label->setPos(-55,y-(label->boundingRect().height()/2));
  4448. label->hide();
  4449. theScene->addItem(label);
  4450. gridLinesC->append(label);
  4451. }
  4452. /*:393*/
  4453. #line 8852 "./typica.w"
  4454. ;
  4455. /*394:*/
  4456. #line 8909 "./typica.w"
  4457. QSettings settings;
  4458. if(settings.contains("settings/graph/relative/enable"))
  4459. {
  4460. if(settings.value("settings/graph/relative/enable").toBool())
  4461. {
  4462. relativeEnabled= true;
  4463. QColor relativeColor= QColor(settings.value("settings/graph/relative/color").toString());
  4464. QString unit= QString(settings.value("settings/graph/relative/unit").toInt()==0?"F":"C");
  4465. QMap<double,QString> relativeAxisPairs;
  4466. QStringList relativeAxisLabels= settings.value("settings/graph/relative/grid").toString().split(QRegExp("[\\s,]+"),QString::SkipEmptyParts);
  4467. foreach(QString item,relativeAxisLabels)
  4468. {
  4469. relativeAxisPairs.insert(item.toDouble(),item);
  4470. }
  4471. if(relativeAxisPairs.size()> 1)
  4472. {
  4473. double skip= 500.0/(relativeAxisPairs.size()-1);
  4474. double y= 0;
  4475. foreach(double key,relativeAxisPairs.keys())
  4476. {
  4477. gridLine= new QGraphicsLineItem;
  4478. gridLine->setLine(0,y,1205,y);
  4479. gridLine->setPen(QPen(relativeColor));
  4480. theScene->addItem(gridLine);
  4481. relativeGridLines->append(gridLine);
  4482. label= new QGraphicsTextItem;
  4483. label->setHtml(QString("%1&deg;%2").arg(relativeAxisPairs.value(key)).arg(unit));
  4484. label->setPos(1210,y-(label->boundingRect().height()/2));
  4485. theScene->addItem(label);
  4486. relativeGridLines->append(label);
  4487. if(unit=="F")
  4488. {
  4489. relativeAdjuster->add_pair(key,-y);
  4490. }
  4491. else
  4492. {
  4493. relativeAdjuster->add_pair(key*(9.0/5.0),-y);
  4494. }
  4495. y-= skip;
  4496. }
  4497. }
  4498. }
  4499. }
  4500. /*:394*/
  4501. #line 8853 "./typica.w"
  4502. /*396:*/
  4503. #line 8986 "./typica.w"
  4504. QGraphicsLineItem*timeaxis= new QGraphicsLineItem;
  4505. timeaxis->setLine(0,10,1200,10);
  4506. theScene->addItem(timeaxis);
  4507. for(int x= 0;x<1201;x+= 120)
  4508. {
  4509. QGraphicsLineItem*tick= new QGraphicsLineItem;
  4510. tick->setLine(x,0,x,20);
  4511. theScene->addItem(tick);
  4512. QGraphicsTextItem*label= new QGraphicsTextItem;
  4513. label->setPlainText(QString("%1").arg(x/60));
  4514. label->setPos(x-(label->boundingRect().width()/2),20);
  4515. theScene->addItem(label);
  4516. }
  4517. /*:396*/
  4518. #line 8854 "./typica.w"
  4519. ;
  4520. fitInView(theScene->sceneRect().adjusted(-50,-50,50,50));
  4521. }
  4522. /*:392*//*395:*/
  4523. #line 8956 "./typica.w"
  4524. void GraphView::showF()
  4525. {
  4526. for(int i= 0;i<gridLinesF->size();i++)
  4527. {
  4528. gridLinesF->at(i)->show();
  4529. }
  4530. for(int i= 0;i<gridLinesC->size();i++)
  4531. {
  4532. gridLinesC->at(i)->hide();
  4533. }
  4534. }
  4535. void GraphView::showC()
  4536. {
  4537. for(int i= 0;i<gridLinesF->size();i++)
  4538. {
  4539. gridLinesF->at(i)->hide();
  4540. }
  4541. for(int i= 0;i<gridLinesC->size();i++)
  4542. {
  4543. gridLinesC->at(i)->show();
  4544. }
  4545. }
  4546. /*:395*//*397:*/
  4547. #line 9005 "./typica.w"
  4548. void GraphView::resizeEvent(QResizeEvent*)
  4549. {
  4550. fitInView(theScene->sceneRect().adjusted(-50,-50,50,50));
  4551. }
  4552. /*:397*//*398:*/
  4553. #line 9019 "./typica.w"
  4554. #define FULLTIMETOINT(t) (t.msec() + (t.second() * 1000) + (t.minute() * 60 * 1000))
  4555. void GraphView::newMeasurement(Measurement measure,int tempcolumn)
  4556. {
  4557. double offset= 0;
  4558. if(measure.contains("relative"))
  4559. {
  4560. if(measure.value("relative").toBool())
  4561. {
  4562. if(relativeEnabled)
  4563. {
  4564. measure.setTemperature(relativeAdjuster->newMeasurement(measure).temperature());
  4565. }
  4566. else
  4567. {
  4568. return;
  4569. }
  4570. }
  4571. }
  4572. if(translations->contains(tempcolumn))
  4573. {
  4574. offset= translations->value(tempcolumn);
  4575. }
  4576. if(prevPoints->contains(tempcolumn))
  4577. {
  4578. /*400:*/
  4579. #line 9096 "./typica.w"
  4580. QGraphicsLineItem*segment= new QGraphicsLineItem;
  4581. QPointF nextPoint(FULLTIMETOINT(measure.time())/1000,measure.temperature());
  4582. segment->setLine(prevPoints->value(tempcolumn).x()+offset,
  4583. -(prevPoints->value(tempcolumn).y()),
  4584. nextPoint.x()+offset,-(nextPoint.y()));
  4585. static QColor p[12]= {Qt::yellow,Qt::blue,Qt::cyan,Qt::red,Qt::magenta,
  4586. Qt::green,Qt::darkGreen,Qt::darkMagenta,
  4587. Qt::darkRed,Qt::darkCyan,Qt::darkBlue,
  4588. Qt::darkYellow};
  4589. segment->setPen(p[tempcolumn%12]);
  4590. theScene->addItem(segment);
  4591. prevPoints->insert(tempcolumn,nextPoint);
  4592. if(timeIndicatorEnabled)
  4593. {
  4594. timeLine->setLine(nextPoint.x()+offset,0,nextPoint.x()+offset,-500);
  4595. }
  4596. /*:400*/
  4597. #line 9045 "./typica.w"
  4598. if(graphLines->contains(tempcolumn))
  4599. {
  4600. graphLines->value(tempcolumn)->append(segment);
  4601. }
  4602. else
  4603. {
  4604. QList<QGraphicsLineItem*> *newLine=
  4605. new QList<QGraphicsLineItem*> ;
  4606. newLine->append(segment);
  4607. graphLines->insert(tempcolumn,newLine);
  4608. }
  4609. }
  4610. else
  4611. {
  4612. /*399:*/
  4613. #line 9081 "./typica.w"
  4614. int x= FULLTIMETOINT(measure.time())/1000;
  4615. prevPoints->insert(tempcolumn,QPointF(x,measure.temperature()));
  4616. if(timeIndicatorEnabled)
  4617. {
  4618. timeLine->setLine(x,0,x,-500);
  4619. }
  4620. /*:399*/
  4621. #line 9062 "./typica.w"
  4622. }
  4623. }
  4624. /*:398*//*401:*/
  4625. #line 9117 "./typica.w"
  4626. void GraphView::clear()
  4627. {
  4628. int i;
  4629. foreach(i,prevPoints->keys())
  4630. {
  4631. removeSeries(i);
  4632. }
  4633. translations->clear();
  4634. }
  4635. /*:401*//*402:*/
  4636. #line 9131 "./typica.w"
  4637. void GraphView::removeSeries(int column)
  4638. {
  4639. if(graphLines->contains(column))
  4640. {
  4641. QList<QGraphicsLineItem*> *series= graphLines->value(column);
  4642. QGraphicsLineItem*segment;
  4643. foreach(segment,*series)
  4644. {
  4645. theScene->removeItem(segment);
  4646. }
  4647. qDeleteAll(*series);
  4648. }
  4649. graphLines->remove(column);
  4650. prevPoints->remove(column);
  4651. }
  4652. /*:402*//*403:*/
  4653. #line 9150 "./typica.w"
  4654. void GraphView::setSeriesTranslation(int column,double offset)
  4655. {
  4656. if(graphLines->contains(column))
  4657. {
  4658. QList<QGraphicsLineItem*> *series= graphLines->value(column);
  4659. QGraphicsLineItem*segment;
  4660. foreach(segment,*series)
  4661. {
  4662. segment->setPos(segment->pos().x()+offset,segment->pos().y());
  4663. }
  4664. }
  4665. if(translations->contains(column))
  4666. {
  4667. translations->insert(column,offset+translations->value(column));
  4668. }
  4669. else
  4670. {
  4671. translations->insert(column,offset);
  4672. }
  4673. }
  4674. /*:403*//*404:*/
  4675. #line 9177 "./typica.w"
  4676. void GraphView::setTimeIndicatorEnabled(bool enabled)
  4677. {
  4678. timeIndicatorEnabled= enabled;
  4679. if(enabled)
  4680. {
  4681. timeLine->show();
  4682. }
  4683. else
  4684. {
  4685. timeLine->hide();
  4686. }
  4687. }
  4688. /*:404*/
  4689. #line 551 "./typica.w"
  4690. /*410:*/
  4691. #line 9324 "./typica.w"
  4692. void ZoomLog::newMeasurement(Measurement measure,int tempcolumn)
  4693. {
  4694. if(measure.time()!=QTime(0,0,0,0))
  4695. {
  4696. /*412:*/
  4697. #line 9398 "./typica.w"
  4698. if(lastMeasurement.contains(tempcolumn))
  4699. {
  4700. if(lastMeasurement[tempcolumn].time()<measure.time())
  4701. {
  4702. QList<QTime> timelist;
  4703. QList<double> templist;
  4704. QTime z= QTime(0,0,0,0);
  4705. double ptime= (double)(z.secsTo(lastMeasurement[tempcolumn].time()));
  4706. double ptemp= lastMeasurement[tempcolumn].temperature();
  4707. double ctime= (double)(z.secsTo(measure.time()));
  4708. double ctemp= measure.temperature();
  4709. for(QTime i= lastMeasurement.value(tempcolumn).time().addSecs(1);i<measure.time();i= i.addSecs(1))
  4710. {
  4711. timelist.append(i);
  4712. double v= ((ptemp*(ctime-z.secsTo(i)))+(ctemp*(z.secsTo(i)-ptime)))/(ctime-ptime);
  4713. templist.append(v);
  4714. }
  4715. for(int i= 0;i<timelist.size();i++)
  4716. {
  4717. Measurement synthesized= measure;
  4718. synthesized.setTime(timelist[i]);
  4719. synthesized.setTemperature(templist[i]);
  4720. newMeasurement(synthesized,tempcolumn);
  4721. }
  4722. }
  4723. }
  4724. /*:412*/
  4725. #line 9329 "./typica.w"
  4726. }
  4727. model_ms->newMeasurement(measure,tempcolumn);
  4728. if(lastMeasurement.contains(tempcolumn))
  4729. {
  4730. if(measure.time().second()!=
  4731. lastMeasurement.value(tempcolumn).time().second())
  4732. {
  4733. Measurement adjusted= measure;
  4734. QTime adjtime(0,measure.time().minute(),measure.time().second(),0);
  4735. adjusted.setTime(adjtime);
  4736. model_1s->newMeasurement(adjusted,tempcolumn);
  4737. if(adjusted.time().second()%5==0)
  4738. {
  4739. model_5s->newMeasurement(adjusted,tempcolumn);
  4740. if(adjusted.time().second()%10==0)
  4741. {
  4742. model_10s->newMeasurement(adjusted,tempcolumn);
  4743. }
  4744. if(adjusted.time().second()%15==0)
  4745. {
  4746. model_15s->newMeasurement(adjusted,tempcolumn);
  4747. if(adjusted.time().second()%30==0)
  4748. {
  4749. model_30s->newMeasurement(adjusted,tempcolumn);
  4750. if(adjusted.time().second()==0)
  4751. {
  4752. model_1m->newMeasurement(adjusted,tempcolumn);
  4753. }
  4754. }
  4755. }
  4756. }
  4757. }
  4758. /*414:*/
  4759. #line 9451 "./typica.w"
  4760. if(currentColumnSet.contains(tempcolumn))
  4761. {
  4762. int replicationcolumn;
  4763. foreach(replicationcolumn,currentColumnSet)
  4764. {
  4765. if(replicationcolumn!=tempcolumn)
  4766. {
  4767. if(lastMeasurement.contains(replicationcolumn))
  4768. {
  4769. if(measure.time()> lastMeasurement.value(replicationcolumn).time())
  4770. {
  4771. Measurement synthetic= lastMeasurement.value(replicationcolumn);
  4772. synthetic.setTime(measure.time());
  4773. model_ms->newMeasurement(synthetic,replicationcolumn);
  4774. if(synthetic.time().second()!=lastMeasurement.value(replicationcolumn).time().second())
  4775. {
  4776. Measurement adjusted= synthetic;
  4777. adjusted.setTime(QTime(0,synthetic.time().minute(),synthetic.time().second(),0));
  4778. model_1s->newMeasurement(adjusted,replicationcolumn);
  4779. if(adjusted.time().second()%5==0)
  4780. {
  4781. model_5s->newMeasurement(adjusted,replicationcolumn);
  4782. if(adjusted.time().second()%10==0)
  4783. {
  4784. model_10s->newMeasurement(adjusted,replicationcolumn);
  4785. }
  4786. if(adjusted.time().second()%15==0)
  4787. {
  4788. model_15s->newMeasurement(adjusted,replicationcolumn);
  4789. if(adjusted.time().second()%30==0)
  4790. {
  4791. model_30s->newMeasurement(adjusted,replicationcolumn);
  4792. if(adjusted.time().second()==0)
  4793. {
  4794. model_1m->newMeasurement(adjusted,replicationcolumn);
  4795. }
  4796. }
  4797. }
  4798. }
  4799. }
  4800. lastMeasurement[replicationcolumn]= synthetic;
  4801. }
  4802. }
  4803. }
  4804. }
  4805. }
  4806. /*:414*/
  4807. #line 9362 "./typica.w"
  4808. }
  4809. else
  4810. {
  4811. /*411:*/
  4812. #line 9374 "./typica.w"
  4813. MeasurementModel*m;
  4814. foreach(m,modelSet)
  4815. {
  4816. m->newMeasurement(measure,tempcolumn);
  4817. }
  4818. /*:411*/
  4819. #line 9366 "./typica.w"
  4820. }
  4821. lastMeasurement.insert(tempcolumn,measure);
  4822. }
  4823. /*:410*//*413:*/
  4824. #line 9437 "./typica.w"
  4825. void ZoomLog::addToCurrentColumnSet(int column)
  4826. {
  4827. currentColumnSet.append(column);
  4828. }
  4829. void ZoomLog::clearCurrentColumnSet()
  4830. {
  4831. currentColumnSet.clear();
  4832. }
  4833. /*:413*//*415:*/
  4834. #line 9521 "./typica.w"
  4835. void ZoomLog::newAnnotation(QString annotation,int tempcolumn,
  4836. int annotationcolumn)
  4837. {
  4838. model_ms->newAnnotation(annotation,tempcolumn,annotationcolumn);
  4839. MeasurementModel*m;
  4840. if(lastMeasurement.contains(tempcolumn))
  4841. {
  4842. foreach(m,modelSet)
  4843. {
  4844. m->newMeasurement(lastMeasurement.value(tempcolumn),tempcolumn);
  4845. }
  4846. }
  4847. foreach(m,modelSet)
  4848. {
  4849. m->newAnnotation(annotation,tempcolumn,annotationcolumn);
  4850. }
  4851. }
  4852. /*:415*//*416:*/
  4853. #line 9545 "./typica.w"
  4854. void ZoomLog::centerOn(int row)
  4855. {
  4856. scrollTo(currentModel->index(row,0),QAbstractItemView::PositionAtCenter);
  4857. }
  4858. /*:416*//*417:*/
  4859. #line 9555 "./typica.w"
  4860. void ZoomLog::clear()
  4861. {
  4862. MeasurementModel*m;
  4863. foreach(m,modelSet)
  4864. {
  4865. m->clear();
  4866. }
  4867. lastMeasurement.clear();
  4868. saveTempCols.clear();
  4869. saveControlCols.clear();
  4870. saveNoteCols.clear();
  4871. }
  4872. /*:417*//*418:*/
  4873. #line 9573 "./typica.w"
  4874. QVariant ZoomLog::data(int row,int column)const
  4875. {
  4876. return model_ms->data(model_ms->index(row,column,QModelIndex()),
  4877. Qt::DisplayRole);
  4878. }
  4879. int ZoomLog::rowCount()
  4880. {
  4881. return model_ms->rowCount();
  4882. }
  4883. /*:418*//*419:*/
  4884. #line 9596 "./typica.w"
  4885. bool ZoomLog::saveXML(QIODevice*device)
  4886. {
  4887. Units::Unit prevUnits= model_ms->displayUnits();
  4888. if(prevUnits!=Units::Fahrenheit)
  4889. {
  4890. model_ms->setDisplayUnits(Units::Fahrenheit);
  4891. }
  4892. XMLOutput writer(model_ms,device,0);
  4893. int c;
  4894. foreach(c,saveTempCols)
  4895. {
  4896. writer.addTemperatureColumn(model_ms->headerData(c,Qt::Horizontal).
  4897. toString(),c);
  4898. }
  4899. foreach(c,saveControlCols)
  4900. {
  4901. writer.addControlColumn(model_ms->headerData(c,Qt::Horizontal).
  4902. toString(),c);
  4903. }
  4904. foreach(c,saveNoteCols)
  4905. {
  4906. writer.addAnnotationColumn(model_ms->headerData(c,Qt::Horizontal).
  4907. toString(),c);
  4908. }
  4909. bool retval= writer.output();
  4910. if(prevUnits!=Units::Fahrenheit)
  4911. {
  4912. model_ms->setDisplayUnits(prevUnits);
  4913. }
  4914. return retval;
  4915. }
  4916. /*:419*//*420:*/
  4917. #line 9632 "./typica.w"
  4918. bool ZoomLog::saveCSV(QIODevice*device)
  4919. {
  4920. CSVOutput writer(currentModel,device,0);
  4921. int c;
  4922. foreach(c,saveTempCols)
  4923. {
  4924. writer.addTemperatureColumn(model_ms->headerData(c,Qt::Horizontal).
  4925. toString(),c);
  4926. }
  4927. foreach(c,saveControlCols)
  4928. {
  4929. writer.addControlColumn(model_ms->headerData(c,Qt::Horizontal).
  4930. toString(),c);
  4931. }
  4932. foreach(c,saveNoteCols)
  4933. {
  4934. writer.addAnnotationColumn(model_ms->headerData(c,Qt::Horizontal).
  4935. toString(),c);
  4936. }
  4937. return writer.output();
  4938. }
  4939. /*:420*//*421:*/
  4940. #line 9661 "./typica.w"
  4941. void ZoomLog::switchLOD(MeasurementModel*m)
  4942. {
  4943. disconnect(currentModel,SIGNAL(rowChanged(int)),this,0);
  4944. setModel(m);
  4945. currentModel= m;
  4946. connect(currentModel,SIGNAL(rowChanged(int)),this,SLOT(centerOn(int)));
  4947. }
  4948. void ZoomLog::LOD_ms()
  4949. {
  4950. switchLOD(model_ms);
  4951. }
  4952. void ZoomLog::LOD_1s()
  4953. {
  4954. switchLOD(model_1s);
  4955. }
  4956. void ZoomLog::LOD_5s()
  4957. {
  4958. switchLOD(model_5s);
  4959. }
  4960. void ZoomLog::LOD_10s()
  4961. {
  4962. switchLOD(model_10s);
  4963. }
  4964. void ZoomLog::LOD_15s()
  4965. {
  4966. switchLOD(model_15s);
  4967. }
  4968. void ZoomLog::LOD_30s()
  4969. {
  4970. switchLOD(model_30s);
  4971. }
  4972. void ZoomLog::LOD_1m()
  4973. {
  4974. switchLOD(model_1m);
  4975. }
  4976. /*:421*//*422:*/
  4977. #line 9709 "./typica.w"
  4978. void ZoomLog::setDisplayUnits(Units::Unit scale)
  4979. {
  4980. model_ms->setDisplayUnits(scale);
  4981. model_1s->setDisplayUnits(scale);
  4982. model_5s->setDisplayUnits(scale);
  4983. model_10s->setDisplayUnits(scale);
  4984. model_15s->setDisplayUnits(scale);
  4985. model_30s->setDisplayUnits(scale);
  4986. model_1m->setDisplayUnits(scale);
  4987. }
  4988. Units::Unit ZoomLog::displayUnits()
  4989. {
  4990. return model_ms->displayUnits();
  4991. }
  4992. /*:422*//*423:*/
  4993. #line 9729 "./typica.w"
  4994. QString ZoomLog::lastTime(int series)
  4995. {
  4996. Measurement measure= lastMeasurement.value(series);
  4997. QTime time= measure.time();
  4998. return time.toString("h:mm:ss.zzz");
  4999. }
  5000. /*:423*//*424:*/
  5001. #line 9739 "./typica.w"
  5002. ZoomLog::ZoomLog():QTableView(NULL),model_ms(new MeasurementModel(this)),
  5003. model_1s(new MeasurementModel(this)),model_5s(new MeasurementModel(this)),
  5004. model_10s(new MeasurementModel(this)),model_15s(new MeasurementModel(this)),
  5005. model_30s(new MeasurementModel(this)),model_1m(new MeasurementModel(this))
  5006. {
  5007. setEditTriggers(QAbstractItemView::NoEditTriggers);
  5008. setSelectionMode(QAbstractItemView::NoSelection);
  5009. modelSet<<model_ms<<model_1s<<model_5s<<model_10s<<model_15s<<
  5010. model_30s<<model_1m;
  5011. currentModel= model_30s;
  5012. setModel(currentModel);
  5013. connect(currentModel,SIGNAL(rowChanged(int)),this,SLOT(centerOn(int)));
  5014. connect(horizontalHeader(),SIGNAL(sectionResized(int,int,int)),
  5015. this,SLOT(persistColumnResize(int,int,int)));
  5016. connect(horizontalHeader(),SIGNAL(sectionCountChanged(int,int)),
  5017. this,SLOT(restoreColumnWidths()));
  5018. }
  5019. /*:424*//*425:*/
  5020. #line 9762 "./typica.w"
  5021. void ZoomLog::setHeaderData(int section,QString text)
  5022. {
  5023. MeasurementModel*m;
  5024. foreach(m,modelSet)
  5025. {
  5026. m->setHeaderData(section,Qt::Horizontal,QVariant(text));
  5027. }
  5028. }
  5029. /*:425*//*426:*/
  5030. #line 9780 "./typica.w"
  5031. void ZoomLog::addOutputTemperatureColumn(int column)
  5032. {
  5033. saveTempCols.append(column);
  5034. }
  5035. void ZoomLog::addOutputControlColumn(int column)
  5036. {
  5037. saveControlCols.append(column);
  5038. }
  5039. void ZoomLog::addOutputAnnotationColumn(int column)
  5040. {
  5041. saveNoteCols.append(column);
  5042. }
  5043. void ZoomLog::clearOutputColumns()
  5044. {
  5045. saveTempCols.clear();
  5046. saveControlCols.clear();
  5047. saveNoteCols.clear();
  5048. }
  5049. /*:426*//*427:*/
  5050. #line 9806 "./typica.w"
  5051. void ZoomLog::persistColumnResize(int column,int,int newsize)
  5052. {
  5053. /*653:*/
  5054. #line 13988 "./typica.w"
  5055. QSettings settings;
  5056. /*654:*/
  5057. #line 14001 "./typica.w"
  5058. QWidget*topLevelWidget= this;
  5059. while(topLevelWidget->parentWidget())
  5060. {
  5061. topLevelWidget= topLevelWidget->parentWidget();
  5062. }
  5063. /*:654*/
  5064. #line 13990 "./typica.w"
  5065. settings.setValue(QString("columnWidths/%1/%2/%3").
  5066. arg(topLevelWidget->objectName()).
  5067. arg(objectName()).arg(column),
  5068. QVariant(newsize));
  5069. /*:653*/
  5070. #line 9809 "./typica.w"
  5071. }
  5072. void ZoomLog::restoreColumnWidths()
  5073. {
  5074. /*656:*/
  5075. #line 14021 "./typica.w"
  5076. QSettings settings;
  5077. /*654:*/
  5078. #line 14001 "./typica.w"
  5079. QWidget*topLevelWidget= this;
  5080. while(topLevelWidget->parentWidget())
  5081. {
  5082. topLevelWidget= topLevelWidget->parentWidget();
  5083. }
  5084. /*:654*/
  5085. #line 14023 "./typica.w"
  5086. QString baseKey=
  5087. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  5088. arg(objectName());
  5089. for(int i= 0;i<model()->columnCount();i++)
  5090. {
  5091. QString key= QString("%1/%2").arg(baseKey).arg(i);
  5092. if(settings.contains(key))
  5093. {
  5094. setColumnWidth(i,settings.value(key).toInt());
  5095. }
  5096. }
  5097. /*:656*/
  5098. #line 9814 "./typica.w"
  5099. }
  5100. void ZoomLog::setVisible(bool visibility)
  5101. {
  5102. QTableView::setVisible(visibility);
  5103. }
  5104. void ZoomLog::showEvent(QShowEvent*)
  5105. {
  5106. /*656:*/
  5107. #line 14021 "./typica.w"
  5108. QSettings settings;
  5109. /*654:*/
  5110. #line 14001 "./typica.w"
  5111. QWidget*topLevelWidget= this;
  5112. while(topLevelWidget->parentWidget())
  5113. {
  5114. topLevelWidget= topLevelWidget->parentWidget();
  5115. }
  5116. /*:654*/
  5117. #line 14023 "./typica.w"
  5118. QString baseKey=
  5119. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  5120. arg(objectName());
  5121. for(int i= 0;i<model()->columnCount();i++)
  5122. {
  5123. QString key= QString("%1/%2").arg(baseKey).arg(i);
  5124. if(settings.contains(key))
  5125. {
  5126. setColumnWidth(i,settings.value(key).toInt());
  5127. }
  5128. }
  5129. /*:656*/
  5130. #line 9824 "./typica.w"
  5131. }
  5132. /*:427*/
  5133. #line 552 "./typica.w"
  5134. /*436:*/
  5135. #line 10057 "./typica.w"
  5136. bool MeasurementList::operator<(const MeasurementList&other)const
  5137. {
  5138. return this->first().toTime()<other.first().toTime();
  5139. }
  5140. bool MeasurementList::operator==(const MeasurementList&other)const
  5141. {
  5142. return this->first().toTime()==other.first().toTime();
  5143. }
  5144. /*:436*//*437:*/
  5145. #line 10073 "./typica.w"
  5146. QModelIndex MeasurementModel::parent(const QModelIndex&)const
  5147. {
  5148. return QModelIndex();
  5149. }
  5150. /*:437*//*438:*/
  5151. #line 10083 "./typica.w"
  5152. void MeasurementModel::newMeasurement(Measurement measure,int tempcolumn)
  5153. {
  5154. if(measure.scale()==Units::Unitless)
  5155. {
  5156. controlColumns->insert(tempcolumn,true);
  5157. }
  5158. else
  5159. {
  5160. controlColumns->insert(tempcolumn,false);
  5161. }
  5162. MeasurementList*temp;
  5163. temp= new MeasurementList;
  5164. temp->append(QVariant(measure.time()));
  5165. /*439:*/
  5166. #line 10142 "./typica.w"
  5167. /*440:*/
  5168. #line 10187 "./typica.w"
  5169. QList<MeasurementList*> ::iterator i= lastInsertion;
  5170. bool quickscan= false;
  5171. if(entries->size()> 5)
  5172. {
  5173. if(**i<*temp)
  5174. {
  5175. i+= 1;
  5176. for(int j= 10;j> 0;j--)
  5177. {
  5178. if(i!=entries->end())
  5179. {
  5180. if(**i<*temp)
  5181. {
  5182. i+= 1;
  5183. }
  5184. else
  5185. {
  5186. quickscan= true;
  5187. break;
  5188. }
  5189. }
  5190. else
  5191. {
  5192. quickscan= true;
  5193. break;
  5194. }
  5195. }
  5196. }
  5197. else
  5198. {
  5199. if(**i==*temp)
  5200. {
  5201. quickscan= true;
  5202. }
  5203. }
  5204. }
  5205. /*:440*/
  5206. #line 10143 "./typica.w"
  5207. if(quickscan==false)
  5208. {
  5209. i= entries->begin();
  5210. QList<MeasurementList*> ::iterator u= entries->end();
  5211. QList<MeasurementList*> ::iterator midpoint;
  5212. int n= u-i;
  5213. int rA;
  5214. while(n> 0)
  5215. {
  5216. rA= n>>1;
  5217. midpoint= i+rA;
  5218. if(**midpoint<*temp)
  5219. {
  5220. i= midpoint+1;
  5221. n-= rA+1;
  5222. }
  5223. else
  5224. {
  5225. n= rA;
  5226. }
  5227. }
  5228. }
  5229. /*:439*/
  5230. #line 10097 "./typica.w"
  5231. MeasurementList*newEntry;
  5232. int insertion;
  5233. if(i!=entries->end())
  5234. {
  5235. insertion= entries->indexOf(*i);
  5236. if((*i)->first().toTime()==measure.time())
  5237. {
  5238. /*441:*/
  5239. #line 10229 "./typica.w"
  5240. if((*i)->size()<tempcolumn+1)
  5241. {
  5242. for(int j= (*i)->size()-1;j<tempcolumn+1;j++)
  5243. {
  5244. (*i)->append(QVariant());
  5245. }
  5246. }
  5247. (*i)->replace(tempcolumn,measure);
  5248. lastInsertion= i;
  5249. emit dataChanged(createIndex(insertion,tempcolumn),
  5250. createIndex(insertion,tempcolumn));
  5251. lastTemperature->insert(tempcolumn,insertion);
  5252. /*:441*/
  5253. #line 10105 "./typica.w"
  5254. }
  5255. else
  5256. {
  5257. /*442:*/
  5258. #line 10247 "./typica.w"
  5259. beginInsertRows(QModelIndex(),insertion,insertion);
  5260. newEntry= new MeasurementList;
  5261. newEntry->append(QVariant(measure.time()));
  5262. for(int j= 0;j<tempcolumn+1;j++)
  5263. {
  5264. newEntry->append(QVariant());
  5265. }
  5266. newEntry->replace(tempcolumn,measure);
  5267. lastInsertion= entries->insert(i,newEntry);
  5268. endInsertRows();
  5269. lastTemperature->insert(tempcolumn,insertion);
  5270. /*:442*/
  5271. #line 10109 "./typica.w"
  5272. }
  5273. }
  5274. else
  5275. {
  5276. /*443:*/
  5277. #line 10265 "./typica.w"
  5278. insertion= entries->size();
  5279. /*442:*/
  5280. #line 10247 "./typica.w"
  5281. beginInsertRows(QModelIndex(),insertion,insertion);
  5282. newEntry= new MeasurementList;
  5283. newEntry->append(QVariant(measure.time()));
  5284. for(int j= 0;j<tempcolumn+1;j++)
  5285. {
  5286. newEntry->append(QVariant());
  5287. }
  5288. newEntry->replace(tempcolumn,measure);
  5289. lastInsertion= entries->insert(i,newEntry);
  5290. endInsertRows();
  5291. lastTemperature->insert(tempcolumn,insertion);
  5292. /*:442*/
  5293. #line 10267 "./typica.w"
  5294. /*:443*/
  5295. #line 10114 "./typica.w"
  5296. }
  5297. if(tempcolumn>=colcount)
  5298. {
  5299. colcount= tempcolumn+1;
  5300. }
  5301. emit rowChanged(insertion);
  5302. delete temp;
  5303. }
  5304. /*:438*//*444:*/
  5305. #line 10277 "./typica.w"
  5306. void MeasurementModel::newAnnotation(QString annotation,int tempcolumn,
  5307. int annotationColumn)
  5308. {
  5309. int r;
  5310. if(lastTemperature->contains(tempcolumn))
  5311. {
  5312. r= lastTemperature->value(tempcolumn);
  5313. }
  5314. else
  5315. {
  5316. r= 0;
  5317. }
  5318. if(r==0&&entries->size()==0)
  5319. {
  5320. /*445:*/
  5321. #line 10315 "./typica.w"
  5322. beginInsertRows(QModelIndex(),0,0);
  5323. MeasurementList*newEntry= new MeasurementList;
  5324. newEntry->append(QVariant(QTime(0,0,0,0)));
  5325. entries->append(newEntry);
  5326. endInsertRows();
  5327. /*:445*/
  5328. #line 10292 "./typica.w"
  5329. }
  5330. MeasurementList*row= entries->at(r);
  5331. if(row->size()<=annotationColumn)
  5332. {
  5333. for(int i= row->size()-1;i<annotationColumn+1;i++)
  5334. {
  5335. row->append(QVariant());
  5336. }
  5337. }
  5338. row->replace(annotationColumn,annotation);
  5339. emit dataChanged(createIndex(r,annotationColumn),
  5340. createIndex(r,annotationColumn));
  5341. emit rowChanged(r);
  5342. if(annotationColumn> colcount-1)
  5343. {
  5344. colcount= annotationColumn+1;
  5345. }
  5346. }
  5347. /*:444*//*446:*/
  5348. #line 10326 "./typica.w"
  5349. void MeasurementModel::clear()
  5350. {
  5351. beginRemoveRows(QModelIndex(),0,entries->size());
  5352. while(entries->size()!=0)
  5353. {
  5354. MeasurementList*row= entries->takeFirst();
  5355. delete row;
  5356. }
  5357. endRemoveRows();
  5358. colcount= hData->size();
  5359. lastTemperature->clear();
  5360. reset();
  5361. }
  5362. /*:446*//*447:*/
  5363. #line 10359 "./typica.w"
  5364. bool MeasurementModel::setData(const QModelIndex&index,
  5365. const QVariant&value,int role)
  5366. {
  5367. if(role!=Qt::EditRole&&role!=Qt::DisplayRole)
  5368. {
  5369. return false;
  5370. }
  5371. /*448:*/
  5372. #line 10391 "./typica.w"
  5373. bool valid= false;
  5374. if(index.isValid())
  5375. {
  5376. if(index.row()<entries->size())
  5377. {
  5378. if(index.column()<colcount)
  5379. {
  5380. valid= true;
  5381. }
  5382. }
  5383. }
  5384. /*:448*/
  5385. #line 10367 "./typica.w"
  5386. if(!valid)
  5387. {
  5388. return false;
  5389. }
  5390. MeasurementList*row= entries->at(index.row());
  5391. if(index.column()>=row->size())
  5392. {
  5393. /*449:*/
  5394. #line 10408 "./typica.w"
  5395. for(int i= row->size()-1;i<index.column();i++)
  5396. {
  5397. row->append(QVariant());
  5398. }
  5399. /*:449*/
  5400. #line 10375 "./typica.w"
  5401. }
  5402. if(index.column()==0)
  5403. {
  5404. /*450:*/
  5405. #line 10423 "./typica.w"
  5406. QTime time;
  5407. if(!(time= QTime::fromString(value.toString(),"m:s.z")).isValid())
  5408. {
  5409. if(!(time= QTime::fromString(value.toString(),"m:s")).isValid())
  5410. {
  5411. return false;
  5412. }
  5413. }
  5414. row= entries->takeAt(index.row());
  5415. row->replace(index.column(),QVariant(time));
  5416. MeasurementList*temp= row;
  5417. /*439:*/
  5418. #line 10142 "./typica.w"
  5419. /*440:*/
  5420. #line 10187 "./typica.w"
  5421. QList<MeasurementList*> ::iterator i= lastInsertion;
  5422. bool quickscan= false;
  5423. if(entries->size()> 5)
  5424. {
  5425. if(**i<*temp)
  5426. {
  5427. i+= 1;
  5428. for(int j= 10;j> 0;j--)
  5429. {
  5430. if(i!=entries->end())
  5431. {
  5432. if(**i<*temp)
  5433. {
  5434. i+= 1;
  5435. }
  5436. else
  5437. {
  5438. quickscan= true;
  5439. break;
  5440. }
  5441. }
  5442. else
  5443. {
  5444. quickscan= true;
  5445. break;
  5446. }
  5447. }
  5448. }
  5449. else
  5450. {
  5451. if(**i==*temp)
  5452. {
  5453. quickscan= true;
  5454. }
  5455. }
  5456. }
  5457. /*:440*/
  5458. #line 10143 "./typica.w"
  5459. if(quickscan==false)
  5460. {
  5461. i= entries->begin();
  5462. QList<MeasurementList*> ::iterator u= entries->end();
  5463. QList<MeasurementList*> ::iterator midpoint;
  5464. int n= u-i;
  5465. int rA;
  5466. while(n> 0)
  5467. {
  5468. rA= n>>1;
  5469. midpoint= i+rA;
  5470. if(**midpoint<*temp)
  5471. {
  5472. i= midpoint+1;
  5473. n-= rA+1;
  5474. }
  5475. else
  5476. {
  5477. n= rA;
  5478. }
  5479. }
  5480. }
  5481. /*:439*/
  5482. #line 10435 "./typica.w"
  5483. entries->insert(i,row);
  5484. int newRow= entries->indexOf(*i);
  5485. if(newRow<index.row())
  5486. {
  5487. emit dataChanged(createIndex(newRow,index.column()),index);
  5488. }
  5489. else
  5490. {
  5491. emit dataChanged(index,createIndex(newRow,index.column()));
  5492. }
  5493. /*:450*/
  5494. #line 10379 "./typica.w"
  5495. }
  5496. else
  5497. {
  5498. /*451:*/
  5499. #line 10449 "./typica.w"
  5500. row->replace(index.column(),value);
  5501. emit dataChanged(index,index);
  5502. /*:451*/
  5503. #line 10383 "./typica.w"
  5504. }
  5505. return true;
  5506. }
  5507. /*:447*//*452:*/
  5508. #line 10457 "./typica.w"
  5509. MeasurementModel::MeasurementModel(QObject*parent):QAbstractItemModel(parent),
  5510. unit(Units::Fahrenheit),hData(new QStringList),
  5511. lastTemperature(new QHash<int,int> ),
  5512. controlColumns(new QHash<int,bool> )
  5513. {
  5514. colcount= 1;
  5515. entries= new QList<MeasurementList*> ;
  5516. lastInsertion= entries->begin();
  5517. hData->append(tr("Time"));
  5518. }
  5519. /*:452*//*453:*/
  5520. #line 10471 "./typica.w"
  5521. MeasurementModel::~MeasurementModel()
  5522. {
  5523. clear();
  5524. delete entries;
  5525. delete hData;
  5526. }
  5527. /*:453*//*454:*/
  5528. #line 10483 "./typica.w"
  5529. int MeasurementModel::rowCount(const QModelIndex&parent)const
  5530. {
  5531. if(parent==QModelIndex())
  5532. {
  5533. return entries->size();
  5534. }
  5535. return 0;
  5536. }
  5537. int MeasurementModel::columnCount(const QModelIndex&parent)const
  5538. {
  5539. if(parent==QModelIndex())
  5540. {
  5541. return colcount;
  5542. }
  5543. return 0;
  5544. }
  5545. /*:454*//*455:*/
  5546. #line 10510 "./typica.w"
  5547. bool MeasurementModel::setHeaderData(int section,Qt::Orientation orientation,
  5548. const QVariant&value,int)
  5549. {
  5550. if(orientation==Qt::Horizontal)
  5551. {
  5552. if(hData->size()<section+1)
  5553. {
  5554. for(int i= hData->size();i<section+1;i++)
  5555. {
  5556. if(colcount<i)
  5557. {
  5558. beginInsertColumns(QModelIndex(),i,i);
  5559. }
  5560. hData->append(QString());
  5561. if(colcount<i)
  5562. {
  5563. endInsertColumns();
  5564. }
  5565. }
  5566. }
  5567. hData->replace(section,value.toString());
  5568. emit headerDataChanged(orientation,section,section);
  5569. if(colcount<section+1)
  5570. {
  5571. colcount= section+1;
  5572. }
  5573. return true;
  5574. }
  5575. return false;
  5576. }
  5577. /*:455*//*456:*/
  5578. #line 10550 "./typica.w"
  5579. void MeasurementModel::setDisplayUnits(Units::Unit scale)
  5580. {
  5581. beginResetModel();
  5582. unit= scale;
  5583. endResetModel();
  5584. }
  5585. Units::Unit MeasurementModel::displayUnits()
  5586. {
  5587. return unit;
  5588. }
  5589. /*:456*//*457:*/
  5590. #line 10576 "./typica.w"
  5591. QVariant MeasurementModel::data(const QModelIndex&index,int role)const
  5592. {
  5593. /*448:*/
  5594. #line 10391 "./typica.w"
  5595. bool valid= false;
  5596. if(index.isValid())
  5597. {
  5598. if(index.row()<entries->size())
  5599. {
  5600. if(index.column()<colcount)
  5601. {
  5602. valid= true;
  5603. }
  5604. }
  5605. }
  5606. /*:448*/
  5607. #line 10579 "./typica.w"
  5608. if(!valid)
  5609. {
  5610. return QVariant();
  5611. }
  5612. MeasurementList*row= entries->at(index.row());
  5613. if(role==Qt::UserRole)
  5614. {
  5615. return QVariant(row->at(index.column()));
  5616. }
  5617. if(role==Qt::DisplayRole||role==Qt::EditRole)
  5618. {
  5619. if(index.column()> row->size())
  5620. {
  5621. return QVariant();
  5622. }
  5623. else
  5624. {
  5625. if(index.column()==0)
  5626. {
  5627. return QVariant(row->at(0).toTime().toString("mm:ss.zzz"));
  5628. }
  5629. else if(lastTemperature->contains(index.column()))
  5630. {
  5631. QVariantMap v= row->at(index.column()).toMap();
  5632. if(!v.contains("measurement"))
  5633. {
  5634. return QVariant();
  5635. }
  5636. if((Units::Unit)(v.value("unit").toInt())==Units::Unitless)
  5637. {
  5638. return v.value("measurement");
  5639. }
  5640. else
  5641. {
  5642. if(v.contains("relative"))
  5643. {
  5644. if(v.value("relative").toBool())
  5645. {
  5646. return QVariant(QString("%1").arg(Units::convertRelativeTemperature(v.value("measurement").
  5647. toDouble(),(Units::Unit)(v.value("unit").toInt()),unit)));
  5648. }
  5649. }
  5650. return QVariant(QString("%1").
  5651. arg(Units::convertTemperature(v.value("measurement").toDouble(),
  5652. (Units::Unit)(v.value("unit").toInt()),unit)));
  5653. }
  5654. }
  5655. return QVariant(row->at(index.column()).toString());
  5656. }
  5657. }
  5658. return QVariant();
  5659. }
  5660. /*:457*//*458:*/
  5661. #line 10635 "./typica.w"
  5662. QVariant MeasurementModel::headerData(int section,Qt::Orientation orientation,
  5663. int role)const
  5664. {
  5665. if(orientation==Qt::Horizontal)
  5666. {
  5667. if(role==Qt::DisplayRole)
  5668. {
  5669. if(section<hData->size())
  5670. {
  5671. return QVariant(hData->at(section));
  5672. }
  5673. }
  5674. }
  5675. return QVariant();
  5676. }
  5677. /*:458*//*459:*/
  5678. #line 10662 "./typica.w"
  5679. Qt::ItemFlags MeasurementModel::flags(const QModelIndex&index)const
  5680. {
  5681. /*448:*/
  5682. #line 10391 "./typica.w"
  5683. bool valid= false;
  5684. if(index.isValid())
  5685. {
  5686. if(index.row()<entries->size())
  5687. {
  5688. if(index.column()<colcount)
  5689. {
  5690. valid= true;
  5691. }
  5692. }
  5693. }
  5694. /*:448*/
  5695. #line 10665 "./typica.w"
  5696. if(valid)
  5697. {
  5698. return Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable;
  5699. }
  5700. return 0;
  5701. }
  5702. /*:459*//*460:*/
  5703. #line 10677 "./typica.w"
  5704. QModelIndex MeasurementModel::index(int row,int column,
  5705. const QModelIndex&parent)const
  5706. {
  5707. if(parent==QModelIndex())
  5708. {
  5709. if(row<entries->size()&&entries->isEmpty()==false)
  5710. {
  5711. if(column<entries->at(row)->size())
  5712. {
  5713. return createIndex(row,column);
  5714. }
  5715. }
  5716. }
  5717. return QModelIndex();
  5718. }
  5719. /*:460*/
  5720. #line 553 "./typica.w"
  5721. /*462:*/
  5722. #line 10728 "./typica.w"
  5723. AnnotationButton::AnnotationButton(const QString&text,QWidget*parent):
  5724. QPushButton(text,parent),note(""),tc(0),ac(0),count(0)
  5725. {
  5726. connect(this,SIGNAL(clicked()),this,SLOT(annotate()));
  5727. }
  5728. /*:462*//*463:*/
  5729. #line 10743 "./typica.w"
  5730. void AnnotationButton::annotate()
  5731. {
  5732. if(note.contains("%1"))
  5733. {
  5734. count++;
  5735. emit annotation(note.arg(count),tc,ac);
  5736. }
  5737. else
  5738. {
  5739. emit annotation(note,tc,ac);
  5740. }
  5741. }
  5742. /*:463*//*464:*/
  5743. #line 10761 "./typica.w"
  5744. void AnnotationButton::setTemperatureColumn(int tempcolumn)
  5745. {
  5746. tc= tempcolumn;
  5747. }
  5748. void AnnotationButton::setAnnotationColumn(int annotationcolumn)
  5749. {
  5750. ac= annotationcolumn;
  5751. }
  5752. void AnnotationButton::setAnnotation(const QString&annotation)
  5753. {
  5754. note= annotation;
  5755. }
  5756. /*:464*//*465:*/
  5757. #line 10780 "./typica.w"
  5758. void AnnotationButton::resetCount()
  5759. {
  5760. count= 0;
  5761. }
  5762. /*:465*/
  5763. #line 554 "./typica.w"
  5764. /*470:*/
  5765. #line 10863 "./typica.w"
  5766. AnnotationSpinBox::AnnotationSpinBox(const QString&pret,
  5767. const QString&postt,
  5768. QWidget*parent)
  5769. :QDoubleSpinBox(parent),pretext(pret),posttext(postt)
  5770. {
  5771. resetChange();
  5772. connect(this,SIGNAL(editingFinished()),this,SLOT(annotate()));
  5773. connect(this,SIGNAL(valueChanged(double)),this,SLOT(resetChange()));
  5774. }
  5775. /*:470*//*471:*/
  5776. #line 10880 "./typica.w"
  5777. void AnnotationSpinBox::resetChange()
  5778. {
  5779. change= true;
  5780. }
  5781. /*:471*//*472:*/
  5782. #line 10891 "./typica.w"
  5783. void AnnotationSpinBox::annotate()
  5784. {
  5785. if(change)
  5786. {
  5787. change= false;
  5788. emit annotation(QString("%1%2%3").arg(pretext).
  5789. arg(value()).arg(posttext),tc,ac);
  5790. }
  5791. }
  5792. /*:472*//*473:*/
  5793. #line 10904 "./typica.w"
  5794. void AnnotationSpinBox::setTemperatureColumn(int tempcolumn)
  5795. {
  5796. tc= tempcolumn;
  5797. }
  5798. void AnnotationSpinBox::setAnnotationColumn(int annotationcolumn)
  5799. {
  5800. ac= annotationcolumn;
  5801. }
  5802. void AnnotationSpinBox::setPretext(const QString&pret)
  5803. {
  5804. pretext= pret;
  5805. }
  5806. void AnnotationSpinBox::setPosttext(const QString&postt)
  5807. {
  5808. posttext= postt;
  5809. }
  5810. /*:473*/
  5811. #line 555 "./typica.w"
  5812. /*480:*/
  5813. #line 11073 "./typica.w"
  5814. TimerDisplay::TimerDisplay(QWidget*parent):QLCDNumber(8,parent),
  5815. s(QTime(0,0,0)),r(QTime(0,0,0)),clock(NULL),m(TimerDisplay::CountUp),
  5816. running(false),ar(false),startAction(new QAction(tr("Start"),NULL)),
  5817. stopAction(new QAction(tr("Stop"),NULL)),
  5818. resetAction(new QAction(tr("Reset"),NULL)),f(QString("hh:mm:ss")),
  5819. relative(QTime::currentTime()),base(QTime(0,0,0))
  5820. {
  5821. connect(startAction,SIGNAL(triggered(bool)),this,SLOT(startTimer()));
  5822. connect(stopAction,SIGNAL(triggered(bool)),this,SLOT(stopTimer()));
  5823. connect(resetAction,SIGNAL(triggered(bool)),this,SLOT(reset()));
  5824. clock.setInterval(500);
  5825. clock.setSingleShot(false);
  5826. connect(&clock,SIGNAL(timeout()),this,SLOT(updateTime()));
  5827. setSegmentStyle(Filled);
  5828. updateDisplay();
  5829. }
  5830. /*:480*//*481:*/
  5831. #line 11094 "./typica.w"
  5832. void TimerDisplay::updateTime()
  5833. {
  5834. QTime time;
  5835. int cseconds= 0;
  5836. int oseconds= 0;
  5837. int r= 0;
  5838. QTime nt= QTime(0,0,0);
  5839. int n= 0;
  5840. int bseconds= 0;
  5841. switch(m)
  5842. {
  5843. case TimerDisplay::CountUp:
  5844. /*482:*/
  5845. #line 11126 "./typica.w"
  5846. /*483:*/
  5847. #line 11139 "./typica.w"
  5848. #define TIMETOINT(t) ((t.hour() * 60 * 60) + (t.minute() * 60) + (t.second()))
  5849. time= QTime::currentTime();
  5850. cseconds= TIMETOINT(time);
  5851. oseconds= TIMETOINT(relative);
  5852. r= cseconds-oseconds;
  5853. /*:483*/
  5854. #line 11127 "./typica.w"
  5855. nt= nt.addSecs(r);
  5856. if(nt!=s)
  5857. {
  5858. s= nt;
  5859. emit valueChanged(s);
  5860. }
  5861. /*:482*/
  5862. #line 11107 "./typica.w"
  5863. ;
  5864. break;
  5865. case TimerDisplay::CountDown:
  5866. /*484:*/
  5867. #line 11151 "./typica.w"
  5868. if(s> QTime(0,0,0))
  5869. {
  5870. /*483:*/
  5871. #line 11139 "./typica.w"
  5872. #define TIMETOINT(t) ((t.hour() * 60 * 60) + (t.minute() * 60) + (t.second()))
  5873. time= QTime::currentTime();
  5874. cseconds= TIMETOINT(time);
  5875. oseconds= TIMETOINT(relative);
  5876. r= cseconds-oseconds;
  5877. /*:483*/
  5878. #line 11154 "./typica.w"
  5879. bseconds= TIMETOINT(base);
  5880. n= bseconds-r;
  5881. nt= nt.addSecs(n);
  5882. if(nt!=s)
  5883. {
  5884. s= nt;
  5885. emit valueChanged(s);
  5886. }
  5887. }else{
  5888. stopTimer();
  5889. }
  5890. /*:484*/
  5891. #line 11110 "./typica.w"
  5892. ;
  5893. break;
  5894. case TimerDisplay::Clock:
  5895. /*485:*/
  5896. #line 11170 "./typica.w"
  5897. time= QTime::currentTime();
  5898. if(time!=s)
  5899. {
  5900. s= time;
  5901. emit valueChanged(s);
  5902. }
  5903. /*:485*/
  5904. #line 11113 "./typica.w"
  5905. ;
  5906. break;
  5907. default:
  5908. Q_ASSERT_X(false,"updateTime","invalid timer mode");
  5909. break;
  5910. }
  5911. updateDisplay();
  5912. }
  5913. /*:481*//*486:*/
  5914. #line 11182 "./typica.w"
  5915. #define TIMESUBTRACT(t1, t2) (t1.addSecs(-(TIMETOINT(t2))).addSecs(-t2.msec()))
  5916. void TimerDisplay::startTimer()
  5917. {
  5918. if(!running)
  5919. {
  5920. relative= QTime::currentTime();
  5921. if(ar)
  5922. {
  5923. reset();
  5924. }
  5925. else
  5926. {
  5927. relative= TIMESUBTRACT(relative,s);
  5928. }
  5929. if(m==Clock)
  5930. {
  5931. updateTime();
  5932. }
  5933. base= s;
  5934. clock.start();
  5935. running= true;
  5936. emit runStateChanged(true);
  5937. }
  5938. }
  5939. /*:486*//*487:*/
  5940. #line 11212 "./typica.w"
  5941. void TimerDisplay::stopTimer()
  5942. {
  5943. if(running)
  5944. {
  5945. clock.stop();
  5946. running= false;
  5947. emit runStateChanged(false);
  5948. }
  5949. }
  5950. /*:487*//*488:*/
  5951. #line 11225 "./typica.w"
  5952. TimerDisplay::~TimerDisplay()
  5953. {
  5954. clock.stop();
  5955. }
  5956. /*:488*//*489:*/
  5957. #line 11234 "./typica.w"
  5958. void TimerDisplay::setCountUpMode()
  5959. {
  5960. m= TimerDisplay::CountUp;
  5961. }
  5962. void TimerDisplay::setCountDownMode()
  5963. {
  5964. m= TimerDisplay::CountDown;
  5965. }
  5966. void TimerDisplay::setClockMode()
  5967. {
  5968. m= TimerDisplay::Clock;
  5969. }
  5970. /*:489*//*490:*/
  5971. #line 11252 "./typica.w"
  5972. QString TimerDisplay::value()
  5973. {
  5974. return s.toString(f);
  5975. }
  5976. QTime TimerDisplay::seconds()
  5977. {
  5978. return s;
  5979. }
  5980. TimerDisplay::TimerMode TimerDisplay::mode()
  5981. {
  5982. return m;
  5983. }
  5984. bool TimerDisplay::isRunning()
  5985. {
  5986. return running;
  5987. }
  5988. QTime TimerDisplay::resetValue()
  5989. {
  5990. return r;
  5991. }
  5992. QString TimerDisplay::displayFormat()
  5993. {
  5994. return f;
  5995. }
  5996. bool TimerDisplay::autoReset()
  5997. {
  5998. return ar;
  5999. }
  6000. /*:490*//*491:*/
  6001. #line 11290 "./typica.w"
  6002. void TimerDisplay::setTimer(QTime value)
  6003. {
  6004. if(value.isValid())
  6005. {
  6006. s= value;
  6007. updateDisplay();
  6008. emit valueChanged(value);
  6009. }
  6010. }
  6011. void TimerDisplay::setMode(TimerDisplay::TimerMode mode)
  6012. {
  6013. m= mode;
  6014. }
  6015. void TimerDisplay::setResetValue(QTime value)
  6016. {
  6017. r= value;
  6018. }
  6019. void TimerDisplay::setDisplayFormat(QString format)
  6020. {
  6021. f= format;
  6022. setNumDigits(format.length());
  6023. }
  6024. void TimerDisplay::setAutoReset(bool reset)
  6025. {
  6026. ar= reset;
  6027. }
  6028. /*:491*//*492:*/
  6029. #line 11325 "./typica.w"
  6030. void TimerDisplay::copyTimer()
  6031. {
  6032. QApplication::clipboard()->setText(value());
  6033. }
  6034. /*:492*//*493:*/
  6035. #line 11334 "./typica.w"
  6036. void TimerDisplay::reset()
  6037. {
  6038. if(!running)
  6039. {
  6040. s= r;
  6041. updateDisplay();
  6042. }
  6043. }
  6044. /*:493*//*494:*/
  6045. #line 11347 "./typica.w"
  6046. void TimerDisplay::updateDisplay()
  6047. {
  6048. display(value());
  6049. }
  6050. /*:494*/
  6051. #line 556 "./typica.w"
  6052. /*501:*/
  6053. #line 11472 "./typica.w"
  6054. int PackLayout::doLayout(const QRect&rect,bool testOnly)const
  6055. {
  6056. int x= rect.x();
  6057. int y= rect.y();
  6058. QLayoutItem*item;
  6059. if(orientation==Qt::Horizontal)
  6060. {
  6061. /*502:*/
  6062. #line 11496 "./typica.w"
  6063. foreach(item,itemList)
  6064. {
  6065. int nextX= x+item->sizeHint().width()+spacing();
  6066. int right= x+item->sizeHint().width();
  6067. if(item==itemList.last())
  6068. {
  6069. right= rect.right();
  6070. }
  6071. int bottom= rect.bottom();
  6072. if(!testOnly)
  6073. {
  6074. item->setGeometry(QRect(QPoint(x,y),QPoint(right,bottom)));
  6075. }
  6076. x= nextX;
  6077. }
  6078. /*:502*/
  6079. #line 11480 "./typica.w"
  6080. }
  6081. else
  6082. {
  6083. /*503:*/
  6084. #line 11515 "./typica.w"
  6085. foreach(item,itemList)
  6086. {
  6087. int nextY= y+item->sizeHint().height()+spacing();
  6088. int bottom= y+item->sizeHint().height();
  6089. if(item==itemList.last())
  6090. {
  6091. bottom= rect.bottom();
  6092. }
  6093. int right= rect.right();
  6094. if(!testOnly)
  6095. {
  6096. item->setGeometry(QRect(QPoint(x,y),QPoint(right,bottom)));
  6097. }
  6098. y= nextY;
  6099. }
  6100. /*:503*/
  6101. #line 11484 "./typica.w"
  6102. }
  6103. return y;
  6104. }
  6105. /*:501*//*504:*/
  6106. #line 11539 "./typica.w"
  6107. QSize PackLayout::minimumSize()const
  6108. {
  6109. QSize size;
  6110. QLayoutItem*item;
  6111. foreach(item,itemList)
  6112. {
  6113. if(orientation==Qt::Horizontal)
  6114. {
  6115. size+= QSize(item->minimumSize().width(),0);
  6116. if(size.height()<item->minimumSize().height())
  6117. {
  6118. size.setHeight(item->minimumSize().height());
  6119. }
  6120. }
  6121. else
  6122. {
  6123. size+= QSize(0,item->minimumSize().height());
  6124. if(size.width()<item->minimumSize().width())
  6125. {
  6126. size.setWidth(item->minimumSize().width());
  6127. }
  6128. }
  6129. }
  6130. size+= QSize(2*margin(),2*margin());
  6131. return size;
  6132. }
  6133. /*:504*//*505:*/
  6134. #line 11571 "./typica.w"
  6135. PackLayout::PackLayout(QWidget*parent,int margin,int spacing):
  6136. QLayout(parent)
  6137. {
  6138. setMargin(margin);
  6139. setSpacing(spacing);
  6140. setOrientation(Qt::Horizontal);
  6141. }
  6142. PackLayout::PackLayout(int spacing)
  6143. {
  6144. setSpacing(spacing);
  6145. setOrientation(Qt::Horizontal);
  6146. }
  6147. /*:505*//*506:*/
  6148. #line 11589 "./typica.w"
  6149. PackLayout::~PackLayout()
  6150. {
  6151. QLayoutItem*item;
  6152. while((item= takeAt(0)))
  6153. {
  6154. delete item;
  6155. }
  6156. }
  6157. /*:506*//*507:*/
  6158. #line 11603 "./typica.w"
  6159. QLayoutItem*PackLayout::takeAt(int index)
  6160. {
  6161. if(index>=0&&index<itemList.size())
  6162. {
  6163. return itemList.takeAt(index);
  6164. }
  6165. else
  6166. {
  6167. return NULL;
  6168. }
  6169. }
  6170. /*:507*//*508:*/
  6171. #line 11619 "./typica.w"
  6172. QLayoutItem*PackLayout::itemAt(int index)const
  6173. {
  6174. if(index>=0&&index<itemList.size())
  6175. {
  6176. return itemList.at(index);
  6177. }
  6178. else
  6179. {
  6180. return NULL;
  6181. }
  6182. }
  6183. /*:508*//*509:*/
  6184. #line 11642 "./typica.w"
  6185. void PackLayout::addItem(QLayoutItem*item)
  6186. {
  6187. itemList.append(item);
  6188. }
  6189. /*:509*//*510:*/
  6190. #line 11650 "./typica.w"
  6191. int PackLayout::count()const
  6192. {
  6193. return itemList.size();
  6194. }
  6195. /*:510*//*511:*/
  6196. #line 11662 "./typica.w"
  6197. Qt::Orientations PackLayout::expandingDirections()const
  6198. {
  6199. return Qt::Vertical|Qt::Horizontal;
  6200. }
  6201. bool PackLayout::hasHeightForWidth()const
  6202. {
  6203. return false;
  6204. }
  6205. int PackLayout::heightForWidth(int width)const
  6206. {
  6207. return doLayout(QRect(0,0,width,0),true);
  6208. }
  6209. void PackLayout::setGeometry(const QRect&rect)
  6210. {
  6211. QLayout::setGeometry(rect);
  6212. doLayout(rect,false);
  6213. }
  6214. QSize PackLayout::sizeHint()const
  6215. {
  6216. return minimumSize();
  6217. }
  6218. /*:511*//*512:*/
  6219. #line 11693 "./typica.w"
  6220. void PackLayout::setOrientation(Qt::Orientations direction)
  6221. {
  6222. orientation= direction;
  6223. doLayout(geometry(),false);
  6224. }
  6225. /*:512*/
  6226. #line 557 "./typica.w"
  6227. /*514:*/
  6228. #line 11732 "./typica.w"
  6229. SceneButton::SceneButton():QGraphicsScene()
  6230. {
  6231. }
  6232. SceneButton::~SceneButton()
  6233. {
  6234. }
  6235. void SceneButton::mousePressEvent(QGraphicsSceneMouseEvent*mouseEvent)
  6236. {
  6237. emit clicked(mouseEvent->buttonDownScreenPos(mouseEvent->button()));
  6238. }
  6239. /*:514*/
  6240. #line 558 "./typica.w"
  6241. /*516:*/
  6242. #line 11778 "./typica.w"
  6243. WidgetDecorator::WidgetDecorator(QWidget*widget,const QString&labeltext,
  6244. Qt::Orientations orientation,
  6245. QWidget*parent,Qt::WindowFlags f):
  6246. QWidget(parent,f),label(new QGraphicsView()),
  6247. scene(new SceneButton())
  6248. {
  6249. layout= new PackLayout(this);
  6250. layout->setOrientation(orientation);
  6251. /*517:*/
  6252. #line 11798 "./typica.w"
  6253. label->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  6254. label->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  6255. label->setFrameShape(QFrame::NoFrame);
  6256. label->setInteractive(true);
  6257. /*:517*/
  6258. #line 11787 "./typica.w"
  6259. /*518:*/
  6260. #line 11809 "./typica.w"
  6261. scene->setBackgroundBrush(Qt::cyan);
  6262. text= scene->addText(labeltext);
  6263. if(orientation==Qt::Horizontal)
  6264. {
  6265. text->rotate(270.0);
  6266. }
  6267. label->setScene(scene);
  6268. /*:518*/
  6269. #line 11788 "./typica.w"
  6270. /*519:*/
  6271. #line 11827 "./typica.w"
  6272. if(orientation==Qt::Horizontal)
  6273. {
  6274. label->setMaximumWidth((int)(text->boundingRect().height()+1));
  6275. }
  6276. else
  6277. {
  6278. label->setMaximumHeight((int)(text->boundingRect().height()+1));
  6279. }
  6280. label->centerOn(text);
  6281. /*:519*/
  6282. #line 11789 "./typica.w"
  6283. /*520:*/
  6284. #line 11842 "./typica.w"
  6285. layout->addWidget(label);
  6286. layout->addWidget(widget);
  6287. if(orientation==Qt::Horizontal)
  6288. {
  6289. setMinimumSize(widget->sizeHint().width()+label->sizeHint().width(),
  6290. widget->sizeHint().height());
  6291. }
  6292. else
  6293. {
  6294. setMinimumSize(widget->sizeHint().width(),
  6295. widget->sizeHint().height()+label->sizeHint().height());
  6296. }
  6297. /*:520*/
  6298. #line 11790 "./typica.w"
  6299. }
  6300. /*:516*//*521:*/
  6301. #line 11859 "./typica.w"
  6302. void WidgetDecorator::setBackgroundBrush(QBrush background)
  6303. {
  6304. scene->setBackgroundBrush(background);
  6305. }
  6306. void WidgetDecorator::setTextColor(QColor color)
  6307. {
  6308. text->setDefaultTextColor(color);
  6309. }
  6310. /*:521*//*522:*/
  6311. #line 11872 "./typica.w"
  6312. WidgetDecorator::~WidgetDecorator()
  6313. {
  6314. }
  6315. /*:522*/
  6316. #line 559 "./typica.w"
  6317. /*527:*/
  6318. #line 11971 "./typica.w"
  6319. void LogEditWindow::addTheRows()
  6320. {
  6321. QTime s= startTime->time();
  6322. while(s<endTime->time())
  6323. {
  6324. model->newMeasurement(Measurement(0,s),1);
  6325. s= s.addSecs(interval->value());
  6326. }
  6327. model->newMeasurement(Measurement(0,endTime->time()),1);
  6328. }
  6329. /*:527*//*528:*/
  6330. #line 11985 "./typica.w"
  6331. LogEditWindow::LogEditWindow():QMainWindow(NULL),
  6332. centralWidget(new QWidget(NULL)),mainLayout(new PackLayout(0)),
  6333. addRowsLayout(new QHBoxLayout(NULL)),
  6334. startTimeLabel(new QLabel("Start Time")),
  6335. startTime(new QTimeEdit(QTime(0,0,0,0))),
  6336. endTimeLabel(new QLabel("End Time")),
  6337. endTime(new QTimeEdit(QTime(0,20,0,0))),
  6338. intervalLabel(new QLabel("Interval (seconds)")),
  6339. interval(new QSpinBox()),
  6340. addRows(new QPushButton("Add Rows")),
  6341. saveXml(new QAction(tr("Save Profile As..."),NULL)),
  6342. saveCsv(new QAction(tr("Export CSV"),NULL)),
  6343. openXml(new QAction(tr("Load Target Profile..."),NULL)),
  6344. model(new MeasurementModel()),
  6345. log(new QTableView())
  6346. {
  6347. /*529:*/
  6348. #line 12022 "./typica.w"
  6349. QSettings settings;
  6350. resize(settings.value("logSize",QSize(620,400)).toSize());
  6351. move(settings.value("logPos",QPoint(200,60)).toPoint());
  6352. /*:529*/
  6353. #line 12002 "./typica.w"
  6354. /*530:*/
  6355. #line 12035 "./typica.w"
  6356. mainLayout->setOrientation(Qt::Vertical);
  6357. addRowsLayout->addSpacing(10);
  6358. addRowsLayout->addWidget(startTimeLabel);
  6359. addRowsLayout->addWidget(startTime);
  6360. addRowsLayout->addSpacing(10);
  6361. startTime->setDisplayFormat("mm:ss");
  6362. addRowsLayout->addWidget(endTimeLabel);
  6363. addRowsLayout->addWidget(endTime);
  6364. addRowsLayout->addSpacing(10);
  6365. endTime->setDisplayFormat("mm:ss");
  6366. addRowsLayout->addWidget(intervalLabel);
  6367. addRowsLayout->addWidget(interval);
  6368. addRowsLayout->addSpacing(10);
  6369. interval->setRange(0,60);
  6370. interval->setValue(30);
  6371. addRowsLayout->addWidget(addRows);
  6372. addRowsLayout->addSpacing(10);
  6373. connect(addRows,SIGNAL(clicked()),this,SLOT(addTheRows()));
  6374. /*:530*/
  6375. #line 12003 "./typica.w"
  6376. /*531:*/
  6377. #line 12058 "./typica.w"
  6378. model->setHeaderData(0,Qt::Horizontal,"Time");
  6379. model->setHeaderData(1,Qt::Horizontal,"Temperature");
  6380. model->setHeaderData(2,Qt::Horizontal,"Annotation");
  6381. model->clear();
  6382. /*:531*/
  6383. #line 12004 "./typica.w"
  6384. /*532:*/
  6385. #line 12067 "./typica.w"
  6386. log->setModel(model);
  6387. log->setColumnWidth(0,100);
  6388. log->setColumnWidth(1,100);
  6389. log->setColumnWidth(2,100);
  6390. /*:532*/
  6391. #line 12005 "./typica.w"
  6392. mainLayout->addItem(addRowsLayout);
  6393. mainLayout->addWidget(log);
  6394. centralWidget->setLayout(mainLayout);
  6395. setCentralWidget(centralWidget);
  6396. QMenu*fileMenu= menuBar()->addMenu(tr("&File"));
  6397. fileMenu->addAction(openXml);
  6398. connect(openXml,SIGNAL(triggered()),this,SLOT(openXML()));
  6399. fileMenu->addAction(saveXml);
  6400. connect(saveXml,SIGNAL(triggered()),this,SLOT(saveXML()));
  6401. fileMenu->addAction(saveCsv);
  6402. connect(saveCsv,SIGNAL(triggered()),this,SLOT(saveCSV()));
  6403. }
  6404. /*:528*//*533:*/
  6405. #line 12078 "./typica.w"
  6406. void LogEditWindow::saveXML()
  6407. {
  6408. QSettings settings;
  6409. QString lastDir= settings.value("lastDirectory").toString();
  6410. QString filename= QFileDialog::getSaveFileName(this,tr("Save Log As..."),
  6411. lastDir,"",0);
  6412. QFile file(filename);
  6413. XMLOutput writer(model,&file,0);
  6414. writer.addTemperatureColumn("Temperature",1);
  6415. writer.addAnnotationColumn("Annotation",2);
  6416. if(writer.output())
  6417. {
  6418. QFileInfo info(filename);
  6419. QDir directory= info.dir();
  6420. lastDir= directory.path();
  6421. settings.setValue("lastDirectory",lastDir);
  6422. }
  6423. }
  6424. void LogEditWindow::saveCSV()
  6425. {
  6426. QSettings settings;
  6427. QString lastDir= settings.value("lastDirectory").toString();
  6428. QString filename= QFileDialog::getSaveFileName(this,tr("Export As..."),
  6429. lastDir,"",0);
  6430. QFile file(filename);
  6431. CSVOutput writer(model,&file,0);
  6432. writer.addTemperatureColumn("Temperature",1);
  6433. writer.addAnnotationColumn("Annotation",2);
  6434. if(writer.output())
  6435. {
  6436. QFileInfo info(filename);
  6437. QDir directory= info.dir();
  6438. lastDir= directory.path();
  6439. settings.setValue("lastDirectory",lastDir);
  6440. }
  6441. }
  6442. /*:533*//*534:*/
  6443. #line 12121 "./typica.w"
  6444. void LogEditWindow::openXML()
  6445. {
  6446. QSettings settings;
  6447. QString lastDir= settings.value("lastDirectory").toString();
  6448. QString filename= QFileDialog::getOpenFileName(this,tr("Open XML Log..."),
  6449. lastDir,"",0);
  6450. if(filename.isNull())
  6451. {
  6452. return;
  6453. }
  6454. QFile file(filename);
  6455. XMLInput reader(&file,1);
  6456. connect(&reader,SIGNAL(measure(Measurement,int)),
  6457. model,SLOT(newMeasurement(Measurement,int)));
  6458. connect(&reader,SIGNAL(annotation(QString,int,int)),
  6459. model,SLOT(newAnnotation(QString,int,int)));
  6460. if(reader.input())
  6461. {
  6462. QFileInfo info(filename);
  6463. setWindowTitle(QString(tr("%1 - %2")).
  6464. arg(QCoreApplication::applicationName()).arg(info.baseName()));
  6465. QDir directory= info.dir();
  6466. lastDir= directory.path();
  6467. settings.setValue("lastDirectory",lastDir);
  6468. }
  6469. }
  6470. /*:534*//*535:*/
  6471. #line 12152 "./typica.w"
  6472. void LogEditWindow::closeEvent(QCloseEvent*event)
  6473. {
  6474. QSettings settings;
  6475. settings.setValue("logSize",size());
  6476. settings.setValue("logPos",pos());
  6477. event->accept();
  6478. }
  6479. /*:535*/
  6480. #line 560 "./typica.w"
  6481. /*541:*/
  6482. #line 12267 "./typica.w"
  6483. bool XMLOutput::output()
  6484. {
  6485. if(!out->open(QIODevice::WriteOnly|QIODevice::Text))
  6486. {
  6487. return false;
  6488. }
  6489. QXmlStreamWriter xmlout(out);
  6490. xmlout.writeStartDocument("1.0");
  6491. xmlout.writeDTD("<!DOCTYPE roastlog3.0>");
  6492. xmlout.writeStartElement("roastlog");
  6493. /*542:*/
  6494. #line 12300 "./typica.w"
  6495. foreach(int c,temperatureColumns.keys())
  6496. {
  6497. xmlout.writeStartElement("tempseries");
  6498. xmlout.writeAttribute("name",temperatureColumns.value(c));
  6499. xmlout.writeEndElement();
  6500. }
  6501. foreach(int c,controlColumns.keys())
  6502. {
  6503. xmlout.writeStartElement("controlseries");
  6504. xmlout.writeAttribute("name",controlColumns.value(c));
  6505. xmlout.writeEndElement();
  6506. }
  6507. foreach(int c,annotationColumns.keys())
  6508. {
  6509. xmlout.writeStartElement("noteseries");
  6510. xmlout.writeAttribute("name",annotationColumns.value(c));
  6511. xmlout.writeEndElement();
  6512. }
  6513. /*:542*/
  6514. #line 12278 "./typica.w"
  6515. xmlout.writeStartElement("roast");
  6516. bool oresult;
  6517. for(int i= 0;i<data->rowCount();i++)
  6518. {
  6519. /*543:*/
  6520. #line 12325 "./typica.w"
  6521. oresult= false;
  6522. foreach(int c,temperatureColumns.keys())
  6523. {
  6524. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6525. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  6526. {
  6527. oresult= true;
  6528. break;
  6529. }
  6530. }
  6531. foreach(int c,controlColumns.keys())
  6532. {
  6533. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6534. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  6535. {
  6536. oresult= true;
  6537. break;
  6538. }
  6539. }
  6540. if(oresult==false)
  6541. {
  6542. foreach(int c,annotationColumns.keys())
  6543. {
  6544. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6545. !(data->data(data->index(i,c),Qt::DisplayRole).toString().
  6546. isEmpty()))
  6547. {
  6548. oresult= true;
  6549. break;
  6550. }
  6551. }
  6552. }
  6553. /*:543*/
  6554. #line 12283 "./typica.w"
  6555. if(oresult)
  6556. {
  6557. /*544:*/
  6558. #line 12364 "./typica.w"
  6559. xmlout.writeStartElement("tuple");
  6560. xmlout.writeTextElement("time",data->data(data->index(i,time),
  6561. Qt::DisplayRole).toString());
  6562. foreach(int c,temperatureColumns.keys())
  6563. {
  6564. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6565. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  6566. {
  6567. xmlout.writeStartElement("temperature");
  6568. xmlout.writeAttribute("series",temperatureColumns.value(c));
  6569. if(data->data(data->index(i,c),Qt::UserRole).toMap().contains("relative"))
  6570. {
  6571. if(data->data(data->index(i,c),Qt::UserRole).toMap().value("relative").toBool())
  6572. {
  6573. xmlout.writeAttribute("relative","true");
  6574. }
  6575. }
  6576. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).
  6577. toString());
  6578. xmlout.writeEndElement();
  6579. }
  6580. }
  6581. foreach(int c,controlColumns.keys())
  6582. {
  6583. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6584. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  6585. {
  6586. xmlout.writeStartElement("control");
  6587. xmlout.writeAttribute("series",controlColumns.value(c));
  6588. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).toString());
  6589. xmlout.writeEndElement();
  6590. }
  6591. }
  6592. foreach(int c,annotationColumns.keys())
  6593. {
  6594. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6595. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  6596. {
  6597. xmlout.writeStartElement("annotation");
  6598. xmlout.writeAttribute("series",annotationColumns.value(c));
  6599. xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).
  6600. toString());
  6601. xmlout.writeEndElement();
  6602. }
  6603. }
  6604. xmlout.writeEndElement();
  6605. /*:544*/
  6606. #line 12286 "./typica.w"
  6607. }
  6608. }
  6609. xmlout.writeEndElement();
  6610. xmlout.writeEndElement();
  6611. xmlout.writeEndDocument();
  6612. out->close();
  6613. return true;
  6614. }
  6615. /*:541*//*545:*/
  6616. #line 12414 "./typica.w"
  6617. XMLOutput::XMLOutput(MeasurementModel*model,QIODevice*device,int timec)
  6618. :QObject(NULL),data(model),out(device),time(timec)
  6619. {
  6620. }
  6621. void XMLOutput::setModel(MeasurementModel*model)
  6622. {
  6623. data= model;
  6624. }
  6625. void XMLOutput::setTimeColumn(int column)
  6626. {
  6627. time= column;
  6628. }
  6629. void XMLOutput::setDevice(QIODevice*device)
  6630. {
  6631. out= device;
  6632. }
  6633. /*:545*//*546:*/
  6634. #line 12443 "./typica.w"
  6635. void XMLOutput::addTemperatureColumn(const QString&series,int column)
  6636. {
  6637. temperatureColumns.insert(column,series);
  6638. }
  6639. void XMLOutput::addControlColumn(const QString&series,int column)
  6640. {
  6641. controlColumns.insert(column,series);
  6642. }
  6643. void XMLOutput::addAnnotationColumn(const QString&series,int column)
  6644. {
  6645. annotationColumns.insert(column,series);
  6646. }
  6647. /*:546*/
  6648. #line 561 "./typica.w"
  6649. /*548:*/
  6650. #line 12500 "./typica.w"
  6651. bool XMLInput::input()
  6652. {
  6653. if(!in->open(QIODevice::ReadOnly|QIODevice::Text))
  6654. {
  6655. return false;
  6656. }
  6657. QXmlStreamReader xmlin(in);
  6658. QMap<QString,int> temperatureColumns;
  6659. QMap<QString,int> annotationColumns;
  6660. int nextColumn= firstc;
  6661. /*549:*/
  6662. #line 12531 "./typica.w"
  6663. while(!xmlin.isDTD())
  6664. {
  6665. xmlin.readNext();
  6666. }
  6667. if(xmlin.isDTD())
  6668. {
  6669. if(xmlin.text()=="<!DOCTYPE roastlog>")
  6670. {
  6671. /*550:*/
  6672. #line 12553 "./typica.w"
  6673. emit newTemperatureColumn(firstc,"Bean");
  6674. emit newAnnotationColumn(firstc+1,"Note");
  6675. emit lastColumn(firstc+1);
  6676. /*:550*/
  6677. #line 12540 "./typica.w"
  6678. }
  6679. else
  6680. {
  6681. xmlin.readNext();
  6682. /*551:*/
  6683. #line 12562 "./typica.w"
  6684. while(xmlin.name()!="roast")
  6685. {
  6686. if(xmlin.isStartElement())
  6687. {
  6688. if((xmlin.name()=="tempseries")||(xmlin.name()=="controlseries"))
  6689. {
  6690. temperatureColumns.insert(xmlin.attributes().value("name").
  6691. toString(),
  6692. nextColumn);
  6693. emit newTemperatureColumn(nextColumn,
  6694. xmlin.attributes().value("name").
  6695. toString());
  6696. nextColumn++;
  6697. }
  6698. else if(xmlin.name()=="noteseries")
  6699. {
  6700. annotationColumns.insert(xmlin.attributes().value("name").
  6701. toString(),nextColumn);
  6702. emit newAnnotationColumn(nextColumn,
  6703. xmlin.attributes().value("name").
  6704. toString());
  6705. nextColumn++;
  6706. }
  6707. }
  6708. xmlin.readNext();
  6709. }
  6710. emit lastColumn(nextColumn-1);
  6711. /*:551*/
  6712. #line 12545 "./typica.w"
  6713. }
  6714. }
  6715. /*:549*/
  6716. #line 12511 "./typica.w"
  6717. QTime timeval= QTime();
  6718. double tempval= 0;
  6719. QString noteval= QString();
  6720. int column;
  6721. int counter= 0;
  6722. while(!xmlin.atEnd())
  6723. {
  6724. /*552:*/
  6725. #line 12603 "./typica.w"
  6726. xmlin.readNext();
  6727. if(xmlin.isStartElement())
  6728. {
  6729. /*553:*/
  6730. #line 12629 "./typica.w"
  6731. if(xmlin.name()=="time")
  6732. {
  6733. timeval= QTime::fromString(xmlin.readElementText(),"mm:ss.zzz");
  6734. }
  6735. else if(xmlin.name()=="temperature")
  6736. {
  6737. column= xmlin.attributes().hasAttribute("series")?
  6738. temperatureColumns.value(xmlin.attributes().value("series").toString()):firstc;
  6739. bool relative= (xmlin.attributes().value("relative")=="true");
  6740. tempval= xmlin.readElementText().toDouble();
  6741. Measurement measurement(tempval,timeval);
  6742. if(relative)
  6743. {
  6744. measurement.insert("relative",true);
  6745. }
  6746. emit measure(measurement,column);
  6747. }
  6748. else if(xmlin.name()=="control")
  6749. {
  6750. column= xmlin.attributes().value("series").toString().isEmpty()?
  6751. firstc:temperatureColumns.value(xmlin.attributes().
  6752. value("series").toString());
  6753. tempval= xmlin.readElementText().toDouble();
  6754. Measurement measurement(tempval,timeval,Units::Unitless);
  6755. emit measure(measurement,column);
  6756. }
  6757. else if(xmlin.name()=="annotation")
  6758. {
  6759. column= xmlin.attributes().value("series").toString().isEmpty()?
  6760. firstc+1:annotationColumns.value(xmlin.attributes().
  6761. value("series").toString());
  6762. noteval= xmlin.readElementText();
  6763. if(!noteval.isEmpty())
  6764. {
  6765. emit annotation(noteval,firstc,column);
  6766. }
  6767. }
  6768. /*:553*/
  6769. #line 12607 "./typica.w"
  6770. }
  6771. counter++;
  6772. if(counter%100==0)
  6773. {
  6774. QCoreApplication::processEvents();
  6775. }
  6776. /*:552*/
  6777. #line 12519 "./typica.w"
  6778. }
  6779. return true;
  6780. }
  6781. /*:548*//*554:*/
  6782. #line 12670 "./typica.w"
  6783. XMLInput::XMLInput(QIODevice*input,int c):
  6784. firstc(c),in(input)
  6785. {
  6786. }
  6787. void XMLInput::setFirstColumn(int column)
  6788. {
  6789. firstc= column;
  6790. }
  6791. void XMLInput::setDevice(QIODevice*device)
  6792. {
  6793. in= device;
  6794. }
  6795. /*:554*/
  6796. #line 562 "./typica.w"
  6797. /*559:*/
  6798. #line 12761 "./typica.w"
  6799. bool CSVOutput::output()
  6800. {
  6801. if(!out->open(QIODevice::WriteOnly|QIODevice::Text))
  6802. {
  6803. return false;
  6804. }
  6805. QTextStream output(out);
  6806. /*560:*/
  6807. #line 12785 "./typica.w"
  6808. output<<"Time";
  6809. foreach(int c,temperatureColumns.keys())
  6810. {
  6811. output<<','<<temperatureColumns.value(c);
  6812. }
  6813. foreach(int c,controlColumns.keys())
  6814. {
  6815. output<<','<<controlColumns.value(c);
  6816. }
  6817. foreach(int c,annotationColumns.keys())
  6818. {
  6819. output<<','<<annotationColumns.value(c);
  6820. }
  6821. output<<'\n';
  6822. /*:560*/
  6823. #line 12769 "./typica.w"
  6824. bool oresult;
  6825. for(int i= 0;i<data->rowCount();i++)
  6826. {
  6827. /*543:*/
  6828. #line 12325 "./typica.w"
  6829. oresult= false;
  6830. foreach(int c,temperatureColumns.keys())
  6831. {
  6832. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6833. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  6834. {
  6835. oresult= true;
  6836. break;
  6837. }
  6838. }
  6839. foreach(int c,controlColumns.keys())
  6840. {
  6841. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6842. !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
  6843. {
  6844. oresult= true;
  6845. break;
  6846. }
  6847. }
  6848. if(oresult==false)
  6849. {
  6850. foreach(int c,annotationColumns.keys())
  6851. {
  6852. if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
  6853. !(data->data(data->index(i,c),Qt::DisplayRole).toString().
  6854. isEmpty()))
  6855. {
  6856. oresult= true;
  6857. break;
  6858. }
  6859. }
  6860. }
  6861. /*:543*/
  6862. #line 12773 "./typica.w"
  6863. if(oresult)
  6864. {
  6865. /*561:*/
  6866. #line 12810 "./typica.w"
  6867. output<<data->data(data->index(i,time),Qt::DisplayRole).toString();
  6868. foreach(int c,temperatureColumns.keys())
  6869. {
  6870. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  6871. }
  6872. foreach(int c,controlColumns.keys())
  6873. {
  6874. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  6875. }
  6876. foreach(int c,annotationColumns.keys())
  6877. {
  6878. output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
  6879. }
  6880. output<<'\n';
  6881. /*:561*/
  6882. #line 12776 "./typica.w"
  6883. }
  6884. }
  6885. out->close();
  6886. return true;
  6887. }
  6888. /*:559*//*562:*/
  6889. #line 12829 "./typica.w"
  6890. CSVOutput::CSVOutput(MeasurementModel*model,QIODevice*device,int timec):
  6891. data(model),out(device),time(timec)
  6892. {
  6893. }
  6894. void CSVOutput::setModel(MeasurementModel*model)
  6895. {
  6896. data= model;
  6897. }
  6898. void CSVOutput::setTimeColumn(int column)
  6899. {
  6900. time= column;
  6901. }
  6902. void CSVOutput::addTemperatureColumn(const QString&series,int column)
  6903. {
  6904. temperatureColumns.insert(column,series);
  6905. }
  6906. void CSVOutput::addControlColumn(const QString&series,int column)
  6907. {
  6908. controlColumns.insert(column,series);
  6909. }
  6910. void CSVOutput::addAnnotationColumn(const QString&series,int column)
  6911. {
  6912. annotationColumns.insert(column,series);
  6913. }
  6914. void CSVOutput::setDevice(QIODevice*device)
  6915. {
  6916. out= device;
  6917. }
  6918. #line 1 "./webview.w"
  6919. /*:562*/
  6920. #line 563 "./typica.w"
  6921. /*608:*/
  6922. #line 13119 "./typica.w"
  6923. QString SaltModel::arrayLiteral(int column,int role)const
  6924. {
  6925. QString literal= "'{";
  6926. for(int i= 0;i<rowCount();i++)
  6927. {
  6928. QString datum= data(index(i,column),role).toString();
  6929. if(!datum.isEmpty())
  6930. {
  6931. literal.append(datum);
  6932. literal.append(", ");
  6933. }
  6934. }
  6935. if(literal.size()> 2)
  6936. {
  6937. literal.chop(2);
  6938. }
  6939. literal.append("}'");
  6940. return literal;
  6941. }
  6942. QString SaltModel::quotedArrayLiteral(int column,int role)const
  6943. {
  6944. QString literal= "'{";
  6945. for(int i= 0;i<rowCount();i++)
  6946. {
  6947. QString datum= data(index(i,column),role).toString();
  6948. if(!datum.isEmpty())
  6949. {
  6950. literal.append("\"");
  6951. literal.append(datum);
  6952. literal.append("\", ");
  6953. }
  6954. }
  6955. if(literal.size()> 2)
  6956. {
  6957. literal.chop(2);
  6958. }
  6959. literal.append("}'");
  6960. return literal;
  6961. }
  6962. /*:608*//*609:*/
  6963. #line 13163 "./typica.w"
  6964. QModelIndex SaltModel::parent(const QModelIndex&)const
  6965. {
  6966. return QModelIndex();
  6967. }
  6968. /*:609*//*610:*/
  6969. #line 13182 "./typica.w"
  6970. bool SaltModel::setData(const QModelIndex&index,const QVariant&value,
  6971. int role)
  6972. {
  6973. /*611:*/
  6974. #line 13213 "./typica.w"
  6975. bool valid= false;
  6976. if(index.isValid())
  6977. {
  6978. if(index.row()<modelData.size())
  6979. {
  6980. if(index.column()<colcount)
  6981. {
  6982. valid= true;
  6983. }
  6984. }
  6985. }
  6986. /*:611*/
  6987. #line 13186 "./typica.w"
  6988. if(!valid)
  6989. {
  6990. return false;
  6991. }
  6992. if(index.row()==modelData.size()-1)
  6993. {
  6994. beginInsertRows(QModelIndex(),modelData.size(),modelData.size());
  6995. /*612:*/
  6996. #line 13229 "./typica.w"
  6997. QList<QMap<int,QVariant> > newRow;
  6998. QMap<int,QVariant> defaults;
  6999. for(int i= 0;i<colcount;i++)
  7000. {
  7001. newRow.append(defaults);
  7002. }
  7003. modelData.append(newRow);
  7004. /*:612*/
  7005. #line 13194 "./typica.w"
  7006. endInsertRows();
  7007. }
  7008. QList<QMap<int,QVariant> > row= modelData.at(index.row());
  7009. QMap<int,QVariant> cell= row.at(index.column());
  7010. cell.insert(role,value);
  7011. if(role==Qt::EditRole)
  7012. {
  7013. cell.insert(Qt::DisplayRole,value);
  7014. }
  7015. row.replace(index.column(),cell);
  7016. modelData.replace(index.row(),row);
  7017. emit dataChanged(index,index);
  7018. return true;
  7019. }
  7020. /*:610*//*613:*/
  7021. #line 13240 "./typica.w"
  7022. SaltModel::SaltModel(int columns):QAbstractItemModel(),colcount(columns)
  7023. {
  7024. for(int i= 0;i<columns;i++)
  7025. {
  7026. hData<<"";
  7027. }
  7028. /*612:*/
  7029. #line 13229 "./typica.w"
  7030. QList<QMap<int,QVariant> > newRow;
  7031. QMap<int,QVariant> defaults;
  7032. for(int i= 0;i<colcount;i++)
  7033. {
  7034. newRow.append(defaults);
  7035. }
  7036. modelData.append(newRow);
  7037. /*:612*/
  7038. #line 13247 "./typica.w"
  7039. }
  7040. /*:613*//*614:*/
  7041. #line 13252 "./typica.w"
  7042. SaltModel::~SaltModel()
  7043. {
  7044. }
  7045. /*:614*//*615:*/
  7046. #line 13262 "./typica.w"
  7047. int SaltModel::rowCount(const QModelIndex&parent)const
  7048. {
  7049. return(parent==QModelIndex()?modelData.size():0);
  7050. }
  7051. int SaltModel::columnCount(const QModelIndex&parent)const
  7052. {
  7053. return(parent==QModelIndex()?colcount:0);
  7054. }
  7055. /*:615*//*616:*/
  7056. #line 13275 "./typica.w"
  7057. bool SaltModel::setHeaderData(int section,Qt::Orientation orientation,
  7058. const QVariant&value,int)
  7059. {
  7060. if(orientation==Qt::Horizontal&&section<colcount)
  7061. {
  7062. hData.replace(section,value.toString());
  7063. emit headerDataChanged(orientation,section,section);
  7064. return true;
  7065. }
  7066. return false;
  7067. }
  7068. /*:616*//*617:*/
  7069. #line 13290 "./typica.w"
  7070. QVariant SaltModel::data(const QModelIndex&index,int role)const
  7071. {
  7072. /*611:*/
  7073. #line 13213 "./typica.w"
  7074. bool valid= false;
  7075. if(index.isValid())
  7076. {
  7077. if(index.row()<modelData.size())
  7078. {
  7079. if(index.column()<colcount)
  7080. {
  7081. valid= true;
  7082. }
  7083. }
  7084. }
  7085. /*:611*/
  7086. #line 13293 "./typica.w"
  7087. if(!valid)
  7088. {
  7089. return QVariant();
  7090. }
  7091. QList<QMap<int,QVariant> > row= modelData.at(index.row());
  7092. QMap<int,QVariant> cell= row.at(index.column());
  7093. return cell.value(role,QVariant());
  7094. }
  7095. QVariant SaltModel::headerData(int section,Qt::Orientation orientation,
  7096. int role)const
  7097. {
  7098. if(orientation==Qt::Horizontal&&role==Qt::DisplayRole&&
  7099. section<colcount)
  7100. {
  7101. return QVariant(hData.at(section));
  7102. }
  7103. return QVariant();
  7104. }
  7105. /*:617*//*618:*/
  7106. #line 13317 "./typica.w"
  7107. Qt::ItemFlags SaltModel::flags(const QModelIndex&index)const
  7108. {
  7109. /*611:*/
  7110. #line 13213 "./typica.w"
  7111. bool valid= false;
  7112. if(index.isValid())
  7113. {
  7114. if(index.row()<modelData.size())
  7115. {
  7116. if(index.column()<colcount)
  7117. {
  7118. valid= true;
  7119. }
  7120. }
  7121. }
  7122. /*:611*/
  7123. #line 13320 "./typica.w"
  7124. if(valid)
  7125. {
  7126. return Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable|Qt::ItemIsDropEnabled;
  7127. }
  7128. return 0;
  7129. }
  7130. /*:618*//*619:*/
  7131. #line 13331 "./typica.w"
  7132. QModelIndex SaltModel::index(int row,int column,
  7133. const QModelIndex&parent)const
  7134. {
  7135. if(parent==QModelIndex())
  7136. {
  7137. if(row<modelData.size()&&column<colcount)
  7138. {
  7139. return createIndex(row,column);
  7140. }
  7141. }
  7142. return QModelIndex();
  7143. }
  7144. /*:619*//*620:*/
  7145. #line 13349 "./typica.w"
  7146. void SaltModel::clear()
  7147. {
  7148. beginResetModel();
  7149. modelData.clear();
  7150. /*612:*/
  7151. #line 13229 "./typica.w"
  7152. QList<QMap<int,QVariant> > newRow;
  7153. QMap<int,QVariant> defaults;
  7154. for(int i= 0;i<colcount;i++)
  7155. {
  7156. newRow.append(defaults);
  7157. }
  7158. modelData.append(newRow);
  7159. /*:612*/
  7160. #line 13354 "./typica.w"
  7161. endResetModel();
  7162. }
  7163. /*:620*//*621:*/
  7164. #line 13363 "./typica.w"
  7165. bool SaltModel::removeRows(int row,int count,
  7166. const QModelIndex&parent)
  7167. {
  7168. if(parent==QModelIndex())
  7169. {
  7170. if(row>=0&&count> 0&&(row+count-1)<modelData.size())
  7171. {
  7172. beginRemoveRows(parent,row,row+count-1);
  7173. for(int i= 0;i<count;i++)
  7174. {
  7175. modelData.removeAt(row);
  7176. }
  7177. endRemoveRows();
  7178. if(modelData.size()==0)
  7179. {
  7180. beginInsertRows(parent,0,0);
  7181. /*612:*/
  7182. #line 13229 "./typica.w"
  7183. QList<QMap<int,QVariant> > newRow;
  7184. QMap<int,QVariant> defaults;
  7185. for(int i= 0;i<colcount;i++)
  7186. {
  7187. newRow.append(defaults);
  7188. }
  7189. modelData.append(newRow);
  7190. /*:612*/
  7191. #line 13380 "./typica.w"
  7192. endInsertRows();
  7193. }
  7194. return true;
  7195. }
  7196. }
  7197. return false;
  7198. }
  7199. /*:621*//*622:*/
  7200. #line 13394 "./typica.w"
  7201. int SaltModel::findData(const QVariant&value,int column,int role)
  7202. {
  7203. for(int i= 0;i<modelData.size();i++)
  7204. {
  7205. if(modelData.at(i).size()> column)
  7206. {
  7207. if(modelData.at(i).at(column).contains(role))
  7208. {
  7209. if(modelData.at(i).at(column).value(role)==value)
  7210. {
  7211. return i;
  7212. }
  7213. }
  7214. }
  7215. }
  7216. return-1;
  7217. }
  7218. /*:622*/
  7219. #line 564 "./typica.w"
  7220. /*624:*/
  7221. #line 13458 "./typica.w"
  7222. SqlComboBox*SqlComboBox::clone(QWidget*parent)
  7223. {
  7224. SqlComboBox*widget= new SqlComboBox();
  7225. widget->setParent(parent);
  7226. for(int i= 0;i<count();i++)
  7227. {
  7228. widget->addItem(itemText(i),itemData(i));
  7229. }
  7230. return widget;
  7231. }
  7232. /*:624*//*625:*/
  7233. #line 13475 "./typica.w"
  7234. void SqlComboBox::showData(bool show)
  7235. {
  7236. dataColumnShown= show;
  7237. }
  7238. /*:625*//*626:*/
  7239. #line 13489 "./typica.w"
  7240. void SqlComboBox::addNullOption()
  7241. {
  7242. addItem(specialNullText,specialNullData);
  7243. }
  7244. void SqlComboBox::setNullText(QString nullText)
  7245. {
  7246. specialNullText= nullText;
  7247. }
  7248. void SqlComboBox::setNullData(QVariant nullData)
  7249. {
  7250. specialNullData= nullData;
  7251. }
  7252. /*:626*//*627:*/
  7253. #line 13512 "./typica.w"
  7254. void SqlComboBox::setDataColumn(int column)
  7255. {
  7256. dataColumn= column;
  7257. }
  7258. void SqlComboBox::setDisplayColumn(int column)
  7259. {
  7260. displayColumn= column;
  7261. }
  7262. /*:627*//*628:*/
  7263. #line 13526 "./typica.w"
  7264. void SqlComboBox::addSqlOptions(QString query)
  7265. {
  7266. SqlQueryConnection h;
  7267. QSqlQuery*dbquery= h.operator->();
  7268. if(!dbquery->exec(query))
  7269. {
  7270. QSqlError error= dbquery->lastError();
  7271. qDebug()<<error.databaseText();
  7272. qDebug()<<error.driverText();
  7273. qDebug()<<error.text();
  7274. qDebug()<<dbquery->lastQuery();
  7275. }
  7276. while(dbquery->next())
  7277. {
  7278. QString displayValue(dbquery->value(displayColumn).toString());
  7279. QString dataValue(dbquery->value(dataColumn).toString());
  7280. if(dataColumnShown)
  7281. {
  7282. displayValue.append(QString(" (%1)").arg(dataValue));
  7283. }
  7284. addItem(displayValue,dataValue);
  7285. }
  7286. }
  7287. /*:628*//*629:*/
  7288. #line 13562 "./typica.w"
  7289. SqlComboBox::SqlComboBox():
  7290. dataColumn(0),displayColumn(0),dataColumnShown(false),
  7291. specialNullText(tr("Unknown")),specialNullData(QVariant::String)
  7292. {
  7293. view()->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
  7294. }
  7295. SqlComboBox::~SqlComboBox()
  7296. {
  7297. }
  7298. /*:629*/
  7299. #line 565 "./typica.w"
  7300. /*631:*/
  7301. #line 13601 "./typica.w"
  7302. void SqlComboBoxDelegate::setWidget(SqlComboBox*widget)
  7303. {
  7304. delegate= widget;
  7305. }
  7306. /*:631*//*632:*/
  7307. #line 13610 "./typica.w"
  7308. QWidget*SqlComboBoxDelegate::createEditor(QWidget*parent,
  7309. const QStyleOptionViewItem&,
  7310. const QModelIndex&)const
  7311. {
  7312. return delegate->clone(parent);
  7313. }
  7314. /*:632*//*633:*/
  7315. #line 13621 "./typica.w"
  7316. void SqlComboBoxDelegate::setEditorData(QWidget*editor,
  7317. const QModelIndex&index)const
  7318. {
  7319. SqlComboBox*self= qobject_cast<SqlComboBox*> (editor);
  7320. self->setCurrentIndex(self->findData(
  7321. index.model()->data(index,
  7322. Qt::UserRole).toString()));
  7323. }
  7324. /*:633*//*634:*/
  7325. #line 13634 "./typica.w"
  7326. void SqlComboBoxDelegate::setModelData(QWidget*editor,
  7327. QAbstractItemModel*model,
  7328. const QModelIndex&index)const
  7329. {
  7330. SqlComboBox*self= qobject_cast<SqlComboBox*> (editor);
  7331. model->setData(index,self->itemData(self->currentIndex(),Qt::UserRole),
  7332. Qt::UserRole);
  7333. model->setData(index,self->currentText(),Qt::DisplayRole);
  7334. }
  7335. /*:634*//*635:*/
  7336. #line 13647 "./typica.w"
  7337. void SqlComboBoxDelegate::updateEditorGeometry(QWidget*editor,
  7338. const QStyleOptionViewItem&option,
  7339. const QModelIndex&)const
  7340. {
  7341. editor->setGeometry(option.rect);
  7342. }
  7343. /*:635*//*636:*/
  7344. #line 13658 "./typica.w"
  7345. QSize SqlComboBoxDelegate::sizeHint()const
  7346. {
  7347. return delegate->sizeHint();
  7348. }
  7349. /*:636*//*637:*/
  7350. #line 13666 "./typica.w"
  7351. SqlComboBoxDelegate::SqlComboBoxDelegate(QObject*parent)
  7352. :QItemDelegate(parent)
  7353. {
  7354. }
  7355. /*:637*/
  7356. #line 566 "./typica.w"
  7357. /*599:*/
  7358. #line 12912 "./typica.w"
  7359. Application::Application(int&argc,char**argv):QApplication(argc,argv),
  7360. connectionStatus(false),currentUser(QString())
  7361. {
  7362. network= new QNetworkAccessManager(this);
  7363. /*600:*/
  7364. #line 12929 "./typica.w"
  7365. setOrganizationName("Wilson's Coffee & Tea");
  7366. setOrganizationDomain("wilsonscoffee.com");
  7367. setApplicationName(PROGRAM_NAME);
  7368. /*:600*/
  7369. #line 12917 "./typica.w"
  7370. /*601:*/
  7371. #line 12938 "./typica.w"
  7372. QTranslator*base= new QTranslator;
  7373. if(base->load(QString("qt_%1").arg(QLocale::system().name()),QString("%1/Translations").arg(QCoreApplication::applicationDirPath())))
  7374. {
  7375. installTranslator(base);
  7376. }
  7377. QTranslator*app= new QTranslator;
  7378. if(app->load(QString("%1_%2").arg("Typica").arg(QLocale::system().name()),QString("%1/Translations").arg(QCoreApplication::applicationDirPath())))
  7379. {
  7380. installTranslator(app);
  7381. }
  7382. /*:601*/
  7383. #line 12918 "./typica.w"
  7384. /*308:*/
  7385. #line 123 "./measurement.w"
  7386. qRegisterMetaType<Measurement> ("Measurement");
  7387. /*:308*/
  7388. #line 12919 "./typica.w"
  7389. /*814:*/
  7390. #line 16956 "./typica.w"
  7391. NodeInserter*inserter= new NodeInserter(tr("NI DAQmx Base Device"),
  7392. tr("NI DAQmx Base"),
  7393. "nidaqmxbase",NULL);
  7394. topLevelNodeInserters.append(inserter);
  7395. /*:814*//*822:*/
  7396. #line 17187 "./typica.w"
  7397. #ifdef Q_OS_WIN32
  7398. inserter= new NodeInserter(tr("NI DAQmx Device"),tr("NI DAQmx"),"nidaqmx",NULL);
  7399. topLevelNodeInserters.append(inserter);
  7400. #endif
  7401. /*:822*//*846:*/
  7402. #line 18154 "./typica.w"
  7403. #if 0
  7404. inserter= new NodeInserter(tr("Modbus RTU Port"),tr("Modbus RTU Port"),"modbusrtuport",NULL);
  7405. topLevelNodeInserters.append(inserter);
  7406. #endif
  7407. /*:846*//*899:*/
  7408. #line 19667 "./typica.w"
  7409. inserter= new NodeInserter(tr("Modbus RTU Device"),tr("Modbus RTU Device"),"modbusrtu",NULL);
  7410. topLevelNodeInserters.append(inserter);
  7411. #line 1 "./modbus.w"
  7412. /*:899*//*905:*/
  7413. #line 328 "./modbus.w"
  7414. inserter= new NodeInserter(tr("ModbusNG Port"),tr("Modbus RTU Port"),"modbusngport",NULL);
  7415. topLevelNodeInserters.append(inserter);
  7416. /*:905*//*921:*/
  7417. #line 272 "./unsupportedserial.w"
  7418. inserter= new NodeInserter(tr("Other Device"),tr("Other Device"),
  7419. "unsupporteddevice",NULL);
  7420. topLevelNodeInserters.append(inserter);
  7421. /*:921*//*952:*/
  7422. #line 190 "./phidgets.w"
  7423. QLibrary phidgetsCheck("phidget21");
  7424. if(phidgetsCheck.load())
  7425. {
  7426. inserter= new NodeInserter(tr("Phidgets 1048"),tr("Phidgets 1048"),
  7427. "phidgets1048",NULL);
  7428. topLevelNodeInserters.append(inserter);
  7429. phidgetsCheck.unload();
  7430. }
  7431. else
  7432. {
  7433. phidgetsCheck.setFileName("Phidget21.framework/Phidget21");
  7434. if(phidgetsCheck.load())
  7435. {
  7436. inserter= new NodeInserter(tr("Phidgets 1048"),tr("Phidgets 1048"),
  7437. "phidgets1048",NULL);
  7438. topLevelNodeInserters.append(inserter);
  7439. phidgetsCheck.unload();
  7440. }
  7441. }
  7442. /*:952*//*966:*/
  7443. #line 17 "./phidget22.w"
  7444. #if __APPLE__
  7445. QLibrary phidget22check("Phidget22.framework/Phidget22");
  7446. #else
  7447. QLibrary phidget22check("phidget22");
  7448. #endif
  7449. if(phidget22check.load())
  7450. {
  7451. inserter= new NodeInserter(tr("Phidget22"),tr("Phidget22"),"phidget22",
  7452. NULL);
  7453. topLevelNodeInserters.append(inserter);
  7454. phidget22check.unload();
  7455. }
  7456. /*:966*//*1089:*/
  7457. #line 1241 "./dataqsdk.w"
  7458. #ifdef Q_OS_WIN32
  7459. inserter= new NodeInserter(tr("DATAQ SDK Device"),tr("DATAQ Device"),
  7460. "dataqsdk",NULL);
  7461. topLevelNodeInserters.append(inserter);
  7462. #endif
  7463. #line 20338 "./typica.w"
  7464. #line 1 "./scales.w"
  7465. /*:1089*//*1114:*/
  7466. #line 557 "./scales.w"
  7467. inserter= new NodeInserter(tr("Serial Scale"),tr("Scale"),"scale",NULL);
  7468. topLevelNodeInserters.append(inserter);
  7469. #line 20340 "./typica.w"
  7470. #line 1 "./valueannotation.w"
  7471. /*:1114*/
  7472. #line 12920 "./typica.w"
  7473. }
  7474. /*:599*//*603:*/
  7475. #line 12961 "./typica.w"
  7476. QDomDocument*Application::configuration()
  7477. {
  7478. return&conf;
  7479. }
  7480. /*:603*//*604:*/
  7481. #line 12970 "./typica.w"
  7482. QSqlDatabase Application::database()
  7483. {
  7484. QString connectionName;
  7485. QSqlDatabase connection=
  7486. QSqlDatabase::database(QLatin1String(QSqlDatabase::defaultConnection),false);
  7487. do
  7488. {
  7489. connectionName= QUuid::createUuid().toString();
  7490. }while(QSqlDatabase::connectionNames().contains(connectionName));
  7491. return QSqlDatabase::cloneDatabase(connection,QString(connectionName));
  7492. }
  7493. /*:604*//*605:*/
  7494. #line 12986 "./typica.w"
  7495. void Application::setDatabaseConnected(bool status)
  7496. {
  7497. connectionStatus= status;
  7498. }
  7499. bool Application::databaseConnected()
  7500. {
  7501. return connectionStatus;
  7502. }
  7503. /*:605*//*749:*/
  7504. #line 15489 "./typica.w"
  7505. void Application::saveDeviceConfiguration()
  7506. {
  7507. QSettings settings;
  7508. settings.setValue("DeviceConfiguration",
  7509. QVariant(deviceConfigurationDocument.toByteArray()));
  7510. }
  7511. /*:749*//*750:*/
  7512. #line 15501 "./typica.w"
  7513. QDomDocument Application::deviceConfiguration()
  7514. {
  7515. if(deviceConfigurationDocument.isNull())
  7516. {
  7517. /*751:*/
  7518. #line 15515 "./typica.w"
  7519. QSettings settings;
  7520. QByteArray document= settings.value("DeviceConfiguration").toByteArray();
  7521. QString etext;
  7522. int eline;
  7523. int ecol;
  7524. if(document.length()==0)
  7525. {
  7526. qDebug()<<"Loaded settings length is 0. Creating new configuration.";
  7527. /*752:*/
  7528. #line 15539 "./typica.w"
  7529. QFile emptyDocument(":/resources/xml/EmptyDeviceConfiguration.xml");
  7530. emptyDocument.open(QIODevice::ReadOnly);
  7531. if(!deviceConfigurationDocument.setContent(&emptyDocument,false,
  7532. &etext,&eline,&ecol))
  7533. {
  7534. /*753:*/
  7535. #line 15556 "./typica.w"
  7536. qDebug()<<QString(tr("An error occurred loading device configuration."));
  7537. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  7538. qDebug()<<etext;
  7539. /*:753*/
  7540. #line 15545 "./typica.w"
  7541. }
  7542. else
  7543. {
  7544. saveDeviceConfiguration();
  7545. }
  7546. /*:752*/
  7547. #line 15524 "./typica.w"
  7548. }
  7549. else
  7550. {
  7551. if(!deviceConfigurationDocument.setContent(document,false,
  7552. &etext,&eline,&ecol))
  7553. {
  7554. /*753:*/
  7555. #line 15556 "./typica.w"
  7556. qDebug()<<QString(tr("An error occurred loading device configuration."));
  7557. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  7558. qDebug()<<etext;
  7559. /*:753*/
  7560. #line 15531 "./typica.w"
  7561. /*752:*/
  7562. #line 15539 "./typica.w"
  7563. QFile emptyDocument(":/resources/xml/EmptyDeviceConfiguration.xml");
  7564. emptyDocument.open(QIODevice::ReadOnly);
  7565. if(!deviceConfigurationDocument.setContent(&emptyDocument,false,
  7566. &etext,&eline,&ecol))
  7567. {
  7568. /*753:*/
  7569. #line 15556 "./typica.w"
  7570. qDebug()<<QString(tr("An error occurred loading device configuration."));
  7571. qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
  7572. qDebug()<<etext;
  7573. /*:753*/
  7574. #line 15545 "./typica.w"
  7575. }
  7576. else
  7577. {
  7578. saveDeviceConfiguration();
  7579. }
  7580. /*:752*/
  7581. #line 15532 "./typica.w"
  7582. }
  7583. }
  7584. /*:751*/
  7585. #line 15506 "./typica.w"
  7586. }
  7587. return deviceConfigurationDocument;
  7588. }
  7589. /*:750*//*781:*/
  7590. #line 16157 "./typica.w"
  7591. void Application::registerDeviceConfigurationWidget(QString driver,
  7592. QMetaObject widget)
  7593. {
  7594. deviceConfigurationWidgets.insert(driver,widget);
  7595. }
  7596. /*:781*//*782:*/
  7597. #line 16173 "./typica.w"
  7598. QWidget*Application::deviceConfigurationWidget(DeviceTreeModel*model,
  7599. const QModelIndex&index)
  7600. {
  7601. QVariant nodeReference= index.data(Qt::UserRole);
  7602. QDomElement referenceElement= model->referenceElement(
  7603. model->data(index,Qt::UserRole).toString());
  7604. QMetaObject metaObject=
  7605. deviceConfigurationWidgets.value(referenceElement.attribute("driver"),
  7606. QWidget::staticMetaObject);
  7607. QWidget*editor;
  7608. if(metaObject.className()==QWidget::staticMetaObject.className())
  7609. {
  7610. editor= NULL;
  7611. }
  7612. else
  7613. {
  7614. editor= qobject_cast<QWidget*> (
  7615. metaObject.newInstance(Q_ARG(DeviceTreeModel*,model),
  7616. Q_ARG(QModelIndex,index)));
  7617. }
  7618. return editor;
  7619. }
  7620. /*:782*//*1144:*/
  7621. #line 16 "./user.w"
  7622. QString Application::currentTypicaUser()
  7623. {
  7624. return currentUser;
  7625. }
  7626. /*:1144*//*1145:*/
  7627. #line 26 "./user.w"
  7628. void Application::setCurrentTypicaUser(const QString&user)
  7629. {
  7630. currentUser= user;
  7631. emit userChanged(currentUser);
  7632. }
  7633. /*:1145*//*1146:*/
  7634. #line 37 "./user.w"
  7635. bool Application::login(const QString&user,const QString&password)
  7636. {
  7637. SqlQueryConnection h;
  7638. QSqlQuery*dbquery= h.operator->();
  7639. dbquery->prepare("SELECT 1 FROM typica_users WHERE name = :name AND password = :password AND active = TRUE");
  7640. dbquery->bindValue(":name",user);
  7641. dbquery->bindValue(":password",password);
  7642. dbquery->exec();
  7643. if(dbquery->next())
  7644. {
  7645. currentUser= user;
  7646. emit userChanged(currentUser);
  7647. return true;
  7648. }
  7649. return false;
  7650. }
  7651. /*:1146*//*1147:*/
  7652. #line 58 "./user.w"
  7653. bool Application::autoLogin()
  7654. {
  7655. SqlQueryConnection h;
  7656. QSqlQuery*dbquery= h.operator->();
  7657. dbquery->exec("SELECT name FROM typica_users WHERE auto_login = TRUE");
  7658. if(dbquery->next())
  7659. {
  7660. currentUser= dbquery->value(0).toString();
  7661. emit userChanged(currentUser);
  7662. return true;
  7663. }
  7664. return false;
  7665. }
  7666. /*:1147*/
  7667. #line 567 "./typica.w"
  7668. /*646:*/
  7669. #line 13814 "./typica.w"
  7670. SqlConnectionSetup::SqlConnectionSetup():
  7671. formLayout(new QFormLayout),driver(new QComboBox),hostname(new QLineEdit),
  7672. portnumber(new QLineEdit),
  7673. dbname(new QLineEdit),user(new QLineEdit),password(new QLineEdit),
  7674. layout(new QVBoxLayout),buttons(new QHBoxLayout),
  7675. cancelButton(new QPushButton(tr("Cancel"))),
  7676. connectButton(new QPushButton(tr("Connect")))
  7677. {
  7678. QSettings settings;
  7679. driver->addItem("PostgreSQL","QPSQL");
  7680. formLayout->addRow(tr("Database driver:"),driver);
  7681. formLayout->addRow(tr("Host name:"),hostname);
  7682. hostname->setText(settings.value("database/hostname").toString());
  7683. formLayout->addRow(tr("Port number:"),portnumber);
  7684. portnumber->setText(settings.value("database/portnumber","5432").toString());
  7685. formLayout->addRow(tr("Database name:"),dbname);
  7686. dbname->setText(settings.value("database/dbname").toString());
  7687. formLayout->addRow(tr("User name:"),user);
  7688. user->setText(settings.value("database/user").toString());
  7689. password->setEchoMode(QLineEdit::Password);
  7690. formLayout->addRow(tr("Password:"),password);
  7691. password->setText(settings.value("database/password").toString());
  7692. layout->addLayout(formLayout);
  7693. buttons->addStretch(1);
  7694. buttons->addWidget(cancelButton);
  7695. connect(cancelButton,SIGNAL(clicked(bool)),this,SLOT(reject()));
  7696. buttons->addWidget(connectButton);
  7697. layout->addLayout(buttons);
  7698. connect(connectButton,SIGNAL(clicked(bool)),this,SLOT(testConnection()));
  7699. connectButton->setDefault(true);
  7700. setLayout(layout);
  7701. setModal(true);
  7702. }
  7703. SqlConnectionSetup::~SqlConnectionSetup()
  7704. {
  7705. }
  7706. /*:646*//*647:*/
  7707. #line 13857 "./typica.w"
  7708. void SqlConnectionSetup::testConnection()
  7709. {
  7710. QSqlDatabase database=
  7711. QSqlDatabase::addDatabase(driver->itemData(driver->currentIndex()).
  7712. toString());
  7713. database.setConnectOptions("application_name=Typica");
  7714. database.setHostName(hostname->text());
  7715. database.setPort(portnumber->text().toInt());
  7716. database.setDatabaseName(dbname->text());
  7717. database.setUserName(user->text());
  7718. database.setPassword(password->text());
  7719. if(database.open())
  7720. {
  7721. QSettings settings;
  7722. settings.setValue("database/exists","true");
  7723. settings.setValue("database/driver",
  7724. driver->itemData(driver->currentIndex()).toString());
  7725. settings.setValue("database/hostname",hostname->text());
  7726. settings.setValue("database/portnumber",portnumber->text());
  7727. settings.setValue("database/dbname",dbname->text());
  7728. settings.setValue("database/user",user->text());
  7729. settings.setValue("database/password",password->text());
  7730. database.close();
  7731. AppInstance->setDatabaseConnected(true);
  7732. accept();
  7733. }
  7734. else
  7735. {
  7736. QMessageBox::information(this,tr("Database connection failed"),
  7737. tr("Failed to connect to database."));
  7738. }
  7739. }
  7740. /*:647*/
  7741. #line 568 "./typica.w"
  7742. /*651:*/
  7743. #line 13964 "./typica.w"
  7744. SqlQueryView::SqlQueryView(QWidget*parent):QTableView(parent)
  7745. {
  7746. setModel(new QSqlQueryModel);
  7747. connect(this,SIGNAL(doubleClicked(QModelIndex)),
  7748. this,SLOT(openRow(QModelIndex)));
  7749. connect(horizontalHeader(),SIGNAL(sectionResized(int,int,int)),
  7750. this,SLOT(persistColumnResize(int,int,int)));
  7751. }
  7752. /*:651*//*652:*/
  7753. #line 13979 "./typica.w"
  7754. void SqlQueryView::persistColumnResize(int column,int,int newsize)
  7755. {
  7756. /*653:*/
  7757. #line 13988 "./typica.w"
  7758. QSettings settings;
  7759. /*654:*/
  7760. #line 14001 "./typica.w"
  7761. QWidget*topLevelWidget= this;
  7762. while(topLevelWidget->parentWidget())
  7763. {
  7764. topLevelWidget= topLevelWidget->parentWidget();
  7765. }
  7766. /*:654*/
  7767. #line 13990 "./typica.w"
  7768. settings.setValue(QString("columnWidths/%1/%2/%3").
  7769. arg(topLevelWidget->objectName()).
  7770. arg(objectName()).arg(column),
  7771. QVariant(newsize));
  7772. /*:653*/
  7773. #line 13982 "./typica.w"
  7774. }
  7775. /*:652*//*655:*/
  7776. #line 14011 "./typica.w"
  7777. void SqlQueryView::showEvent(QShowEvent*event)
  7778. {
  7779. /*656:*/
  7780. #line 14021 "./typica.w"
  7781. QSettings settings;
  7782. /*654:*/
  7783. #line 14001 "./typica.w"
  7784. QWidget*topLevelWidget= this;
  7785. while(topLevelWidget->parentWidget())
  7786. {
  7787. topLevelWidget= topLevelWidget->parentWidget();
  7788. }
  7789. /*:654*/
  7790. #line 14023 "./typica.w"
  7791. QString baseKey=
  7792. QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
  7793. arg(objectName());
  7794. for(int i= 0;i<model()->columnCount();i++)
  7795. {
  7796. QString key= QString("%1/%2").arg(baseKey).arg(i);
  7797. if(settings.contains(key))
  7798. {
  7799. setColumnWidth(i,settings.value(key).toInt());
  7800. }
  7801. }
  7802. /*:656*/
  7803. #line 14014 "./typica.w"
  7804. event->accept();
  7805. }
  7806. /*:655*//*657:*/
  7807. #line 14038 "./typica.w"
  7808. void SqlQueryView::openRow(const QModelIndex&index)
  7809. {
  7810. emit openEntry(((QSqlQueryModel*)model())->record(index.row()).value(0).toString());
  7811. emit openEntryRow(index.row());
  7812. }
  7813. /*:657*//*658:*/
  7814. #line 14047 "./typica.w"
  7815. void SqlQueryView::setQuery(const QString&query)
  7816. {
  7817. QSqlDatabase database= AppInstance->database();
  7818. database.open();
  7819. QSqlQuery q(query,database);
  7820. ((QSqlQueryModel*)model())->setQuery(q);
  7821. database.close();
  7822. }
  7823. bool SqlQueryView::setHeaderData(int section,Qt::Orientation orientation,
  7824. const QVariant&value,int role)
  7825. {
  7826. return model()->setHeaderData(section,orientation,value,role);
  7827. }
  7828. /*:658*//*659:*/
  7829. #line 14065 "./typica.w"
  7830. QVariant SqlQueryView::data(int row,int column,int role)
  7831. {
  7832. return model()->data(model()->index(row,column),role);
  7833. }
  7834. /*:659*/
  7835. #line 569 "./typica.w"
  7836. /*174:*/
  7837. #line 4048 "./typica.w"
  7838. SqlQueryConnection::SqlQueryConnection(const QString&query)
  7839. {
  7840. QSqlDatabase database= AppInstance->database();
  7841. database.open();
  7842. q= new QSqlQuery(query,database);
  7843. connection= database.connectionName();
  7844. }
  7845. /*:174*//*175:*/
  7846. #line 4061 "./typica.w"
  7847. SqlQueryConnection::~SqlQueryConnection()
  7848. {
  7849. delete q;
  7850. {
  7851. QSqlDatabase database= QSqlDatabase::database(connection);
  7852. database.close();
  7853. }
  7854. QSqlDatabase::removeDatabase(connection);
  7855. }
  7856. /*:175*//*176:*/
  7857. #line 4075 "./typica.w"
  7858. QSqlQuery*SqlQueryConnection::operator->()const
  7859. {
  7860. return q;
  7861. }
  7862. /*:176*/
  7863. #line 570 "./typica.w"
  7864. /*678:*/
  7865. #line 14424 "./typica.w"
  7866. ReportTable::ReportTable(QTextFrame*frame,QDomElement description):
  7867. area(frame),configuration(description)
  7868. {
  7869. refresh();
  7870. }
  7871. ReportTable::~ReportTable()
  7872. {
  7873. }
  7874. /*:678*//*679:*/
  7875. #line 14440 "./typica.w"
  7876. void ReportTable::bind(QString placeholder,QVariant value)
  7877. {
  7878. bindings.insert(placeholder,value);
  7879. }
  7880. /*:679*//*680:*/
  7881. #line 14450 "./typica.w"
  7882. void ReportTable::refresh()
  7883. {
  7884. /*681:*/
  7885. #line 14471 "./typica.w"
  7886. QTextCursor cursor= area->firstCursorPosition();
  7887. while(cursor<area->lastCursorPosition())
  7888. {
  7889. cursor.movePosition(QTextCursor::Right,QTextCursor::KeepAnchor);
  7890. }
  7891. cursor.removeSelectedText();
  7892. /*:681*/
  7893. #line 14453 "./typica.w"
  7894. int rows= 1;
  7895. int columns= 1;
  7896. int currentRow= 0;
  7897. QTextTable*table= cursor.insertTable(rows,columns);
  7898. /*682:*/
  7899. #line 14484 "./typica.w"
  7900. QTextTableFormat format= table->format();
  7901. format.setBorderStyle(QTextFrameFormat::BorderStyle_None);
  7902. if(configuration.hasAttribute("align"))
  7903. {
  7904. if(configuration.attribute("align")=="center")
  7905. {
  7906. format.setAlignment(Qt::AlignHCenter);
  7907. }
  7908. }
  7909. table->setFormat(format);
  7910. /*:682*/
  7911. #line 14458 "./typica.w"
  7912. /*683:*/
  7913. #line 14498 "./typica.w"
  7914. QDomNodeList children= configuration.childNodes();
  7915. for(int i= 0;i<children.count();i++)
  7916. {
  7917. QDomNode current;
  7918. QDomElement currentElement;
  7919. current= children.at(i);
  7920. if(current.isElement())
  7921. {
  7922. currentElement= current.toElement();
  7923. if(currentElement.tagName()=="query")
  7924. {
  7925. /*684:*/
  7926. #line 14525 "./typica.w"
  7927. SqlQueryConnection h;
  7928. QSqlQuery*query= h.operator->();
  7929. query->prepare(currentElement.text());
  7930. foreach(QString key,bindings.uniqueKeys())
  7931. {
  7932. if(currentElement.text().contains(key))
  7933. {
  7934. query->bindValue(key,bindings.value(key));
  7935. }
  7936. }
  7937. query->exec();
  7938. if(!query->next())
  7939. {
  7940. continue;
  7941. }
  7942. if(query->record().count()> columns)
  7943. {
  7944. table->appendColumns(query->record().count()-columns);
  7945. }
  7946. do
  7947. {
  7948. table->appendRows(1);
  7949. rows++;
  7950. currentRow++;
  7951. for(int j= 0;j<query->record().count();j++)
  7952. {
  7953. QTextTableCell cell= table->cellAt(currentRow,j);
  7954. cursor= cell.firstCursorPosition();
  7955. cursor.insertText(query->value(j).toString());
  7956. }
  7957. }while(query->next());
  7958. /*:684*/
  7959. #line 14510 "./typica.w"
  7960. }
  7961. else if(currentElement.tagName()=="row")
  7962. {
  7963. /*685:*/
  7964. #line 14565 "./typica.w"
  7965. table->appendRows(1);
  7966. currentRow++;
  7967. rows++;
  7968. QDomNodeList rowChildren= currentElement.childNodes();
  7969. int currentColumn= 0;
  7970. for(int j= 0;j<rowChildren.count();j++)
  7971. {
  7972. QDomNode node;
  7973. QDomElement nodeElement;
  7974. node= rowChildren.at(j);
  7975. if(node.isElement())
  7976. {
  7977. nodeElement= node.toElement();
  7978. if(nodeElement.tagName()=="cell")
  7979. {
  7980. if(currentColumn==columns)
  7981. {
  7982. table->appendColumns(1);
  7983. columns++;
  7984. }
  7985. QTextTableCell cell= table->cellAt(currentRow,currentColumn);
  7986. cursor= cell.firstCursorPosition();
  7987. cursor.insertText(nodeElement.text());
  7988. currentColumn++;
  7989. }
  7990. }
  7991. }
  7992. /*:685*/
  7993. #line 14514 "./typica.w"
  7994. }
  7995. }
  7996. }
  7997. /*:683*/
  7998. #line 14459 "./typica.w"
  7999. if(rows> 1)
  8000. {
  8001. table->removeRows(0,1);
  8002. }
  8003. }
  8004. /*:680*/
  8005. #line 571 "./typica.w"
  8006. /*717:*/
  8007. #line 14671 "./typica.w"
  8008. FormArray::FormArray(QDomElement description):configuration(description),
  8009. maxwidth(-1),maxheight(-1)
  8010. {
  8011. setWidget(&itemContainer);
  8012. itemContainer.setLayout(&itemLayout);
  8013. }
  8014. /*:717*//*718:*/
  8015. #line 14688 "./typica.w"
  8016. void FormArray::addElements(int copies)
  8017. {
  8018. QStack<QWidget*> *widgetStack= new QStack<QWidget*> ;
  8019. QStack<QLayout*> *layoutStack= new QStack<QLayout*> ;
  8020. QWidget*widget;
  8021. for(int i= 0;i<copies;i++)
  8022. {
  8023. widget= new QWidget;
  8024. if(maxwidth> -1)
  8025. {
  8026. widget->setMaximumWidth(maxwidth);
  8027. }
  8028. if(maxheight> -1)
  8029. {
  8030. widget->setMaximumHeight(maxheight);
  8031. }
  8032. if(configuration.hasChildNodes())
  8033. {
  8034. widgetStack->push(widget);
  8035. populateWidget(configuration,widgetStack,layoutStack);
  8036. widgetStack->pop();
  8037. widget->setMinimumHeight(widget->sizeHint().height());
  8038. itemLayout.addWidget(widget);
  8039. if(widget->sizeHint().height()> maxheight&&maxheight> -1)
  8040. {
  8041. itemContainer.setMinimumHeight(maxheight*elements()+50);
  8042. }
  8043. else
  8044. {
  8045. itemContainer.setMinimumHeight(itemContainer.sizeHint().height()
  8046. +widget->sizeHint().height());
  8047. }
  8048. if(maxwidth> -1)
  8049. {
  8050. itemContainer.setMinimumWidth(maxwidth+50);
  8051. }
  8052. else
  8053. {
  8054. itemContainer.setMinimumWidth(widget->sizeHint().width()+50);
  8055. }
  8056. }
  8057. }
  8058. }
  8059. /*:718*//*719:*/
  8060. #line 14738 "./typica.w"
  8061. QWidget*FormArray::elementAt(int index)
  8062. {
  8063. if(index<itemLayout.count())
  8064. {
  8065. QLayoutItem*item= itemLayout.itemAt(index);
  8066. return item->widget();
  8067. }
  8068. else
  8069. {
  8070. return NULL;
  8071. }
  8072. }
  8073. /*:719*//*720:*/
  8074. #line 14755 "./typica.w"
  8075. void FormArray::removeAllElements()
  8076. {
  8077. while(itemLayout.count()> 0)
  8078. {
  8079. QLayoutItem*item;
  8080. item= itemLayout.itemAt(0);
  8081. item->widget()->hide();
  8082. itemLayout.removeWidget(item->widget());
  8083. }
  8084. itemContainer.setMinimumHeight(0);
  8085. }
  8086. /*:720*//*721:*/
  8087. #line 14771 "./typica.w"
  8088. int FormArray::elements()
  8089. {
  8090. return itemLayout.count();
  8091. }
  8092. /*:721*//*722:*/
  8093. #line 14782 "./typica.w"
  8094. void FormArray::setMaximumElementWidth(int width)
  8095. {
  8096. maxwidth= width;
  8097. }
  8098. void FormArray::setMaximumElementHeight(int height)
  8099. {
  8100. maxheight= height;
  8101. }
  8102. /*:722*/
  8103. #line 572 "./typica.w"
  8104. /*728:*/
  8105. #line 14913 "./typica.w"
  8106. ScaleControl::ScaleControl():QGraphicsView(NULL,NULL),nonScoredValue(-1),
  8107. scoredValue(-1),initialSet(false),finalSet(false),scaleDown(false)
  8108. {
  8109. left<<QPointF(0,5)<<QPointF(10,0)<<QPointF(10,10)<<
  8110. QPointF(0,5);
  8111. right<<QPointF(10,5)<<QPointF(0,0)<<QPointF(0,10)<<
  8112. QPointF(10,5);
  8113. down<<QPointF(0,0)<<QPointF(-5,-10)<<QPointF(5,-10)<<
  8114. QPointF(0,0);
  8115. up<<QPointF(0,0)<<QPointF(-5,10)<<QPointF(4,10)<<QPointF(0,0);
  8116. initialBrush.setColor(QColor(170,170,255));
  8117. initialBrush.setStyle(Qt::SolidPattern);
  8118. finalBrush.setColor(Qt::blue);
  8119. finalBrush.setStyle(Qt::SolidPattern);
  8120. initialDecrement.setPolygon(left);
  8121. initialDecrement.setBrush(initialBrush);
  8122. initialDecrement.setPos(0,0);
  8123. scene.addItem(&initialDecrement);
  8124. initialIncrement.setPolygon(right);
  8125. initialIncrement.setBrush(initialBrush);
  8126. initialIncrement.setPos(122,0);
  8127. scene.addItem(&initialIncrement);
  8128. finalDecrement.setPolygon(left);
  8129. finalDecrement.setBrush(finalBrush);
  8130. finalDecrement.setPos(0,12);
  8131. scene.addItem(&finalDecrement);
  8132. finalIncrement.setPolygon(right);
  8133. finalIncrement.setBrush(finalBrush);
  8134. finalIncrement.setPos(122,12);
  8135. scene.addItem(&finalIncrement);
  8136. scalePath.moveTo(0,10);
  8137. scalePath.lineTo(100,10);
  8138. scalePath.moveTo(0,0);
  8139. scalePath.lineTo(0,20);
  8140. scalePath.moveTo(10,5);
  8141. scalePath.lineTo(10,15);
  8142. scalePath.moveTo(20,5);
  8143. scalePath.lineTo(20,15);
  8144. scalePath.moveTo(30,5);
  8145. scalePath.lineTo(30,15);
  8146. scalePath.moveTo(40,5);
  8147. scalePath.lineTo(40,15);
  8148. scalePath.moveTo(50,0);
  8149. scalePath.lineTo(50,20);
  8150. scalePath.moveTo(60,5);
  8151. scalePath.lineTo(60,15);
  8152. scalePath.moveTo(70,5);
  8153. scalePath.lineTo(70,15);
  8154. scalePath.moveTo(80,5);
  8155. scalePath.lineTo(80,15);
  8156. scalePath.moveTo(90,5);
  8157. scalePath.lineTo(90,15);
  8158. scalePath.moveTo(100,0);
  8159. scalePath.lineTo(100,20);
  8160. scaleLine.setPath(scalePath);
  8161. scaleLine.setPos(16,1);
  8162. scene.addItem(&scaleLine);
  8163. setScene(&scene);
  8164. initialIndicator.setPolygon(down);
  8165. initialIndicator.setBrush(initialBrush);
  8166. finalIndicator.setPolygon(up);
  8167. finalIndicator.setBrush(finalBrush);
  8168. setMinimumSize(sizeHint());
  8169. setMaximumSize(sizeHint());
  8170. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  8171. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  8172. setMinimumSize(sizeHint());
  8173. }
  8174. /*:728*//*729:*/
  8175. #line 14986 "./typica.w"
  8176. QSize ScaleControl::sizeHint()const
  8177. {
  8178. return QSize(140,30);
  8179. }
  8180. /*:729*//*730:*/
  8181. #line 14995 "./typica.w"
  8182. void ScaleControl::setInitialValue(double value)
  8183. {
  8184. if(value>=0&&value<=10)
  8185. {
  8186. nonScoredValue= value;
  8187. if(!initialSet)
  8188. {
  8189. scene.addItem(&initialIndicator);
  8190. }
  8191. initialSet= true;
  8192. initialIndicator.setPos(value*10+16,10);
  8193. emit initialChanged(value);
  8194. if(!finalSet)
  8195. {
  8196. setFinalValue(value);
  8197. }
  8198. }
  8199. }
  8200. void ScaleControl::setFinalValue(double value)
  8201. {
  8202. if(value>=0&&value<=10)
  8203. {
  8204. scoredValue= value;
  8205. if(!finalSet)
  8206. {
  8207. scene.addItem(&finalIndicator);
  8208. }
  8209. finalSet= true;
  8210. finalIndicator.setPos(value*10+16,11);
  8211. emit finalChanged(value);
  8212. }
  8213. }
  8214. /*:730*//*731:*/
  8215. #line 15032 "./typica.w"
  8216. double ScaleControl::initialValue(void)
  8217. {
  8218. return nonScoredValue;
  8219. }
  8220. double ScaleControl::finalValue(void)
  8221. {
  8222. return scoredValue;
  8223. }
  8224. /*:731*//*732:*/
  8225. #line 15053 "./typica.w"
  8226. void ScaleControl::mousePressEvent(QMouseEvent*event)
  8227. {
  8228. /*733:*/
  8229. #line 15065 "./typica.w"
  8230. if(event->button()!=Qt::LeftButton)
  8231. {
  8232. event->ignore();
  8233. return;
  8234. }
  8235. /*:733*/
  8236. #line 15056 "./typica.w"
  8237. scaleDown= true;
  8238. event->accept();
  8239. }
  8240. /*:732*//*734:*/
  8241. #line 15076 "./typica.w"
  8242. void ScaleControl::mouseReleaseEvent(QMouseEvent*event)
  8243. {
  8244. /*733:*/
  8245. #line 15065 "./typica.w"
  8246. if(event->button()!=Qt::LeftButton)
  8247. {
  8248. event->ignore();
  8249. return;
  8250. }
  8251. /*:733*/
  8252. #line 15079 "./typica.w"
  8253. if(!scaleDown)
  8254. {
  8255. event->ignore();
  8256. return;
  8257. }
  8258. scaleDown= false;
  8259. QPointF sceneCoordinate= mapToScene(event->x(),event->y());
  8260. /*735:*/
  8261. #line 15101 "./typica.w"
  8262. if(sceneCoordinate.x()>=0&&sceneCoordinate.x()<=10)
  8263. {
  8264. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  8265. {
  8266. if(initialSet)
  8267. {
  8268. setInitialValue(nonScoredValue-0.05);
  8269. }
  8270. event->accept();
  8271. return;
  8272. }
  8273. else if(sceneCoordinate.y()>=12&&sceneCoordinate.y()<=22)
  8274. {
  8275. if(finalSet)
  8276. {
  8277. setFinalValue(scoredValue-0.05);
  8278. event->accept();
  8279. return;
  8280. }
  8281. }
  8282. }
  8283. /*:735*/
  8284. #line 15087 "./typica.w"
  8285. /*736:*/
  8286. #line 15127 "./typica.w"
  8287. else if(sceneCoordinate.x()>=122&&sceneCoordinate.x()<=132)
  8288. {
  8289. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  8290. {
  8291. if(initialSet)
  8292. {
  8293. setInitialValue(nonScoredValue+0.05);
  8294. event->accept();
  8295. return;
  8296. }
  8297. }
  8298. else if(sceneCoordinate.y()>=12&&sceneCoordinate.y()<=22)
  8299. {
  8300. if(finalSet)
  8301. {
  8302. setFinalValue(scoredValue+0.05);
  8303. event->accept();
  8304. return;
  8305. }
  8306. }
  8307. }
  8308. /*:736*/
  8309. #line 15088 "./typica.w"
  8310. /*737:*/
  8311. #line 15153 "./typica.w"
  8312. double relativeX= sceneCoordinate.x()-16;
  8313. if(initialSet)
  8314. {
  8315. if(relativeX>=0&&relativeX<=100)
  8316. {
  8317. setFinalValue(relativeX/10.0);
  8318. event->accept();
  8319. return;
  8320. }
  8321. }
  8322. else
  8323. {
  8324. if(relativeX>=0&&relativeX<=100)
  8325. {
  8326. setInitialValue(relativeX/10.0);
  8327. event->accept();
  8328. return;
  8329. }
  8330. }
  8331. /*:737*/
  8332. #line 15089 "./typica.w"
  8333. event->ignore();
  8334. return;
  8335. }
  8336. /*:734*/
  8337. #line 573 "./typica.w"
  8338. /*739:*/
  8339. #line 15219 "./typica.w"
  8340. IntensityControl::IntensityControl():QGraphicsView(NULL,NULL),theValue(-1),
  8341. valueSet(false),scaleDown(false)
  8342. {
  8343. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  8344. setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  8345. left<<QPointF(0,0)<<QPointF(10,-5)<<QPointF(10,5)<<QPointF(0,0);
  8346. down<<QPointF(0,0)<<QPointF(10,0)<<QPointF(5,10)<<QPointF(0,0);
  8347. up<<QPointF(0,10)<<QPointF(10,10)<<QPointF(5,0)<<QPointF(0,10);
  8348. theBrush.setColor(Qt::blue);
  8349. theBrush.setStyle(Qt::SolidPattern);
  8350. increment.setPolygon(up);
  8351. increment.setBrush(theBrush);
  8352. increment.setPos(0,0);
  8353. scene.addItem(&increment);
  8354. decrement.setPolygon(down);
  8355. decrement.setBrush(theBrush);
  8356. decrement.setPos(0,122);
  8357. scene.addItem(&decrement);
  8358. scalePath.moveTo(5,0);
  8359. scalePath.lineTo(5,100);
  8360. scalePath.moveTo(0,0);
  8361. scalePath.lineTo(10,0);
  8362. scalePath.moveTo(0,10);
  8363. scalePath.lineTo(10,10);
  8364. scalePath.moveTo(0,20);
  8365. scalePath.lineTo(10,20);
  8366. scalePath.moveTo(0,30);
  8367. scalePath.lineTo(10,30);
  8368. scalePath.moveTo(0,40);
  8369. scalePath.lineTo(10,40);
  8370. scalePath.moveTo(0,50);
  8371. scalePath.lineTo(10,50);
  8372. scalePath.moveTo(0,60);
  8373. scalePath.lineTo(10,60);
  8374. scalePath.moveTo(0,70);
  8375. scalePath.lineTo(10,70);
  8376. scalePath.moveTo(0,80);
  8377. scalePath.lineTo(10,80);
  8378. scalePath.moveTo(0,90);
  8379. scalePath.lineTo(10,90);
  8380. scalePath.moveTo(0,100);
  8381. scalePath.lineTo(10,100);
  8382. scaleLine.setPath(scalePath);
  8383. scaleLine.setPos(0,16);
  8384. scene.addItem(&scaleLine);
  8385. setScene(&scene);
  8386. indicator.setPolygon(left);
  8387. indicator.setBrush(theBrush);
  8388. setMinimumSize(sizeHint());
  8389. setMaximumSize(sizeHint());
  8390. }
  8391. /*:739*//*740:*/
  8392. #line 15274 "./typica.w"
  8393. QSize IntensityControl::sizeHint()const
  8394. {
  8395. return QSize(25,160);
  8396. }
  8397. /*:740*//*741:*/
  8398. #line 15289 "./typica.w"
  8399. void IntensityControl::setValue(double val)
  8400. {
  8401. if(val>=0&&val<=10)
  8402. {
  8403. theValue= val;
  8404. if(!valueSet)
  8405. {
  8406. scene.addItem(&indicator);
  8407. }
  8408. valueSet= true;
  8409. indicator.setPos(6,(100-(val*10))+16);
  8410. emit(valueChanged(val));
  8411. }
  8412. else if(val<1)
  8413. {
  8414. setValue(0);
  8415. }
  8416. else
  8417. {
  8418. setValue(10);
  8419. }
  8420. }
  8421. double IntensityControl::value()
  8422. {
  8423. return theValue;
  8424. }
  8425. /*:741*//*742:*/
  8426. #line 15321 "./typica.w"
  8427. void IntensityControl::mousePressEvent(QMouseEvent*event)
  8428. {
  8429. /*733:*/
  8430. #line 15065 "./typica.w"
  8431. if(event->button()!=Qt::LeftButton)
  8432. {
  8433. event->ignore();
  8434. return;
  8435. }
  8436. /*:733*/
  8437. #line 15324 "./typica.w"
  8438. scaleDown= true;
  8439. event->accept();
  8440. }
  8441. /*:742*//*743:*/
  8442. #line 15335 "./typica.w"
  8443. void IntensityControl::mouseReleaseEvent(QMouseEvent*event)
  8444. {
  8445. /*733:*/
  8446. #line 15065 "./typica.w"
  8447. if(event->button()!=Qt::LeftButton)
  8448. {
  8449. event->ignore();
  8450. return;
  8451. }
  8452. /*:733*/
  8453. #line 15338 "./typica.w"
  8454. if(!scaleDown)
  8455. {
  8456. event->ignore();
  8457. return;
  8458. }
  8459. scaleDown= false;
  8460. QPointF sceneCoordinate= mapToScene(event->x(),event->y());
  8461. if(sceneCoordinate.x()>=0&&sceneCoordinate.x()<=16)
  8462. {
  8463. if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
  8464. {
  8465. if(valueSet)
  8466. {
  8467. setValue(theValue+0.05);
  8468. }
  8469. event->accept();
  8470. return;
  8471. }
  8472. else if(sceneCoordinate.y()>=122&&sceneCoordinate.y()<=132)
  8473. {
  8474. if(valueSet)
  8475. {
  8476. setValue(theValue-0.05);
  8477. }
  8478. event->accept();
  8479. return;
  8480. }
  8481. else if(sceneCoordinate.y()>=16&&sceneCoordinate.y()<=116)
  8482. {
  8483. setValue(10-((sceneCoordinate.y()-16)/10.0));
  8484. event->accept();
  8485. return;
  8486. }
  8487. }
  8488. }
  8489. /*:743*/
  8490. #line 574 "./typica.w"
  8491. /*377:*/
  8492. #line 8512 "./typica.w"
  8493. void ThresholdDetector::newMeasurement(Measurement measure)
  8494. {
  8495. if((currentDirection==Ascending&&previousValue<threshold&&
  8496. previousValueValid)||(currentDirection==Descending&&
  8497. previousValue> threshold&&previousValueValid))
  8498. {
  8499. if((currentDirection==Ascending&&measure.temperature()>=threshold)||
  8500. (currentDirection==Descending&&measure.temperature()<=threshold))
  8501. {
  8502. double offset= measure.time().hour()*60*60;
  8503. offset+= measure.time().minute()*60;
  8504. offset+= measure.time().second();
  8505. offset+= measure.time().msec()/1000;
  8506. emit timeForValue(offset);
  8507. }
  8508. }
  8509. previousValue= measure.temperature();
  8510. previousValueValid= true;
  8511. }
  8512. ThresholdDetector::ThresholdDetector(double value):QObject(NULL),
  8513. previousValueValid(false),
  8514. previousValue(-1),threshold(value),currentDirection(Ascending)
  8515. {
  8516. }
  8517. void ThresholdDetector::setThreshold(double value)
  8518. {
  8519. threshold= value;
  8520. }
  8521. void ThresholdDetector::setEdgeDirection(EdgeDirection direction)
  8522. {
  8523. currentDirection= direction;
  8524. }
  8525. /*:377*/
  8526. #line 575 "./typica.w"
  8527. /*825:*/
  8528. #line 17227 "./typica.w"
  8529. PortSelector::PortSelector(QWidget*parent):QComboBox(parent),
  8530. lister(new QextSerialEnumerator)
  8531. {
  8532. QList<QextPortInfo> ports= QextSerialEnumerator::getPorts();
  8533. QextPortInfo port;
  8534. foreach(port,ports)
  8535. {
  8536. #ifdef Q_OS_WIN32
  8537. addItem(port.portName);
  8538. #else
  8539. addItem(port.physName);
  8540. #endif
  8541. }
  8542. lister->setUpNotifications();
  8543. connect(lister,SIGNAL(deviceDiscovered(QextPortInfo)),
  8544. this,SLOT(addDevice(QextPortInfo)));
  8545. setEditable(true);
  8546. }
  8547. void PortSelector::addDevice(QextPortInfo port)
  8548. {
  8549. addItem(port.portName);
  8550. }
  8551. /*:825*/
  8552. #line 576 "./typica.w"
  8553. /*827:*/
  8554. #line 17319 "./typica.w"
  8555. BaudSelector::BaudSelector(QWidget*parent):QComboBox(parent)
  8556. {
  8557. QMetaObject meta= BaudSelector::staticMetaObject;
  8558. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("BaudRateType"));
  8559. for(int i= 0;i<type.keyCount();i++)
  8560. {
  8561. addItem(QString("%1").arg(type.value(i)));
  8562. }
  8563. }
  8564. /*:827*/
  8565. #line 577 "./typica.w"
  8566. /*829:*/
  8567. #line 17357 "./typica.w"
  8568. ParitySelector::ParitySelector(QWidget*parent):QComboBox(parent)
  8569. {
  8570. QMetaObject meta= ParitySelector::staticMetaObject;
  8571. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("ParityType"));
  8572. for(int i= 0;i<type.keyCount();i++)
  8573. {
  8574. addItem(QString(type.key(i)),QVariant(type.value(i)));
  8575. }
  8576. }
  8577. /*:829*/
  8578. #line 578 "./typica.w"
  8579. /*831:*/
  8580. #line 17387 "./typica.w"
  8581. FlowSelector::FlowSelector(QWidget*parent):QComboBox(parent)
  8582. {
  8583. QMetaObject meta= FlowSelector::staticMetaObject;
  8584. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("FlowType"));
  8585. for(int i= 0;i<type.keyCount();i++)
  8586. {
  8587. addItem(QString(type.key(i)),QVariant(type.value(i)));
  8588. }
  8589. }
  8590. /*:831*/
  8591. #line 579 "./typica.w"
  8592. /*833:*/
  8593. #line 17422 "./typica.w"
  8594. StopSelector::StopSelector(QWidget*parent):QComboBox(parent)
  8595. {
  8596. QMetaObject meta= StopSelector::staticMetaObject;
  8597. QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("StopBitsType"));
  8598. for(int i= 0;i<type.keyCount();i++)
  8599. {
  8600. addItem(QString(type.key(i)),QVariant(type.value(i)));
  8601. }
  8602. }
  8603. /*:833*/
  8604. #line 580 "./typica.w"
  8605. /*897:*/
  8606. #line 19208 "./typica.w"
  8607. ModbusConfigurator::ModbusConfigurator(DeviceTreeModel*model,const QModelIndex&index)
  8608. :BasicDeviceConfigurationWidget(model,index),
  8609. port(new PortSelector),baud(new BaudSelector),parity(new ParitySelector),
  8610. flow(new FlowSelector),stop(new StopSelector),station(new QSpinBox),
  8611. decimalQuery(new QCheckBox(tr("Enable"))),
  8612. decimalAddress(new ShortHexSpinBox),decimalPosition(new QSpinBox),
  8613. unitQuery(new QCheckBox(tr("Enable"))),
  8614. unitAddress(new ShortHexSpinBox),valueF(new QSpinBox),
  8615. valueC(new QSpinBox),fixedUnit(new QComboBox),
  8616. pVAddress(new ShortHexSpinBox),
  8617. sVEnabled(new QCheckBox(tr("Enable"))),
  8618. sVReadAddress(new ShortHexSpinBox),
  8619. deviceLimit(new QCheckBox(tr("Enable"))),
  8620. sVLowerAddr(new ShortHexSpinBox),sVUpperAddr(new ShortHexSpinBox),
  8621. sVLower(new QDoubleSpinBox),sVUpper(new QDoubleSpinBox),
  8622. sVWritable(new QCheckBox(tr("Enable"))),
  8623. sVOutputAddr(new ShortHexSpinBox),
  8624. pVColumnName(new QLineEdit),sVColumnName(new QLineEdit)
  8625. {
  8626. QHBoxLayout*layout= new QHBoxLayout;
  8627. QWidget*form= new QWidget;
  8628. QHBoxLayout*masterLayout= new QHBoxLayout;
  8629. QVBoxLayout*portAndDeviceLayout= new QVBoxLayout;
  8630. QVBoxLayout*seriesLayout= new QVBoxLayout;
  8631. QFormLayout*serialSection= new QFormLayout;
  8632. serialSection->addRow(QString(tr("Port:")),port);
  8633. serialSection->addRow(QString(tr("Baud rate:")),baud);
  8634. serialSection->addRow(QString(tr("Parity:")),parity);
  8635. serialSection->addRow(QString(tr("Flow control:")),flow);
  8636. serialSection->addRow(QString(tr("Stop bits:")),stop);
  8637. QGroupBox*serialSectionBox= new QGroupBox(tr("Serial Port Configuration"));
  8638. serialSectionBox->setLayout(serialSection);
  8639. portAndDeviceLayout->addWidget(serialSectionBox);
  8640. QFormLayout*deviceSection= new QFormLayout;
  8641. station->setMinimum(1);
  8642. station->setMaximum(255);
  8643. decimalPosition->setMinimum(0);
  8644. decimalPosition->setMaximum(9);
  8645. valueF->setMinimum(0);
  8646. valueF->setMaximum(0xFFFF);
  8647. valueC->setMinimum(0);
  8648. valueC->setMaximum(0xFFFF);
  8649. fixedUnit->addItem(tr("Fahrenheit"),QVariant(QString("F")));
  8650. fixedUnit->addItem(tr("Celsius"),QVariant(QString("C")));
  8651. deviceSection->addRow(tr("Station:"),station);
  8652. deviceSection->addRow(tr("Decimal position from device:"),decimalQuery);
  8653. deviceSection->addRow(tr("Decimal position relative address:"),decimalAddress);
  8654. deviceSection->addRow(tr("Fixed decimal position:"),decimalPosition);
  8655. deviceSection->addRow(tr("Measurement unit from device:"),unitQuery);
  8656. deviceSection->addRow(tr("Current unit relative address:"),unitAddress);
  8657. deviceSection->addRow(tr("Value for Fahrenheit:"),valueF);
  8658. deviceSection->addRow(tr("Value for Celsius:"),valueC);
  8659. deviceSection->addRow(tr("Fixed unit:"),fixedUnit);
  8660. QGroupBox*deviceSectionBox= new QGroupBox(tr("Device Configuration"));
  8661. deviceSectionBox->setLayout(deviceSection);
  8662. portAndDeviceLayout->addWidget(deviceSectionBox);
  8663. QFormLayout*pVSection= new QFormLayout;
  8664. pVSection->addRow(tr("Value relative address:"),pVAddress);
  8665. pVSection->addRow(tr("PV column name:"),pVColumnName);
  8666. QCheckBox*pVHideBox= new QCheckBox(tr("Hide this channel"));
  8667. pVSection->addRow(pVHideBox);
  8668. QGroupBox*processValueBox= new QGroupBox(tr("Process Value"));
  8669. processValueBox->setLayout(pVSection);
  8670. seriesLayout->addWidget(processValueBox);
  8671. QFormLayout*sVSection= new QFormLayout;
  8672. sVLower->setDecimals(1);
  8673. sVLower->setMinimum(0.0);
  8674. sVLower->setMaximum(999.9);
  8675. sVUpper->setDecimals(1);
  8676. sVUpper->setMinimum(0.0);
  8677. sVUpper->setMaximum(999.9);
  8678. sVSection->addRow(tr("Set value:"),sVEnabled);
  8679. sVSection->addRow(tr("Read relative address:"),sVReadAddress);
  8680. sVSection->addRow(tr("SV column name:"),sVColumnName);
  8681. sVSection->addRow(tr("Limits from device:"),deviceLimit);
  8682. sVSection->addRow(tr("Lower limit relative address:"),sVLowerAddr);
  8683. sVSection->addRow(tr("Upper limit relative address:"),sVUpperAddr);
  8684. sVSection->addRow(tr("Lower limit:"),sVLower);
  8685. sVSection->addRow(tr("Upper limit:"),sVUpper);
  8686. sVSection->addRow(tr("Output set value:"),sVWritable);
  8687. sVSection->addRow(tr("Output relative address:"),sVOutputAddr);
  8688. QCheckBox*sVHideBox= new QCheckBox(tr("Hide this channel"));
  8689. sVSection->addRow(sVHideBox);
  8690. QGroupBox*setValueBox= new QGroupBox(tr("Set Value"));
  8691. setValueBox->setLayout(sVSection);
  8692. seriesLayout->addWidget(setValueBox);
  8693. masterLayout->addLayout(portAndDeviceLayout);
  8694. masterLayout->addLayout(seriesLayout);
  8695. form->setLayout(masterLayout);
  8696. /*801:*/
  8697. #line 16668 "./typica.w"
  8698. QDomElement referenceElement=
  8699. model->referenceElement(model->data(index,Qt::UserRole).toString());
  8700. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  8701. QDomElement node;
  8702. /*:801*/
  8703. #line 19298 "./typica.w"
  8704. for(int i= 0;i<configData.size();i++)
  8705. {
  8706. node= configData.at(i).toElement();
  8707. if(node.attribute("name")=="port")
  8708. {
  8709. QString portname= node.attribute("value");
  8710. int idx= port->findText(portname);
  8711. if(idx>=0)
  8712. {
  8713. port->setCurrentIndex(idx);
  8714. }
  8715. else
  8716. {
  8717. port->addItem(portname);
  8718. }
  8719. }
  8720. else if(node.attribute("name")=="baud")
  8721. {
  8722. baud->setCurrentIndex(baud->findText(node.attribute("value")));
  8723. }
  8724. else if(node.attribute("name")=="parity")
  8725. {
  8726. parity->setCurrentIndex(parity->findData(node.attribute("value")));
  8727. }
  8728. else if(node.attribute("name")=="flow")
  8729. {
  8730. flow->setCurrentIndex(flow->findData(node.attribute("value")));
  8731. }
  8732. else if(node.attribute("name")=="stop")
  8733. {
  8734. stop->setCurrentIndex(stop->findData(node.attribute("value")));
  8735. }
  8736. else if(node.attribute("name")=="station")
  8737. {
  8738. station->setValue(node.attribute("value").toInt());
  8739. }
  8740. else if(node.attribute("name")=="decimalQuery")
  8741. {
  8742. if(node.attribute("value")=="true")
  8743. {
  8744. decimalQuery->setChecked(true);
  8745. }
  8746. else
  8747. {
  8748. decimalQuery->setChecked(false);
  8749. }
  8750. }
  8751. else if(node.attribute("name")=="decimalAddress")
  8752. {
  8753. decimalAddress->setValue(node.attribute("value").toInt());
  8754. }
  8755. else if(node.attribute("name")=="decimalPosition")
  8756. {
  8757. decimalPosition->setValue(node.attribute("value").toInt());
  8758. }
  8759. else if(node.attribute("name")=="unitQuery")
  8760. {
  8761. if(node.attribute("value")=="true")
  8762. {
  8763. unitQuery->setChecked(true);
  8764. }
  8765. else
  8766. {
  8767. unitQuery->setChecked(false);
  8768. }
  8769. }
  8770. else if(node.attribute("name")=="unitAddress")
  8771. {
  8772. unitAddress->setValue(node.attribute("value").toInt());
  8773. }
  8774. else if(node.attribute("name")=="valueF")
  8775. {
  8776. valueF->setValue(node.attribute("value").toInt());
  8777. }
  8778. else if(node.attribute("name")=="valueC")
  8779. {
  8780. valueC->setValue(node.attribute("value").toInt());
  8781. }
  8782. else if(node.attribute("name")=="fixedUnit")
  8783. {
  8784. fixedUnit->setCurrentIndex(fixedUnit->findText(node.attribute("value")));
  8785. }
  8786. else if(node.attribute("name")=="pVAddress")
  8787. {
  8788. pVAddress->setValue(node.attribute("value").toInt());
  8789. }
  8790. else if(node.attribute("name")=="sVEnabled")
  8791. {
  8792. if(node.attribute("value")=="true")
  8793. {
  8794. sVEnabled->setChecked(true);
  8795. }
  8796. else
  8797. {
  8798. sVEnabled->setChecked(false);
  8799. }
  8800. }
  8801. else if(node.attribute("name")=="sVReadAddress")
  8802. {
  8803. sVReadAddress->setValue(node.attribute("value").toInt());
  8804. }
  8805. else if(node.attribute("name")=="deviceLimit")
  8806. {
  8807. if(node.attribute("value")=="true")
  8808. {
  8809. deviceLimit->setChecked(true);
  8810. }
  8811. else
  8812. {
  8813. deviceLimit->setChecked(false);
  8814. }
  8815. }
  8816. else if(node.attribute("name")=="sVLowerAddr")
  8817. {
  8818. sVLowerAddr->setValue(node.attribute("value").toInt());
  8819. }
  8820. else if(node.attribute("name")=="sVUpperAddr")
  8821. {
  8822. sVUpperAddr->setValue(node.attribute("value").toInt());
  8823. }
  8824. else if(node.attribute("name")=="sVLower")
  8825. {
  8826. sVLower->setValue(node.attribute("value").toDouble());
  8827. }
  8828. else if(node.attribute("name")=="sVUpper")
  8829. {
  8830. sVUpper->setValue(node.attribute("value").toDouble());
  8831. }
  8832. else if(node.attribute("name")=="sVWritable")
  8833. {
  8834. if(node.attribute("value")=="true")
  8835. {
  8836. sVWritable->setChecked(true);
  8837. }
  8838. else
  8839. {
  8840. sVWritable->setChecked(false);
  8841. }
  8842. }
  8843. else if(node.attribute("name")=="sVOutputAddr")
  8844. {
  8845. sVOutputAddr->setValue(node.attribute("value").toInt());
  8846. }
  8847. else if(node.attribute("name")=="pvcolname")
  8848. {
  8849. pVColumnName->setText(node.attribute("value"));
  8850. }
  8851. else if(node.attribute("name")=="svcolname")
  8852. {
  8853. sVColumnName->setText(node.attribute("value"));
  8854. }
  8855. else if(node.attribute("name")=="pvhidden")
  8856. {
  8857. pVHideBox->setChecked(node.attribute("value")=="true");
  8858. }
  8859. else if(node.attribute("name")=="svhidden")
  8860. {
  8861. sVHideBox->setChecked(node.attribute("value")=="true");
  8862. }
  8863. }
  8864. updatePort(port->currentText());
  8865. updateBaudRate(baud->currentText());
  8866. updateParity(parity->itemData(parity->currentIndex()).toString());
  8867. updateFlowControl(flow->itemData(flow->currentIndex()).toString());
  8868. updateStopBits(stop->itemData(stop->currentIndex()).toString());
  8869. updateStation(station->value());
  8870. updateFixedDecimal(decimalQuery->isChecked());
  8871. updateDecimalAddress(decimalAddress->value());
  8872. updateDecimalPosition(decimalPosition->value());
  8873. updateFixedUnit(unitQuery->isChecked());
  8874. updateUnitAddress(unitAddress->value());
  8875. updateValueForF(valueF->value());
  8876. updateValueForC(valueC->value());
  8877. updateUnit(fixedUnit->currentText());
  8878. updatePVAddress(pVAddress->value());
  8879. updateSVEnabled(sVEnabled->isChecked());
  8880. updateSVReadAddress(sVReadAddress->value());
  8881. updateDeviceLimit(deviceLimit->isChecked());
  8882. updateSVLowerAddress(sVLowerAddr->value());
  8883. updateSVUpperAddress(sVUpperAddr->value());
  8884. updateSVLower(sVLower->value());
  8885. updateSVUpper(sVUpper->value());
  8886. updateSVWritable(sVWritable->isChecked());
  8887. updateSVWriteAddress(sVOutputAddr->value());
  8888. updatePVColumnName(pVColumnName->text());
  8889. updateSVColumnName(sVColumnName->text());
  8890. updatePVHidden(pVHideBox->isChecked());
  8891. updateSVHidden(sVHideBox->isChecked());
  8892. connect(port,SIGNAL(currentIndexChanged(QString)),this,SLOT(updatePort(QString)));
  8893. connect(port,SIGNAL(editTextChanged(QString)),this,SLOT(updatePort(QString)));
  8894. connect(baud,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateBaudRate(QString)));
  8895. connect(parity,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateParity(QString)));
  8896. connect(flow,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateFlowControl(QString)));
  8897. connect(stop,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateStopBits(QString)));
  8898. connect(station,SIGNAL(valueChanged(int)),this,SLOT(updateStation(int)));
  8899. connect(decimalQuery,SIGNAL(toggled(bool)),this,SLOT(updateFixedDecimal(bool)));
  8900. connect(decimalAddress,SIGNAL(valueChanged(int)),this,SLOT(updateDecimalAddress(int)));
  8901. connect(decimalPosition,SIGNAL(valueChanged(int)),this,SLOT(updateDecimalPosition(int)));
  8902. connect(unitQuery,SIGNAL(toggled(bool)),this,SLOT(updateFixedUnit(bool)));
  8903. connect(unitAddress,SIGNAL(valueChanged(int)),this,SLOT(updateUnitAddress(int)));
  8904. connect(valueF,SIGNAL(valueChanged(int)),this,SLOT(updateValueForF(int)));
  8905. connect(valueC,SIGNAL(valueChanged(int)),this,SLOT(updateValueForC(int)));
  8906. connect(fixedUnit,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateUnit(QString)));
  8907. connect(pVAddress,SIGNAL(valueChanged(int)),this,SLOT(updatePVAddress(int)));
  8908. connect(sVEnabled,SIGNAL(toggled(bool)),this,SLOT(updateSVEnabled(bool)));
  8909. connect(sVReadAddress,SIGNAL(valueChanged(int)),this,SLOT(updateSVReadAddress(int)));
  8910. connect(deviceLimit,SIGNAL(toggled(bool)),this,SLOT(updateDeviceLimit(bool)));
  8911. connect(sVLowerAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVLowerAddress(int)));
  8912. connect(sVUpperAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVUpperAddress(int)));
  8913. connect(sVLower,SIGNAL(valueChanged(double)),this,SLOT(updateSVLower(double)));
  8914. connect(sVUpper,SIGNAL(valueChanged(double)),this,SLOT(updateSVUpper(double)));
  8915. connect(sVWritable,SIGNAL(toggled(bool)),this,SLOT(updateSVWritable(bool)));
  8916. connect(sVOutputAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVWriteAddress(int)));
  8917. connect(pVColumnName,SIGNAL(textEdited(QString)),this,SLOT(updatePVColumnName(QString)));
  8918. connect(sVColumnName,SIGNAL(textEdited(QString)),this,SLOT(updateSVColumnName(QString)));
  8919. connect(pVHideBox,SIGNAL(toggled(bool)),this,SLOT(updatePVHidden(bool)));
  8920. connect(sVHideBox,SIGNAL(toggled(bool)),this,SLOT(updateSVHidden(bool)));
  8921. layout->addWidget(form);
  8922. setLayout(layout);
  8923. }
  8924. void ModbusConfigurator::updatePort(const QString&newPort)
  8925. {
  8926. updateAttribute("port",newPort);
  8927. }
  8928. void ModbusConfigurator::updateBaudRate(const QString&newRate)
  8929. {
  8930. updateAttribute("baud",newRate);
  8931. }
  8932. void ModbusConfigurator::updateParity(const QString&)
  8933. {
  8934. updateAttribute("parity",parity->itemData(parity->currentIndex()).toString());
  8935. }
  8936. void ModbusConfigurator::updateFlowControl(const QString&)
  8937. {
  8938. updateAttribute("flow",flow->itemData(flow->currentIndex()).toString());
  8939. }
  8940. void ModbusConfigurator::updateStopBits(const QString&)
  8941. {
  8942. updateAttribute("stop",stop->itemData(stop->currentIndex()).toString());
  8943. }
  8944. void ModbusConfigurator::updateStation(int station)
  8945. {
  8946. updateAttribute("station",QString("%1").arg(station));
  8947. }
  8948. void ModbusConfigurator::updateFixedDecimal(bool fixed)
  8949. {
  8950. updateAttribute("decimalQuery",fixed?"true":"false");
  8951. }
  8952. void ModbusConfigurator::updateDecimalAddress(int address)
  8953. {
  8954. updateAttribute("decimalAddress",QString("%1").arg(address));
  8955. }
  8956. void ModbusConfigurator::updateDecimalPosition(int position)
  8957. {
  8958. updateAttribute("decimalPosition",QString("%1").arg(position));
  8959. }
  8960. void ModbusConfigurator::updateFixedUnit(bool fixed)
  8961. {
  8962. updateAttribute("unitQuery",fixed?"true":"false");
  8963. }
  8964. void ModbusConfigurator::updateUnitAddress(int address)
  8965. {
  8966. updateAttribute("unitAddress",QString("%1").arg(address));
  8967. }
  8968. void ModbusConfigurator::updateValueForF(int value)
  8969. {
  8970. updateAttribute("valueF",QString("%1").arg(value));
  8971. }
  8972. void ModbusConfigurator::updateValueForC(int value)
  8973. {
  8974. updateAttribute("valueC",QString("%1").arg(value));
  8975. }
  8976. void ModbusConfigurator::updateUnit(const QString&newUnit)
  8977. {
  8978. updateAttribute("fixedUnit",newUnit);
  8979. }
  8980. void ModbusConfigurator::updatePVAddress(int address)
  8981. {
  8982. updateAttribute("pVAddress",QString("%1").arg(address));
  8983. }
  8984. void ModbusConfigurator::updateSVEnabled(bool enabled)
  8985. {
  8986. updateAttribute("sVEnabled",enabled?"true":"false");
  8987. }
  8988. void ModbusConfigurator::updateSVReadAddress(int address)
  8989. {
  8990. updateAttribute("sVReadAddress",QString("%1").arg(address));
  8991. }
  8992. void ModbusConfigurator::updateDeviceLimit(bool query)
  8993. {
  8994. updateAttribute("deviceLimit",query?"true":"false");
  8995. }
  8996. void ModbusConfigurator::updateSVLowerAddress(int address)
  8997. {
  8998. updateAttribute("sVLowerAddr",QString("%1").arg(address));
  8999. }
  9000. void ModbusConfigurator::updateSVUpperAddress(int address)
  9001. {
  9002. updateAttribute("sVUpperAddr",QString("%1").arg(address));
  9003. }
  9004. void ModbusConfigurator::updateSVLower(double value)
  9005. {
  9006. updateAttribute("sVLower",QString("%1").arg(value));
  9007. }
  9008. void ModbusConfigurator::updateSVUpper(double value)
  9009. {
  9010. updateAttribute("sVUpper",QString("%1").arg(value));
  9011. }
  9012. void ModbusConfigurator::updateSVWritable(bool canWriteSV)
  9013. {
  9014. updateAttribute("sVWritable",canWriteSV?"true":"false");
  9015. }
  9016. void ModbusConfigurator::updateSVWriteAddress(int address)
  9017. {
  9018. updateAttribute("sVOutputAddr",QString("%1").arg(address));
  9019. }
  9020. void ModbusConfigurator::updatePVColumnName(const QString&name)
  9021. {
  9022. updateAttribute("pvcolname",name);
  9023. }
  9024. void ModbusConfigurator::updateSVColumnName(const QString&name)
  9025. {
  9026. updateAttribute("svcolname",name);
  9027. }
  9028. void ModbusConfigurator::updatePVHidden(bool hidden)
  9029. {
  9030. updateAttribute("pvhidden",hidden?"true":"false");
  9031. }
  9032. void ModbusConfigurator::updateSVHidden(bool hidden)
  9033. {
  9034. updateAttribute("svhidden",hidden?"true":"false");
  9035. }
  9036. /*:897*/
  9037. #line 581 "./typica.w"
  9038. /*836:*/
  9039. #line 17475 "./typica.w"
  9040. ShortHexSpinBox::ShortHexSpinBox(QWidget*parent):QSpinBox(parent)
  9041. {
  9042. setMinimum(0);
  9043. setMaximum(0xFFFF);
  9044. setPrefix("0x");
  9045. setMinimumWidth(65);
  9046. }
  9047. QValidator::State ShortHexSpinBox::validate(QString&input,int&)const
  9048. {
  9049. if(input.size()==2)
  9050. {
  9051. return QValidator::Intermediate;
  9052. }
  9053. bool okay;
  9054. input.toInt(&okay,16);
  9055. if(okay)
  9056. {
  9057. return QValidator::Acceptable;
  9058. }
  9059. return QValidator::Invalid;
  9060. }
  9061. int ShortHexSpinBox::valueFromText(const QString&text)const
  9062. {
  9063. return text.toInt(NULL,16);
  9064. }
  9065. QString ShortHexSpinBox::textFromValue(int value)const
  9066. {
  9067. QString retval;
  9068. retval.setNum(value,16);
  9069. while(retval.size()<4)
  9070. {
  9071. retval.prepend("0");
  9072. }
  9073. return retval.toUpper();
  9074. }
  9075. /*:836*/
  9076. #line 582 "./typica.w"
  9077. /*881:*/
  9078. #line 18507 "./typica.w"
  9079. ModbusRTUDevice::ModbusRTUDevice(DeviceTreeModel*model,const QModelIndex&index)
  9080. :QObject(NULL),messageDelayTimer(new QTimer),commTimeout(new QTimer),unitIsF(true),readingsv(false),
  9081. waiting(false)
  9082. {
  9083. QDomElement portReferenceElement= model->referenceElement(model->data(index,
  9084. Qt::UserRole).toString());
  9085. QDomNodeList portConfigData= portReferenceElement.elementsByTagName("attribute");
  9086. QDomElement node;
  9087. QVariantMap attributes;
  9088. for(int i= 0;i<portConfigData.size();i++)
  9089. {
  9090. node= portConfigData.at(i).toElement();
  9091. attributes.insert(node.attribute("name"),node.attribute("value"));
  9092. }
  9093. port= new QextSerialPort(attributes.value("port").toString(),
  9094. QextSerialPort::EventDriven);
  9095. int baudRate= attributes.value("baud").toInt();
  9096. port->setBaudRate((BaudRateType)baudRate);
  9097. double temp= ((double)(1)/(double)(baudRate))*48;
  9098. delayTime= (int)(temp*3000);
  9099. messageDelayTimer->setSingleShot(true);
  9100. commTimeout->setSingleShot(true);
  9101. connect(messageDelayTimer,SIGNAL(timeout()),this,SLOT(sendNextMessage()));
  9102. connect(commTimeout,SIGNAL(timeout()),this,SLOT(timeout()));
  9103. port->setDataBits(DATA_8);
  9104. port->setParity((ParityType)attributes.value("parity").toInt());
  9105. port->setStopBits((StopBitsType)attributes.value("stop").toInt());
  9106. port->setFlowControl((FlowType)attributes.value("flow").toInt());
  9107. connect(port,SIGNAL(readyRead()),this,SLOT(dataAvailable()));
  9108. port->open(QIODevice::ReadWrite);
  9109. station= (char)attributes.value("station").toInt();
  9110. if(attributes.value("decimalQuery")=="true")
  9111. {
  9112. decimalPosition= 0;
  9113. QByteArray message;
  9114. message.append(station);
  9115. message.append((char)0x03);
  9116. quint16 address= (quint16)attributes.value("decimalAddress").toInt();
  9117. char*addressBytes= (char*)&address;
  9118. message.append(addressBytes[1]);
  9119. message.append(addressBytes[0]);
  9120. message.append((char)0x00);
  9121. message.append((char)0x01);
  9122. queueMessage(message,this,"decimalResponse(QByteArray)");
  9123. }
  9124. else
  9125. {
  9126. decimalPosition= attributes.value("decimalPosition").toInt();
  9127. }
  9128. valueF= attributes.value("valueF").toInt();
  9129. valueC= attributes.value("valueC").toInt();
  9130. if(attributes.value("unitQuery")=="true")
  9131. {
  9132. QByteArray message;
  9133. message.append(station);
  9134. message.append((char)0x03);
  9135. quint16 address= (quint16)attributes.value("unitAddress").toInt();
  9136. char*addressBytes= (char*)&address;
  9137. message.append(addressBytes[1]);
  9138. message.append(addressBytes[0]);
  9139. message.append((char)0x00);
  9140. message.append((char)0x01);
  9141. queueMessage(message,this,"unitResponse(QByteArray)");
  9142. }
  9143. else
  9144. {
  9145. if(attributes.value("fixedUnit")=="Celsius")
  9146. {
  9147. unitIsF= false;
  9148. }
  9149. }
  9150. if(attributes.value("sVWritable")=="true")
  9151. {
  9152. if(attributes.value("deviceLimit")=="true")
  9153. {
  9154. QByteArray lmessage;
  9155. lmessage.append(station);
  9156. lmessage.append((char)0x03);
  9157. quint16 laddress= (quint16)attributes.value("sVLowerAddr").toInt();
  9158. char*addressBytes= (char*)&laddress;
  9159. lmessage.append(addressBytes[1]);
  9160. lmessage.append(addressBytes[0]);
  9161. lmessage.append((char)0x00);
  9162. lmessage.append((char)0x01);
  9163. queueMessage(lmessage,this,"svlResponse(QByteArray)");
  9164. QByteArray umessage;
  9165. umessage.append(station);
  9166. umessage.append((char)0x03);
  9167. quint16 uaddress= (quint16)attributes.value("sVUpperAddr").toInt();
  9168. addressBytes= (char*)&uaddress;
  9169. umessage.append(addressBytes[1]);
  9170. umessage.append(addressBytes[0]);
  9171. umessage.append((char)0x00);
  9172. umessage.append((char)0x01);
  9173. queueMessage(umessage,this,"svuResponse(QByteArray)");
  9174. }
  9175. else
  9176. {
  9177. outputSVLower= attributes.value("sVLower").toDouble();
  9178. outputSVUpper= attributes.value("sVUpper").toDouble();
  9179. }
  9180. outputSVStub.append(station);
  9181. outputSVStub.append((char)0x06);
  9182. quint16 address= (quint16)attributes.value("sVOutputAddr").toInt();
  9183. char*addressBytes= (char*)&address;
  9184. outputSVStub.append(addressBytes[1]);
  9185. outputSVStub.append(addressBytes[0]);
  9186. }
  9187. Channel*pv= new Channel;
  9188. channels.append(pv);
  9189. pvStub.append(station);
  9190. pvStub.append((char)0x04);
  9191. pvaddress= (quint16)attributes.value("pVAddress").toInt();
  9192. char*pvac= (char*)&pvaddress;
  9193. pvStub.append(pvac[1]);
  9194. pvStub.append(pvac[0]);
  9195. pvStub.append((char)0x00);
  9196. pvStub.append((char)0x01);
  9197. svenabled= attributes.value("sVEnabled").toBool();
  9198. if(svenabled)
  9199. {
  9200. Channel*sv= new Channel;
  9201. channels.append(sv);
  9202. svStub.append(station);
  9203. svStub.append((char)0x04);
  9204. svaddress= (quint16)attributes.value("sVReadAddress").toInt();
  9205. char*svac= (char*)&svaddress;
  9206. svStub.append(svac[1]);
  9207. svStub.append(svac[0]);
  9208. svStub.append((char)0x00);
  9209. svStub.append((char)0x01);
  9210. if(svaddress-pvaddress==1)
  9211. {
  9212. mStub.append(station);
  9213. mStub.append((char)0x04);
  9214. mStub.append(pvac[1]);
  9215. mStub.append(pvac[0]);
  9216. mStub.append((char)0x00);
  9217. mStub.append((char)0x02);
  9218. }
  9219. }
  9220. connect(this,SIGNAL(queueEmpty()),this,SLOT(requestMeasurement()));
  9221. requestMeasurement();
  9222. }
  9223. double ModbusRTUDevice::SVLower()
  9224. {
  9225. return outputSVLower;
  9226. }
  9227. double ModbusRTUDevice::SVUpper()
  9228. {
  9229. return outputSVUpper;
  9230. }
  9231. int ModbusRTUDevice::decimals()
  9232. {
  9233. return decimalPosition;
  9234. }
  9235. void ModbusRTUDevice::decimalResponse(QByteArray response)
  9236. {
  9237. quint16 temp;
  9238. char*tchar= (char*)&temp;
  9239. tchar[1]= response.at(3);
  9240. tchar[0]= response.at(4);
  9241. decimalPosition= temp;
  9242. emit SVDecimalChanged(decimalPosition);
  9243. qDebug()<<"Received decimal response";
  9244. }
  9245. void ModbusRTUDevice::unitResponse(QByteArray response)
  9246. {
  9247. quint16 temp;
  9248. char*tchar= (char*)&temp;
  9249. tchar[1]= response.at(3);
  9250. tchar[0]= response.at(4);
  9251. int value= temp;
  9252. if(value==valueF)
  9253. {
  9254. unitIsF= true;
  9255. }
  9256. else
  9257. {
  9258. unitIsF= false;
  9259. }
  9260. qDebug()<<"Received unit response";
  9261. }
  9262. void ModbusRTUDevice::svlResponse(QByteArray response)
  9263. {
  9264. quint16 temp;
  9265. char*tchar= (char*)&temp;
  9266. tchar[1]= response.at(3);
  9267. tchar[0]= response.at(4);
  9268. outputSVLower= (double)temp;
  9269. for(int i= 0;i<decimalPosition;i++)
  9270. {
  9271. outputSVLower/= 10;
  9272. }
  9273. emit SVLowerChanged(outputSVLower);
  9274. qDebug()<<"Received set value lower bound response";
  9275. }
  9276. void ModbusRTUDevice::svuResponse(QByteArray response)
  9277. {
  9278. quint16 temp;
  9279. char*tchar= (char*)&temp;
  9280. tchar[1]= response.at(3);
  9281. tchar[0]= response.at(4);
  9282. outputSVUpper= (double)temp;
  9283. for(int i= 0;i<decimalPosition;i++)
  9284. {
  9285. outputSVUpper/= 10;
  9286. }
  9287. emit SVUpperChanged(outputSVUpper);
  9288. qDebug()<<"Received set value upper bound response";
  9289. }
  9290. void ModbusRTUDevice::requestMeasurement()
  9291. {
  9292. if(mStub.length()> 0)
  9293. {
  9294. queueMessage(mStub,this,"mResponse(QByteArray)");
  9295. }
  9296. else
  9297. {
  9298. queueMessage(pvStub,this,"mResponse(QByteArray)");
  9299. if(svenabled)
  9300. {
  9301. queueMessage(svStub,this,"mResponse(QByteArray)");
  9302. }
  9303. }
  9304. }
  9305. void ModbusRTUDevice::mResponse(QByteArray response)
  9306. {
  9307. QTime time= QTime::currentTime();
  9308. if(response.at(2)==0x04)
  9309. {
  9310. /*882:*/
  9311. #line 18761 "./typica.w"
  9312. quint16 pv;
  9313. quint16 sv;
  9314. char*pvBytes= (char*)&pv;
  9315. char*svBytes= (char*)&sv;
  9316. pvBytes[1]= response.at(3);
  9317. pvBytes[0]= response.at(4);
  9318. svBytes[1]= response.at(5);
  9319. svBytes[0]= response.at(6);
  9320. double pvOut= (double)pv;
  9321. double svOut= (double)sv;
  9322. for(int i= 0;i<decimalPosition;i++)
  9323. {
  9324. pvOut/= 10;
  9325. svOut/= 10;
  9326. }
  9327. if(!unitIsF)
  9328. {
  9329. pvOut= pvOut*9/5+32;
  9330. svOut= svOut*9/5+32;
  9331. }
  9332. Measurement pvm(pvOut,time,Units::Fahrenheit);
  9333. Measurement svm(svOut,time,Units::Fahrenheit);
  9334. channels.at(0)->input(pvm);
  9335. channels.at(1)->input(svm);
  9336. /*:882*/
  9337. #line 18748 "./typica.w"
  9338. }
  9339. else
  9340. {
  9341. /*883:*/
  9342. #line 18791 "./typica.w"
  9343. quint16 value;
  9344. char*valueBytes= (char*)&value;
  9345. valueBytes[1]= response.at(3);
  9346. valueBytes[0]= response.at(4);
  9347. double valueOut= (double)value;
  9348. for(int i= 0;i<decimalPosition;i++)
  9349. {
  9350. valueOut/= 10;
  9351. }
  9352. if(!unitIsF)
  9353. {
  9354. valueOut= valueOut*9/5+32;
  9355. }
  9356. if(!svenabled)
  9357. {
  9358. Measurement vm(valueOut,time,Units::Fahrenheit);
  9359. channels.at(0)->input(vm);
  9360. }
  9361. else
  9362. {
  9363. if(readingsv)
  9364. {
  9365. Measurement pvm(savedpv,time,Units::Fahrenheit);
  9366. Measurement svm(valueOut,time,Units::Fahrenheit);
  9367. channels.at(0)->input(pvm);
  9368. channels.at(1)->input(svm);
  9369. readingsv= false;
  9370. }
  9371. else
  9372. {
  9373. savedpv= valueOut;
  9374. readingsv= true;
  9375. }
  9376. }
  9377. /*:883*/
  9378. #line 18752 "./typica.w"
  9379. }
  9380. }
  9381. /*:881*//*884:*/
  9382. #line 18829 "./typica.w"
  9383. ModbusRTUDevice::~ModbusRTUDevice()
  9384. {
  9385. commTimeout->stop();
  9386. messageDelayTimer->stop();
  9387. port->close();
  9388. }
  9389. /*:884*//*885:*/
  9390. #line 18856 "./typica.w"
  9391. void ModbusRTUDevice::dataAvailable()
  9392. {
  9393. if(messageDelayTimer->isActive())
  9394. {
  9395. messageDelayTimer->stop();
  9396. }
  9397. responseBuffer.append(port->readAll());
  9398. /*886:*/
  9399. #line 18902 "./typica.w"
  9400. if(responseBuffer.size()<5)
  9401. {
  9402. return;
  9403. }
  9404. switch(responseBuffer.at(1))
  9405. {
  9406. case 0x01:
  9407. case 0x02:
  9408. if(responseBuffer.size()<6)
  9409. {
  9410. return;
  9411. }
  9412. responseBuffer= responseBuffer.left(6);
  9413. break;
  9414. case 0x03:
  9415. case 0x04:
  9416. if(responseBuffer.size()<5+responseBuffer.at(2))
  9417. {
  9418. return;
  9419. }
  9420. responseBuffer= responseBuffer.left(5+responseBuffer.at(2));
  9421. break;
  9422. case 0x05:
  9423. case 0x06:
  9424. case 0x10:
  9425. if(responseBuffer.size()<8)
  9426. {
  9427. return;
  9428. }
  9429. responseBuffer= responseBuffer.left(8);
  9430. break;
  9431. }
  9432. /*:886*/
  9433. #line 18864 "./typica.w"
  9434. commTimeout->stop();
  9435. if(calculateCRC(responseBuffer)==0)
  9436. {
  9437. QObject*object= retObjQueue.at(0);
  9438. char*method= callbackQueue.at(0);
  9439. QMetaMethod metamethod= object->metaObject()->
  9440. method(object->metaObject()->
  9441. indexOfMethod(QMetaObject::normalizedSignature(method)));
  9442. metamethod.invoke(object,Qt::QueuedConnection,
  9443. Q_ARG(QByteArray,responseBuffer));
  9444. messageQueue.removeAt(0);
  9445. retObjQueue.removeAt(0);
  9446. callbackQueue.removeAt(0);
  9447. }
  9448. else
  9449. {
  9450. qDebug()<<"CRC failed";
  9451. }
  9452. messageDelayTimer->start(delayTime);
  9453. waiting= false;
  9454. responseBuffer.clear();
  9455. }
  9456. /*:885*//*887:*/
  9457. #line 18944 "./typica.w"
  9458. quint16 ModbusRTUDevice::calculateCRC(QByteArray data)
  9459. {
  9460. quint16 retval= 0xFFFF;
  9461. int i= 0;
  9462. while(i<data.size())
  9463. {
  9464. retval^= 0x00FF&(quint16)data.at(i);
  9465. for(int j= 0;j<8;j++)
  9466. {
  9467. if(retval&1)
  9468. {
  9469. retval= (retval>>1)^0xA001;
  9470. }
  9471. else
  9472. {
  9473. retval>>= 1;
  9474. }
  9475. }
  9476. i++;
  9477. }
  9478. return retval;
  9479. }
  9480. /*:887*//*888:*/
  9481. #line 18975 "./typica.w"
  9482. void ModbusRTUDevice::queueMessage(QByteArray request,QObject*object,
  9483. const char*callback)
  9484. {
  9485. messageQueue.append(request);
  9486. retObjQueue.append(object);
  9487. callbackQueue.append(const_cast<char*> (callback));
  9488. if(messageQueue.size()==1&&!(messageDelayTimer->isActive()))
  9489. {
  9490. sendNextMessage();
  9491. }
  9492. }
  9493. void ModbusRTUDevice::sendNextMessage()
  9494. {
  9495. if(messageQueue.size()> 0&&!waiting)
  9496. {
  9497. QByteArray message= messageQueue.at(0);
  9498. quint16 crc= calculateCRC(message);
  9499. char*check= (char*)&crc;
  9500. message.append(check[0]);
  9501. message.append(check[1]);
  9502. qDebug()<<"Writing"<<message.toHex();
  9503. port->write(message);
  9504. commTimeout->start(2000);
  9505. messageDelayTimer->start(delayTime);
  9506. waiting= true;
  9507. }
  9508. else
  9509. {
  9510. emit queueEmpty();
  9511. }
  9512. }
  9513. void ModbusRTUDevice::outputSV(double value)
  9514. {
  9515. for(int i= 0;i<decimalPosition;i++)
  9516. {
  9517. value*= 10;
  9518. }
  9519. quint16 outval= (quint16)value;
  9520. QByteArray message(outputSVStub);
  9521. char*valBytes= (char*)&outval;
  9522. message.append(valBytes[1]);
  9523. message.append(valBytes[0]);
  9524. queueMessage(message,this,"ignore(QByteArray)");
  9525. }
  9526. /*:888*//*889:*/
  9527. #line 19025 "./typica.w"
  9528. void ModbusRTUDevice::ignore(QByteArray)
  9529. {
  9530. return;
  9531. }
  9532. /*:889*//*890:*/
  9533. #line 19038 "./typica.w"
  9534. void ModbusRTUDevice::timeout()
  9535. {
  9536. qDebug()<<"Communications timeout.";
  9537. responseBuffer.clear();
  9538. waiting= false;
  9539. messageDelayTimer->start();
  9540. }
  9541. /*:890*/
  9542. #line 583 "./typica.w"
  9543. /*755:*/
  9544. #line 15593 "./typica.w"
  9545. DeviceTreeModelNode::DeviceTreeModelNode(QDomNode&node,int row,
  9546. DeviceTreeModelNode*parent)
  9547. :domNode(node),rowNumber(row),parentItem(parent)
  9548. {
  9549. }
  9550. DeviceTreeModelNode::~DeviceTreeModelNode()
  9551. {
  9552. QHash<int,DeviceTreeModelNode*> ::iterator i;
  9553. for(i= children.begin();i!=children.end();i++)
  9554. {
  9555. delete i.value();
  9556. }
  9557. }
  9558. DeviceTreeModelNode*DeviceTreeModelNode::parent()
  9559. {
  9560. return parentItem;
  9561. }
  9562. int DeviceTreeModelNode::row()
  9563. {
  9564. return rowNumber;
  9565. }
  9566. QDomNode DeviceTreeModelNode::node()const
  9567. {
  9568. return domNode;
  9569. }
  9570. DeviceTreeModelNode*DeviceTreeModelNode::child(int index)
  9571. {
  9572. if(children.contains(index))
  9573. {
  9574. return children[index];
  9575. }
  9576. if(index>=0&&index<domNode.childNodes().count())
  9577. {
  9578. QDomNode childNode= domNode.childNodes().item(index);
  9579. DeviceTreeModelNode*childItem= new DeviceTreeModelNode(childNode,
  9580. index,this);
  9581. children[index]= childItem;
  9582. return childItem;
  9583. }
  9584. return NULL;
  9585. }
  9586. /*:755*/
  9587. #line 584 "./typica.w"
  9588. /*757:*/
  9589. #line 15682 "./typica.w"
  9590. DeviceTreeModel::DeviceTreeModel(QObject*parent)
  9591. :QAbstractItemModel(parent)
  9592. {
  9593. document= AppInstance->deviceConfiguration();
  9594. QDomNodeList elements= document.elementsByTagName("devices");
  9595. if(elements.size()!=1)
  9596. {
  9597. qDebug()<<"Unexpected result when loading device map.";
  9598. }
  9599. treeRoot= elements.at(0);
  9600. root= new DeviceTreeModelNode(treeRoot,0);
  9601. elements= document.elementsByTagName("references");
  9602. if(elements.size()!=1)
  9603. {
  9604. qDebug()<<"No references section. Creating.";
  9605. referenceSection= document.createElement("references");
  9606. document.appendChild(referenceSection);
  9607. }
  9608. else
  9609. {
  9610. referenceSection= elements.at(0);
  9611. }
  9612. connect(this,SIGNAL(dataChanged(QModelIndex,QModelIndex)),
  9613. AppInstance,SLOT(saveDeviceConfiguration()));
  9614. connect(this,SIGNAL(modelReset()),
  9615. AppInstance,SLOT(saveDeviceConfiguration()));
  9616. connect(this,SIGNAL(rowsInserted(QModelIndex,int,int)),
  9617. AppInstance,SLOT(saveDeviceConfiguration()));
  9618. }
  9619. /*:757*//*758:*/
  9620. #line 15717 "./typica.w"
  9621. int DeviceTreeModel::columnCount(const QModelIndex&)const
  9622. {
  9623. return 1;
  9624. }
  9625. int DeviceTreeModel::rowCount(const QModelIndex&parent)const
  9626. {
  9627. if(parent.column()> 0)
  9628. {
  9629. return 0;
  9630. }
  9631. /*759:*/
  9632. #line 15736 "./typica.w"
  9633. DeviceTreeModelNode*parentItem;
  9634. if(!parent.isValid())
  9635. {
  9636. parentItem= root;
  9637. }
  9638. else
  9639. {
  9640. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  9641. }
  9642. /*:759*/
  9643. #line 15729 "./typica.w"
  9644. return parentItem->node().childNodes().count();
  9645. }
  9646. /*:758*//*760:*/
  9647. #line 15750 "./typica.w"
  9648. QModelIndex DeviceTreeModel::index(int row,int column,
  9649. const QModelIndex&parent)const
  9650. {
  9651. if(!hasIndex(row,column,parent))
  9652. {
  9653. return QModelIndex();
  9654. }
  9655. /*759:*/
  9656. #line 15736 "./typica.w"
  9657. DeviceTreeModelNode*parentItem;
  9658. if(!parent.isValid())
  9659. {
  9660. parentItem= root;
  9661. }
  9662. else
  9663. {
  9664. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  9665. }
  9666. /*:759*/
  9667. #line 15758 "./typica.w"
  9668. DeviceTreeModelNode*childItem= parentItem->child(row);
  9669. if(childItem)
  9670. {
  9671. return createIndex(row,column,childItem);
  9672. }
  9673. return QModelIndex();
  9674. }
  9675. /*:760*//*761:*/
  9676. #line 15769 "./typica.w"
  9677. QModelIndex DeviceTreeModel::parent(const QModelIndex&child)const
  9678. {
  9679. if(!child.isValid())
  9680. {
  9681. return QModelIndex();
  9682. }
  9683. DeviceTreeModelNode*childItem=
  9684. static_cast<DeviceTreeModelNode*> (child.internalPointer());
  9685. DeviceTreeModelNode*parentItem= childItem->parent();
  9686. if(!parentItem||parentItem==root)
  9687. {
  9688. return QModelIndex();
  9689. }
  9690. return createIndex(parentItem->row(),0,parentItem);
  9691. }
  9692. /*:761*//*762:*/
  9693. #line 15788 "./typica.w"
  9694. Qt::ItemFlags DeviceTreeModel::flags(const QModelIndex&index)const
  9695. {
  9696. if(!index.isValid())
  9697. {
  9698. return 0;
  9699. }
  9700. return Qt::ItemIsEnabled|Qt::ItemIsSelectable|Qt::ItemIsEditable;
  9701. }
  9702. /*:762*//*763:*/
  9703. #line 15803 "./typica.w"
  9704. QVariant DeviceTreeModel::data(const QModelIndex&index,int role)const
  9705. {
  9706. if(!index.isValid())
  9707. {
  9708. return QVariant();
  9709. }
  9710. if(role!=Qt::DisplayRole&&role!=Qt::UserRole&&role!=Qt::EditRole)
  9711. {
  9712. return QVariant();
  9713. }
  9714. DeviceTreeModelNode*item=
  9715. static_cast<DeviceTreeModelNode*> (index.internalPointer());
  9716. QDomNode node= item->node();
  9717. QDomElement element= node.toElement();
  9718. switch(role)
  9719. {
  9720. case Qt::DisplayRole:
  9721. case Qt::EditRole:
  9722. return QVariant(element.attribute("name"));
  9723. case Qt::UserRole:
  9724. return QVariant(element.attribute("reference"));
  9725. default:
  9726. return QVariant();
  9727. }
  9728. return QVariant();
  9729. }
  9730. /*:763*//*764:*/
  9731. #line 15835 "./typica.w"
  9732. bool DeviceTreeModel::setData(const QModelIndex&index,
  9733. const QVariant&value,int)
  9734. {
  9735. if(!index.isValid())
  9736. {
  9737. return false;
  9738. }
  9739. DeviceTreeModelNode*item=
  9740. static_cast<DeviceTreeModelNode*> (index.internalPointer());
  9741. QDomNode node= item->node();
  9742. QDomElement element= node.toElement();
  9743. element.setAttribute("name",value.toString());
  9744. emit dataChanged(index,index);
  9745. return true;
  9746. }
  9747. /*:764*//*765:*/
  9748. #line 15858 "./typica.w"
  9749. void DeviceTreeModel::newNode(const QString&name,const QString&driver,
  9750. const QModelIndex&parent)
  9751. {
  9752. QString referenceID= QUuid::createUuid().toString();
  9753. /*759:*/
  9754. #line 15736 "./typica.w"
  9755. DeviceTreeModelNode*parentItem;
  9756. if(!parent.isValid())
  9757. {
  9758. parentItem= root;
  9759. }
  9760. else
  9761. {
  9762. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  9763. }
  9764. /*:759*/
  9765. #line 15863 "./typica.w"
  9766. QDomNode parentNode= parentItem->node();
  9767. int newRowNumber= rowCount(parent);
  9768. beginInsertRows(parent,newRowNumber,newRowNumber);
  9769. QDomElement deviceElement= document.createElement("node");
  9770. deviceElement.setAttribute("name",name);
  9771. deviceElement.setAttribute("reference",referenceID);
  9772. parentNode.appendChild(deviceElement);
  9773. QDomElement referenceElement= document.createElement("reference");
  9774. referenceElement.setAttribute("id",referenceID);
  9775. referenceElement.setAttribute("driver",driver);
  9776. referenceSection.appendChild(referenceElement);
  9777. endInsertRows();
  9778. }
  9779. /*:765*//*766:*/
  9780. #line 15881 "./typica.w"
  9781. bool DeviceTreeModel::removeRows(int row,int count,const QModelIndex&parent)
  9782. {
  9783. /*759:*/
  9784. #line 15736 "./typica.w"
  9785. DeviceTreeModelNode*parentItem;
  9786. if(!parent.isValid())
  9787. {
  9788. parentItem= root;
  9789. }
  9790. else
  9791. {
  9792. parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
  9793. }
  9794. /*:759*/
  9795. #line 15884 "./typica.w"
  9796. QDomNode parentNode= parentItem->node();
  9797. QDomNodeList childNodes= parentNode.childNodes();
  9798. if(childNodes.size()<row+count)
  9799. {
  9800. return false;
  9801. }
  9802. beginRemoveRows(parent,row,row+count-1);
  9803. QList<QDomElement> removalList;
  9804. for(int i= row;i<row+count;i++)
  9805. {
  9806. removalList.append(childNodes.at(i).toElement());
  9807. }
  9808. QDomElement element;
  9809. QDomElement reference;
  9810. for(int i= 0;i<count;i++)
  9811. {
  9812. element= removalList.at(i);
  9813. if(element.hasAttribute("reference"))
  9814. {
  9815. reference= referenceElement(element.attribute("reference"));
  9816. if(!reference.isNull())
  9817. {
  9818. referenceSection.removeChild(reference);
  9819. }
  9820. }
  9821. parentNode.removeChild(element);
  9822. }
  9823. endRemoveRows();
  9824. beginResetModel();
  9825. delete root;
  9826. root= new DeviceTreeModelNode(treeRoot,0);
  9827. endResetModel();
  9828. return true;
  9829. }
  9830. /*:766*//*767:*/
  9831. #line 15923 "./typica.w"
  9832. QDomElement DeviceTreeModel::referenceElement(const QString&id)
  9833. {
  9834. QDomNodeList childNodes= referenceSection.childNodes();
  9835. QDomElement element;
  9836. for(int i= 0;i<childNodes.size();i++)
  9837. {
  9838. element= childNodes.at(i).toElement();
  9839. if(element.hasAttribute("id"))
  9840. {
  9841. if(element.attribute("id")==id)
  9842. {
  9843. return element;
  9844. }
  9845. }
  9846. }
  9847. return QDomElement();
  9848. }
  9849. /*:767*//*768:*/
  9850. #line 15944 "./typica.w"
  9851. QVariant DeviceTreeModel::headerData(int,Qt::Orientation,int)const
  9852. {
  9853. return QVariant();
  9854. }
  9855. /*:768*//*769:*/
  9856. #line 15953 "./typica.w"
  9857. DeviceTreeModel::~DeviceTreeModel()
  9858. {
  9859. delete root;
  9860. }
  9861. /*:769*/
  9862. #line 585 "./typica.w"
  9863. /*796:*/
  9864. #line 16453 "./typica.w"
  9865. BasicDeviceConfigurationWidget::BasicDeviceConfigurationWidget(
  9866. DeviceTreeModel*model,const QModelIndex&index)
  9867. :QWidget(NULL),deviceModel(model),currentNode(index)
  9868. {
  9869. }
  9870. /*:796*//*797:*/
  9871. #line 16465 "./typica.w"
  9872. void BasicDeviceConfigurationWidget::updateAttribute(const QString&name,
  9873. const QString&value)
  9874. {
  9875. QDomElement referenceElement= deviceModel->referenceElement(
  9876. deviceModel->data(currentNode,Qt::UserRole).toString());
  9877. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  9878. QDomElement node;
  9879. bool found= false;
  9880. for(int i= 0;i<configData.size();i++)
  9881. {
  9882. node= configData.at(i).toElement();
  9883. if(node.attribute("name")==name)
  9884. {
  9885. node.setAttribute("value",value);
  9886. found= true;
  9887. break;
  9888. }
  9889. }
  9890. if(!found)
  9891. {
  9892. node= AppInstance->deviceConfiguration().createElement("attribute");
  9893. node.setAttribute("name",name);
  9894. node.setAttribute("value",value);
  9895. referenceElement.appendChild(node);
  9896. }
  9897. AppInstance->saveDeviceConfiguration();
  9898. }
  9899. /*:797*//*798:*/
  9900. #line 16499 "./typica.w"
  9901. void BasicDeviceConfigurationWidget::insertChildNode(const QString&name,
  9902. const QString&driver)
  9903. {
  9904. deviceModel->newNode(name,driver,currentNode);
  9905. }
  9906. /*:798*/
  9907. #line 586 "./typica.w"
  9908. /*787:*/
  9909. #line 16297 "./typica.w"
  9910. DeviceConfigurationWindow::DeviceConfigurationWindow():QWidget(NULL),
  9911. view(new QTreeView),configArea(new QScrollArea)
  9912. {
  9913. QSplitter*splitter= new QSplitter;
  9914. QWidget*leftWidget= new QWidget;
  9915. leftWidget->setMinimumWidth(200);
  9916. QVBoxLayout*left= new QVBoxLayout;
  9917. view->setAnimated(true);
  9918. view->setSelectionMode(QAbstractItemView::SingleSelection);
  9919. document= AppInstance->deviceConfiguration();
  9920. model= new DeviceTreeModel;
  9921. view->setModel(model);
  9922. view->setTextElideMode(Qt::ElideNone);
  9923. view->expandAll();
  9924. view->resizeColumnToContents(0);
  9925. connect(model,SIGNAL(modelReset()),view,SLOT(expandAll()));
  9926. QHBoxLayout*treeButtons= new QHBoxLayout;
  9927. QToolButton*addDeviceButton= new QToolButton;
  9928. addDeviceButton->setIcon(QIcon::fromTheme("list-add"));
  9929. addDeviceButton->setToolTip(tr("New Roaster"));
  9930. connect(addDeviceButton,SIGNAL(clicked()),
  9931. this,SLOT(addDevice()));
  9932. QToolButton*removeNodeButton= new QToolButton;
  9933. removeNodeButton->setIcon(QIcon::fromTheme("list-remove"));
  9934. removeNodeButton->setToolTip(tr("Delete Selection"));
  9935. connect(removeNodeButton,SIGNAL(clicked()),this,SLOT(removeNode()));
  9936. treeButtons->addWidget(addDeviceButton);
  9937. treeButtons->addWidget(removeNodeButton);
  9938. left->addWidget(view);
  9939. left->addLayout(treeButtons);
  9940. leftWidget->setLayout(left);
  9941. splitter->addWidget(leftWidget);
  9942. configArea->setMinimumWidth(580);
  9943. configArea->setMinimumHeight(460);
  9944. configArea->setWidgetResizable(true);
  9945. splitter->addWidget(configArea);
  9946. QVBoxLayout*centralLayout= new QVBoxLayout;
  9947. centralLayout->addWidget(splitter);
  9948. setLayout(centralLayout);
  9949. connect(view,SIGNAL(activated(QModelIndex)),
  9950. this,SLOT(newSelection(QModelIndex)));
  9951. connect(view,SIGNAL(clicked(QModelIndex)),
  9952. this,SLOT(newSelection(QModelIndex)));
  9953. connect(model,SIGNAL(rowsInserted(QModelIndex,int,int)),
  9954. view,SLOT(expand(QModelIndex)));
  9955. connect(model,SIGNAL(rowsInserted(QModelIndex,int,int)),
  9956. this,SLOT(resizeColumn()));
  9957. connect(model,SIGNAL(rowsRemoved(QModelIndex,int,int)),
  9958. this,SLOT(resizeColumn()));
  9959. }
  9960. /*:787*//*788:*/
  9961. #line 16352 "./typica.w"
  9962. void DeviceConfigurationWindow::addDevice()
  9963. {
  9964. model->newNode(tr("New Roaster"),"roaster",QModelIndex());
  9965. }
  9966. /*:788*//*789:*/
  9967. #line 16360 "./typica.w"
  9968. void DeviceConfigurationWindow::removeNode()
  9969. {
  9970. QModelIndex index= view->currentIndex();
  9971. if(index.isValid())
  9972. {
  9973. int row= index.row();
  9974. QModelIndex parent= index.parent();
  9975. model->removeRow(row,parent);
  9976. }
  9977. }
  9978. /*:789*//*790:*/
  9979. #line 16376 "./typica.w"
  9980. void DeviceConfigurationWindow::newSelection(const QModelIndex&index)
  9981. {
  9982. QWidget*editor= AppInstance->deviceConfigurationWidget(model,index);
  9983. if(editor)
  9984. {
  9985. configArea->setWidget(editor);
  9986. editor->show();
  9987. }
  9988. }
  9989. /*:790*//*791:*/
  9990. #line 16393 "./typica.w"
  9991. void DeviceConfigurationWindow::resizeColumn()
  9992. {
  9993. view->resizeColumnToContents(0);
  9994. }
  9995. /*:791*/
  9996. #line 587 "./typica.w"
  9997. /*811:*/
  9998. #line 16874 "./typica.w"
  9999. Ni9211TcConfWidget::Ni9211TcConfWidget(DeviceTreeModel*model,
  10000. const QModelIndex&index):
  10001. BasicDeviceConfigurationWidget(model,index)
  10002. {
  10003. QFormLayout*layout= new QFormLayout;
  10004. QLineEdit*columnName= new QLineEdit;
  10005. layout->addRow(tr("Column Name:"),columnName);
  10006. QComboBox*typeSelector= new QComboBox;
  10007. typeSelector->addItem("J");
  10008. typeSelector->addItem("K");
  10009. typeSelector->addItem("T");
  10010. typeSelector->addItem("B");
  10011. typeSelector->addItem("E");
  10012. typeSelector->addItem("N");
  10013. typeSelector->addItem("R");
  10014. typeSelector->addItem("S");
  10015. layout->addRow(tr("Thermocouple Type:"),typeSelector);
  10016. QCheckBox*hideSeries= new QCheckBox("Hide this channel");
  10017. layout->addRow(hideSeries);
  10018. setLayout(layout);
  10019. /*801:*/
  10020. #line 16668 "./typica.w"
  10021. QDomElement referenceElement=
  10022. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10023. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10024. QDomElement node;
  10025. /*:801*/
  10026. #line 16895 "./typica.w"
  10027. for(int i= 0;i<configData.size();i++)
  10028. {
  10029. node= configData.at(i).toElement();
  10030. if(node.attribute("name")=="type")
  10031. {
  10032. typeSelector->setCurrentIndex(
  10033. typeSelector->findText(node.attribute("value")));
  10034. }
  10035. else if(node.attribute("name")=="columnname")
  10036. {
  10037. columnName->setText(node.attribute("value"));
  10038. }
  10039. else if(node.attribute("name")=="hidden")
  10040. {
  10041. hideSeries->setChecked(node.attribute("value")=="true");
  10042. }
  10043. }
  10044. updateThermocoupleType(typeSelector->currentText());
  10045. updateColumnName(columnName->text());
  10046. updateHidden(hideSeries->isChecked());
  10047. connect(typeSelector,SIGNAL(currentIndexChanged(QString)),
  10048. this,SLOT(updateThermocoupleType(QString)));
  10049. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  10050. connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  10051. }
  10052. /*:811*//*812:*/
  10053. #line 16925 "./typica.w"
  10054. void Ni9211TcConfWidget::updateThermocoupleType(const QString&type)
  10055. {
  10056. updateAttribute("type",type);
  10057. }
  10058. void Ni9211TcConfWidget::updateColumnName(const QString&name)
  10059. {
  10060. updateAttribute("columnname",name);
  10061. }
  10062. void Ni9211TcConfWidget::updateHidden(bool hidden)
  10063. {
  10064. updateAttribute("hidden",hidden?"true":"false");
  10065. }
  10066. /*:812*/
  10067. #line 588 "./typica.w"
  10068. /*807:*/
  10069. #line 16788 "./typica.w"
  10070. NiDaqMxBase9211ConfWidget::NiDaqMxBase9211ConfWidget(DeviceTreeModel*model,
  10071. const QModelIndex&index)
  10072. :BasicDeviceConfigurationWidget(model,index)
  10073. {
  10074. QVBoxLayout*layout= new QVBoxLayout;
  10075. QHBoxLayout*deviceIdLayout= new QHBoxLayout;
  10076. QLabel*label= new QLabel(tr("Device ID:"));
  10077. QLineEdit*deviceId= new QLineEdit;
  10078. deviceIdLayout->addWidget(label);
  10079. deviceIdLayout->addWidget(deviceId);
  10080. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  10081. layout->addLayout(deviceIdLayout);
  10082. layout->addWidget(addChannelButton);
  10083. /*801:*/
  10084. #line 16668 "./typica.w"
  10085. QDomElement referenceElement=
  10086. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10087. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10088. QDomElement node;
  10089. /*:801*/
  10090. #line 16802 "./typica.w"
  10091. for(int i= 0;i<configData.size();i++)
  10092. {
  10093. node= configData.at(i).toElement();
  10094. if(node.attribute("name")=="deviceID")
  10095. {
  10096. deviceId->setText(node.attribute("value","Dev1"));
  10097. break;
  10098. }
  10099. }
  10100. updateDeviceId(deviceId->text());
  10101. connect(addChannelButton,SIGNAL(clicked()),
  10102. this,SLOT(addChannel()));
  10103. connect(deviceId,SIGNAL(textEdited(QString)),
  10104. this,SLOT(updateDeviceId(QString)));
  10105. setLayout(layout);
  10106. }
  10107. /*:807*//*808:*/
  10108. #line 16824 "./typica.w"
  10109. void NiDaqMxBase9211ConfWidget::updateDeviceId(const QString&newId)
  10110. {
  10111. updateAttribute("deviceID",newId);
  10112. }
  10113. /*:808*//*809:*/
  10114. #line 16832 "./typica.w"
  10115. void NiDaqMxBase9211ConfWidget::addChannel()
  10116. {
  10117. insertChildNode(tr("Thermocouple channel"),"ni9211seriestc");
  10118. }
  10119. /*:809*/
  10120. #line 589 "./typica.w"
  10121. /*805:*/
  10122. #line 16739 "./typica.w"
  10123. NiDaqMxBaseDriverConfWidget::NiDaqMxBaseDriverConfWidget(
  10124. DeviceTreeModel*model,const QModelIndex&index):
  10125. BasicDeviceConfigurationWidget(model,index)
  10126. {
  10127. QHBoxLayout*layout= new QHBoxLayout;
  10128. QToolButton*addDeviceButton= new QToolButton;
  10129. addDeviceButton->setText(tr("Add Device"));
  10130. NodeInserter*add9211= new NodeInserter("NI USB 9211","NI USB 9211",
  10131. "nidaqmxbase9211series");
  10132. NodeInserter*add9211a= new NodeInserter("NI USB 9211A","NI USB 9211A",
  10133. "nidaqmxbase9211series");
  10134. connect(add9211,SIGNAL(triggered(QString,QString)),
  10135. this,SLOT(insertChildNode(QString,QString)));
  10136. connect(add9211a,SIGNAL(triggered(QString,QString)),
  10137. this,SLOT(insertChildNode(QString,QString)));
  10138. QMenu*deviceMenu= new QMenu;
  10139. deviceMenu->addAction(add9211);
  10140. deviceMenu->addAction(add9211a);
  10141. addDeviceButton->setMenu(deviceMenu);
  10142. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  10143. layout->addWidget(addDeviceButton);
  10144. setLayout(layout);
  10145. }
  10146. /*:805*/
  10147. #line 590 "./typica.w"
  10148. /*666:*/
  10149. #line 14211 "./typica.w"
  10150. ReportAction::ReportAction(const QString&fileName,const QString&reportName,
  10151. QObject*parent):
  10152. QAction(reportName,parent),reportFile(fileName)
  10153. {
  10154. connect(this,SIGNAL(triggered()),this,SLOT(createReport()));
  10155. }
  10156. /*:666*//*667:*/
  10157. #line 14227 "./typica.w"
  10158. void ReportAction::createReport()
  10159. {
  10160. QFile file(reportFile);
  10161. QDomDocument document;
  10162. if(file.open(QIODevice::ReadOnly))
  10163. {
  10164. document.setContent(&file,true);
  10165. QDomElement element= document.documentElement();
  10166. QScriptEngine*engine= AppInstance->engine;
  10167. QScriptContext*context= engine->pushContext();
  10168. QScriptValue object;
  10169. QString targetID= reportFile;
  10170. /*202:*/
  10171. #line 4758 "./typica.w"
  10172. ScriptQMainWindow*window= new ScriptQMainWindow;
  10173. window->setObjectName(targetID);
  10174. object= engine->newQObject(window);
  10175. setQMainWindowProperties(object,engine);
  10176. QWidget*central= new(QWidget);
  10177. central->setParent(window);
  10178. central->setObjectName("centralWidget");
  10179. window->setCentralWidget(central);
  10180. if(element.hasChildNodes())
  10181. {
  10182. /*203:*/
  10183. #line 4794 "./typica.w"
  10184. QStack<QWidget*> widgetStack;
  10185. QStack<QLayout*> layoutStack;
  10186. QString windowScript;
  10187. widgetStack.push(central);
  10188. QDomNodeList windowChildren= element.childNodes();
  10189. int i= 0;
  10190. while(i<windowChildren.count())
  10191. {
  10192. QDomNode current;
  10193. QDomElement element;
  10194. current= windowChildren.at(i);
  10195. if(current.isElement())
  10196. {
  10197. element= current.toElement();
  10198. if(element.tagName()=="program")
  10199. {
  10200. windowScript.append(element.text());
  10201. }
  10202. else if(element.tagName()=="layout")
  10203. {
  10204. element.setAttribute("trcontext","configuration");
  10205. addLayoutToWidget(element,&widgetStack,&layoutStack);
  10206. }
  10207. else if(element.tagName()=="menu")
  10208. {
  10209. /*204:*/
  10210. #line 4842 "./typica.w"
  10211. QMenuBar*bar= window->menuBar();
  10212. bar->setParent(window);
  10213. bar->setObjectName("menuBar");
  10214. if(element.hasAttribute("name"))
  10215. {
  10216. QMenu*menu= bar->addMenu(QCoreApplication::translate("configuration",
  10217. element.attribute("name").toUtf8().data()));
  10218. menu->setParent(bar);
  10219. if(element.hasAttribute("type"))
  10220. {
  10221. if(element.attribute("type")=="reports")
  10222. {
  10223. if(element.hasAttribute("src"))
  10224. {
  10225. /*664:*/
  10226. #line 14171 "./typica.w"
  10227. QSettings settings;
  10228. QString reportDirectory= QString("%1/%2").arg(settings.value("config").
  10229. toString()).
  10230. arg(element.attribute("src"));
  10231. QDir::addSearchPath("reports",reportDirectory);
  10232. QDir directory(reportDirectory);
  10233. directory.setFilter(QDir::Files);
  10234. directory.setSorting(QDir::Name);
  10235. QStringList nameFilter;
  10236. nameFilter<<"*.xml";
  10237. directory.setNameFilters(nameFilter);
  10238. QFileInfoList reportFiles= directory.entryInfoList();
  10239. for(int i= 0;i<reportFiles.size();i++)
  10240. {
  10241. QFileInfo reportFile= reportFiles.at(i);
  10242. /*668:*/
  10243. #line 14251 "./typica.w"
  10244. QString path= reportFile.absoluteFilePath();
  10245. QFile file(path);
  10246. if(file.open(QIODevice::ReadOnly))
  10247. {
  10248. QDomDocument document;
  10249. document.setContent(&file,true);
  10250. QDomElement root= document.documentElement();
  10251. QString translationContext= root.attribute("id");
  10252. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  10253. if(!titleNode.isNull())
  10254. {
  10255. QDomElement titleElement= titleNode.toElement();
  10256. QString title= QCoreApplication::translate("configuration",
  10257. titleElement.text().toUtf8().data());
  10258. if(!title.isEmpty())
  10259. {
  10260. QStringList hierarchy= title.split(":->");
  10261. QMenu*insertionPoint= menu;
  10262. /*669:*/
  10263. #line 14280 "./typica.w"
  10264. for(int j= 0;j<hierarchy.size()-1;j++)
  10265. {
  10266. QObjectList menuList= insertionPoint->children();
  10267. bool menuFound= false;
  10268. for(int k= 0;k<menuList.size();k++)
  10269. {
  10270. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  10271. if(currentItem)
  10272. {
  10273. if(currentItem->title()==hierarchy.at(j))
  10274. {
  10275. menuFound= true;
  10276. insertionPoint= currentItem;
  10277. break;
  10278. }
  10279. }
  10280. }
  10281. if(!menuFound)
  10282. {
  10283. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  10284. }
  10285. }
  10286. /*:669*/
  10287. #line 14270 "./typica.w"
  10288. ReportAction*action= new ReportAction(path,hierarchy.last());
  10289. insertionPoint->addAction(action);
  10290. }
  10291. }
  10292. }
  10293. /*:668*/
  10294. #line 14187 "./typica.w"
  10295. }
  10296. /*:664*/
  10297. #line 4857 "./typica.w"
  10298. }
  10299. }
  10300. }
  10301. if(element.hasChildNodes())
  10302. {
  10303. /*205:*/
  10304. #line 4870 "./typica.w"
  10305. QDomNodeList menuItems= element.childNodes();
  10306. int j= 0;
  10307. while(j<menuItems.count())
  10308. {
  10309. QDomNode item= menuItems.at(j);
  10310. if(item.isElement())
  10311. {
  10312. QDomElement itemElement= item.toElement();
  10313. if(itemElement.tagName()=="item")
  10314. {
  10315. QAction*itemAction= new QAction(QCoreApplication::translate("configuration",
  10316. itemElement.text().toUtf8().data()),menu);
  10317. if(itemElement.hasAttribute("id"))
  10318. {
  10319. itemAction->setObjectName(itemElement.attribute("id"));
  10320. }
  10321. if(itemElement.hasAttribute("shortcut"))
  10322. {
  10323. itemAction->setShortcut(itemElement.attribute("shortcut"));
  10324. }
  10325. menu->addAction(itemAction);
  10326. }
  10327. else if(itemElement.tagName()=="separator")
  10328. {
  10329. menu->addSeparator();
  10330. }
  10331. else if(itemElement.tagName()=="plugins")
  10332. {
  10333. /*689:*/
  10334. #line 21 "./plugins.w"
  10335. QMenu*pluginMenu= new QMenu(menu);
  10336. if(itemElement.hasAttribute("id"))
  10337. {
  10338. pluginMenu->setObjectName(itemElement.attribute("id"));
  10339. }
  10340. if(itemElement.hasAttribute("title"))
  10341. {
  10342. pluginMenu->setTitle(itemElement.attribute("title"));
  10343. }
  10344. if(itemElement.hasAttribute("src"))
  10345. {
  10346. QSettings settings;
  10347. QString pluginDirectory= QString("%1/%2").
  10348. arg(settings.value("config").toString()).
  10349. arg(itemElement.attribute("src"));
  10350. QDir directory(pluginDirectory);
  10351. directory.setFilter(QDir::Files);
  10352. directory.setSorting(QDir::Name);
  10353. QStringList nameFilter;
  10354. nameFilter<<"*.js";
  10355. directory.setNameFilters(nameFilter);
  10356. QFileInfoList pluginFiles= directory.entryInfoList();
  10357. for(int k= 0;k<pluginFiles.size();k++)
  10358. {
  10359. PluginAction*pa= new PluginAction(pluginFiles.at(k),pluginMenu);
  10360. if(itemElement.hasAttribute("preRun"))
  10361. {
  10362. pa->setPreRun(itemElement.attribute("preRun"));
  10363. }
  10364. if(itemElement.hasAttribute("postRun"))
  10365. {
  10366. pa->setPostRun(itemElement.attribute("postRun"));
  10367. }
  10368. pluginMenu->addAction(pa);
  10369. }
  10370. }
  10371. menu->addMenu(pluginMenu);
  10372. /*:689*/
  10373. #line 4899 "./typica.w"
  10374. }
  10375. }
  10376. j++;
  10377. }
  10378. #line 1 "./helpmenu.w"
  10379. /*:205*/
  10380. #line 4863 "./typica.w"
  10381. }
  10382. }
  10383. /*:204*/
  10384. #line 4820 "./typica.w"
  10385. }
  10386. }
  10387. i++;
  10388. }
  10389. QScriptValue oldThis= context->thisObject();
  10390. context->setThisObject(object);
  10391. QScriptValue result= engine->evaluate(windowScript);
  10392. /*196:*/
  10393. #line 4573 "./typica.w"
  10394. if(engine->hasUncaughtException())
  10395. {
  10396. int line= engine->uncaughtExceptionLineNumber();
  10397. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  10398. result.toString();
  10399. QString trace;
  10400. foreach(trace,engine->uncaughtExceptionBacktrace())
  10401. {
  10402. qDebug()<<trace;
  10403. }
  10404. }
  10405. /*:196*/
  10406. #line 4828 "./typica.w"
  10407. context->setThisObject(oldThis);
  10408. /*:203*/
  10409. #line 4769 "./typica.w"
  10410. }
  10411. /*206:*/
  10412. #line 9 "./helpmenu.w"
  10413. HelpMenu*helpMenu= new HelpMenu();
  10414. window->menuBar()->addMenu(helpMenu);
  10415. /*:206*/
  10416. #line 4771 "./typica.w"
  10417. window->show();
  10418. window->setupFinished();
  10419. /*:202*/
  10420. #line 14240 "./typica.w"
  10421. file.close();
  10422. engine->popContext();
  10423. }
  10424. }
  10425. /*:667*/
  10426. #line 591 "./typica.w"
  10427. /*251:*/
  10428. #line 6055 "./typica.w"
  10429. NumericDelegate::NumericDelegate(QObject*parent):
  10430. QItemDelegate(parent)
  10431. {
  10432. }
  10433. /*:251*//*252:*/
  10434. #line 6067 "./typica.w"
  10435. void NumericDelegate::setEditorData(QWidget*editor,
  10436. const QModelIndex&index)const
  10437. {
  10438. QString value= index.model()->data(index,Qt::EditRole).toString();
  10439. QLineEdit*line= static_cast<QLineEdit*> (editor);
  10440. line->setText(value);
  10441. }
  10442. /*:252*//*253:*/
  10443. #line 6082 "./typica.w"
  10444. void NumericDelegate::setModelData(QWidget*editor,QAbstractItemModel*model,
  10445. const QModelIndex&index)const
  10446. {
  10447. QLineEdit*line= static_cast<QLineEdit*> (editor);
  10448. model->setData(index,line->text(),Qt::EditRole);
  10449. QScriptEngine*engine= AppInstance->engine;
  10450. engine->pushContext();
  10451. QString script= QString("Number(%1)").arg(line->text());
  10452. QScriptValue result= engine->evaluate(line->text());
  10453. if(result.isNumber())
  10454. {
  10455. model->setData(index,result.toVariant(),Qt::DisplayRole);
  10456. }
  10457. else
  10458. {
  10459. model->setData(index,QVariant(),Qt::DisplayRole);
  10460. }
  10461. engine->popContext();
  10462. }
  10463. /*:253*//*254:*/
  10464. #line 6105 "./typica.w"
  10465. QWidget*NumericDelegate::createEditor(QWidget*parent,
  10466. const QStyleOptionViewItem&,
  10467. const QModelIndex&)const
  10468. {
  10469. return(new QLineEdit(parent));
  10470. }
  10471. /*:254*//*255:*/
  10472. #line 6116 "./typica.w"
  10473. void NumericDelegate::updateEditorGeometry(QWidget*editor,
  10474. const QStyleOptionViewItem&option,
  10475. const QModelIndex&)const
  10476. {
  10477. editor->setGeometry(option.rect);
  10478. }
  10479. /*:255*/
  10480. #line 592 "./typica.w"
  10481. /*816:*/
  10482. #line 16984 "./typica.w"
  10483. NiDaqMxDriverConfWidget::NiDaqMxDriverConfWidget(DeviceTreeModel*model,
  10484. const QModelIndex&index)
  10485. :BasicDeviceConfigurationWidget(model,index)
  10486. {
  10487. QHBoxLayout*layout= new QHBoxLayout;
  10488. QToolButton*addDeviceButton= new QToolButton;
  10489. addDeviceButton->setText(tr("Add Device"));
  10490. NodeInserter*add9211a= new NodeInserter("NI USB 9211A","NI USB 9211A",
  10491. "nidaqmx9211series");
  10492. NodeInserter*addtc01= new NodeInserter("NI USB TC01","NI USB TC01",
  10493. "nidaqmxtc01");
  10494. connect(add9211a,SIGNAL(triggered(QString,QString)),
  10495. this,SLOT(insertChildNode(QString,QString)));
  10496. connect(addtc01,SIGNAL(triggered(QString,QString)),
  10497. this,SLOT(insertChildNode(QString,QString)));
  10498. QMenu*deviceMenu= new QMenu;
  10499. deviceMenu->addAction(add9211a);
  10500. deviceMenu->addAction(addtc01);
  10501. addDeviceButton->setMenu(deviceMenu);
  10502. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  10503. layout->addWidget(addDeviceButton);
  10504. setLayout(layout);
  10505. }
  10506. /*:816*/
  10507. #line 593 "./typica.w"
  10508. /*818:*/
  10509. #line 17033 "./typica.w"
  10510. NiDaqMx9211ConfWidget::NiDaqMx9211ConfWidget(DeviceTreeModel*model,
  10511. const QModelIndex&index)
  10512. :BasicDeviceConfigurationWidget(model,index)
  10513. {
  10514. QVBoxLayout*layout= new QVBoxLayout;
  10515. QHBoxLayout*deviceIdLayout= new QHBoxLayout;
  10516. QLabel*label= new QLabel(tr("Device ID:"));
  10517. QLineEdit*deviceId= new QLineEdit;
  10518. deviceIdLayout->addWidget(label);
  10519. deviceIdLayout->addWidget(deviceId);
  10520. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  10521. layout->addLayout(deviceIdLayout);
  10522. layout->addWidget(addChannelButton);
  10523. /*801:*/
  10524. #line 16668 "./typica.w"
  10525. QDomElement referenceElement=
  10526. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10527. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10528. QDomElement node;
  10529. /*:801*/
  10530. #line 17047 "./typica.w"
  10531. for(int i= 0;i<configData.size();i++)
  10532. {
  10533. node= configData.at(i).toElement();
  10534. if(node.attribute("name")=="deviceID")
  10535. {
  10536. deviceId->setText(node.attribute("value","Dev1"));
  10537. break;
  10538. }
  10539. }
  10540. updateDeviceId(deviceId->text());
  10541. connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
  10542. connect(deviceId,SIGNAL(textEdited(QString)),
  10543. this,SLOT(updateDeviceId(QString)));
  10544. setLayout(layout);
  10545. }
  10546. void NiDaqMx9211ConfWidget::updateDeviceId(const QString&newId)
  10547. {
  10548. updateAttribute("deviceID",newId);
  10549. }
  10550. void NiDaqMx9211ConfWidget::addChannel()
  10551. {
  10552. insertChildNode(tr("Thermocouple channel"),"ni9211seriestc");
  10553. }
  10554. /*:818*/
  10555. #line 594 "./typica.w"
  10556. /*820:*/
  10557. #line 17098 "./typica.w"
  10558. NiDaqMxTc01ConfWidget::NiDaqMxTc01ConfWidget(DeviceTreeModel*model,
  10559. const QModelIndex&index)
  10560. :BasicDeviceConfigurationWidget(model,index)
  10561. {
  10562. QFormLayout*layout= new QFormLayout;
  10563. QLineEdit*deviceId= new QLineEdit;
  10564. layout->addRow(tr("Device ID:"),deviceId);
  10565. QLineEdit*columnName= new QLineEdit;
  10566. layout->addRow(tr("Column Name:"),columnName);
  10567. QComboBox*typeSelector= new QComboBox;
  10568. typeSelector->addItem("J");
  10569. typeSelector->addItem("K");
  10570. typeSelector->addItem("T");
  10571. typeSelector->addItem("B");
  10572. typeSelector->addItem("E");
  10573. typeSelector->addItem("N");
  10574. typeSelector->addItem("R");
  10575. typeSelector->addItem("S");
  10576. layout->addRow(tr("Thermocouple Type:"),typeSelector);
  10577. QCheckBox*hideSeries= new QCheckBox(tr("Hide this channel"));
  10578. layout->addRow(hideSeries);
  10579. /*801:*/
  10580. #line 16668 "./typica.w"
  10581. QDomElement referenceElement=
  10582. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10583. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10584. QDomElement node;
  10585. /*:801*/
  10586. #line 17120 "./typica.w"
  10587. for(int i= 0;i<configData.size();i++)
  10588. {
  10589. node= configData.at(i).toElement();
  10590. if(node.attribute("name")=="deviceID")
  10591. {
  10592. deviceId->setText(node.attribute("value"));
  10593. }
  10594. else if(node.attribute("name")=="type")
  10595. {
  10596. typeSelector->setCurrentIndex(typeSelector->findText(node.attribute("value")));
  10597. }
  10598. else if(node.attribute("name")=="columnname")
  10599. {
  10600. columnName->setText(node.attribute("value"));
  10601. }
  10602. else if(node.attribute("name")=="hidden")
  10603. {
  10604. hideSeries->setChecked(node.attribute("value")=="true");
  10605. }
  10606. }
  10607. updateDeviceId(deviceId->text());
  10608. updateThermocoupleType(typeSelector->currentText());
  10609. updateColumnName(columnName->text());
  10610. updateHidden(hideSeries->isChecked());
  10611. connect(deviceId,SIGNAL(textEdited(QString)),this,SLOT(updateDeviceId(QString)));
  10612. connect(typeSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateThermocoupleType(QString)));
  10613. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  10614. setLayout(layout);
  10615. connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  10616. }
  10617. void NiDaqMxTc01ConfWidget::updateDeviceId(const QString&newId)
  10618. {
  10619. updateAttribute("deviceID",newId);
  10620. }
  10621. void NiDaqMxTc01ConfWidget::updateThermocoupleType(const QString&type)
  10622. {
  10623. updateAttribute("type",type);
  10624. }
  10625. void NiDaqMxTc01ConfWidget::updateColumnName(const QString&name)
  10626. {
  10627. updateAttribute("columnname",name);
  10628. }
  10629. void NiDaqMxTc01ConfWidget::updateHidden(bool hidden)
  10630. {
  10631. updateAttribute("hidden",hidden?"true":"false");
  10632. }
  10633. /*:820*/
  10634. #line 595 "./typica.w"
  10635. /*838:*/
  10636. #line 17540 "./typica.w"
  10637. ModbusRtuPortConfWidget::ModbusRtuPortConfWidget(DeviceTreeModel*model,
  10638. const QModelIndex&index)
  10639. :BasicDeviceConfigurationWidget(model,index)
  10640. {
  10641. QFormLayout*layout= new QFormLayout;
  10642. QToolButton*addDeviceButton= new QToolButton;
  10643. addDeviceButton->setText(tr("Add Device"));
  10644. NodeInserter*addModbusRtuDevice= new NodeInserter("Modbus RTU Device",
  10645. "Modbus RTU Device",
  10646. "modbusrtudevice");
  10647. connect(addModbusRtuDevice,SIGNAL(triggered(QString,QString)),
  10648. this,SLOT(insertChildNode(QString,QString)));
  10649. QMenu*deviceMenu= new QMenu;
  10650. deviceMenu->addAction(addModbusRtuDevice);
  10651. addDeviceButton->setMenu(deviceMenu);
  10652. addDeviceButton->setPopupMode(QToolButton::InstantPopup);
  10653. layout->addRow(QString(),addDeviceButton);
  10654. PortSelector*port= new PortSelector;
  10655. layout->addRow(tr("Port:"),port);
  10656. connect(port,SIGNAL(currentIndexChanged(QString)),
  10657. this,SLOT(updatePort(QString)));
  10658. connect(port,SIGNAL(editTextChanged(QString)),
  10659. this,SLOT(updatePort(QString)));
  10660. BaudSelector*rate= new BaudSelector;
  10661. layout->addRow(tr("Baud:"),rate);
  10662. connect(rate,SIGNAL(currentIndexChanged(QString)),
  10663. this,SLOT(updateBaudRate(QString)));
  10664. ParitySelector*parity= new ParitySelector;
  10665. layout->addRow(tr("Parity:"),parity);
  10666. connect(parity,SIGNAL(currentIndexChanged(QString)),
  10667. this,SLOT(updateParity(QString)));
  10668. FlowSelector*flow= new FlowSelector;
  10669. layout->addRow(tr("Flow Control:"),flow);
  10670. connect(flow,SIGNAL(currentIndexChanged(QString)),
  10671. this,SLOT(updateFlowControl(QString)));
  10672. StopSelector*stop= new StopSelector;
  10673. layout->addRow(tr("Stop Bits:"),stop);
  10674. connect(stop,SIGNAL(currentIndexChanged(QString)),
  10675. this,SLOT(updateStopBits(QString)));
  10676. /*801:*/
  10677. #line 16668 "./typica.w"
  10678. QDomElement referenceElement=
  10679. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10680. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10681. QDomElement node;
  10682. /*:801*/
  10683. #line 17580 "./typica.w"
  10684. for(int i= 0;i<configData.size();i++)
  10685. {
  10686. node= configData.at(i).toElement();
  10687. if(node.attribute("name")=="port")
  10688. {
  10689. int j= port->findText(node.attribute("value"));
  10690. if(j>=0)
  10691. {
  10692. port->setCurrentIndex(j);
  10693. }
  10694. else
  10695. {
  10696. port->insertItem(0,node.attribute("value"));
  10697. port->setCurrentIndex(0);
  10698. }
  10699. }
  10700. else if(node.attribute("name")=="baudrate")
  10701. {
  10702. rate->setCurrentIndex(rate->findText(node.attribute("value")));
  10703. }
  10704. else if(node.attribute("name")=="parity")
  10705. {
  10706. parity->setCurrentIndex(parity->findText(node.attribute("value")));
  10707. }
  10708. else if(node.attribute("name")=="flowcontrol")
  10709. {
  10710. flow->setCurrentIndex(flow->findText(node.attribute("value")));
  10711. }
  10712. else if(node.attribute("name")=="stopbits")
  10713. {
  10714. stop->setCurrentIndex(stop->findText(node.attribute("value")));
  10715. }
  10716. }
  10717. updatePort(port->currentText());
  10718. updateBaudRate(rate->currentText());
  10719. updateParity(parity->currentText());
  10720. updateFlowControl(flow->currentText());
  10721. updateStopBits(stop->currentText());
  10722. setLayout(layout);
  10723. }
  10724. void ModbusRtuPortConfWidget::updatePort(const QString&newPort)
  10725. {
  10726. updateAttribute("port",newPort);
  10727. }
  10728. void ModbusRtuPortConfWidget::updateBaudRate(const QString&newRate)
  10729. {
  10730. updateAttribute("baudrate",newRate);
  10731. }
  10732. void ModbusRtuPortConfWidget::updateParity(const QString&newParity)
  10733. {
  10734. updateAttribute("parity",newParity);
  10735. }
  10736. void ModbusRtuPortConfWidget::updateFlowControl(const QString&newFlow)
  10737. {
  10738. updateAttribute("flowcontrol",newFlow);
  10739. }
  10740. void ModbusRtuPortConfWidget::updateStopBits(const QString&newStopBits)
  10741. {
  10742. updateAttribute("stopbits",newStopBits);
  10743. }
  10744. /*:838*/
  10745. #line 596 "./typica.w"
  10746. /*840:*/
  10747. #line 17703 "./typica.w"
  10748. ModbusRtuDeviceConfWidget::ModbusRtuDeviceConfWidget(DeviceTreeModel*model,
  10749. const QModelIndex&index)
  10750. :BasicDeviceConfigurationWidget(model,index),
  10751. unitSpecificationLayout(new QStackedLayout),
  10752. decimalSpecificationLayout(new QStackedLayout)
  10753. {
  10754. QVBoxLayout*layout= new QVBoxLayout;
  10755. QToolButton*addChannelButton= new QToolButton;
  10756. addChannelButton->setText(tr("Add Channel"));
  10757. NodeInserter*addTemperaturePV= new NodeInserter("Temperature Process Value",
  10758. "Temperature Process Value",
  10759. "modbustemperaturepv");
  10760. NodeInserter*addTemperatureSV= new NodeInserter("Temperature Set Value",
  10761. "Temperature Set Value",
  10762. "modbustemperaturesv");
  10763. connect(addTemperaturePV,SIGNAL(triggered(QString,QString)),
  10764. this,SLOT(insertChildNode(QString,QString)));
  10765. connect(addTemperatureSV,SIGNAL(triggered(QString,QString)),
  10766. this,SLOT(insertChildNode(QString,QString)));
  10767. QMenu*channelMenu= new QMenu;
  10768. channelMenu->addAction(addTemperaturePV);
  10769. channelMenu->addAction(addTemperatureSV);
  10770. addChannelButton->setMenu(channelMenu);
  10771. addChannelButton->setPopupMode(QToolButton::InstantPopup);
  10772. layout->addWidget(addChannelButton);
  10773. QHBoxLayout*stationLayout= new QHBoxLayout;
  10774. QLabel*stationLabel= new QLabel(tr("Station:"));
  10775. QSpinBox*stationNumber= new QSpinBox;
  10776. stationNumber->setMinimum(0);
  10777. stationNumber->setMaximum(255);
  10778. stationLayout->addWidget(stationLabel);
  10779. stationLayout->addWidget(stationNumber);
  10780. layout->addLayout(stationLayout);
  10781. QCheckBox*fixedUnit= new QCheckBox(tr("Fixed Temperature Unit"));
  10782. layout->addWidget(fixedUnit);
  10783. QWidget*fixedUnitPlaceholder= new QWidget(this);
  10784. QHBoxLayout*fixedUnitLayout= new QHBoxLayout;
  10785. QLabel*fixedUnitLabel= new QLabel(tr("Temperature Unit:"));
  10786. QComboBox*fixedUnitSelector= new QComboBox;
  10787. fixedUnitSelector->addItem("Fahrenheit");
  10788. fixedUnitSelector->addItem("Celsius");
  10789. fixedUnitLayout->addWidget(fixedUnitLabel);
  10790. fixedUnitLayout->addWidget(fixedUnitSelector);
  10791. fixedUnitPlaceholder->setLayout(fixedUnitLayout);
  10792. unitSpecificationLayout->addWidget(fixedUnitPlaceholder);
  10793. QWidget*queriedUnitPlaceholder= new QWidget(this);
  10794. QFormLayout*queriedUnitLayout= new QFormLayout;
  10795. ShortHexSpinBox*unitAddress= new ShortHexSpinBox;
  10796. queriedUnitLayout->addRow(tr("Function 0x03 Unit Address:"),unitAddress);
  10797. QSpinBox*valueF= new QSpinBox;
  10798. valueF->setMinimum(0);
  10799. valueF->setMaximum(65535);
  10800. queriedUnitLayout->addRow(tr("Value for Fahrenheit"),valueF);
  10801. QSpinBox*valueC= new QSpinBox;
  10802. valueC->setMinimum(0);
  10803. valueC->setMaximum(65535);
  10804. queriedUnitLayout->addRow(tr("Value for Celsius"),valueC);
  10805. queriedUnitPlaceholder->setLayout(queriedUnitLayout);
  10806. unitSpecificationLayout->addWidget(queriedUnitPlaceholder);
  10807. layout->addLayout(unitSpecificationLayout);
  10808. QCheckBox*fixedPrecision= new QCheckBox(tr("Fixed Precision"));
  10809. layout->addWidget(fixedPrecision);
  10810. QWidget*fixedPrecisionPlaceholder= new QWidget(this);
  10811. QFormLayout*fixedPrecisionLayout= new QFormLayout;
  10812. QSpinBox*fixedPrecisionValue= new QSpinBox;
  10813. fixedPrecisionValue->setMinimum(0);
  10814. fixedPrecisionValue->setMaximum(9);
  10815. fixedPrecisionLayout->addRow("Places after the decimal point:",
  10816. fixedPrecisionValue);
  10817. fixedPrecisionPlaceholder->setLayout(fixedPrecisionLayout);
  10818. decimalSpecificationLayout->addWidget(fixedPrecisionPlaceholder);
  10819. QWidget*queriedPrecisionPlaceholder= new QWidget(this);
  10820. QFormLayout*queriedPrecisionLayout= new QFormLayout;
  10821. ShortHexSpinBox*precisionAddress= new ShortHexSpinBox;
  10822. queriedPrecisionLayout->addRow("Function 0x03 Decimal Position Address:",
  10823. precisionAddress);
  10824. queriedPrecisionPlaceholder->setLayout(queriedPrecisionLayout);
  10825. decimalSpecificationLayout->addWidget(queriedPrecisionPlaceholder);
  10826. layout->addLayout(decimalSpecificationLayout);
  10827. /*801:*/
  10828. #line 16668 "./typica.w"
  10829. QDomElement referenceElement=
  10830. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10831. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10832. QDomElement node;
  10833. /*:801*/
  10834. #line 17783 "./typica.w"
  10835. for(int i= 0;i<configData.size();i++)
  10836. {
  10837. node= configData.at(i).toElement();
  10838. if(node.attribute("name")=="station")
  10839. {
  10840. stationNumber->setValue(node.attribute("value").toInt());
  10841. }
  10842. else if(node.attribute("name")=="fixedunit")
  10843. {
  10844. if(node.attribute("value")=="true")
  10845. {
  10846. fixedUnit->setCheckState(Qt::Checked);
  10847. }
  10848. else if(node.attribute("value")=="false")
  10849. {
  10850. fixedUnit->setCheckState(Qt::Unchecked);
  10851. }
  10852. }
  10853. else if(node.attribute("name")=="fixedprecision")
  10854. {
  10855. fixedPrecisionValue->setValue(node.attribute("value").toInt());
  10856. }
  10857. else if(node.attribute("name")=="unit")
  10858. {
  10859. fixedUnitSelector->setCurrentIndex(fixedUnitSelector->findText(node.attribute("value")));
  10860. }
  10861. else if(node.attribute("name")=="unitaddress")
  10862. {
  10863. unitAddress->setValue(node.attribute("value").toInt());
  10864. }
  10865. else if(node.attribute("name")=="fvalue")
  10866. {
  10867. valueF->setValue(node.attribute("value").toInt());
  10868. }
  10869. else if(node.attribute("name")=="cvalue")
  10870. {
  10871. valueC->setValue(node.attribute("value").toInt());
  10872. }
  10873. else if(node.attribute("name")=="precisionaddress")
  10874. {
  10875. precisionAddress->setValue(node.attribute("value").toInt());
  10876. }
  10877. else if(node.attribute("name")=="precision")
  10878. {
  10879. fixedPrecisionValue->setValue(node.attribute("value").toInt());
  10880. }
  10881. }
  10882. updateStationNumber(stationNumber->value());
  10883. updateFixedUnit(fixedUnit->isChecked());
  10884. updateFixedDecimal(fixedPrecision->isChecked());
  10885. updateUnit(fixedUnitSelector->currentText());
  10886. updateUnitAddress(unitAddress->value());
  10887. updateValueF(valueF->value());
  10888. updateValueC(valueC->value());
  10889. updatePrecisionAddress(precisionAddress->value());
  10890. updatePrecisionValue(fixedPrecisionValue->value());
  10891. connect(stationNumber,SIGNAL(valueChanged(int)),
  10892. this,SLOT(updateStationNumber(int)));
  10893. connect(fixedUnitSelector,SIGNAL(currentIndexChanged(QString)),
  10894. this,SLOT(updateUnit(QString)));
  10895. connect(unitAddress,SIGNAL(valueChanged(int)),
  10896. this,SLOT(updateUnitAddress(int)));
  10897. connect(valueF,SIGNAL(valueChanged(int)),
  10898. this,SLOT(updateValueF(int)));
  10899. connect(valueC,SIGNAL(valueChanged(int)),
  10900. this,SLOT(updateValueC(int)));
  10901. connect(fixedUnit,SIGNAL(toggled(bool)),
  10902. this,SLOT(updateFixedUnit(bool)));
  10903. connect(fixedPrecision,SIGNAL(toggled(bool)),
  10904. this,SLOT(updateFixedDecimal(bool)));
  10905. connect(fixedPrecisionValue,SIGNAL(valueChanged(int)),
  10906. this,SLOT(updatePrecisionValue(int)));
  10907. connect(precisionAddress,SIGNAL(valueChanged(int)),
  10908. this,SLOT(updatePrecisionAddress(int)));
  10909. setLayout(layout);
  10910. }
  10911. void ModbusRtuDeviceConfWidget::updateStationNumber(int newStation)
  10912. {
  10913. updateAttribute("station",QString("%1").arg(newStation));
  10914. }
  10915. void ModbusRtuDeviceConfWidget::updateFixedUnit(bool newFixed)
  10916. {
  10917. if(newFixed)
  10918. {
  10919. unitSpecificationLayout->setCurrentIndex(0);
  10920. updateAttribute("fixedunit","true");
  10921. }
  10922. else
  10923. {
  10924. unitSpecificationLayout->setCurrentIndex(1);
  10925. updateAttribute("fixedunit","false");
  10926. }
  10927. }
  10928. void ModbusRtuDeviceConfWidget::updateFixedDecimal(bool newFixed)
  10929. {
  10930. if(newFixed)
  10931. {
  10932. decimalSpecificationLayout->setCurrentIndex(0);
  10933. updateAttribute("fixedprecision","true");
  10934. }
  10935. else
  10936. {
  10937. decimalSpecificationLayout->setCurrentIndex(1);
  10938. updateAttribute("fixedprecision","false");
  10939. }
  10940. }
  10941. void ModbusRtuDeviceConfWidget::updateUnit(const QString&newUnit)
  10942. {
  10943. updateAttribute("unit",newUnit);
  10944. }
  10945. void ModbusRtuDeviceConfWidget::updateUnitAddress(int newAddress)
  10946. {
  10947. updateAttribute("unitaddress",QString("%1").arg(newAddress));
  10948. }
  10949. void ModbusRtuDeviceConfWidget::updateValueF(int newValue)
  10950. {
  10951. updateAttribute("fvalue",QString("%1").arg(newValue));
  10952. }
  10953. void ModbusRtuDeviceConfWidget::updateValueC(int newValue)
  10954. {
  10955. updateAttribute("cvalue",QString("%1").arg(newValue));
  10956. }
  10957. void ModbusRtuDeviceConfWidget::updatePrecisionAddress(int newAddress)
  10958. {
  10959. updateAttribute("precisionaddress",QString("%1").arg(newAddress));
  10960. }
  10961. void ModbusRtuDeviceConfWidget::updatePrecisionValue(int newValue)
  10962. {
  10963. updateAttribute("precision",QString("%1").arg(newValue));
  10964. }
  10965. /*:840*/
  10966. #line 597 "./typica.w"
  10967. /*842:*/
  10968. #line 17946 "./typica.w"
  10969. ModbusRtuDeviceTPvConfWidget::ModbusRtuDeviceTPvConfWidget(DeviceTreeModel*model,
  10970. const QModelIndex&index)
  10971. :BasicDeviceConfigurationWidget(model,index)
  10972. {
  10973. QFormLayout*layout= new QFormLayout;
  10974. ShortHexSpinBox*address= new ShortHexSpinBox;
  10975. layout->addRow(tr("Function 0x04 Process Value Address"),address);
  10976. /*801:*/
  10977. #line 16668 "./typica.w"
  10978. QDomElement referenceElement=
  10979. model->referenceElement(model->data(index,Qt::UserRole).toString());
  10980. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  10981. QDomElement node;
  10982. /*:801*/
  10983. #line 17954 "./typica.w"
  10984. for(int i= 0;i<configData.size();i++)
  10985. {
  10986. node= configData.at(i).toElement();
  10987. if(node.attribute("name")=="address")
  10988. {
  10989. address->setValue(node.attribute("value").toInt());
  10990. break;
  10991. }
  10992. }
  10993. updateAddress(address->value());
  10994. connect(address,SIGNAL(valueChanged(int)),this,SLOT(updateAddress(int)));
  10995. setLayout(layout);
  10996. }
  10997. void ModbusRtuDeviceTPvConfWidget::updateAddress(int newAddress)
  10998. {
  10999. updateAttribute("address",QString("%1").arg(newAddress));
  11000. }
  11001. /*:842*/
  11002. #line 598 "./typica.w"
  11003. /*844:*/
  11004. #line 18002 "./typica.w"
  11005. ModbusRtuDeviceTSvConfWidget::ModbusRtuDeviceTSvConfWidget(DeviceTreeModel*model,
  11006. const QModelIndex&index)
  11007. :BasicDeviceConfigurationWidget(model,index),boundsLayout(new QStackedLayout)
  11008. {
  11009. QVBoxLayout*layout= new QVBoxLayout;
  11010. QFormLayout*addressLayout= new QFormLayout;
  11011. ShortHexSpinBox*readAddress= new ShortHexSpinBox;
  11012. ShortHexSpinBox*writeAddress= new ShortHexSpinBox;
  11013. addressLayout->addRow(tr("Function 0x04 Read Set Value Address:"),readAddress);
  11014. addressLayout->addRow(tr("Function 0x06 Write Set Value Address:"),writeAddress);
  11015. layout->addLayout(addressLayout);
  11016. QCheckBox*fixedRange= new QCheckBox(tr("Fixed Set Value Range"));
  11017. layout->addWidget(fixedRange);
  11018. QWidget*queriedRangePlaceholder= new QWidget(this);
  11019. QFormLayout*queriedRangeLayout= new QFormLayout;
  11020. ShortHexSpinBox*lowerAddress= new ShortHexSpinBox;
  11021. ShortHexSpinBox*upperAddress= new ShortHexSpinBox;
  11022. queriedRangeLayout->addRow(tr("Function 0x03 Minimum Set Value Address"),
  11023. lowerAddress);
  11024. queriedRangeLayout->addRow(tr("Function 0x03 Maximum Set Value Address"),
  11025. upperAddress);
  11026. queriedRangePlaceholder->setLayout(queriedRangeLayout);
  11027. boundsLayout->addWidget(queriedRangePlaceholder);
  11028. QWidget*fixedRangePlaceholder= new QWidget(this);
  11029. QFormLayout*fixedRangeLayout= new QFormLayout;
  11030. QLineEdit*fixedLower= new QLineEdit;
  11031. QLineEdit*fixedUpper= new QLineEdit;
  11032. fixedRangeLayout->addRow(tr("Minimum Set Value:"),fixedLower);
  11033. fixedRangeLayout->addRow(tr("Maximum Set Value:"),fixedUpper);
  11034. fixedRangePlaceholder->setLayout(fixedRangeLayout);
  11035. boundsLayout->addWidget(fixedRangePlaceholder);
  11036. layout->addLayout(boundsLayout);
  11037. /*801:*/
  11038. #line 16668 "./typica.w"
  11039. QDomElement referenceElement=
  11040. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11041. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11042. QDomElement node;
  11043. /*:801*/
  11044. #line 18035 "./typica.w"
  11045. for(int i= 0;i<configData.size();i++)
  11046. {
  11047. node= configData.at(i).toElement();
  11048. if(node.attribute("name")=="readaddress")
  11049. {
  11050. readAddress->setValue(node.attribute("value").toInt());
  11051. }
  11052. else if(node.attribute("name")=="writeaddress")
  11053. {
  11054. writeAddress->setValue(node.attribute("value").toInt());
  11055. }
  11056. else if(node.attribute("name")=="fixedrange")
  11057. {
  11058. if(node.attribute("value")=="true")
  11059. {
  11060. fixedRange->setCheckState(Qt::Checked);
  11061. }
  11062. else if(node.attribute("value")=="false")
  11063. {
  11064. fixedRange->setCheckState(Qt::Unchecked);
  11065. }
  11066. }
  11067. else if(node.attribute("name")=="fixedlower")
  11068. {
  11069. fixedLower->setText(node.attribute("value"));
  11070. }
  11071. else if(node.attribute("name")=="fixedupper")
  11072. {
  11073. fixedUpper->setText(node.attribute("value"));
  11074. }
  11075. else if(node.attribute("name")=="loweraddress")
  11076. {
  11077. lowerAddress->setValue(node.attribute("value").toInt());
  11078. }
  11079. else if(node.attribute("name")=="upperaddress")
  11080. {
  11081. upperAddress->setValue(node.attribute("value").toInt());
  11082. }
  11083. }
  11084. updateReadAddress(readAddress->value());
  11085. updateWriteAddress(writeAddress->value());
  11086. updateFixedRange(fixedRange->isChecked());
  11087. updateLower(fixedLower->text());
  11088. updateUpper(fixedUpper->text());
  11089. updateLowerAddress(lowerAddress->value());
  11090. updateUpperAddress(upperAddress->value());
  11091. connect(readAddress,SIGNAL(valueChanged(int)),
  11092. this,SLOT(updateReadAddress(int)));
  11093. connect(writeAddress,SIGNAL(valueChanged(int)),
  11094. this,SLOT(updateWriteAddress(int)));
  11095. connect(fixedRange,SIGNAL(toggled(bool)),this,SLOT(updateFixedRange(bool)));
  11096. connect(fixedLower,SIGNAL(textChanged(QString)),
  11097. this,SLOT(updateLower(QString)));
  11098. connect(fixedUpper,SIGNAL(textChanged(QString)),
  11099. this,SLOT(updateUpper(QString)));
  11100. connect(lowerAddress,SIGNAL(valueChanged(int)),
  11101. this,SLOT(updateLowerAddress(int)));
  11102. connect(upperAddress,SIGNAL(valueChanged(int)),
  11103. this,SLOT(updateUpperAddress(int)));
  11104. setLayout(layout);
  11105. }
  11106. void ModbusRtuDeviceTSvConfWidget::updateReadAddress(int newAddress)
  11107. {
  11108. updateAttribute("readaddress",QString("%1").arg(newAddress));
  11109. }
  11110. void ModbusRtuDeviceTSvConfWidget::updateWriteAddress(int newAddress)
  11111. {
  11112. updateAttribute("writeaddress",QString("%1").arg(newAddress));
  11113. }
  11114. void ModbusRtuDeviceTSvConfWidget::updateFixedRange(bool fixed)
  11115. {
  11116. if(fixed)
  11117. {
  11118. updateAttribute("fixedrange","true");
  11119. boundsLayout->setCurrentIndex(1);
  11120. }
  11121. else
  11122. {
  11123. updateAttribute("fixedrange","false");
  11124. boundsLayout->setCurrentIndex(0);
  11125. }
  11126. }
  11127. void ModbusRtuDeviceTSvConfWidget::updateLower(const QString&lower)
  11128. {
  11129. updateAttribute("fixedlower",lower);
  11130. }
  11131. void ModbusRtuDeviceTSvConfWidget::updateUpper(const QString&upper)
  11132. {
  11133. updateAttribute("fixedupper",upper);
  11134. }
  11135. void ModbusRtuDeviceTSvConfWidget::updateLowerAddress(int newAddress)
  11136. {
  11137. updateAttribute("loweraddress",QString("%1").arg(newAddress));
  11138. }
  11139. void ModbusRtuDeviceTSvConfWidget::updateUpperAddress(int newAddress)
  11140. {
  11141. updateAttribute("upperaddress",QString("%1").arg(newAddress));
  11142. }
  11143. /*:844*/
  11144. #line 599 "./typica.w"
  11145. /*800:*/
  11146. #line 16538 "./typica.w"
  11147. RoasterConfWidget::RoasterConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  11148. :BasicDeviceConfigurationWidget(model,index)
  11149. {
  11150. QVBoxLayout*layout= new QVBoxLayout;
  11151. QPushButton*addDeviceButton= new QPushButton(tr("Add Device"));
  11152. QMenu*deviceMenu= new QMenu;
  11153. NodeInserter*insertAction;
  11154. foreach(insertAction,AppInstance->topLevelNodeInserters)
  11155. {
  11156. connect(insertAction,SIGNAL(triggered(QString,QString)),
  11157. this,SLOT(insertChildNode(QString,QString)));
  11158. deviceMenu->addAction(insertAction);
  11159. }
  11160. addDeviceButton->setMenu(deviceMenu);
  11161. layout->addWidget(addDeviceButton);
  11162. QPushButton*addAnnotationControlButton= new QPushButton(tr("Add Annotation Control"));
  11163. QMenu*annotationMenu= new QMenu;
  11164. NodeInserter*basicButtonInserter= new NodeInserter(tr("Annotation Button"),tr("Annotation Button"),"annotationbutton");
  11165. NodeInserter*countingButtonInserter= new NodeInserter(tr("Counting Button"),tr("Counting Button"),"reconfigurablebutton");
  11166. NodeInserter*spinBoxInserter= new NodeInserter(tr("Numeric Entry"),tr("Numeric Entry"),"annotationspinbox");
  11167. NodeInserter*freeAnnotationInserter= new NodeInserter(tr("Free Text"),
  11168. tr("Free Text"),
  11169. "freeannotation");
  11170. annotationMenu->addAction(basicButtonInserter);
  11171. annotationMenu->addAction(countingButtonInserter);
  11172. annotationMenu->addAction(spinBoxInserter);
  11173. annotationMenu->addAction(freeAnnotationInserter);
  11174. connect(basicButtonInserter,SIGNAL(triggered(QString,QString)),
  11175. this,SLOT(insertChildNode(QString,QString)));
  11176. connect(countingButtonInserter,SIGNAL(triggered(QString,QString)),
  11177. this,SLOT(insertChildNode(QString,QString)));
  11178. connect(spinBoxInserter,SIGNAL(triggered(QString,QString)),
  11179. this,SLOT(insertChildNode(QString,QString)));
  11180. connect(freeAnnotationInserter,SIGNAL(triggered(QString,QString)),
  11181. this,SLOT(insertChildNode(QString,QString)));
  11182. /*1122:*/
  11183. #line 144 "./valueannotation.w"
  11184. NodeInserter*valueAnnotationInserter= new NodeInserter(tr("Value Annotation"),
  11185. tr("Value Annotation"),
  11186. "valueannotation");
  11187. annotationMenu->addAction(valueAnnotationInserter);
  11188. connect(valueAnnotationInserter,SIGNAL(triggered(QString,QString)),
  11189. this,SLOT(insertChildNode(QString,QString)));
  11190. /*:1122*//*1136:*/
  11191. #line 115 "./thresholdannotation.w"
  11192. NodeInserter*thresholdAnnotationInserter= new NodeInserter(tr("Threshold Annotation"),
  11193. tr("Threshold Annotation"),
  11194. "thresholdannotation");
  11195. annotationMenu->addAction(thresholdAnnotationInserter);
  11196. connect(thresholdAnnotationInserter,SIGNAL(triggered(QString,QString)),
  11197. this,SLOT(insertChildNode(QString,QString)));
  11198. /*:1136*/
  11199. #line 16574 "./typica.w"
  11200. addAnnotationControlButton->setMenu(annotationMenu);
  11201. layout->addWidget(addAnnotationControlButton);
  11202. QPushButton*timersButton= new QPushButton(tr("Extra Timers"));
  11203. QMenu*timersMenu= new QMenu;
  11204. NodeInserter*coolingTimerInserter= new NodeInserter(tr("Cooling Timer"),tr("Cooling Timer"),"coolingtimer");
  11205. NodeInserter*rangeTimerInserter= new NodeInserter(tr("Range Timer"),tr("Range Timer"),"rangetimer");
  11206. NodeInserter*multirangeTimerInserter= new NodeInserter(tr("Multi-Range Timer"),tr("Multi-Range Timer"),"multirangetimer");
  11207. timersMenu->addAction(coolingTimerInserter);
  11208. timersMenu->addAction(rangeTimerInserter);
  11209. timersMenu->addAction(multirangeTimerInserter);
  11210. connect(coolingTimerInserter,SIGNAL(triggered(QString,QString)),
  11211. this,SLOT(insertChildNode(QString,QString)));
  11212. connect(rangeTimerInserter,SIGNAL(triggered(QString,QString)),
  11213. this,SLOT(insertChildNode(QString,QString)));
  11214. connect(multirangeTimerInserter,SIGNAL(triggered(QString,QString)),
  11215. this,SLOT(insertChildNode(QString,QString)));
  11216. timersButton->setMenu(timersMenu);
  11217. layout->addWidget(timersButton);
  11218. QPushButton*advancedButton= new QPushButton(tr("Advanced Features"));
  11219. QMenu*advancedMenu= new QMenu;
  11220. NodeInserter*linearsplineinserter= new NodeInserter(tr("Linear Spline Interpolated Series"),tr("Linear Spline Interpolated Series"),"linearspline");
  11221. advancedMenu->addAction(linearsplineinserter);
  11222. NodeInserter*translationinserter= new NodeInserter(tr("Profile Translation"),tr("Profile Translation"),"translation");
  11223. advancedMenu->addAction(translationinserter);
  11224. connect(linearsplineinserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  11225. connect(translationinserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  11226. /*1034:*/
  11227. #line 258 "./rate.w"
  11228. NodeInserter*rateOfChangeInserter= new NodeInserter(tr("Rate of Change"),tr("Rate of Change"),"rate");
  11229. connect(rateOfChangeInserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
  11230. advancedMenu->addAction(rateOfChangeInserter);
  11231. /*:1034*//*1048:*/
  11232. #line 272 "./mergeseries.w"
  11233. NodeInserter*mergeSeriesInserter= new NodeInserter(tr("Merge Series"),
  11234. tr("Merge"),
  11235. "mergeseries");
  11236. connect(mergeSeriesInserter,SIGNAL(triggered(QString,QString)),
  11237. this,SLOT(insertChildNode(QString,QString)));
  11238. advancedMenu->addAction(mergeSeriesInserter);
  11239. /*:1048*/
  11240. #line 16603 "./typica.w"
  11241. advancedButton->setMenu(advancedMenu);
  11242. layout->addWidget(advancedButton);
  11243. QHBoxLayout*idLayout= new QHBoxLayout;
  11244. QLabel*idLabel= new QLabel(tr("Machine ID for database:"));
  11245. idLayout->addWidget(idLabel);
  11246. QSpinBox*id= new QSpinBox;
  11247. idLayout->addWidget(id);
  11248. idLayout->addStretch();
  11249. layout->addLayout(idLayout);
  11250. QHBoxLayout*capacityLayout= new QHBoxLayout;
  11251. QCheckBox*capacityCheckEnabled= new QCheckBox(tr("Maximum batch size:"));
  11252. QDoubleSpinBox*capacity= new QDoubleSpinBox;
  11253. capacity->setMinimum(0.0);
  11254. capacity->setDecimals(3);
  11255. capacity->setMaximum(999999.999);
  11256. QComboBox*capacityUnit= new QComboBox;
  11257. capacityUnit->addItem("g");
  11258. capacityUnit->addItem("Kg");
  11259. capacityUnit->addItem("oz");
  11260. capacityUnit->addItem("Lb");
  11261. capacityUnit->setCurrentIndex(3);
  11262. capacityLayout->addWidget(capacityCheckEnabled);
  11263. capacityLayout->addWidget(capacity);
  11264. capacityLayout->addWidget(capacityUnit);
  11265. capacityLayout->addStretch();
  11266. layout->addLayout(capacityLayout);
  11267. layout->addStretch();
  11268. /*801:*/
  11269. #line 16668 "./typica.w"
  11270. QDomElement referenceElement=
  11271. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11272. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11273. QDomElement node;
  11274. /*:801*/
  11275. #line 16632 "./typica.w"
  11276. for(int i= 0;i<configData.size();i++)
  11277. {
  11278. node= configData.at(i).toElement();
  11279. if(node.attribute("name")=="databaseid")
  11280. {
  11281. id->setValue(node.attribute("value").toInt());
  11282. }
  11283. else if(node.attribute("name")=="checkcapacity")
  11284. {
  11285. capacityCheckEnabled->setChecked(node.attribute("value")=="true");
  11286. }
  11287. else if(node.attribute("name")=="capacity")
  11288. {
  11289. capacity->setValue(node.attribute("value").toDouble());
  11290. }
  11291. else if(node.attribute("name")=="capacityunit")
  11292. {
  11293. capacityUnit->setCurrentIndex(capacityUnit->findText(node.attribute("value")));
  11294. }
  11295. }
  11296. updateRoasterId(id->value());
  11297. connect(id,SIGNAL(valueChanged(int)),this,SLOT(updateRoasterId(int)));
  11298. connect(capacityCheckEnabled,SIGNAL(stateChanged(int)),this,SLOT(updateCapacityCheck(int)));
  11299. connect(capacity,SIGNAL(valueChanged(QString)),this,SLOT(updateCapacity(QString)));
  11300. connect(capacityUnit,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateCapacityUnit(QString)));
  11301. setLayout(layout);
  11302. }
  11303. /*:800*//*802:*/
  11304. #line 16678 "./typica.w"
  11305. void RoasterConfWidget::updateRoasterId(int id)
  11306. {
  11307. updateAttribute("databaseid",QString("%1").arg(id));
  11308. }
  11309. void RoasterConfWidget::updateCapacityCheck(int value)
  11310. {
  11311. updateAttribute("checkcapacity",value==Qt::Checked?"true":"false");
  11312. }
  11313. void RoasterConfWidget::updateCapacity(const QString&value)
  11314. {
  11315. updateAttribute("capacity",value);
  11316. }
  11317. void RoasterConfWidget::updateCapacityUnit(const QString&value)
  11318. {
  11319. updateAttribute("capacityunit",value);
  11320. }
  11321. /*:802*/
  11322. #line 600 "./typica.w"
  11323. /*848:*/
  11324. #line 18185 "./typica.w"
  11325. AnnotationButtonConfWidget::AnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  11326. :BasicDeviceConfigurationWidget(model,index)
  11327. {
  11328. QFormLayout*layout= new QFormLayout;
  11329. QLineEdit*buttonTextEdit= new QLineEdit;
  11330. QLineEdit*annotationTextEdit= new QLineEdit;
  11331. layout->addRow(tr("Button Text:"),buttonTextEdit);
  11332. layout->addRow(tr("Annotation Text:"),annotationTextEdit);
  11333. /*801:*/
  11334. #line 16668 "./typica.w"
  11335. QDomElement referenceElement=
  11336. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11337. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11338. QDomElement node;
  11339. /*:801*/
  11340. #line 18194 "./typica.w"
  11341. for(int i= 0;i<configData.size();i++)
  11342. {
  11343. node= configData.at(i).toElement();
  11344. if(node.attribute("name")=="buttontext")
  11345. {
  11346. buttonTextEdit->setText(node.attribute("value"));
  11347. }
  11348. else if(node.attribute("name")=="annotationtext")
  11349. {
  11350. annotationTextEdit->setText(node.attribute("value"));
  11351. }
  11352. }
  11353. updateButtonText(buttonTextEdit->text());
  11354. updateAnnotationText(annotationTextEdit->text());
  11355. connect(buttonTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateButtonText(QString)));
  11356. connect(annotationTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateAnnotationText(QString)));
  11357. setLayout(layout);
  11358. }
  11359. /*:848*//*849:*/
  11360. #line 18216 "./typica.w"
  11361. void AnnotationButtonConfWidget::updateButtonText(const QString&text)
  11362. {
  11363. updateAttribute("buttontext",text);
  11364. }
  11365. void AnnotationButtonConfWidget::updateAnnotationText(const QString&text)
  11366. {
  11367. updateAttribute("annotationtext",text);
  11368. }
  11369. /*:849*//*852:*/
  11370. #line 18254 "./typica.w"
  11371. ReconfigurableAnnotationButtonConfWidget::ReconfigurableAnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  11372. :BasicDeviceConfigurationWidget(model,index)
  11373. {
  11374. QFormLayout*layout= new QFormLayout;
  11375. QLineEdit*buttonTextEdit= new QLineEdit;
  11376. QLineEdit*annotationTextEdit= new QLineEdit;
  11377. layout->addRow(tr("Button Text:"),buttonTextEdit);
  11378. layout->addRow(tr("Annotation Text:"),annotationTextEdit);
  11379. /*801:*/
  11380. #line 16668 "./typica.w"
  11381. QDomElement referenceElement=
  11382. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11383. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11384. QDomElement node;
  11385. /*:801*/
  11386. #line 18263 "./typica.w"
  11387. for(int i= 0;i<configData.size();i++)
  11388. {
  11389. node= configData.at(i).toElement();
  11390. if(node.attribute("name")=="buttontext")
  11391. {
  11392. buttonTextEdit->setText(node.attribute("value"));
  11393. }
  11394. else if(node.attribute("name")=="annotationtext")
  11395. {
  11396. annotationTextEdit->setText(node.attribute("value"));
  11397. }
  11398. }
  11399. updateButtonText(buttonTextEdit->text());
  11400. updateAnnotationText(annotationTextEdit->text());
  11401. connect(buttonTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateButtonText(QString)));
  11402. connect(annotationTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateAnnotationText(QString)));
  11403. QTextEdit*documentation= new QTextEdit;
  11404. 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."));
  11405. documentation->setReadOnly(true);
  11406. layout->addRow("",documentation);
  11407. setLayout(layout);
  11408. }
  11409. void ReconfigurableAnnotationButtonConfWidget::updateButtonText(const QString&text)
  11410. {
  11411. updateAttribute("buttontext",text);
  11412. }
  11413. void ReconfigurableAnnotationButtonConfWidget::updateAnnotationText(const QString&text)
  11414. {
  11415. updateAttribute("annotationtext",text);
  11416. }
  11417. /*:852*/
  11418. #line 601 "./typica.w"
  11419. /*855:*/
  11420. #line 18331 "./typica.w"
  11421. NoteSpinConfWidget::NoteSpinConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  11422. :BasicDeviceConfigurationWidget(model,index)
  11423. {
  11424. QFormLayout*layout= new QFormLayout;
  11425. QLineEdit*labelEdit= new QLineEdit;
  11426. layout->addRow(tr("Control Label: "),labelEdit);
  11427. QLineEdit*minimumEdit= new QLineEdit;
  11428. layout->addRow(tr("Minimum Value: "),minimumEdit);
  11429. QLineEdit*maximumEdit= new QLineEdit;
  11430. layout->addRow(tr("Maximum Value: "),maximumEdit);
  11431. QSpinBox*precisionEdit= new QSpinBox;
  11432. precisionEdit->setMinimum(0);
  11433. precisionEdit->setMaximum(9);
  11434. layout->addRow(tr("Precision"),precisionEdit);
  11435. QLineEdit*pretext= new QLineEdit;
  11436. layout->addRow(tr("Prefix text"),pretext);
  11437. QLineEdit*posttext= new QLineEdit;
  11438. layout->addRow(tr("Suffix text"),posttext);
  11439. /*801:*/
  11440. #line 16668 "./typica.w"
  11441. QDomElement referenceElement=
  11442. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11443. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11444. QDomElement node;
  11445. /*:801*/
  11446. #line 18350 "./typica.w"
  11447. for(int i= 0;i<configData.size();i++)
  11448. {
  11449. node= configData.at(i).toElement();
  11450. if(node.attribute("name")=="label")
  11451. {
  11452. labelEdit->setText(node.attribute("value"));
  11453. }
  11454. else if(node.attribute("name")=="minimum")
  11455. {
  11456. minimumEdit->setText(node.attribute("value"));
  11457. }
  11458. else if(node.attribute("name")=="maximum")
  11459. {
  11460. maximumEdit->setText(node.attribute("value"));
  11461. }
  11462. else if(node.attribute("name")=="precision")
  11463. {
  11464. precisionEdit->setValue(node.attribute("value").toInt());
  11465. }
  11466. else if(node.attribute("name")=="pretext")
  11467. {
  11468. pretext->setText(node.attribute("value"));
  11469. }
  11470. else if(node.attribute("name")=="posttext")
  11471. {
  11472. posttext->setText(node.attribute("value"));
  11473. }
  11474. }
  11475. updateLabel(labelEdit->text());
  11476. updateMinimum(minimumEdit->text());
  11477. updateMaximum(maximumEdit->text());
  11478. updatePrecision(precisionEdit->value());
  11479. updatePretext(pretext->text());
  11480. updatePosttext(posttext->text());
  11481. connect(labelEdit,SIGNAL(textEdited(QString)),this,SLOT(updateLabel(QString)));
  11482. connect(minimumEdit,SIGNAL(textEdited(QString)),this,SLOT(updateMinimum(QString)));
  11483. connect(maximumEdit,SIGNAL(textEdited(QString)),this,SLOT(updateMaximum(QString)));
  11484. connect(precisionEdit,SIGNAL(valueChanged(int)),this,SLOT(updatePrecision(int)));
  11485. connect(pretext,SIGNAL(textEdited(QString)),this,SLOT(updatePretext(QString)));
  11486. connect(posttext,SIGNAL(textEdited(QString)),this,SLOT(updatePosttext(QString)));
  11487. setLayout(layout);
  11488. }
  11489. void NoteSpinConfWidget::updateLabel(const QString&text)
  11490. {
  11491. updateAttribute("label",text);
  11492. }
  11493. void NoteSpinConfWidget::updateMinimum(const QString&minimum)
  11494. {
  11495. updateAttribute("minimum",minimum);
  11496. }
  11497. void NoteSpinConfWidget::updateMaximum(const QString&maximum)
  11498. {
  11499. updateAttribute("maximum",maximum);
  11500. }
  11501. void NoteSpinConfWidget::updatePrecision(int precision)
  11502. {
  11503. updateAttribute("precision",QString("%1").arg(precision));
  11504. }
  11505. void NoteSpinConfWidget::updatePretext(const QString&text)
  11506. {
  11507. updateAttribute("pretext",text);
  11508. }
  11509. void NoteSpinConfWidget::updatePosttext(const QString&text)
  11510. {
  11511. updateAttribute("posttext",text);
  11512. }
  11513. /*:855*/
  11514. #line 602 "./typica.w"
  11515. /*347:*/
  11516. #line 7820 "./typica.w"
  11517. LinearCalibrator::LinearCalibrator(QObject*parent):
  11518. QObject(parent),Lo1(0),Lo2(0),Up1(1),Up2(1),sensitivitySetting(0.0),clamp(false)
  11519. {
  11520. connect(this,SIGNAL(measurement(Measurement)),this,SIGNAL(newData(Measurement)));
  11521. }
  11522. /*:347*//*348:*/
  11523. #line 7834 "./typica.w"
  11524. Measurement LinearCalibrator::newMeasurement(Measurement measure)
  11525. {
  11526. double outval= Lo1+(measure.temperature()-Lo2)*(Up1-Lo1)/(Up2-Lo2);
  11527. if(clamp)
  11528. {
  11529. if(outval<Lo1)
  11530. {
  11531. outval= Lo1;
  11532. }
  11533. else if(outval> Up1)
  11534. {
  11535. outval= Up1;
  11536. }
  11537. }
  11538. if(sensitivitySetting>=0.05)
  11539. {
  11540. int temp= qRound(outval/sensitivitySetting);
  11541. outval= temp*sensitivitySetting;
  11542. }
  11543. Measurement adjusted(outval,measure.time(),measure.scale());
  11544. emit measurement(adjusted);
  11545. return adjusted;
  11546. }
  11547. /*:348*//*349:*/
  11548. #line 7861 "./typica.w"
  11549. double LinearCalibrator::measuredLower()
  11550. {
  11551. return Lo2;
  11552. }
  11553. double LinearCalibrator::measuredUpper()
  11554. {
  11555. return Up2;
  11556. }
  11557. double LinearCalibrator::mappedLower()
  11558. {
  11559. return Lo1;
  11560. }
  11561. double LinearCalibrator::mappedUpper()
  11562. {
  11563. return Up1;
  11564. }
  11565. bool LinearCalibrator::isClosedRange()
  11566. {
  11567. return clamp;
  11568. }
  11569. void LinearCalibrator::setMeasuredLower(double lower)
  11570. {
  11571. Lo2= lower;
  11572. }
  11573. void LinearCalibrator::setMeasuredUpper(double upper)
  11574. {
  11575. Up2= upper;
  11576. }
  11577. void LinearCalibrator::setMappedLower(double lower)
  11578. {
  11579. Lo1= lower;
  11580. }
  11581. void LinearCalibrator::setMappedUpper(double upper)
  11582. {
  11583. Up1= upper;
  11584. }
  11585. void LinearCalibrator::setClosedRange(bool closed)
  11586. {
  11587. clamp= closed;
  11588. }
  11589. void LinearCalibrator::setSensitivity(double sensitivity)
  11590. {
  11591. sensitivitySetting= sensitivity;
  11592. }
  11593. double LinearCalibrator::sensitivity()
  11594. {
  11595. return sensitivitySetting;
  11596. }
  11597. /*:349*/
  11598. #line 603 "./typica.w"
  11599. /*354:*/
  11600. #line 7994 "./typica.w"
  11601. void LinearSplineInterpolator::add_pair(double source,double destination)
  11602. {
  11603. pairs->insert(source,destination);
  11604. make_interpolators();
  11605. }
  11606. void LinearSplineInterpolator::make_interpolators()
  11607. {
  11608. if(pairs->size()> 1)
  11609. {
  11610. while(interpolators->size()> 0)
  11611. {
  11612. LinearCalibrator*removed= interpolators->takeFirst();
  11613. removed->deleteLater();
  11614. }
  11615. QMap<double,double> ::const_iterator i= pairs->constBegin();
  11616. QMap<double,double> ::const_iterator j= i+1;
  11617. while(j!=pairs->constEnd())
  11618. {
  11619. LinearCalibrator*segment= new LinearCalibrator();
  11620. segment->setMeasuredLower(i.key());
  11621. segment->setMappedLower(i.value());
  11622. segment->setMeasuredUpper(j.key());
  11623. segment->setMappedUpper(j.value());
  11624. segment->setClosedRange(false);
  11625. interpolators->append(segment);
  11626. connect(segment,SIGNAL(measurement(Measurement)),this,SIGNAL(newData(Measurement)));
  11627. i++;
  11628. j++;
  11629. }
  11630. }
  11631. }
  11632. LinearSplineInterpolator::LinearSplineInterpolator(QObject*parent):
  11633. QObject(parent),pairs(new QMap<double,double> ),
  11634. interpolators(new QList<LinearCalibrator*> )
  11635. {
  11636. }
  11637. Measurement LinearSplineInterpolator::newMeasurement(Measurement measure)
  11638. {
  11639. QMap<double,double> ::const_iterator i= pairs->constBegin();
  11640. int index= -1;
  11641. while(i!=pairs->constEnd())
  11642. {
  11643. if(measure.temperature()<=i.key())
  11644. {
  11645. break;
  11646. }
  11647. i++;
  11648. index++;
  11649. }
  11650. if(index<0)
  11651. {
  11652. index= 0;
  11653. }
  11654. if(index>=interpolators->size())
  11655. {
  11656. index= interpolators->size()-1;
  11657. }
  11658. if(interpolators->at(index)!=NULL)
  11659. {
  11660. return interpolators->at(index)->newMeasurement(measure);
  11661. }
  11662. return Measurement();
  11663. }
  11664. /*:354*/
  11665. #line 604 "./typica.w"
  11666. /*999:*/
  11667. #line 19703 "./typica.w"
  11668. LinearSplineInterpolationConfWidget::LinearSplineInterpolationConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  11669. :BasicDeviceConfigurationWidget(model,index),tablemodel(new SaltModel(2))
  11670. {
  11671. QFormLayout*layout= new QFormLayout;
  11672. QLineEdit*source= new QLineEdit;
  11673. layout->addRow(tr("Source column name:"),source);
  11674. QLineEdit*destination= new QLineEdit;
  11675. layout->addRow(tr("Destination column name:"),destination);
  11676. tablemodel->setHeaderData(0,Qt::Horizontal,"Input");
  11677. tablemodel->setHeaderData(1,Qt::Horizontal,"Output");
  11678. QTableView*mappingTable= new QTableView;
  11679. mappingTable->setModel(tablemodel);
  11680. NumericDelegate*delegate= new NumericDelegate;
  11681. mappingTable->setItemDelegate(delegate);
  11682. layout->addRow(tr("Mapping data:"),mappingTable);
  11683. /*801:*/
  11684. #line 16668 "./typica.w"
  11685. QDomElement referenceElement=
  11686. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11687. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11688. QDomElement node;
  11689. /*:801*/
  11690. #line 19719 "./typica.w"
  11691. for(int i= 0;i<configData.size();i++)
  11692. {
  11693. node= configData.at(i).toElement();
  11694. if(node.attribute("name")=="source")
  11695. {
  11696. source->setText(node.attribute("value"));
  11697. }
  11698. else if(node.attribute("name")=="destination")
  11699. {
  11700. destination->setText(node.attribute("value"));
  11701. }
  11702. else if(node.attribute("name")=="sourcevalues")
  11703. {
  11704. /*1000:*/
  11705. #line 19758 "./typica.w"
  11706. QString data= node.attribute("value");
  11707. if(data.length()> 3)
  11708. {
  11709. data.chop(2);
  11710. data= data.remove(0,2);
  11711. }
  11712. QStringList itemList= data.split(",");
  11713. /*:1000*/
  11714. #line 19733 "./typica.w"
  11715. int column= 0;
  11716. /*1001:*/
  11717. #line 19770 "./typica.w"
  11718. for(int j= 0;j<itemList.size();j++)
  11719. {
  11720. tablemodel->setData(tablemodel->index(j,column),
  11721. QVariant(itemList.at(j).toDouble()),
  11722. Qt::DisplayRole);
  11723. }
  11724. /*:1001*/
  11725. #line 19735 "./typica.w"
  11726. }
  11727. else if(node.attribute("name")=="destinationvalues")
  11728. {
  11729. /*1000:*/
  11730. #line 19758 "./typica.w"
  11731. QString data= node.attribute("value");
  11732. if(data.length()> 3)
  11733. {
  11734. data.chop(2);
  11735. data= data.remove(0,2);
  11736. }
  11737. QStringList itemList= data.split(",");
  11738. /*:1000*/
  11739. #line 19740 "./typica.w"
  11740. int column= 1;
  11741. /*1001:*/
  11742. #line 19770 "./typica.w"
  11743. for(int j= 0;j<itemList.size();j++)
  11744. {
  11745. tablemodel->setData(tablemodel->index(j,column),
  11746. QVariant(itemList.at(j).toDouble()),
  11747. Qt::DisplayRole);
  11748. }
  11749. /*:1001*/
  11750. #line 19742 "./typica.w"
  11751. }
  11752. }
  11753. updateSourceColumn(source->text());
  11754. updateDestinationColumn(destination->text());
  11755. updateKnots();
  11756. connect(source,SIGNAL(textEdited(QString)),this,SLOT(updateSourceColumn(QString)));
  11757. connect(destination,SIGNAL(textEdited(QString)),this,SLOT(updateDestinationColumn(QString)));
  11758. connect(tablemodel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(updateKnots()));
  11759. setLayout(layout);
  11760. }
  11761. /*:999*//*1002:*/
  11762. #line 19781 "./typica.w"
  11763. void LinearSplineInterpolationConfWidget::updateKnots()
  11764. {
  11765. updateAttribute("sourcevalues",tablemodel->arrayLiteral(0,Qt::DisplayRole));
  11766. updateAttribute("destinationvalues",tablemodel->arrayLiteral(1,Qt::DisplayRole));
  11767. }
  11768. void LinearSplineInterpolationConfWidget::updateSourceColumn(const QString&source)
  11769. {
  11770. updateAttribute("source",source);
  11771. }
  11772. void LinearSplineInterpolationConfWidget::updateDestinationColumn(const QString&dest)
  11773. {
  11774. updateAttribute("destination",dest);
  11775. }
  11776. /*:1002*/
  11777. #line 605 "./typica.w"
  11778. /*1019:*/
  11779. #line 20252 "./typica.w"
  11780. TranslationConfWidget::TranslationConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  11781. :BasicDeviceConfigurationWidget(model,index),
  11782. temperatureValue(new QDoubleSpinBox),unitSelector(new QComboBox),
  11783. delaySelector(new QSpinBox)
  11784. {
  11785. unitSelector->addItem("Fahrenheit");
  11786. unitSelector->addItem("Celsius");
  11787. temperatureValue->setMinimum(0);
  11788. temperatureValue->setMaximum(1000);
  11789. QFormLayout*layout= new QFormLayout;
  11790. QLineEdit*column= new QLineEdit;
  11791. layout->addRow(tr("Column to match:"),column);
  11792. layout->addRow(tr("Unit:"),unitSelector);
  11793. layout->addRow(tr("Value:"),temperatureValue);
  11794. layout->addRow(tr("Start of batch safety delay:"),delaySelector);
  11795. /*801:*/
  11796. #line 16668 "./typica.w"
  11797. QDomElement referenceElement=
  11798. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11799. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11800. QDomElement node;
  11801. /*:801*/
  11802. #line 20268 "./typica.w"
  11803. for(int i= 0;i<configData.size();i++)
  11804. {
  11805. node= configData.at(i).toElement();
  11806. if(node.attribute("name")=="column")
  11807. {
  11808. column->setText(node.attribute("value"));
  11809. }
  11810. else if(node.attribute("name")=="unit")
  11811. {
  11812. unitSelector->setCurrentIndex(unitSelector->findText(node.attribute("value")));
  11813. }
  11814. else if(node.attribute("name")=="value")
  11815. {
  11816. temperatureValue->setValue(node.attribute("value").toDouble());
  11817. }
  11818. else if(node.attribute("name")=="delay")
  11819. {
  11820. delaySelector->setValue(node.attribute("value").toInt());
  11821. }
  11822. }
  11823. updateMatchingColumn(column->text());
  11824. updateTemperature();
  11825. updateDelay();
  11826. connect(column,SIGNAL(textEdited(QString)),this,SLOT(updateMatchingColumn(QString)));
  11827. connect(unitSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateTemperature()));
  11828. connect(temperatureValue,SIGNAL(valueChanged(double)),this,SLOT(updateTemperature()));
  11829. connect(delaySelector,SIGNAL(valueChanged(int)),this,SLOT(updateDelay()));
  11830. setLayout(layout);
  11831. }
  11832. /*:1019*//*1020:*/
  11833. #line 20303 "./typica.w"
  11834. void TranslationConfWidget::updateTemperature()
  11835. {
  11836. updateAttribute("unit",unitSelector->currentText());
  11837. updateAttribute("value",QString("%1").arg(temperatureValue->value()));
  11838. if(unitSelector->currentText()=="Fahrenheit")
  11839. {
  11840. updateAttribute("FValue",QString("%1").arg(temperatureValue->value()));
  11841. }
  11842. else
  11843. {
  11844. updateAttribute("FValue",QString("%1").arg(temperatureValue->value()*9/5+32));
  11845. }
  11846. }
  11847. void TranslationConfWidget::updateMatchingColumn(const QString&column)
  11848. {
  11849. updateAttribute("column",column);
  11850. }
  11851. void TranslationConfWidget::updateDelay()
  11852. {
  11853. updateAttribute("delay",QString("%1").arg(delaySelector->value()));
  11854. }
  11855. /*:1020*/
  11856. #line 606 "./typica.w"
  11857. /*858:*/
  11858. #line 24 "./freeannotation.w"
  11859. FreeAnnotationConfWidget::FreeAnnotationConfWidget(DeviceTreeModel*model,
  11860. const QModelIndex&index)
  11861. :BasicDeviceConfigurationWidget(model,index)
  11862. {
  11863. QFormLayout*layout= new QFormLayout;
  11864. QLineEdit*labelEdit= new QLineEdit;
  11865. layout->addRow(tr("Label Text:"),labelEdit);
  11866. /*801:*/
  11867. #line 16668 "./typica.w"
  11868. QDomElement referenceElement=
  11869. model->referenceElement(model->data(index,Qt::UserRole).toString());
  11870. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  11871. QDomElement node;
  11872. /*:801*/
  11873. #line 32 "./freeannotation.w"
  11874. for(int i= 0;i<configData.size();i++)
  11875. {
  11876. node= configData.at(i).toElement();
  11877. if(node.attribute("name")=="labeltext")
  11878. {
  11879. labelEdit->setText(node.attribute("value"));
  11880. }
  11881. }
  11882. updateLabel(labelEdit->text());
  11883. connect(labelEdit,SIGNAL(textEdited(QString)),
  11884. this,SLOT(updateLabel(QString)));
  11885. setLayout(layout);
  11886. }
  11887. /*:858*//*859:*/
  11888. #line 49 "./freeannotation.w"
  11889. void FreeAnnotationConfWidget::updateLabel(const QString&text)
  11890. {
  11891. updateAttribute("labeltext",text);
  11892. }
  11893. /*:859*/
  11894. #line 607 "./typica.w"
  11895. /*1023:*/
  11896. #line 39 "./rate.w"
  11897. void RateOfChange::newMeasurement(Measurement measure)
  11898. {
  11899. cache.append(measure);
  11900. /*1024:*/
  11901. #line 64 "./rate.w"
  11902. if(cache.size()> 2)
  11903. {
  11904. bool done= false;
  11905. while(!done)
  11906. {
  11907. if(cache.front().time().secsTo(cache.back().time())> ct)
  11908. {
  11909. cache.removeFirst();
  11910. }
  11911. else if(cache.back().time()<cache.front().time())
  11912. {
  11913. cache.removeFirst();
  11914. done= true;
  11915. }
  11916. else
  11917. {
  11918. done= true;
  11919. }
  11920. if(cache.size()<3)
  11921. {
  11922. done= true;
  11923. }
  11924. }
  11925. }
  11926. /*:1024*/
  11927. #line 43 "./rate.w"
  11928. if(cache.size()>=2)
  11929. {
  11930. /*1025:*/
  11931. #line 96 "./rate.w"
  11932. int N= cache.size();
  11933. double SXY= 0;
  11934. double SX= 0;
  11935. double SXX= 0;
  11936. double SY= 0;
  11937. double y;
  11938. double x;
  11939. for(int i= 0;i<N;i++)
  11940. {
  11941. y= cache.at(i).temperature();
  11942. SY+= y;
  11943. x= cache.at(0).time().msecsTo(cache.at(i).time())/1000.0;
  11944. SX+= x;
  11945. SXX+= (x*x);
  11946. SXY+= (x*y);
  11947. }
  11948. double M= ((N*SXY)-(SX*SY))/((N*SXX)-(SX*SX));
  11949. Measurement value(M*st,cache.back().time(),cache.back().scale());
  11950. value.insert("relative",true);
  11951. emit newData(value);
  11952. /*:1025*/
  11953. #line 46 "./rate.w"
  11954. }
  11955. }
  11956. /*:1023*//*1026:*/
  11957. #line 120 "./rate.w"
  11958. RateOfChange::RateOfChange(int cachetime,int scaletime):ct(cachetime),st(1)
  11959. {
  11960. setScaleTime(scaletime);
  11961. }
  11962. void RateOfChange::setCacheTime(int seconds)
  11963. {
  11964. ct= seconds;
  11965. }
  11966. void RateOfChange::setScaleTime(int seconds)
  11967. {
  11968. st= (seconds> 0?seconds:1);
  11969. }
  11970. /*:1026*/
  11971. #line 608 "./typica.w"
  11972. /*862:*/
  11973. #line 26 "./settings.w"
  11974. SettingsWindow::SettingsWindow():QMainWindow(NULL)
  11975. {
  11976. QTabWidget*settingsTab= new QTabWidget;
  11977. DeviceConfigurationWindow*deviceSettings= new DeviceConfigurationWindow;
  11978. settingsTab->addTab(deviceSettings,tr("Roasters"));
  11979. GraphSettingsWidget*graphSettings= new GraphSettingsWidget;
  11980. settingsTab->addTab(graphSettings,tr("Graph"));
  11981. ColorSettingsWidget*colorSettings= new ColorSettingsWidget;
  11982. settingsTab->addTab(colorSettings,tr("Color"));
  11983. AdvancedSettingsWidget*advancedSettings= new AdvancedSettingsWidget;
  11984. settingsTab->addTab(advancedSettings,tr("Advanced"));
  11985. setCentralWidget(settingsTab);
  11986. }
  11987. /*:862*/
  11988. #line 609 "./typica.w"
  11989. /*867:*/
  11990. #line 27 "./graphsettings.w"
  11991. GraphSettingsWidget::GraphSettingsWidget():QWidget(NULL)
  11992. {
  11993. QTabWidget*graphCategories= new QTabWidget;
  11994. GraphSettingsRelativeTab*relative= new GraphSettingsRelativeTab;
  11995. graphCategories->addTab(relative,tr("Relative Temperatures"));
  11996. QVBoxLayout*layout= new QVBoxLayout;
  11997. layout->addWidget(graphCategories);
  11998. setLayout(layout);
  11999. }
  12000. /*:867*//*869:*/
  12001. #line 69 "./graphsettings.w"
  12002. GraphSettingsRelativeTab::GraphSettingsRelativeTab():QWidget(NULL),
  12003. colorEdit(new QLineEdit)
  12004. {
  12005. QSettings settings;
  12006. QVBoxLayout*layout= new QVBoxLayout;
  12007. QCheckBox*enable= new QCheckBox(tr("Graph relative temperatures"));
  12008. enable->setChecked(settings.value("settings/graph/relative/enable",true).toBool());
  12009. updateEnableSetting(enable->isChecked());
  12010. connect(enable,SIGNAL(toggled(bool)),this,SLOT(updateEnableSetting(bool)));
  12011. layout->addWidget(enable);
  12012. QHBoxLayout*colorLayout= new QHBoxLayout;
  12013. QLabel*colorLabel= new QLabel(tr("Axis color:"));
  12014. colorEdit->setText(settings.value("settings/graph/relative/color","#000000").toString());
  12015. updateColorSetting(colorEdit->text());
  12016. connect(colorEdit,SIGNAL(textChanged(QString)),this,SLOT(updateColorSetting(QString)));
  12017. QToolButton*colorPickerButton= new QToolButton();
  12018. colorPickerButton->setIcon(QIcon::fromTheme("applications-graphics"));
  12019. connect(colorPickerButton,SIGNAL(clicked()),this,SLOT(showColorPicker()));
  12020. colorLayout->addWidget(colorLabel);
  12021. colorLayout->addWidget(colorEdit);
  12022. colorLayout->addWidget(colorPickerButton);
  12023. colorLayout->addStretch();
  12024. layout->addLayout(colorLayout);
  12025. QHBoxLayout*unitLayout= new QHBoxLayout;
  12026. QLabel*unitLabel= new QLabel(tr("Unit"));
  12027. QComboBox*unitSelector= new QComboBox;
  12028. unitSelector->addItem(tr("Fahrenheit"));
  12029. unitSelector->addItem(tr("Celsius"));
  12030. unitSelector->setCurrentIndex(settings.value("settings/graph/relative/unit",0).toInt());
  12031. updateUnit(unitSelector->currentIndex());
  12032. connect(unitSelector,SIGNAL(currentIndexChanged(int)),this,SLOT(updateUnit(int)));
  12033. unitLayout->addWidget(unitLabel);
  12034. unitLayout->addWidget(unitSelector);
  12035. unitLayout->addStretch();
  12036. layout->addLayout(unitLayout);
  12037. QHBoxLayout*axisLayout= new QHBoxLayout;
  12038. QLabel*axisLabel= new QLabel(tr("Grid line positions (comma separated):"));
  12039. QLineEdit*axisEdit= new QLineEdit;
  12040. axisEdit->setText(settings.value("settings/graph/relative/grid","-300, -100, 0, 30, 65, 100").toString());
  12041. updateAxisSetting(axisEdit->text());
  12042. connect(axisEdit,SIGNAL(textChanged(QString)),this,SLOT(updateAxisSetting(QString)));
  12043. axisLayout->addWidget(axisLabel);
  12044. axisLayout->addWidget(axisEdit);
  12045. layout->addLayout(axisLayout);
  12046. layout->addStretch();
  12047. setLayout(layout);
  12048. }
  12049. /*:869*//*870:*/
  12050. #line 120 "./graphsettings.w"
  12051. void GraphSettingsRelativeTab::updateEnableSetting(bool enabled)
  12052. {
  12053. QSettings settings;
  12054. settings.setValue("settings/graph/relative/enable",enabled);
  12055. }
  12056. void GraphSettingsRelativeTab::updateColorSetting(const QString&color)
  12057. {
  12058. QSettings settings;
  12059. settings.setValue("settings/graph/relative/color",color);
  12060. }
  12061. void GraphSettingsRelativeTab::updateAxisSetting(const QString&gridList)
  12062. {
  12063. QSettings settings;
  12064. QString settingValue;
  12065. QStringList points= gridList.split(QRegExp("[\\s,]+"),QString::SkipEmptyParts);
  12066. QStringList numbers;
  12067. foreach(QString text,points)
  12068. {
  12069. bool okay= false;
  12070. text.toDouble(&okay);
  12071. if(okay)
  12072. {
  12073. numbers.append(text);
  12074. }
  12075. }
  12076. numbers.removeDuplicates();
  12077. settings.setValue("settings/graph/relative/grid",numbers.join(","));
  12078. }
  12079. void GraphSettingsRelativeTab::updateUnit(int unit)
  12080. {
  12081. QSettings settings;
  12082. settings.setValue("settings/graph/relative/unit",unit);
  12083. }
  12084. /*:870*//*871:*/
  12085. #line 163 "./graphsettings.w"
  12086. void GraphSettingsRelativeTab::showColorPicker()
  12087. {
  12088. QColor color= QColorDialog::getColor(QColor(colorEdit->text()),this);
  12089. colorEdit->setText(color.name());
  12090. }
  12091. #line 64 "./settings.w"
  12092. #line 1 "./colorsettings.w"
  12093. /*:871*/
  12094. #line 610 "./typica.w"
  12095. /*1072:*/
  12096. #line 682 "./dataqsdk.w"
  12097. DataqSdkDeviceConfWidget::DataqSdkDeviceConfWidget(DeviceTreeModel*model,
  12098. const QModelIndex&index)
  12099. :BasicDeviceConfigurationWidget(model,index),
  12100. deviceIdStack(new QStackedWidget)
  12101. {
  12102. QVBoxLayout*layout= new QVBoxLayout;
  12103. QCheckBox*autoDetect= new QCheckBox("Automatically select device");
  12104. layout->addWidget(autoDetect);
  12105. QWidget*autoLayerWidget= new QWidget;
  12106. QHBoxLayout*autoLayerLayout= new QHBoxLayout;
  12107. QLabel*autoLabel= new QLabel(tr("Device number"));
  12108. QSpinBox*autoNumber= new QSpinBox;
  12109. autoNumber->setMinimum(1);
  12110. autoNumber->setMaximum(99);
  12111. autoLayerLayout->addWidget(autoLabel);
  12112. autoLayerLayout->addWidget(autoNumber);
  12113. autoLayerWidget->setLayout(autoLayerLayout);
  12114. QWidget*fixedLayerWidget= new QWidget;
  12115. QHBoxLayout*fixedLayerLayout= new QHBoxLayout;
  12116. QLabel*fixedLabel= new QLabel(tr("Device port"));
  12117. QComboBox*portSelection= new QComboBox;
  12118. portSelection->setEditable(true);
  12119. portSelection->addItems(DataqSdkDevice::detectHardware());
  12120. fixedLayerLayout->addWidget(fixedLabel);
  12121. fixedLayerLayout->addWidget(portSelection);
  12122. fixedLayerWidget->setLayout(fixedLayerLayout);
  12123. deviceIdStack->addWidget(autoLayerWidget);
  12124. deviceIdStack->addWidget(fixedLayerWidget);
  12125. layout->addWidget(deviceIdStack);
  12126. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  12127. layout->addWidget(addChannelButton);
  12128. /*801:*/
  12129. #line 16668 "./typica.w"
  12130. QDomElement referenceElement=
  12131. model->referenceElement(model->data(index,Qt::UserRole).toString());
  12132. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  12133. QDomElement node;
  12134. /*:801*/
  12135. #line 714 "./dataqsdk.w"
  12136. for(int i= 0;i<configData.size();i++)
  12137. {
  12138. node= configData.at(i).toElement();
  12139. if(node.attribute("name")=="autoSelect")
  12140. {
  12141. autoDetect->setChecked(node.attribute("value")=="true"?true:false);
  12142. }
  12143. else if(node.attribute("name")=="deviceNumber")
  12144. {
  12145. autoNumber->setValue(node.attribute("value").toInt());
  12146. }
  12147. else if(node.attribute("name")=="port")
  12148. {
  12149. int index= portSelection->findText(node.attribute("value"));
  12150. if(index> -1)
  12151. {
  12152. portSelection->setCurrentIndex(index);
  12153. }
  12154. else
  12155. {
  12156. portSelection->setEditText(node.attribute("value"));
  12157. }
  12158. }
  12159. }
  12160. updateAutoSelect(autoDetect->isChecked());
  12161. updateDeviceNumber(autoNumber->value());
  12162. updatePort(portSelection->currentText());
  12163. connect(autoDetect,SIGNAL(toggled(bool)),this,SLOT(updateAutoSelect(bool)));
  12164. connect(autoNumber,SIGNAL(valueChanged(int)),this,SLOT(updateDeviceNumber(int)));
  12165. connect(portSelection,SIGNAL(currentIndexChanged(QString)),this,SLOT(updatePort(QString)));
  12166. connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
  12167. setLayout(layout);
  12168. }
  12169. /*:1072*//*1073:*/
  12170. #line 758 "./dataqsdk.w"
  12171. void DataqSdkDeviceConfWidget::updateAutoSelect(bool automatic)
  12172. {
  12173. if(automatic)
  12174. {
  12175. updateAttribute("autoSelect","true");
  12176. deviceIdStack->setCurrentIndex(0);
  12177. }
  12178. else
  12179. {
  12180. updateAttribute("autoSelect","false");
  12181. deviceIdStack->setCurrentIndex(1);
  12182. }
  12183. }
  12184. /*:1073*//*1074:*/
  12185. #line 775 "./dataqsdk.w"
  12186. void DataqSdkDeviceConfWidget::updateDeviceNumber(int deviceNumber)
  12187. {
  12188. updateAttribute("deviceNumber",QString("%1").arg(deviceNumber));
  12189. }
  12190. void DataqSdkDeviceConfWidget::updatePort(QString portId)
  12191. {
  12192. updateAttribute("port",portId);
  12193. }
  12194. /*:1074*//*1075:*/
  12195. #line 788 "./dataqsdk.w"
  12196. void DataqSdkDeviceConfWidget::addChannel()
  12197. {
  12198. insertChildNode(tr("Channel"),"dataqsdkchannel");
  12199. }
  12200. /*:1075*//*1078:*/
  12201. #line 868 "./dataqsdk.w"
  12202. DataqSdkChannelConfWidget::DataqSdkChannelConfWidget(DeviceTreeModel*model,
  12203. const QModelIndex&index)
  12204. :BasicDeviceConfigurationWidget(model,index),
  12205. startButton(new QPushButton(tr("Start"))),
  12206. resetButton(new QPushButton(tr("Reset"))),
  12207. stopButton(new QPushButton(tr("Stop"))),
  12208. calibrator(new LinearCalibrator),
  12209. currentMeasurement(new QLineEdit),minimumMeasurement(new QLineEdit),
  12210. maximumMeasurement(new QLineEdit),averageMeasurement(new QLineEdit),
  12211. currentMapped(new QLineEdit),minimumMapped(new QLineEdit),
  12212. maximumMapped(new QLineEdit),averageMapped(new QLineEdit),
  12213. rmCount(0),cmCount(0),
  12214. rmin(std::numeric_limits<double> ::max()),
  12215. rmax(std::numeric_limits<double> ::min()),rmean(0),
  12216. cmin(std::numeric_limits<double> ::max()),
  12217. cmax(std::numeric_limits<double> ::min()),cmean(0)
  12218. {
  12219. /*1082:*/
  12220. #line 1107 "./dataqsdk.w"
  12221. QDomElement parentReference= model->referenceElement(model->data(index.parent(),Qt::UserRole).toString());
  12222. QDomNodeList deviceConfigData= parentReference.elementsByTagName("attribute");
  12223. QDomElement deviceNode;
  12224. QString configPort;
  12225. QString configAuto;
  12226. for(int i= 0;i<deviceConfigData.size();i++)
  12227. {
  12228. deviceNode= deviceConfigData.at(i).toElement();
  12229. if(deviceNode.attribute("name")=="autoSelect")
  12230. {
  12231. autoSelect= (deviceNode.attribute("value")=="true");
  12232. }
  12233. else if(deviceNode.attribute("name")=="deviceNumber")
  12234. {
  12235. configAuto= deviceNode.attribute("value");
  12236. }
  12237. else if(deviceNode.attribute("name")=="port")
  12238. {
  12239. configPort= deviceNode.attribute("value");
  12240. }
  12241. }
  12242. deviceID= autoSelect?configAuto:configPort;
  12243. channelOfInterest= index.row();
  12244. /*:1082*/
  12245. #line 886 "./dataqsdk.w"
  12246. resetButton->setEnabled(false);
  12247. stopButton->setEnabled(false);
  12248. connect(startButton,SIGNAL(clicked()),this,SLOT(startCalibration()));
  12249. connect(resetButton,SIGNAL(clicked()),this,SLOT(resetCalibration()));
  12250. connect(stopButton,SIGNAL(clicked()),this,SLOT(stopCalibration()));
  12251. QVBoxLayout*layout= new QVBoxLayout;
  12252. QFormLayout*topLayout= new QFormLayout;
  12253. QLineEdit*columnEdit= new QLineEdit;
  12254. topLayout->addRow(tr("Column name"),columnEdit);
  12255. QComboBox*unitSelector= new QComboBox;
  12256. unitSelector->addItem(tr("Temperature"));
  12257. unitSelector->addItem(tr("Control"));
  12258. topLayout->addRow(tr("Measurement type"),unitSelector);
  12259. QCheckBox*smoothingBox= new QCheckBox(tr("Enable smoothing"));
  12260. topLayout->addRow(smoothingBox);
  12261. layout->addLayout(topLayout);
  12262. QCheckBox*hideSeries= new QCheckBox(tr("Hide this channel"));
  12263. topLayout->addRow(hideSeries);
  12264. QLabel*calibrationLabel= new QLabel(tr("Calibration settings"));
  12265. layout->addWidget(calibrationLabel);
  12266. QHBoxLayout*calibrationLayout= new QHBoxLayout;
  12267. QFormLayout*calibrationControlsLayout= new QFormLayout;
  12268. QLineEdit*measuredLowerEdit= new QLineEdit;
  12269. measuredLowerEdit->setText("0");
  12270. QLineEdit*measuredUpperEdit= new QLineEdit;
  12271. measuredUpperEdit->setText("10");
  12272. QLineEdit*mappedLowerEdit= new QLineEdit;
  12273. mappedLowerEdit->setText("0");
  12274. QLineEdit*mappedUpperEdit= new QLineEdit;
  12275. mappedUpperEdit->setText("10");
  12276. calibrationControlsLayout->addRow(tr("Measured lower value"),measuredLowerEdit);
  12277. calibrationControlsLayout->addRow(tr("Mapped lower value"),mappedLowerEdit);
  12278. calibrationControlsLayout->addRow(tr("Measured upper value"),measuredUpperEdit);
  12279. calibrationControlsLayout->addRow(tr("Mapped upper value"),mappedUpperEdit);
  12280. QCheckBox*closedBox= new QCheckBox(tr("Closed range"));
  12281. calibrationControlsLayout->addRow(closedBox);
  12282. QLineEdit*sensitivityEdit= new QLineEdit;
  12283. sensitivityEdit->setText("0");
  12284. calibrationControlsLayout->addRow(tr("Discrete interval skip"),sensitivityEdit);
  12285. QVBoxLayout*calibrationTestLayout= new QVBoxLayout;
  12286. QHBoxLayout*deviceControlLayout= new QHBoxLayout;
  12287. deviceControlLayout->addWidget(startButton);
  12288. deviceControlLayout->addWidget(resetButton);
  12289. deviceControlLayout->addWidget(stopButton);
  12290. QFormLayout*indicatorLayout= new QFormLayout;
  12291. currentMeasurement->setReadOnly(true);
  12292. minimumMeasurement->setReadOnly(true);
  12293. maximumMeasurement->setReadOnly(true);
  12294. averageMeasurement->setReadOnly(true);
  12295. currentMapped->setReadOnly(true);
  12296. minimumMapped->setReadOnly(true);
  12297. maximumMapped->setReadOnly(true);
  12298. averageMapped->setReadOnly(true);
  12299. indicatorLayout->addRow(tr("Measured Values"),new QWidget);
  12300. indicatorLayout->addRow(tr("Current"),currentMeasurement);
  12301. indicatorLayout->addRow(tr("Minimum"),minimumMeasurement);
  12302. indicatorLayout->addRow(tr("Maximum"),maximumMeasurement);
  12303. indicatorLayout->addRow(tr("Mean"),averageMeasurement);
  12304. indicatorLayout->addRow(tr("Mapped Values"),new QWidget);
  12305. indicatorLayout->addRow(tr("Current Mapped"),currentMapped);
  12306. indicatorLayout->addRow(tr("Minimum Mapped"),minimumMapped);
  12307. indicatorLayout->addRow(tr("Maximum Mapped"),maximumMapped);
  12308. indicatorLayout->addRow(tr("Mean Mapped"),averageMapped);
  12309. calibrationTestLayout->addLayout(deviceControlLayout);
  12310. calibrationTestLayout->addLayout(indicatorLayout);
  12311. calibrationLayout->addLayout(calibrationControlsLayout);
  12312. calibrationLayout->addLayout(calibrationTestLayout);
  12313. layout->addLayout(calibrationLayout);
  12314. /*801:*/
  12315. #line 16668 "./typica.w"
  12316. QDomElement referenceElement=
  12317. model->referenceElement(model->data(index,Qt::UserRole).toString());
  12318. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  12319. QDomElement node;
  12320. /*:801*/
  12321. #line 955 "./dataqsdk.w"
  12322. for(int i= 0;i<configData.size();i++)
  12323. {
  12324. node= configData.at(i).toElement();
  12325. if(node.attribute("name")=="column")
  12326. {
  12327. columnEdit->setText(node.attribute("value"));
  12328. }
  12329. else if(node.attribute("name")=="type")
  12330. {
  12331. unitSelector->setCurrentIndex(unitSelector->findText(node.attribute("value")));
  12332. }
  12333. else if(node.attribute("name")=="smoothing")
  12334. {
  12335. smoothingBox->setChecked(node.attribute("value")=="true");
  12336. }
  12337. else if(node.attribute("name")=="calibrationMeasuredLower")
  12338. {
  12339. measuredLowerEdit->setText(node.attribute("value"));
  12340. }
  12341. else if(node.attribute("name")=="calibrationMeasuredUpper")
  12342. {
  12343. measuredUpperEdit->setText(node.attribute("value"));
  12344. }
  12345. else if(node.attribute("name")=="calibrationMappedLower")
  12346. {
  12347. mappedLowerEdit->setText(node.attribute("value"));
  12348. }
  12349. else if(node.attribute("name")=="calibrationMappedUpper")
  12350. {
  12351. mappedUpperEdit->setText(node.attribute("value"));
  12352. }
  12353. else if(node.attribute("name")=="calibrationClosedInterval")
  12354. {
  12355. closedBox->setChecked(node.attribute("value")=="true");
  12356. }
  12357. else if(node.attribute("name")=="calibrationSensitivity")
  12358. {
  12359. sensitivityEdit->setText(node.attribute("value"));
  12360. }
  12361. else if(node.attribute("name")=="hidden")
  12362. {
  12363. hideSeries->setChecked(node.attribute("value")=="true");
  12364. }
  12365. }
  12366. updateColumnName(columnEdit->text());
  12367. updateUnits(unitSelector->currentText());
  12368. updateSmoothingEnabled(smoothingBox->isChecked());
  12369. updateMeasuredLower(measuredLowerEdit->text());
  12370. updateMeasuredUpper(measuredUpperEdit->text());
  12371. updateMappedLower(mappedLowerEdit->text());
  12372. updateMappedUpper(mappedUpperEdit->text());
  12373. updateClosedInterval(closedBox->isChecked());
  12374. updateSensitivity(sensitivityEdit->text());
  12375. updateHidden(hideSeries->isChecked());
  12376. connect(columnEdit,SIGNAL(textChanged(QString)),
  12377. this,SLOT(updateColumnName(QString)));
  12378. connect(unitSelector,SIGNAL(currentIndexChanged(QString)),
  12379. this,SLOT(updateUnits(QString)));
  12380. connect(smoothingBox,SIGNAL(toggled(bool)),
  12381. this,SLOT(updateSmoothingEnabled(bool)));
  12382. connect(measuredLowerEdit,SIGNAL(textChanged(QString)),
  12383. this,SLOT(updateMeasuredLower(QString)));
  12384. connect(mappedLowerEdit,SIGNAL(textChanged(QString)),
  12385. this,SLOT(updateMappedLower(QString)));
  12386. connect(measuredUpperEdit,SIGNAL(textChanged(QString)),
  12387. this,SLOT(updateMeasuredUpper(QString)));
  12388. connect(mappedUpperEdit,SIGNAL(textChanged(QString)),
  12389. this,SLOT(updateMappedUpper(QString)));
  12390. connect(closedBox,SIGNAL(toggled(bool)),
  12391. this,SLOT(updateClosedInterval(bool)));
  12392. connect(sensitivityEdit,SIGNAL(textChanged(QString)),
  12393. this,SLOT(updateSensitivity(QString)));
  12394. connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  12395. setLayout(layout);
  12396. }
  12397. /*:1078*//*1079:*/
  12398. #line 1038 "./dataqsdk.w"
  12399. void DataqSdkChannelConfWidget::updateUnits(const QString&unit)
  12400. {
  12401. updateAttribute("type",unit);
  12402. }
  12403. /*:1079*//*1080:*/
  12404. #line 1047 "./dataqsdk.w"
  12405. void DataqSdkChannelConfWidget::updateMeasuredLower(const QString&value)
  12406. {
  12407. updateAttribute("calibrationMeasuredLower",value);
  12408. calibrator->setMeasuredLower(value.toDouble());
  12409. }
  12410. void DataqSdkChannelConfWidget::updateMeasuredUpper(const QString&value)
  12411. {
  12412. updateAttribute("calibrationMeasuredUpper",value);
  12413. calibrator->setMeasuredUpper(value.toDouble());
  12414. }
  12415. void DataqSdkChannelConfWidget::updateMappedLower(const QString&value)
  12416. {
  12417. updateAttribute("calibrationMappedLower",value);
  12418. calibrator->setMappedLower(value.toDouble());
  12419. }
  12420. void DataqSdkChannelConfWidget::updateMappedUpper(const QString&value)
  12421. {
  12422. updateAttribute("calibrationMappedUpper",value);
  12423. calibrator->setMappedUpper(value.toDouble());
  12424. }
  12425. void DataqSdkChannelConfWidget::updateClosedInterval(bool closed)
  12426. {
  12427. updateAttribute("calibrationClosedInterval",closed?"true":"false");
  12428. calibrator->setClosedRange(closed);
  12429. }
  12430. void DataqSdkChannelConfWidget::updateSmoothingEnabled(bool enabled)
  12431. {
  12432. updateAttribute("smoothing",enabled?"true":"false");
  12433. }
  12434. void DataqSdkChannelConfWidget::updateSensitivity(const QString&value)
  12435. {
  12436. updateAttribute("calibrationSensitivity",value);
  12437. calibrator->setSensitivity(value.toDouble());
  12438. }
  12439. void DataqSdkChannelConfWidget::updateHidden(bool hidden)
  12440. {
  12441. updateAttribute("hidden",hidden?"true":"false");
  12442. }
  12443. /*:1080*//*1083:*/
  12444. #line 1136 "./dataqsdk.w"
  12445. void DataqSdkChannelConfWidget::startCalibration()
  12446. {
  12447. startButton->setEnabled(false);
  12448. stopButton->setEnabled(true);
  12449. resetButton->setEnabled(true);
  12450. calibrationDevice= new DataqSdkDevice(deviceID);
  12451. Channel*channel;
  12452. for(unsigned int i= 0;i<=channelOfInterest;i++)
  12453. {
  12454. channel= calibrationDevice->newChannel(Units::Unitless);
  12455. }
  12456. connect(channel,SIGNAL(newData(Measurement)),this,SLOT(updateInput(Measurement)));
  12457. connect(channel,SIGNAL(newData(Measurement)),calibrator,SLOT(newMeasurement(Measurement)));
  12458. connect(calibrator,SIGNAL(newData(Measurement)),this,SLOT(updateOutput(Measurement)));
  12459. calibrationDevice->setClockRate(6.0/(1.0+channelOfInterest));
  12460. calibrationDevice->start();
  12461. }
  12462. void DataqSdkChannelConfWidget::stopCalibration()
  12463. {
  12464. startButton->setEnabled(true);
  12465. stopButton->setEnabled(false);
  12466. resetButton->setEnabled(false);
  12467. calibrationDevice->deleteLater();
  12468. /*1085:*/
  12469. #line 1181 "./dataqsdk.w"
  12470. rmCount= 0;
  12471. cmCount= 0;
  12472. rmin= std::numeric_limits<double> ::max();
  12473. rmax= std::numeric_limits<double> ::min();
  12474. rmean= 0;
  12475. cmin= std::numeric_limits<double> ::max();
  12476. cmax= std::numeric_limits<double> ::min();
  12477. cmean= 0;
  12478. /*:1085*/
  12479. #line 1161 "./dataqsdk.w"
  12480. }
  12481. /*:1083*//*1084:*/
  12482. #line 1172 "./dataqsdk.w"
  12483. void DataqSdkChannelConfWidget::resetCalibration()
  12484. {
  12485. /*1085:*/
  12486. #line 1181 "./dataqsdk.w"
  12487. rmCount= 0;
  12488. cmCount= 0;
  12489. rmin= std::numeric_limits<double> ::max();
  12490. rmax= std::numeric_limits<double> ::min();
  12491. rmean= 0;
  12492. cmin= std::numeric_limits<double> ::max();
  12493. cmax= std::numeric_limits<double> ::min();
  12494. cmean= 0;
  12495. /*:1085*/
  12496. #line 1175 "./dataqsdk.w"
  12497. }
  12498. /*:1084*//*1086:*/
  12499. #line 1195 "./dataqsdk.w"
  12500. void DataqSdkChannelConfWidget::updateInput(Measurement measure)
  12501. {
  12502. double nv= measure.temperature();
  12503. currentMeasurement->setText(QString("%1").arg(nv));
  12504. rmin= qMin(nv,rmin);
  12505. minimumMeasurement->setText(QString("%1").arg(rmin));
  12506. rmax= qMax(nv,rmax);
  12507. maximumMeasurement->setText(QString("%1").arg(rmax));
  12508. rmean= ((rmean*rmCount)+nv)/(rmCount+1);
  12509. rmCount++;
  12510. averageMeasurement->setText(QString("%1").arg(rmean));
  12511. }
  12512. void DataqSdkChannelConfWidget::updateOutput(Measurement measure)
  12513. {
  12514. double nv= measure.temperature();
  12515. currentMapped->setText(QString("%1").arg(nv));
  12516. cmin= qMin(nv,cmin);
  12517. minimumMapped->setText(QString("%1").arg(cmin));
  12518. cmax= qMax(nv,cmax);
  12519. maximumMapped->setText(QString("%1").arg(cmax));
  12520. cmean= ((cmean*cmCount)+nv)/(cmCount+1);
  12521. cmCount++;
  12522. averageMapped->setText(QString("%1").arg(cmean));
  12523. }
  12524. /*:1086*//*1087:*/
  12525. #line 1224 "./dataqsdk.w"
  12526. void DataqSdkChannelConfWidget::updateColumnName(const QString&value)
  12527. {
  12528. updateAttribute("column",value);
  12529. }
  12530. /*:1087*/
  12531. #line 611 "./typica.w"
  12532. /*1111:*/
  12533. #line 423 "./scales.w"
  12534. SerialScaleConfWidget::SerialScaleConfWidget(DeviceTreeModel*model,
  12535. const QModelIndex&index)
  12536. :BasicDeviceConfigurationWidget(model,index),
  12537. port(new PortSelector),baud(new BaudSelector),parity(new ParitySelector),
  12538. flow(new FlowSelector),stop(new StopSelector),
  12539. weighcommand(new QLineEdit("!KP")),commandterminator(new QComboBox)
  12540. {
  12541. QFormLayout*layout= new QFormLayout;
  12542. layout->addRow(tr("Port:"),port);
  12543. connect(port,SIGNAL(currentIndexChanged(QString)),
  12544. this,SLOT(updatePort(QString)));
  12545. connect(port,SIGNAL(editTextChanged(QString)),
  12546. this,SLOT(updatePort(QString)));
  12547. layout->addRow(tr("Baud:"),baud);
  12548. connect(baud,SIGNAL(currentIndexChanged(QString)),
  12549. this,SLOT(updateBaudRate(QString)));
  12550. layout->addRow(tr("Parity:"),parity);
  12551. connect(parity,SIGNAL(currentIndexChanged(int)),
  12552. this,SLOT(updateParity(int)));
  12553. layout->addRow(tr("Flow Control:"),flow);
  12554. connect(flow,SIGNAL(currentIndexChanged(int)),
  12555. this,SLOT(updateFlowControl(int)));
  12556. layout->addRow(tr("Stop Bits:"),stop);
  12557. connect(stop,SIGNAL(currentIndexChanged(int)),
  12558. this,SLOT(updateStopBits(int)));
  12559. layout->addRow(tr("Weigh Command:"),weighcommand);
  12560. connect(weighcommand,SIGNAL(textChanged(QString)),
  12561. this,SLOT(updateWeighCommand(QString)));
  12562. commandterminator->addItem("CRLF");
  12563. commandterminator->addItem("CR");
  12564. commandterminator->addItem("LF");
  12565. layout->addRow(tr("Command Terminator:"),commandterminator);
  12566. connect(commandterminator,SIGNAL(currentIndexChanged(QString)),
  12567. this,SLOT(updateCommandTerminator(QString)));
  12568. /*801:*/
  12569. #line 16668 "./typica.w"
  12570. QDomElement referenceElement=
  12571. model->referenceElement(model->data(index,Qt::UserRole).toString());
  12572. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  12573. QDomElement node;
  12574. /*:801*/
  12575. #line 459 "./scales.w"
  12576. for(int i= 0;i<configData.size();i++)
  12577. {
  12578. node= configData.at(i).toElement();
  12579. if(node.attribute("name")=="port")
  12580. {
  12581. int j= port->findText(node.attribute("value"));
  12582. if(j>=0)
  12583. {
  12584. port->setCurrentIndex(j);
  12585. }
  12586. else
  12587. {
  12588. port->insertItem(0,node.attribute("value"));
  12589. port->setCurrentIndex(0);
  12590. }
  12591. }
  12592. else if(node.attribute("name")=="baudrate")
  12593. {
  12594. baud->setCurrentIndex(baud->findText(node.attribute("value")));
  12595. }
  12596. else if(node.attribute("name")=="parity")
  12597. {
  12598. parity->setCurrentIndex(parity->findData(node.attribute("value")));
  12599. }
  12600. else if(node.attribute("name")=="flowcontrol")
  12601. {
  12602. flow->setCurrentIndex(flow->findData(node.attribute("value")));
  12603. }
  12604. else if(node.attribute("name")=="stopbits")
  12605. {
  12606. stop->setCurrentIndex(stop->findData(node.attribute("value")));
  12607. }
  12608. else if(node.attribute("name")=="weighcommand")
  12609. {
  12610. weighcommand->setText(node.attribute("value"));
  12611. }
  12612. else if(node.attribute("name")=="commandterminator")
  12613. {
  12614. commandterminator->setCurrentIndex(
  12615. commandterminator->findText(node.attribute("value")));
  12616. }
  12617. }
  12618. updatePort(port->currentText());
  12619. updateBaudRate(baud->currentText());
  12620. updateParity(parity->currentIndex());
  12621. updateFlowControl(flow->currentIndex());
  12622. updateStopBits(stop->currentIndex());
  12623. updateWeighCommand(weighcommand->text());
  12624. updateCommandTerminator(commandterminator->currentText());
  12625. setLayout(layout);
  12626. }
  12627. /*:1111*//*1112:*/
  12628. #line 514 "./scales.w"
  12629. void SerialScaleConfWidget::updatePort(const QString&newPort)
  12630. {
  12631. updateAttribute("port",newPort);
  12632. }
  12633. void SerialScaleConfWidget::updateBaudRate(const QString&rate)
  12634. {
  12635. updateAttribute("baudrate",rate);
  12636. }
  12637. void SerialScaleConfWidget::updateParity(int index)
  12638. {
  12639. updateAttribute("parity",parity->itemData(index).toString());
  12640. }
  12641. void SerialScaleConfWidget::updateFlowControl(int index)
  12642. {
  12643. updateAttribute("flowcontrol",flow->itemData(index).toString());
  12644. }
  12645. void SerialScaleConfWidget::updateStopBits(int index)
  12646. {
  12647. updateAttribute("stopbits",stop->itemData(index).toString());
  12648. }
  12649. void SerialScaleConfWidget::updateWeighCommand(const QString&command)
  12650. {
  12651. updateAttribute("weighcommand",command);
  12652. }
  12653. void SerialScaleConfWidget::updateCommandTerminator(const QString&terminator)
  12654. {
  12655. updateAttribute("commandterminator",terminator);
  12656. }
  12657. /*:1112*/
  12658. #line 612 "./typica.w"
  12659. /*1124:*/
  12660. #line 195 "./valueannotation.w"
  12661. void ValueAnnotation::newMeasurement(Measurement measure)
  12662. {
  12663. for(int i= 0;i<values.size();i++)
  12664. {
  12665. if(measure.temperature()> values.at(i)-tolerance&&
  12666. measure.temperature()<values.at(i)+tolerance)
  12667. {
  12668. if(i!=lastIndex)
  12669. {
  12670. lastIndex= i;
  12671. emit annotation(annotations.at(i),measurementColumn,annotationColumn);
  12672. }
  12673. }
  12674. }
  12675. }
  12676. /*:1124*//*1125:*/
  12677. #line 216 "./valueannotation.w"
  12678. void ValueAnnotation::annotate()
  12679. {
  12680. if(lastIndex> -1)
  12681. {
  12682. emit annotation(annotations.at(lastIndex),measurementColumn,annotationColumn);
  12683. }
  12684. }
  12685. /*:1125*//*1126:*/
  12686. #line 228 "./valueannotation.w"
  12687. void ValueAnnotation::setAnnotation(double value,const QString&annotation)
  12688. {
  12689. values.append(value);
  12690. annotations.append(annotation);
  12691. }
  12692. /*:1126*//*1127:*/
  12693. #line 237 "./valueannotation.w"
  12694. void ValueAnnotation::setAnnotationColumn(int column)
  12695. {
  12696. annotationColumn= column;
  12697. }
  12698. void ValueAnnotation::setTemperatureColumn(int column)
  12699. {
  12700. measurementColumn= column;
  12701. }
  12702. void ValueAnnotation::setTolerance(double epsilon)
  12703. {
  12704. tolerance= epsilon;
  12705. }
  12706. /*:1127*//*1128:*/
  12707. #line 255 "./valueannotation.w"
  12708. ValueAnnotation::ValueAnnotation():QObject(),
  12709. lastIndex(-1),annotationColumn(2),measurementColumn(1),tolerance(0.05)
  12710. {
  12711. }
  12712. /*:1128*/
  12713. #line 613 "./typica.w"
  12714. /*1116:*/
  12715. #line 33 "./valueannotation.w"
  12716. ValueAnnotationConfWidget::ValueAnnotationConfWidget(DeviceTreeModel*model,
  12717. const QModelIndex&index)
  12718. :BasicDeviceConfigurationWidget(model,index),
  12719. tablemodel(new SaltModel(2))
  12720. {
  12721. QFormLayout*layout= new QFormLayout;
  12722. QLineEdit*source= new QLineEdit;
  12723. layout->addRow(tr("Source column name:"),source);
  12724. QCheckBox*noteOnStart= new QCheckBox(tr("Produce Start State Annotation"));
  12725. noteOnStart->setChecked(true);
  12726. layout->addRow(noteOnStart);
  12727. tablemodel->setHeaderData(0,Qt::Horizontal,"Value");
  12728. tablemodel->setHeaderData(1,Qt::Horizontal,"Annotation");
  12729. QTableView*annotationTable= new QTableView;
  12730. annotationTable->setModel(tablemodel);
  12731. NumericDelegate*delegate= new NumericDelegate;
  12732. annotationTable->setItemDelegateForColumn(0,delegate);
  12733. layout->addRow(tr("Annotations for values:"),annotationTable);
  12734. /*801:*/
  12735. #line 16668 "./typica.w"
  12736. QDomElement referenceElement=
  12737. model->referenceElement(model->data(index,Qt::UserRole).toString());
  12738. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  12739. QDomElement node;
  12740. /*:801*/
  12741. #line 52 "./valueannotation.w"
  12742. for(int i= 0;i<configData.size();i++)
  12743. {
  12744. node= configData.at(i).toElement();
  12745. if(node.attribute("name")=="source")
  12746. {
  12747. source->setText(node.attribute("value"));
  12748. }
  12749. else if(node.attribute("name")=="emitOnStart")
  12750. {
  12751. noteOnStart->setChecked(node.attribute("value")=="true"?true:false);
  12752. }
  12753. else if(node.attribute("name")=="measuredValues")
  12754. {
  12755. /*1000:*/
  12756. #line 19758 "./typica.w"
  12757. QString data= node.attribute("value");
  12758. if(data.length()> 3)
  12759. {
  12760. data.chop(2);
  12761. data= data.remove(0,2);
  12762. }
  12763. QStringList itemList= data.split(",");
  12764. /*:1000*/
  12765. #line 66 "./valueannotation.w"
  12766. int column= 0;
  12767. /*1001:*/
  12768. #line 19770 "./typica.w"
  12769. for(int j= 0;j<itemList.size();j++)
  12770. {
  12771. tablemodel->setData(tablemodel->index(j,column),
  12772. QVariant(itemList.at(j).toDouble()),
  12773. Qt::DisplayRole);
  12774. }
  12775. /*:1001*/
  12776. #line 68 "./valueannotation.w"
  12777. }
  12778. else if(node.attribute("name")=="annotations")
  12779. {
  12780. /*1117:*/
  12781. #line 89 "./valueannotation.w"
  12782. QString data= node.attribute("value");
  12783. if(data.length()> 3)
  12784. {
  12785. data.chop(2);
  12786. data= data.remove(0,2);
  12787. }
  12788. QStringList itemList= data.split(",");
  12789. for(int i= 0;i<itemList.size();i++)
  12790. {
  12791. itemList[i]= itemList[i].simplified();
  12792. }
  12793. /*:1117*/
  12794. #line 72 "./valueannotation.w"
  12795. int column= 1;
  12796. /*1118:*/
  12797. #line 104 "./valueannotation.w"
  12798. for(int i= 0;i<itemList.size();i++)
  12799. {
  12800. tablemodel->setData(tablemodel->index(i,column),
  12801. QVariant(itemList.at(i)),
  12802. Qt::DisplayRole);
  12803. }
  12804. /*:1118*/
  12805. #line 74 "./valueannotation.w"
  12806. }
  12807. }
  12808. updateSourceColumn(source->text());
  12809. updateStart(noteOnStart->isChecked());
  12810. updateAnnotations();
  12811. connect(source,SIGNAL(textEdited(QString)),this,SLOT(updateSourceColumn(QString)));
  12812. connect(noteOnStart,SIGNAL(toggled(bool)),this,SLOT(updateStart(bool)));
  12813. connect(tablemodel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(updateAnnotations()));
  12814. setLayout(layout);
  12815. }
  12816. /*:1116*//*1119:*/
  12817. #line 115 "./valueannotation.w"
  12818. void ValueAnnotationConfWidget::updateAnnotations()
  12819. {
  12820. updateAttribute("measuredValues",tablemodel->arrayLiteral(0,Qt::DisplayRole));
  12821. updateAttribute("annotations",tablemodel->arrayLiteral(1,Qt::DisplayRole));
  12822. }
  12823. /*:1119*//*1120:*/
  12824. #line 125 "./valueannotation.w"
  12825. void ValueAnnotationConfWidget::updateSourceColumn(const QString&source)
  12826. {
  12827. updateAttribute("source",source);
  12828. }
  12829. void ValueAnnotationConfWidget::updateStart(bool noteOnStart)
  12830. {
  12831. updateAttribute("emitOnStart",noteOnStart?"true":"false");
  12832. }
  12833. /*:1120*/
  12834. #line 614 "./typica.w"
  12835. /*901:*/
  12836. #line 44 "./modbus.w"
  12837. ModbusNGConfWidget::ModbusNGConfWidget(DeviceTreeModel*model,const QModelIndex&index):
  12838. BasicDeviceConfigurationWidget(model,index),m_parity(new ParitySelector),
  12839. m_flow(new FlowSelector),m_stop(new StopSelector)
  12840. {
  12841. QFormLayout*layout= new QFormLayout;
  12842. PortSelector*port= new PortSelector;
  12843. BaudSelector*baud= new BaudSelector;
  12844. QPushButton*newInput= new QPushButton(tr("Add Input Channel"));
  12845. layout->addRow(QString(tr("Port:")),port);
  12846. layout->addRow(QString(tr("Baud rate:")),baud);
  12847. layout->addRow(QString(tr("Parity:")),m_parity);
  12848. layout->addRow(QString(tr("Flow control:")),m_flow);
  12849. layout->addRow(QString(tr("Stop bits:")),m_stop);
  12850. layout->addRow(newInput);
  12851. /*801:*/
  12852. #line 16668 "./typica.w"
  12853. QDomElement referenceElement=
  12854. model->referenceElement(model->data(index,Qt::UserRole).toString());
  12855. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  12856. QDomElement node;
  12857. /*:801*/
  12858. #line 60 "./modbus.w"
  12859. for(int i= 0;i<configData.size();i++)
  12860. {
  12861. node= configData.at(i).toElement();
  12862. if(node.attribute("name")=="port")
  12863. {
  12864. int idx= port->findText(node.attribute("value"));
  12865. if(idx>=0)
  12866. {
  12867. port->setCurrentIndex(idx);
  12868. }
  12869. else
  12870. {
  12871. port->addItem(node.attribute("value"));
  12872. }
  12873. }
  12874. else if(node.attribute("name")=="baud")
  12875. {
  12876. baud->setCurrentIndex(baud->findText(node.attribute("value")));
  12877. }
  12878. else if(node.attribute("name")=="parity")
  12879. {
  12880. m_parity->setCurrentIndex(m_parity->findData(node.attribute("value")));
  12881. }
  12882. else if(node.attribute("name")=="flow")
  12883. {
  12884. m_flow->setCurrentIndex(m_flow->findData(node.attribute("value")));
  12885. }
  12886. else if(node.attribute("name")=="stop")
  12887. {
  12888. m_stop->setCurrentIndex(m_stop->findData(node.attribute("value")));
  12889. }
  12890. }
  12891. updatePort(port->currentText());
  12892. updateBaudRate(baud->currentText());
  12893. updateParity(m_parity->currentIndex());
  12894. updateFlowControl(m_flow->currentIndex());
  12895. updateStopBits(m_stop->currentIndex());
  12896. connect(port,SIGNAL(currentIndexChanged(QString)),this,SLOT(updatePort(QString)));
  12897. connect(port,SIGNAL(editTextChanged(QString)),this,SLOT(updatePort(QString)));
  12898. connect(baud,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateBaudRate(QString)));
  12899. connect(m_parity,SIGNAL(currentIndexChanged(int)),this,SLOT(updateParity(int)));
  12900. connect(m_flow,SIGNAL(currentIndexChanged(int)),
  12901. this,SLOT(updateFlowControl(int)));
  12902. connect(m_stop,SIGNAL(currentIndexChanged(int)),this,SLOT(updateStopBits(int)));
  12903. connect(newInput,SIGNAL(clicked()),this,SLOT(addInput()));
  12904. setLayout(layout);
  12905. }
  12906. void ModbusNGConfWidget::updatePort(const QString&value)
  12907. {
  12908. updateAttribute("port",value);
  12909. }
  12910. void ModbusNGConfWidget::updateBaudRate(const QString&value)
  12911. {
  12912. updateAttribute("baud",value);
  12913. }
  12914. void ModbusNGConfWidget::updateParity(int value)
  12915. {
  12916. updateAttribute("parity",m_parity->itemData(value).toString());
  12917. }
  12918. void ModbusNGConfWidget::updateFlowControl(int value)
  12919. {
  12920. updateAttribute("flow",m_flow->itemData(value).toString());
  12921. }
  12922. void ModbusNGConfWidget::updateStopBits(int value)
  12923. {
  12924. updateAttribute("stop",m_stop->itemData(value).toString());
  12925. }
  12926. void ModbusNGConfWidget::addInput()
  12927. {
  12928. insertChildNode(tr("Input"),"modbusnginput");
  12929. }
  12930. /*:901*//*903:*/
  12931. #line 164 "./modbus.w"
  12932. ModbusNGInputConfWidget::ModbusNGInputConfWidget(DeviceTreeModel*model,const QModelIndex&index):BasicDeviceConfigurationWidget(model,index)
  12933. {
  12934. QFormLayout*layout= new QFormLayout;
  12935. QSpinBox*station= new QSpinBox;
  12936. station->setMinimum(1);
  12937. station->setMaximum(247);
  12938. layout->addRow(tr("Station ID"),station);
  12939. QComboBox*function= new QComboBox;
  12940. function->addItem("3","3");
  12941. function->addItem("4","4");
  12942. function->setCurrentIndex(1);
  12943. layout->addRow(tr("Function"),function);
  12944. ShortHexSpinBox*address= new ShortHexSpinBox;
  12945. layout->addRow(tr("Address"),address);
  12946. QComboBox*format= new QComboBox;
  12947. format->addItem(tr("16 bits fixed point"),"16fixedint");
  12948. format->addItem(tr("32 bits floating point (High Low)"),"32floathl");
  12949. format->addItem(tr("32 bits floating point (Low High)"),"32floatlh");
  12950. layout->addRow(tr("Data format"),format);
  12951. QSpinBox*decimals= new QSpinBox;
  12952. decimals->setMinimum(0);
  12953. decimals->setMaximum(9);
  12954. layout->addRow(tr("Decimal places"),decimals);
  12955. QComboBox*unit= new QComboBox;
  12956. unit->addItem("Celsius","C");
  12957. unit->addItem("Fahrenheit","F");
  12958. unit->addItem("Control","Control");
  12959. unit->setCurrentIndex(1);
  12960. layout->addRow(tr("Unit"),unit);
  12961. QLineEdit*column= new QLineEdit;
  12962. layout->addRow(tr("Column name"),column);
  12963. QCheckBox*hidden= new QCheckBox(tr("Hide this channel"));
  12964. layout->addRow(hidden);
  12965. /*801:*/
  12966. #line 16668 "./typica.w"
  12967. QDomElement referenceElement=
  12968. model->referenceElement(model->data(index,Qt::UserRole).toString());
  12969. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  12970. QDomElement node;
  12971. /*:801*/
  12972. #line 199 "./modbus.w"
  12973. for(int i= 0;i<configData.size();i++)
  12974. {
  12975. node= configData.at(i).toElement();
  12976. if(node.attribute("name")=="station")
  12977. {
  12978. station->setValue(node.attribute("value").toInt());
  12979. }
  12980. else if(node.attribute("name")=="function")
  12981. {
  12982. function->setCurrentIndex(function->findText(node.attribute("value")));
  12983. }
  12984. else if(node.attribute("name")=="address")
  12985. {
  12986. address->setValue(node.attribute("value").toInt());
  12987. }
  12988. else if(node.attribute("name")=="format")
  12989. {
  12990. format->setCurrentIndex(format->findData(node.attribute("value")));
  12991. }
  12992. else if(node.attribute("name")=="decimals")
  12993. {
  12994. decimals->setValue(node.attribute("value").toInt());
  12995. }
  12996. else if(node.attribute("name")=="unit")
  12997. {
  12998. unit->setCurrentIndex(unit->findData(node.attribute("value")));
  12999. }
  13000. else if(node.attribute("name")=="column")
  13001. {
  13002. column->setText(node.attribute("value"));
  13003. }
  13004. else if(node.attribute("name")=="hidden")
  13005. {
  13006. hidden->setChecked(node.attribute("value")=="true"?true:false);
  13007. }
  13008. }
  13009. updateStation(station->value());
  13010. updateFunction(function->currentIndex());
  13011. updateAddress(address->value());
  13012. updateFormat(format->currentIndex());
  13013. updateDecimals(decimals->value());
  13014. updateUnit(unit->currentIndex());
  13015. updateColumnName(column->text());
  13016. updateHidden(hidden->isChecked());
  13017. connect(station,SIGNAL(valueChanged(int)),this,SLOT(updateStation(int)));
  13018. connect(function,SIGNAL(currentIndexChanged(int)),this,SLOT(updateFunction(int)));
  13019. connect(address,SIGNAL(valueChanged(int)),this,SLOT(updateAddress(int)));
  13020. connect(format,SIGNAL(currentIndexChanged(int)),this,SLOT(updateFormat(int)));
  13021. connect(decimals,SIGNAL(valueChanged(int)),this,SLOT(updateDecimals(int)));
  13022. connect(unit,SIGNAL(currentIndexChanged(int)),this,SLOT(updateUnit(int)));
  13023. connect(column,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  13024. connect(hidden,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  13025. setLayout(layout);
  13026. }
  13027. void ModbusNGInputConfWidget::updateStation(int value)
  13028. {
  13029. updateAttribute("station",QString("%1").arg(value));
  13030. }
  13031. void ModbusNGInputConfWidget::updateFunction(int value)
  13032. {
  13033. updateAttribute("function",QString("%1").arg(value==0?"3":"4"));
  13034. }
  13035. void ModbusNGInputConfWidget::updateAddress(int value)
  13036. {
  13037. updateAttribute("address",QString("%1").arg(value));
  13038. }
  13039. void ModbusNGInputConfWidget::updateFormat(int value)
  13040. {
  13041. switch(value)
  13042. {
  13043. case 0:
  13044. updateAttribute("format","16fixedint");
  13045. break;
  13046. case 1:
  13047. updateAttribute("format","32floathl");
  13048. break;
  13049. case 2:
  13050. updateAttribute("format","32floatlh");
  13051. break;
  13052. }
  13053. }
  13054. void ModbusNGInputConfWidget::updateDecimals(int value)
  13055. {
  13056. updateAttribute("decimals",QString("%1").arg(value));
  13057. }
  13058. void ModbusNGInputConfWidget::updateUnit(int value)
  13059. {
  13060. switch(value)
  13061. {
  13062. case 0:
  13063. updateAttribute("unit","C");
  13064. break;
  13065. case 1:
  13066. updateAttribute("unit","F");
  13067. break;
  13068. case 2:
  13069. updateAttribute("unit","Control");
  13070. break;
  13071. }
  13072. }
  13073. void ModbusNGInputConfWidget::updateColumnName(const QString&value)
  13074. {
  13075. updateAttribute("column",value);
  13076. }
  13077. void ModbusNGInputConfWidget::updateHidden(bool value)
  13078. {
  13079. updateAttribute("hidden",value?"true":"false");
  13080. }
  13081. /*:903*//*908:*/
  13082. #line 403 "./modbus.w"
  13083. ModbusNG::ModbusNG(DeviceTreeModel*model,const QModelIndex&index):
  13084. QObject(NULL),messageDelayTimer(new QTimer),commTimeout(new QTimer),
  13085. rateLimiter(new QTimer),scanPosition(0),waiting(false)
  13086. {
  13087. QDomElement portReferenceElement=
  13088. model->referenceElement(model->data(index,Qt::UserRole).toString());
  13089. QDomNodeList portConfigData= portReferenceElement.elementsByTagName("attribute");
  13090. QDomElement node;
  13091. QVariantMap attributes;
  13092. for(int i= 0;i<portConfigData.size();i++)
  13093. {
  13094. node= portConfigData.at(i).toElement();
  13095. attributes.insert(node.attribute("name"),node.attribute("value"));
  13096. }
  13097. port= new QextSerialPort(attributes.value("port").toString(),
  13098. QextSerialPort::EventDriven);
  13099. port->setBaudRate((BaudRateType)(attributes.value("baud").toInt()));
  13100. port->setDataBits(DATA_8);
  13101. port->setParity((ParityType)attributes.value("parity").toInt());
  13102. port->setStopBits((StopBitsType)attributes.value("stop").toInt());
  13103. port->setFlowControl((FlowType)attributes.value("flow").toInt());
  13104. delayTime= (int)(((double)(1)/(double)(attributes.value("baud").toInt()))*144000.0);
  13105. messageDelayTimer->setSingleShot(true);
  13106. commTimeout->setSingleShot(true);
  13107. rateLimiter->setSingleShot(true);
  13108. rateLimiter->setInterval(0);
  13109. connect(messageDelayTimer,SIGNAL(timeout()),this,SLOT(sendNextMessage()));
  13110. connect(commTimeout,SIGNAL(timeout()),this,SLOT(timeout()));
  13111. connect(port,SIGNAL(readyRead()),this,SLOT(dataAvailable()));
  13112. connect(rateLimiter,SIGNAL(timeout()),this,SLOT(rateLimitTimeout()));
  13113. if(!port->open(QIODevice::ReadWrite))
  13114. {
  13115. qDebug()<<"Failed to open serial port";
  13116. }
  13117. for(int i= 0;i<model->rowCount(index);i++)
  13118. {
  13119. QModelIndex channelIndex= model->index(i,0,index);
  13120. QDomElement channelReferenceElement=
  13121. model->referenceElement(model->data(channelIndex,Qt::UserRole).toString());
  13122. QDomNodeList channelConfigData=
  13123. channelReferenceElement.elementsByTagName("attribute");
  13124. QDomElement channelNode;
  13125. QVariantMap channelAttributes;
  13126. for(int j= 0;j<channelConfigData.size();j++)
  13127. {
  13128. channelNode= channelConfigData.at(j).toElement();
  13129. channelAttributes.insert(channelNode.attribute("name"),
  13130. channelNode.attribute("value"));
  13131. }
  13132. ModbusScanItem scanItem;
  13133. QString format= channelAttributes.value("format").toString();
  13134. if(format=="16fixedint")
  13135. {
  13136. scanItem.format= Int16;
  13137. }
  13138. else if(format=="32floathl")
  13139. {
  13140. scanItem.format= FloatHL;
  13141. }
  13142. else if(format=="32floatlh")
  13143. {
  13144. scanItem.format= FloatLH;
  13145. }
  13146. scanItem.request.append((char)channelAttributes.value("station").toInt());
  13147. scanItem.request.append((char)channelAttributes.value("function").toInt());
  13148. quint16 startAddress= (quint16)channelAttributes.value("address").toInt();
  13149. char*startAddressBytes= (char*)&startAddress;
  13150. scanItem.request.append(startAddressBytes[1]);
  13151. scanItem.request.append(startAddressBytes[0]);
  13152. scanItem.request.append((char)0x00);
  13153. if(scanItem.format==Int16)
  13154. {
  13155. scanItem.request.append((char)0x01);
  13156. }
  13157. else
  13158. {
  13159. scanItem.request.append((char)0x02);
  13160. }
  13161. quint16 crc= calculateCRC(scanItem.request);
  13162. char*crcBytes= (char*)&crc;
  13163. scanItem.request.append(crcBytes[0]);
  13164. scanItem.request.append(crcBytes[1]);
  13165. scanItem.decimalPosition= channelAttributes.value("decimals").toInt();
  13166. if(channelAttributes.value("unit").toString()=="C")
  13167. {
  13168. scanItem.unit= Units::Celsius;
  13169. channelTypeList.append("T");
  13170. }
  13171. else if(channelAttributes.value("unit").toString()=="F")
  13172. {
  13173. scanItem.unit= Units::Fahrenheit;
  13174. channelTypeList.append("T");
  13175. }
  13176. else
  13177. {
  13178. scanItem.unit= Units::Unitless;
  13179. channelTypeList.append("C");
  13180. }
  13181. scanList.append(scanItem);
  13182. lastMeasurement.append(0.0);
  13183. channels.append(new Channel);
  13184. channelNames.append(channelAttributes.value("column").toString());
  13185. hiddenStates.append(
  13186. channelAttributes.value("hidden").toString()=="true"?true:false);
  13187. channelLabels.append(model->data(channelIndex,0).toString());
  13188. }
  13189. messageDelayTimer->start();
  13190. }
  13191. ModbusNG::~ModbusNG()
  13192. {
  13193. commTimeout->stop();
  13194. messageDelayTimer->stop();
  13195. port->close();
  13196. }
  13197. void ModbusNG::sendNextMessage()
  13198. {
  13199. if(scanList.length()> 0&&!waiting)
  13200. {
  13201. port->write(scanList.at(scanPosition).request);
  13202. commTimeout->start(2000);
  13203. messageDelayTimer->start(delayTime);
  13204. waiting= true;
  13205. }
  13206. }
  13207. void ModbusNG::timeout()
  13208. {
  13209. qDebug()<<"Communications timeout.";
  13210. messageDelayTimer->start();
  13211. }
  13212. void ModbusNG::rateLimitTimeout()
  13213. {
  13214. messageDelayTimer->start();
  13215. }
  13216. void ModbusNG::dataAvailable()
  13217. {
  13218. if(messageDelayTimer->isActive())
  13219. {
  13220. messageDelayTimer->stop();
  13221. }
  13222. responseBuffer.append(port->readAll());
  13223. if(responseBuffer.size()<5)
  13224. {
  13225. return;
  13226. }
  13227. if(responseBuffer.size()<5+responseBuffer.at(2))
  13228. {
  13229. return;
  13230. }
  13231. responseBuffer= responseBuffer.left(5+responseBuffer.at(2));
  13232. commTimeout->stop();
  13233. if(calculateCRC(responseBuffer)==0)
  13234. {
  13235. quint16 intresponse;
  13236. float floatresponse;
  13237. char*ibytes= (char*)&intresponse;
  13238. char*fbytes= (char*)&floatresponse;
  13239. double output;
  13240. switch(scanList.at(scanPosition).format)
  13241. {
  13242. case Int16:
  13243. ibytes[0]= responseBuffer.at(4);
  13244. ibytes[1]= responseBuffer.at(3);
  13245. output= intresponse;
  13246. for(int i= 0;i<scanList.at(scanPosition).decimalPosition;i++)
  13247. {
  13248. output/= 10;
  13249. }
  13250. break;
  13251. case FloatHL:
  13252. fbytes[0]= responseBuffer.at(4);
  13253. fbytes[1]= responseBuffer.at(3);
  13254. fbytes[2]= responseBuffer.at(6);
  13255. fbytes[3]= responseBuffer.at(5);
  13256. output= floatresponse;
  13257. break;
  13258. case FloatLH:
  13259. fbytes[0]= responseBuffer.at(6);
  13260. fbytes[1]= responseBuffer.at(5);
  13261. fbytes[2]= responseBuffer.at(4);
  13262. fbytes[3]= responseBuffer.at(3);
  13263. output= floatresponse;
  13264. break;
  13265. }
  13266. if(scanList.at(scanPosition).unit==Units::Celsius)
  13267. {
  13268. output= output*9.0/5.0+32.0;
  13269. }
  13270. scanList.at(scanPosition).lastValue= output;
  13271. }
  13272. else
  13273. {
  13274. qDebug()<<"CRC failed";
  13275. }
  13276. scanPosition= (scanPosition+1)%scanList.size();
  13277. if(scanPosition==0)
  13278. {
  13279. QTime time= QTime::currentTime();
  13280. bool doOutput= false;
  13281. for(int i= 0;i<scanList.size();i++)
  13282. {
  13283. if(scanList.at(i).lastValue!=lastMeasurement.at(i))
  13284. {
  13285. doOutput= true;
  13286. break;
  13287. }
  13288. }
  13289. if(doOutput)
  13290. {
  13291. for(int i= 0;i<scanList.size();i++)
  13292. {
  13293. lastMeasurement[i]= scanList.at(i).lastValue;
  13294. if(scanList.at(scanPosition).unit==Units::Unitless)
  13295. {
  13296. channels.at(i)->input(Measurement(scanList.at(i).lastValue,time,Units::Unitless));
  13297. }
  13298. else
  13299. {
  13300. channels.at(i)->input(Measurement(scanList.at(i).lastValue,time,Units::Fahrenheit));
  13301. }
  13302. }
  13303. }
  13304. }
  13305. responseBuffer.clear();
  13306. waiting= false;
  13307. if(scanPosition==0)
  13308. {
  13309. rateLimiter->start();
  13310. }
  13311. else
  13312. {
  13313. messageDelayTimer->start(delayTime);
  13314. }
  13315. }
  13316. quint16 ModbusNG::calculateCRC(QByteArray data)
  13317. {
  13318. quint16 retval= 0xFFFF;
  13319. int i= 0;
  13320. while(i<data.size())
  13321. {
  13322. retval^= 0x00FF&(quint16)data.at(i);
  13323. for(int j= 0;j<8;j++)
  13324. {
  13325. if(retval&1)
  13326. {
  13327. retval= (retval>>1)^0xA001;
  13328. }
  13329. else
  13330. {
  13331. retval>>= 1;
  13332. }
  13333. }
  13334. i++;
  13335. }
  13336. return retval;
  13337. }
  13338. int ModbusNG::channelCount()
  13339. {
  13340. return channels.size();
  13341. }
  13342. Channel*ModbusNG::getChannel(int channel)
  13343. {
  13344. return channels.at(channel);
  13345. }
  13346. QString ModbusNG::channelColumnName(int channel)
  13347. {
  13348. return channelNames.at(channel);
  13349. }
  13350. QString ModbusNG::channelIndicatorText(int channel)
  13351. {
  13352. return channelLabels.at(channel);
  13353. }
  13354. bool ModbusNG::isChannelHidden(int channel)
  13355. {
  13356. return hiddenStates.at(channel);
  13357. }
  13358. QString ModbusNG::channelType(int channel)
  13359. {
  13360. return channelTypeList.at(channel);
  13361. }
  13362. /*:908*/
  13363. #line 615 "./typica.w"
  13364. /*1133:*/
  13365. #line 33 "./thresholdannotation.w"
  13366. ThresholdAnnotationConfWidget::ThresholdAnnotationConfWidget(DeviceTreeModel*model,
  13367. const QModelIndex&index)
  13368. :BasicDeviceConfigurationWidget(model,index)
  13369. {
  13370. QFormLayout*layout= new QFormLayout;
  13371. QLineEdit*source= new QLineEdit;
  13372. layout->addRow(tr("Source column name:"),source);
  13373. QDoubleSpinBox*value= new QDoubleSpinBox;
  13374. value->setMinimum(-9999.99);
  13375. value->setMaximum(9999.99);
  13376. value->setDecimals(2);
  13377. layout->addRow(tr("Threshold value:"),value);
  13378. QComboBox*direction= new QComboBox;
  13379. direction->addItem(tr("Ascending"));
  13380. direction->addItem(tr("Descending"));
  13381. layout->addRow(tr("Direction:"),direction);
  13382. QLineEdit*annotation= new QLineEdit;
  13383. layout->addRow(tr("Annotation:"),annotation);
  13384. /*801:*/
  13385. #line 16668 "./typica.w"
  13386. QDomElement referenceElement=
  13387. model->referenceElement(model->data(index,Qt::UserRole).toString());
  13388. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  13389. QDomElement node;
  13390. /*:801*/
  13391. #line 52 "./thresholdannotation.w"
  13392. for(int i= 0;i<configData.size();i++)
  13393. {
  13394. node= configData.at(i).toElement();
  13395. if(node.attribute("name")=="source")
  13396. {
  13397. source->setText(node.attribute("value"));
  13398. }
  13399. else if(node.attribute("name")=="value")
  13400. {
  13401. value->setValue(node.attribute("value").toDouble());
  13402. }
  13403. else if(node.attribute("name")=="direction")
  13404. {
  13405. direction->setCurrentIndex(node.attribute("value").toInt());
  13406. }
  13407. else if(node.attribute("name")=="annotation")
  13408. {
  13409. annotation->setText(node.attribute("value"));
  13410. }
  13411. }
  13412. updateSourceColumn(source->text());
  13413. updateThreshold(value->value());
  13414. updateDirection(direction->currentIndex());
  13415. updateAnnotation(annotation->text());
  13416. connect(source,SIGNAL(textEdited(QString)),this,SLOT(updateSourceColumn(QString)));
  13417. connect(value,SIGNAL(valueChanged(double)),this,SLOT(updateThreshold(double)));
  13418. connect(direction,SIGNAL(currentIndexChanged(int)),this,SLOT(updateDirection(int)));
  13419. connect(annotation,SIGNAL(textEdited(QString)),this,SLOT(updateAnnotation(QString)));
  13420. setLayout(layout);
  13421. }
  13422. /*:1133*//*1134:*/
  13423. #line 86 "./thresholdannotation.w"
  13424. void ThresholdAnnotationConfWidget::updateSourceColumn(const QString&source)
  13425. {
  13426. updateAttribute("source",source);
  13427. }
  13428. void ThresholdAnnotationConfWidget::updateThreshold(double value)
  13429. {
  13430. updateAttribute("value",QString("%1").arg(value));
  13431. }
  13432. void ThresholdAnnotationConfWidget::updateDirection(int direction)
  13433. {
  13434. updateAttribute("direction",QString("%1").arg(direction));
  13435. }
  13436. void ThresholdAnnotationConfWidget::updateAnnotation(const QString&annotation)
  13437. {
  13438. updateAttribute("annotation",annotation);
  13439. }
  13440. /*:1134*/
  13441. #line 616 "./typica.w"
  13442. /*1138:*/
  13443. #line 152 "./thresholdannotation.w"
  13444. Annotator::Annotator(const QString&text):QObject(NULL),note(text)
  13445. {
  13446. t.setInterval(0);
  13447. t.setSingleShot(true);
  13448. connect(&t,SIGNAL(timeout()),this,SLOT(catchTimer()));
  13449. }
  13450. void Annotator::setAnnotation(const QString&annotation)
  13451. {
  13452. note= annotation;
  13453. }
  13454. void Annotator::setTemperatureColumn(int tempcolumn)
  13455. {
  13456. tc= tempcolumn;
  13457. }
  13458. void Annotator::setAnnotationColumn(int annotationcolumn)
  13459. {
  13460. ac= annotationcolumn;
  13461. }
  13462. /*:1138*//*1139:*/
  13463. #line 181 "./thresholdannotation.w"
  13464. void Annotator::catchTimer()
  13465. {
  13466. emit annotation(note,tc,ac);
  13467. }
  13468. void Annotator::annotate()
  13469. {
  13470. t.start();
  13471. }
  13472. /*:1139*/
  13473. #line 617 "./typica.w"
  13474. /*:4*//*260:*/
  13475. #line 6181 "./typica.w"
  13476. /*257:*/
  13477. #line 6144 "./typica.w"
  13478. void ScriptValidator::fixup(QString&input)const
  13479. {
  13480. QScriptEngine*engine= AppInstance->engine;
  13481. engine->pushContext();
  13482. input= engine->evaluate(input).toString();
  13483. engine->popContext();
  13484. }
  13485. /*:257*//*258:*/
  13486. #line 6157 "./typica.w"
  13487. QValidator::State ScriptValidator::validate(QString&input,int&pos)const
  13488. {
  13489. if(v)
  13490. {
  13491. if(v->validate(input,pos)==QValidator::Acceptable)
  13492. {
  13493. return QValidator::Acceptable;
  13494. }
  13495. }
  13496. return QValidator::Intermediate;
  13497. }
  13498. /*:258*//*259:*/
  13499. #line 6172 "./typica.w"
  13500. ScriptValidator::ScriptValidator(QValidator*validator,QObject*parent)
  13501. :QValidator(parent),v(validator)
  13502. {
  13503. }
  13504. /*:259*/
  13505. #line 6182 "./typica.w"
  13506. /*:260*//*694:*/
  13507. #line 160 "./plugins.w"
  13508. /*691:*/
  13509. #line 92 "./plugins.w"
  13510. PluginAction::PluginAction(const QFileInfo&info,QObject*parent):
  13511. QAction(parent),preRunScript(""),postRunScript("")
  13512. {
  13513. pluginFile= info.absoluteFilePath();
  13514. setText(info.baseName());
  13515. connect(this,SIGNAL(triggered()),this,SLOT(runScript()));
  13516. }
  13517. void PluginAction::runScript()
  13518. {
  13519. QFile file(pluginFile);
  13520. if(file.open(QIODevice::ReadOnly))
  13521. {
  13522. QScriptEngine*engine= AppInstance->engine;
  13523. QScriptContext*context= engine->pushContext();
  13524. if(parent()->dynamicPropertyNames().contains("activationObject"))
  13525. {
  13526. QScriptValue activationObject=
  13527. parent()->property("activationObject").value<QScriptValue> ();
  13528. context->setActivationObject(activationObject);
  13529. }
  13530. QString script(file.readAll());
  13531. QScriptValue retval= engine->evaluate(preRunScript+script+postRunScript,pluginFile);
  13532. if(engine->hasUncaughtException())
  13533. {
  13534. qDebug()<<"Uncaught exception: "<<
  13535. engine->uncaughtException().toString()<<
  13536. " in "<<pluginFile<<" line: "<<
  13537. engine->uncaughtExceptionLineNumber();
  13538. }
  13539. engine->popContext();
  13540. file.close();
  13541. }
  13542. }
  13543. /*:691*//*692:*/
  13544. #line 131 "./plugins.w"
  13545. QString PluginAction::preRun()
  13546. {
  13547. return preRunScript;
  13548. }
  13549. QString PluginAction::postRun()
  13550. {
  13551. return postRunScript;
  13552. }
  13553. void PluginAction::setPreRun(const QString&script)
  13554. {
  13555. preRunScript= script;
  13556. }
  13557. void PluginAction::setPostRun(const QString&script)
  13558. {
  13559. postRunScript= script;
  13560. }
  13561. /*:692*/
  13562. #line 161 "./plugins.w"
  13563. #line 14629 "./typica.w"
  13564. #line 1 "./daterangeselector.w"
  13565. /*:694*//*875:*/
  13566. #line 89 "./colorsettings.w"
  13567. /*873:*/
  13568. #line 40 "./colorsettings.w"
  13569. ColorSettingsWidget::ColorSettingsWidget():QWidget(NULL)
  13570. {
  13571. QFormLayout*layout= new QFormLayout;
  13572. QCheckBox*enable= new QCheckBox(tr("Enable Javalytics communication"));
  13573. QSettings settings;
  13574. enable->setChecked(settings.value("settings/color/javalytics/enable",false).toBool());
  13575. QLineEdit*address= new QLineEdit();
  13576. address->setText(settings.value("settings/color/javalytics/address","192.168.1.10").toString());
  13577. QSpinBox*scale= new QSpinBox();
  13578. scale->setMinimum(1);
  13579. scale->setMaximum(4);
  13580. scale->setValue(settings.value("settings/color/javalytics/scale",1).toInt());
  13581. connect(enable,SIGNAL(toggled(bool)),this,SLOT(updateEnable(bool)));
  13582. connect(address,SIGNAL(textChanged(QString)),this,SLOT(updateAddress(QString)));
  13583. connect(scale,SIGNAL(valueChanged(int)),this,SLOT(updateScale(int)));
  13584. layout->addRow(enable);
  13585. layout->addRow(tr("IP Address:"),address);
  13586. layout->addRow(tr("Scale Number:"),scale);
  13587. updateEnable(enable->isChecked());
  13588. updateAddress(address->text());
  13589. updateScale(scale->value());
  13590. setLayout(layout);
  13591. }
  13592. /*:873*//*874:*/
  13593. #line 68 "./colorsettings.w"
  13594. void ColorSettingsWidget::updateEnable(bool enable)
  13595. {
  13596. QSettings settings;
  13597. settings.setValue("settings/color/javalytics/enable",enable);
  13598. }
  13599. void ColorSettingsWidget::updateAddress(const QString&address)
  13600. {
  13601. QSettings settings;
  13602. settings.setValue("settings/color/javalytics/address",address);
  13603. }
  13604. void ColorSettingsWidget::updateScale(int scale)
  13605. {
  13606. QSettings settings;
  13607. settings.setValue("settings/color/javalytics/scale",scale);
  13608. }
  13609. /*:874*/
  13610. #line 90 "./colorsettings.w"
  13611. #line 66 "./settings.w"
  13612. #line 1 "./advancedsettings.w"
  13613. /*:875*//*879:*/
  13614. #line 60 "./advancedsettings.w"
  13615. /*877:*/
  13616. #line 26 "./advancedsettings.w"
  13617. AdvancedSettingsWidget::AdvancedSettingsWidget():QWidget(NULL)
  13618. {
  13619. QSettings settings;
  13620. QFormLayout*layout= new QFormLayout;
  13621. QCheckBox*logDiagnostics= new QCheckBox;
  13622. logDiagnostics->setCheckState(
  13623. settings.value("settings/advanced/logging",false).toBool()?
  13624. Qt::Checked:Qt::Unchecked);
  13625. connect(logDiagnostics,SIGNAL(toggled(bool)),this,SLOT(enableDiagnosticLogging(bool)));
  13626. layout->addRow(tr("Enable diagnostic logging"),logDiagnostics);
  13627. setLayout(layout);
  13628. }
  13629. /*:877*//*878:*/
  13630. #line 43 "./advancedsettings.w"
  13631. void AdvancedSettingsWidget::enableDiagnosticLogging(bool enabled)
  13632. {
  13633. QSettings settings;
  13634. settings.setValue("settings/advanced/logging",enabled);
  13635. if(enabled)
  13636. {
  13637. qInstallMsgHandler(messageFileOutput);
  13638. }
  13639. else
  13640. {
  13641. qInstallMsgHandler(0);
  13642. }
  13643. }
  13644. /*:878*/
  13645. #line 61 "./advancedsettings.w"
  13646. #line 18432 "./typica.w"
  13647. /*:879*//*938:*/
  13648. #line 639 "./unsupportedserial.w"
  13649. /*913:*/
  13650. #line 58 "./unsupportedserial.w"
  13651. UnsupportedSerialDeviceConfWidget::UnsupportedSerialDeviceConfWidget(DeviceTreeModel*model,
  13652. const QModelIndex&index)
  13653. :BasicDeviceConfigurationWidget(model,index),
  13654. deviceSettingsModel(new SaltModel(2)),
  13655. scriptEditor(new QTextEdit)
  13656. {
  13657. scriptEditor->setTabStopWidth(20);
  13658. QVBoxLayout*dummyLayout= new QVBoxLayout;
  13659. QTabWidget*central= new QTabWidget;
  13660. QWidget*deviceConfigurationWidget= new QWidget;
  13661. QVBoxLayout*deviceConfigurationLayout= new QVBoxLayout;
  13662. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  13663. deviceConfigurationLayout->addWidget(addChannelButton);
  13664. connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
  13665. QLabel*deviceSettingsLabel= new QLabel(tr("Device Settings:"));
  13666. deviceConfigurationLayout->addWidget(deviceSettingsLabel);
  13667. QTableView*deviceSettingsView= new QTableView;
  13668. deviceSettingsModel->setHeaderData(0,Qt::Horizontal,tr("Key"));
  13669. deviceSettingsModel->setHeaderData(1,Qt::Horizontal,tr("Value"));
  13670. deviceSettingsView->setModel(deviceSettingsModel);
  13671. deviceConfigurationLayout->addWidget(deviceSettingsView);
  13672. deviceConfigurationWidget->setLayout(deviceConfigurationLayout);
  13673. central->addTab(deviceConfigurationWidget,tr("Configuration"));
  13674. central->addTab(scriptEditor,tr("Script"));
  13675. dummyLayout->addWidget(central);
  13676. /*801:*/
  13677. #line 16668 "./typica.w"
  13678. QDomElement referenceElement=
  13679. model->referenceElement(model->data(index,Qt::UserRole).toString());
  13680. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  13681. QDomElement node;
  13682. /*:801*/
  13683. #line 86 "./unsupportedserial.w"
  13684. for(int i= 0;i<configData.size();i++)
  13685. {
  13686. node= configData.at(i).toElement();
  13687. if(node.attribute("name")=="keys"||node.attribute("name")=="values")
  13688. {
  13689. int column= 0;
  13690. if(node.attribute("name")=="values")
  13691. {
  13692. column= 1;
  13693. }
  13694. QString data= node.attribute("value");
  13695. if(data.length()> 3)
  13696. {
  13697. data.chop(2);
  13698. data= data.remove(0,2);
  13699. }
  13700. QStringList keyList= data.split(", ");
  13701. for(int j= 0;j<keyList.size();j++)
  13702. {
  13703. deviceSettingsModel->setData(deviceSettingsModel->index(j,column),
  13704. QVariant(keyList.at(j)),
  13705. Qt::EditRole);
  13706. }
  13707. }
  13708. else if(node.attribute("name")=="script")
  13709. {
  13710. scriptEditor->setPlainText(node.attribute("value"));
  13711. }
  13712. }
  13713. connect(deviceSettingsModel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),
  13714. this,SLOT(updateConfiguration()));
  13715. connect(scriptEditor,SIGNAL(textChanged()),this,SLOT(saveScript()));
  13716. setLayout(dummyLayout);
  13717. }
  13718. /*:913*//*914:*/
  13719. #line 131 "./unsupportedserial.w"
  13720. void UnsupportedSerialDeviceConfWidget::updateConfiguration()
  13721. {
  13722. updateAttribute("keys",deviceSettingsModel->arrayLiteral(0,Qt::DisplayRole));
  13723. updateAttribute("values",deviceSettingsModel->arrayLiteral(1,Qt::DisplayRole));
  13724. }
  13725. /*:914*//*915:*/
  13726. #line 144 "./unsupportedserial.w"
  13727. void UnsupportedSerialDeviceConfWidget::saveScript()
  13728. {
  13729. updateAttribute("script",scriptEditor->toPlainText());
  13730. }
  13731. /*:915*//*916:*/
  13732. #line 155 "./unsupportedserial.w"
  13733. void UnsupportedSerialDeviceConfWidget::addChannel()
  13734. {
  13735. insertChildNode(tr("Channel"),"unsupporteddevicechannel");
  13736. }
  13737. /*:916*//*918:*/
  13738. #line 183 "./unsupportedserial.w"
  13739. UnsupportedDeviceChannelConfWidget::UnsupportedDeviceChannelConfWidget(DeviceTreeModel*model,
  13740. const QModelIndex&index)
  13741. :BasicDeviceConfigurationWidget(model,index),
  13742. channelSettingsModel(new SaltModel(2))
  13743. {
  13744. QFormLayout*layout= new QFormLayout;
  13745. QLineEdit*columnName= new QLineEdit;
  13746. layout->addRow(tr("Column Name:"),columnName);
  13747. QCheckBox*hideSeries= new QCheckBox("Hide this channel");
  13748. layout->addRow(hideSeries);
  13749. QTableView*channelSettings= new QTableView;
  13750. channelSettingsModel->setHeaderData(0,Qt::Horizontal,"Key");
  13751. channelSettingsModel->setHeaderData(1,Qt::Horizontal,"Value");
  13752. channelSettings->setModel(channelSettingsModel);
  13753. layout->addRow(channelSettings);
  13754. setLayout(layout);
  13755. /*801:*/
  13756. #line 16668 "./typica.w"
  13757. QDomElement referenceElement=
  13758. model->referenceElement(model->data(index,Qt::UserRole).toString());
  13759. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  13760. QDomElement node;
  13761. /*:801*/
  13762. #line 200 "./unsupportedserial.w"
  13763. for(int i= 0;i<configData.size();i++)
  13764. {
  13765. node= configData.at(i).toElement();
  13766. if(node.attribute("name")=="columnname")
  13767. {
  13768. columnName->setText(node.attribute("value"));
  13769. }
  13770. else if(node.attribute("name")=="hidden")
  13771. {
  13772. hideSeries->setChecked(node.attribute("value")=="true");
  13773. }
  13774. else if(node.attribute("name")=="keys"||node.attribute("name")=="values")
  13775. {
  13776. int column= 0;
  13777. if(node.attribute("name")=="values")
  13778. {
  13779. column= 1;
  13780. }
  13781. QString data= node.attribute("value");
  13782. if(data.length()> 3)
  13783. {
  13784. data.chop(2);
  13785. data= data.remove(0,2);
  13786. }
  13787. QStringList keyList= data.split(", ");
  13788. for(int j= 0;j<keyList.size();j++)
  13789. {
  13790. channelSettingsModel->setData(channelSettingsModel->index(j,column),
  13791. QVariant(keyList.at(j)),
  13792. Qt::EditRole);
  13793. }
  13794. }
  13795. }
  13796. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  13797. connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  13798. connect(channelSettingsModel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),
  13799. this,SLOT(updateConfiguration()));
  13800. }
  13801. /*:918*//*919:*/
  13802. #line 244 "./unsupportedserial.w"
  13803. void UnsupportedDeviceChannelConfWidget::updateColumnName(const QString&value)
  13804. {
  13805. updateAttribute("columnname",value);
  13806. }
  13807. void UnsupportedDeviceChannelConfWidget::updateHidden(bool hidden)
  13808. {
  13809. updateAttribute("hidden",hidden?"true":"false");
  13810. }
  13811. void UnsupportedDeviceChannelConfWidget::updateConfiguration()
  13812. {
  13813. updateAttribute("keys",channelSettingsModel->arrayLiteral(0,Qt::DisplayRole));
  13814. updateAttribute("values",channelSettingsModel->arrayLiteral(1,Qt::DisplayRole));
  13815. }
  13816. /*:919*/
  13817. #line 640 "./unsupportedserial.w"
  13818. /*926:*/
  13819. #line 371 "./unsupportedserial.w"
  13820. void JavaScriptDevice::start()
  13821. {
  13822. QScriptValue object= scriptengine->newQObject(this);
  13823. /*927:*/
  13824. #line 390 "./unsupportedserial.w"
  13825. QScriptValue settingsObject= scriptengine->newObject();
  13826. QVariantMap::const_iterator i= deviceSettings.constBegin();
  13827. while(i!=deviceSettings.constEnd())
  13828. {
  13829. settingsObject.setProperty(i.key(),i.value().toString());
  13830. i++;
  13831. }
  13832. object.setProperty("settings",settingsObject);
  13833. /*:927*/
  13834. #line 375 "./unsupportedserial.w"
  13835. /*928:*/
  13836. #line 405 "./unsupportedserial.w"
  13837. QScriptValue channelsArray= scriptengine->newArray(channelCount());
  13838. for(int i= 0;i<channelCount();i++)
  13839. {
  13840. QScriptValue channelObject= scriptengine->newQObject(getChannel(i));
  13841. QScriptValue channelSettingsObject= scriptengine->newObject();
  13842. QVariantMap::const_iterator j= channelSettings.at(i).constBegin();
  13843. while(j!=channelSettings.at(i).constEnd())
  13844. {
  13845. channelSettingsObject.setProperty(j.key(),j.value().toString());
  13846. j++;
  13847. }
  13848. channelObject.setProperty("settings",channelSettingsObject);
  13849. channelsArray.setProperty(i,channelObject);
  13850. }
  13851. object.setProperty("channels",channelsArray);
  13852. /*:928*/
  13853. #line 376 "./unsupportedserial.w"
  13854. QScriptContext*context= scriptengine->currentContext();
  13855. QScriptValue oldThis= context->thisObject();
  13856. context->setThisObject(object);
  13857. QScriptValue result= scriptengine->evaluate(deviceScript);
  13858. QScriptEngine*engine= scriptengine;
  13859. /*196:*/
  13860. #line 4573 "./typica.w"
  13861. if(engine->hasUncaughtException())
  13862. {
  13863. int line= engine->uncaughtExceptionLineNumber();
  13864. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  13865. result.toString();
  13866. QString trace;
  13867. foreach(trace,engine->uncaughtExceptionBacktrace())
  13868. {
  13869. qDebug()<<trace;
  13870. }
  13871. }
  13872. /*:196*/
  13873. #line 382 "./unsupportedserial.w"
  13874. context->setThisObject(oldThis);
  13875. }
  13876. /*:926*//*931:*/
  13877. #line 446 "./unsupportedserial.w"
  13878. void JavaScriptDevice::stop()
  13879. {
  13880. emit deviceStopRequested();
  13881. }
  13882. /*:931*//*932:*/
  13883. #line 459 "./unsupportedserial.w"
  13884. JavaScriptDevice::JavaScriptDevice(const QModelIndex&index,
  13885. QScriptEngine*engine):
  13886. QObject(NULL),scriptengine(engine)
  13887. {
  13888. DeviceTreeModel*model= (DeviceTreeModel*)(index.model());
  13889. QDomElement deviceReferenceElement=
  13890. model->referenceElement(model->data(index,Qt::UserRole).toString());
  13891. QDomNodeList deviceConfigData= deviceReferenceElement.elementsByTagName("attribute");
  13892. QDomElement node;
  13893. QStringList deviceKeys;
  13894. QStringList deviceValues;
  13895. for(int i= 0;i<deviceConfigData.size();i++)
  13896. {
  13897. node= deviceConfigData.at(i).toElement();
  13898. if(node.attribute("name")=="keys")
  13899. {
  13900. QString data= node.attribute("value");
  13901. if(data.length()> 3)
  13902. {
  13903. data.chop(2);
  13904. data= data.remove(0,2);
  13905. }
  13906. deviceKeys= data.split(", ");
  13907. }
  13908. else if(node.attribute("name")=="values")
  13909. {
  13910. QString data= node.attribute("value");
  13911. if(data.length()> 3)
  13912. {
  13913. data.chop(2);
  13914. data= data.remove(0,2);
  13915. }
  13916. deviceValues= data.split(", ");
  13917. }
  13918. else if(node.attribute("name")=="script")
  13919. {
  13920. deviceScript= node.attribute("value");
  13921. }
  13922. deviceSettings.insert(node.attribute("name"),node.attribute("value"));
  13923. }
  13924. for(int i= 0;i<qMin(deviceKeys.length(),deviceValues.length());i++)
  13925. {
  13926. deviceSettings.insert(deviceKeys[i],deviceValues[i]);
  13927. }
  13928. if(model->hasChildren(index))
  13929. {
  13930. for(int i= 0;i<model->rowCount(index);i++)
  13931. {
  13932. QModelIndex channelIndex= model->index(i,0,index);
  13933. QDomElement channelReference= model->referenceElement(model->data(channelIndex,32).toString());
  13934. channelList.append(new Channel);
  13935. QDomElement channelReferenceElement=
  13936. model->referenceElement(model->data(channelIndex,Qt::UserRole).toString());
  13937. QDomNodeList channelConfigData=
  13938. channelReferenceElement.elementsByTagName("attribute");
  13939. QStringList channelKeys;
  13940. QStringList channelValues;
  13941. for(int j= 0;j<channelConfigData.size();j++)
  13942. {
  13943. node= channelConfigData.at(j).toElement();
  13944. if(node.attribute("name")=="keys")
  13945. {
  13946. QString data= node.attribute("value");
  13947. if(data.length()> 3)
  13948. {
  13949. data.chop(2);
  13950. data= data.remove(0,2);
  13951. }
  13952. channelKeys= data.split(", ");
  13953. }
  13954. else if(node.attribute("name")=="values")
  13955. {
  13956. QString data= node.attribute("value");
  13957. if(data.length()> 3)
  13958. {
  13959. data.chop(2);
  13960. data= data.remove(0,2);
  13961. }
  13962. channelValues= data.split(", ");
  13963. }
  13964. else if(node.attribute("name")=="hidden")
  13965. {
  13966. hiddenState.append(node.attribute("value")=="true");
  13967. }
  13968. else if(node.attribute("name")=="columnname")
  13969. {
  13970. columnNames.append(node.attribute("value"));
  13971. }
  13972. }
  13973. QVariantMap cs;
  13974. for(int j= 0;j<qMin(channelKeys.length(),channelValues.length());j++)
  13975. {
  13976. cs.insert(channelKeys[j],channelValues[j]);
  13977. }
  13978. channelSettings.append(cs);
  13979. indicatorTexts.append(model->data(channelIndex,Qt::DisplayRole).toString());
  13980. channelUnits.append(Units::Fahrenheit);
  13981. }
  13982. }
  13983. }
  13984. /*:932*//*933:*/
  13985. #line 564 "./unsupportedserial.w"
  13986. int JavaScriptDevice::channelCount()
  13987. {
  13988. return channelList.length();
  13989. }
  13990. Channel*JavaScriptDevice::getChannel(int channel)
  13991. {
  13992. return channelList.at(channel);
  13993. }
  13994. bool JavaScriptDevice::isChannelHidden(int channel)
  13995. {
  13996. return hiddenState.at(channel);
  13997. }
  13998. Units::Unit JavaScriptDevice::expectedChannelUnit(int channel)
  13999. {
  14000. return channelUnits.at(channel);
  14001. }
  14002. QString JavaScriptDevice::channelColumnName(int channel)
  14003. {
  14004. if(channel>=0&&channel<columnNames.length())
  14005. {
  14006. return columnNames.at(channel);
  14007. }
  14008. return QString();
  14009. }
  14010. QString JavaScriptDevice::channelIndicatorText(int channel)
  14011. {
  14012. return indicatorTexts.at(channel);
  14013. }
  14014. /*:933*//*934:*/
  14015. #line 601 "./unsupportedserial.w"
  14016. void JavaScriptDevice::setTemperatureColumn(int tcol)
  14017. {
  14018. annotationTemperatureColumn= tcol;
  14019. }
  14020. void JavaScriptDevice::setAnnotationColumn(int ncol)
  14021. {
  14022. annotationNoteColumn= ncol;
  14023. }
  14024. /*:934*/
  14025. #line 641 "./unsupportedserial.w"
  14026. /*:938*//*961:*/
  14027. #line 444 "./phidgets.w"
  14028. /*945:*/
  14029. #line 31 "./phidgets.w"
  14030. PhidgetsTemperatureSensorConfWidget::PhidgetsTemperatureSensorConfWidget(DeviceTreeModel*model,
  14031. const QModelIndex&index)
  14032. :BasicDeviceConfigurationWidget(model,index)
  14033. {
  14034. QFormLayout*layout= new QFormLayout;
  14035. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  14036. QSpinBox*sampleRate= new QSpinBox;
  14037. sampleRate->setMinimum(40);
  14038. sampleRate->setMaximum(600);
  14039. sampleRate->setSingleStep(40);
  14040. sampleRate->setValue(360);
  14041. /*801:*/
  14042. #line 16668 "./typica.w"
  14043. QDomElement referenceElement=
  14044. model->referenceElement(model->data(index,Qt::UserRole).toString());
  14045. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  14046. QDomElement node;
  14047. /*:801*/
  14048. #line 44 "./phidgets.w"
  14049. for(int i= 0;i<configData.size();i++)
  14050. {
  14051. node= configData.at(i).toElement();
  14052. if(node.attribute("name")=="sampleRate")
  14053. {
  14054. sampleRate->setValue(node.attribute("value").toInt());
  14055. }
  14056. }
  14057. updateRate(sampleRate->value());
  14058. connect(sampleRate,SIGNAL(valueChanged(int)),this,SLOT(updateRate(int)));
  14059. connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
  14060. layout->addRow(addChannelButton);
  14061. layout->addRow(tr("Sample rate:"),sampleRate);
  14062. setLayout(layout);
  14063. }
  14064. /*:945*//*946:*/
  14065. #line 66 "./phidgets.w"
  14066. void PhidgetsTemperatureSensorConfWidget::addChannel()
  14067. {
  14068. insertChildNode(tr("Channel"),"phidgets1048channel");
  14069. }
  14070. /*:946*//*947:*/
  14071. #line 74 "./phidgets.w"
  14072. void PhidgetsTemperatureSensorConfWidget::updateRate(int ms)
  14073. {
  14074. updateAttribute("sampleRate",QString("%1").arg(ms));
  14075. }
  14076. /*:947*//*949:*/
  14077. #line 103 "./phidgets.w"
  14078. PhidgetTemperatureSensorChannelConfWidget::PhidgetTemperatureSensorChannelConfWidget(
  14079. DeviceTreeModel*model,const QModelIndex&index)
  14080. :BasicDeviceConfigurationWidget(model,index),
  14081. tcType(new QComboBox)
  14082. {
  14083. QFormLayout*layout= new QFormLayout;
  14084. QLineEdit*columnName= new QLineEdit;
  14085. layout->addRow(tr("Column Name:"),columnName);
  14086. QCheckBox*hideSeries= new QCheckBox("Hide this channel");
  14087. layout->addRow(hideSeries);
  14088. layout->addRow(tr("Thermocouple Type:"),tcType);
  14089. tcType->addItem("Type K","1");
  14090. tcType->addItem("Type J","2");
  14091. tcType->addItem("Type E","3");
  14092. tcType->addItem("Type T","4");
  14093. QSpinBox*channel= new QSpinBox;
  14094. layout->addRow(tr("Channel:"),channel);
  14095. channel->setMinimum(0);
  14096. channel->setMaximum(3);
  14097. setLayout(layout);
  14098. /*801:*/
  14099. #line 16668 "./typica.w"
  14100. QDomElement referenceElement=
  14101. model->referenceElement(model->data(index,Qt::UserRole).toString());
  14102. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  14103. QDomElement node;
  14104. /*:801*/
  14105. #line 124 "./phidgets.w"
  14106. for(int i= 0;i<configData.size();i++)
  14107. {
  14108. node= configData.at(i).toElement();
  14109. if(node.attribute("name")=="columnname")
  14110. {
  14111. columnName->setText(node.attribute("value"));
  14112. }
  14113. else if(node.attribute("name")=="hidden")
  14114. {
  14115. hideSeries->setChecked(node.attribute("value")=="true");
  14116. }
  14117. else if(node.attribute("name")=="tctype")
  14118. {
  14119. tcType->setCurrentIndex(tcType->findData(node.attribute("value")));
  14120. }
  14121. else if(node.attribute("name")=="channel")
  14122. {
  14123. channel->setValue(node.attribute("value").toInt());
  14124. }
  14125. }
  14126. updateColumnName(columnName->text());
  14127. updateHidden(hideSeries->isChecked());
  14128. updateTC(tcType->currentIndex());
  14129. updateChannel(channel->value());
  14130. connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  14131. connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
  14132. connect(tcType,SIGNAL(currentIndexChanged(int)),this,SLOT(updateTC(int)));
  14133. connect(channel,SIGNAL(valueChanged(int)),this,SLOT(updateChannel(int)));
  14134. }
  14135. /*:949*//*950:*/
  14136. #line 157 "./phidgets.w"
  14137. void PhidgetTemperatureSensorChannelConfWidget::updateColumnName(const QString&value)
  14138. {
  14139. updateAttribute("columnname",value);
  14140. }
  14141. void PhidgetTemperatureSensorChannelConfWidget::updateHidden(bool hidden)
  14142. {
  14143. updateAttribute("hidden",hidden?"true":"false");
  14144. }
  14145. void PhidgetTemperatureSensorChannelConfWidget::updateTC(int index)
  14146. {
  14147. updateAttribute("tctype",tcType->itemData(index).toString());
  14148. }
  14149. void PhidgetTemperatureSensorChannelConfWidget::updateChannel(int channel)
  14150. {
  14151. updateAttribute("channel",QString("%1").arg(channel));
  14152. }
  14153. /*:950*//*954:*/
  14154. #line 246 "./phidgets.w"
  14155. PhidgetsTemperatureSensor::PhidgetsTemperatureSensor(const QModelIndex&index)
  14156. :QObject(NULL),driver("phidget21"),device(NULL)
  14157. {
  14158. DeviceTreeModel*model= (DeviceTreeModel*)(index.model());
  14159. QDomElement deviceReferenceElement=
  14160. model->referenceElement(model->data(index,Qt::UserRole).toString());
  14161. QDomNodeList deviceConfigData= deviceReferenceElement.elementsByTagName("attribute");
  14162. QDomElement node;
  14163. for(int i= 0;i<deviceConfigData.size();i++)
  14164. {
  14165. node= deviceConfigData.at(i).toElement();
  14166. if(node.attribute("name")=="sampleRate")
  14167. {
  14168. sampleTimer.setInterval(node.attribute("value").toInt());
  14169. }
  14170. }
  14171. if(model->hasChildren(index))
  14172. {
  14173. for(int i= 0;i<model->rowCount(index);i++)
  14174. {
  14175. QModelIndex channelIndex= model->index(i,0,index);
  14176. QDomElement channelReference= model->referenceElement(model->data(channelIndex,32).toString());
  14177. QDomElement channelReferenceElement= model->referenceElement(model->data(channelIndex,Qt::UserRole).toString());
  14178. QDomNodeList channelConfigData= channelReferenceElement.elementsByTagName("attribute");
  14179. for(int j= 0;j<channelConfigData.size();j++)
  14180. {
  14181. node= channelConfigData.at(j).toElement();
  14182. if(node.attribute("name")=="channel")
  14183. {
  14184. int channelID= node.attribute("value").toInt();
  14185. channelIndices.append(channelID);
  14186. Channel*channel= new Channel;
  14187. channelList.append(channel);
  14188. channelMap.insert(channelID,channel);
  14189. }
  14190. else if(node.attribute("name")=="hidden")
  14191. {
  14192. hiddenState.append(node.attribute("value")=="true");
  14193. }
  14194. else if(node.attribute("name")=="columnname")
  14195. {
  14196. columnNames.append(node.attribute("value"));
  14197. }
  14198. else if(node.attribute("name")=="tctype")
  14199. {
  14200. tctypes.append(node.attribute("value").toInt());
  14201. }
  14202. }
  14203. indicatorTexts.append(model->data(channelIndex,Qt::DisplayRole).toString());
  14204. }
  14205. }
  14206. }
  14207. /*:954*//*955:*/
  14208. #line 306 "./phidgets.w"
  14209. int PhidgetsTemperatureSensor::channelCount()
  14210. {
  14211. return channelList.length();
  14212. }
  14213. Channel*PhidgetsTemperatureSensor::getChannel(int channel)
  14214. {
  14215. return channelList.at(channel);
  14216. }
  14217. /*:955*//*956:*/
  14218. #line 319 "./phidgets.w"
  14219. bool PhidgetsTemperatureSensor::isChannelHidden(int channel)
  14220. {
  14221. return hiddenState.at(channel);
  14222. }
  14223. QString PhidgetsTemperatureSensor::channelColumnName(int channel)
  14224. {
  14225. if(channel>=0&&channel<columnNames.length())
  14226. {
  14227. return columnNames.at(channel);
  14228. }
  14229. return QString();
  14230. }
  14231. QString PhidgetsTemperatureSensor::channelIndicatorText(int channel)
  14232. {
  14233. if(channel>=0&&channel<indicatorTexts.length())
  14234. {
  14235. return indicatorTexts.at(channel);
  14236. }
  14237. return QString();
  14238. }
  14239. /*:956*//*958:*/
  14240. #line 371 "./phidgets.w"
  14241. void PhidgetsTemperatureSensor::start()
  14242. {
  14243. if(!driver.load())
  14244. {
  14245. driver.setFileName("Phidget21.framework/Phidget21");
  14246. if(!driver.load())
  14247. {
  14248. QMessageBox::critical(NULL,tr("Typica: Driver not found"),
  14249. tr("Failed to find phidget21. Please install it."));
  14250. return;
  14251. }
  14252. }
  14253. if((createDevice= (PhidgetHandleOnly)driver.resolve("CPhidgetTemperatureSensor_create"))==0||
  14254. (openDevice= (PhidgetHandleInt)driver.resolve("CPhidget_open"))==0||
  14255. (waitForOpen= (PhidgetHandleInt)driver.resolve("CPhidget_waitForAttachment"))==0||
  14256. (setTCType= (PhidgetHandleIntInt)driver.resolve("CPhidgetTemperatureSensor_setThermocoupleType"))==0||
  14257. (getTemperature= (PhidgetHandleIntDoubleOut)driver.resolve("CPhidgetTemperatureSensor_getTemperature"))==0||
  14258. (closeDevice= (PhidgetHandleOnly)driver.resolve("CPhidget_close"))==0||
  14259. (deleteDevice= (PhidgetHandleOnly)driver.resolve("CPhidget_delete"))==0)
  14260. {
  14261. QMessageBox::critical(NULL,tr("Typica: Link error"),
  14262. tr("Failed to link a required symbol in phidget21."));
  14263. return;
  14264. }
  14265. createDevice(&device);
  14266. openDevice(device,-1);
  14267. int error;
  14268. if((error= waitForOpen(device,10000)))
  14269. {
  14270. closeDevice(device);
  14271. deleteDevice(device);
  14272. QMessageBox::critical(NULL,tr("Typica: Failed to Open Device"),
  14273. tr("CPhidget_waitForAttachment returns error %n",0,error));
  14274. return;
  14275. }
  14276. for(int i= 0;i<channelIndices.length();i++)
  14277. {
  14278. setTCType(device,channelIndices.at(i),tctypes.at(i));
  14279. }
  14280. connect(&sampleTimer,SIGNAL(timeout()),this,SLOT(getMeasurements()));
  14281. sampleTimer.start();
  14282. }
  14283. /*:958*//*959:*/
  14284. #line 418 "./phidgets.w"
  14285. void PhidgetsTemperatureSensor::getMeasurements()
  14286. {
  14287. double value= 0.0;
  14288. QTime time= QTime::currentTime();
  14289. foreach(int i,channelIndices)
  14290. {
  14291. getTemperature(device,i,&value);
  14292. Measurement measure(value*9.0/5.0+32.0,time);
  14293. channelMap[i]->input(measure);
  14294. }
  14295. }
  14296. /*:959*//*960:*/
  14297. #line 433 "./phidgets.w"
  14298. void PhidgetsTemperatureSensor::stop()
  14299. {
  14300. sampleTimer.stop();
  14301. closeDevice(device);
  14302. deleteDevice(device);
  14303. driver.unload();
  14304. }
  14305. /*:960*/
  14306. #line 445 "./phidgets.w"
  14307. /*:961*//*993:*/
  14308. #line 792 "./phidget22.w"
  14309. /*969:*/
  14310. #line 60 "./phidget22.w"
  14311. PhidgetConfWidget::PhidgetConfWidget(DeviceTreeModel*model,
  14312. const QModelIndex&index)
  14313. :BasicDeviceConfigurationWidget(model,index)
  14314. {
  14315. QHBoxLayout*layout= new QHBoxLayout;
  14316. QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
  14317. connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
  14318. layout->addWidget(addChannelButton);
  14319. setLayout(layout);
  14320. }
  14321. void PhidgetConfWidget::addChannel()
  14322. {
  14323. insertChildNode(tr("Channel"),"phidgetchannel");
  14324. }
  14325. /*:969*//*974:*/
  14326. #line 179 "./phidget22.w"
  14327. PhidgetChannelSelector::PhidgetChannelSelector():QComboBox(),manager(NULL)
  14328. {
  14329. #if __APPLE__
  14330. driver.setFileName("Phidget22.framework/Phidget22");
  14331. #else
  14332. driver.setFileName("phidget22");
  14333. #endif
  14334. if(!driver.load())
  14335. {
  14336. QMessageBox::critical(NULL,tr("Typica: Driver not found"),
  14337. tr("Failed to find phidget22. Please install it."));
  14338. return;
  14339. }
  14340. /*973:*/
  14341. #line 157 "./phidget22.w"
  14342. if((createManager= (PhidgetPointer)driver.resolve("PhidgetManager_create"))==0||
  14343. (setOnAttachManager= (PhidgetPointerCallbackPointer)driver.resolve("PhidgetManager_setOnAttachHandler"))==0||
  14344. (setOnDetachManager= (PhidgetPointerCallbackPointer)driver.resolve("PhidgetManager_setOnDetachHandler"))==0||
  14345. (openManager= (PhidgetPointer)driver.resolve("PhidgetManager_open"))==0||
  14346. (getDeviceName= (PhidgetPointerStringOut)driver.resolve("Phidget_getDeviceName"))==0||
  14347. (getDeviceSerialNumber= (PhidgetPointerIntOut)driver.resolve("Phidget_getDeviceSerialNumber"))==0||
  14348. (getChannel= (PhidgetPointerIntOut)driver.resolve("Phidget_getChannel"))==0||
  14349. (getChannelClass= (PhidgetPointerIntOut)driver.resolve("Phidget_getChannelClass"))==0||
  14350. (getChannelSubclass= (PhidgetPointerIntOut)driver.resolve("Phidget_getChannelSubclass"))==0||
  14351. (getHubPort= (PhidgetPointerIntOut)driver.resolve("Phidget_getHubPort"))==0||
  14352. (closeManager= (PhidgetPointer)driver.resolve("PhidgetManager_close"))==0||
  14353. (deleteManager= (PhidgetPointer)driver.resolve("PhidgetManager_delete"))==0)
  14354. {
  14355. QMessageBox::critical(NULL,tr("Typica: Link error"),
  14356. tr("Failed to link a required symbol in phidget22."));
  14357. return;
  14358. }
  14359. /*:973*/
  14360. #line 193 "./phidget22.w"
  14361. createManager(&manager);
  14362. setOnAttachManager(manager,ChannelListAddChannel,this);
  14363. setOnDetachManager(manager,ChannelListRemoveChannel,this);
  14364. openManager(manager);
  14365. }
  14366. /*:974*//*977:*/
  14367. #line 228 "./phidget22.w"
  14368. void PhidgetChannelSelector::addChannel(void*device)
  14369. {
  14370. char*deviceName;
  14371. int deviceSerialNumber;
  14372. int channel;
  14373. int channelClass;
  14374. int channelSubclass;
  14375. int hubPort;
  14376. getDeviceName(device,&deviceName);
  14377. getDeviceSerialNumber(device,&deviceSerialNumber);
  14378. getChannel(device,&channel);
  14379. getChannelClass(device,&channelClass);
  14380. getChannelSubclass(device,&channelSubclass);
  14381. getHubPort(device,&hubPort);
  14382. QMap<QString,QVariant> itemData;
  14383. if(channelClass==28)
  14384. {
  14385. itemData.insert("serialNumber",QString("%1").arg(deviceSerialNumber));
  14386. itemData.insert("channel",QString("%1").arg(channel));
  14387. itemData.insert("class",QString("%1").arg(channelClass));
  14388. itemData.insert("subclass",QString("%1").arg(channelSubclass));
  14389. itemData.insert("hubport",QString("%1").arg(hubPort));
  14390. addItem(QString("%1: %2").arg(deviceName).arg(channel),QVariant(itemData));
  14391. }
  14392. }
  14393. /*:977*//*978:*/
  14394. #line 266 "./phidget22.w"
  14395. void PhidgetChannelSelector::removeChannel(void*device)
  14396. {
  14397. int deviceSerialNumber;
  14398. getDeviceSerialNumber(device,&deviceSerialNumber);
  14399. for(int i= count()-1;i>=0;i--)
  14400. {
  14401. QMap<QString,QVariant> data= itemData(i).toMap();
  14402. if(data.value("serialNumber").toInt()==deviceSerialNumber)
  14403. {
  14404. removeItem(i);
  14405. }
  14406. }
  14407. }
  14408. /*:978*//*979:*/
  14409. #line 285 "./phidget22.w"
  14410. PhidgetChannelSelector::~PhidgetChannelSelector()
  14411. {
  14412. if(manager!=NULL)
  14413. {
  14414. closeManager(manager);
  14415. deleteManager(&manager);
  14416. }
  14417. }
  14418. /*:979*//*981:*/
  14419. #line 330 "./phidget22.w"
  14420. PhidgetChannelConfWidget::PhidgetChannelConfWidget(DeviceTreeModel*model,
  14421. const QModelIndex&index)
  14422. :BasicDeviceConfigurationWidget(model,index),
  14423. channelSelector(new PhidgetChannelSelector),
  14424. serialNumber(new QLineEdit),
  14425. channel(new QLineEdit),
  14426. hubPort(new QLineEdit),
  14427. subtype(new QComboBox),
  14428. subtypeLayout(new QStackedLayout),
  14429. tctype(new QComboBox),
  14430. rtdtype(new QComboBox),
  14431. rtdwiring(new QComboBox)
  14432. {
  14433. QVBoxLayout*outerLayout= new QVBoxLayout;
  14434. QFormLayout*layout= new QFormLayout;
  14435. QLineEdit*columnName= new QLineEdit;
  14436. subtype->addItem(tr("IC"),QVariant(1));
  14437. subtype->addItem(tr("RTD"),QVariant(32));
  14438. subtype->addItem(tr("Thermocouple"),QVariant(33));
  14439. layout->addRow(tr("Channels:"),channelSelector);
  14440. layout->addRow(tr("Column Name:"),columnName);
  14441. QCheckBox*hidden= new QCheckBox(tr("Hide channel"));
  14442. layout->addRow(hidden);
  14443. layout->addRow(tr("Serial Number:"),serialNumber);
  14444. layout->addRow(tr("Hub Port:"),hubPort);
  14445. layout->addRow(tr("Channel Number:"),channel);
  14446. layout->addRow(tr("Channel Type:"),subtype);
  14447. serialNumber->setEnabled(false);
  14448. channel->setEnabled(false);
  14449. subtype->setEnabled(false);
  14450. outerLayout->addLayout(layout);
  14451. QWidget*icconfiguration= new QWidget;
  14452. QWidget*rtdconfiguration= new QWidget;
  14453. QFormLayout*rtdconfigurationLayout= new QFormLayout;
  14454. rtdtype->addItem(tr("PT100 with .00385 curve"),QVariant(1));
  14455. rtdtype->addItem(tr("PT1000 with .00385 curve"),QVariant(2));
  14456. rtdtype->addItem(tr("PT100 with .00392 curve"),QVariant(3));
  14457. rtdtype->addItem(tr("PT1000 with .00392 curve"),QVariant(4));
  14458. rtdconfigurationLayout->addRow(tr("RTD type:"),rtdtype);
  14459. rtdwiring->addItem(tr("2 wire"),QVariant(1));
  14460. rtdwiring->addItem(tr("3 wire"),QVariant(2));
  14461. rtdwiring->addItem(tr("4 wire"),QVariant(3));
  14462. rtdconfigurationLayout->addRow(tr("RTD wiring:"),rtdwiring);
  14463. rtdconfiguration->setLayout(rtdconfigurationLayout);
  14464. QWidget*tcconfiguration= new QWidget;
  14465. QFormLayout*tcconfigurationLayout= new QFormLayout;
  14466. tctype->addItem(tr("Type J"),QVariant(1));
  14467. tctype->addItem(tr("Type K"),QVariant(2));
  14468. tctype->addItem(tr("Type E"),QVariant(3));
  14469. tctype->addItem(tr("Type T"),QVariant(4));
  14470. tcconfigurationLayout->addRow(tr("Thermocouple type:"),tctype);
  14471. tcconfiguration->setLayout(tcconfigurationLayout);
  14472. subtypeLayout->addWidget(icconfiguration);
  14473. subtypeLayout->addWidget(rtdconfiguration);
  14474. subtypeLayout->addWidget(tcconfiguration);
  14475. /*801:*/
  14476. #line 16668 "./typica.w"
  14477. QDomElement referenceElement=
  14478. model->referenceElement(model->data(index,Qt::UserRole).toString());
  14479. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  14480. QDomElement node;
  14481. /*:801*/
  14482. #line 387 "./phidget22.w"
  14483. for(int i= 0;i<configData.size();i++)
  14484. {
  14485. node= configData.at(i).toElement();
  14486. if(node.attribute("name")=="serialnumber")
  14487. {
  14488. serialNumber->setText(node.attribute("value"));
  14489. }
  14490. else if(node.attribute("name")=="channel")
  14491. {
  14492. channel->setText(node.attribute("value"));
  14493. }
  14494. else if(node.attribute("name")=="columnname")
  14495. {
  14496. columnName->setText(node.attribute("value"));
  14497. }
  14498. else if(node.attribute("name")=="channeltype")
  14499. {
  14500. subtype->setCurrentIndex(subtype->
  14501. findData(QVariant(node.attribute("value").toInt())));
  14502. subtypeLayout->setCurrentIndex(subtype->currentIndex());
  14503. }
  14504. else if(node.attribute("name")=="tctype")
  14505. {
  14506. tctype->setCurrentIndex(tctype->
  14507. findData(QVariant(node.attribute("value").toInt())));
  14508. }
  14509. else if(node.attribute("name")=="rtdtype")
  14510. {
  14511. rtdtype->setCurrentIndex(rtdtype->
  14512. findData(QVariant(node.attribute("value").toInt())));
  14513. }
  14514. else if(node.attribute("name")=="rtdwiring")
  14515. {
  14516. rtdwiring->setCurrentIndex(rtdwiring->
  14517. findData(QVariant(node.attribute("value").toInt())));
  14518. }
  14519. else if(node.attribute("name")=="hubport")
  14520. {
  14521. hubPort->setText(node.attribute("value"));
  14522. }
  14523. else if(node.attribute("name")=="hidden")
  14524. {
  14525. hidden->setCheckState(node.attribute("value")=="true"?Qt::Checked:Qt::Unchecked);
  14526. }
  14527. }
  14528. outerLayout->addLayout(subtypeLayout);
  14529. setLayout(outerLayout);
  14530. updateSerialNumber(serialNumber->text());
  14531. updateChannel(channel->text());
  14532. updateColumnName(columnName->text());
  14533. updateChannelType(subtype->currentIndex());
  14534. updateTCType(tctype->currentIndex());
  14535. updateRTDType(rtdtype->currentIndex());
  14536. updateRTDWiring(rtdwiring->currentIndex());
  14537. updateHubPort(hubPort->text());
  14538. updateHidden(hidden->checkState());
  14539. connect(channelSelector,SIGNAL(currentIndexChanged(int)),
  14540. this,SLOT(changeSelectedChannel(int)));
  14541. connect(subtype,SIGNAL(currentIndexChanged(int)),
  14542. subtypeLayout,SLOT(setCurrentIndex(int)));
  14543. connect(serialNumber,SIGNAL(textChanged(QString)),
  14544. this,SLOT(updateSerialNumber(QString)));
  14545. connect(channel,SIGNAL(textChanged(QString)),
  14546. this,SLOT(updateChannel(QString)));
  14547. connect(columnName,SIGNAL(textEdited(QString)),
  14548. this,SLOT(updateColumnName(QString)));
  14549. connect(subtype,SIGNAL(currentIndexChanged(int)),
  14550. this,SLOT(updateChannelType(int)));
  14551. connect(tctype,SIGNAL(currentIndexChanged(int)),
  14552. this,SLOT(updateTCType(int)));
  14553. connect(rtdtype,SIGNAL(currentIndexChanged(int)),
  14554. this,SLOT(updateRTDType(int)));
  14555. connect(rtdwiring,SIGNAL(currentIndexChanged(int)),
  14556. this,SLOT(updateRTDWiring(int)));
  14557. connect(hubPort,SIGNAL(textChanged(QString)),
  14558. this,SLOT(updateHubPort(QString)));
  14559. connect(hidden,SIGNAL(stateChanged(int)),
  14560. this,SLOT(updateHidden(int)));
  14561. }
  14562. /*:981*//*982:*/
  14563. #line 471 "./phidget22.w"
  14564. void PhidgetChannelConfWidget::changeSelectedChannel(int index)
  14565. {
  14566. QMap<QString,QVariant> data= channelSelector->itemData(index).toMap();
  14567. serialNumber->setText(data.value("serialNumber").toString());
  14568. channel->setText(data.value("channel").toString());
  14569. subtype->setCurrentIndex(subtype->
  14570. findData(QVariant(data.value("subclass").toString().toInt())));
  14571. hubPort->setText(data.value("hubport").toString());
  14572. }
  14573. /*:982*//*983:*/
  14574. #line 484 "./phidget22.w"
  14575. void PhidgetChannelConfWidget::updateSerialNumber(const QString&value)
  14576. {
  14577. updateAttribute("serialnumber",value);
  14578. }
  14579. void PhidgetChannelConfWidget::updateChannel(const QString&value)
  14580. {
  14581. updateAttribute("channel",value);
  14582. }
  14583. void PhidgetChannelConfWidget::updateColumnName(const QString&value)
  14584. {
  14585. updateAttribute("columnname",value);
  14586. }
  14587. void PhidgetChannelConfWidget::updateChannelType(int value)
  14588. {
  14589. updateAttribute("channeltype",subtype->itemData(value).toString());
  14590. }
  14591. void PhidgetChannelConfWidget::updateTCType(int value)
  14592. {
  14593. updateAttribute("tctype",tctype->itemData(value).toString());
  14594. }
  14595. void PhidgetChannelConfWidget::updateRTDType(int value)
  14596. {
  14597. updateAttribute("rtdtype",rtdtype->itemData(value).toString());
  14598. }
  14599. void PhidgetChannelConfWidget::updateRTDWiring(int value)
  14600. {
  14601. updateAttribute("rtdwiring",rtdwiring->itemData(value).toString());
  14602. }
  14603. void PhidgetChannelConfWidget::updateHubPort(const QString&value)
  14604. {
  14605. updateAttribute("hubport",value);
  14606. }
  14607. void PhidgetChannelConfWidget::updateHidden(int value)
  14608. {
  14609. updateAttribute("hidden",value==0?"false":"true");
  14610. }
  14611. /*:983*//*986:*/
  14612. #line 593 "./phidget22.w"
  14613. Phidget22::Phidget22(const QModelIndex&index):QObject(NULL)
  14614. {
  14615. DeviceTreeModel*model= (DeviceTreeModel*)(index.model());
  14616. if(model->hasChildren(index))
  14617. {
  14618. for(int i= 0;i<model->rowCount(index);i++)
  14619. {
  14620. QModelIndex channelIndex= model->index(i,0,index);
  14621. QDomElement channelReference= model->
  14622. referenceElement(model->data(channelIndex,32).toString());
  14623. QDomElement channelReferenceElement= model->
  14624. referenceElement(model->
  14625. data(channelIndex,Qt::UserRole).toString());
  14626. QDomNodeList channelConfigData=
  14627. channelReferenceElement.elementsByTagName("attribute");
  14628. PhidgetChannelData*c= new PhidgetChannelData;
  14629. c->channel= new Channel;
  14630. c->indicatorLabel=
  14631. model->data(channelIndex,Qt::DisplayRole).toString();
  14632. c->device= NULL;
  14633. c->hubPort= -1;
  14634. for(int j= 0;j<channelConfigData.size();j++)
  14635. {
  14636. QDomElement node= channelConfigData.at(j).toElement();
  14637. if(node.attribute("name")=="serialnumber")
  14638. {
  14639. c->serialNumber= node.attribute("value").toInt();
  14640. }
  14641. else if(node.attribute("name")=="channel")
  14642. {
  14643. c->channelNumber= node.attribute("value").toInt();
  14644. }
  14645. else if(node.attribute("name")=="channeltype")
  14646. {
  14647. c->channelType= node.attribute("value").toInt();
  14648. }
  14649. else if(node.attribute("name")=="tctype")
  14650. {
  14651. c->tcType= node.attribute("value").toInt();
  14652. }
  14653. else if(node.attribute("name")=="rtdtype")
  14654. {
  14655. c->rtdType= node.attribute("value").toInt();
  14656. }
  14657. else if(node.attribute("name")=="rtdwiring")
  14658. {
  14659. c->wiring= node.attribute("value").toInt();
  14660. }
  14661. else if(node.attribute("name")=="hidden")
  14662. {
  14663. c->hidden= (node.attribute("value")=="true");
  14664. }
  14665. else if(node.attribute("name")=="columnname")
  14666. {
  14667. c->columnName= node.attribute("value");
  14668. }
  14669. else if(node.attribute("name")=="hubport")
  14670. {
  14671. c->hubPort= node.attribute("value").toInt();
  14672. }
  14673. }
  14674. channelConfiguration.append(c);
  14675. }
  14676. }
  14677. }
  14678. /*:986*//*987:*/
  14679. #line 663 "./phidget22.w"
  14680. int Phidget22::channelCount()
  14681. {
  14682. return channelConfiguration.length();
  14683. }
  14684. Channel*Phidget22::getChannel(int channel)
  14685. {
  14686. return channelConfiguration.at(channel)->channel;
  14687. }
  14688. /*:987*//*988:*/
  14689. #line 677 "./phidget22.w"
  14690. bool Phidget22::isChannelHidden(int channel)
  14691. {
  14692. return channelConfiguration.at(channel)->hidden;
  14693. }
  14694. QString Phidget22::channelColumnName(int channel)
  14695. {
  14696. return channelConfiguration.at(channel)->columnName;
  14697. }
  14698. QString Phidget22::channelIndicatorText(int channel)
  14699. {
  14700. return channelConfiguration.at(channel)->indicatorLabel;
  14701. }
  14702. /*:988*//*989:*/
  14703. #line 696 "./phidget22.w"
  14704. void Phidget22::start()
  14705. {
  14706. #if __APPLE__
  14707. driver.setFileName("Phidget22.framework/Phidget22");
  14708. #else
  14709. driver.setFileName("phidget22");
  14710. #endif
  14711. if(!driver.load())
  14712. {
  14713. QMessageBox::critical(NULL,tr("Typica: Driver not found"),
  14714. tr("Failed to find phidget22. Please install it."));
  14715. return;
  14716. }
  14717. if((p_createTemperatureSensor= (PhidgetPointer)driver.resolve("PhidgetTemperatureSensor_create"))==0||
  14718. (p_setSerialNumber= (PhidgetPointerIntIn)driver.resolve("Phidget_setDeviceSerialNumber"))==0||
  14719. (p_setChannelNumber= (PhidgetPointerIntIn)driver.resolve("Phidget_setChannel"))==0||
  14720. (p_setTCType= (PhidgetPointerIntIn)driver.resolve("PhidgetTemperatureSensor_setThermocoupleType"))==0||
  14721. (p_setRTDType= (PhidgetPointerIntIn)driver.resolve("PhidgetTemperatureSensor_setRTDType"))==0||
  14722. (p_setRTDWiring= (PhidgetPointerIntIn)driver.resolve("PhidgetTemperatureSensor_setRTDWireSetup"))==0||
  14723. (p_setNewDataCallback= (PhidgetPointerVCPointer)driver.resolve("PhidgetTemperatureSensor_setOnTemperatureChangeHandler"))==0||
  14724. (p_open= (PhidgetPointerIntIn)driver.resolve("Phidget_openWaitForAttachment"))==0||
  14725. (p_close= (PhidgetPointer)driver.resolve("Phidget_close"))==0||
  14726. (p_delete= (PhidgetPointer)driver.resolve("PhidgetTemperatureSensor_delete"))==0||
  14727. (p_setHubPort= (PhidgetPointerIntIn)driver.resolve("Phidget_setHubPort"))==0)
  14728. {
  14729. QMessageBox::critical(NULL,tr("Typica: Link error"),
  14730. tr("Failed to link a required symbol in phidget22."));
  14731. return;
  14732. }
  14733. for(int i= 0;i<channelConfiguration.length();i++)
  14734. {
  14735. PhidgetChannelData*c= channelConfiguration.at(i);
  14736. p_createTemperatureSensor(&(c->device));
  14737. p_setSerialNumber(c->device,c->serialNumber);
  14738. p_setChannelNumber(c->device,c->channelNumber);
  14739. switch(c->channelType)
  14740. {
  14741. case 32:
  14742. p_setRTDType(c->device,c->rtdType);
  14743. p_setRTDWiring(c->device,c->wiring);
  14744. break;
  14745. case 33:
  14746. p_setTCType(c->device,c->tcType);
  14747. break;
  14748. default:
  14749. break;
  14750. }
  14751. if(c->hubPort>=0)
  14752. {
  14753. p_setHubPort(c->device,c->hubPort);
  14754. }
  14755. p_setNewDataCallback(c->device,Phidget22ValueCallback,c->channel);
  14756. p_open(c->device,5000);
  14757. }
  14758. }
  14759. /*:989*//*992:*/
  14760. #line 779 "./phidget22.w"
  14761. void Phidget22::stop()
  14762. {
  14763. for(int i= 0;i<channelConfiguration.length();i++)
  14764. {
  14765. PhidgetChannelData*c= channelConfiguration.at(i);
  14766. p_close(c->device);
  14767. p_delete(&(c->device));
  14768. }
  14769. }
  14770. /*:992*/
  14771. #line 793 "./phidget22.w"
  14772. /*:993*//*1007:*/
  14773. #line 19866 "./typica.w"
  14774. /*1005:*/
  14775. #line 19828 "./typica.w"
  14776. CoolingTimerConfWidget::CoolingTimerConfWidget(DeviceTreeModel*model,
  14777. const QModelIndex&index)
  14778. :BasicDeviceConfigurationWidget(model,index)
  14779. {
  14780. QHBoxLayout*layout= new QHBoxLayout;
  14781. QLabel*label= new QLabel(tr("Cooling Time: "));
  14782. QTimeEdit*editor= new QTimeEdit;
  14783. editor->setDisplayFormat("mm:ss");
  14784. /*801:*/
  14785. #line 16668 "./typica.w"
  14786. QDomElement referenceElement=
  14787. model->referenceElement(model->data(index,Qt::UserRole).toString());
  14788. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  14789. QDomElement node;
  14790. /*:801*/
  14791. #line 19837 "./typica.w"
  14792. for(int i= 0;i<configData.size();i++)
  14793. {
  14794. node= configData.at(i).toElement();
  14795. if(node.attribute("name")=="reset")
  14796. {
  14797. editor->setTime(QTime::fromString(node.attribute("value"),"mm:ss"));
  14798. }
  14799. }
  14800. updateResetTime(editor->time());
  14801. connect(editor,SIGNAL(timeChanged(QTime)),
  14802. this,SLOT(updateResetTime(QTime)));
  14803. layout->addWidget(label);
  14804. layout->addWidget(editor);
  14805. setLayout(layout);
  14806. }
  14807. void CoolingTimerConfWidget::updateResetTime(QTime time)
  14808. {
  14809. updateAttribute("reset",time.toString("mm:ss"));
  14810. }
  14811. /*:1005*/
  14812. #line 19867 "./typica.w"
  14813. /*:1007*//*1012:*/
  14814. #line 20125 "./typica.w"
  14815. /*1009:*/
  14816. #line 19899 "./typica.w"
  14817. RangeTimerConfWidget::RangeTimerConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  14818. :BasicDeviceConfigurationWidget(model,index)
  14819. {
  14820. QVBoxLayout*layout= new QVBoxLayout;
  14821. QGroupBox*startConfigurationGroup= new QGroupBox(tr("Start trigger"));
  14822. QRadioButton*startBatchOption= new QRadioButton(tr("Start of batch"));
  14823. QRadioButton*buttonOption= new QRadioButton(tr("Manual"));
  14824. QRadioButton*thresholdOption= new QRadioButton(tr("At temperature"));
  14825. QButtonGroup*startOptionGroup= new QButtonGroup;
  14826. startOptionGroup->addButton(startBatchOption,1);
  14827. startOptionGroup->addButton(buttonOption,2);
  14828. startOptionGroup->addButton(thresholdOption,3);
  14829. startBatchOption->setChecked(true);
  14830. QGridLayout*startOptions= new QGridLayout;
  14831. startOptions->addWidget(startBatchOption,0,0);
  14832. startOptions->addWidget(buttonOption,1,0);
  14833. startOptions->addWidget(thresholdOption,2,0);
  14834. QLabel*buttonTextLabel= new QLabel(tr("Button Text: "));
  14835. QLineEdit*buttonTextEdit= new QLineEdit;
  14836. QHBoxLayout*buttonTextOptions= new QHBoxLayout;
  14837. buttonTextOptions->addWidget(buttonTextLabel);
  14838. buttonTextOptions->addWidget(buttonTextEdit);
  14839. startOptions->addLayout(buttonTextOptions,1,1);
  14840. QFormLayout*thresholdOptions= new QFormLayout;
  14841. QLineEdit*startColumnName= new QLineEdit;
  14842. QLineEdit*startValue= new QLineEdit;
  14843. thresholdOptions->addRow(tr("Column Name: "),startColumnName);
  14844. thresholdOptions->addRow(tr("Value: "),startValue);
  14845. startOptions->addLayout(thresholdOptions,2,1);
  14846. startConfigurationGroup->setLayout(startOptions);
  14847. layout->addWidget(startConfigurationGroup);
  14848. QGroupBox*stopConfigurationGroup= new QGroupBox(tr("Stop trigger"));
  14849. QRadioButton*stopBatchOption= new QRadioButton(tr("End of batch"));
  14850. QRadioButton*stopButtonOption= new QRadioButton(tr("Manual"));
  14851. QRadioButton*stopThresholdOption= new QRadioButton(tr("At temperature"));
  14852. QButtonGroup*stopOptionGroup= new QButtonGroup;
  14853. stopOptionGroup->addButton(stopBatchOption,1);
  14854. stopOptionGroup->addButton(stopButtonOption,2);
  14855. stopOptionGroup->addButton(stopThresholdOption,3);
  14856. stopBatchOption->setChecked(true);
  14857. QGridLayout*stopOptions= new QGridLayout;
  14858. stopOptions->addWidget(stopBatchOption,0,0);
  14859. stopOptions->addWidget(stopButtonOption,1,0);
  14860. stopOptions->addWidget(stopThresholdOption,2,0);
  14861. QLabel*stopButtonLabel= new QLabel(tr("Button Text: "));
  14862. QLineEdit*stopButtonEdit= new QLineEdit;
  14863. QHBoxLayout*stopButtonTextOptions= new QHBoxLayout;
  14864. stopButtonTextOptions->addWidget(stopButtonLabel);
  14865. stopButtonTextOptions->addWidget(stopButtonEdit);
  14866. stopOptions->addLayout(stopButtonTextOptions,1,1);
  14867. QLineEdit*stopColumnName= new QLineEdit;
  14868. QLineEdit*stopValue= new QLineEdit;
  14869. QFormLayout*stopThresholdOptions= new QFormLayout;
  14870. stopThresholdOptions->addRow(tr("Column Name: "),stopColumnName);
  14871. stopThresholdOptions->addRow(tr("Value: "),stopValue);
  14872. stopOptions->addLayout(stopThresholdOptions,2,1);
  14873. stopConfigurationGroup->setLayout(stopOptions);
  14874. layout->addWidget(stopConfigurationGroup);
  14875. /*801:*/
  14876. #line 16668 "./typica.w"
  14877. QDomElement referenceElement=
  14878. model->referenceElement(model->data(index,Qt::UserRole).toString());
  14879. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  14880. QDomElement node;
  14881. /*:801*/
  14882. #line 19961 "./typica.w"
  14883. for(int i= 0;i<configData.size();i++)
  14884. {
  14885. node= configData.at(i).toElement();
  14886. if(node.attribute("name")=="startbuttontext")
  14887. {
  14888. buttonTextEdit->setText(node.attribute("value"));
  14889. }
  14890. else if(node.attribute("name")=="stopbuttontext")
  14891. {
  14892. stopButtonEdit->setText(node.attribute("value"));
  14893. }
  14894. else if(node.attribute("name")=="startcolumnname")
  14895. {
  14896. startColumnName->setText(node.attribute("value"));
  14897. }
  14898. else if(node.attribute("name")=="stopcolumnname")
  14899. {
  14900. stopColumnName->setText(node.attribute("value"));
  14901. }
  14902. else if(node.attribute("name")=="startvalue")
  14903. {
  14904. startValue->setText(node.attribute("value"));
  14905. }
  14906. else if(node.attribute("name")=="stopvalue")
  14907. {
  14908. stopValue->setText(node.attribute("value"));
  14909. }
  14910. else if(node.attribute("name")=="starttrigger")
  14911. {
  14912. if(node.attribute("value")=="batch")
  14913. {
  14914. startBatchOption->setChecked(true);
  14915. }
  14916. else if(node.attribute("value")=="manual")
  14917. {
  14918. buttonOption->setChecked(true);
  14919. }
  14920. else if(node.attribute("value")=="value")
  14921. {
  14922. thresholdOption->setChecked(true);
  14923. }
  14924. }
  14925. else if(node.attribute("name")=="stoptrigger")
  14926. {
  14927. if(node.attribute("value")=="batch")
  14928. {
  14929. stopBatchOption->setChecked(true);
  14930. }
  14931. else if(node.attribute("value")=="manual")
  14932. {
  14933. stopButtonOption->setChecked(true);
  14934. }
  14935. else if(node.attribute("value")=="value")
  14936. {
  14937. stopThresholdOption->setChecked(true);
  14938. }
  14939. }
  14940. }
  14941. updateStartButtonText(buttonTextEdit->text());
  14942. updateStopButtonText(stopButtonEdit->text());
  14943. updateStartColumnName(startColumnName->text());
  14944. updateStopColumnName(stopColumnName->text());
  14945. updateStartValue(startValue->text());
  14946. updateStopValue(stopValue->text());
  14947. updateStartTrigger(startOptionGroup->checkedId());
  14948. updateStopTrigger(stopOptionGroup->checkedId());
  14949. setLayout(layout);
  14950. connect(buttonTextEdit,SIGNAL(textChanged(QString)),
  14951. this,SLOT(updateStartButtonText(QString)));
  14952. connect(stopButtonEdit,SIGNAL(textChanged(QString)),
  14953. this,SLOT(updateStopButtonText(QString)));
  14954. connect(startColumnName,SIGNAL(textChanged(QString)),
  14955. this,SLOT(updateStartColumnName(QString)));
  14956. connect(stopColumnName,SIGNAL(textChanged(QString)),
  14957. this,SLOT(updateStopColumnName(QString)));
  14958. connect(startValue,SIGNAL(textChanged(QString)),
  14959. this,SLOT(updateStartValue(QString)));
  14960. connect(stopValue,SIGNAL(textChanged(QString)),
  14961. this,SLOT(updateStopValue(QString)));
  14962. connect(startOptionGroup,SIGNAL(buttonClicked(int)),
  14963. this,SLOT(updateStartTrigger(int)));
  14964. connect(stopOptionGroup,SIGNAL(buttonClicked(int)),
  14965. this,SLOT(updateStopTrigger(int)));
  14966. }
  14967. /*:1009*//*1010:*/
  14968. #line 20051 "./typica.w"
  14969. void RangeTimerConfWidget::updateStartButtonText(const QString&text)
  14970. {
  14971. updateAttribute("startbuttontext",text);
  14972. }
  14973. void RangeTimerConfWidget::updateStopButtonText(const QString&text)
  14974. {
  14975. updateAttribute("stopbuttontext",text);
  14976. }
  14977. void RangeTimerConfWidget::updateStartColumnName(const QString&text)
  14978. {
  14979. updateAttribute("startcolumnname",text);
  14980. }
  14981. void RangeTimerConfWidget::updateStopColumnName(const QString&text)
  14982. {
  14983. updateAttribute("stopcolumnname",text);
  14984. }
  14985. void RangeTimerConfWidget::updateStartValue(const QString&text)
  14986. {
  14987. updateAttribute("startvalue",text);
  14988. }
  14989. void RangeTimerConfWidget::updateStopValue(const QString&text)
  14990. {
  14991. updateAttribute("stopvalue",text);
  14992. }
  14993. void RangeTimerConfWidget::updateStartTrigger(int option)
  14994. {
  14995. switch(option)
  14996. {
  14997. case 1:
  14998. updateAttribute("starttrigger","batch");
  14999. break;
  15000. case 2:
  15001. updateAttribute("starttrigger","manual");
  15002. break;
  15003. case 3:
  15004. updateAttribute("starttrigger","value");
  15005. break;
  15006. default:
  15007. break;
  15008. }
  15009. }
  15010. void RangeTimerConfWidget::updateStopTrigger(int option)
  15011. {
  15012. switch(option)
  15013. {
  15014. case 1:
  15015. updateAttribute("stoptrigger","batch");
  15016. break;
  15017. case 2:
  15018. updateAttribute("stoptrigger","manual");
  15019. break;
  15020. case 3:
  15021. updateAttribute("stoptrigger","value");
  15022. break;
  15023. default:
  15024. break;
  15025. }
  15026. }
  15027. /*:1010*/
  15028. #line 20126 "./typica.w"
  15029. /*:1012*//*1017:*/
  15030. #line 20226 "./typica.w"
  15031. /*1014:*/
  15032. #line 20150 "./typica.w"
  15033. MultiRangeTimerConfWidget::MultiRangeTimerConfWidget(DeviceTreeModel*model,
  15034. const QModelIndex&index)
  15035. :BasicDeviceConfigurationWidget(model,index),tablemodel(new SaltModel(2))
  15036. {
  15037. QFormLayout*layout= new QFormLayout;
  15038. QLineEdit*trigger= new QLineEdit;
  15039. layout->addRow(tr("Trigger column name:"),trigger);
  15040. tablemodel->setHeaderData(0,Qt::Horizontal,"Range Name");
  15041. tablemodel->setHeaderData(1,Qt::Horizontal,"End Temperature");
  15042. QTableView*rangeTable= new QTableView;
  15043. rangeTable->setModel(tablemodel);
  15044. layout->addRow(tr("Range data:"),rangeTable);
  15045. /*801:*/
  15046. #line 16668 "./typica.w"
  15047. QDomElement referenceElement=
  15048. model->referenceElement(model->data(index,Qt::UserRole).toString());
  15049. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  15050. QDomElement node;
  15051. /*:801*/
  15052. #line 20163 "./typica.w"
  15053. for(int i= 0;i<configData.size();i++)
  15054. {
  15055. node= configData.at(i).toElement();
  15056. if(node.attribute("name")=="trigger")
  15057. {
  15058. trigger->setText(node.attribute("value"));
  15059. }
  15060. else if(node.attribute("name")=="rangenames")
  15061. {
  15062. QString data= node.attribute("value");
  15063. if(data.length()> 3)
  15064. {
  15065. data.chop(2);
  15066. data= data.remove(0,2);
  15067. }
  15068. QStringList itemList= data.split(", ");
  15069. for(int j= 0;j<itemList.size();j++)
  15070. {
  15071. QString item= itemList.at(j);
  15072. item.chop(1);
  15073. item= item.remove(0,1);
  15074. tablemodel->setData(tablemodel->index(j,0),
  15075. QVariant(item),Qt::DisplayRole);
  15076. }
  15077. }
  15078. else if(node.attribute("name")=="endtemps")
  15079. {
  15080. /*1000:*/
  15081. #line 19758 "./typica.w"
  15082. QString data= node.attribute("value");
  15083. if(data.length()> 3)
  15084. {
  15085. data.chop(2);
  15086. data= data.remove(0,2);
  15087. }
  15088. QStringList itemList= data.split(",");
  15089. /*:1000*/
  15090. #line 20191 "./typica.w"
  15091. int column= 1;
  15092. /*1001:*/
  15093. #line 19770 "./typica.w"
  15094. for(int j= 0;j<itemList.size();j++)
  15095. {
  15096. tablemodel->setData(tablemodel->index(j,column),
  15097. QVariant(itemList.at(j).toDouble()),
  15098. Qt::DisplayRole);
  15099. }
  15100. /*:1001*/
  15101. #line 20193 "./typica.w"
  15102. }
  15103. }
  15104. updateColumnName(trigger->text());
  15105. updateRangeData();
  15106. connect(trigger,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
  15107. connect(tablemodel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(updateRangeData()));
  15108. setLayout(layout);
  15109. }
  15110. /*:1014*//*1015:*/
  15111. #line 20207 "./typica.w"
  15112. void MultiRangeTimerConfWidget::updateRangeData()
  15113. {
  15114. updateAttribute("rangenames",tablemodel->quotedArrayLiteral(0,Qt::DisplayRole));
  15115. updateAttribute("endtemps",tablemodel->arrayLiteral(1,Qt::DisplayRole));
  15116. }
  15117. void MultiRangeTimerConfWidget::updateColumnName(const QString&text)
  15118. {
  15119. updateAttribute("trigger",text);
  15120. }
  15121. /*:1015*/
  15122. #line 20227 "./typica.w"
  15123. /*:1017*//*1035:*/
  15124. #line 265 "./rate.w"
  15125. /*1031:*/
  15126. #line 191 "./rate.w"
  15127. RateOfChangeConfWidget::RateOfChangeConfWidget(DeviceTreeModel*model,const QModelIndex&index)
  15128. :BasicDeviceConfigurationWidget(model,index)
  15129. {
  15130. QFormLayout*layout= new QFormLayout;
  15131. QLineEdit*column= new QLineEdit;
  15132. layout->addRow(tr("Primary series column name:"),column);
  15133. QSpinBox*cacheTime= new QSpinBox;
  15134. cacheTime->setMinimum(0);
  15135. cacheTime->setMaximum(300);
  15136. layout->addRow(tr("Cache time:"),cacheTime);
  15137. QSpinBox*scaleTime= new QSpinBox;
  15138. scaleTime->setMinimum(1);
  15139. scaleTime->setMaximum(300);
  15140. layout->addRow(tr("Scale time:"),scaleTime);
  15141. /*801:*/
  15142. #line 16668 "./typica.w"
  15143. QDomElement referenceElement=
  15144. model->referenceElement(model->data(index,Qt::UserRole).toString());
  15145. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  15146. QDomElement node;
  15147. /*:801*/
  15148. #line 206 "./rate.w"
  15149. for(int i= 0;i<configData.size();i++)
  15150. {
  15151. node= configData.at(i).toElement();
  15152. if(node.attribute("name")=="column")
  15153. {
  15154. column->setText(node.attribute("value"));
  15155. }
  15156. else if(node.attribute("name")=="cache")
  15157. {
  15158. cacheTime->setValue(node.attribute("value").toInt());
  15159. }
  15160. else if(node.attribute("name")=="scale")
  15161. {
  15162. scaleTime->setValue(node.attribute("value").toInt());
  15163. }
  15164. }
  15165. updateColumn(column->text());
  15166. updateCacheTime(cacheTime->text());
  15167. updateScaleTime(scaleTime->text());
  15168. connect(column,SIGNAL(textEdited(QString)),this,SLOT(updateColumn(QString)));
  15169. connect(cacheTime,SIGNAL(valueChanged(QString)),this,SLOT(updateCacheTime(QString)));
  15170. connect(scaleTime,SIGNAL(valueChanged(QString)),this,SLOT(updateScaleTime(QString)));
  15171. setLayout(layout);
  15172. }
  15173. /*:1031*//*1032:*/
  15174. #line 235 "./rate.w"
  15175. void RateOfChangeConfWidget::updateColumn(const QString&column)
  15176. {
  15177. updateAttribute("column",column);
  15178. }
  15179. void RateOfChangeConfWidget::updateCacheTime(const QString&seconds)
  15180. {
  15181. updateAttribute("cache",seconds);
  15182. }
  15183. void RateOfChangeConfWidget::updateScaleTime(const QString&seconds)
  15184. {
  15185. updateAttribute("scale",seconds);
  15186. }
  15187. /*:1032*/
  15188. #line 266 "./rate.w"
  15189. #line 20334 "./typica.w"
  15190. #line 1 "./mergeseries.w"
  15191. /*:1035*//*1049:*/
  15192. #line 282 "./mergeseries.w"
  15193. /*1045:*/
  15194. #line 183 "./mergeseries.w"
  15195. MergeSeriesConfWidget::MergeSeriesConfWidget(DeviceTreeModel*model,
  15196. const QModelIndex&index)
  15197. :BasicDeviceConfigurationWidget(model,index)
  15198. {
  15199. QFormLayout*layout= new QFormLayout;
  15200. QComboBox*type= new QComboBox;
  15201. type->addItem(tr("Difference"),QVariant("Difference"));
  15202. type->addItem(tr("Mean"),QVariant("Mean"));
  15203. layout->addRow(tr("Series type:"),type);
  15204. QLineEdit*column1= new QLineEdit;
  15205. layout->addRow(tr("First input column name:"),column1);
  15206. QLineEdit*column2= new QLineEdit;
  15207. layout->addRow(tr("Second input column name:"),column2);
  15208. QLineEdit*output= new QLineEdit;
  15209. layout->addRow(tr("Output column name:"),output);
  15210. /*801:*/
  15211. #line 16668 "./typica.w"
  15212. QDomElement referenceElement=
  15213. model->referenceElement(model->data(index,Qt::UserRole).toString());
  15214. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  15215. QDomElement node;
  15216. /*:801*/
  15217. #line 199 "./mergeseries.w"
  15218. for(int i= 0;i<configData.size();i++)
  15219. {
  15220. node= configData.at(i).toElement();
  15221. if(node.attribute("name")=="type")
  15222. {
  15223. type->setCurrentIndex(type->findData(node.attribute("value")));
  15224. }
  15225. else if(node.attribute("name")=="column1")
  15226. {
  15227. column1->setText(node.attribute("value"));
  15228. }
  15229. else if(node.attribute("name")=="column2")
  15230. {
  15231. column2->setText(node.attribute("value"));
  15232. }
  15233. else if(node.attribute("name")=="output")
  15234. {
  15235. output->setText(node.attribute("value"));
  15236. }
  15237. }
  15238. updateColumn1(column1->text());
  15239. updateColumn2(column2->text());
  15240. updateOutput(output->text());
  15241. updateType(type->currentIndex());
  15242. connect(column1,SIGNAL(textEdited(QString)),this,SLOT(updateColumn1(QString)));
  15243. connect(column2,SIGNAL(textEdited(QString)),this,SLOT(updateColumn2(QString)));
  15244. connect(output,SIGNAL(textEdited(QString)),this,SLOT(updateOutput(QString)));
  15245. connect(type,SIGNAL(currentIndexChanged(int)),this,SLOT(updateType(int)));
  15246. setLayout(layout);
  15247. }
  15248. /*:1045*//*1046:*/
  15249. #line 233 "./mergeseries.w"
  15250. void MergeSeriesConfWidget::updateColumn1(const QString&column)
  15251. {
  15252. updateAttribute("column1",column);
  15253. }
  15254. void MergeSeriesConfWidget::updateColumn2(const QString&column)
  15255. {
  15256. updateAttribute("column2",column);
  15257. }
  15258. void MergeSeriesConfWidget::updateOutput(const QString&column)
  15259. {
  15260. updateAttribute("output",column);
  15261. }
  15262. void MergeSeriesConfWidget::updateType(int index)
  15263. {
  15264. switch(index)
  15265. {
  15266. case 0:
  15267. updateAttribute("type","Difference");
  15268. break;
  15269. case 1:
  15270. updateAttribute("type","Mean");
  15271. break;
  15272. default:
  15273. break;
  15274. }
  15275. }
  15276. /*:1046*/
  15277. #line 283 "./mergeseries.w"
  15278. /*1037:*/
  15279. #line 59 "./mergeseries.w"
  15280. void MergeSeries::in1(Measurement measure)
  15281. {
  15282. last1= measure;
  15283. received1= true;
  15284. if(received1&&received2)
  15285. {
  15286. calculate(last1,last2);
  15287. received1= false;
  15288. received2= false;
  15289. }
  15290. }
  15291. void MergeSeries::in2(Measurement measure)
  15292. {
  15293. last2= measure;
  15294. received2= true;
  15295. if(received1&&received2)
  15296. {
  15297. calculate(last1,last2);
  15298. received1= false;
  15299. received2= false;
  15300. }
  15301. }
  15302. /*:1037*//*1038:*/
  15303. #line 86 "./mergeseries.w"
  15304. MergeSeries::MergeSeries():QObject(NULL),received1(false),received2(false)
  15305. {
  15306. }
  15307. /*:1038*//*1039:*/
  15308. #line 97 "./mergeseries.w"
  15309. void DifferenceSeries::calculate(Measurement m1,Measurement m2)
  15310. {
  15311. Measurement outval(m1.temperature()-m2.temperature(),
  15312. (m1.time()> m2.time()?m1.time():m2.time()));
  15313. outval.insert("relative",true);
  15314. emit newData(outval);
  15315. }
  15316. void MeanSeries::calculate(Measurement m1,Measurement m2)
  15317. {
  15318. Measurement outval((m1.temperature()+m2.temperature())/2,
  15319. (m1.time()> m2.time()?m1.time():m2.time()));
  15320. emit newData(outval);
  15321. }
  15322. /*:1039*//*1040:*/
  15323. #line 115 "./mergeseries.w"
  15324. DifferenceSeries::DifferenceSeries():MergeSeries()
  15325. {
  15326. }
  15327. MeanSeries::MeanSeries():MergeSeries()
  15328. {
  15329. }
  15330. /*:1040*/
  15331. #line 284 "./mergeseries.w"
  15332. #line 20336 "./typica.w"
  15333. #line 1 "./dataqsdk.w"
  15334. /*:1049*//*1164:*/
  15335. #line 344 "./user.w"
  15336. /*1159:*/
  15337. #line 232 "./user.w"
  15338. NewTypicaUser::NewTypicaUser():QDialog(),
  15339. userField(new QLineEdit),passwordField(new QLineEdit),
  15340. autoLogin(new QCheckBox(tr("Log in automatically"))),
  15341. saveAndCloseButton(new QPushButton(tr("Save and Close"))),
  15342. saveAndNewButton(new QPushButton(tr("Save and Create Another"))),
  15343. cancelButton(new QPushButton(tr("Cancel")))
  15344. {
  15345. setModal(true);
  15346. QVBoxLayout*mainLayout= new QVBoxLayout;
  15347. QFormLayout*form= new QFormLayout;
  15348. QHBoxLayout*buttons= new QHBoxLayout;
  15349. form->addRow(tr("Name:"),userField);
  15350. passwordField->setEchoMode(QLineEdit::Password);
  15351. form->addRow(tr("Password:"),passwordField);
  15352. form->addRow(autoLogin);
  15353. buttons->addWidget(cancelButton);
  15354. buttons->addStretch();
  15355. buttons->addWidget(saveAndNewButton);
  15356. buttons->addWidget(saveAndCloseButton);
  15357. mainLayout->addLayout(form);
  15358. mainLayout->addLayout(buttons);
  15359. setLayout(mainLayout);
  15360. setWindowTitle(tr("Create New User"));
  15361. connect(cancelButton,SIGNAL(clicked()),this,SLOT(reject()));
  15362. connect(saveAndCloseButton,SIGNAL(clicked()),this,SLOT(createAndClose()));
  15363. connect(saveAndNewButton,SIGNAL(clicked()),this,SLOT(createAndReset()));
  15364. connect(userField,SIGNAL(textChanged(QString)),this,SLOT(validate()));
  15365. }
  15366. /*:1159*//*1160:*/
  15367. #line 264 "./user.w"
  15368. void NewTypicaUser::createAndReset()
  15369. {
  15370. createNewUser();
  15371. userField->setText("");
  15372. passwordField->setText("");
  15373. autoLogin->setChecked(false);
  15374. }
  15375. void NewTypicaUser::createAndClose()
  15376. {
  15377. createNewUser();
  15378. accept();
  15379. }
  15380. void NewTypicaUser::createNewUser()
  15381. {
  15382. SqlQueryConnection h;
  15383. QSqlQuery*dbquery= h.operator->();
  15384. dbquery->prepare("INSERT INTO typica_users (name, password, active, auto_login) VALUES (:name, :password, true, :auto)");
  15385. dbquery->bindValue(":name",userField->text());
  15386. dbquery->bindValue(":password",passwordField->text());
  15387. dbquery->bindValue(":auto",autoLogin->isChecked());
  15388. dbquery->exec();
  15389. cancelButton->setEnabled(true);
  15390. }
  15391. void NewTypicaUser::validate()
  15392. {
  15393. if(!userField->text().isEmpty())
  15394. {
  15395. saveAndCloseButton->setEnabled(true);
  15396. saveAndNewButton->setEnabled(true);
  15397. }
  15398. else
  15399. {
  15400. saveAndCloseButton->setEnabled(false);
  15401. saveAndNewButton->setEnabled(false);
  15402. }
  15403. }
  15404. void NewTypicaUser::cancelValidate()
  15405. {
  15406. SqlQueryConnection h;
  15407. QSqlQuery*dbquery= h.operator->();
  15408. dbquery->exec("SELECT count(1) FROM typica_users");
  15409. if(dbquery->next())
  15410. {
  15411. if(dbquery->value(0).toInt()> 0)
  15412. {
  15413. cancelButton->setEnabled(true);
  15414. return;
  15415. }
  15416. }
  15417. cancelButton->setEnabled(false);
  15418. }
  15419. /*:1160*/
  15420. #line 345 "./user.w"
  15421. /*1155:*/
  15422. #line 177 "./user.w"
  15423. UserLabel::UserLabel():QLabel()
  15424. {
  15425. setTextFormat(Qt::PlainText);
  15426. updateLabel(AppInstance->currentTypicaUser());
  15427. connect(AppInstance,SIGNAL(userChanged(QString)),
  15428. this,SLOT(updateLabel(QString)));
  15429. }
  15430. /*:1155*//*1156:*/
  15431. #line 188 "./user.w"
  15432. void UserLabel::updateLabel(const QString&user)
  15433. {
  15434. setText(QString(tr("Current operator: %1").arg(user)));
  15435. }
  15436. /*:1156*//*1157:*/
  15437. #line 196 "./user.w"
  15438. void UserLabel::mouseReleaseEvent(QMouseEvent*)
  15439. {
  15440. LoginDialog*dialog= new LoginDialog;
  15441. dialog->exec();
  15442. }
  15443. /*:1157*/
  15444. #line 346 "./user.w"
  15445. /*1149:*/
  15446. #line 95 "./user.w"
  15447. LoginDialog::LoginDialog():QDialog(),
  15448. user(new QLineEdit),password(new QLineEdit),
  15449. warning(new QLabel(tr("Log in failed."))),
  15450. login(new QPushButton(tr("Log In")))
  15451. {
  15452. setModal(true);
  15453. QVBoxLayout*mainLayout= new QVBoxLayout;
  15454. warning->setVisible(false);
  15455. password->setEchoMode(QLineEdit::Password);
  15456. QFormLayout*form= new QFormLayout;
  15457. form->addRow(tr("Name:"),user);
  15458. form->addRow(tr("Password:"),password);
  15459. form->addRow(warning);
  15460. QHBoxLayout*buttonBox= new QHBoxLayout;
  15461. buttonBox->addStretch();
  15462. buttonBox->addWidget(login);
  15463. mainLayout->addLayout(form);
  15464. mainLayout->addLayout(buttonBox);
  15465. connect(login,SIGNAL(clicked()),this,SLOT(attemptLogin()));
  15466. setLayout(mainLayout);
  15467. }
  15468. /*:1149*//*1150:*/
  15469. #line 120 "./user.w"
  15470. void LoginDialog::attemptLogin()
  15471. {
  15472. if(AppInstance->login(user->text(),password->text()))
  15473. {
  15474. accept();
  15475. }
  15476. else
  15477. {
  15478. warning->setVisible(true);
  15479. }
  15480. }
  15481. /*:1150*/
  15482. #line 347 "./user.w"
  15483. #line 20346 "./typica.w"
  15484. #line 1 "./roastcoloredit.w"
  15485. /*:1164*//*1172:*/
  15486. #line 149 "./roastcoloredit.w"
  15487. /*1166:*/
  15488. #line 31 "./roastcoloredit.w"
  15489. RoastColorEdit::RoastColorEdit():edit(new QLineEdit)
  15490. {
  15491. QHBoxLayout*layout= new QHBoxLayout;
  15492. layout->setContentsMargins(0,0,0,0);
  15493. layout->addWidget(edit);
  15494. QSettings settings;
  15495. if(settings.value("settings/color/javalytics/enable",false).toBool())
  15496. {
  15497. QPushButton*button= new QPushButton(tr("Measure"));
  15498. layout->addWidget(button);
  15499. connect(button,SIGNAL(clicked()),this,SLOT(readColor()));
  15500. }
  15501. setLayout(layout);
  15502. }
  15503. /*:1166*//*1167:*/
  15504. #line 50 "./roastcoloredit.w"
  15505. void RoastColorEdit::readColor()
  15506. {
  15507. QSettings settings;
  15508. QUrl postData;
  15509. postData.addQueryItem("calscale",settings.value("settings/color/javalytics/scale",1).toString());
  15510. postData.addQueryItem("webcontrol","20");
  15511. QNetworkRequest request(QUrl("http://"+settings.value("settings/color/javalytics/address","192.168.1.10").toString()+"/index.zhtml"));
  15512. request.setHeader(QNetworkRequest::ContentTypeHeader,"application/x-www-form-urlencoded");
  15513. networkReply= AppInstance->network->post(request,postData.encodedQuery());
  15514. connect(networkReply,SIGNAL(finished()),this,SLOT(measureFinished()));
  15515. }
  15516. /*:1167*//*1168:*/
  15517. #line 66 "./roastcoloredit.w"
  15518. void RoastColorEdit::measureFinished()
  15519. {
  15520. QSettings settings;
  15521. networkReply->deleteLater();
  15522. networkReply= AppInstance->network->get(QNetworkRequest(QUrl("http://"+settings.value("settings/color/javalytics/address","192.168.1.10").toString()+"/data.csv")));
  15523. connect(networkReply,SIGNAL(finished()),this,SLOT(readFinished()));
  15524. }
  15525. /*:1168*//*1169:*/
  15526. #line 93 "./roastcoloredit.w"
  15527. void RoastColorEdit::readFinished()
  15528. {
  15529. QByteArray response= networkReply->readAll();
  15530. networkReply->deleteLater();
  15531. networkReply= 0;
  15532. if(response.size()==0)
  15533. {
  15534. return;
  15535. }
  15536. QList<QByteArray> lines= response.split('\n');
  15537. if(lines.last().size()==0)
  15538. {
  15539. lines.removeLast();
  15540. }
  15541. if(lines.size()==0)
  15542. {
  15543. return;
  15544. }
  15545. QList<QByteArray> fields= lines.last().split(',');
  15546. if(fields.size()<3)
  15547. {
  15548. return;
  15549. }
  15550. edit->setText(QString(fields.at(2)));
  15551. }
  15552. /*:1169*//*1170:*/
  15553. #line 122 "./roastcoloredit.w"
  15554. void RoastColorEdit::setValue(const QString&color)
  15555. {
  15556. edit->setText(color);
  15557. }
  15558. QString RoastColorEdit::value()
  15559. {
  15560. return edit->text();
  15561. }
  15562. /*:1170*/
  15563. #line 150 "./roastcoloredit.w"
  15564. #line 20348 "./typica.w"
  15565. /*:1172*/
  15566. #line 532 "./typica.w"
  15567. /*8:*/
  15568. #line 679 "./typica.w"
  15569. template<class TYPE> TYPE getself(QScriptContext*context)
  15570. {
  15571. TYPE self= qobject_cast<TYPE> (context->thisObject().toQObject());
  15572. return self;
  15573. }
  15574. template<> QTime getself(QScriptContext*context)
  15575. {
  15576. QTime self= context->thisObject().toVariant().toTime();
  15577. return self;
  15578. }
  15579. template<> QByteArray getself(QScriptContext*context)
  15580. {
  15581. QByteArray self= context->thisObject().toVariant().toByteArray();
  15582. return self;
  15583. }
  15584. template<> SqlQueryConnection*getself(QScriptContext*context)
  15585. {
  15586. SqlQueryConnection*self=
  15587. (SqlQueryConnection*)qscriptvalue_cast<void*> (context->thisObject());
  15588. return self;
  15589. }
  15590. template<> QXmlQuery*getself(QScriptContext*context)
  15591. {
  15592. QXmlQuery*self=
  15593. (QXmlQuery*)qscriptvalue_cast<void*> (context->thisObject());
  15594. return self;
  15595. }
  15596. template<> QXmlStreamWriter*getself(QScriptContext*context)
  15597. {
  15598. QXmlStreamWriter*self=
  15599. (QXmlStreamWriter*)qscriptvalue_cast<void*> (context->thisObject());
  15600. return self;
  15601. }
  15602. template<> QXmlStreamReader*getself(QScriptContext*context)
  15603. {
  15604. QXmlStreamReader*self=
  15605. (QXmlStreamReader*)qscriptvalue_cast<void*> (context->thisObject());
  15606. return self;
  15607. }
  15608. /*:8*//*9:*/
  15609. #line 730 "./typica.w"
  15610. template<class TYPE> TYPE argument(int arg,QScriptContext*context)
  15611. {
  15612. TYPE argument= qobject_cast<TYPE> (context->argument(arg).toQObject());
  15613. return argument;
  15614. }
  15615. template<> QString argument(int arg,QScriptContext*context)
  15616. {
  15617. return context->argument(arg).toString();
  15618. }
  15619. template<> QVariant argument(int arg,QScriptContext*context)
  15620. {
  15621. return context->argument(arg).toVariant();
  15622. }
  15623. template<> int argument(int arg,QScriptContext*context)
  15624. {
  15625. return context->argument(arg).toInt32();
  15626. }
  15627. template<> SqlQueryConnection*argument(int arg,QScriptContext*context)
  15628. {
  15629. return(SqlQueryConnection*)
  15630. qscriptvalue_cast<void*> (context->argument(arg));
  15631. }
  15632. template<> QModelIndex argument(int arg,QScriptContext*context)
  15633. {
  15634. return qscriptvalue_cast<QModelIndex> (context->argument(arg));
  15635. }
  15636. template<> double argument(int arg,QScriptContext*context)
  15637. {
  15638. return(double)(context->argument(arg).toNumber());
  15639. }
  15640. template<> Units::Unit argument(int arg,QScriptContext*context)
  15641. {
  15642. return(Units::Unit)(context->argument(arg).toInt32());
  15643. }
  15644. template<> QByteArray argument(int arg,QScriptContext*context)
  15645. {
  15646. return qscriptvalue_cast<QByteArray> (context->argument(arg));
  15647. }
  15648. template<> bool argument(int arg,QScriptContext*context)
  15649. {
  15650. return context->argument(arg).toBool();
  15651. }
  15652. /*:9*//*13:*/
  15653. #line 829 "./typica.w"
  15654. void setQObjectProperties(QScriptValue value,QScriptEngine*engine)
  15655. {
  15656. value.setProperty("setProperty",engine->newFunction(QObject_setProperty));
  15657. }
  15658. QScriptValue QObject_setProperty(QScriptContext*context,QScriptEngine*)
  15659. {
  15660. QObject*self= getself<QObject*> (context);
  15661. self->setProperty(argument<QString> (0,context).toUtf8().constData(),
  15662. argument<QVariant> (1,context));
  15663. return QScriptValue();
  15664. }
  15665. /*:13*//*15:*/
  15666. #line 851 "./typica.w"
  15667. void setQPaintDeviceProperties(QScriptValue,QScriptEngine*)
  15668. {
  15669. }
  15670. void setQLayoutItemProperties(QScriptValue,QScriptEngine*)
  15671. {
  15672. }
  15673. /*:15*//*18:*/
  15674. #line 883 "./typica.w"
  15675. void setQTimerProperties(QScriptValue value,QScriptEngine*engine)
  15676. {
  15677. setQObjectProperties(value,engine);
  15678. }
  15679. QScriptValue constructQTimer(QScriptContext*,QScriptEngine*engine)
  15680. {
  15681. QScriptValue object= engine->newQObject(new QTimer);
  15682. setQTimerProperties(object,engine);
  15683. return object;
  15684. }
  15685. /*:18*//*21:*/
  15686. #line 925 "./typica.w"
  15687. QScriptValue constructQWidget(QScriptContext*,QScriptEngine*engine)
  15688. {
  15689. QScriptValue object= engine->newQObject(new QWidget);
  15690. setQWidgetProperties(object,engine);
  15691. return object;
  15692. }
  15693. void setQWidgetProperties(QScriptValue value,QScriptEngine*engine)
  15694. {
  15695. setQObjectProperties(value,engine);
  15696. setQPaintDeviceProperties(value,engine);
  15697. value.setProperty("setLayout",engine->newFunction(QWidget_setLayout));
  15698. value.setProperty("activateWindow",
  15699. engine->newFunction(QWidget_activateWindow));
  15700. }
  15701. /*:21*//*22:*/
  15702. #line 947 "./typica.w"
  15703. QScriptValue QWidget_setLayout(QScriptContext*context,QScriptEngine*)
  15704. {
  15705. if(context->argumentCount()==1)
  15706. {
  15707. QWidget*self= getself<QWidget*> (context);
  15708. QLayout*layout= argument<QLayout*> (0,context);
  15709. if(layout)
  15710. {
  15711. self->setLayout(layout);
  15712. }
  15713. else
  15714. {
  15715. context->throwError("Incorrect argument type passed to "
  15716. "QWidget::setLayout(). This method requires "
  15717. "a QLayout.");
  15718. }
  15719. }
  15720. else
  15721. {
  15722. context->throwError("Incorrect number of arguments passed to "
  15723. "QWidget::setLayout(). This method takes one "
  15724. "QLayout as an argument.");
  15725. }
  15726. return QScriptValue();
  15727. }
  15728. QScriptValue QWidget_activateWindow(QScriptContext*context,
  15729. QScriptEngine*)
  15730. {
  15731. QWidget*self= getself<QWidget*> (context);
  15732. self->activateWindow();
  15733. return QScriptValue();
  15734. }
  15735. /*:22*//*25:*/
  15736. #line 1012 "./typica.w"
  15737. QScriptValue displayWarning(QScriptContext*context,QScriptEngine*)
  15738. {
  15739. QMessageBox::StandardButton selection= QMessageBox::warning(NULL,
  15740. argument<QString> (0,context),
  15741. argument<QString> (1,context),
  15742. QMessageBox::Ok|QMessageBox::Cancel);
  15743. if(selection==QMessageBox::Ok){
  15744. return QScriptValue(true);
  15745. }
  15746. return QScriptValue(false);
  15747. }
  15748. QScriptValue displayError(QScriptContext*context,QScriptEngine*)
  15749. {
  15750. QMessageBox::critical(NULL,argument<QString> (0,context),
  15751. argument<QString> (1,context));
  15752. return QScriptValue();
  15753. }
  15754. QScriptValue displayInfo(QScriptContext*context,QScriptEngine*)
  15755. {
  15756. QMessageBox::information(NULL,argument<QString> (0,context),
  15757. argument<QString> (1,context));
  15758. return QScriptValue();
  15759. }
  15760. /*:25*//*27:*/
  15761. #line 1097 "./typica.w"
  15762. ScriptQMainWindow::ScriptQMainWindow():QMainWindow(NULL),
  15763. cprompt(tr("Closing this window may result in loss of data. Continue?"))
  15764. {
  15765. if(!AppInstance->databaseConnected())
  15766. {
  15767. statusBar()->addWidget(new QLabel(tr("Not connected to database")));
  15768. }
  15769. else
  15770. {
  15771. statusBar()->addWidget(new UserLabel);
  15772. }
  15773. }
  15774. void ScriptQMainWindow::saveSizeAndPosition(const QString&key)
  15775. {
  15776. QSettings settings;
  15777. settings.beginGroup(key);
  15778. settings.setValue("pos",pos());
  15779. settings.setValue("size",size());
  15780. settings.endGroup();
  15781. }
  15782. void ScriptQMainWindow::restoreSizeAndPosition(const QString&key)
  15783. {
  15784. QSettings settings;
  15785. settings.beginGroup(key);
  15786. if(settings.contains("size"))
  15787. {
  15788. resize(settings.value("size").toSize());
  15789. }
  15790. if(settings.contains("pos"))
  15791. {
  15792. move(settings.value("pos").toPoint());
  15793. }
  15794. settings.endGroup();
  15795. }
  15796. void ScriptQMainWindow::displayStatus(const QString&message)
  15797. {
  15798. statusBar()->showMessage(message);
  15799. }
  15800. void ScriptQMainWindow::showEvent(QShowEvent*event)
  15801. {
  15802. if(!event->spontaneous())
  15803. {
  15804. /*32:*/
  15805. #line 1221 "./typica.w"
  15806. QSettings settings;
  15807. restoreGeometry(settings.value(QString("geometries/%1").arg(objectName())).
  15808. toByteArray());
  15809. /*:32*/
  15810. #line 1144 "./typica.w"
  15811. event->accept();
  15812. }
  15813. else
  15814. {
  15815. event->ignore();
  15816. }
  15817. }
  15818. void ScriptQMainWindow::show()
  15819. {
  15820. QMainWindow::show();
  15821. }
  15822. void ScriptQMainWindow::setupFinished()
  15823. {
  15824. emit windowReady();
  15825. }
  15826. /*:27*//*28:*/
  15827. #line 1170 "./typica.w"
  15828. void ScriptQMainWindow::closeEvent(QCloseEvent*event)
  15829. {
  15830. if(isWindowModified()){
  15831. /*29:*/
  15832. #line 1184 "./typica.w"
  15833. QMessageBox::StandardButton result;
  15834. result= QMessageBox::warning(this,"Typica",closePrompt(),
  15835. QMessageBox::Ok|QMessageBox::Cancel);
  15836. if(result==QMessageBox::Cancel)
  15837. {
  15838. event->ignore();
  15839. return;
  15840. }
  15841. /*:29*/
  15842. #line 1174 "./typica.w"
  15843. }
  15844. emit aboutToClose();
  15845. /*31:*/
  15846. #line 1215 "./typica.w"
  15847. QSettings settings;
  15848. settings.setValue(QString("geometries/%1").arg(objectName()),saveGeometry());
  15849. /*:31*/
  15850. #line 1177 "./typica.w"
  15851. event->accept();
  15852. }
  15853. /*:28*//*30:*/
  15854. #line 1196 "./typica.w"
  15855. QString ScriptQMainWindow::closePrompt()
  15856. {
  15857. return cprompt;
  15858. }
  15859. void ScriptQMainWindow::setClosePrompt(QString prompt)
  15860. {
  15861. cprompt= prompt;
  15862. }
  15863. /*:30*//*35:*/
  15864. #line 1249 "./typica.w"
  15865. QScriptValue constructQMainWindow(QScriptContext*,QScriptEngine*engine)
  15866. {
  15867. QScriptValue object= engine->newQObject(new ScriptQMainWindow);
  15868. setQMainWindowProperties(object,engine);
  15869. return object;
  15870. }
  15871. void setQMainWindowProperties(QScriptValue value,QScriptEngine*engine)
  15872. {
  15873. setQWidgetProperties(value,engine);
  15874. value.setProperty("setCentralWidget",
  15875. engine->newFunction(QMainWindow_setCentralWidget));
  15876. value.setProperty("menuBar",engine->newFunction(QMainWindow_menuBar));
  15877. }
  15878. /*:35*//*36:*/
  15879. #line 1271 "./typica.w"
  15880. QScriptValue QMainWindow_setCentralWidget(QScriptContext*context,
  15881. QScriptEngine*)
  15882. {
  15883. if(context->argumentCount()==1)
  15884. {
  15885. QMainWindow*self= getself<QMainWindow*> (context);
  15886. QWidget*widget= argument<QWidget*> (0,context);
  15887. if(widget)
  15888. {
  15889. self->setCentralWidget(widget);
  15890. }
  15891. else
  15892. {
  15893. context->throwError("Incorrect argument type passed to "
  15894. "QMainWindow::setCentralWidget(). This "
  15895. "method requires a QWidget.");
  15896. }
  15897. }
  15898. else
  15899. {
  15900. context->throwError("Incorrect number of arguments passed to "
  15901. "QMainWindow::setCentralWidget(). This method "
  15902. "takes one QWidget as an argument.");
  15903. }
  15904. return QScriptValue();
  15905. }
  15906. /*:36*//*37:*/
  15907. #line 1305 "./typica.w"
  15908. QScriptValue QMainWindow_menuBar(QScriptContext*context,QScriptEngine*engine)
  15909. {
  15910. QScriptValue object;
  15911. if(context->argumentCount()==0)
  15912. {
  15913. QMainWindow*self= getself<QMainWindow*> (context);
  15914. QMenuBar*bar= self->menuBar();
  15915. object= engine->newQObject(bar);
  15916. setQMenuBarProperties(object,engine);
  15917. }
  15918. else
  15919. {
  15920. context->throwError("Incorrect number of arguments passed to "
  15921. "QMainWindow::menuBar(). This method takes no "
  15922. "arguments.");
  15923. }
  15924. return object;
  15925. }
  15926. /*:37*//*39:*/
  15927. #line 1335 "./typica.w"
  15928. void setQMenuBarProperties(QScriptValue value,QScriptEngine*engine)
  15929. {
  15930. setQWidgetProperties(value,engine);
  15931. value.setProperty("addMenu",engine->newFunction(QMenuBar_addMenu));
  15932. }
  15933. /*:39*//*40:*/
  15934. #line 1350 "./typica.w"
  15935. QScriptValue QMenuBar_addMenu(QScriptContext*context,QScriptEngine*engine)
  15936. {
  15937. QScriptValue object;
  15938. if(context->argumentCount()==1)
  15939. {
  15940. QMenuBar*self= getself<QMenuBar*> (context);
  15941. QString title= argument<QString> (0,context);
  15942. object= engine->newQObject(self->addMenu(title));
  15943. setQMenuProperties(object,engine);
  15944. }
  15945. else
  15946. {
  15947. context->throwError("Incorrect number of arguments passed to "
  15948. "QMenuBar::addMenu(). This method takes one "
  15949. "string as an argument.");
  15950. }
  15951. return object;
  15952. }
  15953. /*:40*//*42:*/
  15954. #line 1380 "./typica.w"
  15955. void setQMenuProperties(QScriptValue value,QScriptEngine*engine)
  15956. {
  15957. setQWidgetProperties(value,engine);
  15958. value.setProperty("addAction",engine->newFunction(QMenu_addAction));
  15959. value.setProperty("addSeparator",engine->newFunction(QMenu_addSeparator));
  15960. }
  15961. /*:42*//*43:*/
  15962. #line 1390 "./typica.w"
  15963. QScriptValue QMenu_addAction(QScriptContext*context,QScriptEngine*)
  15964. {
  15965. if(context->argumentCount()==1)
  15966. {
  15967. QMenu*self= getself<QMenu*> (context);
  15968. QAction*action= argument<QAction*> (0,context);
  15969. if(action)
  15970. {
  15971. self->addAction(action);
  15972. }
  15973. else
  15974. {
  15975. context->throwError("Incorrect argument type passed to "
  15976. "QMenu::addAction(). This method requires a "
  15977. "QAction.");
  15978. }
  15979. }
  15980. else
  15981. {
  15982. context->throwError("Incorrect number of arguments passed to "
  15983. "QMenu::addAction(). This method takes one "
  15984. "QAction as an argument.");
  15985. }
  15986. return QScriptValue();
  15987. }
  15988. QScriptValue QMenu_addSeparator(QScriptContext*context,QScriptEngine*)
  15989. {
  15990. if(context->argumentCount()==0)
  15991. {
  15992. QMenu*self= getself<QMenu*> (context);
  15993. self->addSeparator();
  15994. }
  15995. else
  15996. {
  15997. context->throwError("Incorrect number of arguments passed to "
  15998. "QMenu::addSeparator(). This method takes no "
  15999. "arguments.");
  16000. }
  16001. return QScriptValue();
  16002. }
  16003. /*:43*//*46:*/
  16004. #line 1452 "./typica.w"
  16005. QScriptValue constructQFrame(QScriptContext*,QScriptEngine*engine)
  16006. {
  16007. QScriptValue object= engine->newQObject(new QFrame);
  16008. setQFrameProperties(object,engine);
  16009. return object;
  16010. }
  16011. void setQFrameProperties(QScriptValue value,QScriptEngine*engine)
  16012. {
  16013. setQWidgetProperties(value,engine);
  16014. }
  16015. /*:46*//*49:*/
  16016. #line 1486 "./typica.w"
  16017. QScriptValue constructQLabel(QScriptContext*context,QScriptEngine*engine)
  16018. {
  16019. QString text;
  16020. if(context->argumentCount()==1)
  16021. {
  16022. text= argument<QString> (0,context);
  16023. }
  16024. QScriptValue object= engine->newQObject(new QLabel(text));
  16025. setQLabelProperties(object,engine);
  16026. return object;
  16027. }
  16028. void setQLabelProperties(QScriptValue value,QScriptEngine*engine)
  16029. {
  16030. setQFrameProperties(value,engine);
  16031. }
  16032. /*:49*//*52:*/
  16033. #line 1528 "./typica.w"
  16034. QScriptValue constructQSvgWidget(QScriptContext*,
  16035. QScriptEngine*engine)
  16036. {
  16037. QScriptValue object= engine->newQObject(new QSvgWidget);
  16038. setQSvgWidgetProperties(object,engine);
  16039. return object;
  16040. }
  16041. /*:52*//*53:*/
  16042. #line 1539 "./typica.w"
  16043. void setQSvgWidgetProperties(QScriptValue value,QScriptEngine*engine)
  16044. {
  16045. setQWidgetProperties(value,engine);
  16046. value.setProperty("loadDevice",
  16047. engine->newFunction(QSvgWidget_loadDevice));
  16048. }
  16049. QScriptValue QSvgWidget_loadDevice(QScriptContext*context,QScriptEngine*)
  16050. {
  16051. if(context->argumentCount()==1)
  16052. {
  16053. QSvgWidget*self= getself<QSvgWidget*> (context);
  16054. QIODevice*device= argument<QIODevice*> (0,context);
  16055. device->reset();
  16056. QByteArray data= device->readAll();
  16057. self->load(data);
  16058. }
  16059. else
  16060. {
  16061. context->throwError("Incorrect number of arguments passed to "
  16062. "QSvgWidget::loadData(). This method takes one "
  16063. "QIODevice as an argument.");
  16064. }
  16065. return QScriptValue();
  16066. }
  16067. /*:53*//*55:*/
  16068. #line 1577 "./typica.w"
  16069. void addSvgWidgetToLayout(QDomElement element,QStack<QWidget*> *,
  16070. QStack<QLayout*> *layoutStack)
  16071. {
  16072. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  16073. QSvgWidget*widget= new QSvgWidget;
  16074. layout->addWidget(widget);
  16075. QString id= element.attribute("id");
  16076. if(!id.isEmpty())
  16077. {
  16078. widget->setObjectName(id);
  16079. }
  16080. }
  16081. /*:55*//*58:*/
  16082. #line 1610 "./typica.w"
  16083. QScriptValue constructQLineEdit(QScriptContext*,QScriptEngine*engine)
  16084. {
  16085. QScriptValue object= engine->newQObject(new QLineEdit());
  16086. setQLineEditProperties(object,engine);
  16087. return object;
  16088. }
  16089. /*:58*//*59:*/
  16090. #line 1621 "./typica.w"
  16091. void setQLineEditProperties(QScriptValue value,QScriptEngine*engine)
  16092. {
  16093. setQWidgetProperties(value,engine);
  16094. }
  16095. /*:59*//*62:*/
  16096. #line 1659 "./typica.w"
  16097. QScriptValue constructQSplitter(QScriptContext*,QScriptEngine*engine)
  16098. {
  16099. QScriptValue object= engine->newQObject(new QSplitter);
  16100. setQSplitterProperties(object,engine);
  16101. return object;
  16102. }
  16103. void setQSplitterProperties(QScriptValue value,QScriptEngine*engine)
  16104. {
  16105. setQFrameProperties(value,engine);
  16106. value.setProperty("addWidget",engine->newFunction(QSplitter_addWidget));
  16107. value.setProperty("saveState",engine->newFunction(QSplitter_saveState));
  16108. value.setProperty("restoreState",
  16109. engine->newFunction(QSplitter_restoreState));
  16110. value.setProperty("count",engine->newFunction(QSplitter_count));
  16111. value.setProperty("setCollapsible",engine->newFunction(QSplitter_setCollapsible));
  16112. }
  16113. /*:62*//*63:*/
  16114. #line 1681 "./typica.w"
  16115. QScriptValue QSplitter_addWidget(QScriptContext*context,QScriptEngine*)
  16116. {
  16117. if(context->argumentCount()==1)
  16118. {
  16119. QSplitter*self= getself<QSplitter*> (context);
  16120. QWidget*widget= argument<QWidget*> (0,context);
  16121. if(widget)
  16122. {
  16123. self->addWidget(widget);
  16124. }
  16125. else
  16126. {
  16127. context->throwError("Incorrect argument type passed to "
  16128. "QSplitter::addWidget(). This method "
  16129. "requires a QWidget.");
  16130. }
  16131. }
  16132. else
  16133. {
  16134. context->throwError("Incorrect number of arguments passed to "
  16135. "QSplitter::addWidget(). This method takes one "
  16136. "QWidget as an argument.");
  16137. }
  16138. return QScriptValue();
  16139. }
  16140. /*:63*//*64:*/
  16141. #line 1718 "./typica.w"
  16142. QScriptValue QSplitter_count(QScriptContext*context,QScriptEngine*)
  16143. {
  16144. QSplitter*self= getself<QSplitter*> (context);
  16145. return QScriptValue(self->count());
  16146. }
  16147. /*:64*//*65:*/
  16148. #line 1731 "./typica.w"
  16149. QScriptValue QSplitter_saveState(QScriptContext*context,QScriptEngine*)
  16150. {
  16151. if(context->argumentCount()==1)
  16152. {
  16153. QSplitter*self= getself<QSplitter*> (context);
  16154. QString key= argument<QString> (0,context);
  16155. QSettings settings;
  16156. settings.setValue(key,self->saveState());
  16157. }
  16158. else
  16159. {
  16160. context->throwError("Incorrect number of arguments passed to "
  16161. "QSplitter::saveState(). This method takes one "
  16162. "string as an argument.");
  16163. }
  16164. return QScriptValue();
  16165. }
  16166. QScriptValue QSplitter_restoreState(QScriptContext*context,QScriptEngine*)
  16167. {
  16168. if(context->argumentCount()==1)
  16169. {
  16170. QSplitter*self= getself<QSplitter*> (context);
  16171. QString key= argument<QString> (0,context);
  16172. QSettings settings;
  16173. self->restoreState(settings.value(key).toByteArray());
  16174. }
  16175. else
  16176. {
  16177. context->throwError("Incorrect number of arguments passed to "
  16178. "QSplitter::restoreState(). This method takes "
  16179. "one string as an argument.");
  16180. }
  16181. return QScriptValue();
  16182. }
  16183. /*:65*//*66:*/
  16184. #line 1772 "./typica.w"
  16185. QScriptValue QSplitter_setCollapsible(QScriptContext*context,QScriptEngine*)
  16186. {
  16187. if(context->argumentCount()==2)
  16188. {
  16189. QSplitter*self= getself<QSplitter*> (context);
  16190. self->setCollapsible(argument<int> (0,context),argument<bool> (1,context));
  16191. }
  16192. else
  16193. {
  16194. context->throwError("Incorrect number of arguments");
  16195. }
  16196. return QScriptValue();
  16197. }
  16198. /*:66*//*68:*/
  16199. #line 1803 "./typica.w"
  16200. void setQLayoutProperties(QScriptValue value,QScriptEngine*engine)
  16201. {
  16202. setQLayoutItemProperties(value,engine);
  16203. value.setProperty("addWidget",engine->newFunction(QLayout_addWidget));
  16204. }
  16205. QScriptValue QLayout_addWidget(QScriptContext*context,QScriptEngine*)
  16206. {
  16207. if(context->argumentCount()==1)
  16208. {
  16209. QLayout*self= getself<QLayout*> (context);
  16210. QWidget*widget= argument<QWidget*> (0,context);
  16211. if(widget)
  16212. {
  16213. self->addWidget(widget);
  16214. }
  16215. else
  16216. {
  16217. context->throwError("Incorrect argument type passed to "
  16218. "QLayout::addWidget(). This method requires "
  16219. "a QWidget.");
  16220. }
  16221. }
  16222. else
  16223. {
  16224. context->throwError("Incorrect number of arguments passed to "
  16225. "QLayout::addWidget(). This method takes one "
  16226. "QWidget as an argument.");
  16227. }
  16228. return QScriptValue();
  16229. }
  16230. /*:68*//*71:*/
  16231. #line 1870 "./typica.w"
  16232. QScriptValue constructQBoxLayout(QScriptContext*,QScriptEngine*engine)
  16233. {
  16234. QScriptValue object=
  16235. engine->newQObject(new QBoxLayout(QBoxLayout::LeftToRight));
  16236. setQBoxLayoutProperties(object,engine);
  16237. return object;
  16238. }
  16239. void setQBoxLayoutProperties(QScriptValue value,QScriptEngine*engine)
  16240. {
  16241. setQLayoutProperties(value,engine);
  16242. value.setProperty("addLayout",engine->newFunction(QBoxLayout_addLayout));
  16243. value.setProperty("addWidget",engine->newFunction(QBoxLayout_addWidget));
  16244. }
  16245. QScriptValue QBoxLayout_addLayout(QScriptContext*context,QScriptEngine*)
  16246. {
  16247. if(context->argumentCount()> 0&&context->argumentCount()<3)
  16248. {
  16249. QBoxLayout*self= getself<QBoxLayout*> (context);
  16250. QLayout*layout= argument<QLayout*> (0,context);
  16251. int stretch= 0;
  16252. if(context->argumentCount()==2)
  16253. {
  16254. stretch= argument<int> (1,context);
  16255. }
  16256. if(layout)
  16257. {
  16258. self->addLayout(layout,stretch);
  16259. }
  16260. else
  16261. {
  16262. context->throwError("Incorrect argument type passed to "
  16263. "QLayout::addLayout(). This method requires "
  16264. "a QLayout.");
  16265. }
  16266. }
  16267. else
  16268. {
  16269. context->throwError("Incorrect number of arguments passed to "
  16270. "QLayout::addLayout(). This method takes one "
  16271. "QLayout as an argument and optionally one integer.");
  16272. }
  16273. return QScriptValue();
  16274. }
  16275. /*:71*//*72:*/
  16276. #line 1921 "./typica.w"
  16277. QScriptValue QBoxLayout_addWidget(QScriptContext*context,QScriptEngine*)
  16278. {
  16279. if(context->argumentCount()> 0&&context->argumentCount()<4)
  16280. {
  16281. QBoxLayout*self= getself<QBoxLayout*> (context);
  16282. QWidget*widget= argument<QWidget*> (0,context);
  16283. int stretch= 0;
  16284. Qt::Alignment alignment= 0;
  16285. if(context->argumentCount()> 1)
  16286. {
  16287. stretch= argument<int> (1,context);
  16288. }
  16289. if(context->argumentCount()> 2)
  16290. {
  16291. alignment= (Qt::Alignment)(argument<int> (2,context));
  16292. }
  16293. if(widget)
  16294. {
  16295. self->addWidget(widget,stretch,alignment);
  16296. }
  16297. else
  16298. {
  16299. context->throwError("Incorrect argument type passed to "
  16300. "QBoxLayout::addWidget(). This method requires "
  16301. "a QWidget.");
  16302. }
  16303. }
  16304. else
  16305. {
  16306. context->throwError("Incorrect number of arguments passed to "
  16307. "QBoxLayout::addWidget(). This method takes one "
  16308. "QWidget and optionally up to two integers as "
  16309. "arguments.");
  16310. }
  16311. return QScriptValue();
  16312. }
  16313. /*:72*//*75:*/
  16314. #line 1985 "./typica.w"
  16315. QScriptValue constructQAction(QScriptContext*,QScriptEngine*engine)
  16316. {
  16317. QScriptValue object= engine->newQObject(new QAction(NULL));
  16318. setQActionProperties(object,engine);
  16319. return object;
  16320. }
  16321. void setQActionProperties(QScriptValue value,QScriptEngine*engine)
  16322. {
  16323. setQObjectProperties(value,engine);
  16324. value.setProperty("setShortcut",engine->newFunction(QAction_setShortcut));
  16325. }
  16326. QScriptValue QAction_setShortcut(QScriptContext*context,QScriptEngine*)
  16327. {
  16328. if(context->argumentCount()==1)
  16329. {
  16330. QAction*self= getself<QAction*> (context);
  16331. self->setShortcut(argument<QString> (0,context));
  16332. }
  16333. else
  16334. {
  16335. context->throwError("Incorrect number of arguments passed to "
  16336. "QAction::setShortcut(). This method takes one "
  16337. "string as an argument.");
  16338. }
  16339. return QScriptValue();
  16340. }
  16341. /*:75*//*78:*/
  16342. #line 2043 "./typica.w"
  16343. QScriptValue QFileDialog_getOpenFileName(QScriptContext*context,
  16344. QScriptEngine*engine)
  16345. {
  16346. QScriptValue retval;
  16347. if(context->argumentCount()==3)
  16348. {
  16349. QWidget*widget= argument<QWidget*> (0,context);
  16350. if(widget)
  16351. {
  16352. QString caption= argument<QString> (1,context);
  16353. QString dir= argument<QString> (2,context);
  16354. retval= QScriptValue(engine,
  16355. QFileDialog::getOpenFileName(widget,caption,
  16356. dir,"",0,0));
  16357. setQFileDialogProperties(retval,engine);
  16358. }
  16359. else
  16360. {
  16361. context->throwError("Incorrect argument type passed to "
  16362. "QFileDialog::getOpenFileName(). The first "
  16363. "argument to this method must be a QWidget.");
  16364. }
  16365. }
  16366. else
  16367. {
  16368. context->throwError("Incorrect number of arguments passed to "
  16369. "QFileDialog::getOpenFileName(). This method "
  16370. "takes one QWidget followed by two strings for a "
  16371. "total of three arguments.");
  16372. }
  16373. return retval;
  16374. }
  16375. /*:78*//*79:*/
  16376. #line 2079 "./typica.w"
  16377. QScriptValue QFileDialog_getSaveFileName(QScriptContext*context,
  16378. QScriptEngine*engine)
  16379. {
  16380. QScriptValue retval;
  16381. if(context->argumentCount()==3)
  16382. {
  16383. QWidget*widget= argument<QWidget*> (0,context);
  16384. if(widget)
  16385. {
  16386. QString caption= argument<QString> (1,context);
  16387. QString dir= argument<QString> (2,context);
  16388. retval= QScriptValue(engine,
  16389. QFileDialog::getSaveFileName(widget,caption,
  16390. dir,"",0,0));
  16391. setQFileDialogProperties(retval,engine);
  16392. }
  16393. else
  16394. {
  16395. context->throwError("Incorrect argument type passed to "
  16396. "QFileDialog::getSaveFileName(). The first "
  16397. "argument to this method must be a QWidget.");
  16398. }
  16399. }
  16400. else
  16401. {
  16402. context->throwError("Incorrect number of arguments passed to "
  16403. "QFileDialog::getSaveFileName(). This method "
  16404. "takes one QWidget followed by two strings for a "
  16405. "total of three arguments.");
  16406. }
  16407. return retval;
  16408. }
  16409. /*:79*//*80:*/
  16410. #line 2116 "./typica.w"
  16411. void setQFileDialogProperties(QScriptValue value,QScriptEngine*engine)
  16412. {
  16413. setQDialogProperties(value,engine);
  16414. }
  16415. void setQDialogProperties(QScriptValue value,QScriptEngine*engine)
  16416. {
  16417. setQWidgetProperties(value,engine);
  16418. }
  16419. /*:80*//*83:*/
  16420. #line 2157 "./typica.w"
  16421. QScriptValue constructQFile(QScriptContext*context,QScriptEngine*engine)
  16422. {
  16423. QScriptValue object=
  16424. engine->newQObject(new QFile(argument<QString> (0,context)));
  16425. setQFileProperties(object,engine);
  16426. return object;
  16427. }
  16428. /*:83*//*84:*/
  16429. #line 2168 "./typica.w"
  16430. void setQFileProperties(QScriptValue value,QScriptEngine*engine)
  16431. {
  16432. setQIODeviceProperties(value,engine);
  16433. value.setProperty("remove",engine->newFunction(QFile_remove));
  16434. }
  16435. QScriptValue QFile_remove(QScriptContext*context,QScriptEngine*engine)
  16436. {
  16437. QFile*self= getself<QFile*> (context);
  16438. bool retval= self->remove();
  16439. return QScriptValue(engine,retval);
  16440. }
  16441. /*:84*//*85:*/
  16442. #line 2190 "./typica.w"
  16443. void setQIODeviceProperties(QScriptValue value,QScriptEngine*engine)
  16444. {
  16445. setQObjectProperties(value,engine);
  16446. value.setProperty("open",engine->newFunction(QIODevice_open));
  16447. value.setProperty("close",engine->newFunction(QIODevice_close));
  16448. value.setProperty("readToString",
  16449. engine->newFunction(QIODevice_readToString));
  16450. value.setProperty("putChar",engine->newFunction(QIODevice_putChar));
  16451. value.setProperty("writeString",engine->newFunction(QIODevice_writeString));
  16452. value.setProperty("writeBytes",engine->newFunction(QIODevice_writeBytes));
  16453. value.setProperty("readBytes",engine->newFunction(QIODevice_readBytes));
  16454. value.setProperty("peek",engine->newFunction(QIODevice_peek));
  16455. value.setProperty("read",engine->newFunction(QIODevice_read));
  16456. }
  16457. /*:85*//*86:*/
  16458. #line 2211 "./typica.w"
  16459. QScriptValue QIODevice_open(QScriptContext*context,QScriptEngine*)
  16460. {
  16461. QIODevice*self= getself<QIODevice*> (context);
  16462. bool retval= false;
  16463. if(context->argumentCount()==1)
  16464. {
  16465. switch(argument<int> (0,context))
  16466. {
  16467. case 1:
  16468. retval= self->open(QIODevice::ReadOnly);
  16469. break;
  16470. case 2:
  16471. retval= self->open(QIODevice::WriteOnly);
  16472. break;
  16473. case 3:
  16474. retval= self->open(QIODevice::ReadWrite);
  16475. break;
  16476. default:
  16477. break;
  16478. }
  16479. }
  16480. else
  16481. {
  16482. retval= self->open(QIODevice::ReadWrite);
  16483. }
  16484. return QScriptValue(retval);
  16485. }
  16486. QScriptValue QIODevice_close(QScriptContext*context,QScriptEngine*)
  16487. {
  16488. QIODevice*self= getself<QIODevice*> (context);
  16489. self->close();
  16490. return QScriptValue();
  16491. }
  16492. /*:86*//*87:*/
  16493. #line 2251 "./typica.w"
  16494. QScriptValue QIODevice_readToString(QScriptContext*context,QScriptEngine*)
  16495. {
  16496. QIODevice*self= getself<QIODevice*> (context);
  16497. self->reset();
  16498. return QScriptValue(QString(self->readAll()));
  16499. }
  16500. /*:87*//*88:*/
  16501. #line 2267 "./typica.w"
  16502. QScriptValue QIODevice_putChar(QScriptContext*context,QScriptEngine*)
  16503. {
  16504. QIODevice*self= getself<QIODevice*> (context);
  16505. if(context->argumentCount()==1)
  16506. {
  16507. return QScriptValue(self->putChar(argument<QString> (0,context).toUtf8().at(0)));
  16508. }
  16509. context->throwError("Incorrect number of arguments passed to "
  16510. "QIODevice::putChar()");
  16511. return QScriptValue();
  16512. }
  16513. /*:88*//*89:*/
  16514. #line 2285 "./typica.w"
  16515. QScriptValue QIODevice_writeString(QScriptContext*context,QScriptEngine*)
  16516. {
  16517. QIODevice*self= getself<QIODevice*> (context);
  16518. if(context->argumentCount()==1)
  16519. {
  16520. self->write(argument<QString> (0,context).toUtf8());
  16521. }
  16522. else
  16523. {
  16524. context->throwError("Incorrect number of arguments passed to "
  16525. "QIODevice::writeString()");
  16526. }
  16527. return QScriptValue();
  16528. }
  16529. QScriptValue QIODevice_writeBytes(QScriptContext*context,QScriptEngine*)
  16530. {
  16531. QIODevice*self= getself<QIODevice*> (context);
  16532. if(context->argumentCount()==1)
  16533. {
  16534. self->write(argument<QByteArray> (0,context));
  16535. }
  16536. else
  16537. {
  16538. context->throwError("Incorrect number of arguments passed to "
  16539. "QIODevice::writeBytes()");
  16540. }
  16541. return QScriptValue();
  16542. }
  16543. /*:89*//*90:*/
  16544. #line 2319 "./typica.w"
  16545. QScriptValue QIODevice_readBytes(QScriptContext*context,QScriptEngine*engine)
  16546. {
  16547. QIODevice*self= getself<QIODevice*> (context);
  16548. QScriptValue value= engine->toScriptValue<QByteArray> (self->readAll());
  16549. setQByteArrayProperties(value,engine);
  16550. return value;
  16551. }
  16552. /*:90*//*91:*/
  16553. #line 2330 "./typica.w"
  16554. QScriptValue QIODevice_peek(QScriptContext*context,QScriptEngine*engine)
  16555. {
  16556. QIODevice*self= getself<QIODevice*> (context);
  16557. QScriptValue value= engine->toScriptValue<QByteArray> (
  16558. self->peek(argument<int> (0,context)));
  16559. setQByteArrayProperties(value,engine);
  16560. return value;
  16561. }
  16562. QScriptValue QIODevice_read(QScriptContext*context,QScriptEngine*engine)
  16563. {
  16564. QIODevice*self= getself<QIODevice*> (context);
  16565. QScriptValue value= engine->toScriptValue<QByteArray> (
  16566. self->read(argument<int> (0,context)));
  16567. setQByteArrayProperties(value,engine);
  16568. return value;
  16569. }
  16570. /*:91*//*94:*/
  16571. #line 2375 "./typica.w"
  16572. QScriptValue constructQProcess(QScriptContext*,QScriptEngine*engine)
  16573. {
  16574. QScriptValue object= engine->newQObject(new QProcess);
  16575. setQProcessProperties(object,engine);
  16576. return object;
  16577. }
  16578. /*:94*//*95:*/
  16579. #line 2386 "./typica.w"
  16580. void setQProcessProperties(QScriptValue value,QScriptEngine*engine)
  16581. {
  16582. setQIODeviceProperties(value,engine);
  16583. value.setProperty("execute",engine->newFunction(QProcess_execute));
  16584. value.setProperty("startDetached",engine->newFunction(QProcess_startDetached));
  16585. value.setProperty("setWorkingDirectory",engine->newFunction(QProcess_setWorkingDirectory));
  16586. value.setProperty("start",engine->newFunction(QProcess_start));
  16587. }
  16588. /*:95*//*96:*/
  16589. #line 2400 "./typica.w"
  16590. QScriptValue QProcess_execute(QScriptContext*context,QScriptEngine*)
  16591. {
  16592. QProcess*self= getself<QProcess*> (context);
  16593. QString program= argument<QString> (0,context);
  16594. QStringList arguments= QStringList();
  16595. if(context->argumentCount()> 1){
  16596. arguments= argument<QVariant> (1,context).toStringList();
  16597. }
  16598. int retval= self->execute(program,arguments);
  16599. return QScriptValue(retval);
  16600. }
  16601. /*:96*//*97:*/
  16602. #line 2415 "./typica.w"
  16603. QScriptValue QProcess_startDetached(QScriptContext*context,QScriptEngine*)
  16604. {
  16605. QProcess*self= getself<QProcess*> (context);
  16606. QString program= argument<QString> (0,context);
  16607. QStringList arguments= QStringList();
  16608. if(context->argumentCount()> 1){
  16609. arguments= argument<QVariant> (1,context).toStringList();
  16610. }
  16611. QString workingDirectory= "";
  16612. if(context->argumentCount()> 2){
  16613. workingDirectory= argument<QString> (2,context);
  16614. }
  16615. bool retval;
  16616. switch(context->argumentCount())
  16617. {
  16618. case 1:
  16619. retval= self->startDetached(program);
  16620. break;
  16621. case 2:
  16622. retval= self->startDetached(program,arguments);
  16623. break;
  16624. case 3:
  16625. retval= self->startDetached(program,arguments,workingDirectory);
  16626. break;
  16627. default:
  16628. retval= false;
  16629. }
  16630. return QScriptValue(retval);
  16631. }
  16632. /*:97*//*98:*/
  16633. #line 2448 "./typica.w"
  16634. QScriptValue QProcess_setWorkingDirectory(QScriptContext*context,QScriptEngine*)
  16635. {
  16636. QProcess*self= getself<QProcess*> (context);
  16637. QString directory= argument<QString> (0,context);
  16638. self->setWorkingDirectory(directory);
  16639. return QScriptValue();
  16640. }
  16641. /*:98*//*99:*/
  16642. #line 2460 "./typica.w"
  16643. QScriptValue QProcess_start(QScriptContext*context,QScriptEngine*)
  16644. {
  16645. QProcess*self= getself<QProcess*> (context);
  16646. QString program= argument<QString> (0,context);
  16647. QStringList arguments= QStringList();
  16648. if(context->argumentCount()> 1){
  16649. arguments= argument<QVariant> (1,context).toStringList();
  16650. }
  16651. self->start(program,arguments);
  16652. return QScriptValue();
  16653. }
  16654. /*:99*//*101:*/
  16655. #line 2501 "./typica.w"
  16656. QScriptValue QByteArray_toScriptValue(QScriptEngine*engine,const QByteArray&bytes)
  16657. {
  16658. QScriptValue object= engine->newVariant(QVariant(bytes));
  16659. setQByteArrayProperties(object,engine);
  16660. return object;
  16661. }
  16662. void QByteArray_fromScriptValue(const QScriptValue&value,QByteArray&bytes)
  16663. {
  16664. bytes= value.toVariant().toByteArray();
  16665. }
  16666. /*:101*//*103:*/
  16667. #line 2524 "./typica.w"
  16668. QScriptValue constructQByteArray(QScriptContext*,QScriptEngine*engine)
  16669. {
  16670. QScriptValue object= engine->toScriptValue<QByteArray> (QByteArray());
  16671. setQByteArrayProperties(object,engine);
  16672. return object;
  16673. }
  16674. /*:103*//*104:*/
  16675. #line 2535 "./typica.w"
  16676. void setQByteArrayProperties(QScriptValue value,QScriptEngine*engine)
  16677. {
  16678. value.setProperty("fromHex",engine->newFunction(QByteArray_fromHex));
  16679. value.setProperty("getAt",engine->newFunction(QByteArray_getAt));
  16680. value.setProperty("setAt",engine->newFunction(QByteArray_setAt));
  16681. value.setProperty("appendBytes",engine->newFunction(QByteArray_appendBytes));
  16682. value.setProperty("appendString",engine->newFunction(QByteArray_appendString));
  16683. value.setProperty("size",engine->newFunction(QByteArray_size));
  16684. value.setProperty("left",engine->newFunction(QByteArray_left));
  16685. value.setProperty("right",engine->newFunction(QByteArray_right));
  16686. value.setProperty("mid",engine->newFunction(QByteArray_mid));
  16687. value.setProperty("chop",engine->newFunction(QByteArray_chop));
  16688. value.setProperty("remove",engine->newFunction(QByteArray_remove));
  16689. value.setProperty("toInt8",engine->newFunction(QByteArray_toInt8));
  16690. value.setProperty("toInt16",engine->newFunction(QByteArray_toInt16));
  16691. value.setProperty("toInt32",engine->newFunction(QByteArray_toInt32));
  16692. value.setProperty("toFloat",engine->newFunction(QByteArray_toFloat));
  16693. value.setProperty("toDouble",engine->newFunction(QByteArray_toDouble));
  16694. }
  16695. /*:104*//*105:*/
  16696. #line 2559 "./typica.w"
  16697. QScriptValue QByteArray_fromHex(QScriptContext*context,QScriptEngine*engine)
  16698. {
  16699. QByteArray self= getself<QByteArray> (context);
  16700. QByteArray retval;
  16701. retval= self.fromHex(argument<QString> (0,context).toUtf8());
  16702. QScriptValue value= engine->toScriptValue<QByteArray> (retval);
  16703. setQByteArrayProperties(value,engine);
  16704. return value;
  16705. }
  16706. /*:105*//*106:*/
  16707. #line 2573 "./typica.w"
  16708. QScriptValue QByteArray_getAt(QScriptContext*context,QScriptEngine*)
  16709. {
  16710. QByteArray self= getself<QByteArray> (context);
  16711. return QScriptValue((int)(self.at(argument<int> (0,context))));
  16712. }
  16713. QScriptValue QByteArray_setAt(QScriptContext*context,QScriptEngine*)
  16714. {
  16715. QByteArray self= getself<QByteArray> (context);
  16716. self[argument<int> (0,context)]= (char)(argument<int> (1,context));
  16717. return QScriptValue();
  16718. }
  16719. /*:106*//*107:*/
  16720. #line 2591 "./typica.w"
  16721. QScriptValue QByteArray_appendBytes(QScriptContext*context,QScriptEngine*engine)
  16722. {
  16723. QByteArray self= getself<QByteArray> (context);
  16724. QScriptValue value=
  16725. engine->toScriptValue<QByteArray> (
  16726. self.append(argument<QByteArray> (0,context)));
  16727. setQByteArrayProperties(value,engine);
  16728. return value;
  16729. }
  16730. QScriptValue QByteArray_appendString(QScriptContext*context,QScriptEngine*engine)
  16731. {
  16732. QByteArray self= getself<QByteArray> (context);
  16733. QScriptValue value= engine->toScriptValue<QByteArray> (
  16734. self.append(argument<QString> (0,context)));
  16735. setQByteArrayProperties(value,engine);
  16736. return value;
  16737. }
  16738. /*:107*//*108:*/
  16739. #line 2613 "./typica.w"
  16740. QScriptValue QByteArray_size(QScriptContext*context,QScriptEngine*)
  16741. {
  16742. QByteArray self= getself<QByteArray> (context);
  16743. return QScriptValue(self.size());
  16744. }
  16745. /*:108*//*109:*/
  16746. #line 2623 "./typica.w"
  16747. QScriptValue QByteArray_left(QScriptContext*context,QScriptEngine*engine)
  16748. {
  16749. QByteArray self= getself<QByteArray> (context);
  16750. QScriptValue value= engine->toScriptValue<QByteArray> (
  16751. self.left(argument<int> (0,context)));
  16752. setQByteArrayProperties(value,engine);
  16753. return value;
  16754. }
  16755. QScriptValue QByteArray_right(QScriptContext*context,QScriptEngine*engine)
  16756. {
  16757. QByteArray self= getself<QByteArray> (context);
  16758. QScriptValue value= engine->toScriptValue<QByteArray> (
  16759. self.right(argument<int> (0,context)));
  16760. setQByteArrayProperties(value,engine);
  16761. return value;
  16762. }
  16763. QScriptValue QByteArray_mid(QScriptContext*context,QScriptEngine*engine)
  16764. {
  16765. QByteArray self= getself<QByteArray> (context);
  16766. int length= -1;
  16767. if(context->argumentCount()> 1)
  16768. {
  16769. length= argument<int> (1,context);
  16770. }
  16771. QScriptValue value= engine->toScriptValue<QByteArray> (
  16772. self.mid(argument<int> (0,context),length));
  16773. setQByteArrayProperties(value,engine);
  16774. return value;
  16775. }
  16776. /*:109*//*110:*/
  16777. #line 2658 "./typica.w"
  16778. QScriptValue QByteArray_chop(QScriptContext*context,QScriptEngine*)
  16779. {
  16780. QByteArray self= getself<QByteArray> (context);
  16781. self.chop(argument<int> (0,context));
  16782. return QScriptValue();
  16783. }
  16784. QScriptValue QByteArray_remove(QScriptContext*context,QScriptEngine*engine)
  16785. {
  16786. QByteArray self= getself<QByteArray> (context);
  16787. QScriptValue value= engine->toScriptValue<QByteArray> (
  16788. self.remove(argument<int> (0,context),argument<int> (1,context)));
  16789. setQByteArrayProperties(value,engine);
  16790. return value;
  16791. }
  16792. /*:110*//*111:*/
  16793. #line 2681 "./typica.w"
  16794. QScriptValue QByteArray_toInt8(QScriptContext*context,QScriptEngine*)
  16795. {
  16796. QByteArray self= getself<QByteArray> (context);
  16797. int value= 0;
  16798. char*bytes= (char*)&value;
  16799. bytes[0]= self[0];
  16800. return QScriptValue(value);
  16801. }
  16802. QScriptValue QByteArray_toInt16(QScriptContext*context,QScriptEngine*)
  16803. {
  16804. QByteArray self= getself<QByteArray> (context);
  16805. int value= 0;
  16806. char*bytes= (char*)&value;
  16807. bytes[0]= self[0];
  16808. bytes[1]= self[1];
  16809. return QScriptValue(value);
  16810. }
  16811. QScriptValue QByteArray_toInt32(QScriptContext*context,QScriptEngine*)
  16812. {
  16813. QByteArray self= getself<QByteArray> (context);
  16814. int value= 0;
  16815. char*bytes= (char*)&value;
  16816. bytes[0]= self[0];
  16817. bytes[1]= self[1];
  16818. bytes[2]= self[2];
  16819. bytes[3]= self[3];
  16820. return QScriptValue(value);
  16821. }
  16822. /*:111*//*112:*/
  16823. #line 2717 "./typica.w"
  16824. QScriptValue QByteArray_toFloat(QScriptContext*context,QScriptEngine*)
  16825. {
  16826. QByteArray self= getself<QByteArray> (context);
  16827. float value= 0.0;
  16828. char*bytes= (char*)&value;
  16829. bytes[0]= self[0];
  16830. bytes[1]= self[1];
  16831. bytes[2]= self[2];
  16832. bytes[3]= self[3];
  16833. return QScriptValue(value);
  16834. }
  16835. QScriptValue QByteArray_toDouble(QScriptContext*context,QScriptEngine*)
  16836. {
  16837. QByteArray self= getself<QByteArray> (context);
  16838. double value= 0.0;
  16839. char*bytes= (char*)&value;
  16840. bytes[0]= self[0];
  16841. bytes[1]= self[1];
  16842. bytes[2]= self[2];
  16843. bytes[3]= self[3];
  16844. bytes[4]= self[4];
  16845. bytes[5]= self[5];
  16846. bytes[6]= self[6];
  16847. bytes[7]= self[7];
  16848. return QScriptValue(value);
  16849. }
  16850. /*:112*//*115:*/
  16851. #line 2772 "./typica.w"
  16852. QScriptValue bytesFromInt8(QScriptContext*context,QScriptEngine*engine)
  16853. {
  16854. qint8 value= (qint8)(argument<int> (0,context));
  16855. char*bytes= (char*)&value;
  16856. QByteArray retval;
  16857. retval.resize(1);
  16858. retval[0]= bytes[0];
  16859. QScriptValue v= engine->toScriptValue<QByteArray> (retval);
  16860. setQByteArrayProperties(v,engine);
  16861. return v;
  16862. }
  16863. QScriptValue bytesFromInt16(QScriptContext*context,QScriptEngine*engine)
  16864. {
  16865. qint16 value= (qint16)(argument<int> (0,context));
  16866. char*bytes= (char*)&value;
  16867. QByteArray retval;
  16868. retval.resize(2);
  16869. retval[0]= bytes[0];
  16870. retval[1]= bytes[1];
  16871. QScriptValue v= engine->toScriptValue<QByteArray> (retval);
  16872. setQByteArrayProperties(v,engine);
  16873. return v;
  16874. }
  16875. QScriptValue bytesFromInt32(QScriptContext*context,QScriptEngine*engine)
  16876. {
  16877. qint32 value= (qint32)(argument<int> (0,context));
  16878. char*bytes= (char*)&value;
  16879. QByteArray retval;
  16880. retval.resize(4);
  16881. retval[0]= bytes[0];
  16882. retval[1]= bytes[1];
  16883. retval[2]= bytes[2];
  16884. retval[3]= bytes[3];
  16885. QScriptValue v= engine->toScriptValue<QByteArray> (retval);
  16886. setQByteArrayProperties(v,engine);
  16887. return v;
  16888. }
  16889. QScriptValue bytesFromFloat(QScriptContext*context,QScriptEngine*engine)
  16890. {
  16891. float value= (float)(argument<double> (0,context));
  16892. char*bytes= (char*)&value;
  16893. QByteArray retval;
  16894. retval.resize(4);
  16895. retval[0]= bytes[0];
  16896. retval[1]= bytes[1];
  16897. retval[2]= bytes[2];
  16898. retval[3]= bytes[3];
  16899. QScriptValue v= engine->toScriptValue<QByteArray> (retval);
  16900. setQByteArrayProperties(v,engine);
  16901. return v;
  16902. }
  16903. QScriptValue bytesFromDouble(QScriptContext*context,QScriptEngine*engine)
  16904. {
  16905. double value= (double)(argument<double> (0,context));
  16906. char*bytes= (char*)&value;
  16907. QByteArray retval;
  16908. retval.resize(8);
  16909. retval[0]= bytes[0];
  16910. retval[1]= bytes[1];
  16911. retval[2]= bytes[2];
  16912. retval[3]= bytes[3];
  16913. retval[4]= bytes[4];
  16914. retval[5]= bytes[5];
  16915. retval[6]= bytes[6];
  16916. retval[7]= bytes[7];
  16917. QScriptValue v= engine->toScriptValue<QByteArray> (retval);
  16918. setQByteArrayProperties(v,engine);
  16919. return v;
  16920. }
  16921. /*:115*//*118:*/
  16922. #line 2869 "./typica.w"
  16923. QScriptValue constructQBuffer(QScriptContext*context,QScriptEngine*engine)
  16924. {
  16925. QByteArray*array= new QByteArray(argument<QString> (0,context).toAscii());
  16926. QScriptValue object= engine->newQObject(new QBuffer(array));
  16927. setQBufferProperties(object,engine);
  16928. return object;
  16929. }
  16930. void setQBufferProperties(QScriptValue value,QScriptEngine*engine)
  16931. {
  16932. setQIODeviceProperties(value,engine);
  16933. value.setProperty("setData",engine->newFunction(QBuffer_setData));
  16934. }
  16935. QScriptValue QBuffer_setData(QScriptContext*context,QScriptEngine*)
  16936. {
  16937. QBuffer*self= getself<QBuffer*> (context);
  16938. self->setData(argument<QString> (0,context).toAscii());
  16939. return QScriptValue();
  16940. }
  16941. /*:118*//*121:*/
  16942. #line 2918 "./typica.w"
  16943. QScriptValue constructXQuery(QScriptContext*,QScriptEngine*engine)
  16944. {
  16945. QScriptValue object= engine->toScriptValue<void*> (new QXmlQuery);
  16946. setXQueryProperties(object,engine);
  16947. return object;
  16948. }
  16949. QScriptValue XQuery_invalidate(QScriptContext*context,QScriptEngine*)
  16950. {
  16951. QXmlQuery*self= getself<QXmlQuery*> (context);
  16952. delete self;
  16953. return QScriptValue();
  16954. }
  16955. void setXQueryProperties(QScriptValue value,QScriptEngine*engine)
  16956. {
  16957. value.setProperty("bind",engine->newFunction(XQuery_bind));
  16958. value.setProperty("exec",engine->newFunction(XQuery_exec));
  16959. value.setProperty("setQuery",engine->newFunction(XQuery_setQuery));
  16960. value.setProperty("invalidate",engine->newFunction(XQuery_invalidate));
  16961. }
  16962. /*:121*//*122:*/
  16963. #line 2944 "./typica.w"
  16964. QScriptValue XQuery_bind(QScriptContext*context,QScriptEngine*)
  16965. {
  16966. QXmlQuery*self= getself<QXmlQuery*> (context);
  16967. QIODevice*buffer= argument<QIODevice*> (1,context);
  16968. self->bindVariable(argument<QString> (0,context),buffer);
  16969. return QScriptValue();
  16970. }
  16971. /*:122*//*123:*/
  16972. #line 2955 "./typica.w"
  16973. QScriptValue XQuery_setQuery(QScriptContext*context,QScriptEngine*)
  16974. {
  16975. QXmlQuery*self= getself<QXmlQuery*> (context);
  16976. self->setQuery(argument<QString> (0,context));
  16977. return QScriptValue();
  16978. }
  16979. /*:123*//*124:*/
  16980. #line 2965 "./typica.w"
  16981. QScriptValue XQuery_exec(QScriptContext*context,QScriptEngine*)
  16982. {
  16983. QXmlQuery*self= getself<QXmlQuery*> (context);
  16984. QString result;
  16985. self->evaluateTo(&result);
  16986. return QScriptValue(result);
  16987. }
  16988. /*:124*//*127:*/
  16989. #line 3020 "./typica.w"
  16990. QScriptValue constructXmlWriter(QScriptContext*context,QScriptEngine*engine)
  16991. {
  16992. QXmlStreamWriter*retval;
  16993. if(context->argumentCount()==1)
  16994. {
  16995. retval= new QXmlStreamWriter(argument<QIODevice*> (0,context));
  16996. }
  16997. else
  16998. {
  16999. retval= new QXmlStreamWriter;
  17000. }
  17001. QScriptValue object= engine->toScriptValue<void*> (retval);
  17002. setXmlWriterProperties(object,engine);
  17003. return object;
  17004. }
  17005. void setXmlWriterProperties(QScriptValue value,QScriptEngine*engine)
  17006. {
  17007. value.setProperty("setDevice",engine->newFunction(XmlWriter_setDevice));
  17008. value.setProperty("writeAttribute",
  17009. engine->newFunction(XmlWriter_writeAttribute));
  17010. value.setProperty("writeCDATA",engine->newFunction(XmlWriter_writeCDATA));
  17011. value.setProperty("writeCharacters",
  17012. engine->newFunction(XmlWriter_writeCharacters));
  17013. value.setProperty("writeDTD",engine->newFunction(XmlWriter_writeDTD));
  17014. value.setProperty("writeEmptyElement",
  17015. engine->newFunction(XmlWriter_writeEmptyElement));
  17016. value.setProperty("writeEndDocument",
  17017. engine->newFunction(XmlWriter_writeEndDocument));
  17018. value.setProperty("writeEndElement",
  17019. engine->newFunction(XmlWriter_writeEndElement));
  17020. value.setProperty("writeEntityReference",
  17021. engine->newFunction(XmlWriter_writeEntityReference));
  17022. value.setProperty("writeProcessingInstruction",
  17023. engine->newFunction(XmlWriter_writeProcessingInstruction));
  17024. value.setProperty("writeStartDocument",
  17025. engine->newFunction(XmlWriter_writeStartDocument));
  17026. value.setProperty("writeStartElement",
  17027. engine->newFunction(XmlWriter_writeStartElement));
  17028. value.setProperty("writeTextElement",
  17029. engine->newFunction(XmlWriter_writeTextElement));
  17030. }
  17031. /*:127*//*128:*/
  17032. #line 3067 "./typica.w"
  17033. QScriptValue XmlWriter_setDevice(QScriptContext*context,QScriptEngine*)
  17034. {
  17035. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  17036. QIODevice*device= argument<QIODevice*> (0,context);
  17037. self->setDevice(device);
  17038. return QScriptValue();
  17039. }
  17040. /*:128*//*129:*/
  17041. #line 3081 "./typica.w"
  17042. QScriptValue XmlWriter_writeStartDocument(QScriptContext*context,
  17043. QScriptEngine*)
  17044. {
  17045. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  17046. self->writeStartDocument(argument<QString> (0,context));
  17047. return QScriptValue();
  17048. }
  17049. QScriptValue XmlWriter_writeEndDocument(QScriptContext*context,
  17050. QScriptEngine*)
  17051. {
  17052. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  17053. self->writeEndDocument();
  17054. return QScriptValue();
  17055. }
  17056. /*:129*//*130:*/
  17057. #line 3100 "./typica.w"
  17058. QScriptValue XmlWriter_writeDTD(QScriptContext*context,QScriptEngine*)
  17059. {
  17060. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  17061. self->writeDTD(argument<QString> (0,context));
  17062. return QScriptValue();
  17063. }
  17064. /*:130*//*131:*/
  17065. #line 3111 "./typica.w"
  17066. QScriptValue XmlWriter_writeStartElement(QScriptContext*context,
  17067. QScriptEngine*)
  17068. {
  17069. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  17070. self->writeStartElement(argument<QString> (0,context));
  17071. return QScriptValue();
  17072. }
  17073. QScriptValue XmlWriter_writeAttribute(QScriptContext*context,QScriptEngine*)
  17074. {
  17075. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  17076. self->writeAttribute(argument<QString> (0,context),
  17077. argument<QString> (1,context));
  17078. return QScriptValue();
  17079. }
  17080. QScriptValue XmlWriter_writeCharacters(QScriptContext*context,QScriptEngine*)
  17081. {
  17082. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  17083. self->writeCharacters(argument<QString> (0,context));
  17084. return QScriptValue();
  17085. }
  17086. QScriptValue XmlWriter_writeEndElement(QScriptContext*context,QScriptEngine*)
  17087. {
  17088. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  17089. self->writeEndElement();
  17090. return QScriptValue();
  17091. }
  17092. /*:131*//*132:*/
  17093. #line 3147 "./typica.w"
  17094. QScriptValue XmlWriter_writeEmptyElement(QScriptContext*context,
  17095. QScriptEngine*)
  17096. {
  17097. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  17098. self->writeEmptyElement(argument<QString> (0,context));
  17099. return QScriptValue();
  17100. }
  17101. QScriptValue XmlWriter_writeTextElement(QScriptContext*context,
  17102. QScriptEngine*)
  17103. {
  17104. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  17105. self->writeTextElement(argument<QString> (0,context),
  17106. argument<QString> (1,context));
  17107. return QScriptValue();
  17108. }
  17109. /*:132*//*133:*/
  17110. #line 3168 "./typica.w"
  17111. QScriptValue XmlWriter_writeCDATA(QScriptContext*context,QScriptEngine*)
  17112. {
  17113. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  17114. self->writeCDATA(argument<QString> (0,context));
  17115. return QScriptValue();
  17116. }
  17117. QScriptValue XmlWriter_writeEntityReference(QScriptContext*context,
  17118. QScriptEngine*)
  17119. {
  17120. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  17121. self->writeEntityReference(argument<QString> (0,context));
  17122. return QScriptValue();
  17123. }
  17124. QScriptValue XmlWriter_writeProcessingInstruction(QScriptContext*context,
  17125. QScriptEngine*)
  17126. {
  17127. QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
  17128. self->writeProcessingInstruction(argument<QString> (0,context),
  17129. argument<QString> (1,context));
  17130. return QScriptValue();
  17131. }
  17132. /*:133*//*136:*/
  17133. #line 3227 "./typica.w"
  17134. QScriptValue constructXmlReader(QScriptContext*context,QScriptEngine*engine)
  17135. {
  17136. QXmlStreamReader*retval=
  17137. new QXmlStreamReader(argument<QIODevice*> (0,context));
  17138. QScriptValue object= engine->toScriptValue<void*> (retval);
  17139. setXmlReaderProperties(object,engine);
  17140. return object;
  17141. }
  17142. void setXmlReaderProperties(QScriptValue value,QScriptEngine*engine)
  17143. {
  17144. value.setProperty("atEnd",engine->newFunction(XmlReader_atEnd));
  17145. value.setProperty("attribute",engine->newFunction(XmlReader_attribute));
  17146. value.setProperty("hasAttribute",
  17147. engine->newFunction(XmlReader_hasAttribute));
  17148. value.setProperty("isDTD",engine->newFunction(XmlReader_isDTD));
  17149. value.setProperty("isStartElement",
  17150. engine->newFunction(XmlReader_isStartElement));
  17151. value.setProperty("name",engine->newFunction(XmlReader_name));
  17152. value.setProperty("readElementText",
  17153. engine->newFunction(XmlReader_readElementText));
  17154. value.setProperty("readNext",
  17155. engine->newFunction(XmlReader_readNext));
  17156. value.setProperty("text",engine->newFunction(XmlReader_text));
  17157. }
  17158. /*:136*//*137:*/
  17159. #line 3257 "./typica.w"
  17160. QScriptValue XmlReader_attribute(QScriptContext*context,QScriptEngine*)
  17161. {
  17162. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  17163. QString retval=
  17164. self->attributes().value(argument<QString> (0,context)).toString();
  17165. return QScriptValue(retval);
  17166. }
  17167. QScriptValue XmlReader_hasAttribute(QScriptContext*context,QScriptEngine*)
  17168. {
  17169. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  17170. bool retval=
  17171. self->attributes().hasAttribute(argument<QString> (0,context));
  17172. return QScriptValue(retval);
  17173. }
  17174. /*:137*//*138:*/
  17175. #line 3277 "./typica.w"
  17176. QScriptValue XmlReader_atEnd(QScriptContext*context,QScriptEngine*)
  17177. {
  17178. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  17179. return QScriptValue(self->atEnd());
  17180. }
  17181. QScriptValue XmlReader_isDTD(QScriptContext*context,QScriptEngine*)
  17182. {
  17183. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  17184. return QScriptValue(self->isDTD());
  17185. }
  17186. QScriptValue XmlReader_isStartElement(QScriptContext*context,QScriptEngine*)
  17187. {
  17188. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  17189. return QScriptValue(self->isStartElement());
  17190. }
  17191. /*:138*//*139:*/
  17192. #line 3298 "./typica.w"
  17193. QScriptValue XmlReader_readNext(QScriptContext*context,QScriptEngine*)
  17194. {
  17195. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  17196. self->readNext();
  17197. return QScriptValue();
  17198. }
  17199. /*:139*//*140:*/
  17200. #line 3308 "./typica.w"
  17201. QScriptValue XmlReader_name(QScriptContext*context,QScriptEngine*)
  17202. {
  17203. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  17204. return QScriptValue(self->name().toString());
  17205. }
  17206. QScriptValue XmlReader_readElementText(QScriptContext*context,QScriptEngine*)
  17207. {
  17208. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  17209. return QScriptValue(self->readElementText());
  17210. }
  17211. QScriptValue XmlReader_text(QScriptContext*context,QScriptEngine*)
  17212. {
  17213. QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
  17214. return QScriptValue(self->text().toString());
  17215. }
  17216. /*:140*//*143:*/
  17217. #line 3350 "./typica.w"
  17218. void setQSettingsProperties(QScriptValue value,QScriptEngine*engine)
  17219. {
  17220. setQObjectProperties(value,engine);
  17221. value.setProperty("value",engine->newFunction(QSettings_value));
  17222. value.setProperty("setValue",engine->newFunction(QSettings_setValue));
  17223. }
  17224. /*:143*//*144:*/
  17225. #line 3362 "./typica.w"
  17226. QScriptValue QSettings_value(QScriptContext*context,QScriptEngine*engine)
  17227. {
  17228. QScriptValue object;
  17229. if(context->argumentCount()==1||context->argumentCount()==2)
  17230. {
  17231. QSettings settings;
  17232. QString key= argument<QString> (0,context);
  17233. QVariant value;
  17234. QVariant retval;
  17235. if(context->argumentCount()> 1)
  17236. {
  17237. value= argument<QVariant> (1,context);
  17238. retval= settings.value(key,value);
  17239. }
  17240. else
  17241. {
  17242. retval= settings.value(key);
  17243. }
  17244. object= engine->newVariant(retval);
  17245. }
  17246. else
  17247. {
  17248. context->throwError("Incorrect number of arguments passed to "
  17249. "QSettings::value(). This method takes one "
  17250. "string and one optional variant type.");
  17251. }
  17252. return object;
  17253. }
  17254. QScriptValue QSettings_setValue(QScriptContext*context,QScriptEngine*)
  17255. {
  17256. if(context->argumentCount()==2)
  17257. {
  17258. QSettings settings;
  17259. QString key= argument<QString> (0,context);
  17260. QVariant value= argument<QVariant> (1,context);
  17261. settings.setValue(key,value);
  17262. }
  17263. else
  17264. {
  17265. context->throwError("Incorrect number of arguments passed to "
  17266. "QSettings::setValue(). This method takes one "
  17267. "string and one variant type for a total of two "
  17268. "arguments.");
  17269. }
  17270. return QScriptValue();
  17271. }
  17272. /*:144*//*147:*/
  17273. #line 3431 "./typica.w"
  17274. QScriptValue constructQLCDNumber(QScriptContext*,QScriptEngine*engine)
  17275. {
  17276. QScriptValue object= engine->newQObject(new QLCDNumber());
  17277. setQLCDNumberProperties(object,engine);
  17278. return object;
  17279. }
  17280. void setQLCDNumberProperties(QScriptValue value,QScriptEngine*engine)
  17281. {
  17282. setQFrameProperties(value,engine);
  17283. }
  17284. /*:147*//*150:*/
  17285. #line 3489 "./typica.w"
  17286. QScriptValue constructQTime(QScriptContext*context,
  17287. QScriptEngine*engine)
  17288. {
  17289. QScriptValue object;
  17290. if(context->argumentCount()==0||
  17291. (context->argumentCount()>=2&&context->argumentCount()<=4))
  17292. {
  17293. int arg1= 0;
  17294. int arg2= 0;
  17295. int arg3= 0;
  17296. int arg4= 0;
  17297. switch(context->argumentCount())
  17298. {
  17299. case 4:
  17300. arg4= argument<int> (3,context);
  17301. case 3:
  17302. arg3= argument<int> (2,context);
  17303. case 2:
  17304. arg2= argument<int> (1,context);
  17305. arg1= argument<int> (0,context);
  17306. default:
  17307. break;
  17308. }
  17309. if(context->argumentCount())
  17310. {
  17311. object= engine->toScriptValue<QTime> (QTime(arg1,arg2,arg3,
  17312. arg4));
  17313. }
  17314. else
  17315. {
  17316. object= engine->toScriptValue<QTime> (QTime());
  17317. }
  17318. setQTimeProperties(object,engine);
  17319. }
  17320. else
  17321. {
  17322. context->throwError("Incorrect number of arguments passed to "
  17323. "QTime::QTime(). This method takes zero, two, "
  17324. "three, or four integer arguments.");
  17325. }
  17326. return object;
  17327. }
  17328. /*:150*//*151:*/
  17329. #line 3537 "./typica.w"
  17330. void setQTimeProperties(QScriptValue value,QScriptEngine*engine)
  17331. {
  17332. value.setProperty("addMSecs",engine->newFunction(QTime_addMSecs));
  17333. value.setProperty("addSecs",engine->newFunction(QTime_addSecs));
  17334. value.setProperty("elapsed",engine->newFunction(QTime_elapsed));
  17335. value.setProperty("hour",engine->newFunction(QTime_hour));
  17336. value.setProperty("isNull",engine->newFunction(QTime_isNull));
  17337. value.setProperty("isValid",engine->newFunction(QTime_isValid));
  17338. value.setProperty("minute",engine->newFunction(QTime_minute));
  17339. value.setProperty("msec",engine->newFunction(QTime_msec));
  17340. value.setProperty("msecsTo",engine->newFunction(QTime_msecsTo));
  17341. value.setProperty("restart",engine->newFunction(QTime_restart));
  17342. value.setProperty("second",engine->newFunction(QTime_second));
  17343. value.setProperty("secsTo",engine->newFunction(QTime_secsTo));
  17344. value.setProperty("setHMS",engine->newFunction(QTime_setHMS));
  17345. value.setProperty("start",engine->newFunction(QTime_start));
  17346. value.setProperty("toString",engine->newFunction(QTime_toString));
  17347. value.setProperty("currentTime",engine->newFunction(QTime_currentTime));
  17348. value.setProperty("fromString",engine->newFunction(QTime_fromString));
  17349. value.setProperty("valueOf",engine->newFunction(QTime_valueOf));
  17350. }
  17351. /*:151*//*152:*/
  17352. #line 3566 "./typica.w"
  17353. QScriptValue QTime_valueOf(QScriptContext*context,QScriptEngine*)
  17354. {
  17355. QTime self= getself<QTime> (context);
  17356. int retval= (self.hour()*60*60*1000)+(self.minute()*60*1000)+
  17357. (self.second()*1000)+self.msec();
  17358. return QScriptValue(retval);
  17359. }
  17360. /*:152*//*153:*/
  17361. #line 3580 "./typica.w"
  17362. QScriptValue QTime_addMSecs(QScriptContext*context,QScriptEngine*engine)
  17363. {
  17364. QTime time;
  17365. QScriptValue retval;
  17366. if(context->argumentCount()==1)
  17367. {
  17368. QTime self= getself<QTime> (context);
  17369. time= self.addMSecs(argument<int> (0,context));
  17370. retval= engine->toScriptValue<QTime> (time);
  17371. setQTimeProperties(retval,engine);
  17372. }
  17373. else
  17374. {
  17375. context->throwError("Incorrect number of arguments passed to "
  17376. "QTime::addMSecs(). This method takes one "
  17377. "integer as an argument.");
  17378. }
  17379. return retval;
  17380. }
  17381. QScriptValue QTime_addSecs(QScriptContext*context,QScriptEngine*engine)
  17382. {
  17383. QTime time;
  17384. QScriptValue retval;
  17385. if(context->argumentCount()==1)
  17386. {
  17387. QTime self= getself<QTime> (context);
  17388. time= self.addSecs(argument<int> (0,context));
  17389. retval= engine->toScriptValue<QTime> (time);
  17390. setQTimeProperties(retval,engine);
  17391. }
  17392. else
  17393. {
  17394. context->throwError("Incorrect number of arguments passed to "
  17395. "QTime::addSecs(). This method takes one "
  17396. "integer as an argument.");
  17397. }
  17398. return retval;
  17399. }
  17400. /*:153*//*154:*/
  17401. #line 3623 "./typica.w"
  17402. QScriptValue QTime_elapsed(QScriptContext*context,QScriptEngine*engine)
  17403. {
  17404. QScriptValue retval;
  17405. if(context->argumentCount()==0)
  17406. {
  17407. QTime self= getself<QTime> (context);
  17408. retval= QScriptValue(engine,self.elapsed());
  17409. }
  17410. else
  17411. {
  17412. context->throwError("Incorrect number of arguments passed to "
  17413. "QTime::elapsed(). This method takes no "
  17414. "arguments.");
  17415. }
  17416. return retval;
  17417. }
  17418. /*:154*//*155:*/
  17419. #line 3644 "./typica.w"
  17420. QScriptValue QTime_hour(QScriptContext*context,QScriptEngine*engine)
  17421. {
  17422. QScriptValue retval;
  17423. if(context->argumentCount()==0)
  17424. {
  17425. QTime self= getself<QTime> (context);
  17426. retval= QScriptValue(engine,self.hour());
  17427. }
  17428. else
  17429. {
  17430. context->throwError("Incorrect number of arguments passed to "
  17431. "QTime::hour(). This method takes no "
  17432. "arguments.");
  17433. }
  17434. return retval;
  17435. }
  17436. /*:155*//*156:*/
  17437. #line 3664 "./typica.w"
  17438. QScriptValue QTime_minute(QScriptContext*context,QScriptEngine*engine)
  17439. {
  17440. QScriptValue retval;
  17441. if(context->argumentCount()==0)
  17442. {
  17443. QTime self= getself<QTime> (context);
  17444. retval= QScriptValue(engine,self.minute());
  17445. }
  17446. else
  17447. {
  17448. context->throwError("Incorrect number of arguments passed to "
  17449. "QTime::minute(). This method takes no "
  17450. "arguments.");
  17451. }
  17452. return retval;
  17453. }
  17454. QScriptValue QTime_second(QScriptContext*context,QScriptEngine*engine)
  17455. {
  17456. QScriptValue retval;
  17457. if(context->argumentCount()==0)
  17458. {
  17459. QTime self= getself<QTime> (context);
  17460. retval= QScriptValue(engine,self.second());
  17461. }
  17462. else
  17463. {
  17464. context->throwError("Incorrect number of arguments passed to "
  17465. "QTime::second(). This method takes no "
  17466. "arguments.");
  17467. }
  17468. return retval;
  17469. }
  17470. QScriptValue QTime_msec(QScriptContext*context,QScriptEngine*engine)
  17471. {
  17472. QScriptValue retval;
  17473. if(context->argumentCount()==0)
  17474. {
  17475. QTime self= getself<QTime> (context);
  17476. retval= QScriptValue(engine,self.msec());
  17477. }
  17478. else
  17479. {
  17480. context->throwError("Incorrect number of arguments passed to "
  17481. "QTime::msec(). This method takes no "
  17482. "arguments.");
  17483. }
  17484. return retval;
  17485. }
  17486. /*:156*//*157:*/
  17487. #line 3720 "./typica.w"
  17488. QScriptValue QTime_isNull(QScriptContext*context,QScriptEngine*engine)
  17489. {
  17490. QScriptValue retval;
  17491. if(context->argumentCount()==0)
  17492. {
  17493. QTime self= getself<QTime> (context);
  17494. retval= QScriptValue(engine,self.isNull());
  17495. }
  17496. else
  17497. {
  17498. context->throwError("Incorrect number of arguments passed to "
  17499. "QTime::isNull(). This method takes no "
  17500. "arguments.");
  17501. }
  17502. return retval;
  17503. }
  17504. QScriptValue QTime_isValid(QScriptContext*context,QScriptEngine*engine)
  17505. {
  17506. QScriptValue retval;
  17507. if(context->argumentCount()==0)
  17508. {
  17509. QTime self= getself<QTime> (context);
  17510. retval= QScriptValue(engine,self.isValid());
  17511. }
  17512. else
  17513. {
  17514. context->throwError("Incorrect number of arguments passed to "
  17515. "QTime::isValid(). This method takes no "
  17516. "arguments.");
  17517. }
  17518. return retval;
  17519. }
  17520. /*:157*//*158:*/
  17521. #line 3758 "./typica.w"
  17522. QScriptValue QTime_msecsTo(QScriptContext*context,QScriptEngine*engine)
  17523. {
  17524. QScriptValue retval;
  17525. if(context->argumentCount()==1)
  17526. {
  17527. QTime self= getself<QTime> (context);
  17528. QTime arg= argument<QVariant> (0,context).toTime();
  17529. retval= QScriptValue(engine,self.msecsTo(arg));
  17530. }
  17531. else
  17532. {
  17533. context->throwError("Incorrect number of arguments passed to "
  17534. "QTime::msecsTo(). This method takes one QTime.");
  17535. }
  17536. return retval;
  17537. }
  17538. QScriptValue QTime_secsTo(QScriptContext*context,QScriptEngine*engine)
  17539. {
  17540. QScriptValue retval;
  17541. if(context->argumentCount()==1)
  17542. {
  17543. QTime self= getself<QTime> (context);
  17544. QTime arg= argument<QVariant> (0,context).toTime();
  17545. retval= QScriptValue(engine,self.secsTo(arg));
  17546. }
  17547. else
  17548. {
  17549. context->throwError("Incorrect number of arguments passed to "
  17550. "QTime::secsTo(). This method takes one QTime.");
  17551. }
  17552. return retval;
  17553. }
  17554. /*:158*//*159:*/
  17555. #line 3797 "./typica.w"
  17556. QScriptValue QTime_restart(QScriptContext*context,QScriptEngine*engine)
  17557. {
  17558. QScriptValue retval;
  17559. if(context->argumentCount()==0)
  17560. {
  17561. QTime self= getself<QTime> (context);
  17562. retval= QScriptValue(engine,self.restart());
  17563. }
  17564. else
  17565. {
  17566. context->throwError("Incorrect number of arguments passed to "
  17567. "QTime::restart(). This method takes no "
  17568. "arguments.");
  17569. }
  17570. return retval;
  17571. }
  17572. QScriptValue QTime_start(QScriptContext*context,QScriptEngine*)
  17573. {
  17574. if(context->argumentCount()==0)
  17575. {
  17576. QTime self= getself<QTime> (context);
  17577. self.start();
  17578. }
  17579. else
  17580. {
  17581. context->throwError("Incorrect number of arguments passed to "
  17582. "QTime::start(). This method takes no arguments.");
  17583. }
  17584. return QScriptValue();
  17585. }
  17586. /*:159*//*160:*/
  17587. #line 3833 "./typica.w"
  17588. QScriptValue QTime_setHMS(QScriptContext*context,QScriptEngine*engine)
  17589. {
  17590. QScriptValue retval;
  17591. if(context->argumentCount()==3||context->argumentCount()==4)
  17592. {
  17593. QTime self= getself<QTime> (context);
  17594. int arg1= 0;
  17595. int arg2= 0;
  17596. int arg3= 0;
  17597. int arg4= 0;
  17598. switch(context->argumentCount())
  17599. {
  17600. case 4:
  17601. arg4= argument<int> (3,context);
  17602. case 3:
  17603. arg3= argument<int> (2,context);
  17604. arg2= argument<int> (1,context);
  17605. arg1= argument<int> (0,context);
  17606. default:
  17607. break;
  17608. }
  17609. retval= QScriptValue(engine,self.setHMS(arg1,arg2,arg3,arg4));
  17610. }
  17611. else
  17612. {
  17613. context->throwError("Incorrect number of arguments passed to "
  17614. "QTime::setHMS(). This method takes three or "
  17615. "four integer arguments.");
  17616. }
  17617. return retval;
  17618. }
  17619. /*:160*//*161:*/
  17620. #line 3869 "./typica.w"
  17621. QScriptValue QTime_toString(QScriptContext*context,QScriptEngine*engine)
  17622. {
  17623. QScriptValue retval;
  17624. if(context->argumentCount()==1)
  17625. {
  17626. QTime self= getself<QTime> (context);
  17627. retval= QScriptValue(engine,self.toString(argument<QString> (0,context)));
  17628. }
  17629. else
  17630. {
  17631. context->throwError("Incorrect number of arguments passed to "
  17632. "QTime::toString(). This method takes one QString "
  17633. "as an argument.");
  17634. }
  17635. return retval;
  17636. }
  17637. /*:161*//*162:*/
  17638. #line 3890 "./typica.w"
  17639. QScriptValue QTime_currentTime(QScriptContext*,QScriptEngine*engine)
  17640. {
  17641. QScriptValue object;
  17642. object= engine->toScriptValue<QTime> (QTime::currentTime());
  17643. setQTimeProperties(object,engine);
  17644. return object;
  17645. }
  17646. QScriptValue QTime_fromString(QScriptContext*context,QScriptEngine*engine)
  17647. {
  17648. QScriptValue object;
  17649. if(context->argumentCount()==2)
  17650. {
  17651. QString time= argument<QString> (0,context);
  17652. QString format= argument<QString> (1,context);
  17653. object= engine->toScriptValue<QTime> (QTime::fromString(time,format));
  17654. setQTimeProperties(object,engine);
  17655. }
  17656. else
  17657. {
  17658. context->throwError("Incorrect number of arguments passed to "
  17659. "QTime::fromString(). This method takes two "
  17660. "string arguments.");
  17661. }
  17662. return object;
  17663. }
  17664. /*:162*//*163:*/
  17665. #line 3921 "./typica.w"
  17666. template<> QTime argument(int arg,QScriptContext*context)
  17667. {
  17668. return qscriptvalue_cast<QTime> (context->argument(arg));
  17669. }
  17670. /*:163*//*165:*/
  17671. #line 3939 "./typica.w"
  17672. void setQAbstractScrollAreaProperties(QScriptValue value,QScriptEngine*engine)
  17673. {
  17674. setQFrameProperties(value,engine);
  17675. }
  17676. /*:165*//*167:*/
  17677. #line 3953 "./typica.w"
  17678. void setQAbstractItemViewProperties(QScriptValue value,QScriptEngine*engine)
  17679. {
  17680. setQAbstractScrollAreaProperties(value,engine);
  17681. }
  17682. /*:167*//*169:*/
  17683. #line 3967 "./typica.w"
  17684. void setQGraphicsViewProperties(QScriptValue value,QScriptEngine*engine)
  17685. {
  17686. setQAbstractScrollAreaProperties(value,engine);
  17687. }
  17688. void setQTableViewProperties(QScriptValue value,QScriptEngine*engine)
  17689. {
  17690. setQAbstractItemViewProperties(value,engine);
  17691. }
  17692. /*:169*//*172:*/
  17693. #line 4000 "./typica.w"
  17694. QScriptValue constructQPushButton(QScriptContext*,QScriptEngine*engine)
  17695. {
  17696. QScriptValue object= engine->newQObject(new QPushButton());
  17697. setQPushButtonProperties(object,engine);
  17698. return object;
  17699. }
  17700. void setQPushButtonProperties(QScriptValue value,QScriptEngine*engine)
  17701. {
  17702. setQAbstractButtonProperties(value,engine);
  17703. }
  17704. void setQAbstractButtonProperties(QScriptValue value,QScriptEngine*engine)
  17705. {
  17706. setQWidgetProperties(value,engine);
  17707. }
  17708. /*:172*//*179:*/
  17709. #line 4112 "./typica.w"
  17710. QScriptValue constructQSqlQuery(QScriptContext*,QScriptEngine*engine)
  17711. {
  17712. SqlQueryConnection*obj= new SqlQueryConnection();
  17713. QScriptValue object=
  17714. engine->toScriptValue<void*> (obj);
  17715. setQSqlQueryProperties(object,engine);
  17716. return object;
  17717. }
  17718. /*:179*//*180:*/
  17719. #line 4125 "./typica.w"
  17720. void setQSqlQueryProperties(QScriptValue value,QScriptEngine*engine)
  17721. {
  17722. value.setProperty("bind",engine->newFunction(QSqlQuery_bind));
  17723. value.setProperty("bindFileData",
  17724. engine->newFunction(QSqlQuery_bindFileData));
  17725. value.setProperty("bindDeviceData",
  17726. engine->newFunction(QSqlQuery_bindDeviceData));
  17727. value.setProperty("exec",engine->newFunction(QSqlQuery_exec));
  17728. value.setProperty("executedQuery",engine->newFunction(QSqlQuery_executedQuery));
  17729. value.setProperty("invalidate",engine->newFunction(QSqlQuery_invalidate));
  17730. value.setProperty("next",engine->newFunction(QSqlQuery_next));
  17731. value.setProperty("prepare",engine->newFunction(QSqlQuery_prepare));
  17732. value.setProperty("value",engine->newFunction(QSqlQuery_value));
  17733. }
  17734. /*:180*//*181:*/
  17735. #line 4143 "./typica.w"
  17736. QScriptValue QSqlQuery_exec(QScriptContext*context,QScriptEngine*engine)
  17737. {
  17738. QSqlQuery*q= getself<SqlQueryConnection*> (context)->operator->();
  17739. QScriptValue retval;
  17740. if(context->argumentCount()==1)
  17741. {
  17742. retval= QScriptValue(engine,
  17743. q->exec(argument<QString> (0,context)));
  17744. }
  17745. else
  17746. {
  17747. retval= QScriptValue(engine,q->exec());
  17748. }
  17749. if(q->lastError().isValid())
  17750. {
  17751. qDebug()<<q->lastQuery();
  17752. qDebug()<<q->lastError().text();
  17753. }
  17754. return retval;
  17755. }
  17756. QScriptValue QSqlQuery_executedQuery(QScriptContext*context,QScriptEngine*)
  17757. {
  17758. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  17759. return QScriptValue(query->lastQuery());
  17760. }
  17761. QScriptValue QSqlQuery_next(QScriptContext*context,QScriptEngine*engine)
  17762. {
  17763. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  17764. return QScriptValue(engine,query->next());
  17765. }
  17766. QScriptValue QSqlQuery_value(QScriptContext*context,QScriptEngine*engine)
  17767. {
  17768. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  17769. return QScriptValue(engine,
  17770. query->value(argument<int> (0,context)).toString());
  17771. }
  17772. /*:181*//*182:*/
  17773. #line 4187 "./typica.w"
  17774. QScriptValue QSqlQuery_prepare(QScriptContext*context,QScriptEngine*engine)
  17775. {
  17776. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  17777. return QScriptValue(engine,query->prepare(argument<QString> (0,context)));
  17778. }
  17779. QScriptValue QSqlQuery_bind(QScriptContext*context,QScriptEngine*)
  17780. {
  17781. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  17782. query->bindValue(argument<QString> (0,context),
  17783. argument<QVariant> (1,context));
  17784. return QScriptValue();
  17785. }
  17786. QScriptValue QSqlQuery_bindFileData(QScriptContext*context,
  17787. QScriptEngine*)
  17788. {
  17789. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  17790. QString placeholder= argument<QString> (0,context);
  17791. QString filename= argument<QString> (1,context);
  17792. QFile file(filename);
  17793. QByteArray data;
  17794. if(file.open(QIODevice::ReadOnly))
  17795. {
  17796. data= file.readAll();
  17797. file.close();
  17798. }
  17799. query->bindValue(placeholder,data);
  17800. return QScriptValue();
  17801. }
  17802. QScriptValue QSqlQuery_bindDeviceData(QScriptContext*context,
  17803. QScriptEngine*)
  17804. {
  17805. QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
  17806. QString placeholder= argument<QString> (0,context);
  17807. QIODevice*device= argument<QIODevice*> (1,context);
  17808. device->reset();
  17809. QByteArray data;
  17810. data= device->readAll();
  17811. query->bindValue(placeholder,data);
  17812. return QScriptValue();
  17813. }
  17814. /*:182*//*183:*/
  17815. #line 4239 "./typica.w"
  17816. QScriptValue QSqlQuery_invalidate(QScriptContext*context,QScriptEngine*)
  17817. {
  17818. SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
  17819. delete query;
  17820. return QScriptValue::UndefinedValue;
  17821. }
  17822. /*:183*//*186:*/
  17823. #line 4286 "./typica.w"
  17824. QScriptValue baseName(QScriptContext*context,QScriptEngine*engine)
  17825. {
  17826. QFileInfo info(argument<QString> (0,context));
  17827. QScriptValue retval(engine,info.baseName());
  17828. return retval;
  17829. }
  17830. QScriptValue dir(QScriptContext*context,QScriptEngine*engine)
  17831. {
  17832. QFileInfo info(argument<QString> (0,context));
  17833. QDir dir= info.dir();
  17834. QScriptValue retval(engine,dir.path());
  17835. return retval;
  17836. }
  17837. /*:186*//*187:*/
  17838. #line 4305 "./typica.w"
  17839. QScriptValue saveFileFromDatabase(QScriptContext*context,QScriptEngine*)
  17840. {
  17841. SqlQueryConnection h;
  17842. QSqlQuery*query= h.operator->();
  17843. QString q= "SELECT file FROM files WHERE id = :file";
  17844. query->prepare(q);
  17845. query->bindValue(":file",argument<int> (0,context));
  17846. query->exec();
  17847. query->next();
  17848. QByteArray array= query->value(0).toByteArray();
  17849. QFile file(argument<QString> (1,context));
  17850. file.open(QIODevice::WriteOnly);
  17851. file.write(array);
  17852. file.close();
  17853. return QScriptValue();
  17854. }
  17855. /*:187*//*188:*/
  17856. #line 4326 "./typica.w"
  17857. QScriptValue sqlToArray(QScriptContext*context,QScriptEngine*engine)
  17858. {
  17859. QString source= argument<QString> (0,context);
  17860. source.remove(0,1);
  17861. source.chop(1);
  17862. QStringList elements= source.split(",");
  17863. QString element;
  17864. QScriptValue dest= engine->newArray(elements.size());
  17865. int i= 0;
  17866. foreach(element,elements)
  17867. {
  17868. if(element.startsWith("\"")&&element.endsWith("\""))
  17869. {
  17870. element.chop(1);
  17871. element= element.remove(0,1);
  17872. }
  17873. dest.setProperty(i,QScriptValue(engine,element));
  17874. i++;
  17875. }
  17876. return dest;
  17877. }
  17878. /*:188*//*189:*/
  17879. #line 4352 "./typica.w"
  17880. QScriptValue setFont(QScriptContext*context,QScriptEngine*)
  17881. {
  17882. QString font= argument<QString> (0,context);
  17883. QString classname;
  17884. if(context->argumentCount()> 1)
  17885. {
  17886. classname= argument<QString> (1,context);
  17887. QApplication::setFont(QFont(font),classname.toLatin1().constData());
  17888. }
  17889. else
  17890. {
  17891. QApplication::setFont(QFont(font));
  17892. }
  17893. return QScriptValue();
  17894. }
  17895. /*:189*//*190:*/
  17896. #line 4372 "./typica.w"
  17897. QScriptValue annotationFromRecord(QScriptContext*context,QScriptEngine*)
  17898. {
  17899. SqlQueryConnection h;
  17900. QSqlQuery*query= h.operator->();
  17901. QString q= "SELECT file FROM files WHERE id = :file";
  17902. query->prepare(q);
  17903. query->bindValue(":file",argument<int> (0,context));
  17904. query->exec();
  17905. query->next();
  17906. QByteArray array= query->value(0).toByteArray();
  17907. QBuffer buffer(&array);
  17908. buffer.open(QIODevice::ReadOnly);
  17909. QXmlQuery xquery;
  17910. xquery.bindVariable("profile",&buffer);
  17911. QString xq;
  17912. xq= "for $b in doc($profile) //tuple where exists($b/annotation) return $b";
  17913. xquery.setQuery(xq);
  17914. QString result;
  17915. xquery.evaluateTo(&result);
  17916. return QScriptValue(result);
  17917. }
  17918. /*:190*//*191:*/
  17919. #line 4399 "./typica.w"
  17920. QScriptValue setTabOrder(QScriptContext*context,QScriptEngine*)
  17921. {
  17922. QWidget::setTabOrder(argument<QWidget*> (0,context),
  17923. argument<QWidget*> (1,context));
  17924. return QScriptValue();
  17925. }
  17926. /*:191*//*192:*/
  17927. #line 4410 "./typica.w"
  17928. QScriptValue scriptTr(QScriptContext*context,QScriptEngine*)
  17929. {
  17930. return QScriptValue(QCoreApplication::translate(
  17931. "configuration",
  17932. argument<QString> (1,context).toUtf8().data()));
  17933. }
  17934. /*:192*//*199:*/
  17935. #line 4679 "./typica.w"
  17936. QScriptValue createWindow(QScriptContext*context,QScriptEngine*engine)
  17937. {
  17938. QString targetID= argument<QString> (0,context);
  17939. QDomNode element;
  17940. QScriptValue object;
  17941. /*201:*/
  17942. #line 4726 "./typica.w"
  17943. QDomNodeList windows=
  17944. AppInstance->configuration()->documentElement().elementsByTagName("window");
  17945. QDomNode nullNode;
  17946. int i= 0;
  17947. element= nullNode;
  17948. while(i<windows.count())
  17949. {
  17950. element= windows.at(i);
  17951. QDomNamedNodeMap attributes= element.attributes();
  17952. if(attributes.contains("id"))
  17953. {
  17954. if(attributes.namedItem("id").toAttr().value()==targetID)
  17955. {
  17956. break;
  17957. }
  17958. }
  17959. element= nullNode;
  17960. i++;
  17961. }
  17962. /*:201*/
  17963. #line 4685 "./typica.w"
  17964. if(!element.isNull())
  17965. {
  17966. /*202:*/
  17967. #line 4758 "./typica.w"
  17968. ScriptQMainWindow*window= new ScriptQMainWindow;
  17969. window->setObjectName(targetID);
  17970. object= engine->newQObject(window);
  17971. setQMainWindowProperties(object,engine);
  17972. QWidget*central= new(QWidget);
  17973. central->setParent(window);
  17974. central->setObjectName("centralWidget");
  17975. window->setCentralWidget(central);
  17976. if(element.hasChildNodes())
  17977. {
  17978. /*203:*/
  17979. #line 4794 "./typica.w"
  17980. QStack<QWidget*> widgetStack;
  17981. QStack<QLayout*> layoutStack;
  17982. QString windowScript;
  17983. widgetStack.push(central);
  17984. QDomNodeList windowChildren= element.childNodes();
  17985. int i= 0;
  17986. while(i<windowChildren.count())
  17987. {
  17988. QDomNode current;
  17989. QDomElement element;
  17990. current= windowChildren.at(i);
  17991. if(current.isElement())
  17992. {
  17993. element= current.toElement();
  17994. if(element.tagName()=="program")
  17995. {
  17996. windowScript.append(element.text());
  17997. }
  17998. else if(element.tagName()=="layout")
  17999. {
  18000. element.setAttribute("trcontext","configuration");
  18001. addLayoutToWidget(element,&widgetStack,&layoutStack);
  18002. }
  18003. else if(element.tagName()=="menu")
  18004. {
  18005. /*204:*/
  18006. #line 4842 "./typica.w"
  18007. QMenuBar*bar= window->menuBar();
  18008. bar->setParent(window);
  18009. bar->setObjectName("menuBar");
  18010. if(element.hasAttribute("name"))
  18011. {
  18012. QMenu*menu= bar->addMenu(QCoreApplication::translate("configuration",
  18013. element.attribute("name").toUtf8().data()));
  18014. menu->setParent(bar);
  18015. if(element.hasAttribute("type"))
  18016. {
  18017. if(element.attribute("type")=="reports")
  18018. {
  18019. if(element.hasAttribute("src"))
  18020. {
  18021. /*664:*/
  18022. #line 14171 "./typica.w"
  18023. QSettings settings;
  18024. QString reportDirectory= QString("%1/%2").arg(settings.value("config").
  18025. toString()).
  18026. arg(element.attribute("src"));
  18027. QDir::addSearchPath("reports",reportDirectory);
  18028. QDir directory(reportDirectory);
  18029. directory.setFilter(QDir::Files);
  18030. directory.setSorting(QDir::Name);
  18031. QStringList nameFilter;
  18032. nameFilter<<"*.xml";
  18033. directory.setNameFilters(nameFilter);
  18034. QFileInfoList reportFiles= directory.entryInfoList();
  18035. for(int i= 0;i<reportFiles.size();i++)
  18036. {
  18037. QFileInfo reportFile= reportFiles.at(i);
  18038. /*668:*/
  18039. #line 14251 "./typica.w"
  18040. QString path= reportFile.absoluteFilePath();
  18041. QFile file(path);
  18042. if(file.open(QIODevice::ReadOnly))
  18043. {
  18044. QDomDocument document;
  18045. document.setContent(&file,true);
  18046. QDomElement root= document.documentElement();
  18047. QString translationContext= root.attribute("id");
  18048. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  18049. if(!titleNode.isNull())
  18050. {
  18051. QDomElement titleElement= titleNode.toElement();
  18052. QString title= QCoreApplication::translate("configuration",
  18053. titleElement.text().toUtf8().data());
  18054. if(!title.isEmpty())
  18055. {
  18056. QStringList hierarchy= title.split(":->");
  18057. QMenu*insertionPoint= menu;
  18058. /*669:*/
  18059. #line 14280 "./typica.w"
  18060. for(int j= 0;j<hierarchy.size()-1;j++)
  18061. {
  18062. QObjectList menuList= insertionPoint->children();
  18063. bool menuFound= false;
  18064. for(int k= 0;k<menuList.size();k++)
  18065. {
  18066. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  18067. if(currentItem)
  18068. {
  18069. if(currentItem->title()==hierarchy.at(j))
  18070. {
  18071. menuFound= true;
  18072. insertionPoint= currentItem;
  18073. break;
  18074. }
  18075. }
  18076. }
  18077. if(!menuFound)
  18078. {
  18079. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  18080. }
  18081. }
  18082. /*:669*/
  18083. #line 14270 "./typica.w"
  18084. ReportAction*action= new ReportAction(path,hierarchy.last());
  18085. insertionPoint->addAction(action);
  18086. }
  18087. }
  18088. }
  18089. /*:668*/
  18090. #line 14187 "./typica.w"
  18091. }
  18092. /*:664*/
  18093. #line 4857 "./typica.w"
  18094. }
  18095. }
  18096. }
  18097. if(element.hasChildNodes())
  18098. {
  18099. /*205:*/
  18100. #line 4870 "./typica.w"
  18101. QDomNodeList menuItems= element.childNodes();
  18102. int j= 0;
  18103. while(j<menuItems.count())
  18104. {
  18105. QDomNode item= menuItems.at(j);
  18106. if(item.isElement())
  18107. {
  18108. QDomElement itemElement= item.toElement();
  18109. if(itemElement.tagName()=="item")
  18110. {
  18111. QAction*itemAction= new QAction(QCoreApplication::translate("configuration",
  18112. itemElement.text().toUtf8().data()),menu);
  18113. if(itemElement.hasAttribute("id"))
  18114. {
  18115. itemAction->setObjectName(itemElement.attribute("id"));
  18116. }
  18117. if(itemElement.hasAttribute("shortcut"))
  18118. {
  18119. itemAction->setShortcut(itemElement.attribute("shortcut"));
  18120. }
  18121. menu->addAction(itemAction);
  18122. }
  18123. else if(itemElement.tagName()=="separator")
  18124. {
  18125. menu->addSeparator();
  18126. }
  18127. else if(itemElement.tagName()=="plugins")
  18128. {
  18129. /*689:*/
  18130. #line 21 "./plugins.w"
  18131. QMenu*pluginMenu= new QMenu(menu);
  18132. if(itemElement.hasAttribute("id"))
  18133. {
  18134. pluginMenu->setObjectName(itemElement.attribute("id"));
  18135. }
  18136. if(itemElement.hasAttribute("title"))
  18137. {
  18138. pluginMenu->setTitle(itemElement.attribute("title"));
  18139. }
  18140. if(itemElement.hasAttribute("src"))
  18141. {
  18142. QSettings settings;
  18143. QString pluginDirectory= QString("%1/%2").
  18144. arg(settings.value("config").toString()).
  18145. arg(itemElement.attribute("src"));
  18146. QDir directory(pluginDirectory);
  18147. directory.setFilter(QDir::Files);
  18148. directory.setSorting(QDir::Name);
  18149. QStringList nameFilter;
  18150. nameFilter<<"*.js";
  18151. directory.setNameFilters(nameFilter);
  18152. QFileInfoList pluginFiles= directory.entryInfoList();
  18153. for(int k= 0;k<pluginFiles.size();k++)
  18154. {
  18155. PluginAction*pa= new PluginAction(pluginFiles.at(k),pluginMenu);
  18156. if(itemElement.hasAttribute("preRun"))
  18157. {
  18158. pa->setPreRun(itemElement.attribute("preRun"));
  18159. }
  18160. if(itemElement.hasAttribute("postRun"))
  18161. {
  18162. pa->setPostRun(itemElement.attribute("postRun"));
  18163. }
  18164. pluginMenu->addAction(pa);
  18165. }
  18166. }
  18167. menu->addMenu(pluginMenu);
  18168. /*:689*/
  18169. #line 4899 "./typica.w"
  18170. }
  18171. }
  18172. j++;
  18173. }
  18174. #line 1 "./helpmenu.w"
  18175. /*:205*/
  18176. #line 4863 "./typica.w"
  18177. }
  18178. }
  18179. /*:204*/
  18180. #line 4820 "./typica.w"
  18181. }
  18182. }
  18183. i++;
  18184. }
  18185. QScriptValue oldThis= context->thisObject();
  18186. context->setThisObject(object);
  18187. QScriptValue result= engine->evaluate(windowScript);
  18188. /*196:*/
  18189. #line 4573 "./typica.w"
  18190. if(engine->hasUncaughtException())
  18191. {
  18192. int line= engine->uncaughtExceptionLineNumber();
  18193. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  18194. result.toString();
  18195. QString trace;
  18196. foreach(trace,engine->uncaughtExceptionBacktrace())
  18197. {
  18198. qDebug()<<trace;
  18199. }
  18200. }
  18201. /*:196*/
  18202. #line 4828 "./typica.w"
  18203. context->setThisObject(oldThis);
  18204. /*:203*/
  18205. #line 4769 "./typica.w"
  18206. }
  18207. /*206:*/
  18208. #line 9 "./helpmenu.w"
  18209. HelpMenu*helpMenu= new HelpMenu();
  18210. window->menuBar()->addMenu(helpMenu);
  18211. /*:206*/
  18212. #line 4771 "./typica.w"
  18213. window->show();
  18214. window->setupFinished();
  18215. /*:202*/
  18216. #line 4688 "./typica.w"
  18217. }
  18218. return object;
  18219. }
  18220. /*:199*//*200:*/
  18221. #line 4699 "./typica.w"
  18222. QScriptValue createReport(QScriptContext*context,QScriptEngine*engine)
  18223. {
  18224. QString targetID= argument<QString> (0,context);
  18225. QFile file(QString("reports:%1").arg(targetID));
  18226. QScriptValue object;
  18227. if(file.open(QIODevice::ReadOnly))
  18228. {
  18229. QDomDocument document;
  18230. document.setContent(&file,true);
  18231. QDomElement element= document.documentElement();
  18232. if(!element.isNull())
  18233. {
  18234. /*202:*/
  18235. #line 4758 "./typica.w"
  18236. ScriptQMainWindow*window= new ScriptQMainWindow;
  18237. window->setObjectName(targetID);
  18238. object= engine->newQObject(window);
  18239. setQMainWindowProperties(object,engine);
  18240. QWidget*central= new(QWidget);
  18241. central->setParent(window);
  18242. central->setObjectName("centralWidget");
  18243. window->setCentralWidget(central);
  18244. if(element.hasChildNodes())
  18245. {
  18246. /*203:*/
  18247. #line 4794 "./typica.w"
  18248. QStack<QWidget*> widgetStack;
  18249. QStack<QLayout*> layoutStack;
  18250. QString windowScript;
  18251. widgetStack.push(central);
  18252. QDomNodeList windowChildren= element.childNodes();
  18253. int i= 0;
  18254. while(i<windowChildren.count())
  18255. {
  18256. QDomNode current;
  18257. QDomElement element;
  18258. current= windowChildren.at(i);
  18259. if(current.isElement())
  18260. {
  18261. element= current.toElement();
  18262. if(element.tagName()=="program")
  18263. {
  18264. windowScript.append(element.text());
  18265. }
  18266. else if(element.tagName()=="layout")
  18267. {
  18268. element.setAttribute("trcontext","configuration");
  18269. addLayoutToWidget(element,&widgetStack,&layoutStack);
  18270. }
  18271. else if(element.tagName()=="menu")
  18272. {
  18273. /*204:*/
  18274. #line 4842 "./typica.w"
  18275. QMenuBar*bar= window->menuBar();
  18276. bar->setParent(window);
  18277. bar->setObjectName("menuBar");
  18278. if(element.hasAttribute("name"))
  18279. {
  18280. QMenu*menu= bar->addMenu(QCoreApplication::translate("configuration",
  18281. element.attribute("name").toUtf8().data()));
  18282. menu->setParent(bar);
  18283. if(element.hasAttribute("type"))
  18284. {
  18285. if(element.attribute("type")=="reports")
  18286. {
  18287. if(element.hasAttribute("src"))
  18288. {
  18289. /*664:*/
  18290. #line 14171 "./typica.w"
  18291. QSettings settings;
  18292. QString reportDirectory= QString("%1/%2").arg(settings.value("config").
  18293. toString()).
  18294. arg(element.attribute("src"));
  18295. QDir::addSearchPath("reports",reportDirectory);
  18296. QDir directory(reportDirectory);
  18297. directory.setFilter(QDir::Files);
  18298. directory.setSorting(QDir::Name);
  18299. QStringList nameFilter;
  18300. nameFilter<<"*.xml";
  18301. directory.setNameFilters(nameFilter);
  18302. QFileInfoList reportFiles= directory.entryInfoList();
  18303. for(int i= 0;i<reportFiles.size();i++)
  18304. {
  18305. QFileInfo reportFile= reportFiles.at(i);
  18306. /*668:*/
  18307. #line 14251 "./typica.w"
  18308. QString path= reportFile.absoluteFilePath();
  18309. QFile file(path);
  18310. if(file.open(QIODevice::ReadOnly))
  18311. {
  18312. QDomDocument document;
  18313. document.setContent(&file,true);
  18314. QDomElement root= document.documentElement();
  18315. QString translationContext= root.attribute("id");
  18316. QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
  18317. if(!titleNode.isNull())
  18318. {
  18319. QDomElement titleElement= titleNode.toElement();
  18320. QString title= QCoreApplication::translate("configuration",
  18321. titleElement.text().toUtf8().data());
  18322. if(!title.isEmpty())
  18323. {
  18324. QStringList hierarchy= title.split(":->");
  18325. QMenu*insertionPoint= menu;
  18326. /*669:*/
  18327. #line 14280 "./typica.w"
  18328. for(int j= 0;j<hierarchy.size()-1;j++)
  18329. {
  18330. QObjectList menuList= insertionPoint->children();
  18331. bool menuFound= false;
  18332. for(int k= 0;k<menuList.size();k++)
  18333. {
  18334. QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
  18335. if(currentItem)
  18336. {
  18337. if(currentItem->title()==hierarchy.at(j))
  18338. {
  18339. menuFound= true;
  18340. insertionPoint= currentItem;
  18341. break;
  18342. }
  18343. }
  18344. }
  18345. if(!menuFound)
  18346. {
  18347. insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
  18348. }
  18349. }
  18350. /*:669*/
  18351. #line 14270 "./typica.w"
  18352. ReportAction*action= new ReportAction(path,hierarchy.last());
  18353. insertionPoint->addAction(action);
  18354. }
  18355. }
  18356. }
  18357. /*:668*/
  18358. #line 14187 "./typica.w"
  18359. }
  18360. /*:664*/
  18361. #line 4857 "./typica.w"
  18362. }
  18363. }
  18364. }
  18365. if(element.hasChildNodes())
  18366. {
  18367. /*205:*/
  18368. #line 4870 "./typica.w"
  18369. QDomNodeList menuItems= element.childNodes();
  18370. int j= 0;
  18371. while(j<menuItems.count())
  18372. {
  18373. QDomNode item= menuItems.at(j);
  18374. if(item.isElement())
  18375. {
  18376. QDomElement itemElement= item.toElement();
  18377. if(itemElement.tagName()=="item")
  18378. {
  18379. QAction*itemAction= new QAction(QCoreApplication::translate("configuration",
  18380. itemElement.text().toUtf8().data()),menu);
  18381. if(itemElement.hasAttribute("id"))
  18382. {
  18383. itemAction->setObjectName(itemElement.attribute("id"));
  18384. }
  18385. if(itemElement.hasAttribute("shortcut"))
  18386. {
  18387. itemAction->setShortcut(itemElement.attribute("shortcut"));
  18388. }
  18389. menu->addAction(itemAction);
  18390. }
  18391. else if(itemElement.tagName()=="separator")
  18392. {
  18393. menu->addSeparator();
  18394. }
  18395. else if(itemElement.tagName()=="plugins")
  18396. {
  18397. /*689:*/
  18398. #line 21 "./plugins.w"
  18399. QMenu*pluginMenu= new QMenu(menu);
  18400. if(itemElement.hasAttribute("id"))
  18401. {
  18402. pluginMenu->setObjectName(itemElement.attribute("id"));
  18403. }
  18404. if(itemElement.hasAttribute("title"))
  18405. {
  18406. pluginMenu->setTitle(itemElement.attribute("title"));
  18407. }
  18408. if(itemElement.hasAttribute("src"))
  18409. {
  18410. QSettings settings;
  18411. QString pluginDirectory= QString("%1/%2").
  18412. arg(settings.value("config").toString()).
  18413. arg(itemElement.attribute("src"));
  18414. QDir directory(pluginDirectory);
  18415. directory.setFilter(QDir::Files);
  18416. directory.setSorting(QDir::Name);
  18417. QStringList nameFilter;
  18418. nameFilter<<"*.js";
  18419. directory.setNameFilters(nameFilter);
  18420. QFileInfoList pluginFiles= directory.entryInfoList();
  18421. for(int k= 0;k<pluginFiles.size();k++)
  18422. {
  18423. PluginAction*pa= new PluginAction(pluginFiles.at(k),pluginMenu);
  18424. if(itemElement.hasAttribute("preRun"))
  18425. {
  18426. pa->setPreRun(itemElement.attribute("preRun"));
  18427. }
  18428. if(itemElement.hasAttribute("postRun"))
  18429. {
  18430. pa->setPostRun(itemElement.attribute("postRun"));
  18431. }
  18432. pluginMenu->addAction(pa);
  18433. }
  18434. }
  18435. menu->addMenu(pluginMenu);
  18436. /*:689*/
  18437. #line 4899 "./typica.w"
  18438. }
  18439. }
  18440. j++;
  18441. }
  18442. #line 1 "./helpmenu.w"
  18443. /*:205*/
  18444. #line 4863 "./typica.w"
  18445. }
  18446. }
  18447. /*:204*/
  18448. #line 4820 "./typica.w"
  18449. }
  18450. }
  18451. i++;
  18452. }
  18453. QScriptValue oldThis= context->thisObject();
  18454. context->setThisObject(object);
  18455. QScriptValue result= engine->evaluate(windowScript);
  18456. /*196:*/
  18457. #line 4573 "./typica.w"
  18458. if(engine->hasUncaughtException())
  18459. {
  18460. int line= engine->uncaughtExceptionLineNumber();
  18461. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  18462. result.toString();
  18463. QString trace;
  18464. foreach(trace,engine->uncaughtExceptionBacktrace())
  18465. {
  18466. qDebug()<<trace;
  18467. }
  18468. }
  18469. /*:196*/
  18470. #line 4828 "./typica.w"
  18471. context->setThisObject(oldThis);
  18472. /*:203*/
  18473. #line 4769 "./typica.w"
  18474. }
  18475. /*206:*/
  18476. #line 9 "./helpmenu.w"
  18477. HelpMenu*helpMenu= new HelpMenu();
  18478. window->menuBar()->addMenu(helpMenu);
  18479. /*:206*/
  18480. #line 4771 "./typica.w"
  18481. window->show();
  18482. window->setupFinished();
  18483. /*:202*/
  18484. #line 4712 "./typica.w"
  18485. }
  18486. file.close();
  18487. }
  18488. return object;
  18489. }
  18490. /*:200*//*218:*/
  18491. #line 4919 "./typica.w"
  18492. void addLayoutToWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  18493. QStack<QLayout*> *layoutStack)
  18494. {
  18495. if(element.hasAttribute("type"))
  18496. {
  18497. /*219:*/
  18498. #line 4940 "./typica.w"
  18499. QLayout*layout;
  18500. QString layoutType= element.attribute("type");
  18501. if(layoutType=="horizontal")
  18502. {
  18503. layout= new QHBoxLayout;
  18504. layoutStack->push(layout);
  18505. populateBoxLayout(element,widgetStack,layoutStack);
  18506. }
  18507. else if(layoutType=="vertical")
  18508. {
  18509. layout= new QVBoxLayout;
  18510. layoutStack->push(layout);
  18511. populateBoxLayout(element,widgetStack,layoutStack);
  18512. }
  18513. else if(layoutType=="grid")
  18514. {
  18515. layout= new QGridLayout;
  18516. layoutStack->push(layout);
  18517. populateGridLayout(element,widgetStack,layoutStack);
  18518. }
  18519. else if(layoutType=="stack")
  18520. {
  18521. layout= new QStackedLayout;
  18522. layoutStack->push(layout);
  18523. populateStackedLayout(element,widgetStack,layoutStack);
  18524. }
  18525. if(element.hasAttribute("id"))
  18526. {
  18527. layout->setObjectName(element.attribute("id"));
  18528. }
  18529. if(element.hasAttribute("spacing"))
  18530. {
  18531. layout->setSpacing(element.attribute("spacing").toInt());
  18532. }
  18533. if(element.hasAttribute("margin"))
  18534. {
  18535. int m= element.attribute("margin").toInt();
  18536. layout->setContentsMargins(m,m,m,m);
  18537. }
  18538. /*:219*/
  18539. #line 4925 "./typica.w"
  18540. QWidget*widget= widgetStack->top();
  18541. if(layout)
  18542. {
  18543. widget->setLayout(layout);
  18544. }
  18545. layoutStack->pop();
  18546. }
  18547. }
  18548. /*:218*//*220:*/
  18549. #line 4987 "./typica.w"
  18550. void populateStackedLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  18551. QStack<QLayout*> *layoutStack)
  18552. {
  18553. QDomNodeList children= element.childNodes();
  18554. QStackedLayout*layout= qobject_cast<QStackedLayout*> (layoutStack->top());
  18555. for(int i= 0;i<children.count();i++)
  18556. {
  18557. QDomNode current;
  18558. QDomElement currentElement;
  18559. current= children.at(i);
  18560. if(current.isElement())
  18561. {
  18562. currentElement= current.toElement();
  18563. if(currentElement.tagName()=="page")
  18564. {
  18565. QWidget*widget= new QWidget;
  18566. layout->addWidget(widget);
  18567. widgetStack->push(widget);
  18568. currentElement.setAttribute("trcontext","configuration");
  18569. populateWidget(currentElement,widgetStack,layoutStack);
  18570. widgetStack->pop();
  18571. }
  18572. }
  18573. }
  18574. }
  18575. /*:220*//*222:*/
  18576. #line 5026 "./typica.w"
  18577. void addTabBarToLayout(QDomElement element,QStack<QWidget*> *,QStack<QLayout*> *layoutStack)
  18578. {
  18579. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  18580. QTabBar*widget= new QTabBar;
  18581. layout->addWidget(widget);
  18582. if(!element.attribute("id").isEmpty())
  18583. {
  18584. widget->setObjectName(element.attribute("id"));
  18585. }
  18586. }
  18587. /*:222*//*224:*/
  18588. #line 5048 "./typica.w"
  18589. QScriptValue constructQTabBar(QScriptContext*,QScriptEngine*engine)
  18590. {
  18591. QScriptValue object= engine->newQObject(new QTabBar);
  18592. setQTabBarProperties(object,engine);
  18593. return object;
  18594. }
  18595. /*:224*//*225:*/
  18596. #line 5059 "./typica.w"
  18597. void setQTabBarProperties(QScriptValue value,QScriptEngine*engine)
  18598. {
  18599. setQWidgetProperties(value,engine);
  18600. value.setProperty("addTab",engine->newFunction(QTabBar_addTab));
  18601. }
  18602. QScriptValue QTabBar_addTab(QScriptContext*context,QScriptEngine*)
  18603. {
  18604. QTabBar*self= getself<QTabBar*> (context);
  18605. if(context->argumentCount()> 0)
  18606. {
  18607. self->addTab(argument<QString> (0,context));
  18608. }
  18609. else
  18610. {
  18611. context->throwError("Incorrect number of arguments passed to "
  18612. "QTabBar::addTab().");
  18613. }
  18614. return QScriptValue();
  18615. }
  18616. /*:225*//*227:*/
  18617. #line 5094 "./typica.w"
  18618. void populateGridLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  18619. QStack<QLayout*> *layoutStack)
  18620. {
  18621. QDomNodeList children= element.childNodes();
  18622. int row= -1;
  18623. QGridLayout*layout= qobject_cast<QGridLayout*> (layoutStack->top());
  18624. for(int i= 0;i<children.count();i++)
  18625. {
  18626. QDomNode current;
  18627. QDomElement currentElement;
  18628. current= children.at(i);
  18629. if(current.isElement())
  18630. {
  18631. currentElement= current.toElement();
  18632. if(currentElement.tagName()=="row")
  18633. {
  18634. row++;
  18635. if(currentElement.hasAttribute("height"))
  18636. {
  18637. layout->setRowMinimumHeight(row,
  18638. currentElement.attribute("height").toInt());
  18639. }
  18640. if(currentElement.hasAttribute("stretch"))
  18641. {
  18642. layout->setRowStretch(row,
  18643. currentElement.attribute("stretch").toInt());
  18644. }
  18645. /*228:*/
  18646. #line 5150 "./typica.w"
  18647. int column= -1;
  18648. QDomNodeList rowChildren= currentElement.childNodes();
  18649. for(int j= 0;j<rowChildren.count();j++)
  18650. {
  18651. QDomNode columnNode;
  18652. QDomElement columnElement;
  18653. columnNode= rowChildren.at(j);
  18654. if(columnNode.isElement())
  18655. {
  18656. columnElement= columnNode.toElement();
  18657. if(columnElement.tagName()=="column")
  18658. {
  18659. column++;
  18660. if(columnElement.hasAttribute("column"))
  18661. {
  18662. column= columnElement.attribute("column").toInt();
  18663. }
  18664. if(columnElement.hasAttribute("width"))
  18665. {
  18666. layout->setColumnMinimumWidth(column,
  18667. columnElement.attribute("width").toInt());
  18668. }
  18669. if(columnElement.hasAttribute("stretch"))
  18670. {
  18671. layout->setColumnStretch(column,
  18672. columnElement.attribute("stretch").toInt());
  18673. }
  18674. int hspan= 1;
  18675. int vspan= 1;
  18676. if(columnElement.hasAttribute("rowspan"))
  18677. {
  18678. vspan= columnElement.attribute("rowspan").toInt();
  18679. }
  18680. if(columnElement.hasAttribute("colspan"))
  18681. {
  18682. hspan= columnElement.attribute("colspan").toInt();
  18683. }
  18684. QHBoxLayout*cell= new QHBoxLayout;
  18685. layout->addLayout(cell,row,column,vspan,hspan);
  18686. layoutStack->push(cell);
  18687. columnElement.setAttribute("trcontext","configuration");
  18688. populateBoxLayout(columnElement,widgetStack,layoutStack);
  18689. layoutStack->pop();
  18690. }
  18691. }
  18692. }
  18693. /*:228*/
  18694. #line 5122 "./typica.w"
  18695. }
  18696. }
  18697. }
  18698. }
  18699. /*:227*//*229:*/
  18700. #line 5201 "./typica.w"
  18701. void populateBoxLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  18702. QStack<QLayout*> *layoutStack)
  18703. {
  18704. QDomNodeList children= element.childNodes();
  18705. for(int i= 0;i<children.count();i++)
  18706. {
  18707. QDomNode current;
  18708. QDomElement currentElement;
  18709. current= children.at(i);
  18710. if(current.isElement())
  18711. {
  18712. currentElement= current.toElement();
  18713. currentElement.setAttribute("trcontext","configuration");
  18714. if(currentElement.tagName()=="button")
  18715. {
  18716. addButtonToLayout(currentElement,widgetStack,layoutStack);
  18717. }
  18718. else if(currentElement.tagName()=="calendar")
  18719. {
  18720. addCalendarToLayout(currentElement,widgetStack,layoutStack);
  18721. }
  18722. else if(currentElement.tagName()=="timeedit")
  18723. {
  18724. addTimeEditToLayout(currentElement,widgetStack,layoutStack);
  18725. }
  18726. else if(currentElement.tagName()=="decoration")
  18727. {
  18728. addDecorationToLayout(currentElement,widgetStack,
  18729. layoutStack);
  18730. }
  18731. else if(currentElement.tagName()=="layout")
  18732. {
  18733. addLayoutToLayout(currentElement,widgetStack,layoutStack);
  18734. }
  18735. else if(currentElement.tagName()=="splitter")
  18736. {
  18737. addSplitterToLayout(currentElement,widgetStack,layoutStack);
  18738. }
  18739. else if(currentElement.tagName()=="label")
  18740. {
  18741. QBoxLayout*layout=
  18742. qobject_cast<QBoxLayout*> (layoutStack->top());
  18743. QLabel*label= new QLabel(QCoreApplication::translate(
  18744. "configuration",
  18745. currentElement.text().toUtf8().data()));
  18746. if(currentElement.hasAttribute("id"))
  18747. {
  18748. label->setObjectName(currentElement.attribute("id"));
  18749. }
  18750. layout->addWidget(label);
  18751. }
  18752. else if(currentElement.tagName()=="lcdtemperature")
  18753. {
  18754. addTemperatureDisplayToLayout(currentElement,widgetStack,
  18755. layoutStack);
  18756. }
  18757. else if(currentElement.tagName()=="lcdtimer")
  18758. {
  18759. addTimerDisplayToLayout(currentElement,widgetStack,
  18760. layoutStack);
  18761. }
  18762. else if(currentElement.tagName()=="line")
  18763. {
  18764. addLineToLayout(currentElement,widgetStack,layoutStack);
  18765. }
  18766. else if(currentElement.tagName()=="report")
  18767. {
  18768. addReportToLayout(currentElement,widgetStack,layoutStack);
  18769. }
  18770. else if(currentElement.tagName()=="sqldrop")
  18771. {
  18772. addSqlDropToLayout(currentElement,widgetStack,layoutStack);
  18773. }
  18774. else if(currentElement.tagName()=="sqltablearray")
  18775. {
  18776. addSaltToLayout(currentElement,widgetStack,layoutStack);
  18777. }
  18778. else if(currentElement.tagName()=="sqlview")
  18779. {
  18780. addSqlQueryViewToLayout(currentElement,widgetStack,
  18781. layoutStack);
  18782. }
  18783. else if(currentElement.tagName()=="textarea")
  18784. {
  18785. addTextToLayout(currentElement,widgetStack,layoutStack);
  18786. }
  18787. else if(currentElement.tagName()=="spinbox")
  18788. {
  18789. addSpinBoxToLayout(currentElement,widgetStack,layoutStack);
  18790. }
  18791. else if(currentElement.tagName()=="formarray")
  18792. {
  18793. addFormArrayToLayout(currentElement,widgetStack,layoutStack);
  18794. }
  18795. else if(currentElement.tagName()=="hscale")
  18796. {
  18797. addScaleControlToLayout(currentElement,widgetStack,
  18798. layoutStack);
  18799. }
  18800. else if(currentElement.tagName()=="vscale")
  18801. {
  18802. addIntensityControlToLayout(currentElement,widgetStack,
  18803. layoutStack);
  18804. }
  18805. else if(currentElement.tagName()=="webview")
  18806. {
  18807. addWebViewToLayout(currentElement,widgetStack,layoutStack);
  18808. }
  18809. else if(currentElement.tagName()=="stretch")
  18810. {
  18811. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  18812. layout->addStretch();
  18813. }
  18814. /*54:*/
  18815. #line 1569 "./typica.w"
  18816. else if(currentElement.tagName()=="svgwidget")
  18817. {
  18818. addSvgWidgetToLayout(currentElement,widgetStack,layoutStack);
  18819. }
  18820. /*:54*//*221:*/
  18821. #line 5018 "./typica.w"
  18822. else if(currentElement.tagName()=="tabbar")
  18823. {
  18824. addTabBarToLayout(currentElement,widgetStack,layoutStack);
  18825. }
  18826. /*:221*//*597:*/
  18827. #line 111 "./printerselector.w"
  18828. else if(currentElement.tagName()=="printerselector")
  18829. {
  18830. addPrinterSelectorToLayout(currentElement,widgetStack,layoutStack);
  18831. }
  18832. #line 12869 "./typica.w"
  18833. /*:597*//*712:*/
  18834. #line 451 "./daterangeselector.w"
  18835. else if(currentElement.tagName()=="daterange")
  18836. {
  18837. addDateRangeToLayout(currentElement,widgetStack,layoutStack);
  18838. }
  18839. /*:712*//*1171:*/
  18840. #line 135 "./roastcoloredit.w"
  18841. else if(currentElement.tagName()=="roastcoloredit")
  18842. {
  18843. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  18844. RoastColorEdit*edit= new RoastColorEdit;
  18845. if(element.hasAttribute("id"))
  18846. {
  18847. edit->setObjectName(element.attribute("id"));
  18848. }
  18849. layout->addWidget(edit);
  18850. }
  18851. /*:1171*/
  18852. #line 5315 "./typica.w"
  18853. }
  18854. }
  18855. }
  18856. /*:229*//*230:*/
  18857. #line 5323 "./typica.w"
  18858. void addLayoutToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  18859. QStack<QLayout*> *layoutStack)
  18860. {
  18861. QLayout*targetLayout= layoutStack->pop();
  18862. QBoxLayout*boxLayout= qobject_cast<QBoxLayout*> (targetLayout);
  18863. if(element.hasAttribute("type"))
  18864. {
  18865. /*219:*/
  18866. #line 4940 "./typica.w"
  18867. QLayout*layout;
  18868. QString layoutType= element.attribute("type");
  18869. if(layoutType=="horizontal")
  18870. {
  18871. layout= new QHBoxLayout;
  18872. layoutStack->push(layout);
  18873. populateBoxLayout(element,widgetStack,layoutStack);
  18874. }
  18875. else if(layoutType=="vertical")
  18876. {
  18877. layout= new QVBoxLayout;
  18878. layoutStack->push(layout);
  18879. populateBoxLayout(element,widgetStack,layoutStack);
  18880. }
  18881. else if(layoutType=="grid")
  18882. {
  18883. layout= new QGridLayout;
  18884. layoutStack->push(layout);
  18885. populateGridLayout(element,widgetStack,layoutStack);
  18886. }
  18887. else if(layoutType=="stack")
  18888. {
  18889. layout= new QStackedLayout;
  18890. layoutStack->push(layout);
  18891. populateStackedLayout(element,widgetStack,layoutStack);
  18892. }
  18893. if(element.hasAttribute("id"))
  18894. {
  18895. layout->setObjectName(element.attribute("id"));
  18896. }
  18897. if(element.hasAttribute("spacing"))
  18898. {
  18899. layout->setSpacing(element.attribute("spacing").toInt());
  18900. }
  18901. if(element.hasAttribute("margin"))
  18902. {
  18903. int m= element.attribute("margin").toInt();
  18904. layout->setContentsMargins(m,m,m,m);
  18905. }
  18906. /*:219*/
  18907. #line 5331 "./typica.w"
  18908. boxLayout->addLayout(layout);
  18909. layoutStack->pop();
  18910. }
  18911. layoutStack->push(targetLayout);
  18912. }
  18913. /*:230*//*231:*/
  18914. #line 5342 "./typica.w"
  18915. void addSplitterToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
  18916. QStack<QLayout*> *layoutStack)
  18917. {
  18918. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  18919. QSplitter*splitter= new(QSplitter);
  18920. layout->addWidget(splitter);
  18921. /*232:*/
  18922. #line 5355 "./typica.w"
  18923. QString orientation= element.attribute("type");
  18924. if(orientation=="horizontal")
  18925. {
  18926. splitter->setOrientation(Qt::Horizontal);
  18927. }
  18928. else if(orientation=="vertical")
  18929. {
  18930. splitter->setOrientation(Qt::Vertical);
  18931. }
  18932. QString id= element.attribute("id");
  18933. if(!id.isEmpty())
  18934. {
  18935. splitter->setObjectName(id);
  18936. }
  18937. if(element.hasChildNodes())
  18938. {
  18939. widgetStack->push(splitter);
  18940. populateSplitter(element,widgetStack,layoutStack);
  18941. widgetStack->pop();
  18942. }
  18943. /*:232*/
  18944. #line 5349 "./typica.w"
  18945. }
  18946. /*:231*//*233:*/
  18947. #line 5381 "./typica.w"
  18948. void populateSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  18949. QStack<QLayout*> *layoutStack)
  18950. {
  18951. QDomNodeList children= element.childNodes();
  18952. for(int i= 0;i<children.count();i++)
  18953. {
  18954. QDomNode current;
  18955. QDomElement currentElement;
  18956. current= children.at(i);
  18957. if(current.isElement())
  18958. {
  18959. currentElement= current.toElement();
  18960. currentElement.setAttribute("trcontext","configuration");
  18961. if(currentElement.tagName()=="decoration")
  18962. {
  18963. addDecorationToSplitter(currentElement,widgetStack,
  18964. layoutStack);
  18965. }
  18966. else if(currentElement.tagName()=="graph")
  18967. {
  18968. addGraphToSplitter(currentElement,widgetStack,layoutStack);
  18969. }
  18970. else if(currentElement.tagName()=="splitter")
  18971. {
  18972. addSplitterToSplitter(currentElement,widgetStack,layoutStack);
  18973. }
  18974. else if(currentElement.tagName()=="lcdtemperature")
  18975. {
  18976. addTemperatureDisplayToSplitter(currentElement,widgetStack,
  18977. layoutStack);
  18978. }
  18979. else if(currentElement.tagName()=="lcdtimer")
  18980. {
  18981. addTimerDisplayToSplitter(currentElement,widgetStack,
  18982. layoutStack);
  18983. }
  18984. else if(currentElement.tagName()=="measurementtable")
  18985. {
  18986. addZoomLogToSplitter(currentElement,widgetStack,layoutStack);
  18987. }
  18988. else if(currentElement.tagName()=="widget")
  18989. {
  18990. addWidgetToSplitter(currentElement,widgetStack,layoutStack);
  18991. }
  18992. }
  18993. }
  18994. }
  18995. /*:233*//*234:*/
  18996. #line 5432 "./typica.w"
  18997. void addSplitterToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  18998. QStack<QLayout*> *layoutStack)
  18999. {
  19000. QSplitter*parent= qobject_cast<QSplitter*> (widgetStack->top());
  19001. QSplitter*splitter= new(QSplitter);
  19002. splitter->setParent(parent);
  19003. parent->addWidget(splitter);
  19004. /*232:*/
  19005. #line 5355 "./typica.w"
  19006. QString orientation= element.attribute("type");
  19007. if(orientation=="horizontal")
  19008. {
  19009. splitter->setOrientation(Qt::Horizontal);
  19010. }
  19011. else if(orientation=="vertical")
  19012. {
  19013. splitter->setOrientation(Qt::Vertical);
  19014. }
  19015. QString id= element.attribute("id");
  19016. if(!id.isEmpty())
  19017. {
  19018. splitter->setObjectName(id);
  19019. }
  19020. if(element.hasChildNodes())
  19021. {
  19022. widgetStack->push(splitter);
  19023. populateSplitter(element,widgetStack,layoutStack);
  19024. widgetStack->pop();
  19025. }
  19026. /*:232*/
  19027. #line 5440 "./typica.w"
  19028. }
  19029. /*:234*//*235:*/
  19030. #line 5449 "./typica.w"
  19031. void addTemperatureDisplayToSplitter(QDomElement element,
  19032. QStack<QWidget*> *widgetStack,
  19033. QStack<QLayout*> *)
  19034. {
  19035. TemperatureDisplay*display= new(TemperatureDisplay);
  19036. if(element.hasAttribute("id"))
  19037. {
  19038. display->setObjectName(element.attribute("id"));
  19039. }
  19040. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  19041. splitter->addWidget(display);
  19042. }
  19043. void addTemperatureDisplayToLayout(QDomElement element,
  19044. QStack<QWidget*> *,
  19045. QStack<QLayout*> *layoutStack)
  19046. {
  19047. TemperatureDisplay*display= new(TemperatureDisplay);
  19048. if(element.hasAttribute("id"))
  19049. {
  19050. display->setObjectName(element.attribute("id"));
  19051. }
  19052. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  19053. layout->addWidget(display);
  19054. }
  19055. /*:235*//*236:*/
  19056. #line 5480 "./typica.w"
  19057. void addTimerDisplayToSplitter(QDomElement element,
  19058. QStack<QWidget*> *widgetStack,
  19059. QStack<QLayout*> *)
  19060. {
  19061. TimerDisplay*display= new(TimerDisplay);
  19062. if(element.hasAttribute("id"))
  19063. {
  19064. display->setObjectName(element.attribute("id"));
  19065. }
  19066. if(element.hasAttribute("format"))
  19067. {
  19068. display->setDisplayFormat(element.attribute("format"));
  19069. }
  19070. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  19071. splitter->addWidget(display);
  19072. }
  19073. void addTimerDisplayToLayout(QDomElement element,
  19074. QStack<QWidget*> *,
  19075. QStack<QLayout*> *layoutStack)
  19076. {
  19077. TimerDisplay*display= new(TimerDisplay);
  19078. if(element.hasAttribute("id"))
  19079. {
  19080. display->setObjectName(element.attribute("id"));
  19081. }
  19082. if(element.hasAttribute("format"))
  19083. {
  19084. display->setDisplayFormat(element.attribute("format"));
  19085. }
  19086. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  19087. layout->addWidget(display);
  19088. }
  19089. /*:236*//*237:*/
  19090. #line 5518 "./typica.w"
  19091. void addDecorationToLayout(QDomElement element,QStack<QWidget*> *,
  19092. QStack<QLayout*> *layoutStack)
  19093. {
  19094. /*238:*/
  19095. #line 5539 "./typica.w"
  19096. QString labelText=
  19097. QCoreApplication::translate("configuration",
  19098. element.attribute("name").toUtf8().data());
  19099. Qt::Orientations orientation= Qt::Horizontal;
  19100. if(element.hasAttribute("type"))
  19101. {
  19102. if(element.attribute("type")=="horizontal")
  19103. {
  19104. orientation= Qt::Horizontal;
  19105. }
  19106. else if(element.attribute("type")=="vertical")
  19107. {
  19108. orientation= Qt::Vertical;
  19109. }
  19110. }
  19111. /*239:*/
  19112. #line 5566 "./typica.w"
  19113. QWidget*theWidget= NULL;
  19114. QDomNodeList children= element.childNodes();
  19115. for(int i= 0;i<children.count();i++)
  19116. {
  19117. QDomNode item= children.at(i);
  19118. if(item.isElement())
  19119. {
  19120. QDomElement itemElement= item.toElement();
  19121. if(itemElement.tagName()=="lcdtemperature")
  19122. {
  19123. TemperatureDisplay*display= new TemperatureDisplay;
  19124. if(itemElement.hasAttribute("id"))
  19125. {
  19126. display->setObjectName(itemElement.attribute("id"));
  19127. }
  19128. theWidget= display;
  19129. }
  19130. else if(itemElement.tagName()=="lcdtimer")
  19131. {
  19132. TimerDisplay*display= new TimerDisplay;
  19133. if(itemElement.hasAttribute("id"))
  19134. {
  19135. display->setObjectName(itemElement.attribute("id"));
  19136. }
  19137. if(itemElement.hasAttribute("format"))
  19138. {
  19139. display->setDisplayFormat(itemElement.attribute("format"));
  19140. }
  19141. theWidget= display;
  19142. }
  19143. }
  19144. }
  19145. /*:239*/
  19146. #line 5555 "./typica.w"
  19147. WidgetDecorator*decoration= new WidgetDecorator(theWidget,labelText,
  19148. orientation);
  19149. if(element.hasAttribute("id"))
  19150. {
  19151. decoration->setObjectName(element.attribute("id"));
  19152. }
  19153. /*:238*/
  19154. #line 5522 "./typica.w"
  19155. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  19156. layout->addWidget(decoration);
  19157. }
  19158. void addDecorationToSplitter(QDomElement element,
  19159. QStack<QWidget*> *widgetStack,
  19160. QStack<QLayout*> *)
  19161. {
  19162. /*238:*/
  19163. #line 5539 "./typica.w"
  19164. QString labelText=
  19165. QCoreApplication::translate("configuration",
  19166. element.attribute("name").toUtf8().data());
  19167. Qt::Orientations orientation= Qt::Horizontal;
  19168. if(element.hasAttribute("type"))
  19169. {
  19170. if(element.attribute("type")=="horizontal")
  19171. {
  19172. orientation= Qt::Horizontal;
  19173. }
  19174. else if(element.attribute("type")=="vertical")
  19175. {
  19176. orientation= Qt::Vertical;
  19177. }
  19178. }
  19179. /*239:*/
  19180. #line 5566 "./typica.w"
  19181. QWidget*theWidget= NULL;
  19182. QDomNodeList children= element.childNodes();
  19183. for(int i= 0;i<children.count();i++)
  19184. {
  19185. QDomNode item= children.at(i);
  19186. if(item.isElement())
  19187. {
  19188. QDomElement itemElement= item.toElement();
  19189. if(itemElement.tagName()=="lcdtemperature")
  19190. {
  19191. TemperatureDisplay*display= new TemperatureDisplay;
  19192. if(itemElement.hasAttribute("id"))
  19193. {
  19194. display->setObjectName(itemElement.attribute("id"));
  19195. }
  19196. theWidget= display;
  19197. }
  19198. else if(itemElement.tagName()=="lcdtimer")
  19199. {
  19200. TimerDisplay*display= new TimerDisplay;
  19201. if(itemElement.hasAttribute("id"))
  19202. {
  19203. display->setObjectName(itemElement.attribute("id"));
  19204. }
  19205. if(itemElement.hasAttribute("format"))
  19206. {
  19207. display->setDisplayFormat(itemElement.attribute("format"));
  19208. }
  19209. theWidget= display;
  19210. }
  19211. }
  19212. }
  19213. /*:239*/
  19214. #line 5555 "./typica.w"
  19215. WidgetDecorator*decoration= new WidgetDecorator(theWidget,labelText,
  19216. orientation);
  19217. if(element.hasAttribute("id"))
  19218. {
  19219. decoration->setObjectName(element.attribute("id"));
  19220. }
  19221. /*:238*/
  19222. #line 5531 "./typica.w"
  19223. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  19224. splitter->addWidget(decoration);
  19225. }
  19226. /*:237*//*240:*/
  19227. #line 5611 "./typica.w"
  19228. void addWidgetToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  19229. QStack<QLayout*> *layoutStack)
  19230. {
  19231. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  19232. QWidget*widget= new QWidget;
  19233. if(element.hasAttribute("id"))
  19234. {
  19235. widget->setObjectName(element.attribute("id"));
  19236. }
  19237. if(element.hasAttribute("ignoreSizePolicy"))
  19238. {
  19239. if(element.attribute("ignoreSizePolicy")=="true")
  19240. {
  19241. widget->setSizePolicy(QSizePolicy::Ignored,QSizePolicy::Ignored);
  19242. }
  19243. }
  19244. splitter->addWidget(widget);
  19245. if(element.hasChildNodes())
  19246. {
  19247. widgetStack->push(widget);
  19248. populateWidget(element,widgetStack,layoutStack);
  19249. widgetStack->pop();
  19250. }
  19251. }
  19252. void populateWidget(QDomElement element,QStack<QWidget*> *widgetStack,
  19253. QStack<QLayout*> *layoutStack)
  19254. {
  19255. QDomNodeList children= element.childNodes();
  19256. for(int i= 0;i<children.count();i++)
  19257. {
  19258. QDomNode current;
  19259. QDomElement currentElement;
  19260. current= children.at(i);
  19261. if(current.isElement())
  19262. {
  19263. currentElement= current.toElement();
  19264. if(currentElement.tagName()=="layout")
  19265. {
  19266. currentElement.setAttribute("trcontext","configuration");
  19267. addLayoutToWidget(currentElement,widgetStack,layoutStack);
  19268. }
  19269. }
  19270. }
  19271. }
  19272. /*:240*//*241:*/
  19273. #line 5662 "./typica.w"
  19274. void addButtonToLayout(QDomElement element,QStack<QWidget*> *,
  19275. QStack<QLayout*> *layoutStack)
  19276. {
  19277. QAbstractButton*button= NULL;
  19278. QString text=
  19279. QCoreApplication::translate("configuration",
  19280. element.attribute("name").toUtf8().data());
  19281. if(element.hasAttribute("type"))
  19282. {
  19283. QString type= element.attribute("type");
  19284. if(type=="annotation")
  19285. {
  19286. AnnotationButton*abutton= new AnnotationButton(text);
  19287. if(element.hasAttribute("annotation"))
  19288. {
  19289. abutton->setAnnotation(element.attribute("annotation"));
  19290. }
  19291. if(element.hasAttribute("series"))
  19292. {
  19293. abutton->setTemperatureColumn(element.attribute("series").
  19294. toInt());
  19295. }
  19296. if(element.hasAttribute("column"))
  19297. {
  19298. abutton->setAnnotationColumn(element.attribute("column").
  19299. toInt());
  19300. }
  19301. button= abutton;
  19302. }
  19303. else if(type=="check")
  19304. {
  19305. button= new QCheckBox(text);
  19306. }
  19307. else if(type=="push")
  19308. {
  19309. button= new QPushButton(text);
  19310. }
  19311. }
  19312. if(element.hasAttribute("id"))
  19313. {
  19314. button->setObjectName(element.attribute("id"));
  19315. }
  19316. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  19317. layout->addWidget(button);
  19318. }
  19319. /*:241*//*242:*/
  19320. #line 5716 "./typica.w"
  19321. void addSpinBoxToLayout(QDomElement element,QStack<QWidget*> *,
  19322. QStack<QLayout*> *layoutStack)
  19323. {
  19324. AnnotationSpinBox*box= new AnnotationSpinBox("","",NULL);
  19325. if(element.hasAttribute("pretext"))
  19326. {
  19327. box->setPretext(QCoreApplication::translate(
  19328. "configuration",
  19329. element.attribute("pretext").toUtf8().data()));
  19330. }
  19331. if(element.hasAttribute("posttext"))
  19332. {
  19333. box->setPosttext(QCoreApplication::translate(
  19334. "configuration",
  19335. element.attribute("posttext").toUtf8().data()));
  19336. }
  19337. if(element.hasAttribute("series"))
  19338. {
  19339. box->setTemperatureColumn(element.attribute("series").toInt());
  19340. }
  19341. if(element.hasAttribute("column"))
  19342. {
  19343. box->setAnnotationColumn(element.attribute("column").toInt());
  19344. }
  19345. if(element.hasAttribute("min"))
  19346. {
  19347. box->setMinimum(element.attribute("min").toDouble());
  19348. }
  19349. if(element.hasAttribute("max"))
  19350. {
  19351. box->setMaximum(element.attribute("max").toDouble());
  19352. }
  19353. if(element.hasAttribute("decimals"))
  19354. {
  19355. box->setDecimals(element.attribute("decimals").toInt());
  19356. }
  19357. if(element.hasAttribute("step"))
  19358. {
  19359. box->setSingleStep(element.attribute("step").toDouble());
  19360. }
  19361. if(element.hasAttribute("id"))
  19362. {
  19363. box->setObjectName(element.attribute("id"));
  19364. }
  19365. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  19366. layout->addWidget(box);
  19367. }
  19368. /*:242*//*243:*/
  19369. #line 5776 "./typica.w"
  19370. void addZoomLogToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  19371. QStack<QLayout*> *)
  19372. {
  19373. ZoomLog*widget= new ZoomLog;
  19374. if(element.hasAttribute("id"))
  19375. {
  19376. widget->setObjectName(element.attribute("id"));
  19377. }
  19378. if(element.hasChildNodes())
  19379. {
  19380. QDomNodeList children= element.childNodes();
  19381. int column= 0;
  19382. for(int i= 0;i<children.count();i++)
  19383. {
  19384. QDomNode current;
  19385. QDomElement currentElement;
  19386. current= children.at(i);
  19387. if(current.isElement())
  19388. {
  19389. currentElement= current.toElement();
  19390. if(currentElement.tagName()=="column")
  19391. {
  19392. QString text=
  19393. QCoreApplication::translate(
  19394. "configuration",
  19395. currentElement.text().toUtf8().data());
  19396. widget->setHeaderData(column,text);
  19397. column++;
  19398. }
  19399. }
  19400. }
  19401. }
  19402. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  19403. if(splitter)
  19404. {
  19405. splitter->addWidget(widget);
  19406. }
  19407. else
  19408. {
  19409. qDebug()<<"Splitter not found at top of widget stack!";
  19410. }
  19411. }
  19412. /*:243*//*244:*/
  19413. #line 5823 "./typica.w"
  19414. void addGraphToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
  19415. QStack<QLayout*> *)
  19416. {
  19417. GraphView*view= new GraphView;
  19418. if(element.hasAttribute("id"))
  19419. {
  19420. view->setObjectName(element.attribute("id"));
  19421. }
  19422. QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
  19423. splitter->addWidget(view);
  19424. }
  19425. /*:244*//*245:*/
  19426. #line 5840 "./typica.w"
  19427. void addSqlDropToLayout(QDomElement element,QStack<QWidget*> *,
  19428. QStack<QLayout*> *layoutStack)
  19429. {
  19430. SqlComboBox*box= new SqlComboBox();
  19431. if(element.hasAttribute("data"))
  19432. {
  19433. box->setDataColumn(element.attribute("data").toInt());
  19434. }
  19435. if(element.hasAttribute("display"))
  19436. {
  19437. box->setDisplayColumn(element.attribute("display").toInt());
  19438. }
  19439. if(element.hasAttribute("showdata"))
  19440. {
  19441. if(element.attribute("showdata")=="true")
  19442. {
  19443. box->showData(true);
  19444. }
  19445. }
  19446. if(element.hasAttribute("editable"))
  19447. {
  19448. if(element.attribute("editable")=="true")
  19449. {
  19450. box->setEditable(true);
  19451. }
  19452. }
  19453. if(element.hasChildNodes())
  19454. {
  19455. QDomNodeList children= element.childNodes();
  19456. for(int i= 0;i<children.count();i++)
  19457. {
  19458. QDomNode current;
  19459. QDomElement currentElement;
  19460. current= children.at(i);
  19461. if(current.isElement())
  19462. {
  19463. currentElement= current.toElement();
  19464. if(currentElement.tagName()=="null")
  19465. {
  19466. box->addNullOption();
  19467. }
  19468. else if(currentElement.tagName()=="query")
  19469. {
  19470. box->addSqlOptions(currentElement.text());
  19471. }
  19472. }
  19473. }
  19474. }
  19475. if(element.hasAttribute("id"))
  19476. {
  19477. box->setObjectName(element.attribute("id"));
  19478. }
  19479. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  19480. layout->addWidget(box);
  19481. }
  19482. /*:245*//*246:*/
  19483. #line 5919 "./typica.w"
  19484. void addSaltToLayout(QDomElement element,QStack<QWidget*> *,
  19485. QStack<QLayout*> *layoutStack)
  19486. {
  19487. QTableView*view= new QTableView;
  19488. view->setProperty("tabletype",QVariant(QString("SaltTable")));
  19489. SaltModel*model= new SaltModel(element.childNodes().count());
  19490. if(element.hasAttribute("id"))
  19491. {
  19492. view->setObjectName(element.attribute("id"));
  19493. }
  19494. if(element.hasChildNodes())
  19495. {
  19496. QDomNodeList children= element.childNodes();
  19497. int currentColumn= 0;
  19498. for(int i= 0;i<children.count();i++)
  19499. {
  19500. QDomNode current;
  19501. QDomElement currentElement;
  19502. current= children.at(i);
  19503. if(current.isElement())
  19504. {
  19505. currentElement= current.toElement();
  19506. if(currentElement.tagName()=="column")
  19507. {
  19508. if(currentElement.hasAttribute("name"))
  19509. {
  19510. model->setHeaderData(currentColumn,
  19511. Qt::Horizontal,
  19512. QCoreApplication::translate(
  19513. "configuration",
  19514. currentElement.attribute("name").toUtf8().data()));
  19515. }
  19516. if(currentElement.hasAttribute("delegate"))
  19517. {
  19518. /*247:*/
  19519. #line 5970 "./typica.w"
  19520. if(currentElement.attribute("delegate")=="sql")
  19521. {
  19522. /*248:*/
  19523. #line 5986 "./typica.w"
  19524. SqlComboBoxDelegate*delegate= new SqlComboBoxDelegate;
  19525. SqlComboBox*widget= new SqlComboBox();
  19526. if(currentElement.hasAttribute("nulltext"))
  19527. {
  19528. widget->setNullText(currentElement.attribute("nulltext"));
  19529. }
  19530. if(currentElement.hasAttribute("nulldata"))
  19531. {
  19532. widget->setNullData(QVariant(currentElement.attribute("nulldata")));
  19533. }
  19534. if(currentElement.hasAttribute("null"))
  19535. {
  19536. if(currentElement.attribute("null")=="true")
  19537. {
  19538. widget->addNullOption();
  19539. }
  19540. }
  19541. if(currentElement.hasAttribute("showdata"))
  19542. {
  19543. if(currentElement.attribute("showdata")=="true")
  19544. {
  19545. widget->showData(true);
  19546. }
  19547. }
  19548. if(currentElement.hasAttribute("data"))
  19549. {
  19550. widget->setDataColumn(currentElement.attribute("data").toInt());
  19551. }
  19552. if(currentElement.hasAttribute("display"))
  19553. {
  19554. widget->setDisplayColumn(currentElement.attribute("display").toInt());
  19555. }
  19556. widget->addSqlOptions(currentElement.text());
  19557. delegate->setWidget(widget);
  19558. view->setItemDelegateForColumn(currentColumn,delegate);
  19559. /*:248*/
  19560. #line 5973 "./typica.w"
  19561. }
  19562. else if(currentElement.attribute("delegate")=="numeric")
  19563. {
  19564. /*249:*/
  19565. #line 6027 "./typica.w"
  19566. NumericDelegate*delegate= new NumericDelegate;
  19567. view->setItemDelegateForColumn(currentColumn,delegate);
  19568. /*:249*/
  19569. #line 5977 "./typica.w"
  19570. }
  19571. /*:247*/
  19572. #line 5954 "./typica.w"
  19573. }
  19574. currentColumn++;
  19575. }
  19576. }
  19577. }
  19578. }
  19579. view->setModel(model);
  19580. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  19581. layout->addWidget(view);
  19582. }
  19583. /*:246*//*261:*/
  19584. #line 6200 "./typica.w"
  19585. void addLineToLayout(QDomElement element,QStack<QWidget*> *,
  19586. QStack<QLayout*> *layoutStack)
  19587. {
  19588. QLineEdit*widget= new QLineEdit(element.text());
  19589. if(element.hasAttribute("id"))
  19590. {
  19591. widget->setObjectName(element.attribute("id"));
  19592. }
  19593. if(element.hasAttribute("writable"))
  19594. {
  19595. if(element.attribute("writable")=="false")
  19596. {
  19597. widget->setReadOnly(true);
  19598. }
  19599. }
  19600. if(element.hasAttribute("validator"))
  19601. {
  19602. if(element.attribute("validator")=="numeric")
  19603. {
  19604. widget->setValidator(new ScriptValidator(new QDoubleValidator));
  19605. }
  19606. else if(element.attribute("validator")=="integer")
  19607. {
  19608. widget->setValidator(new ScriptValidator(new QIntValidator));
  19609. }
  19610. else if(element.attribute("validator")=="expression"&&
  19611. element.hasAttribute("expression"))
  19612. {
  19613. widget->setValidator(new QRegExpValidator(
  19614. QRegExp(element.attribute("expression")),
  19615. NULL));
  19616. }
  19617. }
  19618. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  19619. layout->addWidget(widget);
  19620. }
  19621. /*:261*//*262:*/
  19622. #line 6241 "./typica.w"
  19623. void addTextToLayout(QDomElement element,QStack<QWidget*> *,
  19624. QStack<QLayout*> *layoutStack)
  19625. {
  19626. QTextEdit*widget= new QTextEdit;
  19627. if(element.hasAttribute("id"))
  19628. {
  19629. widget->setObjectName(element.attribute("id"));
  19630. }
  19631. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  19632. layout->addWidget(widget);
  19633. }
  19634. /*:262*//*263:*/
  19635. #line 6258 "./typica.w"
  19636. void addSqlQueryViewToLayout(QDomElement element,
  19637. QStack<QWidget*> *,
  19638. QStack<QLayout*> *layoutStack)
  19639. {
  19640. SqlQueryView*view= new SqlQueryView;
  19641. if(element.hasAttribute("id"))
  19642. {
  19643. view->setObjectName(element.attribute("id"));
  19644. }
  19645. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  19646. layout->addWidget(view);
  19647. }
  19648. /*:263*//*264:*/
  19649. #line 6275 "./typica.w"
  19650. void addCalendarToLayout(QDomElement element,QStack<QWidget*> *,
  19651. QStack<QLayout*> *layoutStack)
  19652. {
  19653. QWidget*widget;
  19654. if(element.hasAttribute("time"))
  19655. {
  19656. if(element.attribute("time")=="true")
  19657. {
  19658. QDateTimeEdit*edit= new QDateTimeEdit;
  19659. edit->setDateTime(QDateTime::currentDateTime());
  19660. edit->setCalendarPopup(true);
  19661. edit->setDisplayFormat("yyyy-MM-dd hh:mm:ss");
  19662. widget= qobject_cast<QWidget*> (edit);
  19663. }
  19664. else
  19665. {
  19666. QDateEdit*edit= new QDateEdit;
  19667. edit->setDate(QDate::currentDate());
  19668. edit->setCalendarPopup(true);
  19669. edit->setDisplayFormat("yyyy-MM-dd");
  19670. widget= qobject_cast<QWidget*> (edit);
  19671. }
  19672. }
  19673. else
  19674. {
  19675. QDateEdit*edit= new QDateEdit;
  19676. edit->setDate(QDate::currentDate());
  19677. edit->setCalendarPopup(true);
  19678. edit->setDisplayFormat("yyyy-MM-dd");
  19679. widget= qobject_cast<QWidget*> (edit);
  19680. }
  19681. if(element.hasAttribute("id"))
  19682. {
  19683. widget->setObjectName(element.attribute("id"));
  19684. }
  19685. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  19686. layout->addWidget(widget);
  19687. }
  19688. /*:264*//*265:*/
  19689. #line 6318 "./typica.w"
  19690. void setQDateEditProperties(QScriptValue value,QScriptEngine*engine)
  19691. {
  19692. setQDateTimeEditProperties(value,engine);
  19693. }
  19694. void setQDateTimeEditProperties(QScriptValue value,QScriptEngine*engine)
  19695. {
  19696. setQAbstractSpinBoxProperties(value,engine);
  19697. value.setProperty("setDate",engine->newFunction(QDateTimeEdit_setDate));
  19698. value.setProperty("day",engine->newFunction(QDateTimeEdit_day));
  19699. value.setProperty("month",engine->newFunction(QDateTimeEdit_month));
  19700. value.setProperty("year",engine->newFunction(QDateTimeEdit_year));
  19701. value.setProperty("setToCurrentTime",
  19702. engine->newFunction(QDateTimeEdit_setToCurrentTime));
  19703. }
  19704. /*:265*//*266:*/
  19705. #line 6340 "./typica.w"
  19706. QScriptValue QDateTimeEdit_setDate(QScriptContext*context,QScriptEngine*)
  19707. {
  19708. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  19709. if(context->argumentCount()==3)
  19710. {
  19711. self->setDate(QDate(argument<int> (0,context),
  19712. argument<int> (1,context),
  19713. argument<int> (2,context)));
  19714. }
  19715. else
  19716. {
  19717. context->throwError("Incorrect number of arguments passed to "
  19718. "QDateTimeEdit::setDate(). This method takes three integer arguments "
  19719. "specifying the year, month, and day.");
  19720. }
  19721. return QScriptValue();
  19722. }
  19723. QScriptValue QDateTimeEdit_day(QScriptContext*context,QScriptEngine*)
  19724. {
  19725. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  19726. return QScriptValue(self->date().day());
  19727. }
  19728. QScriptValue QDateTimeEdit_month(QScriptContext*context,QScriptEngine*)
  19729. {
  19730. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  19731. return QScriptValue(self->date().month());
  19732. }
  19733. QScriptValue QDateTimeEdit_year(QScriptContext*context,QScriptEngine*)
  19734. {
  19735. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  19736. return QScriptValue(self->date().year());
  19737. }
  19738. QScriptValue QDateTimeEdit_setToCurrentTime(QScriptContext*context,QScriptEngine*)
  19739. {
  19740. QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
  19741. self->setDateTime(QDateTime::currentDateTime());
  19742. return QScriptValue();
  19743. }
  19744. /*:266*//*268:*/
  19745. #line 6400 "./typica.w"
  19746. void addTimeEditToLayout(QDomElement element,QStack<QWidget*> *,
  19747. QStack<QLayout*> *layoutStack)
  19748. {
  19749. QTimeEdit*edit= new QTimeEdit;
  19750. if(element.hasAttribute("displayFormat"))
  19751. {
  19752. edit->setDisplayFormat(element.attribute("displayFormat"));
  19753. }
  19754. else
  19755. {
  19756. edit->setDisplayFormat("mm:ss.zzz");
  19757. }
  19758. if(element.hasAttribute("id"))
  19759. {
  19760. edit->setObjectName(element.attribute("id"));
  19761. }
  19762. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  19763. layout->addWidget(edit);
  19764. }
  19765. /*:268*//*269:*/
  19766. #line 6423 "./typica.w"
  19767. void setQTimeEditProperties(QScriptValue value,QScriptEngine*engine)
  19768. {
  19769. setQDateTimeEditProperties(value,engine);
  19770. }
  19771. /*:269*//*273:*/
  19772. #line 6452 "./typica.w"
  19773. QScriptValue findChildObject(QScriptContext*context,QScriptEngine*engine)
  19774. {
  19775. QObject*parent= argument<QObject*> (0,context);
  19776. QString name= argument<QString> (1,context);
  19777. QObject*object= parent->findChild<QObject*> (name);
  19778. QScriptValue value;
  19779. if(object)
  19780. {
  19781. value= engine->newQObject(object);
  19782. QString className= object->metaObject()->className();
  19783. /*274:*/
  19784. #line 6470 "./typica.w"
  19785. if(className=="TemperatureDisplay")
  19786. {
  19787. setTemperatureDisplayProperties(value,engine);
  19788. }
  19789. else if(className=="TimerDisplay")
  19790. {
  19791. setTimerDisplayProperties(value,engine);
  19792. }
  19793. else if(className=="QAction")
  19794. {
  19795. setQActionProperties(value,engine);
  19796. }
  19797. else if(className=="QBoxLayout")
  19798. {
  19799. setQBoxLayoutProperties(value,engine);
  19800. }
  19801. else if(className=="QDateEdit")
  19802. {
  19803. setQDateEditProperties(value,engine);
  19804. }
  19805. else if(className=="QDateTimeEdit")
  19806. {
  19807. setQDateTimeEditProperties(value,engine);
  19808. }
  19809. else if(className=="QFrame")
  19810. {
  19811. setQFrameProperties(value,engine);
  19812. }
  19813. else if(className=="QHBoxLayout")
  19814. {
  19815. setQBoxLayoutProperties(value,engine);
  19816. }
  19817. else if(className=="QLCDNumber")
  19818. {
  19819. setQLCDNumberProperties(value,engine);
  19820. }
  19821. else if(className=="QMenu")
  19822. {
  19823. setQMenuProperties(value,engine);
  19824. }
  19825. else if(className=="QMenuBar")
  19826. {
  19827. setQMenuBarProperties(value,engine);
  19828. }
  19829. else if(className=="QPushButton")
  19830. {
  19831. setQPushButtonProperties(value,engine);
  19832. }
  19833. else if(className=="QSplitter")
  19834. {
  19835. setQSplitterProperties(value,engine);
  19836. }
  19837. else if(className=="QTableView")
  19838. {
  19839. if(object->property("tabletype").isValid())
  19840. {
  19841. if(object->property("tabletype").toString()=="SaltTable")
  19842. {
  19843. setSaltTableProperties(value,engine);
  19844. }
  19845. }
  19846. }
  19847. else if(className=="QVBoxLayout")
  19848. {
  19849. setQBoxLayoutProperties(value,engine);
  19850. }
  19851. else if(className=="QWidget")
  19852. {
  19853. setQWidgetProperties(value,engine);
  19854. }
  19855. else if(className=="ScriptQMainWindow")
  19856. {
  19857. setQMainWindowProperties(value,engine);
  19858. }
  19859. else if(className=="SqlComboBox")
  19860. {
  19861. setSqlComboBoxProperties(value,engine);
  19862. }
  19863. else if(className=="SqlQueryView")
  19864. {
  19865. setSqlQueryViewProperties(value,engine);
  19866. }
  19867. else if(className=="ZoomLog")
  19868. {
  19869. setZoomLogProperties(value,engine);
  19870. }
  19871. else if(className=="QTextEdit")
  19872. {
  19873. setQTextEditProperties(value,engine);
  19874. }
  19875. else if(className=="QWebView")
  19876. {
  19877. setQWebViewProperties(value,engine);
  19878. }
  19879. else if(className=="QLineEdit")
  19880. {
  19881. setQLineEditProperties(value,engine);
  19882. }
  19883. else if(className=="QSvgWidget")
  19884. {
  19885. setQSvgWidgetProperties(value,engine);
  19886. }
  19887. else if(className=="QTabBar")
  19888. {
  19889. setQTabBarProperties(value,engine);
  19890. }
  19891. else if(className=="PrinterSelector")
  19892. {
  19893. setQComboBoxProperties(value,engine);
  19894. }
  19895. /*:274*/
  19896. #line 6463 "./typica.w"
  19897. }
  19898. return value;
  19899. }
  19900. /*:273*//*276:*/
  19901. #line 6611 "./typica.w"
  19902. QScriptValue SaltTable_columnSum(QScriptContext*context,QScriptEngine*engine)
  19903. {
  19904. QTableView*self= getself<QTableView*> (context);
  19905. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  19906. QString datum;
  19907. double total= 0.0;
  19908. int column= argument<int> (0,context);
  19909. int role= argument<int> (1,context);
  19910. for(int i= 0;i<model->rowCount();i++)
  19911. {
  19912. datum= model->data(model->index(i,column),role).toString();
  19913. if(!datum.isEmpty())
  19914. {
  19915. total+= datum.toDouble();
  19916. }
  19917. }
  19918. return QScriptValue(engine,total);
  19919. }
  19920. /*:276*//*277:*/
  19921. #line 6635 "./typica.w"
  19922. QScriptValue SaltTable_columnArray(QScriptContext*context,
  19923. QScriptEngine*engine)
  19924. {
  19925. QTableView*self= getself<QTableView*> (context);
  19926. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  19927. int column= argument<int> (0,context);
  19928. int role= argument<int> (1,context);
  19929. QString literal= model->arrayLiteral(column,role);
  19930. return QScriptValue(engine,literal);
  19931. }
  19932. QScriptValue SaltTable_quotedColumnArray(QScriptContext*context,
  19933. QScriptEngine*engine)
  19934. {
  19935. QTableView*self= getself<QTableView*> (context);
  19936. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  19937. int column= argument<int> (0,context);
  19938. int role= argument<int> (1,context);
  19939. QString literal= model->quotedArrayLiteral(column,role);
  19940. return QScriptValue(engine,literal);
  19941. }
  19942. QScriptValue SaltTable_bindableColumnArray(QScriptContext*context,
  19943. QScriptEngine*engine)
  19944. {
  19945. QTableView*self= getself<QTableView*> (context);
  19946. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  19947. int column= argument<int> (0,context);
  19948. int role= argument<int> (1,context);
  19949. QString literal= model->arrayLiteral(column,role);
  19950. literal.chop(1);
  19951. literal= literal.remove(0,1);
  19952. return QScriptValue(engine,literal);
  19953. }
  19954. QScriptValue SaltTable_bindableQuotedColumnArray(QScriptContext*context,
  19955. QScriptEngine*engine)
  19956. {
  19957. QTableView*self= getself<QTableView*> (context);
  19958. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  19959. int column= argument<int> (0,context);
  19960. int role= argument<int> (1,context);
  19961. QString literal= model->quotedArrayLiteral(column,role);
  19962. literal.chop(1);
  19963. literal= literal.remove(0,1);
  19964. return QScriptValue(engine,literal);
  19965. }
  19966. /*:277*//*278:*/
  19967. #line 6687 "./typica.w"
  19968. QScriptValue SaltTable_model(QScriptContext*context,QScriptEngine*engine)
  19969. {
  19970. QTableView*self= getself<QTableView*> (context);
  19971. QScriptValue value= engine->newQObject(self->model());
  19972. return value;
  19973. }
  19974. /*:278*//*279:*/
  19975. #line 6701 "./typica.w"
  19976. QScriptValue SaltTable_setData(QScriptContext*context,QScriptEngine*)
  19977. {
  19978. QTableView*self= getself<QTableView*> (context);
  19979. int row= argument<int> (0,context);
  19980. int column= argument<int> (1,context);
  19981. QVariant value= argument<QVariant> (2,context);
  19982. int role= argument<int> (3,context);
  19983. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  19984. QModelIndex cell= model->index(row,column);
  19985. model->setData(cell,value,role);
  19986. self->update(cell);
  19987. return QScriptValue();
  19988. }
  19989. /*:279*//*280:*/
  19990. #line 6719 "./typica.w"
  19991. QScriptValue SaltTable_data(QScriptContext*context,QScriptEngine*engine)
  19992. {
  19993. QTableView*self= getself<QTableView*> (context);
  19994. int row= argument<int> (0,context);
  19995. int column= argument<int> (1,context);
  19996. int role= argument<int> (2,context);
  19997. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  19998. QModelIndex cell= model->index(row,column);
  19999. QVariant value= model->data(cell,role);
  20000. QScriptValue retval= engine->newVariant(value);
  20001. retval.setProperty("value",QScriptValue(value.toString()));
  20002. return retval;
  20003. }
  20004. /*:280*//*281:*/
  20005. #line 6739 "./typica.w"
  20006. QScriptValue SaltTable_clear(QScriptContext*context,QScriptEngine*)
  20007. {
  20008. QTableView*self= getself<QTableView*> (context);
  20009. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  20010. model->clear();
  20011. return QScriptValue();
  20012. }
  20013. /*:281*//*282:*/
  20014. #line 6751 "./typica.w"
  20015. QScriptValue SaltTable_removeRow(QScriptContext*context,QScriptEngine*engine)
  20016. {
  20017. QTableView*self= getself<QTableView*> (context);
  20018. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  20019. int row= argument<int> (0,context);
  20020. return engine->newVariant(model->removeRow(row));
  20021. }
  20022. /*:282*//*283:*/
  20023. #line 6764 "./typica.w"
  20024. QScriptValue SaltTable_findData(QScriptContext*context,QScriptEngine*engine)
  20025. {
  20026. QTableView*self= getself<QTableView*> (context);
  20027. SaltModel*model= qobject_cast<SaltModel*> (self->model());
  20028. QVariant value= argument<QVariant> (0,context);
  20029. int column= argument<int> (1,context);
  20030. return engine->newVariant(model->findData(value,column));
  20031. }
  20032. /*:283*//*284:*/
  20033. #line 6777 "./typica.w"
  20034. void setSaltTableProperties(QScriptValue value,QScriptEngine*engine)
  20035. {
  20036. setQWidgetProperties(value,engine);
  20037. value.setProperty("columnArray",
  20038. engine->newFunction(SaltTable_columnArray));
  20039. value.setProperty("quotedColumnArray",
  20040. engine->newFunction(SaltTable_quotedColumnArray));
  20041. value.setProperty("bindableColumnArray",
  20042. engine->newFunction(SaltTable_bindableColumnArray));
  20043. value.setProperty("bindableQuotedColumnArray",
  20044. engine->newFunction(SaltTable_bindableQuotedColumnArray));
  20045. value.setProperty("columnSum",engine->newFunction(SaltTable_columnSum));
  20046. value.setProperty("data",engine->newFunction(SaltTable_data));
  20047. value.setProperty("model",engine->newFunction(SaltTable_model));
  20048. value.setProperty("setData",engine->newFunction(SaltTable_setData));
  20049. value.setProperty("clear",engine->newFunction(SaltTable_clear));
  20050. value.setProperty("removeRow",engine->newFunction(SaltTable_removeRow));
  20051. value.setProperty("findData",engine->newFunction(SaltTable_findData));
  20052. }
  20053. /*:284*//*286:*/
  20054. #line 6814 "./typica.w"
  20055. void setSqlComboBoxProperties(QScriptValue value,QScriptEngine*engine)
  20056. {
  20057. setQComboBoxProperties(value,engine);
  20058. }
  20059. void setQComboBoxProperties(QScriptValue value,QScriptEngine*engine)
  20060. {
  20061. setQWidgetProperties(value,engine);
  20062. value.setProperty("currentData",
  20063. engine->newFunction(QComboBox_currentData));
  20064. value.setProperty("addItem",engine->newFunction(QComboBox_addItem));
  20065. value.setProperty("setModel",engine->newFunction(QComboBox_setModel));
  20066. value.setProperty("findText",engine->newFunction(QComboBox_findText));
  20067. value.setProperty("findData",engine->newFunction(QComboBox_findData));
  20068. }
  20069. QScriptValue QComboBox_currentData(QScriptContext*context,
  20070. QScriptEngine*engine)
  20071. {
  20072. QComboBox*self= getself<QComboBox*> (context);
  20073. return QScriptValue(engine,
  20074. self->itemData(self->currentIndex()).toString());
  20075. }
  20076. QScriptValue QComboBox_addItem(QScriptContext*context,QScriptEngine*)
  20077. {
  20078. QComboBox*self= getself<QComboBox*> (context);
  20079. self->addItem(argument<QString> (0,context));
  20080. return QScriptValue();
  20081. }
  20082. QScriptValue QComboBox_setModel(QScriptContext*context,QScriptEngine*)
  20083. {
  20084. QComboBox*self= getself<QComboBox*> (context);
  20085. self->setModel(argument<QAbstractItemModel*> (0,context));
  20086. return QScriptValue();
  20087. }
  20088. QScriptValue QComboBox_findText(QScriptContext*context,QScriptEngine*engine)
  20089. {
  20090. QComboBox*self= getself<QComboBox*> (context);
  20091. return QScriptValue(engine,self->findText(argument<QString> (0,context)));
  20092. }
  20093. QScriptValue QComboBox_findData(QScriptContext*context,QScriptEngine*engine)
  20094. {
  20095. QComboBox*self= getself<QComboBox*> (context);
  20096. return QScriptValue(engine,self->findData(argument<QVariant> (0,context)));
  20097. }
  20098. #line 1 "./abouttypica.w"
  20099. /*:286*//*299:*/
  20100. #line 401 "./units.w"
  20101. QScriptValue Units_convertTemperature(QScriptContext*context,QScriptEngine*)
  20102. {
  20103. return QScriptValue(Units::convertTemperature(argument<double> (0,context),
  20104. argument<Units::Unit> (1,context),
  20105. argument<Units::Unit> (2,context)));
  20106. }
  20107. QScriptValue Units_convertRelativeTemperature(QScriptContext*context,
  20108. QScriptEngine*)
  20109. {
  20110. return QScriptValue(Units::convertRelativeTemperature(
  20111. argument<double> (0,context),
  20112. argument<Units::Unit> (1,context),
  20113. argument<Units::Unit> (2,context)));
  20114. }
  20115. QScriptValue Units_isTemperatureUnit(QScriptContext*context,QScriptEngine*)
  20116. {
  20117. return QScriptValue(Units::isTemperatureUnit(argument<Units::Unit> (0,context)));
  20118. }
  20119. QScriptValue Units_convertWeight(QScriptContext*context,QScriptEngine*)
  20120. {
  20121. return QScriptValue(Units::convertWeight(argument<double> (0,context),
  20122. argument<Units::Unit> (1,context),
  20123. argument<Units::Unit> (2,context)));
  20124. }
  20125. QScriptValue Units_isWeightUnit(QScriptContext*context,QScriptEngine*)
  20126. {
  20127. return QScriptValue(Units::isWeightUnit(argument<Units::Unit> (0,context)));
  20128. }
  20129. /*:299*//*302:*/
  20130. #line 449 "./units.w"
  20131. QScriptValue Unit_toScriptValue(QScriptEngine*engine,const Units::Unit&value)
  20132. {
  20133. return engine->newVariant(QVariant(value));
  20134. }
  20135. void Unit_fromScriptValue(const QScriptValue&sv,Units::Unit&value)
  20136. {
  20137. value= sv.toVariant().value<Units::Unit> ();
  20138. }
  20139. /*:302*//*312:*/
  20140. #line 149 "./measurement.w"
  20141. QScriptValue constructMeasurement(QScriptContext*context,QScriptEngine*engine)
  20142. {
  20143. QScriptValue object;
  20144. if(context->argumentCount()==2||context->argumentCount()==3)
  20145. {
  20146. double measurement= argument<double> (0,context);
  20147. QTime timestamp= argument<QTime> (1,context);
  20148. Units::Unit unit= Units::Fahrenheit;
  20149. if(context->argumentCount()==3)
  20150. {
  20151. unit= argument<Units::Unit> (2,context);
  20152. }
  20153. object= engine->toScriptValue<Measurement> (Measurement(measurement,timestamp,unit));
  20154. setMeasurementProperties(object,engine);
  20155. }
  20156. else
  20157. {
  20158. context->throwError("Incorrect number of arguments passed to "
  20159. "Measurement::Measurement(). This method takes two "
  20160. "or three arguments.");
  20161. }
  20162. return object;
  20163. }
  20164. /*:312*//*313:*/
  20165. #line 176 "./measurement.w"
  20166. void setMeasurementProperties(QScriptValue,QScriptEngine*)
  20167. {
  20168. }
  20169. /*:313*//*314:*/
  20170. #line 184 "./measurement.w"
  20171. QScriptValue Measurement_toScriptValue(QScriptEngine*engine,const Measurement&measurement)
  20172. {
  20173. QVariant var;
  20174. var.setValue(measurement);
  20175. return engine->newVariant(var);
  20176. }
  20177. void Measurement_fromScriptValue(const QScriptValue&value,Measurement&measurement)
  20178. {
  20179. measurement= value.toVariant().value<Measurement> ();
  20180. }
  20181. #line 6883 "./typica.w"
  20182. /*:314*//*332:*/
  20183. #line 7461 "./typica.w"
  20184. QScriptValue constructDAQ(QScriptContext*context,QScriptEngine*engine)
  20185. {
  20186. QScriptValue object;
  20187. if(context->argumentCount()==1)
  20188. {
  20189. object= engine->newQObject(new DAQ(argument<QString> (0,context)),
  20190. QScriptEngine::ScriptOwnership);
  20191. setDAQProperties(object,engine);
  20192. }
  20193. else if(context->argumentCount()==2)
  20194. {
  20195. object= engine->newQObject(new DAQ(argument<QString> (0,context),
  20196. argument<QString> (1,context)),
  20197. QScriptEngine::ScriptOwnership);
  20198. setDAQProperties(object,engine);
  20199. }
  20200. else
  20201. {
  20202. context->throwError("Incorrect number of arguments passed to DAQ"
  20203. "constructor. The DAQ constructor takes one"
  20204. "string as an argument specifying a device name."
  20205. "Example: Dev1");
  20206. }
  20207. return object;
  20208. }
  20209. /*:332*//*333:*/
  20210. #line 7491 "./typica.w"
  20211. void setDAQProperties(QScriptValue value,QScriptEngine*engine)
  20212. {
  20213. setQObjectProperties(value,engine);
  20214. value.setProperty("newChannel",engine->newFunction(DAQ_newChannel));
  20215. }
  20216. /*:333*//*334:*/
  20217. #line 7501 "./typica.w"
  20218. QScriptValue DAQ_newChannel(QScriptContext*context,QScriptEngine*engine)
  20219. {
  20220. DAQ*self= getself<DAQ*> (context);
  20221. QScriptValue object;
  20222. if(self)
  20223. {
  20224. object=
  20225. engine->newQObject(self->newChannel(argument<int> (0,context),
  20226. argument<int> (1,context)));
  20227. setChannelProperties(object,engine);
  20228. }
  20229. return object;
  20230. }
  20231. /*:334*//*341:*/
  20232. #line 7657 "./typica.w"
  20233. QScriptValue constructFakeDAQ(QScriptContext*context,
  20234. QScriptEngine*engine)
  20235. {
  20236. QScriptValue object;
  20237. if(context->argumentCount()==1)
  20238. {
  20239. object=
  20240. engine->newQObject(new FakeDAQ(argument<QString> (0,context)),
  20241. QScriptEngine::ScriptOwnership);
  20242. setFakeDAQProperties(object,engine);
  20243. }
  20244. else
  20245. {
  20246. context->throwError("Incorrect number of arguments passed to DAQ"
  20247. "constructor. The DAQ constructor takes one"
  20248. "string as an argument specifying a device name."
  20249. "Example: Dev1");
  20250. }
  20251. return object;
  20252. }
  20253. void setFakeDAQProperties(QScriptValue value,QScriptEngine*engine)
  20254. {
  20255. setQObjectProperties(value,engine);
  20256. value.setProperty("newChannel",engine->newFunction(FakeDAQ_newChannel));
  20257. }
  20258. QScriptValue FakeDAQ_newChannel(QScriptContext*context,QScriptEngine*engine)
  20259. {
  20260. FakeDAQ*self= getself<FakeDAQ*> (context);
  20261. QScriptValue object;
  20262. if(self)
  20263. {
  20264. object=
  20265. engine->newQObject(self->newChannel(argument<int> (0,context),
  20266. argument<int> (1,context)));
  20267. setChannelProperties(object,engine);
  20268. }
  20269. return object;
  20270. }
  20271. /*:341*//*345:*/
  20272. #line 7748 "./typica.w"
  20273. void setChannelProperties(QScriptValue value,QScriptEngine*engine)
  20274. {
  20275. setQObjectProperties(value,engine);
  20276. }
  20277. /*:345*//*352:*/
  20278. #line 7940 "./typica.w"
  20279. QScriptValue constructLinearCalibrator(QScriptContext*,QScriptEngine*engine)
  20280. {
  20281. QScriptValue object= engine->newQObject(new LinearCalibrator(NULL));
  20282. setLinearCalibratorProperties(object,engine);
  20283. return object;
  20284. }
  20285. void setLinearCalibratorProperties(QScriptValue value,QScriptEngine*engine)
  20286. {
  20287. setQObjectProperties(value,engine);
  20288. }
  20289. /*:352*//*357:*/
  20290. #line 8078 "./typica.w"
  20291. QScriptValue constructLinearSplineInterpolator(QScriptContext*,QScriptEngine*engine)
  20292. {
  20293. QScriptValue object= engine->newQObject(new LinearSplineInterpolator(NULL));
  20294. setLinearSplineInterpolatorProperties(object,engine);
  20295. return object;
  20296. }
  20297. void setLinearSplineInterpolatorProperties(QScriptValue value,QScriptEngine*engine)
  20298. {
  20299. setQObjectProperties(value,engine);
  20300. }
  20301. /*:357*//*367:*/
  20302. #line 8287 "./typica.w"
  20303. QScriptValue constructTemperatureDisplay(QScriptContext*,
  20304. QScriptEngine*engine)
  20305. {
  20306. QScriptValue object= engine->newQObject(new TemperatureDisplay);
  20307. setTemperatureDisplayProperties(object,engine);
  20308. return object;
  20309. }
  20310. void setTemperatureDisplayProperties(QScriptValue value,QScriptEngine*engine)
  20311. {
  20312. setQLCDNumberProperties(value,engine);
  20313. value.setProperty("setDisplayUnits",
  20314. engine->newFunction(TemperatureDisplay_setDisplayUnits));
  20315. }
  20316. /*:367*//*368:*/
  20317. #line 8311 "./typica.w"
  20318. QScriptValue TemperatureDisplay_setDisplayUnits(QScriptContext*context,QScriptEngine*)
  20319. {
  20320. TemperatureDisplay*self= getself<TemperatureDisplay*> (context);
  20321. self->setDisplayUnits((Units::Unit)argument<int> (0,context));
  20322. return QScriptValue();
  20323. }
  20324. /*:368*//*375:*/
  20325. #line 8448 "./typica.w"
  20326. QScriptValue constructMeasurementTimeOffset(QScriptContext*,
  20327. QScriptEngine*engine)
  20328. {
  20329. QScriptValue object=
  20330. engine->newQObject(new MeasurementTimeOffset(QTime::currentTime()));
  20331. setMeasurementTimeOffsetProperties(object,engine);
  20332. return object;
  20333. }
  20334. void setMeasurementTimeOffsetProperties(QScriptValue value,
  20335. QScriptEngine*engine)
  20336. {
  20337. setQObjectProperties(value,engine);
  20338. }
  20339. /*:375*//*380:*/
  20340. #line 8567 "./typica.w"
  20341. QScriptValue constructThresholdDetector(QScriptContext*,QScriptEngine*engine)
  20342. {
  20343. QScriptValue object= engine->newQObject(new ThresholdDetector(300));
  20344. return object;
  20345. }
  20346. void setThresholdDetectorProperties(QScriptValue value,QScriptEngine*engine)
  20347. {
  20348. setQObjectProperties(value,engine);
  20349. }
  20350. /*:380*//*385:*/
  20351. #line 8664 "./typica.w"
  20352. QScriptValue constructZeroEmitter(QScriptContext*context,
  20353. QScriptEngine*engine)
  20354. {
  20355. QScriptValue object=
  20356. engine->newQObject(new ZeroEmitter(argument<int> (0,context)));
  20357. setZeroEmitterProperties(object,engine);
  20358. return object;
  20359. }
  20360. void setZeroEmitterProperties(QScriptValue value,QScriptEngine*engine)
  20361. {
  20362. setQObjectProperties(value,engine);
  20363. }
  20364. /*:385*//*390:*/
  20365. #line 8744 "./typica.w"
  20366. QScriptValue constructMeasurementAdapter(QScriptContext*context,
  20367. QScriptEngine*engine)
  20368. {
  20369. QScriptValue object=
  20370. engine->newQObject(new MeasurementAdapter(argument<int> (0,context)));
  20371. setMeasurementAdapterProperties(object,engine);
  20372. return object;
  20373. }
  20374. void setMeasurementAdapterProperties(QScriptValue value,QScriptEngine*engine)
  20375. {
  20376. setQObjectProperties(value,engine);
  20377. }
  20378. /*:390*//*407:*/
  20379. #line 9206 "./typica.w"
  20380. QScriptValue constructGraphView(QScriptContext*,QScriptEngine*engine)
  20381. {
  20382. QScriptValue object= engine->newQObject(new GraphView);
  20383. setGraphViewProperties(object,engine);
  20384. return object;
  20385. }
  20386. void setGraphViewProperties(QScriptValue value,QScriptEngine*engine)
  20387. {
  20388. setQGraphicsViewProperties(value,engine);
  20389. }
  20390. /*:407*//*430:*/
  20391. #line 9856 "./typica.w"
  20392. QScriptValue constructZoomLog(QScriptContext*,QScriptEngine*engine)
  20393. {
  20394. QScriptValue object= engine->newQObject(new ZoomLog);
  20395. setZoomLogProperties(object,engine);
  20396. return object;
  20397. }
  20398. void setZoomLogProperties(QScriptValue value,QScriptEngine*engine)
  20399. {
  20400. setQTableViewProperties(value,engine);
  20401. value.setProperty("saveXML",engine->newFunction(ZoomLog_saveXML));
  20402. value.setProperty("saveCSV",engine->newFunction(ZoomLog_saveCSV));
  20403. value.setProperty("saveState",engine->newFunction(ZoomLog_saveState));
  20404. value.setProperty("restoreState",
  20405. engine->newFunction(ZoomLog_restoreState));
  20406. value.setProperty("lastTime",engine->newFunction(ZoomLog_lastTime));
  20407. value.setProperty("saveTemporary",
  20408. engine->newFunction(ZoomLog_saveTemporary));
  20409. value.setProperty("setDisplayUnits",engine->newFunction(ZoomLog_setDisplayUnits));
  20410. }
  20411. /*:430*//*431:*/
  20412. #line 9883 "./typica.w"
  20413. QScriptValue ZoomLog_saveXML(QScriptContext*context,QScriptEngine*engine)
  20414. {
  20415. ZoomLog*self= getself<ZoomLog*> (context);
  20416. bool retval= self->saveXML(argument<QIODevice*> (0,context));
  20417. return QScriptValue(engine,retval);
  20418. }
  20419. QScriptValue ZoomLog_saveCSV(QScriptContext*context,QScriptEngine*engine)
  20420. {
  20421. ZoomLog*self= getself<ZoomLog*> (context);
  20422. bool retval= self->saveCSV(argument<QIODevice*> (0,context));
  20423. return QScriptValue(engine,retval);
  20424. }
  20425. QScriptValue ZoomLog_saveTemporary(QScriptContext*context,
  20426. QScriptEngine*engine)
  20427. {
  20428. ZoomLog*self= getself<ZoomLog*> (context);
  20429. QString filename= QDir::tempPath();
  20430. filename.append("/");
  20431. filename.append(QUuid::createUuid().toString());
  20432. filename.append(".xml");
  20433. QFile*file= new QFile(filename);
  20434. self->saveXML(file);
  20435. file->close();
  20436. delete file;
  20437. return QScriptValue(engine,filename);
  20438. }
  20439. /*:431*//*432:*/
  20440. #line 9931 "./typica.w"
  20441. QScriptValue ZoomLog_saveState(QScriptContext*context,QScriptEngine*)
  20442. {
  20443. ZoomLog*self= getself<ZoomLog*> (context);
  20444. QString key= argument<QString> (0,context);
  20445. int columns= argument<int> (1,context);
  20446. QSettings settings;
  20447. for(int i= 0;i<columns;i++)
  20448. {
  20449. if(self->columnWidth(i))
  20450. {
  20451. settings.beginGroup(key);
  20452. settings.setValue(QString("%1").arg(i),self->columnWidth(i));
  20453. settings.endGroup();
  20454. }
  20455. }
  20456. return QScriptValue();
  20457. }
  20458. QScriptValue ZoomLog_restoreState(QScriptContext*context,QScriptEngine*)
  20459. {
  20460. ZoomLog*self= getself<ZoomLog*> (context);
  20461. QString key= argument<QString> (0,context);
  20462. int columns= argument<int> (1,context);
  20463. QSettings settings;
  20464. for(int i= 0;i<columns;i++)
  20465. {
  20466. settings.beginGroup(key);
  20467. self->setColumnWidth(i,
  20468. settings.value(QString("%1").arg(i),80).toInt());
  20469. if(settings.value(QString("%1").arg(i),80).toInt()==0)
  20470. {
  20471. self->setColumnWidth(i,80);
  20472. }
  20473. settings.endGroup();
  20474. }
  20475. return QScriptValue();
  20476. }
  20477. QScriptValue ZoomLog_lastTime(QScriptContext*context,QScriptEngine*engine)
  20478. {
  20479. ZoomLog*self= getself<ZoomLog*> (context);
  20480. return QScriptValue(engine,self->lastTime(argument<int> (0,context)));
  20481. }
  20482. /*:432*//*433:*/
  20483. #line 9984 "./typica.w"
  20484. QScriptValue ZoomLog_setDisplayUnits(QScriptContext*context,QScriptEngine*)
  20485. {
  20486. ZoomLog*self= getself<ZoomLog*> (context);
  20487. self->setDisplayUnits((Units::Unit)argument<int> (0,context));
  20488. return QScriptValue();
  20489. }
  20490. /*:433*//*468:*/
  20491. #line 10804 "./typica.w"
  20492. QScriptValue constructAnnotationButton(QScriptContext*context,
  20493. QScriptEngine*engine)
  20494. {
  20495. QScriptValue object=
  20496. engine->newQObject(new AnnotationButton(argument<QString> (0,context)));
  20497. setAnnotationButtonProperties(object,engine);
  20498. return object;
  20499. }
  20500. void setAnnotationButtonProperties(QScriptValue value,QScriptEngine*engine)
  20501. {
  20502. setQPushButtonProperties(value,engine);
  20503. }
  20504. /*:468*//*476:*/
  20505. #line 10947 "./typica.w"
  20506. QScriptValue constructAnnotationSpinBox(QScriptContext*context,
  20507. QScriptEngine*engine)
  20508. {
  20509. QScriptValue object= engine->newQObject(new AnnotationSpinBox(
  20510. argument<QString> (0,context),argument<QString> (1,context)));
  20511. setAnnotationSpinBoxProperties(object,engine);
  20512. return object;
  20513. }
  20514. void setAnnotationSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  20515. {
  20516. setQDoubleSpinBoxProperties(value,engine);
  20517. }
  20518. void setQDoubleSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  20519. {
  20520. setQAbstractSpinBoxProperties(value,engine);
  20521. }
  20522. void setQAbstractSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
  20523. {
  20524. setQWidgetProperties(value,engine);
  20525. }
  20526. /*:476*//*497:*/
  20527. #line 11370 "./typica.w"
  20528. QScriptValue constructTimerDisplay(QScriptContext*,QScriptEngine*engine)
  20529. {
  20530. QScriptValue object= engine->newQObject(new TimerDisplay);
  20531. setTimerDisplayProperties(object,engine);
  20532. return object;
  20533. }
  20534. void setTimerDisplayProperties(QScriptValue value,QScriptEngine*engine)
  20535. {
  20536. setQLCDNumberProperties(value,engine);
  20537. value.setProperty("setTimerMode",engine->newFunction(TimerDisplay_setTimerMode));
  20538. }
  20539. /*:497*//*498:*/
  20540. #line 11389 "./typica.w"
  20541. QScriptValue TimerDisplay_setTimerMode(QScriptContext*context,QScriptEngine*)
  20542. {
  20543. TimerDisplay*self= getself<TimerDisplay*> (context);
  20544. if(self)
  20545. {
  20546. switch(argument<int> (0,context))
  20547. {
  20548. case 0:
  20549. self->setMode(TimerDisplay::CountUp);
  20550. break;
  20551. case 1:
  20552. self->setMode(TimerDisplay::CountDown);
  20553. break;
  20554. case 2:
  20555. self->setMode(TimerDisplay::Clock);
  20556. break;
  20557. default:
  20558. break;
  20559. }
  20560. }
  20561. return QScriptValue();
  20562. }
  20563. /*:498*//*525:*/
  20564. #line 11895 "./typica.w"
  20565. QScriptValue constructWidgetDecorator(QScriptContext*context,
  20566. QScriptEngine*engine)
  20567. {
  20568. QWidget*widget= argument<QWidget*> (0,context);
  20569. QString text= argument<QString> (1,context);
  20570. Qt::Orientations orientation;
  20571. switch(argument<int> (2,context))
  20572. {
  20573. case 2:
  20574. orientation= Qt::Vertical;
  20575. break;
  20576. default:
  20577. orientation= Qt::Horizontal;
  20578. break;
  20579. }
  20580. QScriptValue object=
  20581. engine->newQObject(new WidgetDecorator(widget,text,orientation));
  20582. setWidgetDecoratorProperties(object,engine);
  20583. return object;
  20584. }
  20585. void setWidgetDecoratorProperties(QScriptValue value,QScriptEngine*engine)
  20586. {
  20587. setQWidgetProperties(value,engine);
  20588. }
  20589. /*:525*//*538:*/
  20590. #line 12176 "./typica.w"
  20591. QScriptValue constructLogEditWindow(QScriptContext*,QScriptEngine*engine)
  20592. {
  20593. QScriptValue object= engine->newQObject(new LogEditWindow);
  20594. return object;
  20595. }
  20596. /*:538*//*557:*/
  20597. #line 12703 "./typica.w"
  20598. QScriptValue constructXMLInput(QScriptContext*context,QScriptEngine*engine)
  20599. {
  20600. QIODevice*device= argument<QIODevice*> (0,context);
  20601. QScriptValue object= engine->newQObject(new XMLInput(&*device,
  20602. argument<int> (1,context)));
  20603. object.setProperty("input",engine->newFunction(XMLInput_input));
  20604. return object;
  20605. }
  20606. QScriptValue XMLInput_input(QScriptContext*context,QScriptEngine*)
  20607. {
  20608. XMLInput*self= getself<XMLInput*> (context);
  20609. self->input();
  20610. return QScriptValue();
  20611. }
  20612. /*:557*//*572:*/
  20613. #line 172 "./webview.w"
  20614. QScriptValue constructWebView(QScriptContext*,QScriptEngine*engine)
  20615. {
  20616. QScriptValue object= engine->newQObject(new TypicaWebView);
  20617. setQWebViewProperties(object,engine);
  20618. return object;
  20619. }
  20620. void setQWebViewProperties(QScriptValue value,QScriptEngine*engine)
  20621. {
  20622. setQWidgetProperties(value,engine);
  20623. }
  20624. /*:572*//*573:*/
  20625. #line 189 "./webview.w"
  20626. void addWebViewToLayout(QDomElement element,QStack<QWidget*> *,
  20627. QStack<QLayout*> *layoutStack)
  20628. {
  20629. TypicaWebView*view= new TypicaWebView;
  20630. if(element.hasAttribute("id"))
  20631. {
  20632. view->setObjectName(element.attribute("id"));
  20633. }
  20634. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  20635. layout->addWidget(view);
  20636. }
  20637. /*:573*//*578:*/
  20638. #line 240 "./webview.w"
  20639. QScriptValue QWebElement_toScriptValue(QScriptEngine*engine,const QWebElement&element)
  20640. {
  20641. QVariant var;
  20642. var.setValue(element);
  20643. QScriptValue object= engine->newVariant(var);
  20644. return object;
  20645. }
  20646. void QWebElement_fromScriptValue(const QScriptValue&value,QWebElement&element)
  20647. {
  20648. element= value.toVariant().value<QWebElement> ();
  20649. }
  20650. /*:578*//*583:*/
  20651. #line 305 "./webview.w"
  20652. template<> QWebElement argument(int arg,QScriptContext*context)
  20653. {
  20654. return qscriptvalue_cast<QWebElement> (context->argument(arg));
  20655. }
  20656. /*:583*//*584:*/
  20657. #line 314 "./webview.w"
  20658. QScriptValue constructWebElement(QScriptContext*context,
  20659. QScriptEngine*engine)
  20660. {
  20661. QWebElement element= argument<QWebElement> (0,context);
  20662. QScriptValue object= engine->newQObject(new TypicaWebElement(element));
  20663. return object;
  20664. }
  20665. /*:584*//*595:*/
  20666. #line 85 "./printerselector.w"
  20667. QScriptValue constructPrinterSelector(QScriptContext*,QScriptEngine*engine)
  20668. {
  20669. QScriptValue object= engine->newQObject(new PrinterSelector);
  20670. setQComboBoxProperties(object,engine);
  20671. return object;
  20672. }
  20673. /*:595*//*596:*/
  20674. #line 96 "./printerselector.w"
  20675. void addPrinterSelectorToLayout(QDomElement element,QStack<QWidget*> *,
  20676. QStack<QLayout*> *layoutStack)
  20677. {
  20678. PrinterSelector*selector= new PrinterSelector;
  20679. if(element.hasAttribute("id"))
  20680. {
  20681. selector->setObjectName(element.attribute("id"));
  20682. }
  20683. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  20684. layout->addWidget(selector);
  20685. }
  20686. /*:596*//*662:*/
  20687. #line 14092 "./typica.w"
  20688. QScriptValue constructSqlQueryView(QScriptContext*,QScriptEngine*engine)
  20689. {
  20690. QScriptValue object= engine->newQObject(new SqlQueryView);
  20691. setSqlQueryViewProperties(object,engine);
  20692. return object;
  20693. }
  20694. void setSqlQueryViewProperties(QScriptValue value,QScriptEngine*engine)
  20695. {
  20696. setQTableViewProperties(value,engine);
  20697. value.setProperty("setHeaderData",
  20698. engine->newFunction(SqlQueryView_setHeaderData));
  20699. value.setProperty("setQuery",engine->newFunction(SqlQueryView_setQuery));
  20700. }
  20701. /*:662*//*663:*/
  20702. #line 14110 "./typica.w"
  20703. QScriptValue SqlQueryView_setQuery(QScriptContext*context,QScriptEngine*)
  20704. {
  20705. SqlQueryView*self= getself<SqlQueryView*> (context);
  20706. QString query= argument<QString> (0,context);
  20707. self->setQuery(query);
  20708. self->reset();
  20709. return QScriptValue();
  20710. }
  20711. QScriptValue SqlQueryView_setHeaderData(QScriptContext*context,
  20712. QScriptEngine*)
  20713. {
  20714. SqlQueryView*self= getself<SqlQueryView*> (context);
  20715. int section= argument<int> (0,context);
  20716. QString data= argument<QString> (1,context);
  20717. self->setHeaderData(section,Qt::Horizontal,data,Qt::DisplayRole);
  20718. return QScriptValue();
  20719. }
  20720. /*:663*//*671:*/
  20721. #line 14319 "./typica.w"
  20722. void addReportToLayout(QDomElement element,QStack<QWidget*> *,
  20723. QStack<QLayout*> *layoutStack)
  20724. {
  20725. QTextEdit*widget= new QTextEdit;
  20726. if(element.hasAttribute("id"))
  20727. {
  20728. widget->setObjectName(element.attribute("id"));
  20729. }
  20730. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  20731. layout->addWidget(widget);
  20732. QTextDocument*document= new QTextDocument;
  20733. QFont defaultFont;
  20734. defaultFont.setPointSize(11);
  20735. document->setDefaultFont(defaultFont);
  20736. QTextCursor cursor(document);
  20737. /*672:*/
  20738. #line 14342 "./typica.w"
  20739. QDomNodeList children= element.childNodes();
  20740. for(int i= 0;i<children.count();i++)
  20741. {
  20742. QDomNode current;
  20743. QDomElement currentElement;
  20744. current= children.at(i);
  20745. if(current.isElement())
  20746. {
  20747. currentElement= current.toElement();
  20748. /*673:*/
  20749. #line 14359 "./typica.w"
  20750. if(currentElement.tagName()=="style")
  20751. {
  20752. document->setDefaultStyleSheet(currentElement.text());
  20753. }
  20754. /*:673*//*674:*/
  20755. #line 14370 "./typica.w"
  20756. if(currentElement.tagName()=="html")
  20757. {
  20758. cursor.insertHtml(currentElement.text());
  20759. }
  20760. /*:674*//*675:*/
  20761. #line 14380 "./typica.w"
  20762. if(currentElement.tagName()=="text")
  20763. {
  20764. cursor.insertText(currentElement.text());
  20765. }
  20766. /*:675*//*676:*/
  20767. #line 14390 "./typica.w"
  20768. if(currentElement.tagName()=="table")
  20769. {
  20770. QTextFrame*frame= cursor.insertFrame(QTextFrameFormat());
  20771. ReportTable*table= new ReportTable(frame,currentElement);
  20772. table->setParent(widget);
  20773. if(currentElement.hasAttribute("id"))
  20774. {
  20775. table->setObjectName(currentElement.attribute("id"));
  20776. }
  20777. }
  20778. /*:676*/
  20779. #line 14352 "./typica.w"
  20780. }
  20781. }
  20782. /*:672*/
  20783. #line 14335 "./typica.w"
  20784. widget->setDocument(document);
  20785. }
  20786. /*:671*//*687:*/
  20787. #line 14603 "./typica.w"
  20788. QScriptValue QTextEdit_print(QScriptContext*context,QScriptEngine*)
  20789. {
  20790. QTextEdit*self= getself<QTextEdit*> (context);
  20791. QTextDocument*document= self->document();
  20792. QPrinter printer;
  20793. QPrintDialog printwindow(&printer,self);
  20794. if(printwindow.exec()!=QDialog::Accepted)
  20795. {
  20796. return QScriptValue();
  20797. }
  20798. document->print(&printer);
  20799. return QScriptValue();
  20800. }
  20801. /*:687*//*688:*/
  20802. #line 14621 "./typica.w"
  20803. void setQTextEditProperties(QScriptValue value,QScriptEngine*engine)
  20804. {
  20805. setQAbstractScrollAreaProperties(value,engine);
  20806. value.setProperty("print",engine->newFunction(QTextEdit_print));
  20807. }
  20808. #line 1 "./plugins.w"
  20809. /*:688*//*713:*/
  20810. #line 461 "./daterangeselector.w"
  20811. void addDateRangeToLayout(QDomElement element,QStack<QWidget*> *,
  20812. QStack<QLayout*> *layoutStack)
  20813. {
  20814. DateRangeSelector*widget= new DateRangeSelector;
  20815. if(element.hasAttribute("id"))
  20816. {
  20817. widget->setObjectName(element.attribute("id"));
  20818. }
  20819. if(element.hasAttribute("initial"))
  20820. {
  20821. widget->setCurrentIndex(element.attribute("initial").toInt());
  20822. }
  20823. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  20824. layout->addWidget(widget);
  20825. }
  20826. /*:713*//*724:*/
  20827. #line 14803 "./typica.w"
  20828. void addFormArrayToLayout(QDomElement element,QStack<QWidget*> *,
  20829. QStack<QLayout*> *layoutStack)
  20830. {
  20831. FormArray*widget= new FormArray(element);
  20832. if(element.hasAttribute("id"))
  20833. {
  20834. widget->setObjectName(element.attribute("id"));
  20835. }
  20836. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  20837. layout->addWidget(widget);
  20838. }
  20839. /*:724*//*745:*/
  20840. #line 15390 "./typica.w"
  20841. void addScaleControlToLayout(QDomElement element,QStack<QWidget*> *,
  20842. QStack<QLayout*> *layoutStack)
  20843. {
  20844. ScaleControl*scale= new ScaleControl;
  20845. if(element.hasAttribute("id"))
  20846. {
  20847. scale->setObjectName(element.attribute("id"));
  20848. }
  20849. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  20850. layout->addWidget(scale);
  20851. }
  20852. void addIntensityControlToLayout(QDomElement element,QStack<QWidget*> *,
  20853. QStack<QLayout*> *layoutStack)
  20854. {
  20855. IntensityControl*scale= new IntensityControl;
  20856. if(element.hasAttribute("id"))
  20857. {
  20858. scale->setObjectName(element.attribute("id"));
  20859. }
  20860. QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
  20861. layout->addWidget(scale);
  20862. }
  20863. /*:745*//*771:*/
  20864. #line 15980 "./typica.w"
  20865. QScriptValue constructDeviceTreeModel(QScriptContext*,QScriptEngine*engine)
  20866. {
  20867. QScriptValue object= engine->newQObject(new DeviceTreeModel);
  20868. setDeviceTreeModelProperties(object,engine);
  20869. return object;
  20870. }
  20871. /*:771*//*773:*/
  20872. #line 16003 "./typica.w"
  20873. void setDeviceTreeModelProperties(QScriptValue value,QScriptEngine*engine)
  20874. {
  20875. setQAbstractItemModelProperties(value,engine);
  20876. value.setProperty("referenceElement",
  20877. engine->newFunction(DeviceTreeModel_referenceElement));
  20878. }
  20879. void setQAbstractItemModelProperties(QScriptValue value,QScriptEngine*engine)
  20880. {
  20881. setQObjectProperties(value,engine);
  20882. value.setProperty("data",engine->newFunction(QAbstractItemModel_data));
  20883. value.setProperty("index",engine->newFunction(QAbstractItemModel_index));
  20884. value.setProperty("rowCount",engine->newFunction(QAbstractItemModel_rowCount));
  20885. value.setProperty("hasChildren",engine->newFunction(QAbstractItemModel_hasChildren));
  20886. }
  20887. /*:773*//*774:*/
  20888. #line 16030 "./typica.w"
  20889. QScriptValue DeviceTreeModel_referenceElement(QScriptContext*context,
  20890. QScriptEngine*engine)
  20891. {
  20892. DeviceTreeModel*model= getself<DeviceTreeModel*> (context);
  20893. QDomElement referenceElement= model->referenceElement(argument<QString> (0,context));
  20894. QDomNodeList configData= referenceElement.elementsByTagName("attribute");
  20895. QDomElement node;
  20896. QVariantMap retval;
  20897. retval.insert("driver",referenceElement.attribute("driver"));
  20898. for(int i= 0;i<configData.size();i++)
  20899. {
  20900. node= configData.at(i).toElement();
  20901. retval.insert(node.attribute("name"),node.attribute("value"));
  20902. }
  20903. return engine->toScriptValue(retval);
  20904. }
  20905. QScriptValue QAbstractItemModel_data(QScriptContext*context,QScriptEngine*engine)
  20906. {
  20907. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  20908. QModelIndex index= argument<QModelIndex> (0,context);
  20909. int role= argument<int> (1,context);
  20910. return engine->toScriptValue(model->data(index,role));
  20911. }
  20912. QScriptValue QAbstractItemModel_index(QScriptContext*context,QScriptEngine*engine)
  20913. {
  20914. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  20915. int row= 0;
  20916. int column= 0;
  20917. QModelIndex index;
  20918. if(context->argumentCount()> 1)
  20919. {
  20920. row= argument<int> (0,context);
  20921. column= argument<int> (1,context);
  20922. }
  20923. if(context->argumentCount()> 2)
  20924. {
  20925. index= argument<QModelIndex> (2,context);
  20926. }
  20927. QModelIndex retval= model->index(row,column,index);
  20928. return engine->toScriptValue(retval);
  20929. }
  20930. QScriptValue QAbstractItemModel_rowCount(QScriptContext*context,
  20931. QScriptEngine*)
  20932. {
  20933. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  20934. QModelIndex index;
  20935. if(context->argumentCount()==1)
  20936. {
  20937. index= argument<QModelIndex> (0,context);
  20938. }
  20939. return QScriptValue(model->rowCount(index));
  20940. }
  20941. QScriptValue QAbstractItemModel_hasChildren(QScriptContext*context,
  20942. QScriptEngine*engine)
  20943. {
  20944. QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
  20945. QModelIndex index;
  20946. if(context->argumentCount()==1)
  20947. {
  20948. index= argument<QModelIndex> (0,context);
  20949. }
  20950. return QScriptValue(engine,model->hasChildren(index));
  20951. }
  20952. /*:774*//*777:*/
  20953. #line 16114 "./typica.w"
  20954. QScriptValue QModelIndex_toScriptValue(QScriptEngine*engine,const QModelIndex&index)
  20955. {
  20956. QVariant var;
  20957. var.setValue(index);
  20958. QScriptValue object= engine->newVariant(var);
  20959. return object;
  20960. }
  20961. void QModelIndex_fromScriptValue(const QScriptValue&value,QModelIndex&index)
  20962. {
  20963. index= value.toVariant().value<QModelIndex> ();
  20964. }
  20965. /*:777*//*793:*/
  20966. #line 16412 "./typica.w"
  20967. QScriptValue constructDeviceConfigurationWindow(QScriptContext*,
  20968. QScriptEngine*engine)
  20969. {
  20970. QScriptValue object= engine->newQObject(new DeviceConfigurationWindow);
  20971. return object;
  20972. }
  20973. /*:793*//*864:*/
  20974. #line 49 "./settings.w"
  20975. QScriptValue constructSettingsWindow(QScriptContext*,QScriptEngine*engine)
  20976. {
  20977. QScriptValue object= engine->newQObject(new SettingsWindow);
  20978. return object;
  20979. }
  20980. /*:864*//*893:*/
  20981. #line 19066 "./typica.w"
  20982. QScriptValue constructModbusRTUDevice(QScriptContext*context,QScriptEngine*engine)
  20983. {
  20984. QScriptValue object;
  20985. if(context->argumentCount()==2)
  20986. {
  20987. object= engine->newQObject(new ModbusRTUDevice(argument<DeviceTreeModel*> (0,context),
  20988. argument<QModelIndex> (1,context)),
  20989. QScriptEngine::ScriptOwnership);
  20990. setModbusRTUDeviceProperties(object,engine);
  20991. }
  20992. else
  20993. {
  20994. context->throwError("Incorrect number of arguments passed to "
  20995. "ModbusRTUDevice constructor. This takes the configuration model "
  20996. "and an index.");
  20997. }
  20998. return object;
  20999. }
  21000. /*:893*//*894:*/
  21001. #line 19088 "./typica.w"
  21002. QScriptValue ModbusRTUDevice_pVChannel(QScriptContext*context,QScriptEngine*engine)
  21003. {
  21004. ModbusRTUDevice*self= getself<ModbusRTUDevice*> (context);
  21005. QScriptValue object;
  21006. if(self)
  21007. {
  21008. if(self->channels.size()> 0)
  21009. {
  21010. object= engine->newQObject(self->channels.at(0));
  21011. setChannelProperties(object,engine);
  21012. }
  21013. }
  21014. return object;
  21015. }
  21016. QScriptValue ModbusRTUDevice_sVChannel(QScriptContext*context,QScriptEngine*engine)
  21017. {
  21018. ModbusRTUDevice*self= getself<ModbusRTUDevice*> (context);
  21019. QScriptValue object;
  21020. if(self)
  21021. {
  21022. if(self->channels.size()> 1)
  21023. {
  21024. object= engine->newQObject(self->channels.at(1));
  21025. setChannelProperties(object,engine);
  21026. }
  21027. }
  21028. return object;
  21029. }
  21030. /*:894*//*895:*/
  21031. #line 19121 "./typica.w"
  21032. void setModbusRTUDeviceProperties(QScriptValue value,QScriptEngine*engine)
  21033. {
  21034. setQObjectProperties(value,engine);
  21035. value.setProperty("pVChannel",engine->newFunction(ModbusRTUDevice_pVChannel));
  21036. value.setProperty("sVChannel",engine->newFunction(ModbusRTUDevice_sVChannel));
  21037. }
  21038. /*:895*//*911:*/
  21039. #line 713 "./modbus.w"
  21040. QScriptValue constructModbusNG(QScriptContext*context,QScriptEngine*engine)
  21041. {
  21042. QScriptValue object;
  21043. if(context->argumentCount()==2)
  21044. {
  21045. object= engine->newQObject(new ModbusNG(argument<DeviceTreeModel*> (0,context),
  21046. argument<QModelIndex> (1,context)),
  21047. QScriptEngine::ScriptOwnership);
  21048. setModbusNGProperties(object,engine);
  21049. }
  21050. else
  21051. {
  21052. context->throwError("Incorrect number of arguments passed to "
  21053. "ModbusNG constructor.");
  21054. }
  21055. return object;
  21056. }
  21057. void setModbusNGProperties(QScriptValue value,QScriptEngine*engine)
  21058. {
  21059. setQObjectProperties(value,engine);
  21060. value.setProperty("getChannel",engine->newFunction(ModbusNG_getChannel));
  21061. }
  21062. QScriptValue ModbusNG_getChannel(QScriptContext*context,QScriptEngine*engine)
  21063. {
  21064. ModbusNG*self= getself<ModbusNG*> (context);
  21065. QScriptValue object;
  21066. if(self)
  21067. {
  21068. object= engine->newQObject(self->getChannel(argument<int> (0,context)));
  21069. setChannelProperties(object,engine);
  21070. }
  21071. return object;
  21072. }
  21073. #line 19672 "./typica.w"
  21074. #line 1 "./unsupportedserial.w"
  21075. /*:911*//*925:*/
  21076. #line 357 "./unsupportedserial.w"
  21077. QScriptValue createDevice(QScriptContext*context,QScriptEngine*engine)
  21078. {
  21079. QModelIndex deviceIndex= argument<QModelIndex> (0,context);
  21080. JavaScriptDevice*device= new JavaScriptDevice(deviceIndex,engine);
  21081. QScriptValue object= engine->newQObject(device);
  21082. setQObjectProperties(object,engine);
  21083. object.setProperty("getChannel",engine->newFunction(JavaScriptDevice_getChannel));
  21084. return object;
  21085. }
  21086. /*:925*//*930:*/
  21087. #line 430 "./unsupportedserial.w"
  21088. QScriptValue JavaScriptDevice_getChannel(QScriptContext*context,QScriptEngine*engine)
  21089. {
  21090. JavaScriptDevice*self= getself<JavaScriptDevice*> (context);
  21091. QScriptValue object;
  21092. if(self)
  21093. {
  21094. object= engine->newQObject(self->getChannel(argument<int> (0,context)));
  21095. setChannelProperties(object,engine);
  21096. }
  21097. return object;
  21098. }
  21099. /*:930*//*937:*/
  21100. #line 630 "./unsupportedserial.w"
  21101. QScriptValue getMeasurementTimestamp(QScriptContext*,QScriptEngine*engine)
  21102. {
  21103. return engine->toScriptValue<QTime> (QTime::currentTime());
  21104. }
  21105. /*:937*//*941:*/
  21106. #line 667 "./unsupportedserial.w"
  21107. QScriptValue constructSerialPort(QScriptContext*,QScriptEngine*engine)
  21108. {
  21109. QScriptValue object= engine->newQObject(new QextSerialPort());
  21110. setSerialPortProperties(object,engine);
  21111. return object;
  21112. }
  21113. /*:941*//*942:*/
  21114. #line 678 "./unsupportedserial.w"
  21115. void setSerialPortProperties(QScriptValue value,QScriptEngine*engine)
  21116. {
  21117. setQIODeviceProperties(value,engine);
  21118. value.setProperty("flush",engine->newFunction(SerialPort_flush));
  21119. }
  21120. /*:942*//*943:*/
  21121. #line 687 "./unsupportedserial.w"
  21122. QScriptValue SerialPort_flush(QScriptContext*context,QScriptEngine*)
  21123. {
  21124. QextSerialPort*self= getself<QextSerialPort*> (context);
  21125. self->flush();
  21126. return QScriptValue();
  21127. }
  21128. #line 19674 "./typica.w"
  21129. #line 1 "./phidgets.w"
  21130. /*:943*//*964:*/
  21131. #line 463 "./phidgets.w"
  21132. QScriptValue constructPhidgetsTemperatureSensor(QScriptContext*context,QScriptEngine*engine)
  21133. {
  21134. if(context->argumentCount()!=1)
  21135. {
  21136. context->throwError("Incorrect number of arguments passed to "
  21137. "PhidgetsTemperatureSensor constructor. This takes "
  21138. "a QModelIndex.");
  21139. }
  21140. QScriptValue object= engine->newQObject(new PhidgetsTemperatureSensor(argument<QModelIndex> (0,context)),QScriptEngine::ScriptOwnership);
  21141. setQObjectProperties(object,engine);
  21142. object.setProperty("getChannel",engine->newFunction(Phidgets_getChannel));
  21143. return object;
  21144. }
  21145. /*:964*//*965:*/
  21146. #line 480 "./phidgets.w"
  21147. QScriptValue Phidgets_getChannel(QScriptContext*context,QScriptEngine*engine)
  21148. {
  21149. PhidgetsTemperatureSensor*self= getself<PhidgetsTemperatureSensor*> (context);
  21150. QScriptValue object;
  21151. if(self)
  21152. {
  21153. object= engine->newQObject(self->getChannel(argument<int> (0,context)));
  21154. setChannelProperties(object,engine);
  21155. }
  21156. return object;
  21157. }
  21158. #line 19676 "./typica.w"
  21159. #line 1 "./phidget22.w"
  21160. /*:965*//*996:*/
  21161. #line 811 "./phidget22.w"
  21162. QScriptValue constructPhidget22(QScriptContext*context,QScriptEngine*engine)
  21163. {
  21164. if(context->argumentCount()!=1)
  21165. {
  21166. context->throwError("Incorrect number of arguments");
  21167. }
  21168. QScriptValue object= engine->newQObject(new Phidget22(argument<QModelIndex> (0,context)),QScriptEngine::ScriptOwnership);
  21169. setQObjectProperties(object,engine);
  21170. object.setProperty("getChannel",engine->newFunction(Phidget22_getChannel));
  21171. return object;
  21172. }
  21173. /*:996*//*997:*/
  21174. #line 826 "./phidget22.w"
  21175. QScriptValue Phidget22_getChannel(QScriptContext*context,QScriptEngine*engine)
  21176. {
  21177. Phidget22*self= getself<Phidget22*> (context);
  21178. QScriptValue object;
  21179. if(self)
  21180. {
  21181. object= engine->newQObject(self->getChannel(argument<int> (0,context)));
  21182. setChannelProperties(object,engine);
  21183. }
  21184. return object;
  21185. }
  21186. #line 19678 "./typica.w"
  21187. /*:997*//*1029:*/
  21188. #line 151 "./rate.w"
  21189. QScriptValue constructRateOfChange(QScriptContext*context,QScriptEngine*engine)
  21190. {
  21191. int cachetime= 1;
  21192. int scaletime= 1;
  21193. if(context->argumentCount()> 0)
  21194. {
  21195. cachetime= argument<int> (0,context);
  21196. if(context->argumentCount()> 1)
  21197. {
  21198. scaletime= argument<int> (1,context);
  21199. }
  21200. }
  21201. QScriptValue object= engine->newQObject(new RateOfChange(cachetime,scaletime));
  21202. setRateOfChangeProperties(object,engine);
  21203. return object;
  21204. }
  21205. void setRateOfChangeProperties(QScriptValue value,QScriptEngine*engine)
  21206. {
  21207. setQObjectProperties(value,engine);
  21208. }
  21209. /*:1029*//*1043:*/
  21210. #line 148 "./mergeseries.w"
  21211. QScriptValue constructDifferenceSeries(QScriptContext*,QScriptEngine*engine)
  21212. {
  21213. QScriptValue object= engine->newQObject(new DifferenceSeries);
  21214. setQObjectProperties(object,engine);
  21215. return object;
  21216. }
  21217. QScriptValue constructMeanSeries(QScriptContext*,QScriptEngine*engine)
  21218. {
  21219. QScriptValue object= engine->newQObject(new MeanSeries);
  21220. setQObjectProperties(object,engine);
  21221. return object;
  21222. }
  21223. /*:1043*//*1068:*/
  21224. #line 614 "./dataqsdk.w"
  21225. QScriptValue constructDataqSdkDevice(QScriptContext*context,QScriptEngine*engine)
  21226. {
  21227. QScriptValue object;
  21228. if(context->argumentCount()==1)
  21229. {
  21230. object= engine->newQObject(new DataqSdkDevice(argument<QString> (0,context)),
  21231. QScriptEngine::ScriptOwnership);
  21232. setDataqSdkDeviceProperties(object,engine);
  21233. }
  21234. else
  21235. {
  21236. context->throwError("Incorrect number of arguments passed to "
  21237. "DataqSdkDevice. The constructor takes one string "
  21238. "as an argument specifying a device name. "
  21239. "Example: Dev1");
  21240. }
  21241. return object;
  21242. }
  21243. /*:1068*//*1069:*/
  21244. #line 637 "./dataqsdk.w"
  21245. void setDataqSdkDeviceProperties(QScriptValue value,QScriptEngine*engine)
  21246. {
  21247. setQObjectProperties(value,engine);
  21248. value.setProperty("newChannel",engine->newFunction(DataqSdkDevice_newChannel));
  21249. }
  21250. /*:1069*//*1070:*/
  21251. #line 647 "./dataqsdk.w"
  21252. QScriptValue DataqSdkDevice_newChannel(QScriptContext*context,QScriptEngine*engine)
  21253. {
  21254. DataqSdkDevice*self= getself<DataqSdkDevice*> (context);
  21255. QScriptValue object;
  21256. if(self)
  21257. {
  21258. object= engine->newQObject(self->newChannel((Units::Unit)argument<int> (0,context)));
  21259. setChannelProperties(object,engine);
  21260. }
  21261. return object;
  21262. }
  21263. /*:1070*//*1095:*/
  21264. #line 80 "./scales.w"
  21265. QScriptValue constructDragLabel(QScriptContext*context,QScriptEngine*engine)
  21266. {
  21267. QScriptValue object;
  21268. QString labelText= "";
  21269. if(context->argumentCount()==1)
  21270. {
  21271. labelText= argument<QString> (0,context);
  21272. }
  21273. object= engine->newQObject(new DragLabel(labelText));
  21274. setDragLabelProperties(object,engine);
  21275. return object;
  21276. }
  21277. void setDragLabelProperties(QScriptValue value,QScriptEngine*engine)
  21278. {
  21279. setQLabelProperties(value,engine);
  21280. }
  21281. /*:1095*//*1105:*/
  21282. #line 298 "./scales.w"
  21283. QScriptValue BaudRateType_toScriptValue(QScriptEngine*engine,const BaudRateType&value)
  21284. {
  21285. return engine->newVariant(QVariant((int)(value)));
  21286. }
  21287. void BaudRateType_fromScriptValue(const QScriptValue&sv,BaudRateType&value)
  21288. {
  21289. value= (BaudRateType)(sv.toVariant().toInt());
  21290. }
  21291. QScriptValue DataBitsType_toScriptValue(QScriptEngine*engine,const DataBitsType&value)
  21292. {
  21293. return engine->newVariant(QVariant((int)(value)));
  21294. }
  21295. void DataBitsType_fromScriptValue(const QScriptValue&sv,DataBitsType&value)
  21296. {
  21297. value= (DataBitsType)(sv.toVariant().toInt());
  21298. }
  21299. QScriptValue ParityType_toScriptValue(QScriptEngine*engine,const ParityType&value)
  21300. {
  21301. return engine->newVariant(QVariant((int)(value)));
  21302. }
  21303. void ParityType_fromScriptValue(const QScriptValue&sv,ParityType&value)
  21304. {
  21305. value= (ParityType)(sv.toVariant().toInt());
  21306. }
  21307. QScriptValue StopBitsType_toScriptValue(QScriptEngine*engine,const StopBitsType&value)
  21308. {
  21309. return engine->newVariant(QVariant((int)(value)));
  21310. }
  21311. void StopBitsType_fromScriptValue(const QScriptValue&sv,StopBitsType&value)
  21312. {
  21313. value= (StopBitsType)(sv.toVariant().toInt());
  21314. }
  21315. QScriptValue FlowType_toScriptValue(QScriptEngine*engine,const FlowType&value)
  21316. {
  21317. return engine->newVariant(QVariant((int)(value)));
  21318. }
  21319. void FlowType_fromScriptValue(const QScriptValue&sv,FlowType&value)
  21320. {
  21321. value= (FlowType)(sv.toVariant().toInt());
  21322. }
  21323. /*:1105*//*1108:*/
  21324. #line 367 "./scales.w"
  21325. void setSerialScaleProperties(QScriptValue value,QScriptEngine*engine)
  21326. {
  21327. setQIODeviceProperties(value,engine);
  21328. }
  21329. /*:1108*//*1109:*/
  21330. #line 375 "./scales.w"
  21331. QScriptValue constructSerialScale(QScriptContext*context,QScriptEngine*engine)
  21332. {
  21333. QScriptValue object;
  21334. if(context->argumentCount()==1)
  21335. {
  21336. object= engine->newQObject(new SerialScale(argument<QString> (0,context)));
  21337. setSerialScaleProperties(object,engine);
  21338. }
  21339. else
  21340. {
  21341. context->throwError("Incorrect number of arguments passed to "
  21342. "SerialScale. The constructor takes one string "
  21343. "as an argument specifying a port name.");
  21344. }
  21345. return object;
  21346. }
  21347. /*:1109*//*1131:*/
  21348. #line 278 "./valueannotation.w"
  21349. QScriptValue constructValueAnnotation(QScriptContext*,QScriptEngine*engine)
  21350. {
  21351. QScriptValue object= engine->newQObject(new ValueAnnotation);
  21352. setValueAnnotationProperties(object,engine);
  21353. return object;
  21354. }
  21355. void setValueAnnotationProperties(QScriptValue value,QScriptEngine*engine)
  21356. {
  21357. setQObjectProperties(value,engine);
  21358. }
  21359. #line 20342 "./typica.w"
  21360. #line 1 "./thresholdannotation.w"
  21361. /*:1131*//*1142:*/
  21362. #line 208 "./thresholdannotation.w"
  21363. QScriptValue constructAnnotator(QScriptContext*context,QScriptEngine*engine)
  21364. {
  21365. QScriptValue object= engine->newQObject(new Annotator(argument<QString> (0,context)));
  21366. setAnnotatorProperties(object,engine);
  21367. return object;
  21368. }
  21369. void setAnnotatorProperties(QScriptValue value,QScriptEngine*engine)
  21370. {
  21371. setQObjectProperties(value,engine);
  21372. }
  21373. #line 20344 "./typica.w"
  21374. #line 1 "./user.w"
  21375. /*:1142*//*1152:*/
  21376. #line 142 "./user.w"
  21377. QScriptValue constructLoginDialog(QScriptContext*,QScriptEngine*engine)
  21378. {
  21379. QScriptValue object= engine->newQObject(new LoginDialog);
  21380. return object;
  21381. }
  21382. /*:1152*//*1162:*/
  21383. #line 330 "./user.w"
  21384. QScriptValue constructNewTypicaUser(QScriptContext*,QScriptEngine*engine)
  21385. {
  21386. QScriptValue object= engine->newQObject(new NewTypicaUser);
  21387. return object;
  21388. }
  21389. /*:1162*/
  21390. #line 533 "./typica.w"
  21391. /*641:*/
  21392. #line 13720 "./typica.w"
  21393. void messageFileOutput(QtMsgType,const char*msg)
  21394. {
  21395. QFile output("Typica-"+QDate::currentDate().toString("yyyy-MM-dd")+".log");
  21396. output.open(QIODevice::WriteOnly|QIODevice::Append);
  21397. QTextStream outstream(&output);
  21398. outstream<<msg<<"\r\n";
  21399. }
  21400. /*:641*/
  21401. #line 534 "./typica.w"
  21402. /*638:*/
  21403. #line 13681 "./typica.w"
  21404. int main(int argc,char**argv)
  21405. {
  21406. int*c= &argc;
  21407. Application app(*c,argv);
  21408. QSettings settings;
  21409. /*639:*/
  21410. #line 13707 "./typica.w"
  21411. if(settings.value("settings/advanced/logging",false).toBool())
  21412. {
  21413. qInstallMsgHandler(messageFileOutput);
  21414. }
  21415. /*:639*/
  21416. #line 13687 "./typica.w"
  21417. /*642:*/
  21418. #line 13733 "./typica.w"
  21419. QStringList themeSearchPath= QIcon::themeSearchPaths();
  21420. themeSearchPath.append(":/resources/icons/tango");
  21421. QIcon::setThemeSearchPaths(themeSearchPath);
  21422. QIcon::setThemeName(":/resources/icons/tango");
  21423. app.setWindowIcon(QIcon(":/resources/icons/appicons/logo.svg"));
  21424. /*:642*/
  21425. #line 13688 "./typica.w"
  21426. /*643:*/
  21427. #line 13753 "./typica.w"
  21428. QFile entypo(":/resources/fonts/entypo.ttf");
  21429. entypo.open(QIODevice::ReadOnly);
  21430. QFontDatabase::addApplicationFontFromData(entypo.readAll());
  21431. entypo.close();
  21432. QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-regular.otf");
  21433. QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-bold.otf");
  21434. QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-bolditalic.otf");
  21435. QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-italic.otf");
  21436. QWebSettings::globalSettings()->setFontFamily(QWebSettings::StandardFont,"Tex Gyre Pagella");
  21437. /*:643*/
  21438. #line 13689 "./typica.w"
  21439. /*803:*/
  21440. #line 16702 "./typica.w"
  21441. app.registerDeviceConfigurationWidget("roaster",RoasterConfWidget::staticMetaObject);
  21442. /*:803*//*813:*/
  21443. #line 16944 "./typica.w"
  21444. app.registerDeviceConfigurationWidget("nidaqmxbase",
  21445. NiDaqMxBaseDriverConfWidget::staticMetaObject);
  21446. app.registerDeviceConfigurationWidget("nidaqmxbase9211series",
  21447. NiDaqMxBase9211ConfWidget::staticMetaObject);
  21448. app.registerDeviceConfigurationWidget("ni9211seriestc",
  21449. Ni9211TcConfWidget::staticMetaObject);
  21450. /*:813*//*821:*/
  21451. #line 17175 "./typica.w"
  21452. app.registerDeviceConfigurationWidget("nidaqmx",NiDaqMxDriverConfWidget::staticMetaObject);
  21453. app.registerDeviceConfigurationWidget("nidaqmx9211series",NiDaqMx9211ConfWidget::staticMetaObject);
  21454. app.registerDeviceConfigurationWidget("nidaqmxtc01",NiDaqMxTc01ConfWidget::staticMetaObject);
  21455. /*:821*//*845:*/
  21456. #line 18144 "./typica.w"
  21457. app.registerDeviceConfigurationWidget("modbusrtuport",ModbusRtuPortConfWidget::staticMetaObject);
  21458. app.registerDeviceConfigurationWidget("modbusrtudevice",ModbusRtuDeviceConfWidget::staticMetaObject);
  21459. app.registerDeviceConfigurationWidget("modbustemperaturepv",ModbusRtuDeviceTPvConfWidget::staticMetaObject);
  21460. app.registerDeviceConfigurationWidget("modbustemperaturesv",ModbusRtuDeviceTSvConfWidget::staticMetaObject);
  21461. /*:845*//*850:*/
  21462. #line 18229 "./typica.w"
  21463. app.registerDeviceConfigurationWidget("annotationbutton",AnnotationButtonConfWidget::staticMetaObject);
  21464. /*:850*//*853:*/
  21465. #line 18299 "./typica.w"
  21466. app.registerDeviceConfigurationWidget("reconfigurablebutton",ReconfigurableAnnotationButtonConfWidget::staticMetaObject);
  21467. /*:853*//*856:*/
  21468. #line 18426 "./typica.w"
  21469. app.registerDeviceConfigurationWidget("annotationspinbox",NoteSpinConfWidget::staticMetaObject);
  21470. #line 1 "./freeannotation.w"
  21471. /*:856*//*860:*/
  21472. #line 57 "./freeannotation.w"
  21473. app.registerDeviceConfigurationWidget("freeannotation",
  21474. FreeAnnotationConfWidget::staticMetaObject);
  21475. #line 18430 "./typica.w"
  21476. #line 1 "./settings.w"
  21477. /*:860*//*898:*/
  21478. #line 19662 "./typica.w"
  21479. app.registerDeviceConfigurationWidget("modbusrtu",ModbusConfigurator::staticMetaObject);
  21480. /*:898*//*904:*/
  21481. #line 321 "./modbus.w"
  21482. app.registerDeviceConfigurationWidget("modbusngport",ModbusNGConfWidget::staticMetaObject);
  21483. app.registerDeviceConfigurationWidget("modbusnginput",
  21484. ModbusNGInputConfWidget::staticMetaObject);
  21485. /*:904*//*920:*/
  21486. #line 264 "./unsupportedserial.w"
  21487. app.registerDeviceConfigurationWidget("unsupporteddevicechannel",
  21488. UnsupportedDeviceChannelConfWidget::staticMetaObject);
  21489. app.registerDeviceConfigurationWidget("unsupporteddevice",
  21490. UnsupportedSerialDeviceConfWidget::staticMetaObject);
  21491. /*:920*//*951:*/
  21492. #line 181 "./phidgets.w"
  21493. app.registerDeviceConfigurationWidget("phidgets1048",
  21494. PhidgetsTemperatureSensorConfWidget::staticMetaObject);
  21495. app.registerDeviceConfigurationWidget("phidgets1048channel",
  21496. PhidgetTemperatureSensorChannelConfWidget::staticMetaObject);
  21497. /*:951*//*967:*/
  21498. #line 35 "./phidget22.w"
  21499. app.registerDeviceConfigurationWidget("phidget22",
  21500. PhidgetConfWidget::staticMetaObject);
  21501. app.registerDeviceConfigurationWidget("phidgetchannel",
  21502. PhidgetChannelConfWidget::staticMetaObject);
  21503. /*:967*//*1003:*/
  21504. #line 19800 "./typica.w"
  21505. app.registerDeviceConfigurationWidget("linearspline",LinearSplineInterpolationConfWidget::staticMetaObject);
  21506. /*:1003*//*1006:*/
  21507. #line 19860 "./typica.w"
  21508. app.registerDeviceConfigurationWidget("coolingtimer",
  21509. CoolingTimerConfWidget::staticMetaObject);
  21510. /*:1006*//*1011:*/
  21511. #line 20119 "./typica.w"
  21512. app.registerDeviceConfigurationWidget("rangetimer",
  21513. RangeTimerConfWidget::staticMetaObject);
  21514. /*:1011*//*1016:*/
  21515. #line 20220 "./typica.w"
  21516. app.registerDeviceConfigurationWidget("multirangetimer",
  21517. MultiRangeTimerConfWidget::staticMetaObject);
  21518. /*:1016*//*1021:*/
  21519. #line 20330 "./typica.w"
  21520. app.registerDeviceConfigurationWidget("translation",TranslationConfWidget::staticMetaObject);
  21521. #line 1 "./rate.w"
  21522. /*:1021*//*1033:*/
  21523. #line 253 "./rate.w"
  21524. app.registerDeviceConfigurationWidget("rate",RateOfChangeConfWidget::staticMetaObject);
  21525. /*:1033*//*1047:*/
  21526. #line 266 "./mergeseries.w"
  21527. app.registerDeviceConfigurationWidget("mergeseries",
  21528. MergeSeriesConfWidget::staticMetaObject);
  21529. /*:1047*//*1088:*/
  21530. #line 1233 "./dataqsdk.w"
  21531. app.registerDeviceConfigurationWidget("dataqsdk",DataqSdkDeviceConfWidget::staticMetaObject);
  21532. app.registerDeviceConfigurationWidget("dataqsdkchannel",
  21533. DataqSdkChannelConfWidget::staticMetaObject);
  21534. /*:1088*//*1113:*/
  21535. #line 552 "./scales.w"
  21536. app.registerDeviceConfigurationWidget("scale",SerialScaleConfWidget::staticMetaObject);
  21537. /*:1113*//*1121:*/
  21538. #line 138 "./valueannotation.w"
  21539. app.registerDeviceConfigurationWidget("valueannotation",
  21540. ValueAnnotationConfWidget::staticMetaObject);
  21541. /*:1121*//*1135:*/
  21542. #line 109 "./thresholdannotation.w"
  21543. app.registerDeviceConfigurationWidget("thresholdannotation",
  21544. ThresholdAnnotationConfWidget::staticMetaObject);
  21545. /*:1135*/
  21546. #line 13691 "./typica.w"
  21547. /*644:*/
  21548. #line 13770 "./typica.w"
  21549. if(settings.value("database/exists","false").toString()=="true")
  21550. {
  21551. /*649:*/
  21552. #line 13905 "./typica.w"
  21553. QSqlDatabase database=
  21554. QSqlDatabase::addDatabase(settings.value("database/driver").toString());
  21555. database.setConnectOptions("application_name=Typica");
  21556. database.setHostName(settings.value("database/hostname").toString());
  21557. database.setPort(settings.value("database/portnumber",5432).toInt());
  21558. database.setDatabaseName(settings.value("database/dbname").toString());
  21559. database.setUserName(settings.value("database/user").toString());
  21560. database.setPassword(settings.value("database/password").toString());
  21561. if(!database.open())
  21562. {
  21563. settings.setValue("database/exists","false");
  21564. }
  21565. else
  21566. {
  21567. database.close();
  21568. AppInstance->setDatabaseConnected(true);
  21569. }
  21570. /*:649*/
  21571. #line 13773 "./typica.w"
  21572. }
  21573. if(settings.value("database/exists","false").toString()=="false")
  21574. {
  21575. /*648:*/
  21576. #line 13896 "./typica.w"
  21577. SqlConnectionSetup dialog;
  21578. dialog.exec();
  21579. /*:648*/
  21580. #line 13777 "./typica.w"
  21581. }
  21582. /*:644*/
  21583. #line 13692 "./typica.w"
  21584. /*193:*/
  21585. #line 4447 "./typica.w"
  21586. QStringList arguments= QCoreApplication::arguments();
  21587. int position= arguments.indexOf("-c");
  21588. QString filename= QString();
  21589. if(position!=-1)
  21590. {
  21591. if(arguments.size()>=position+1)
  21592. {
  21593. filename= arguments.at(position+1);
  21594. }
  21595. }else{
  21596. QDir checkPath(QCoreApplication::applicationDirPath()+"/../config/");
  21597. if(checkPath.exists("config.xml")){
  21598. filename= checkPath.filePath("config.xml");
  21599. }else{
  21600. checkPath= QDir(QCoreApplication::applicationDirPath()+"/config/");
  21601. if(checkPath.exists("config.xml")){
  21602. filename= checkPath.filePath("config.xml");
  21603. }
  21604. }
  21605. }
  21606. if(filename.isEmpty())
  21607. {
  21608. filename= QFileDialog::getOpenFileName(NULL,"Open Configuration File",
  21609. settings.value("config","").toString());
  21610. }
  21611. QDir directory;
  21612. if(!filename.isEmpty())
  21613. {
  21614. QFile file(filename);
  21615. QFileInfo info(filename);
  21616. directory= info.dir();
  21617. QTextCodec::setCodecForTr(QTextCodec::codecForName("utf-8"));
  21618. QTranslator*configtr= new QTranslator;
  21619. if(configtr->load(QString("config.%1").arg(QLocale::system().name()),
  21620. QString("%1/Translations").arg(directory.canonicalPath())))
  21621. {
  21622. QCoreApplication::installTranslator(configtr);
  21623. }
  21624. settings.setValue("config",directory.path());
  21625. if(file.open(QIODevice::ReadOnly))
  21626. {
  21627. app.configuration()->setContent(&file,true);
  21628. }
  21629. }else{
  21630. return 1;
  21631. }
  21632. /*194:*/
  21633. #line 4500 "./typica.w"
  21634. QDomElement root= app.configuration()->documentElement();
  21635. QDomNodeList children= root.childNodes();
  21636. QString replacementDoc;
  21637. QDomDocument includedDoc;
  21638. QDomDocumentFragment fragment;
  21639. for(int i= 0;i<children.size();i++)
  21640. {
  21641. QDomNode currentNode= children.at(i);
  21642. QDomElement currentElement;
  21643. if(currentNode.nodeName()=="include")
  21644. {
  21645. currentElement= currentNode.toElement();
  21646. if(currentElement.hasAttribute("src"))
  21647. {
  21648. replacementDoc= directory.path();
  21649. replacementDoc.append('/');
  21650. replacementDoc.append(currentElement.attribute("src"));
  21651. QFile doc(replacementDoc);
  21652. if(doc.open(QIODevice::ReadOnly))
  21653. {
  21654. includedDoc.setContent(&doc,true);
  21655. fragment= includedDoc.createDocumentFragment();
  21656. fragment.appendChild(includedDoc.documentElement());
  21657. root.replaceChild(fragment,currentNode);
  21658. doc.close();
  21659. }
  21660. }
  21661. }
  21662. }
  21663. /*:194*/
  21664. #line 4494 "./typica.w"
  21665. /*:193*/
  21666. #line 13693 "./typica.w"
  21667. /*7:*/
  21668. #line 667 "./typica.w"
  21669. QScriptEngine*engine= new QScriptEngine;
  21670. QScriptValue constructor;
  21671. QScriptValue value;
  21672. /*:7*//*17:*/
  21673. #line 875 "./typica.w"
  21674. constructor= engine->newFunction(constructQTimer);
  21675. value= engine->newQMetaObject(&QTimer::staticMetaObject,constructor);
  21676. engine->globalObject().setProperty("Timer",value);
  21677. /*:17*//*20:*/
  21678. #line 914 "./typica.w"
  21679. constructor= engine->newFunction(constructQWidget);
  21680. value= engine->newQMetaObject(&QWidget::staticMetaObject,constructor);
  21681. engine->globalObject().setProperty("QWidget",value);
  21682. /*:20*//*24:*/
  21683. #line 1002 "./typica.w"
  21684. constructor= engine->newFunction(displayWarning);
  21685. engine->globalObject().setProperty("displayWarning",constructor);
  21686. constructor= engine->newFunction(displayError);
  21687. engine->globalObject().setProperty("displayError",constructor);
  21688. constructor= engine->newFunction(displayInfo);
  21689. engine->globalObject().setProperty("displayInfo",constructor);
  21690. /*:24*//*34:*/
  21691. #line 1240 "./typica.w"
  21692. constructor= engine->newFunction(constructQMainWindow);
  21693. value= engine->newQMetaObject(&ScriptQMainWindow::staticMetaObject,
  21694. constructor);
  21695. engine->globalObject().setProperty("QMainWindow",value);
  21696. /*:34*//*45:*/
  21697. #line 1445 "./typica.w"
  21698. constructor= engine->newFunction(constructQFrame);
  21699. value= engine->newQMetaObject(&QFrame::staticMetaObject,constructor);
  21700. engine->globalObject().setProperty("QFrame",value);
  21701. /*:45*//*48:*/
  21702. #line 1478 "./typica.w"
  21703. constructor= engine->newFunction(constructQLabel);
  21704. value= engine->newQMetaObject(&QLabel::staticMetaObject,constructor);
  21705. engine->globalObject().setProperty("QLabel",value);
  21706. /*:48*//*51:*/
  21707. #line 1521 "./typica.w"
  21708. constructor= engine->newFunction(constructQSvgWidget);
  21709. value= engine->newQMetaObject(&QSvgWidget::staticMetaObject,constructor);
  21710. engine->globalObject().setProperty("QSvgWidget",value);
  21711. /*:51*//*57:*/
  21712. #line 1603 "./typica.w"
  21713. constructor= engine->newFunction(constructQLineEdit);
  21714. value= engine->newQMetaObject(&QLineEdit::staticMetaObject,constructor);
  21715. engine->globalObject().setProperty("QLineEdit",value);
  21716. /*:57*//*61:*/
  21717. #line 1652 "./typica.w"
  21718. constructor= engine->newFunction(constructQSplitter);
  21719. value= engine->newQMetaObject(&QSplitter::staticMetaObject,constructor);
  21720. engine->globalObject().setProperty("QSplitter",value);
  21721. /*:61*//*70:*/
  21722. #line 1861 "./typica.w"
  21723. constructor= engine->newFunction(constructQBoxLayout);
  21724. value= engine->newQMetaObject(&QBoxLayout::staticMetaObject,constructor);
  21725. engine->globalObject().setProperty("QBoxLayout",value);
  21726. /*:70*//*74:*/
  21727. #line 1973 "./typica.w"
  21728. constructor= engine->newFunction(constructQAction);
  21729. value= engine->newQMetaObject(&QAction::staticMetaObject,constructor);
  21730. engine->globalObject().setProperty("QAction",value);
  21731. /*:74*//*77:*/
  21732. #line 2032 "./typica.w"
  21733. value= engine->newQMetaObject(&QFileDialog::staticMetaObject);
  21734. value.setProperty("getOpenFileName",
  21735. engine->newFunction(QFileDialog_getOpenFileName));
  21736. value.setProperty("getSaveFileName",
  21737. engine->newFunction(QFileDialog_getSaveFileName));
  21738. engine->globalObject().setProperty("QFileDialog",value);
  21739. /*:77*//*82:*/
  21740. #line 2150 "./typica.w"
  21741. constructor= engine->newFunction(constructQFile);
  21742. value= engine->newQMetaObject(&QFile::staticMetaObject,constructor);
  21743. engine->globalObject().setProperty("QFile",value);
  21744. /*:82*//*93:*/
  21745. #line 2368 "./typica.w"
  21746. constructor= engine->newFunction(constructQProcess);
  21747. value= engine->newQMetaObject(&QProcess::staticMetaObject,constructor);
  21748. engine->globalObject().setProperty("QProcess",value);
  21749. /*:93*//*102:*/
  21750. #line 2517 "./typica.w"
  21751. qScriptRegisterMetaType(engine,QByteArray_toScriptValue,QByteArray_fromScriptValue);
  21752. constructor= engine->newFunction(constructQByteArray);
  21753. engine->globalObject().setProperty("QByteArray",constructor);
  21754. /*:102*//*114:*/
  21755. #line 2759 "./typica.w"
  21756. engine->globalObject().setProperty("bytesFromInt8",engine->newFunction(bytesFromInt8));
  21757. engine->globalObject().setProperty("bytesFromInt16",engine->newFunction(bytesFromInt16));
  21758. engine->globalObject().setProperty("bytesFromInt32",engine->newFunction(bytesFromInt32));
  21759. engine->globalObject().setProperty("bytesFromFloat",engine->newFunction(bytesFromFloat));
  21760. engine->globalObject().setProperty("bytesFromDouble",engine->newFunction(bytesFromDouble));
  21761. /*:114*//*117:*/
  21762. #line 2862 "./typica.w"
  21763. constructor= engine->newFunction(constructQBuffer);
  21764. value= engine->newQMetaObject(&QBuffer::staticMetaObject,constructor);
  21765. engine->globalObject().setProperty("QBuffer",value);
  21766. /*:117*//*120:*/
  21767. #line 2911 "./typica.w"
  21768. constructor= engine->newFunction(constructXQuery);
  21769. engine->globalObject().setProperty("XQuery",constructor);
  21770. /*:120*//*126:*/
  21771. #line 3013 "./typica.w"
  21772. constructor= engine->newFunction(constructXmlWriter);
  21773. engine->globalObject().setProperty("XmlWriter",constructor);
  21774. /*:126*//*135:*/
  21775. #line 3219 "./typica.w"
  21776. constructor= engine->newFunction(constructXmlReader);
  21777. engine->globalObject().setProperty("XmlReader",constructor);
  21778. /*:135*//*142:*/
  21779. #line 3343 "./typica.w"
  21780. value= engine->newQObject(&settings);
  21781. setQSettingsProperties(value,engine);
  21782. engine->globalObject().setProperty("QSettings",value);
  21783. /*:142*//*146:*/
  21784. #line 3424 "./typica.w"
  21785. constructor= engine->newFunction(constructQLCDNumber);
  21786. value= engine->newQMetaObject(&QLCDNumber::staticMetaObject,constructor);
  21787. engine->globalObject().setProperty("QLCDNumber",value);
  21788. /*:146*//*149:*/
  21789. #line 3480 "./typica.w"
  21790. constructor= engine->newFunction(constructQTime);
  21791. engine->globalObject().setProperty("QTime",constructor);
  21792. /*:149*//*171:*/
  21793. #line 3993 "./typica.w"
  21794. constructor= engine->newFunction(constructQPushButton);
  21795. value= engine->newQMetaObject(&QPushButton::staticMetaObject,constructor);
  21796. engine->globalObject().setProperty("QPushButton",value);
  21797. /*:171*//*178:*/
  21798. #line 4104 "./typica.w"
  21799. constructor= engine->newFunction(constructQSqlQuery);
  21800. engine->globalObject().setProperty("QSqlQuery",constructor);
  21801. /*:178*//*185:*/
  21802. #line 4268 "./typica.w"
  21803. engine->globalObject().setProperty("baseName",engine->newFunction(baseName));
  21804. engine->globalObject().setProperty("dir",engine->newFunction(dir));
  21805. engine->globalObject().setProperty("sqlToArray",
  21806. engine->newFunction(sqlToArray));
  21807. engine->globalObject().setProperty("setFont",engine->newFunction(setFont));
  21808. engine->globalObject().setProperty("annotationFromRecord",
  21809. engine->newFunction(annotationFromRecord));
  21810. engine->globalObject().setProperty("setTabOrder",
  21811. engine->newFunction(setTabOrder));
  21812. engine->globalObject().setProperty("saveFileFromDatabase",
  21813. engine->newFunction(saveFileFromDatabase));
  21814. engine->globalObject().setProperty("TTR",engine->newFunction(scriptTr));
  21815. /*:185*//*198:*/
  21816. #line 4669 "./typica.w"
  21817. engine->globalObject().setProperty("createWindow",
  21818. engine->newFunction(createWindow));
  21819. engine->globalObject().setProperty("createReport",
  21820. engine->newFunction(createReport));
  21821. /*:198*//*223:*/
  21822. #line 5041 "./typica.w"
  21823. constructor= engine->newFunction(constructQTabBar);
  21824. value= engine->newQMetaObject(&QTabBar::staticMetaObject,constructor);
  21825. engine->globalObject().setProperty("QTabBar",value);
  21826. /*:223*//*272:*/
  21827. #line 6444 "./typica.w"
  21828. engine->globalObject().setProperty("findChildObject",
  21829. engine->newFunction(findChildObject));
  21830. /*:272*//*298:*/
  21831. #line 389 "./units.w"
  21832. value= engine->newQMetaObject(&Units::staticMetaObject);
  21833. value.setProperty("convertTemperature",engine->newFunction(Units_convertTemperature));
  21834. value.setProperty("convertRelativeTemperature",
  21835. engine->newFunction(Units_convertRelativeTemperature));
  21836. value.setProperty("isTemperatureUnit",engine->newFunction(Units_isTemperatureUnit));
  21837. value.setProperty("convertWeight",engine->newFunction(Units_convertWeight));
  21838. value.setProperty("isWeightUnit",engine->newFunction(Units_isWeightUnit));
  21839. engine->globalObject().setProperty("Units",value);
  21840. /*:298*//*303:*/
  21841. #line 462 "./units.w"
  21842. qScriptRegisterMetaType(engine,Unit_toScriptValue,Unit_fromScriptValue);
  21843. #line 6876 "./typica.w"
  21844. /*:303*//*311:*/
  21845. #line 141 "./measurement.w"
  21846. constructor= engine->newFunction(constructMeasurement);
  21847. engine->globalObject().setProperty("Measurement",constructor);
  21848. qScriptRegisterMetaType(engine,Measurement_toScriptValue,Measurement_fromScriptValue);
  21849. /*:311*//*331:*/
  21850. #line 7447 "./typica.w"
  21851. constructor= engine->newFunction(constructDAQ);
  21852. value= engine->newQMetaObject(&DAQ::staticMetaObject,constructor);
  21853. value.setProperty("Fahrenheit",Units::Fahrenheit);
  21854. value.setProperty("Celsius",Units::Celsius);
  21855. value.setProperty("Kelvin",Units::Kelvin);
  21856. value.setProperty("Rankine",Units::Rankine);
  21857. engine->globalObject().setProperty("DAQ",value);
  21858. /*:331*//*340:*/
  21859. #line 7649 "./typica.w"
  21860. constructor= engine->newFunction(constructFakeDAQ);
  21861. value= engine->newQMetaObject(&FakeDAQ::staticMetaObject,constructor);
  21862. engine->globalObject().setProperty("FakeDAQ",value);
  21863. /*:340*//*351:*/
  21864. #line 7932 "./typica.w"
  21865. constructor= engine->newFunction(constructLinearCalibrator);
  21866. value= engine->newQMetaObject(&LinearCalibrator::staticMetaObject,
  21867. constructor);
  21868. engine->globalObject().setProperty("LinearCalibrator",value);
  21869. /*:351*//*356:*/
  21870. #line 8071 "./typica.w"
  21871. constructor= engine->newFunction(constructLinearSplineInterpolator);
  21872. value= engine->newQMetaObject(&LinearSplineInterpolator::staticMetaObject,constructor);
  21873. engine->globalObject().setProperty("LinearSplineInterpolator",value);
  21874. /*:356*//*366:*/
  21875. #line 8279 "./typica.w"
  21876. constructor= engine->newFunction(constructTemperatureDisplay);
  21877. value= engine->newQMetaObject(&TemperatureDisplay::staticMetaObject,
  21878. constructor);
  21879. engine->globalObject().setProperty("TemperatureDisplay",value);
  21880. /*:366*//*374:*/
  21881. #line 8437 "./typica.w"
  21882. constructor= engine->newFunction(constructMeasurementTimeOffset);
  21883. value= engine->newQMetaObject(&MeasurementTimeOffset::staticMetaObject,
  21884. constructor);
  21885. engine->globalObject().setProperty("MeasurementTimeOffset",value);
  21886. /*:374*//*379:*/
  21887. #line 8558 "./typica.w"
  21888. constructor= engine->newFunction(constructThresholdDetector);
  21889. value= engine->newQMetaObject(&ThresholdDetector::staticMetaObject,constructor);
  21890. engine->globalObject().setProperty("ThresholdDetector",value);
  21891. /*:379*//*384:*/
  21892. #line 8657 "./typica.w"
  21893. constructor= engine->newFunction(constructZeroEmitter);
  21894. value= engine->newQMetaObject(&ZeroEmitter::staticMetaObject,constructor);
  21895. engine->globalObject().setProperty("ZeroEmitter",value);
  21896. /*:384*//*389:*/
  21897. #line 8736 "./typica.w"
  21898. constructor= engine->newFunction(constructMeasurementAdapter);
  21899. value= engine->newQMetaObject(&MeasurementAdapter::staticMetaObject,
  21900. constructor);
  21901. engine->globalObject().setProperty("MeasurementAdapter",value);
  21902. /*:389*//*406:*/
  21903. #line 9199 "./typica.w"
  21904. constructor= engine->newFunction(constructGraphView);
  21905. value= engine->newQMetaObject(&GraphView::staticMetaObject,constructor);
  21906. engine->globalObject().setProperty("GraphView",value);
  21907. /*:406*//*429:*/
  21908. #line 9848 "./typica.w"
  21909. constructor= engine->newFunction(constructZoomLog);
  21910. value= engine->newQMetaObject(&ZoomLog::staticMetaObject,constructor);
  21911. engine->globalObject().setProperty("ZoomLog",value);
  21912. /*:429*//*467:*/
  21913. #line 10796 "./typica.w"
  21914. constructor= engine->newFunction(constructAnnotationButton);
  21915. value= engine->newQMetaObject(&AnnotationButton::staticMetaObject,
  21916. constructor);
  21917. engine->globalObject().setProperty("AnnotationButton",value);
  21918. /*:467*//*475:*/
  21919. #line 10938 "./typica.w"
  21920. constructor= engine->newFunction(constructAnnotationSpinBox);
  21921. value= engine->newQMetaObject(&AnnotationSpinBox::staticMetaObject,
  21922. constructor);
  21923. engine->globalObject().setProperty("AnnotationSpinBox",value);
  21924. /*:475*//*496:*/
  21925. #line 11363 "./typica.w"
  21926. constructor= engine->newFunction(constructTimerDisplay);
  21927. value= engine->newQMetaObject(&TimerDisplay::staticMetaObject,constructor);
  21928. engine->globalObject().setProperty("TimerDisplay",value);
  21929. /*:496*//*524:*/
  21930. #line 11887 "./typica.w"
  21931. constructor= engine->newFunction(constructWidgetDecorator);
  21932. value= engine->newQMetaObject(&WidgetDecorator::staticMetaObject,constructor);
  21933. engine->globalObject().setProperty("WidgetDecorator",value);
  21934. /*:524*//*537:*/
  21935. #line 12169 "./typica.w"
  21936. constructor= engine->newFunction(constructLogEditWindow);
  21937. value= engine->newQMetaObject(&LogEditWindow::staticMetaObject,constructor);
  21938. engine->globalObject().setProperty("LogEditWindow",value);
  21939. /*:537*//*556:*/
  21940. #line 12696 "./typica.w"
  21941. constructor= engine->newFunction(constructXMLInput);
  21942. value= engine->newQMetaObject(&XMLInput::staticMetaObject,constructor);
  21943. engine->globalObject().setProperty("XMLInput",value);
  21944. /*:556*//*571:*/
  21945. #line 164 "./webview.w"
  21946. constructor= engine->newFunction(constructWebView);
  21947. value= engine->newQMetaObject(&TypicaWebView::staticMetaObject,constructor);
  21948. engine->globalObject().setProperty("WebView",value);
  21949. /*:571*//*579:*/
  21950. #line 256 "./webview.w"
  21951. qScriptRegisterMetaType(engine,QWebElement_toScriptValue,QWebElement_fromScriptValue);
  21952. /*:579*//*582:*/
  21953. #line 298 "./webview.w"
  21954. constructor= engine->newFunction(constructWebElement);
  21955. engine->globalObject().setProperty("WebElement",constructor);
  21956. /*:582*//*594:*/
  21957. #line 76 "./printerselector.w"
  21958. constructor= engine->newFunction(constructPrinterSelector);
  21959. engine->globalObject().setProperty("PrinterSelector",constructor);
  21960. /*:594*//*602:*/
  21961. #line 12954 "./typica.w"
  21962. value= engine->newQObject(AppInstance);
  21963. engine->globalObject().setProperty("Application",value);
  21964. /*:602*//*661:*/
  21965. #line 14084 "./typica.w"
  21966. constructor= engine->newFunction(constructSqlQueryView);
  21967. value= engine->newQMetaObject(&SqlQueryView::staticMetaObject,constructor);
  21968. engine->globalObject().setProperty("SqlQueryView",value);
  21969. /*:661*//*772:*/
  21970. #line 15990 "./typica.w"
  21971. constructor= engine->newFunction(constructDeviceTreeModel);
  21972. value= engine->newQMetaObject(&DeviceTreeModel::staticMetaObject,
  21973. constructor);
  21974. engine->globalObject().setProperty("DeviceTreeModel",value);
  21975. /*:772*//*778:*/
  21976. #line 16130 "./typica.w"
  21977. qScriptRegisterMetaType(engine,QModelIndex_toScriptValue,QModelIndex_fromScriptValue);
  21978. /*:778*//*794:*/
  21979. #line 16422 "./typica.w"
  21980. constructor= engine->newFunction(constructDeviceConfigurationWindow);
  21981. value= engine->newQMetaObject(&DeviceConfigurationWindow::staticMetaObject,
  21982. constructor);
  21983. engine->globalObject().setProperty("DeviceConfigurationWindow",value);
  21984. /*:794*//*865:*/
  21985. #line 58 "./settings.w"
  21986. constructor= engine->newFunction(constructSettingsWindow);
  21987. value= engine->newQMetaObject(&DeviceConfigurationWindow::staticMetaObject,constructor);
  21988. engine->globalObject().setProperty("SettingsWindow",value);
  21989. #line 1 "./graphsettings.w"
  21990. /*:865*//*892:*/
  21991. #line 19057 "./typica.w"
  21992. constructor= engine->newFunction(constructModbusRTUDevice);
  21993. value= engine->newQMetaObject(&ModbusRTUDevice::staticMetaObject,constructor);
  21994. engine->globalObject().setProperty("ModbusRTUDevice",value);
  21995. /*:892*//*910:*/
  21996. #line 705 "./modbus.w"
  21997. constructor= engine->newFunction(constructModbusNG);
  21998. value= engine->newQMetaObject(&ModbusNG::staticMetaObject,constructor);
  21999. engine->globalObject().setProperty("ModbusNG",value);
  22000. /*:910*//*924:*/
  22001. #line 350 "./unsupportedserial.w"
  22002. engine->globalObject().setProperty("createDevice",
  22003. engine->newFunction(createDevice));
  22004. /*:924*//*936:*/
  22005. #line 622 "./unsupportedserial.w"
  22006. engine->globalObject().setProperty("getMeasurementTimestamp",
  22007. engine->newFunction(getMeasurementTimestamp));
  22008. /*:936*//*940:*/
  22009. #line 658 "./unsupportedserial.w"
  22010. constructor= engine->newFunction(constructSerialPort);
  22011. value= engine->newQMetaObject(&QextSerialPort::staticMetaObject,constructor);
  22012. engine->globalObject().setProperty("SerialPort",value);
  22013. /*:940*//*962:*/
  22014. #line 450 "./phidgets.w"
  22015. constructor= engine->newFunction(constructPhidgetsTemperatureSensor);
  22016. value= engine->newQMetaObject(&PhidgetsTemperatureSensor::staticMetaObject,constructor);
  22017. engine->globalObject().setProperty("PhidgetsTemperatureSensor",value);
  22018. /*:962*//*994:*/
  22019. #line 798 "./phidget22.w"
  22020. constructor= engine->newFunction(constructPhidget22);
  22021. value= engine->newQMetaObject(&Phidget22::staticMetaObject,constructor);
  22022. engine->globalObject().setProperty("Phidget22",value);
  22023. /*:994*//*1028:*/
  22024. #line 144 "./rate.w"
  22025. constructor= engine->newFunction(constructRateOfChange);
  22026. value= engine->newQMetaObject(&RateOfChange::staticMetaObject,constructor);
  22027. engine->globalObject().setProperty("RateOfChange",value);
  22028. /*:1028*//*1042:*/
  22029. #line 137 "./mergeseries.w"
  22030. constructor= engine->newFunction(constructDifferenceSeries);
  22031. value= engine->newQMetaObject(&DifferenceSeries::staticMetaObject,
  22032. constructor);
  22033. engine->globalObject().setProperty("DifferenceSeries",value);
  22034. constructor= engine->newFunction(constructMeanSeries);
  22035. value= engine->newQMetaObject(&MeanSeries::staticMetaObject,constructor);
  22036. engine->globalObject().setProperty("MeanSeries",value);
  22037. /*:1042*//*1067:*/
  22038. #line 604 "./dataqsdk.w"
  22039. constructor= engine->newFunction(constructDataqSdkDevice);
  22040. value= engine->newQMetaObject(&DataqSdkDevice::staticMetaObject,constructor);
  22041. engine->globalObject().setProperty("DataqSdkDevice",value);
  22042. /*:1067*//*1094:*/
  22043. #line 73 "./scales.w"
  22044. constructor= engine->newFunction(constructDragLabel);
  22045. value= engine->newQMetaObject(&DragLabel::staticMetaObject,constructor);
  22046. engine->globalObject().setProperty("DragLabel",value);
  22047. /*:1094*//*1102:*/
  22048. #line 265 "./scales.w"
  22049. constructor= engine->newFunction(constructSerialScale);
  22050. value= engine->newQMetaObject(&SerialScale::staticMetaObject,constructor);
  22051. engine->globalObject().setProperty("SerialScale",value);
  22052. /*:1102*//*1106:*/
  22053. #line 351 "./scales.w"
  22054. qScriptRegisterMetaType(engine,BaudRateType_toScriptValue,BaudRateType_fromScriptValue);
  22055. qScriptRegisterMetaType(engine,DataBitsType_toScriptValue,DataBitsType_fromScriptValue);
  22056. qScriptRegisterMetaType(engine,ParityType_toScriptValue,ParityType_fromScriptValue);
  22057. qScriptRegisterMetaType(engine,StopBitsType_toScriptValue,StopBitsType_fromScriptValue);
  22058. qScriptRegisterMetaType(engine,FlowType_toScriptValue,FlowType_fromScriptValue);
  22059. /*:1106*//*1130:*/
  22060. #line 271 "./valueannotation.w"
  22061. constructor= engine->newFunction(constructValueAnnotation);
  22062. value= engine->newQMetaObject(&ValueAnnotation::staticMetaObject,constructor);
  22063. engine->globalObject().setProperty("ValueAnnotation",value);
  22064. /*:1130*//*1141:*/
  22065. #line 201 "./thresholdannotation.w"
  22066. constructor= engine->newFunction(constructAnnotator);
  22067. value= engine->newQMetaObject(&Annotator::staticMetaObject,constructor);
  22068. engine->globalObject().setProperty("Annotator",value);
  22069. /*:1141*//*1151:*/
  22070. #line 135 "./user.w"
  22071. constructor= engine->newFunction(constructLoginDialog);
  22072. value= engine->newQMetaObject(&LoginDialog::staticMetaObject,constructor);
  22073. engine->globalObject().setProperty("LoginDialog",value);
  22074. /*:1151*//*1161:*/
  22075. #line 323 "./user.w"
  22076. constructor= engine->newFunction(constructNewTypicaUser);
  22077. value= engine->newQMetaObject(&NewTypicaUser::staticMetaObject,constructor);
  22078. engine->globalObject().setProperty("NewTypicaUser",value);
  22079. /*:1161*/
  22080. #line 13694 "./typica.w"
  22081. app.engine= engine;
  22082. /*195:*/
  22083. #line 4548 "./typica.w"
  22084. QString styleText;
  22085. QString programText;
  22086. QDomElement currentElement;
  22087. for(int i= 0;i<children.size();i++)
  22088. {
  22089. QDomNode currentNode= children.at(i);
  22090. if(currentNode.nodeName()=="style")
  22091. {
  22092. currentElement= currentNode.toElement();
  22093. styleText.append(currentElement.text());
  22094. }
  22095. else if(currentNode.nodeName()=="program")
  22096. {
  22097. currentElement= currentNode.toElement();
  22098. programText.append(currentElement.text());
  22099. }
  22100. }
  22101. app.setStyleSheet(styleText);
  22102. QScriptValue result= engine->evaluate(programText);
  22103. /*196:*/
  22104. #line 4573 "./typica.w"
  22105. if(engine->hasUncaughtException())
  22106. {
  22107. int line= engine->uncaughtExceptionLineNumber();
  22108. qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
  22109. result.toString();
  22110. QString trace;
  22111. foreach(trace,engine->uncaughtExceptionBacktrace())
  22112. {
  22113. qDebug()<<trace;
  22114. }
  22115. }
  22116. /*:196*/
  22117. #line 4568 "./typica.w"
  22118. /*:195*/
  22119. #line 13696 "./typica.w"
  22120. int retval= app.exec();
  22121. delete engine;
  22122. return retval;
  22123. }
  22124. /*:638*/
  22125. #line 535 "./typica.w"
  22126. #include "moc_typica.cpp"
  22127. /*:3*/