1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310 |
- /*3:*/
- #line 522 "./typica.w"
-
- #define PROGRAM_NAME "Typica"
-
- /*5:*/
- #line 616 "./typica.w"
-
- #include <QtCore>
- #include <QtGui>
- #include <QtScript>
- #include <QtScriptTools>
- #include <QtXml>
- #include <QtSql>
- #include <QtDebug>
- #include <QtXmlPatterns>
- #include <QtWebKit>
- #include <QtSvg>
-
- /*:5*//*6:*/
- #line 632 "./typica.w"
-
- #include "helpmenu.h"
-
- /*:6*//*291:*/
- #line 6605 "./typica.w"
-
- #include "units.h"
-
- #line 1 "./measurement.w"
- /*:291*//*561:*/
- #line 197 "./webview.w"
-
- #include "webview.h"
-
- /*:561*//*574:*/
- #line 375 "./webview.w"
-
- #include "webelement.h"
-
- #line 12571 "./typica.w"
-
- /*:574*//*685:*/
- #line 487 "./daterangeselector.w"
-
- #include "daterangeselector.h"
- #line 14297 "./typica.w"
-
- /*:685*//*793:*/
- #line 16868 "./typica.w"
-
- #include "qextserialport.h"
- #include "qextserialenumerator.h"
-
- /*:793*//*964:*/
- #line 124 "./dataqsdk.w"
-
- #ifdef Q_OS_WIN32
- #include <windef.h>
- #else
- #define PASCAL
- #endif
-
- /*:964*//*988:*/
- #line 862 "./dataqsdk.w"
-
- #include <limits>
-
- /*:988*//*1003:*/
- #line 62 "./scales.w"
-
- #include "draglabel.h"
-
- /*:1003*//*1018:*/
- #line 335 "./scales.w"
-
- #include "scale.h"
-
- /*:1018*/
- #line 525 "./typica.w"
-
- /*23:*/
- #line 994 "./typica.w"
-
- class ScriptQMainWindow:public QMainWindow
- {
- Q_OBJECT
- Q_PROPERTY(QString closePrompt READ closePrompt WRITE setClosePrompt)
- public:
- ScriptQMainWindow();
- QString closePrompt();
- public slots:
- void show();
- void saveSizeAndPosition(const QString&key);
- void restoreSizeAndPosition(const QString&key);
- void displayStatus(const QString&message= QString());
- void setClosePrompt(QString prompt);
- protected:
- void closeEvent(QCloseEvent*event);
- void showEvent(QShowEvent*event);
- signals:
- void aboutToClose(void);
- private:
- QString cprompt;
- };
-
- /*:23*//*169:*/
- #line 3918 "./typica.w"
-
- class SqlQueryConnection:public QSqlQuery
- {
- public:
- SqlQueryConnection(const QString&query= QString());
- ~SqlQueryConnection();
- QSqlQuery*operator->()const;
- private:
- QString connection;
- QSqlQuery*q;
- };
-
- /*:169*//*240:*/
- #line 5807 "./typica.w"
-
- class NumericDelegate:public QItemDelegate
- {
- Q_OBJECT
- public:
- NumericDelegate(QObject*parent= NULL);
- QWidget*createEditor(QWidget*parent,
- const QStyleOptionViewItem&option,
- const QModelIndex&index)const;
- void setEditorData(QWidget*editor,const QModelIndex&index)const;
- void setModelData(QWidget*editor,QAbstractItemModel*model,
- const QModelIndex&index)const;
- void updateEditorGeometry(QWidget*editor,
- const QStyleOptionViewItem&option,
- const QModelIndex&index)const;
- };
-
- /*:240*//*246:*/
- #line 5900 "./typica.w"
-
- class ScriptValidator:public QValidator
- {
- Q_OBJECT
- public:
- ScriptValidator(QValidator*validator,QObject*parent= NULL);
- void fixup(QString&input)const;
- QValidator::State validate(QString&input,int&pos)const;
- private:
- QValidator*v;
- };
-
- /*:246*//*287:*/
- #line 438 "./units.w"
-
- Q_DECLARE_METATYPE(Units::Unit)
-
- /*:287*//*292:*/
- #line 19 "./measurement.w"
-
- class Measurement:public QVariantMap
- {
- public:
- Measurement(double temperature= 0,QTime time= QTime(),
- Units::Unit sc= Units::Fahrenheit);
- Measurement(double temperature);
- double temperature()const;
- QTime time()const;
- void setTemperature(double temperature);
- void setTime(QTime time);
- void setUnit(Units::Unit scale);
- Units::Unit scale()const;
- Measurement toFahrenheit();
- Measurement toCelsius();
- Measurement toKelvin();
- Measurement toRankine();
- };
-
- /*:292*//*296:*/
- #line 128 "./measurement.w"
-
- Q_DECLARE_METATYPE(Measurement)
-
- /*:296*//*303:*/
- #line 6669 "./typica.w"
-
- class Channel;
- class DAQImplementation;
-
- class DAQ:public QObject
- {
- Q_OBJECT
- Q_ENUMS(ThermocoupleType)
- DAQImplementation*imp;
- private slots:
- void threadFinished();
- public:
- DAQ(QString device,const QString&driver= QString("nidaqmxbase"));
- ~DAQ();
- Channel*newChannel(int units,int thermocouple);
- Q_INVOKABLE void setClockRate(double Hz);
- Q_INVOKABLE void start();
- Q_INVOKABLE void stop();
- enum ThermocoupleType
- {
- TypeJ= 10072,
- TypeK= 10073,
- TypeN= 10077,
- TypeR= 10082,
- TypeS= 10085,
- TypeT= 10086,
- TypeB= 10047,
- TypeE= 10055
- };
- };
-
- /*:303*//*304:*/
- #line 6707 "./typica.w"
-
- class DAQImplementation:public QThread
- {
- Q_OBJECT
- public:
- DAQImplementation(const QString&driverinfo);
- ~DAQImplementation();
- void run();
- void measure();
- /*305:*/
- #line 6727 "./typica.w"
-
- typedef int(*daqfp)(...);
- daqfp read;
- daqfp errorInfo;
- daqfp startTask;
- daqfp createTask;
- daqfp createChannel;
- daqfp setClock;
- daqfp stopTask;
- daqfp clearTask;
- daqfp resetDevice;
- daqfp waitForMeasurement;
-
- /*:305*/
- #line 6716 "./typica.w"
-
- /*306:*/
- #line 6743 "./typica.w"
-
- bool useBase;
- QString device;
- QVector<Channel*> channelMap;
- unsigned int handle;
- int error;
- int channels;
- bool ready;
- QLibrary driver;
- QVector<Units::Unit> unitMap;
-
- /*:306*/
- #line 6717 "./typica.w"
-
- };
-
- /*:304*//*322:*/
- #line 7248 "./typica.w"
-
- class FakeDAQImplementation:public QThread
- {
- Q_OBJECT
- public:
- FakeDAQImplementation();
- ~FakeDAQImplementation();
- void run();
- void measure();
- QVector<Channel*> channelMap;
- int channels;
- bool ready;
- double clockRate;
- };
-
- class FakeDAQ:public QObject
- {
- Q_OBJECT
- FakeDAQImplementation*imp;
- public:
- FakeDAQ(QString device);
- ~FakeDAQ();
- Channel*newChannel(int units,int thermocouple);
- Q_INVOKABLE void setClockRate(double Hz);
- Q_INVOKABLE void start();
- };
-
- /*:322*//*329:*/
- #line 7435 "./typica.w"
-
- class Channel:public QObject
- {
- Q_OBJECT
- public:
- Channel();
- ~Channel();
- public slots:
- void input(Measurement measurement);
- signals:
- void newData(Measurement);
- };
-
- /*:329*//*333:*/
- #line 7502 "./typica.w"
-
- class LinearCalibrator:public QObject
- {
- Q_OBJECT
- Q_PROPERTY(double measuredLower READ measuredLower
- WRITE setMeasuredLower)
- Q_PROPERTY(double measuredUpper READ measuredUpper
- WRITE setMeasuredUpper)
- Q_PROPERTY(double mappedLower READ mappedLower WRITE setMappedLower)
- Q_PROPERTY(double mappedUpper READ mappedUpper WRITE setMappedUpper)
- Q_PROPERTY(bool closedRange READ isClosedRange WRITE setClosedRange)
- Q_PROPERTY(double sensitivity READ sensitivity WRITE setSensitivity)
- public:
- LinearCalibrator(QObject*parent= NULL);
- double measuredLower();
- double measuredUpper();
- double mappedLower();
- double mappedUpper();
- bool isClosedRange();
- double sensitivity();
- public slots:
- void setMeasuredLower(double lower);
- void setMeasuredUpper(double upper);
- void setMappedLower(double lower);
- void setMappedUpper(double upper);
- void setClosedRange(bool closed);
- void setSensitivity(double sensitivity);
- Measurement newMeasurement(Measurement measure);
- signals:
- void measurement(Measurement measure);
- void newData(Measurement measure);
- private:
- double Lo1;
- double Lo2;
- double Up1;
- double Up2;
- double sensitivitySetting;
- bool clamp;
- };
-
- /*:333*//*340:*/
- #line 7698 "./typica.w"
-
- class LinearSplineInterpolator:public QObject
- {
- Q_OBJECT
- public:
- LinearSplineInterpolator(QObject*parent= NULL);
- Q_INVOKABLE void add_pair(double source,double destination);
- public slots:
- Measurement newMeasurement(Measurement measure);
- signals:
- void newData(Measurement measure);
- private:
- void make_interpolators();
- QMap<double,double> *pairs;
- QList<LinearCalibrator*> *interpolators;
- };
-
- /*:340*//*345:*/
- #line 7834 "./typica.w"
-
- class TemperatureDisplay:public QLCDNumber
- {
- Q_OBJECT
- int unit;
- bool r;
- public:
- TemperatureDisplay(QWidget*parent= NULL);
- ~TemperatureDisplay();
- public slots:
- void setValue(Measurement temperature);
- void invalidate();
- void setDisplayUnits(Units::Unit scale);
- void setRelativeMode(bool relative);
- };
-
- /*:345*//*356:*/
- #line 8053 "./typica.w"
-
- class MeasurementTimeOffset:public QObject
- {
- Q_OBJECT
- QTime epoch;
- QTime previous;
- bool hasPrevious;
- public:
- MeasurementTimeOffset(QTime zero);
- QTime zeroTime();
- public slots:
- void newMeasurement(Measurement measure);
- void setZeroTime(QTime zero);
- signals:
- void measurement(Measurement measure);
- };
-
- /*:356*//*363:*/
- #line 8205 "./typica.w"
-
- class ThresholdDetector:public QObject
- {
- Q_OBJECT
- Q_ENUMS(EdgeDirection)
- public:
- enum EdgeDirection{
- Ascending,Descending
- };
- ThresholdDetector(double value);
- public slots:
- void newMeasurement(Measurement measure);
- void setThreshold(double value);
- void setEdgeDirection(EdgeDirection direction);
- signals:
- void timeForValue(double);
- private:
- double previousValue;
- double threshold;
- EdgeDirection currentDirection;
- };
-
- /*:363*//*368:*/
- #line 8311 "./typica.w"
-
- class ZeroEmitter:public QObject
- {
- Q_OBJECT
- Q_PROPERTY(int column READ column WRITE setColumn)
- Measurement cache;
- int col;
- public:
- ZeroEmitter(int tempcolumn= 1);
- int column();
- double lastTemperature();
- public slots:
- void newMeasurement(Measurement measure);
- void setColumn(int column);
- void emitZero();
- signals:
- void measurement(Measurement measure,int tempcolumn);
- };
-
- /*:368*//*373:*/
- #line 8405 "./typica.w"
-
- class MeasurementAdapter:public QObject
- {
- Q_OBJECT
- int col;
- public:
- MeasurementAdapter(int tempcolumn);
- int column();
- public slots:
- void newMeasurement(Measurement measure);
- void setColumn(int column);
- signals:
- void measurement(Measurement measure,int tempcolumn);
- };
-
- /*:373*//*378:*/
- #line 8494 "./typica.w"
-
- class GraphView:public QGraphicsView
- {
- Q_OBJECT
- QGraphicsScene*theScene;
- QMap<int,QList<QGraphicsLineItem*> *> *graphLines;
- QMap<int,QPointF> *prevPoints;
- QMap<int,double> *translations;
- QList<QGraphicsItem*> *gridLinesF;
- QList<QGraphicsItem*> *gridLinesC;
- QList<QGraphicsItem*> *relativeGridLines;
- bool relativeEnabled;
- bool timeIndicatorEnabled;
- QGraphicsLineItem*timeLine;
- LinearSplineInterpolator*relativeAdjuster;
- public:
- GraphView(QWidget*parent= NULL);
- void removeSeries(int column);
- protected:
- void resizeEvent(QResizeEvent*event);
- public slots:
- void newMeasurement(Measurement measure,int tempcolumn);
- void setSeriesTranslation(int column,double offset);
- void setTimeIndicatorEnabled(bool enabled);
- void clear();
- void showF();
- void showC();
- };
-
- /*:378*//*395:*/
- #line 8959 "./typica.w"
-
- class MeasurementModel;
- class ZoomLog:public QTableView
- {
- Q_OBJECT
- /*396:*/
- #line 9008 "./typica.w"
-
- MeasurementModel*model_ms;
- MeasurementModel*model_1s;
- MeasurementModel*model_5s;
- MeasurementModel*model_10s;
- MeasurementModel*model_15s;
- MeasurementModel*model_30s;
- MeasurementModel*model_1m;
- QList<MeasurementModel*> modelSet;
- QHash<int,Measurement> lastMeasurement;
- MeasurementModel*currentModel;
- QList<int> saveTempCols;
- QList<int> saveControlCols;
- QList<int> saveNoteCols;
- QList<int> currentColumnSet;
-
- /*:396*/
- #line 8964 "./typica.w"
-
- void switchLOD(MeasurementModel*m);
- private slots:
- void centerOn(int row);
- void persistColumnResize(int column,int oldsize,int newsize);
- void restoreColumnWidths();
- public:
- ZoomLog();
- QVariant data(int row,int column)const;
- int rowCount();
- bool saveXML(QIODevice*device);
- bool saveCSV(QIODevice*device);
- QString lastTime(int series);
- Q_INVOKABLE Units::Unit displayUnits();
- public slots:
- void setVisible(bool visibility);
- void setHeaderData(int section,QString text);
- void LOD_ms();
- void LOD_1s();
- void LOD_5s();
- void LOD_10s();
- void LOD_15s();
- void LOD_30s();
- void LOD_1m();
- void newMeasurement(Measurement measure,int tempcolumn);
- void newAnnotation(QString annotation,int tempcolumn,
- int annotationcolumn);
- void clear();
- void addOutputTemperatureColumn(int column);
- void addOutputControlColumn(int column);
- void addOutputAnnotationColumn(int column);
- void clearOutputColumns();
- void setDisplayUnits(Units::Unit scale);
- void addToCurrentColumnSet(int column);
- void clearCurrentColumnSet();
- protected:
- virtual void showEvent(QShowEvent*event);
- };
-
- /*:395*//*421:*/
- #line 9704 "./typica.w"
-
- class MeasurementList;
- class MeasurementModel:public QAbstractItemModel
- {
- Q_OBJECT
- Units::Unit unit;
- QList<MeasurementList*> *entries;
- QStringList*hData;
- int colcount;
- QHash<int,int> *lastTemperature;
- QList<MeasurementList*> ::iterator lastInsertion;
- QHash<int,bool> *controlColumns;
- public:
- MeasurementModel(QObject*parent= NULL);
- ~MeasurementModel();
- int rowCount(const QModelIndex&parent= QModelIndex())const;
- int columnCount(const QModelIndex&parent= QModelIndex())const;
- bool setHeaderData(int section,Qt::Orientation orientation,
- const QVariant&value,int role= Qt::DisplayRole);
- QVariant data(const QModelIndex&index,int role)const;
- bool setData(const QModelIndex&index,const QVariant&value,
- int role= Qt::EditRole);
- Qt::ItemFlags flags(const QModelIndex&index)const;
- QVariant headerData(int section,Qt::Orientation orientation,
- int role= Qt::DisplayRole)const;
- QModelIndex index(int row,int column,
- const QModelIndex&parent= QModelIndex())const;
- QModelIndex parent(const QModelIndex&index)const;
- Units::Unit displayUnits();
- public slots:
- void newMeasurement(Measurement measure,int tempcolumn);
- void newAnnotation(QString annotation,int tempcolumn,
- int annotationColumn);
- void clear();
- void setDisplayUnits(Units::Unit scale);
- signals:
- void rowChanged(int);
- };
-
- /*:421*//*422:*/
- #line 9748 "./typica.w"
-
- class MeasurementList:public QVariantList
- {
- public:
- bool operator<(const MeasurementList&other)const;
- bool operator==(const MeasurementList&other)const;
- };
-
- /*:422*//*448:*/
- #line 10406 "./typica.w"
-
- class AnnotationButton:public QPushButton
- {
- Q_OBJECT
- QString note;
- int tc;
- int ac;
- int count;
- public:
- AnnotationButton(const QString&text,QWidget*parent= NULL);
- public slots:
- void setAnnotation(const QString&annotation);
- void setTemperatureColumn(int tempcolumn);
- void setAnnotationColumn(int annotationcolumn);
- void annotate();
- void resetCount();
- signals:
- void annotation(QString annotation,int tempcolumn,
- int notecolumn);
- };
-
- /*:448*//*456:*/
- #line 10531 "./typica.w"
-
- class AnnotationSpinBox:public QDoubleSpinBox
- {
- Q_OBJECT
- QString pretext;
- QString posttext;
- int tc;
- int ac;
- bool change;
- public:
- AnnotationSpinBox(const QString&pret,const QString&postt,
- QWidget*parent= NULL);
- public slots:
- void setPretext(const QString&pret);
- void setPosttext(const QString&postt);
- void setTemperatureColumn(int tempcolumn);
- void setAnnotationColumn(int annotationcolumn);
- void annotate();
- void resetChange();
- signals:
- void annotation(QString annotation,int tempcolumn,
- int notecolumn);
- };
-
- /*:456*//*464:*/
- #line 10690 "./typica.w"
-
- class TimerDisplay:public QLCDNumber
- {
- Q_OBJECT
- /*465:*/
- #line 10740 "./typica.w"
-
- Q_PROPERTY(QTime seconds READ seconds WRITE setTimer)
- Q_PROPERTY(TimerMode mode READ mode WRITE setMode)
- Q_PROPERTY(bool running READ isRunning)
- Q_PROPERTY(QTime resetValue READ resetValue WRITE setResetValue)
- Q_PROPERTY(QString displayFormat READ displayFormat WRITE setDisplayFormat)
- Q_PROPERTY(bool autoReset READ autoReset WRITE setAutoReset)
- Q_PROPERTY(QString value READ value)
-
- /*:465*/
- #line 10694 "./typica.w"
-
- private slots:
- void updateTime();
- void setCountUpMode();
- void setCountDownMode();
- void setClockMode();
- public:
- TimerDisplay(QWidget*parent= NULL);
- ~TimerDisplay();
- enum TimerMode
- {
- CountUp,
- CountDown,
- Clock
- };
- QString value();
- QTime seconds();
- TimerMode mode();
- bool isRunning();
- QTime resetValue();
- QString displayFormat();
- bool autoReset();
- public slots:
- void setTimer(QTime value= QTime(0,0,0));
- void setMode(TimerMode mode);
- void startTimer();
- void stopTimer();
- void copyTimer();
- void setResetValue(QTime value= QTime(0,0,0));
- void reset();
- void setDisplayFormat(QString format);
- void setAutoReset(bool reset);
- void updateDisplay();
- signals:
- void valueChanged(QTime);
- void runStateChanged(bool);
- private:
- /*466:*/
- #line 10751 "./typica.w"
-
- QTime s;
- QTime r;
- QTimer clock;
- TimerDisplay::TimerMode m;
- bool running;
- bool ar;
- QAction*startAction;
- QAction*stopAction;
- QAction*resetAction;
- QString f;
- QTime relative;
- QTime base;
-
- /*:466*/
- #line 10731 "./typica.w"
-
- };
-
- /*:464*//*487:*/
- #line 11143 "./typica.w"
-
- class PackLayout:public QLayout
- {
- int doLayout(const QRect&rect,bool testOnly)const;
- QList<QLayoutItem*> itemList;
- Qt::Orientations orientation;
- public:
- PackLayout(QWidget*parent,int margin= 0,int spacing= -1);
- PackLayout(int spacing= -1);
- ~PackLayout();
- void addItem(QLayoutItem*item);
- Qt::Orientations expandingDirections()const;
- bool hasHeightForWidth()const;
- int heightForWidth(int width)const;
- int count()const;
- QLayoutItem*itemAt(int index)const;
- QSize minimumSize()const;
- void setGeometry(const QRect&rect);
- void setOrientation(Qt::Orientations direction);
- QSize sizeHint()const;
- QLayoutItem*takeAt(int index);
- };
-
- /*:487*//*500:*/
- #line 11421 "./typica.w"
-
- class SceneButton:public QGraphicsScene
- {
- Q_OBJECT
- public:
- SceneButton();
- ~SceneButton();
- protected:
- void mousePressEvent(QGraphicsSceneMouseEvent*mouseEvent);
- signals:
- void clicked(QPoint pos);
- };
-
- /*:500*//*502:*/
- #line 11463 "./typica.w"
-
- class WidgetDecorator:public QWidget
- {
- Q_OBJECT
- PackLayout*layout;
- QGraphicsView*label;
- QGraphicsTextItem*text;
- SceneButton*scene;
- public:
- WidgetDecorator(QWidget*widget,const QString&labeltext,
- Qt::Orientations orientation= Qt::Horizontal,
- QWidget*parent= NULL,Qt::WindowFlags f= 0);
- ~WidgetDecorator();
- void setBackgroundBrush(QBrush background);
- void setTextColor(QColor color);
- };
-
- /*:502*//*513:*/
- #line 11638 "./typica.w"
-
- class LogEditWindow:public QMainWindow
- {
- Q_OBJECT
- QWidget*centralWidget;
- PackLayout*mainLayout;
- QHBoxLayout*addRowsLayout;
- QLabel*startTimeLabel;
- QTimeEdit*startTime;
- QLabel*endTimeLabel;
- QTimeEdit*endTime;
- QLabel*intervalLabel;
- QSpinBox*interval;
- QPushButton*addRows;
- QAction*saveXml;
- QAction*saveCsv;
- QAction*openXml;
- MeasurementModel*model;
- QTableView*log;
- private slots:
- void addTheRows();
- void saveXML();
- void saveCSV();
- void openXML();
- protected:
- void closeEvent(QCloseEvent*event);
- public:
- LogEditWindow();
- };
-
- /*:513*//*527:*/
- #line 11946 "./typica.w"
-
- class XMLOutput:public QObject
- {
- Q_OBJECT
- MeasurementModel*data;
- QIODevice*out;
- int time;
- QMap<int,QString> temperatureColumns;
- QMap<int,QString> controlColumns;
- QMap<int,QString> annotationColumns;
- public:
- XMLOutput(MeasurementModel*model,QIODevice*device,int timec= 0);
- void addTemperatureColumn(const QString&series,int column);
- void addControlColumn(const QString&series,int column);
- void addAnnotationColumn(const QString&series,int column);
- void setModel(MeasurementModel*model);
- void setTimeColumn(int column);
- void setDevice(QIODevice*device);
- bool output();
- };
-
- /*:527*//*534:*/
- #line 12182 "./typica.w"
-
- class XMLInput:public QObject
- {
- Q_OBJECT
- int firstc;
- QIODevice*in;
- public:
- XMLInput(QIODevice*input,int c);
- void setFirstColumn(int column);
- void setDevice(QIODevice*device);
- bool input();
- signals:
- void measure(Measurement,int);
- void annotation(QString,int,int);
- void newTemperatureColumn(int,QString);
- void newAnnotationColumn(int,QString);
- void lastColumn(int);
- };
-
- /*:534*//*545:*/
- #line 12436 "./typica.w"
-
- class CSVOutput
- {
- MeasurementModel*data;
- QIODevice*out;
- int time;
- QMap<int,QString> temperatureColumns;
- QMap<int,QString> controlColumns;
- QMap<int,QString> annotationColumns;
- public:
- CSVOutput(MeasurementModel*model,QIODevice*device,int timec= 0);
- void addTemperatureColumn(const QString&series,int column);
- void addControlColumn(const QString&series,int column);
- void addAnnotationColumn(const QString&series,int column);
- void setModel(MeasurementModel*model);
- void setTimeColumn(int column);
- void setDevice(QIODevice*device);
- bool output();
- };
-
- /*:545*//*575:*/
- #line 12579 "./typica.w"
-
- #define AppInstance (qobject_cast<Application *> (qApp))
-
- class NodeInserter;
- class DeviceTreeModel;
- class Application:public QApplication
- {
- Q_OBJECT
- public:
- Application(int&argc,char**argv);
- QDomDocument*configuration();
- /*717:*/
- #line 15143 "./typica.w"
-
- QDomDocument deviceConfiguration();
-
- /*:717*//*750:*/
- #line 15816 "./typica.w"
-
- void registerDeviceConfigurationWidget(QString driver,QMetaObject widget);
- QWidget*deviceConfigurationWidget(DeviceTreeModel*model,
- const QModelIndex&index);
-
- /*:750*//*755:*/
- #line 15920 "./typica.w"
-
- QList<NodeInserter*> topLevelNodeInserters;
-
- /*:755*/
- #line 12590 "./typica.w"
-
- QSqlDatabase database();
- QScriptEngine*engine;
- public slots:
- /*718:*/
- #line 15150 "./typica.w"
-
- void saveDeviceConfiguration();
-
- /*:718*/
- #line 12594 "./typica.w"
-
- private:
- /*716:*/
- #line 15134 "./typica.w"
-
- QDomDocument deviceConfigurationDocument;
-
- /*:716*//*749:*/
- #line 15810 "./typica.w"
-
- QHash<QString,QMetaObject> deviceConfigurationWidgets;
-
- /*:749*/
- #line 12596 "./typica.w"
-
- QDomDocument conf;
- };
-
- /*:575*//*583:*/
- #line 12721 "./typica.w"
-
- class SaltModel:public QAbstractItemModel
- {
- Q_OBJECT
- QList<QList<QMap<int,QVariant> > > modelData;
- QStringList hData;
- int colcount;
- public:
- SaltModel(int columns);
- ~SaltModel();
- int rowCount(const QModelIndex&parent= QModelIndex())const;
- int columnCount(const QModelIndex&parent= QModelIndex())const;
- bool setHeaderData(int section,Qt::Orientation orientation,
- const QVariant&value,int role= Qt::DisplayRole);
- QVariant data(const QModelIndex&index,int role)const;
- bool setData(const QModelIndex&index,const QVariant&value,
- int role= Qt::EditRole);
- Qt::ItemFlags flags(const QModelIndex&index)const;
- QVariant headerData(int section,Qt::Orientation orientation,
- int role= Qt::DisplayRole)const;
- QModelIndex index(int row,int column,
- const QModelIndex&parent= QModelIndex())const;
- QModelIndex parent(const QModelIndex&index)const;
- QString arrayLiteral(int column,int role)const;
- QString quotedArrayLiteral(int column,int role)const;
- void clear();
- bool removeRows(int row,int count,
- const QModelIndex&parent= QModelIndex());
- int findData(const QVariant&value,int column,int role= Qt::UserRole);
- };
-
- /*:583*//*599:*/
- #line 13106 "./typica.w"
-
- class SqlComboBox:public QComboBox
- {
- Q_OBJECT
- int dataColumn;
- int displayColumn;
- bool dataColumnShown;
- QString specialNullText;
- QVariant specialNullData;
- public:
- SqlComboBox();
- ~SqlComboBox();
- SqlComboBox*clone(QWidget*parent);
- public slots:
- void addNullOption();
- void addSqlOptions(QString query);
- void setDataColumn(int column);
- void setDisplayColumn(int column);
- void showData(bool show);
- void setNullText(QString nullText);
- void setNullData(QVariant nullData);
- };
-
- /*:599*//*606:*/
- #line 13253 "./typica.w"
-
- class SqlComboBoxDelegate:public QItemDelegate
- {
- Q_OBJECT
- SqlComboBox*delegate;
- public:
- SqlComboBoxDelegate(QObject*parent= NULL);
- QWidget*createEditor(QWidget*parent,
- const QStyleOptionViewItem&option,
- const QModelIndex&index)const;
- void setEditorData(QWidget*editor,const QModelIndex&index)const;
- void setModelData(QWidget*editor,QAbstractItemModel*model,
- const QModelIndex&index)const;
- void setWidget(SqlComboBox*widget);
- virtual QSize sizeHint()const;
- void updateEditorGeometry(QWidget*editor,
- const QStyleOptionViewItem&option,
- const QModelIndex&index)const;
- };
-
- /*:606*//*621:*/
- #line 13464 "./typica.w"
-
- class SqlConnectionSetup:public QDialog
- {
- Q_OBJECT
- public:
- SqlConnectionSetup();
- ~SqlConnectionSetup();
- public slots:
- void testConnection();
- private:
- QFormLayout*formLayout;
- QComboBox*driver;
- QLineEdit*hostname;
- QLineEdit*portnumber;
- QLineEdit*dbname;
- QLineEdit*user;
- QLineEdit*password;
- QVBoxLayout*layout;
- QHBoxLayout*buttons;
- QPushButton*cancelButton;
- QPushButton*connectButton;
- };
-
- /*:621*//*626:*/
- #line 13607 "./typica.w"
-
- class SqlQueryView:public QTableView
- {
- Q_OBJECT
- public:
- SqlQueryView(QWidget*parent= NULL);
- void setQuery(const QString&query);
- bool setHeaderData(int section,Qt::Orientation orientation,
- const QVariant&value,int role);
- Q_INVOKABLE QVariant data(int row,int column,
- int role= Qt::DisplayRole);
- signals:
- void openEntry(QString key);
- void openEntryRow(int row);
- protected:
- virtual void showEvent(QShowEvent*event);
- private slots:
- void openRow(const QModelIndex&index);
- void persistColumnResize(int column,int oldsize,int newsize);
- };
-
- /*:626*//*641:*/
- #line 13862 "./typica.w"
-
- class ReportAction:public QAction
- {
- Q_OBJECT
- public:
- ReportAction(const QString&fileName,const QString&reportName,
- QObject*parent= NULL);
- private slots:
- void createReport();
- private:
- QString reportFile;
- };
-
- /*:641*//*653:*/
- #line 14073 "./typica.w"
-
- class ReportTable:public QObject
- {
- Q_OBJECT
- QTextFrame*area;
- QDomElement configuration;
- QMap<QString,QVariant> bindings;
- public:
- ReportTable(QTextFrame*frame,QDomElement description);
- ~ReportTable();
- Q_INVOKABLE void bind(QString placeholder,QVariant value);
- public slots:
- void refresh();
- };
-
- /*:653*//*686:*/
- #line 14312 "./typica.w"
-
- class FormArray:public QScrollArea
- {
- Q_OBJECT
- QDomElement configuration;
- QWidget itemContainer;
- QVBoxLayout itemLayout;
- int maxwidth;
- int maxheight;
- public:
- FormArray(QDomElement description);
- Q_INVOKABLE QWidget*elementAt(int index);
- Q_INVOKABLE int elements();
- public slots:
- void addElements(int copies= 1);
- void removeAllElements();
- void setMaximumElementWidth(int width);
- void setMaximumElementHeight(int height);
- };
-
- /*:686*//*696:*/
- #line 14528 "./typica.w"
-
- class ScaleControl:public QGraphicsView
- {
- Q_OBJECT
- Q_PROPERTY(double initialValue READ initialValue WRITE setInitialValue)
- Q_PROPERTY(double finalValue READ finalValue WRITE setFinalValue)
- /*697:*/
- #line 14554 "./typica.w"
-
- QGraphicsScene scene;
- QGraphicsPolygonItem initialDecrement;
- QGraphicsPolygonItem initialIncrement;
- QGraphicsPolygonItem finalDecrement;
- QGraphicsPolygonItem finalIncrement;
- QGraphicsPolygonItem initialIndicator;
- QGraphicsPolygonItem finalIndicator;
- QGraphicsPathItem scaleLine;
- QPolygonF left;
- QPolygonF right;
- QPolygonF down;
- QPolygonF up;
- QPainterPath scalePath;
- QBrush initialBrush;
- QBrush finalBrush;
- double nonScoredValue;
- double scoredValue;
- bool initialSet;
- bool finalSet;
- bool scaleDown;
-
- /*:697*/
- #line 14534 "./typica.w"
-
- public:
- ScaleControl();
- double initialValue(void);
- double finalValue(void);
- virtual QSize sizeHint()const;
- public slots:
- void setInitialValue(double value);
- void setFinalValue(double value);
- signals:
- void initialChanged(double);
- void finalChanged(double);
- protected:
- virtual void mousePressEvent(QMouseEvent*event);
- virtual void mouseReleaseEvent(QMouseEvent*event);
- };
-
- /*:696*//*708:*/
- #line 14851 "./typica.w"
-
- class IntensityControl:public QGraphicsView
- {
- Q_OBJECT
- Q_PROPERTY(double value READ value WRITE setValue)
- QGraphicsScene scene;
- QGraphicsPolygonItem decrement;
- QGraphicsPolygonItem increment;
- QGraphicsPolygonItem indicator;
- QGraphicsPathItem scaleLine;
- QPolygonF left;
- QPolygonF up;
- QPolygonF down;
- QPainterPath scalePath;
- QBrush theBrush;
- double theValue;
- bool valueSet;
- bool scaleDown;
- public:
- IntensityControl();
- double value();
- virtual QSize sizeHint()const;
- public slots:
- void setValue(double val);
- signals:
- void valueChanged(double);
- protected:
- virtual void mousePressEvent(QMouseEvent*event);
- virtual void mouseReleaseEvent(QMouseEvent*event);
- };
-
- /*:708*//*724:*/
- #line 15239 "./typica.w"
-
- class DeviceTreeModelNode
- {
- public:
- DeviceTreeModelNode(QDomNode&node,int row,
- DeviceTreeModelNode*parent= NULL);
- ~DeviceTreeModelNode();
- DeviceTreeModelNode*child(int index);
- DeviceTreeModelNode*parent();
- QDomNode node()const;
- int row();
- private:
- QDomNode domNode;
- QHash<int,DeviceTreeModelNode*> children;
- int rowNumber;
- DeviceTreeModelNode*parentItem;
- };
-
- /*:724*//*726:*/
- #line 15314 "./typica.w"
-
- class DeviceTreeModel:public QAbstractItemModel
- {
- Q_OBJECT
- public:
- DeviceTreeModel(QObject*parent= NULL);
- ~DeviceTreeModel();
- QVariant data(const QModelIndex&index,int role)const;
- Qt::ItemFlags flags(const QModelIndex&index)const;
- QVariant headerData(int section,Qt::Orientation orientation,
- int role= Qt::DisplayRole)const;
- QModelIndex index(int row,int column,
- const QModelIndex&parent= QModelIndex())const;
- QModelIndex parent(const QModelIndex&child)const;
- int rowCount(const QModelIndex&parent= QModelIndex())const;
- int columnCount(const QModelIndex&parent= QModelIndex())const;
- bool setData(const QModelIndex&index,const QVariant&value,
- int role);
- bool removeRows(int row,int count,const QModelIndex&parent);
- QDomElement referenceElement(const QString&id);
- public slots:
- void newNode(const QString&name,const QString&driver,
- const QModelIndex&parent);
- private:
- QDomDocument document;
- DeviceTreeModelNode*root;
- QDomNode referenceSection;
- QDomNode treeRoot;
- };
-
- /*:726*//*745:*/
- #line 15768 "./typica.w"
-
- Q_DECLARE_METATYPE(QModelIndex)
-
- /*:745*//*753:*/
- #line 15875 "./typica.w"
-
- class NodeInserter:public QAction
- {
- Q_OBJECT
- public:
- NodeInserter(const QString&title,const QString&name,
- const QString&driver,QObject*parent= NULL);
- signals:
- void triggered(QString name,QString driver);
- private slots:
- void onTriggered();
- private:
- QString defaultNodeName;
- QString driverString;
- };
-
- /*:753*//*756:*/
- #line 15930 "./typica.w"
-
- class DeviceConfigurationWindow:public QWidget
- {
- Q_OBJECT
- public:
- DeviceConfigurationWindow();
- public slots:
- void addDevice();
- void removeNode();
- void newSelection(const QModelIndex&index);
- private slots:
- void resizeColumn();
- private:
- QDomDocument document;
- DeviceTreeModel*model;
- QTreeView*view;
- QScrollArea*configArea;
- };
-
- /*:756*//*765:*/
- #line 16100 "./typica.w"
-
- class BasicDeviceConfigurationWidget:public QWidget
- {
- Q_OBJECT
- public:
- BasicDeviceConfigurationWidget(DeviceTreeModel*model,
- const QModelIndex&index);
- public slots:
- void insertChildNode(const QString&name,const QString&driver);
- void updateAttribute(const QString&name,const QString&value);
- protected:
- DeviceTreeModel*deviceModel;
- QModelIndex currentNode;
- };
-
- /*:765*//*769:*/
- #line 16185 "./typica.w"
-
- class RoasterConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE RoasterConfWidget(DeviceTreeModel*model,
- const QModelIndex&index);
- private slots:
- void updateRoasterId(int id);
- void updateCapacityCheck(int value);
- void updateCapacity(const QString&value);
- void updateCapacityUnit(const QString&value);
- };
-
- /*:769*//*774:*/
- #line 16390 "./typica.w"
-
- class NiDaqMxBaseDriverConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE NiDaqMxBaseDriverConfWidget(DeviceTreeModel*model,
- const QModelIndex&index);
- };
-
- /*:774*//*776:*/
- #line 16436 "./typica.w"
-
- class NiDaqMxBase9211ConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE NiDaqMxBase9211ConfWidget(DeviceTreeModel*device,
- const QModelIndex&index);
- private slots:
- void addChannel();
- void updateDeviceId(const QString&newId);
- };
-
- /*:776*//*780:*/
- #line 16522 "./typica.w"
-
- class Ni9211TcConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE Ni9211TcConfWidget(DeviceTreeModel*device,
- const QModelIndex&index);
- private slots:
- void updateThermocoupleType(const QString&type);
- void updateColumnName(const QString&name);
- void updateHidden(bool hidden);
- };
-
- /*:780*//*785:*/
- #line 16638 "./typica.w"
-
- class NiDaqMxDriverConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE NiDaqMxDriverConfWidget(DeviceTreeModel*model,
- const QModelIndex&index);
- };
-
- /*:785*//*787:*/
- #line 16679 "./typica.w"
-
- class NiDaqMx9211ConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE NiDaqMx9211ConfWidget(DeviceTreeModel*model,
- const QModelIndex&index);
- private slots:
- void addChannel();
- void updateDeviceId(const QString&newId);
- };
-
- /*:787*//*789:*/
- #line 16748 "./typica.w"
-
- class NiDaqMxTc01ConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE NiDaqMxTc01ConfWidget(DeviceTreeModel*model,
- const QModelIndex&index);
- private slots:
- void updateDeviceId(const QString&newId);
- void updateThermocoupleType(const QString&type);
- void updateColumnName(const QString&name);
- void updateHidden(bool hidden);
- };
-
- /*:789*//*794:*/
- #line 16879 "./typica.w"
-
- class PortSelector:public QComboBox
- {
- Q_OBJECT
- public:
- PortSelector(QWidget*parent= NULL);
- private slots:
- void addDevice(QextPortInfo port);
- private:
- QextSerialEnumerator*lister;
- };
-
- /*:794*//*796:*/
- #line 16927 "./typica.w"
-
- class BaudSelector:public QComboBox
- {
- Q_OBJECT
- Q_ENUMS(BaudRateType)
- public:
- BaudSelector(QWidget*parent= NULL);
- enum BaudRateType
- {
- #if defined(Q_OS_UNIX) || defined(qdoc)
- BAUD50= 50,
- BAUD75= 75,
- BAUD134= 134,
- BAUD150= 150,
- BAUD200= 200,
- BAUD1800= 1800,
- #if defined(B76800) || defined(qdoc)
- BAUD76800= 76800,
- #endif
- #if (defined(B230400) && defined(B4000000)) || defined(qdoc)
- BAUD230400= 230400,
- BAUD460800= 460800,
- BAUD500000= 500000,
- BAUD576000= 576000,
- BAUD921600= 921600,
- BAUD1000000= 1000000,
- BAUD1152000= 1152000,
- BAUD1500000= 1500000,
- BAUD2000000= 2000000,
- BAUD2500000= 2500000,
- BAUD3000000= 3000000,
- BAUD3500000= 3500000,
- BAUD4000000= 4000000,
- #endif
- #endif
- #if defined(Q_OS_WIN) || defined(qdoc)
- BAUD14400= 14400,
- BAUD56000= 56000,
- BAUD128000= 128000,
- BAUD256000= 256000,
- #endif
- BAUD110= 110,
- BAUD300= 300,
- BAUD600= 600,
- BAUD1200= 1200,
- BAUD2400= 2400,
- BAUD4800= 4800,
- BAUD9600= 9600,
- BAUD19200= 19200,
- BAUD38400= 38400,
- BAUD57600= 57600,
- BAUD115200= 115200
- };
- };
-
- /*:796*//*798:*/
- #line 16998 "./typica.w"
-
- class ParitySelector:public QComboBox
- {
- Q_OBJECT
- Q_ENUMS(ParityType)
- public:
- ParitySelector(QWidget*parent= NULL);
- enum ParityType
- {
- PAR_NONE,
- PAR_ODD,
- PAR_EVEN,
- #if defined(Q_OS_WIN) || defined(qdoc)
- PAR_MARK,
- #endif
- PAR_SPACE
- };
- };
-
- /*:798*//*800:*/
- #line 17036 "./typica.w"
-
- class FlowSelector:public QComboBox
- {
- Q_OBJECT
- Q_ENUMS(FlowType)
- public:
- FlowSelector(QWidget*parent= NULL);
- enum FlowType
- {
- FLOW_OFF,
- FLOW_HARDWARE,
- FLOW_XONXOFF
- };
- };
-
- /*:800*//*802:*/
- #line 17069 "./typica.w"
-
- class StopSelector:public QComboBox
- {
- Q_OBJECT
- Q_ENUMS(StopBitsType)
- public:
- StopSelector(QWidget*parent= NULL);
- enum StopBitsType
- {
- STOP_1,
- #if defined(Q_OS_WIN) || defined(qdoc)
- STOP_1_5,
- #endif
- STOP_2
- };
- };
-
- /*:802*//*805:*/
- #line 17122 "./typica.w"
-
- class ShortHexSpinBox:public QSpinBox
- {
- Q_OBJECT
- public:
- ShortHexSpinBox(QWidget*parent= NULL);
- virtual QValidator::State validate(QString&input,int&pos)const;
- protected:
- virtual int valueFromText(const QString&text)const;
- virtual QString textFromValue(int value)const;
- };
-
- /*:805*//*807:*/
- #line 17184 "./typica.w"
-
- class ModbusRtuPortConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE ModbusRtuPortConfWidget(DeviceTreeModel*model,
- const QModelIndex&index);
- private slots:
- void updatePort(const QString&newPort);
- void updateBaudRate(const QString&newRate);
- void updateParity(const QString&newParity);
- void updateFlowControl(const QString&newFlow);
- void updateStopBits(const QString&newStopBits);
- };
-
- /*:807*//*809:*/
- #line 17335 "./typica.w"
-
- class ModbusRtuDeviceConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE ModbusRtuDeviceConfWidget(DeviceTreeModel*model,
- const QModelIndex&index);
- private slots:
- void updateStationNumber(int newStation);
- void updateFixedUnit(bool newFixed);
- void updateFixedDecimal(bool newFixed);
- void updateUnit(const QString&newUnit);
- void updateUnitAddress(int newAddress);
- void updateValueF(int newValue);
- void updateValueC(int newValue);
- void updatePrecisionAddress(int newAddress);
- void updatePrecisionValue(int newValue);
- private:
- QStackedLayout*unitSpecificationLayout;
- QStackedLayout*decimalSpecificationLayout;
- };
-
- /*:809*//*811:*/
- #line 17594 "./typica.w"
-
- class ModbusRtuDeviceTPvConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE ModbusRtuDeviceTPvConfWidget(DeviceTreeModel*model,
- const QModelIndex&index);
- private slots:
- void updateAddress(int newAddress);
- };
-
- /*:811*//*813:*/
- #line 17640 "./typica.w"
-
- class ModbusRtuDeviceTSvConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE ModbusRtuDeviceTSvConfWidget(DeviceTreeModel*model,
- const QModelIndex&index);
- private slots:
- void updateReadAddress(int newAddress);
- void updateWriteAddress(int newAddress);
- void updateFixedRange(bool fixed);
- void updateLower(const QString&lower);
- void updateUpper(const QString&upper);
- void updateLowerAddress(int newAddress);
- void updateUpperAddress(int newAddress);
- private:
- QStackedLayout*boundsLayout;
- };
-
- /*:813*//*817:*/
- #line 17834 "./typica.w"
-
- class AnnotationButtonConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE AnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index);
- private slots:
- void updateButtonText(const QString&text);
- void updateAnnotationText(const QString&text);
- };
-
- /*:817*//*821:*/
- #line 17902 "./typica.w"
-
- class ReconfigurableAnnotationButtonConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE ReconfigurableAnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index);
- private slots:
- void updateButtonText(const QString&text);
- void updateAnnotationText(const QString&text);
- };
-
- /*:821*//*824:*/
- #line 17976 "./typica.w"
-
- class NoteSpinConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE NoteSpinConfWidget(DeviceTreeModel*model,const QModelIndex&index);
- private slots:
- void updateLabel(const QString&text);
- void updateMinimum(const QString&minimum);
- void updateMaximum(const QString&maximum);
- void updatePrecision(int precision);
- void updatePretext(const QString&text);
- void updatePosttext(const QString&text);
- };
-
- /*:824*//*827:*/
- #line 12 "./freeannotation.w"
-
- class FreeAnnotationConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE FreeAnnotationConfWidget(DeviceTreeModel*model,const QModelIndex&index);
- private slots:
- void updateLabel(const QString&text);
- };
-
- /*:827*//*831:*/
- #line 11 "./settings.w"
-
- class SettingsWindow:public QMainWindow
- {
- Q_OBJECT
- public:
- SettingsWindow();
- };
-
- /*:831*//*836:*/
- #line 8 "./graphsettings.w"
-
- class GraphSettingsWidget:public QWidget
- {
- Q_OBJECT
- public:
- GraphSettingsWidget();
- };
-
- /*:836*//*838:*/
- #line 46 "./graphsettings.w"
-
- class GraphSettingsRelativeTab:public QWidget
- {
- Q_OBJECT
- public:
- GraphSettingsRelativeTab();
- public slots:
- void updateEnableSetting(bool enable);
- void updateColorSetting(const QString&color);
- void updateAxisSetting(const QString&gridList);
- void updateUnit(int unit);
- void showColorPicker();
- private:
- QLineEdit*colorEdit;
- };
-
- /*:838*//*842:*/
- #line 7 "./advancedsettings.w"
-
- class AdvancedSettingsWidget:public QWidget
- {
- Q_OBJECT
- public:
- AdvancedSettingsWidget();
- public slots:
- void enableDiagnosticLogging(bool enabled);
- };
-
- /*:842*//*846:*/
- #line 18101 "./typica.w"
-
- class ModbusRTUDevice:public QObject
- {
- Q_OBJECT
- public:
- ModbusRTUDevice(DeviceTreeModel*model,const QModelIndex&index);
- ~ModbusRTUDevice();
- void queueMessage(QByteArray request,QObject*object,const char*callback);
- Q_INVOKABLE double SVLower();
- Q_INVOKABLE double SVUpper();
- Q_INVOKABLE int decimals();
- QList<Channel*> channels;
- public slots:
- void outputSV(double sv);
- signals:
- void SVLowerChanged(double);
- void SVUpperChanged(double);
- void SVDecimalChanged(int);
- void queueEmpty();
- private slots:
- void dataAvailable();
- void sendNextMessage();
- void decimalResponse(QByteArray response);
- void unitResponse(QByteArray response);
- void svlResponse(QByteArray response);
- void svuResponse(QByteArray response);
- void requestMeasurement();
- void mResponse(QByteArray response);
- void ignore(QByteArray response);
- void timeout();
- private:
- QextSerialPort*port;
- QByteArray responseBuffer;
- QList<QByteArray> messageQueue;
- QList<QObject*> retObjQueue;
- QList<char*> callbackQueue;
- quint16 calculateCRC(QByteArray data);
- QTimer*messageDelayTimer;
- QTimer*commTimeout;
- int delayTime;
- char station;
- int decimalPosition;
- int valueF;
- int valueC;
- bool unitIsF;
- double outputSVLower;
- double outputSVUpper;
- QByteArray outputSVStub;
- QByteArray pvStub;
- QByteArray svStub;
- QByteArray mStub;
- quint16 pvaddress;
- quint16 svaddress;
- bool svenabled;
- bool readingsv;
- double savedpv;
- bool waiting;
- };
-
- /*:846*//*862:*/
- #line 18804 "./typica.w"
-
- class ModbusConfigurator:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE ModbusConfigurator(DeviceTreeModel*model,const QModelIndex&index);
- private slots:
- void updatePort(const QString&newPort);
- void updateBaudRate(const QString&newRate);
- void updateParity(const QString&newParity);
- void updateFlowControl(const QString&newFlow);
- void updateStopBits(const QString&newStopBits);
- void updateStation(int station);
- void updateFixedDecimal(bool fixed);
- void updateDecimalAddress(int address);
- void updateDecimalPosition(int position);
- void updateFixedUnit(bool fixed);
- void updateUnitAddress(int address);
- void updateValueForF(int value);
- void updateValueForC(int value);
- void updateUnit(const QString&newUnit);
- void updatePVAddress(int address);
- void updateSVEnabled(bool enabled);
- void updateSVReadAddress(int address);
- void updateDeviceLimit(bool query);
- void updateSVLowerAddress(int address);
- void updateSVUpperAddress(int address);
- void updateSVLower(double value);
- void updateSVUpper(double value);
- void updateSVWritable(bool canWriteSV);
- void updateSVWriteAddress(int address);
- void updatePVColumnName(const QString&name);
- void updateSVColumnName(const QString&name);
- void updatePVHidden(bool hidden);
- void updateSVHidden(bool hidden);
- private:
- PortSelector*port;
- BaudSelector*baud;
- ParitySelector*parity;
- FlowSelector*flow;
- StopSelector*stop;
- QSpinBox*station;
- QCheckBox*decimalQuery;
- ShortHexSpinBox*decimalAddress;
- QSpinBox*decimalPosition;
- QCheckBox*unitQuery;
- ShortHexSpinBox*unitAddress;
- QSpinBox*valueF;
- QSpinBox*valueC;
- QComboBox*fixedUnit;
- ShortHexSpinBox*pVAddress;
- QCheckBox*sVEnabled;
- ShortHexSpinBox*sVReadAddress;
- QCheckBox*deviceLimit;
- ShortHexSpinBox*sVLowerAddr;
- ShortHexSpinBox*sVUpperAddr;
- QDoubleSpinBox*sVLower;
- QDoubleSpinBox*sVUpper;
- QCheckBox*sVWritable;
- ShortHexSpinBox*sVOutputAddr;
- QLineEdit*pVColumnName;
- QLineEdit*sVColumnName;
- };
-
- /*:862*//*866:*/
- #line 36 "./unsupportedserial.w"
-
- class UnsupportedSerialDeviceConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE UnsupportedSerialDeviceConfWidget(DeviceTreeModel*model,
- const QModelIndex&index);
- private slots:
- void updateConfiguration();
- void saveScript();
- void addChannel();
- private:
- SaltModel*deviceSettingsModel;
- QTextEdit*scriptEditor;
- };
-
- /*:866*//*871:*/
- #line 166 "./unsupportedserial.w"
-
- class UnsupportedDeviceChannelConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE UnsupportedDeviceChannelConfWidget(DeviceTreeModel*model,
- const QModelIndex&index);
- private slots:
- void updateColumnName(const QString&value);
- void updateHidden(bool hidden);
- void updateConfiguration();
- private:
- SaltModel*channelSettingsModel;
- };
-
- /*:871*//*876:*/
- #line 298 "./unsupportedserial.w"
-
- class JavaScriptDevice:public QObject
- {
- Q_OBJECT
- public:
- Q_INVOKABLE JavaScriptDevice(const QModelIndex&deviceIndex,
- QScriptEngine*engine);
- Q_INVOKABLE int channelCount();
- Channel*getChannel(int channel);
- Q_INVOKABLE bool isChannelHidden(int channel);
- Q_INVOKABLE Units::Unit expectedChannelUnit(int channel);
- Q_INVOKABLE QString channelColumnName(int channel);
- Q_INVOKABLE QString channelIndicatorText(int channel);
- public slots:
- void setTemperatureColumn(int tcol);
- void setAnnotationColumn(int ncol);
- void start();
- void stop();
- signals:
- void annotation(QString note,int tcol,int ncol);
- void triggerStartBatch();
- void triggerStopBatch();
- void deviceStopRequested();
- private:
- QVariantMap deviceSettings;
- QString deviceScript;
- QList<Channel*> channelList;
- QList<bool> hiddenState;
- QList<Units::Unit> channelUnits;
- QList<QString> columnNames;
- QList<QString> indicatorTexts;
- QList<QVariantMap> channelSettings;
- int annotationTemperatureColumn;
- int annotationNoteColumn;
- QScriptEngine*scriptengine;
- };
-
- /*:876*//*901:*/
- #line 11 "./phidgets.w"
-
- class PhidgetsTemperatureSensorConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE PhidgetsTemperatureSensorConfWidget(DeviceTreeModel*model,
- const QModelIndex&index);
- private slots:
- void addChannel();
- void updateRate(int ms);
- };
-
- /*:901*//*905:*/
- #line 82 "./phidgets.w"
-
- class PhidgetTemperatureSensorChannelConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE PhidgetTemperatureSensorChannelConfWidget(DeviceTreeModel*model,
- const QModelIndex&index);
- private slots:
- void updateColumnName(const QString&value);
- void updateHidden(bool hidden);
- void updateTC(int index);
- void updateChannel(int channel);
- private:
- QComboBox*tcType;
- };
-
- /*:905*//*910:*/
- #line 213 "./phidgets.w"
-
- class PhidgetsTemperatureSensor:public QObject
- {
- Q_OBJECT
- public:
- Q_INVOKABLE PhidgetsTemperatureSensor(const QModelIndex&deviceIndex);
- Q_INVOKABLE int channelCount();
- Channel*getChannel(int channel);
- Q_INVOKABLE bool isChannelHidden(int channel);
- Q_INVOKABLE QString channelColumnName(int channel);
- Q_INVOKABLE QString channelIndicatorText(int channel);
- public slots:
- void start();
- void stop();
- private slots:
- void getMeasurements();
- private:
- QList<int> channelIndices;
- QList<int> tctypes;
- QList<Channel*> channelList;
- QMap<int,Channel*> channelMap;
- QList<bool> hiddenState;
- QList<QString> columnNames;
- QList<QString> indicatorTexts;
- QLibrary driver;
- QTimer sampleTimer;
- void*device;
- /*914:*/
- #line 349 "./phidgets.w"
-
- #ifdef _WIN32
- typedef int(__stdcall*PhidgetHandleOnly)(void*);
- typedef int(__stdcall*PhidgetHandleInt)(void*,int);
- typedef int(__stdcall*PhidgetHandleIntInt)(void*,int,int);
- typedef int(__stdcall*PhidgetHandleIntDoubleOut)(void*,int,double*);
- #else
- typedef int(*PhidgetHandleOnly)(void*);
- typedef int(*PhidgetHandleInt)(void*,int);
- typedef int(*PhidgetHandleIntInt)(void*,int,int);
- typedef int(*PhidgetHandleIntDoubleOut)(void*,int,double*);
- #endif
- PhidgetHandleOnly createDevice;
- PhidgetHandleInt openDevice;
- PhidgetHandleInt waitForOpen;
- PhidgetHandleIntInt setTCType;
- PhidgetHandleIntDoubleOut getTemperature;
- PhidgetHandleOnly closeDevice;
- PhidgetHandleOnly deleteDevice;
-
- /*:914*/
- #line 240 "./phidgets.w"
-
- };
-
- /*:910*//*923:*/
- #line 19342 "./typica.w"
-
- class LinearSplineInterpolationConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE LinearSplineInterpolationConfWidget(DeviceTreeModel*model,
- const QModelIndex&index);
- private slots:
- void updateSourceColumn(const QString&source);
- void updateDestinationColumn(const QString&dest);
- void updateKnots();
- private:
- SaltModel*tablemodel;
- };
-
- /*:923*//*929:*/
- #line 19472 "./typica.w"
-
- class CoolingTimerConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE CoolingTimerConfWidget(DeviceTreeModel*model,
- const QModelIndex&index);
- private slots:
- void updateResetTime(QTime time);
- };
-
- /*:929*//*933:*/
- #line 19538 "./typica.w"
-
- class RangeTimerConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE RangeTimerConfWidget(DeviceTreeModel*model,const QModelIndex&index);
- private slots:
- void updateStartButtonText(const QString&text);
- void updateStopButtonText(const QString&text);
- void updateStartColumnName(const QString&text);
- void updateStopColumnName(const QString&text);
- void updateStartValue(const QString&text);
- void updateStopValue(const QString&text);
- void updateStartTrigger(int option);
- void updateStopTrigger(int option);
- };
-
- /*:933*//*938:*/
- #line 19790 "./typica.w"
-
- class MultiRangeTimerConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE MultiRangeTimerConfWidget(DeviceTreeModel*model,
- const QModelIndex&index);
- private slots:
- void updateColumnName(const QString&text);
- void updateRangeData();
- private:
- SaltModel*tablemodel;
- };
-
- /*:938*//*943:*/
- #line 19892 "./typica.w"
-
- class TranslationConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE TranslationConfWidget(DeviceTreeModel*model,const QModelIndex&index);
- private slots:
- void updateMatchingColumn(const QString&column);
- void updateTemperature();
- private:
- QDoubleSpinBox*temperatureValue;
- QComboBox*unitSelector;
- };
-
- /*:943*//*947:*/
- #line 16 "./rate.w"
-
- class RateOfChange:public QObject
- {
- Q_OBJECT
- public:
- RateOfChange(int cachetime= 1,int scaletime= 1);
- public slots:
- void newMeasurement(Measurement measure);
- void setCacheTime(int seconds);
- void setScaleTime(int seconds);
- signals:
- void newData(Measurement measure);
- private:
- int ct;
- int st;
- QList<Measurement> cache;
- };
-
- /*:947*//*955:*/
- #line 177 "./rate.w"
-
- class RateOfChangeConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE RateOfChangeConfWidget(DeviceTreeModel*model,const QModelIndex&index);
- private slots:
- void updateColumn(const QString&column);
- void updateCacheTime(const QString&seconds);
- void updateScaleTime(const QString&seconds);
- };
-
- /*:955*//*961:*/
- #line 19 "./dataqsdk.w"
-
- class DataqSdkDeviceImplementation;
- class DataqSdkDevice:public QObject
- {
- Q_OBJECT
- DataqSdkDeviceImplementation*imp;
- private slots:
- void threadFinished();
- public:
- DataqSdkDevice(QString device);
- ~DataqSdkDevice();
- Channel*newChannel(Units::Unit scale);
- Q_INVOKABLE void setClockRate(double Hz);
- Q_INVOKABLE void start();
- static QStringList detectPorts();
- static QStringList detectHardware();
- };
-
- /*:961*//*962:*/
- #line 49 "./dataqsdk.w"
-
- class DataqSdkDeviceImplementation:public QThread
- {
- Q_OBJECT
- public:
- DataqSdkDeviceImplementation();
- ~DataqSdkDeviceImplementation();
- void run();
- /*963:*/
- #line 70 "./dataqsdk.w"
-
- typedef struct di_inlist_struct{
- unsigned short chan;
- unsigned short diff;
- unsigned short gain;
- unsigned short unipolar;
- unsigned short dig_out_enable;
- unsigned short dig_out;
- unsigned short ave;
- unsigned short counter;
- }DI_INLIST_STRUCT;
-
- typedef int(PASCAL*FPDIOPEN)(unsigned);
- typedef int(PASCAL*FPDICLOSE)(void);
- typedef double(PASCAL*FPDISAMPLERATE)(double,long*,long*);
- typedef double(PASCAL*FPDIMAXIMUMRATE)(double);
- typedef int(PASCAL*FPDILISTLENGTH)(unsigned,unsigned);
- typedef int(PASCAL*FPDIINLIST)(di_inlist_struct*);
- typedef int*(PASCAL*FPDIBUFFERALLOC)(unsigned,unsigned);
- typedef int(PASCAL*FPDISTARTSCAN)(void);
- typedef unsigned(PASCAL*FPDISTATUSREAD)(short*,unsigned);
- typedef unsigned(PASCAL*FPDIBUFFERSTATUS)(unsigned);
- typedef int(PASCAL*FPDIBURSTRATE)(unsigned);
- typedef int(PASCAL*FPDISTOPSCAN)(void);
-
- FPDIOPEN di_open;
- FPDICLOSE di_close;
- FPDISAMPLERATE di_sample_rate;
- FPDIMAXIMUMRATE di_maximum_rate;
- FPDILISTLENGTH di_list_length;
- FPDIINLIST di_inlist;
- FPDIBUFFERALLOC di_buffer_alloc;
- FPDISTARTSCAN di_start_scan;
- FPDISTATUSREAD di_status_read;
- FPDIBUFFERSTATUS di_buffer_status;
- FPDIBURSTRATE di_burst_rate;
- FPDISTOPSCAN di_stop_scan;
-
- /*:963*/
- #line 57 "./dataqsdk.w"
-
- /*965:*/
- #line 134 "./dataqsdk.w"
-
- bool isOpen;
- double sampleRate;
- long oversample;
- long burstDivisor;
- QString device;
- unsigned deviceNumber;
- QVector<Channel*> channelMap;
-
- int error;
- int channels;
- bool ready;
- QLibrary*driver;
- QVector<Units::Unit> unitMap;
- int*input_buffer;
- QTimer*eventClock;
- QMultiMap<int,double> smoother;
-
- /*:965*/
- #line 58 "./dataqsdk.w"
-
- public slots:
- void measure();
- private:
- qint16*buffer;
- };
-
- /*:962*//*982:*/
- #line 663 "./dataqsdk.w"
-
- class DataqSdkDeviceConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE DataqSdkDeviceConfWidget(DeviceTreeModel*model,
- const QModelIndex&index);
- private slots:
- void updateAutoSelect(bool automatic);
- void updateDeviceNumber(int deviceNumber);
- void updatePort(QString portId);
- void addChannel();
- private:
- QStackedWidget*deviceIdStack;
- };
-
- /*:982*//*987:*/
- #line 808 "./dataqsdk.w"
-
- class DataqSdkChannelConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE DataqSdkChannelConfWidget(DeviceTreeModel*model,
- const QModelIndex&index);
- private slots:
- void updateUnits(const QString&unit);
- void updateColumnName(const QString&value);
- void updateMeasuredLower(const QString&value);
- void updateMeasuredUpper(const QString&value);
- void updateMappedLower(const QString&value);
- void updateMappedUpper(const QString&value);
- void updateClosedInterval(bool closed);
- void updateSmoothingEnabled(bool enabled);
- void updateSensitivity(const QString&value);
- void startCalibration();
- void stopCalibration();
- void resetCalibration();
- void updateInput(Measurement measure);
- void updateOutput(Measurement measure);
- void updateHidden(bool hidden);
- private:
- QPushButton*startButton;
- QPushButton*resetButton;
- QPushButton*stopButton;
- /*992:*/
- #line 1098 "./dataqsdk.w"
-
- bool autoSelect;
- QString deviceID;
- unsigned int channelOfInterest;
-
- /*:992*/
- #line 835 "./dataqsdk.w"
-
- DataqSdkDevice*calibrationDevice;
- LinearCalibrator*calibrator;
- QLineEdit*currentMeasurement;
- QLineEdit*minimumMeasurement;
- QLineEdit*maximumMeasurement;
- QLineEdit*averageMeasurement;
- QLineEdit*currentMapped;
- QLineEdit*minimumMapped;
- QLineEdit*maximumMapped;
- QLineEdit*averageMapped;
- int rmCount;
- int cmCount;
- double rmin;
- double rmax;
- double rmean;
- double cmin;
- double cmax;
- double cmean;
- };
-
- /*:987*//*1014:*/
- #line 247 "./scales.w"
-
- Q_DECLARE_METATYPE(BaudRateType)
- Q_DECLARE_METATYPE(DataBitsType)
- Q_DECLARE_METATYPE(ParityType)
- Q_DECLARE_METATYPE(StopBitsType)
- Q_DECLARE_METATYPE(FlowType)
-
- /*:1014*//*1021:*/
- #line 370 "./scales.w"
-
- class SerialScaleConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE SerialScaleConfWidget(DeviceTreeModel*model,
- const QModelIndex&index);
- private slots:
- void updatePort(const QString&newPort);
- void updateBaudRate(const QString&rate);
- void updateParity(int index);
- void updateFlowControl(int index);
- void updateStopBits(int index);
- private:
- PortSelector*port;
- BaudSelector*baud;
- ParitySelector*parity;
- FlowSelector*flow;
- StopSelector*stop;
- };
-
- /*:1021*//*1026:*/
- #line 14 "./valueannotation.w"
-
- class ValueAnnotationConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE ValueAnnotationConfWidget(DeviceTreeModel*model,
- const QModelIndex&index);
- private slots:
- void updateSourceColumn(const QString&source);
- void updateAnnotations();
- void updateStart(bool noteOnStart);
- private:
- SaltModel*tablemodel;
- };
-
- /*:1026*//*1034:*/
- #line 165 "./valueannotation.w"
-
- class ValueAnnotation:public QObject
- {
- Q_OBJECT
- public:
- ValueAnnotation();
- Q_INVOKABLE void setAnnotation(double value,const QString&annotation);
- public slots:
- void newMeasurement(Measurement measure);
- void annotate();
- void setAnnotationColumn(int column);
- void setTemperatureColumn(int column);
- void setTolerance(double epsilon);
- signals:
- void annotation(QString annotation,int tempcolumn,int notecolumn);
- private:
- int lastIndex;
- int annotationColumn;
- int measurementColumn;
- QList<double> values;
- QStringList annotations;
- double tolerance;
- };
-
- /*:1034*/
- #line 526 "./typica.w"
-
- /*12:*/
- #line 808 "./typica.w"
-
- void setQObjectProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:12*//*14:*/
- #line 823 "./typica.w"
-
- void setQPaintDeviceProperties(QScriptValue value,QScriptEngine*engine);
- void setQLayoutItemProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:14*//*16:*/
- #line 848 "./typica.w"
-
- void setQWidgetProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue constructQWidget(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QWidget_setLayout(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QWidget_activateWindow(QScriptContext*context,
- QScriptEngine*engine);
-
- /*:16*//*20:*/
- #line 938 "./typica.w"
-
- QScriptValue displayWarning(QScriptContext*context,QScriptEngine*engine);
- QScriptValue displayError(QScriptContext*context,QScriptEngine*engine);
-
- /*:20*//*30:*/
- #line 1139 "./typica.w"
-
- QScriptValue constructQMainWindow(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue QMainWindow_setCentralWidget(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue QMainWindow_menuBar(QScriptContext*context,
- QScriptEngine*engine);
- void setQMainWindowProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:30*//*35:*/
- #line 1238 "./typica.w"
-
- void setQMenuBarProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue QMenuBar_addMenu(QScriptContext*context,QScriptEngine*engine);
-
- /*:35*//*38:*/
- #line 1283 "./typica.w"
-
- void setQMenuProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue QMenu_addAction(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QMenu_addSeparator(QScriptContext*context,QScriptEngine*engine);
-
- /*:38*//*41:*/
- #line 1349 "./typica.w"
-
- void setQFrameProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue constructQFrame(QScriptContext*context,QScriptEngine*engine);
-
- /*:41*//*44:*/
- #line 1382 "./typica.w"
-
- void setQLabelProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue constructQLabel(QScriptContext*context,QScriptEngine*engine);
-
- /*:44*//*47:*/
- #line 1420 "./typica.w"
-
- void setQSvgWidgetProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue constructQSvgWidget(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue QSvgWidget_loadDevice(QScriptContext*context,
- QScriptEngine*engine);
- void addSvgWidgetToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
-
- /*:47*//*53:*/
- #line 1507 "./typica.w"
-
- void setQLineEditProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue constructQLineEdit(QScriptContext*context,QScriptEngine*engine);
-
- /*:53*//*57:*/
- #line 1546 "./typica.w"
-
- QScriptValue constructQSplitter(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QSplitter_addWidget(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue QSplitter_saveState(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue QSplitter_restoreState(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue QSplitter_count(QScriptContext*context,
- QScriptEngine*engine);
- void setQSplitterProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:57*//*63:*/
- #line 1685 "./typica.w"
-
- void setQLayoutProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue QLayout_addWidget(QScriptContext*context,QScriptEngine*engine);
-
- /*:63*//*65:*/
- #line 1740 "./typica.w"
-
- QScriptValue constructQBoxLayout(QScriptContext*context,
- QScriptEngine*engine);
- void setQBoxLayoutProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue QBoxLayout_addLayout(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QBoxLayout_addWidget(QScriptContext*context,QScriptEngine*engine);
-
- /*:65*//*69:*/
- #line 1853 "./typica.w"
-
- QScriptValue constructQAction(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QAction_setShortcut(QScriptContext*context,
- QScriptEngine*engine);
- void setQActionProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:69*//*72:*/
- #line 1909 "./typica.w"
-
- QScriptValue QFileDialog_getOpenFileName(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue QFileDialog_getSaveFileName(QScriptContext*context,
- QScriptEngine*engine);
- void setQFileDialogProperties(QScriptValue value,QScriptEngine*engine);
- void setQDialogProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:72*//*77:*/
- #line 2020 "./typica.w"
-
- QScriptValue constructQFile(QScriptContext*context,QScriptEngine*engine);
- void setQFileProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue QFile_remove(QScriptContext*context,QScriptEngine*engine);
- void setQIODeviceProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue QIODevice_open(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QIODevice_close(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QIODevice_readToString(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue QIODevice_putChar(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QIODevice_writeString(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QIODevice_writeBytes(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QIODevice_readBytes(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QIODevice_peek(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QIODevice_read(QScriptContext*context,QScriptEngine*engine);
-
- /*:77*//*88:*/
- #line 2246 "./typica.w"
-
- QScriptValue constructQProcess(QScriptContext*context,QScriptEngine*engine);
- void setQProcessProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue QProcess_execute(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QProcess_startDetached(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QProcess_setWorkingDirectory(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QProcess_start(QScriptContext*context,QScriptEngine*engine);
-
- /*:88*//*96:*/
- #line 2364 "./typica.w"
-
- QScriptValue QByteArray_toScriptValue(QScriptEngine*engine,const QByteArray&bytes);
- void QByteArray_fromScriptValue(const QScriptValue&value,QByteArray&bytes);
- QScriptValue constructQByteArray(QScriptContext*context,QScriptEngine*engine);
- void setQByteArrayProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue QByteArray_fromHex(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QByteArray_getAt(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QByteArray_setAt(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QByteArray_appendBytes(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QByteArray_appendString(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QByteArray_size(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QByteArray_left(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QByteArray_right(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QByteArray_mid(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QByteArray_chop(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QByteArray_remove(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QByteArray_toInt8(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QByteArray_toInt16(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QByteArray_toInt32(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QByteArray_toFloat(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QByteArray_toDouble(QScriptContext*context,QScriptEngine*engine);
-
- /*:96*//*109:*/
- #line 2638 "./typica.w"
-
- QScriptValue bytesFromInt8(QScriptContext*context,QScriptEngine*engine);
- QScriptValue bytesFromInt16(QScriptContext*context,QScriptEngine*engine);
- QScriptValue bytesFromInt32(QScriptContext*context,QScriptEngine*engine);
- QScriptValue bytesFromFloat(QScriptContext*context,QScriptEngine*engine);
- QScriptValue bytesFromDouble(QScriptContext*context,QScriptEngine*engine);
-
- /*:109*//*112:*/
- #line 2743 "./typica.w"
-
- QScriptValue constructQBuffer(QScriptContext*context,QScriptEngine*engine);
- void setQBufferProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue QBuffer_setData(QScriptContext*context,QScriptEngine*engine);
-
- /*:112*//*115:*/
- #line 2788 "./typica.w"
-
- QScriptValue constructXQuery(QScriptContext*context,QScriptEngine*engine);
- QScriptValue XQuery_bind(QScriptContext*context,QScriptEngine*engine);
- QScriptValue XQuery_exec(QScriptContext*context,QScriptEngine*engine);
- QScriptValue XQuery_setQuery(QScriptContext*context,QScriptEngine*engine);
- QScriptValue XQuery_invalidate(QScriptContext*context,QScriptEngine*engine);
- void setXQueryProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:115*//*121:*/
- #line 2870 "./typica.w"
-
- QScriptValue constructXmlWriter(QScriptContext*context,QScriptEngine*engine);
- QScriptValue XmlWriter_setDevice(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue XmlWriter_writeAttribute(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue XmlWriter_writeCDATA(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue XmlWriter_writeCharacters(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue XmlWriter_writeDTD(QScriptContext*context,QScriptEngine*engine);
- QScriptValue XmlWriter_writeEmptyElement(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue XmlWriter_writeEndDocument(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue XmlWriter_writeEndElement(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue XmlWriter_writeEntityReference(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue XmlWriter_writeProcessingInstruction(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue XmlWriter_writeStartDocument(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue XmlWriter_writeStartElement(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue XmlWriter_writeTextElement(QScriptContext*context,
- QScriptEngine*engine);
- void setXmlWriterProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:121*//*130:*/
- #line 3088 "./typica.w"
-
- QScriptValue constructXmlReader(QScriptContext*context,QScriptEngine*engine);
- QScriptValue XmlReader_atEnd(QScriptContext*context,QScriptEngine*engine);
- QScriptValue XmlReader_attribute(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue XmlReader_hasAttribute(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue XmlReader_isDTD(QScriptContext*context,QScriptEngine*engine);
- QScriptValue XmlReader_isStartElement(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue XmlReader_name(QScriptContext*context,QScriptEngine*engine);
- QScriptValue XmlReader_readElementText(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue XmlReader_readNext(QScriptContext*context,QScriptEngine*engine);
- QScriptValue XmlReader_text(QScriptContext*context,QScriptEngine*engine);
- void setXmlReaderProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:130*//*137:*/
- #line 3223 "./typica.w"
-
- QScriptValue QSettings_value(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QSettings_setValue(QScriptContext*context,QScriptEngine*engine);
- void setQSettingsProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:137*//*141:*/
- #line 3305 "./typica.w"
-
- QScriptValue constructQLCDNumber(QScriptContext*context,
- QScriptEngine*engine);
- void setQLCDNumberProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:141*//*144:*/
- #line 3343 "./typica.w"
-
- QScriptValue constructQTime(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QTime_addMSecs(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QTime_addSecs(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QTime_elapsed(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QTime_hour(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QTime_isNull(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QTime_isValid(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QTime_minute(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QTime_msec(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QTime_msecsTo(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QTime_restart(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QTime_second(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QTime_secsTo(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QTime_setHMS(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QTime_start(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QTime_toString(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QTime_currentTime(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QTime_fromString(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QTime_valueOf(QScriptContext*context,QScriptEngine*engine);
- void setQTimeProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:144*//*160:*/
- #line 3821 "./typica.w"
-
- void setQAbstractScrollAreaProperties(QScriptValue value,
- QScriptEngine*engine);
-
- /*:160*//*162:*/
- #line 3836 "./typica.w"
-
- void setQAbstractItemViewProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:162*//*164:*/
- #line 3849 "./typica.w"
-
- void setQGraphicsViewProperties(QScriptValue value,QScriptEngine*engine);
- void setQTableViewProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:164*//*166:*/
- #line 3873 "./typica.w"
-
- void setQAbstractButtonProperties(QScriptValue value,QScriptEngine*engine);
- void setQPushButtonProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue constructQPushButton(QScriptContext*context,
- QScriptEngine*engine);
-
- /*:166*//*173:*/
- #line 3972 "./typica.w"
-
- void setQSqlQueryProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue constructQSqlQuery(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QSqlQuery_bind(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QSqlQuery_bindDeviceData(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue QSqlQuery_bindFileData(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue QSqlQuery_exec(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue QSqlQuery_executedQuery(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue QSqlQuery_invalidate(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QSqlQuery_next(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QSqlQuery_prepare(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QSqlQuery_value(QScriptContext*context,QScriptEngine*engine);
-
- /*:173*//*180:*/
- #line 4143 "./typica.w"
-
- QScriptValue baseName(QScriptContext*context,QScriptEngine*engine);
- QScriptValue dir(QScriptContext*context,QScriptEngine*engine);
- QScriptValue sqlToArray(QScriptContext*context,QScriptEngine*engine);
- QScriptValue setFont(QScriptContext*context,QScriptEngine*engine);
- QScriptValue annotationFromRecord(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue setTabOrder(QScriptContext*context,QScriptEngine*engine);
- QScriptValue saveFileFromDatabase(QScriptContext*context,QScriptEngine*engine);
- QScriptValue scriptTr(QScriptContext*context,QScriptEngine*engine);
-
- /*:180*//*193:*/
- #line 4475 "./typica.w"
-
- QScriptValue createWindow(QScriptContext*context,QScriptEngine*engine);
- QScriptValue createReport(QScriptContext*context,QScriptEngine*engine);
- void addLayoutToWidget(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
- void addLayoutToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
- void addSplitterToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
- void addSplitterToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
- void populateGridLayout(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
- void populateBoxLayout(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
- void populateSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
- void populateWidget(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
- void populateStackedLayout(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
- void addTemperatureDisplayToSplitter(QDomElement element,
- QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
- void addTemperatureDisplayToLayout(QDomElement element,
- QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
- void addTimerDisplayToSplitter(QDomElement element,
- QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
- void addTimerDisplayToLayout(QDomElement element,
- QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
- void addDecorationToSplitter(QDomElement element,
- QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
- void addDecorationToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
- void addWidgetToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
- void addButtonToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
- void addZoomLogToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
- void addGraphToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
- void addSqlDropToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
- void addSaltToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
- void addLineToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
- void addTextToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
- void addSqlQueryViewToLayout(QDomElement element,
- QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
- void addCalendarToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
- void addSpinBoxToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
-
- /*:193*//*257:*/
- #line 6157 "./typica.w"
-
- void setQDateEditProperties(QScriptValue value,QScriptEngine*engine);
- void setQDateTimeEditProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue QDateTimeEdit_setDate(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue QDateTimeEdit_day(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QDateTimeEdit_month(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue QDateTimeEdit_year(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QDateTimeEdit_setToCurrentTime(QScriptContext*context,QScriptEngine*engine);
-
- /*:257*//*258:*/
- #line 6173 "./typica.w"
-
- QScriptValue findChildObject(QScriptContext*context,QScriptEngine*engine);
-
- /*:258*//*262:*/
- #line 6312 "./typica.w"
-
- void setSaltTableProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue SaltTable_bindableColumnArray(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue SaltTable_bindableQuotedColumnArray(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue SaltTable_columnSum(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue SaltTable_columnArray(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue SaltTable_data(QScriptContext*context,QScriptEngine*engine);
- QScriptValue SaltTable_model(QScriptContext*context,QScriptEngine*engine);
- QScriptValue SaltTable_quotedColumnArray(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue SaltTable_setData(QScriptContext*context,QScriptEngine*engine);
- QScriptValue SaltTable_clear(QScriptContext*context,QScriptEngine*engine);
- QScriptValue SaltTable_removeRow(QScriptContext*context,QScriptEngine*engine);
- QScriptValue SaltTable_findData(QScriptContext*context,QScriptEngine*engine);
-
- /*:262*//*272:*/
- #line 6528 "./typica.w"
-
- void setSqlComboBoxProperties(QScriptValue value,QScriptEngine*engine);
- void setQComboBoxProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue QComboBox_currentData(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue QComboBox_addItem(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QComboBox_setModel(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QComboBox_findText(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QComboBox_findData(QScriptContext*context,QScriptEngine*engine);
-
- /*:272*//*284:*/
- #line 379 "./units.w"
-
- QScriptValue Units_convertTemperature(QScriptContext*context,QScriptEngine*engine);
- QScriptValue Units_convertRelativeTemperature(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue Units_isTemperatureUnit(QScriptContext*context,QScriptEngine*engine);
- QScriptValue Units_convertWeight(QScriptContext*context,QScriptEngine*engine);
- QScriptValue Units_isWeightUnit(QScriptContext*context,QScriptEngine*engine);
-
- /*:284*//*288:*/
- #line 443 "./units.w"
-
- QScriptValue Unit_toScriptValue(QScriptEngine*engine,const Units::Unit&value);
- void Unit_fromScriptValue(const QScriptValue&sv,Units::Unit&value);
-
- /*:288*//*297:*/
- #line 133 "./measurement.w"
-
- QScriptValue constructMeasurement(QScriptContext*context,QScriptEngine*engine);
- void setMeasurementProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue Measurement_toScriptValue(QScriptEngine*engine,const Measurement&measurement);
- void Measurement_fromScriptValue(const QScriptValue&value,Measurement&measurement);
-
- /*:297*//*317:*/
- #line 7163 "./typica.w"
-
- QScriptValue constructDAQ(QScriptContext*context,QScriptEngine*engine);
- QScriptValue DAQ_newChannel(QScriptContext*context,QScriptEngine*engine);
- void setDAQProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:317*//*326:*/
- #line 7368 "./typica.w"
-
- QScriptValue constructFakeDAQ(QScriptContext*context,QScriptEngine*engine);
- QScriptValue FakeDAQ_newChannel(QScriptContext*context,QScriptEngine*engine);
- void setFakeDAQProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:326*//*331:*/
- #line 7469 "./typica.w"
-
- void setChannelProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:331*//*337:*/
- #line 7651 "./typica.w"
-
- QScriptValue constructLinearCalibrator(QScriptContext*context,
- QScriptEngine*engine);
- void setLinearCalibratorProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:337*//*342:*/
- #line 7791 "./typica.w"
-
- QScriptValue constructLinearSplineInterpolator(QScriptContext*context,QScriptEngine*engine);
- void setLinearSplineInterpolatorProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:342*//*352:*/
- #line 7996 "./typica.w"
-
- QScriptValue constructTemperatureDisplay(QScriptContext*context,
- QScriptEngine*engine);
- void setTemperatureDisplayProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue TemperatureDisplay_setDisplayUnits(QScriptContext*context,
- QScriptEngine*engine);
-
- /*:352*//*360:*/
- #line 8155 "./typica.w"
-
- QScriptValue constructMeasurementTimeOffset(QScriptContext*context,
- QScriptEngine*engine);
- void setMeasurementTimeOffsetProperties(QScriptValue value,
- QScriptEngine*engine);
-
- /*:360*//*365:*/
- #line 8268 "./typica.w"
-
- QScriptValue constructThresholdDetector(QScriptContext*context,QScriptEngine*engine);
- void setThresholdDetectorProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:365*//*370:*/
- #line 8366 "./typica.w"
-
- QScriptValue constructZeroEmitter(QScriptContext*context,
- QScriptEngine*engine);
- void setZeroEmitterProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:370*//*375:*/
- #line 8445 "./typica.w"
-
- QScriptValue constructMeasurementAdapter(QScriptContext*context,
- QScriptEngine*engine);
- void setMeasurementAdapterProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:375*//*392:*/
- #line 8909 "./typica.w"
-
- void setGraphViewProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue constructGraphView(QScriptContext*context,QScriptEngine*engine);
-
- /*:392*//*415:*/
- #line 9536 "./typica.w"
-
- void setZoomLogProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue constructZoomLog(QScriptContext*context,QScriptEngine*engine);
- QScriptValue ZoomLog_saveXML(QScriptContext*context,QScriptEngine*engine);
- QScriptValue ZoomLog_saveCSV(QScriptContext*context,QScriptEngine*engine);
- QScriptValue ZoomLog_saveState(QScriptContext*context,QScriptEngine*engine);
- QScriptValue ZoomLog_restoreState(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue ZoomLog_lastTime(QScriptContext*context,QScriptEngine*engine);
- QScriptValue ZoomLog_saveTemporary(QScriptContext*context,
- QScriptEngine*engnie);
- QScriptValue ZoomLog_setDisplayUnits(QScriptContext*context,
- QScriptEngine*engine);
-
- /*:415*//*453:*/
- #line 10493 "./typica.w"
-
- QScriptValue constructAnnotationButton(QScriptContext*context,
- QScriptEngine*engine);
- void setAnnotationButtonProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:453*//*461:*/
- #line 10633 "./typica.w"
-
- QScriptValue constructAnnotationSpinBox(QScriptContext*context,
- QScriptEngine*engine);
- void setAnnotationSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
- void setQDoubleSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
- void setQAbstractSpinBoxProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:461*//*482:*/
- #line 11059 "./typica.w"
-
- QScriptValue constructTimerDisplay(QScriptContext*context,
- QScriptEngine*engine);
- void setTimerDisplayProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue TimerDisplay_setTimerMode(QScriptContext*context,QScriptEngine*engine);
-
- /*:482*//*510:*/
- #line 11584 "./typica.w"
-
- void setWidgetDecoratorProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue constructWidgetDecorator(QScriptContext*context,
- QScriptEngine*engine);
-
- /*:510*//*523:*/
- #line 11867 "./typica.w"
-
- QScriptValue constructLogEditWindow(QScriptContext*context,
- QScriptEngine*engine);
-
- /*:523*//*542:*/
- #line 12394 "./typica.w"
-
- QScriptValue constructXMLInput(QScriptContext*context,QScriptEngine*engine);
- QScriptValue XMLInput_input(QScriptContext*context,QScriptEngine*engine);
-
- /*:542*//*560:*/
- #line 189 "./webview.w"
-
- QScriptValue constructWebView(QScriptContext*context,QScriptEngine*engine);
- void setQWebViewProperties(QScriptValue value,QScriptEngine*engine);
- void addWebViewToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
-
- /*:560*//*563:*/
- #line 219 "./webview.w"
-
- QScriptValue QWebElement_toScriptValue(QScriptEngine*engine,const QWebElement&element);
- void QWebElement_fromScriptValue(const QScriptValue&value,QWebElement&element);
-
- /*:563*//*567:*/
- #line 277 "./webview.w"
-
- QScriptValue constructWebElement(QScriptContext*context,
- QScriptEngine*engine);
-
- /*:567*//*636:*/
- #line 13741 "./typica.w"
-
- void setSqlQueryViewProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue constructSqlQueryView(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue SqlQueryView_setQuery(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue SqlQueryView_setHeaderData(QScriptContext*context,
- QScriptEngine*engine);
-
- /*:636*//*646:*/
- #line 13980 "./typica.w"
-
- void addReportToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
-
- /*:646*//*662:*/
- #line 14265 "./typica.w"
-
- void setQTextEditProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue QTextEdit_print(QScriptContext*context,QScriptEngine*engine);
-
- /*:662*//*684:*/
- #line 480 "./daterangeselector.w"
-
- void addDateRangeToLayout(QDomElement element,
- QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
-
- /*:684*//*693:*/
- #line 14462 "./typica.w"
-
- void addFormArrayToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
-
- /*:693*//*714:*/
- #line 15046 "./typica.w"
-
- void addScaleControlToLayout(QDomElement element,
- QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
- void addIntensityControlToLayout(QDomElement element,
- QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
-
- /*:714*//*740:*/
- #line 15632 "./typica.w"
-
- QScriptValue constructDeviceTreeModel(QScriptContext*context,
- QScriptEngine*engine);
- void setDeviceTreeModelProperties(QScriptValue value,QScriptEngine*engine);
- void setQAbstractItemModelProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue DeviceTreeModel_referenceElement(QScriptContext*context,
- QScriptEngine*engine);
- QScriptValue QAbstractItemModel_data(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QAbstractItemModel_index(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QAbstractItemModel_rowCount(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QAbstractItemModel_hasChildren(QScriptContext*context,QScriptEngine*engine);
-
- /*:740*//*746:*/
- #line 15774 "./typica.w"
-
- QScriptValue QModelIndex_toScriptValue(QScriptEngine*engine,const QModelIndex&index);
- void QModelIndex_fromScriptValue(const QScriptValue&value,QModelIndex&index);
-
- /*:746*//*762:*/
- #line 16072 "./typica.w"
-
- QScriptValue constructDeviceConfigurationWindow(QScriptContext*context,
- QScriptEngine*engine);
-
- /*:762*//*833:*/
- #line 42 "./settings.w"
-
- QScriptValue constructSettingsWindow(QScriptContext*context,QScriptEngine*engine);
-
- /*:833*//*857:*/
- #line 18711 "./typica.w"
-
- QScriptValue constructModbusRTUDevice(QScriptContext*context,QScriptEngine*engine);
- QScriptValue ModbusRTUDevice_pVChannel(QScriptContext*context,QScriptEngine*engine);
- QScriptValue ModbusRTUDevice_sVChannel(QScriptContext*context,QScriptEngine*engine);
- void setModbusRTUDeviceProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:857*//*877:*/
- #line 345 "./unsupportedserial.w"
-
- QScriptValue createDevice(QScriptContext*context,QScriptEngine*engine);
-
- /*:877*//*883:*/
- #line 425 "./unsupportedserial.w"
-
- QScriptValue JavaScriptDevice_getChannel(QScriptContext*context,QScriptEngine*engine);
-
- /*:883*//*889:*/
- #line 617 "./unsupportedserial.w"
-
- QScriptValue getMeasurementTimestamp(QScriptContext*context,QScriptEngine*engine);
-
- /*:889*//*893:*/
- #line 651 "./unsupportedserial.w"
-
- QScriptValue constructSerialPort(QScriptContext*context,QScriptEngine*engine);
- void setSerialPortProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue SerialPort_flush(QScriptContext*context,QScriptEngine*engine);
-
- /*:893*//*920:*/
- #line 457 "./phidgets.w"
-
- QScriptValue constructPhidgetsTemperatureSensor(QScriptContext*context,QScriptEngine*engine);
- QScriptValue Phidgets_getChannel(QScriptContext*context,QScriptEngine*engine);
-
- /*:920*//*952:*/
- #line 138 "./rate.w"
-
- QScriptValue constructRateOfChange(QScriptContext*context,QScriptEngine*engine);
- void setRateOfChangeProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:952*//*977:*/
- #line 597 "./dataqsdk.w"
-
- QScriptValue constructDataqSdkDevice(QScriptContext*context,QScriptEngine*engine);
- QScriptValue DataqSdkDevice_newChannel(QScriptContext*context,QScriptEngine*engine);
- void setDataqSdkDeviceProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:977*//*1004:*/
- #line 67 "./scales.w"
-
- QScriptValue constructDragLabel(QScriptContext*context,QScriptEngine*engine);
- void setDragLabelProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:1004*//*1012:*/
- #line 233 "./scales.w"
-
- QScriptValue constructSerialScale(QScriptContext*context,QScriptEngine*engine);
- void setSerialScaleProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:1012*//*1015:*/
- #line 258 "./scales.w"
-
- QScriptValue BaudRateType_toScriptValue(QScriptEngine*engine,const BaudRateType&value);
- void BaudRateType_fromScriptValue(const QScriptValue&sv,BaudRateType&value);
- QScriptValue DataBitsType_toScriptValue(QScriptEngine*engine,const DataBitsType&value);
- void DataBitsType_fromScriptValue(const QScriptValue&sv,DataBitsType&value);
- QScriptValue ParityType_toScriptValue(QScriptEngine*engine,const ParityType&value);
- void ParityType_fromScriptValue(const QScriptValue&sv,ParityType&value);
- QScriptValue StopBitsType_toScriptValue(QScriptEngine*engine,const StopBitsType&value);
- void StopBitsType_fromScriptValue(const QScriptValue&sv,StopBitsType&value);
- QScriptValue FlowType_toScriptValue(QScriptEngine*engine,const FlowType&value);
- void FlowType_fromScriptValue(const QScriptValue&sv,FlowType&value);
-
- /*:1015*//*1040:*/
- #line 265 "./valueannotation.w"
-
- QScriptValue constructValueAnnotation(QScriptContext*context,QScriptEngine*engine);
- void setValueAnnotationProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:1040*/
- #line 527 "./typica.w"
-
- /*616:*/
- #line 13390 "./typica.w"
-
- void messageFileOutput(QtMsgType type,const char*msg);
-
- /*:616*/
- #line 528 "./typica.w"
-
- /*4:*/
- #line 537 "./typica.w"
-
- /*754:*/
- #line 15895 "./typica.w"
-
- NodeInserter::NodeInserter(const QString&title,const QString&name,
- const QString&driver,QObject*parent):
- QAction(title,parent),defaultNodeName(name),driverString(driver)
- {
- connect(this,SIGNAL(triggered()),this,SLOT(onTriggered()));
- }
-
- void NodeInserter::onTriggered()
- {
- emit triggered(defaultNodeName,driverString);
- }
-
- /*:754*/
- #line 538 "./typica.w"
-
- /*293:*/
- #line 40 "./measurement.w"
-
- Measurement::Measurement(double temperature,QTime time,Units::Unit sc)
- {
- insert("measurement",temperature);
- insert("time",time);
- insert("unit",sc);
- }
-
- Measurement::Measurement(double temperature)
- {
- insert("measurement",temperature);
- insert("time",QTime::currentTime());
- insert("unit",Units::Fahrenheit);
- }
-
- void Measurement::setTemperature(double temperature)
- {
- insert("measurement",temperature);
- }
-
- void Measurement::setTime(QTime time)
- {
- insert("time",time);
- }
-
- void Measurement::setUnit(Units::Unit scale)
- {
- insert("unit",scale);
- }
-
- double Measurement::temperature()const
- {
- return value("measurement").toDouble();
- }
-
- QTime Measurement::time()const
- {
- return value("time").toTime();
- }
-
- Units::Unit Measurement::scale()const
- {
- return(Units::Unit)(value("unit").toInt());
- }
-
- /*:293*//*294:*/
- #line 88 "./measurement.w"
-
- Measurement Measurement::toFahrenheit()
- {
- return Measurement(Units::convertTemperature(this->temperature(),
- this->scale(),Units::Fahrenheit),
- this->time(),Units::Fahrenheit);
- }
-
- Measurement Measurement::toCelsius()
- {
- return Measurement(Units::convertTemperature(this->temperature(),
- this->scale(),Units::Celsius),
- this->time(),Units::Celsius);
- }
-
- Measurement Measurement::toKelvin()
- {
- return Measurement(Units::convertTemperature(this->temperature(),
- this->scale(),Units::Kelvin),
- this->time(),Units::Kelvin);
- }
-
- Measurement Measurement::toRankine()
- {
- return Measurement(Units::convertTemperature(this->temperature(),
- this->scale(),Units::Rankine),
- this->time(),Units::Rankine);
- }
-
- /*:294*/
- #line 539 "./typica.w"
-
- /*307:*/
- #line 6768 "./typica.w"
-
- void DAQImplementation::measure()
- {
- int samplesRead= 0;
- double buffer[channels];
- error= read((unsigned int)(handle),(signed long)(1),(double)(10.0),
- (unsigned long)(0),buffer,(unsigned long)(channels),
- &samplesRead,(signed long)(0));
- if(error)
- {
- ready= false;
- }
- else
- {
- if(samplesRead)
- {
- QTime time= QTime::currentTime();
- for(int i= 0;i<samplesRead;i++)
- {
- for(int j= 0;j<channels;j++)
- {
- double measuredValue= buffer[j+(i*channels)];
- Measurement measure(measuredValue,time,
- unitMap[j]);
- channelMap[j]->input(measure);
- }
- }
- }
- }
- }
-
- /*:307*//*308:*/
- #line 6811 "./typica.w"
-
- void DAQImplementation::run()
- {
- setPriority(QThread::TimeCriticalPriority);
- while(ready)
- {
- measure();
- }
- }
-
- /*:308*//*309:*/
- #line 6827 "./typica.w"
-
- void DAQ::threadFinished()
- {
- if(imp->error)
- {
- /*310:*/
- #line 6878 "./typica.w"
-
- imp->ready= false;
- QMessageBox warning;
- warning.setStandardButtons(QMessageBox::Cancel);
- warning.setIcon(QMessageBox::Warning);
- warning.setText(QString(tr("Error: %1")).arg(imp->error));
- unsigned long bytes= imp->errorInfo(NULL,0);
- char string[bytes];
- imp->errorInfo(string,bytes);
- warning.setInformativeText(QString(string));
- warning.setWindowTitle(QString(PROGRAM_NAME));
- warning.exec();
-
- /*:310*/
- #line 6832 "./typica.w"
-
- }
- }
-
- /*:309*//*311:*/
- #line 6903 "./typica.w"
-
- void DAQ::start()
- {
- if(imp->ready)
- {
- imp->error= imp->startTask(imp->handle);
- if(imp->error)
- {
- /*310:*/
- #line 6878 "./typica.w"
-
- imp->ready= false;
- QMessageBox warning;
- warning.setStandardButtons(QMessageBox::Cancel);
- warning.setIcon(QMessageBox::Warning);
- warning.setText(QString(tr("Error: %1")).arg(imp->error));
- unsigned long bytes= imp->errorInfo(NULL,0);
- char string[bytes];
- imp->errorInfo(string,bytes);
- warning.setInformativeText(QString(string));
- warning.setWindowTitle(QString(PROGRAM_NAME));
- warning.exec();
-
- /*:310*/
- #line 6911 "./typica.w"
-
- }
- else
- {
- connect(imp,SIGNAL(finished()),this,SLOT(threadFinished()));
- imp->start();
- }
- }
- }
-
- void DAQ::stop()
- {
- if(imp->useBase)
- {
- imp->ready= false;
- imp->wait(ULONG_MAX);
- imp->stopTask(imp->handle);
- }
- else
- {
- imp->ready= false;
- imp->error= imp->stopTask(imp->handle);
- if(imp->error)
- {
- /*310:*/
- #line 6878 "./typica.w"
-
- imp->ready= false;
- QMessageBox warning;
- warning.setStandardButtons(QMessageBox::Cancel);
- warning.setIcon(QMessageBox::Warning);
- warning.setText(QString(tr("Error: %1")).arg(imp->error));
- unsigned long bytes= imp->errorInfo(NULL,0);
- char string[bytes];
- imp->errorInfo(string,bytes);
- warning.setInformativeText(QString(string));
- warning.setWindowTitle(QString(PROGRAM_NAME));
- warning.exec();
-
- /*:310*/
- #line 6935 "./typica.w"
-
- }
- imp->error= imp->clearTask(imp->handle);
- if(imp->error)
- {
- /*310:*/
- #line 6878 "./typica.w"
-
- imp->ready= false;
- QMessageBox warning;
- warning.setStandardButtons(QMessageBox::Cancel);
- warning.setIcon(QMessageBox::Warning);
- warning.setText(QString(tr("Error: %1")).arg(imp->error));
- unsigned long bytes= imp->errorInfo(NULL,0);
- char string[bytes];
- imp->errorInfo(string,bytes);
- warning.setInformativeText(QString(string));
- warning.setWindowTitle(QString(PROGRAM_NAME));
- warning.exec();
-
- /*:310*/
- #line 6940 "./typica.w"
-
- }
- }
- }
-
- /*:311*//*312:*/
- #line 6950 "./typica.w"
-
- DAQ::DAQ(QString device,const QString&driver):imp(new DAQImplementation(driver))
- {
- imp->device= device;
- imp->error= imp->createTask(device.toAscii().data(),&(imp->handle));
- if(imp->error)
- {
- /*310:*/
- #line 6878 "./typica.w"
-
- imp->ready= false;
- QMessageBox warning;
- warning.setStandardButtons(QMessageBox::Cancel);
- warning.setIcon(QMessageBox::Warning);
- warning.setText(QString(tr("Error: %1")).arg(imp->error));
- unsigned long bytes= imp->errorInfo(NULL,0);
- char string[bytes];
- imp->errorInfo(string,bytes);
- warning.setInformativeText(QString(string));
- warning.setWindowTitle(QString(PROGRAM_NAME));
- warning.exec();
-
- /*:310*/
- #line 6957 "./typica.w"
-
- }
- else
- {
- imp->ready= true;
- }
- }
-
- /*:312*//*313:*/
- #line 6971 "./typica.w"
-
- Channel*DAQ::newChannel(int units,int thermocouple)
- {
- Channel*retval= new Channel();
- imp->channelMap[imp->channels]= retval;
- imp->unitMap[imp->channels]= (Units::Unit)units;
- imp->channels++;
- if(imp->ready)
- {
- if(imp->useBase)
- {
- imp->error= imp->createChannel(imp->handle,
- QString("%1/ai%2").arg(imp->device).
- arg(imp->channels-1).
- toAscii().data(),
- "",(double)(-1.0),(double)(100.0),
- (signed long)(units),
- (signed long)(thermocouple),
- (signed long)(10200),(double)(0),
- "");
- }
- else
- {
- imp->error= imp->createChannel(imp->handle,
- QString("%1/ai%2").arg(imp->device).
- arg(imp->channels-1).
- toAscii().data(),
- "",(double)(50.0),(double)(500.0),
- (signed long)(units),
- (signed long)(thermocouple),
- (signed long)(10200),(double)(0),
- "");
- }
- if(imp->error)
- {
- /*310:*/
- #line 6878 "./typica.w"
-
- imp->ready= false;
- QMessageBox warning;
- warning.setStandardButtons(QMessageBox::Cancel);
- warning.setIcon(QMessageBox::Warning);
- warning.setText(QString(tr("Error: %1")).arg(imp->error));
- unsigned long bytes= imp->errorInfo(NULL,0);
- char string[bytes];
- imp->errorInfo(string,bytes);
- warning.setInformativeText(QString(string));
- warning.setWindowTitle(QString(PROGRAM_NAME));
- warning.exec();
-
- /*:310*/
- #line 7006 "./typica.w"
-
- }
- }
- return retval;
- }
-
- /*:313*//*314:*/
- #line 7020 "./typica.w"
-
- void DAQ::setClockRate(double Hz)
- {
- if(imp->ready)
- {
- imp->error= imp->setClock(imp->handle,"OnboardClock",Hz,
- (signed long)(10280),(signed long)(10123),
- (unsigned long long)(1));
- if(imp->error)
- {
- /*310:*/
- #line 6878 "./typica.w"
-
- imp->ready= false;
- QMessageBox warning;
- warning.setStandardButtons(QMessageBox::Cancel);
- warning.setIcon(QMessageBox::Warning);
- warning.setText(QString(tr("Error: %1")).arg(imp->error));
- unsigned long bytes= imp->errorInfo(NULL,0);
- char string[bytes];
- imp->errorInfo(string,bytes);
- warning.setInformativeText(QString(string));
- warning.setWindowTitle(QString(PROGRAM_NAME));
- warning.exec();
-
- /*:310*/
- #line 7030 "./typica.w"
-
- }
- }
- }
-
- /*:314*//*315:*/
- #line 7040 "./typica.w"
-
- DAQ::~DAQ()
- {
- if(imp->useBase)
- {
- imp->resetDevice(imp->device.toAscii().data());
- imp->clearTask(imp->handle);
- }
- else
- {
- if(imp->ready)
- {
- imp->ready= false;
- imp->wait(ULONG_MAX);
- imp->stopTask(imp->handle);
- imp->resetDevice(imp->device.toAscii().data());
- imp->clearTask(imp->handle);
- }
- }
- delete imp;
- }
-
- /*:315*//*316:*/
- #line 7071 "./typica.w"
-
- DAQImplementation::DAQImplementation(const QString&driverinfo)
- :QThread(NULL),channelMap(4),handle(0),error(0),channels(0),ready(false),
- unitMap(4)
- {
- if(driverinfo=="nidaqmxbase")
- {
- useBase= true;
- }
- else
- {
- useBase= false;
- }
- if(useBase)
- {
- driver.setFileName("nidaqmxbase.framework/nidaqmxbase");
- if(!driver.load())
- {
- driver.setFileName("nidaqmxbase");
- if(!driver.load())
- {
- QMessageBox::critical(NULL,tr("Typica: Driver not found"),
- tr("Failed to find nidaqmxbase. Please install it."));
- QApplication::quit();
- }
- }
- }
- else
- {
- driver.setFileName("nicaiu");
- if(!driver.load())
- {
- QMessageBox::critical(NULL,tr("Typica: Driver not found"),
- tr("Failed to find nidaqmx. Please install it."));
- QApplication::quit();
- }
- }
- if(useBase)
- {
- if((createTask= (daqfp)driver.resolve("DAQmxBaseCreateTask"))==0||
- (startTask= (daqfp)driver.resolve("DAQmxBaseStartTask"))==0||
- (stopTask= (daqfp)driver.resolve("DAQmxBaseStopTask"))==0||
- (clearTask= (daqfp)driver.resolve("DAQmxBaseClearTask"))==0||
- (createChannel= (daqfp)driver.resolve("DAQmxBaseCreateAIThrmcplChan"))
- ==0||
- (setClock= (daqfp)driver.resolve("DAQmxBaseCfgSampClkTiming"))==
- 0||
- (read= (daqfp)driver.resolve("DAQmxBaseReadAnalogF64"))==0||
- (errorInfo= (daqfp)driver.resolve("DAQmxBaseGetExtendedErrorInfo"))==
- 0||
- (resetDevice= (daqfp)driver.resolve("DAQmxBaseResetDevice"))==0)
- {
- waitForMeasurement= NULL;
- QMessageBox::critical(NULL,tr("Typica: Link error"),
- tr("Failed to link a required symbol in NI-DAQmxBase."));
- QApplication::quit();
- }
- }
- else
- {
- if((createTask= (daqfp)driver.resolve("DAQmxCreateTask"))==0||
- (startTask= (daqfp)driver.resolve("DAQmxStartTask"))==0||
- (stopTask= (daqfp)driver.resolve("DAQmxStopTask"))==0||
- (clearTask= (daqfp)driver.resolve("DAQmxClearTask"))==0||
- (createChannel= (daqfp)driver.resolve("DAQmxCreateAIThrmcplChan"))
- ==0||
- (setClock= (daqfp)driver.resolve("DAQmxCfgSampClkTiming"))==0||
- (read= (daqfp)driver.resolve("DAQmxReadAnalogF64"))==0||
- (errorInfo= (daqfp)driver.resolve("DAQmxGetExtendedErrorInfo"))==
- 0||
- (resetDevice= (daqfp)driver.resolve("DAQmxResetDevice"))==0||
- (waitForMeasurement= (daqfp)driver.resolve("DAQmxWaitUntilTaskDone"))==0)
- {
- QMessageBox::critical(NULL,tr("Typica: Link error"),
- tr("Failed to link a required symbol in NI-DAQmx."));
- QApplication::quit();
- }
- }
- }
-
- DAQImplementation::~DAQImplementation()
- {
- driver.unload();
- }
-
- /*:316*/
- #line 540 "./typica.w"
-
- /*966:*/
- #line 197 "./dataqsdk.w"
-
- void DataqSdkDeviceImplementation::measure()
- {
- unsigned count= channels*40;
- di_status_read(buffer,count);
- QTime time= QTime::currentTime();
- for(unsigned int i= 0;i<count;i++)
- {
- buffer[i]= buffer[i]&0xFFFC;
- }
- QList<int> countList;
- for(unsigned int i= 0;i<(unsigned)channels;i++)
- {
- QList<double> channelBuffer;
- for(unsigned int j= 0;j<40;j++)
- {
- channelBuffer<<((double)buffer[i+(channels*j)]*10.0)/32768.0;
- if(i==0)
- {
- countList<<buffer[i+(channels*j)];
- }
- }
- double value= 0.0;
- for(unsigned int j= 0;j<40;j++)
- {
- value+= channelBuffer[j];
- }
- value/= 40.0;
- if(i==0)
- {
- QList<double> smoothingList;
- smoothingList<<value;
- QList<int> smoothingKeys= smoother.uniqueKeys();
- for(int j= 0;j<smoothingKeys.size();j++)
- {
- if(countList.contains(smoothingKeys[j]))
- {
- QList<double> keyValues= smoother.values(smoothingKeys[j]);
- for(int k= 0;k<keyValues.size();k++)
- {
- smoothingList<<keyValues[k];
- }
- }
- else
- {
- smoother.remove(smoothingKeys[j]);
- }
- }
- qSort(countList);
- int lastCount= 0;
- for(int j= 0;j<countList.size();j++)
- {
- if(j==0||countList[j]!=lastCount)
- {
- smoother.insert(countList[j],value);
- lastCount= countList[j];
- }
- }
- value= 0.0;
- for(int j= 0;j<smoothingList.size();j++)
- {
- value+= smoothingList[j];
- }
- value/= smoothingList.size();
- }
- Measurement measure(value,time,unitMap[i]);
- channelMap[i]->input(measure);
- }
- }
-
- /*:966*//*967:*/
- #line 290 "./dataqsdk.w"
-
- void DataqSdkDeviceImplementation::run()
- {
- if(!ready)
- {
- error= 9;
- return;
- }
- driver= new QLibrary(device);
- if(!driver->load())
- {
- error= 1;
- qDebug()<<"Failed to load driver: "<<device;
- return;
- }
- di_open= (FPDIOPEN)driver->resolve("di_open");
- di_close= (FPDICLOSE)driver->resolve("di_close");
- di_sample_rate= (FPDISAMPLERATE)driver->resolve("di_sample_rate");
- di_maximum_rate= (FPDIMAXIMUMRATE)driver->resolve("di_maximum_rate");
- di_list_length= (FPDILISTLENGTH)driver->resolve("di_list_length");
- di_inlist= (FPDIINLIST)driver->resolve("di_inlist");
- di_buffer_alloc= (FPDIBUFFERALLOC)driver->resolve("di_buffer_alloc");
- di_start_scan= (FPDISTARTSCAN)driver->resolve("di_start_scan");
- di_status_read= (FPDISTATUSREAD)driver->resolve("di_status_read");
- di_buffer_status= (FPDIBUFFERSTATUS)driver->resolve("di_buffer_status");
- di_burst_rate= (FPDIBURSTRATE)driver->resolve("di_burst_rate");
- di_stop_scan= (FPDISTOPSCAN)driver->resolve("di_stop_scan");
- if((!di_open)||(!di_close)||(!di_sample_rate)||(!di_maximum_rate)||
- (!di_list_length)||(!di_inlist)||(!di_buffer_alloc)||
- (!di_start_scan)||(!di_status_read)||(!di_buffer_status)||
- (!di_burst_rate)||(!di_stop_scan))
- {
- error= 2;
- return;
- }
- error= di_open(deviceNumber);
- if(error)
- {
- di_close();
- error= di_open(deviceNumber);
- if(error)
- {
- error= 3;
- di_close();
- return;
- }
- }
- isOpen= true;
- di_maximum_rate(240.0);
- sampleRate= di_sample_rate(sampleRate*channels*40,&oversample,
- &burstDivisor);
- buffer= new qint16[(int)sampleRate];
- di_inlist_struct inlist[16]= {{0,0,0,0,0,0,0,0}};
- for(unsigned short i= 0;i<channels;i++)
- {
- inlist[i].chan= i;
- inlist[i].gain= 0;
- inlist[i].ave= 1;
- inlist[i].counter= (oversample-1);
- }
- error= di_list_length(channels,0);
- if(error)
- {
- error= 4;
- return;
- }
- error= di_inlist(inlist);
- if(error)
- {
- error= 5;
- return;
- }
- input_buffer= di_buffer_alloc(0,4096);
- if(input_buffer==NULL)
- {
- error= 6;
- return;
- }
- error= di_start_scan();
- if(error)
- {
- error= 7;
- return;
- }
- while(ready)
- {
- measure();
- }
- }
-
- /*:967*//*968:*/
- #line 386 "./dataqsdk.w"
-
- void DataqSdkDevice::threadFinished()
- {
- if(imp->error)
- {
- /*969:*/
- #line 400 "./dataqsdk.w"
-
- imp->ready= false;
- QMessageBox warning;
- warning.setStandardButtons(QMessageBox::Cancel);
- warning.setIcon(QMessageBox::Warning);
- warning.setText(QString(tr("Error: %1")).arg(imp->error));
- warning.setInformativeText(tr("An error occurred"));
- warning.setWindowTitle(QString(PROGRAM_NAME));
- warning.exec();
-
- /*:969*/
- #line 391 "./dataqsdk.w"
-
- }
- }
-
- /*:968*//*970:*/
- #line 417 "./dataqsdk.w"
-
- void DataqSdkDevice::start()
- {
- connect(imp,SIGNAL(finished()),this,SLOT(threadFinished()));
- imp->start();
- }
-
- /*:970*//*971:*/
- #line 428 "./dataqsdk.w"
-
- QStringList DataqSdkDevice::detectHardware()
- {
- QSettings deviceLookup("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\services\\usbser\\Enum",
- QSettings::NativeFormat);
- QStringList keys= deviceLookup.childKeys();
- QStringList devices;
- for(int i= 0;i<keys.size();i++)
- {
- QString value= deviceLookup.value(keys.at(i)).toString();
- if(value.startsWith("USB\\VID_0683&PID_1450\\"))
- {
- devices.append(value.split("\\").at(2));
- }
- }
- QStringList portList;
- foreach(QString device,devices)
- {
- QString deviceKey= QString("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\USB\\VID_0683&PID_1450\\%1").arg(device);
- QSettings deviceEntry(deviceKey,QSettings::NativeFormat);
- portList.append(deviceEntry.value("FriendlyName").toString());
- }
- return portList;
- }
-
- QStringList DataqSdkDevice::detectPorts()
- {
- QStringList friendlyNames= detectHardware();
- QStringList portList;
- foreach(QString name,friendlyNames)
- {
- name.remove(0,name.indexOf("COM"));
- name.chop(1);
- portList.append(name);
- }
- return portList;
- }
-
- /*:971*//*972:*/
- #line 473 "./dataqsdk.w"
-
- DataqSdkDevice::DataqSdkDevice(QString device):imp(new DataqSdkDeviceImplementation)
- {
- bool usesAuto= false;
- int autoIndex= device.toInt(&usesAuto);
- QString finalizedPort;
- if(usesAuto)
- {
- QStringList portList= detectPorts();
- if(autoIndex> 0&&autoIndex<=portList.size())
- {
- finalizedPort= portList.at(autoIndex-1);
- }
- else
- {
- imp->error= 8;
- qDebug()<<"Failed to detect port.";
- }
- }
- else
- {
- finalizedPort= device;
- }
- int rstart= finalizedPort.indexOf("COM");
- finalizedPort.remove(0,rstart+3);
- bool chopFinished= false;
- int finalizedPortNumber= 0;
- while(finalizedPort.size()> 0&&!chopFinished)
- {
- finalizedPortNumber= finalizedPort.toInt(&chopFinished);
- if(!chopFinished)
- {
- finalizedPort.chop(1);
- }
- }
- if(finalizedPortNumber<10)
- {
- imp->device= QString("DI10%1NT.DLL").arg(finalizedPort);
- }
- else
- {
- imp->device= QString("DI1%1NT.DLL").arg(finalizedPort);
- }
- imp->deviceNumber= 0x12C02D00;
- imp->deviceNumber+= finalizedPortNumber;
- imp->ready= true;
- }
-
- /*:972*//*973:*/
- #line 523 "./dataqsdk.w"
-
- Channel*DataqSdkDevice::newChannel(Units::Unit scale)
- {
- Channel*retval= NULL;
- if(imp->ready)
- {
- retval= new Channel();
- imp->channelMap[imp->channels]= retval;
- imp->unitMap[imp->channels]= scale;
- imp->channels++;
- }
- return retval;
- }
-
- /*:973*//*974:*/
- #line 547 "./dataqsdk.w"
-
- void DataqSdkDevice::setClockRate(double Hz)
- {
- imp->sampleRate= Hz;
- }
-
- /*:974*//*975:*/
- #line 557 "./dataqsdk.w"
-
- DataqSdkDevice::~DataqSdkDevice()
- {
- if(imp->ready)
- {
- imp->ready= false;
- }
- imp->wait(ULONG_MAX);
- delete imp;
- }
-
- /*:975*//*976:*/
- #line 575 "./dataqsdk.w"
-
- DataqSdkDeviceImplementation::DataqSdkDeviceImplementation():QThread(NULL),
- channelMap(4),error(0),channels(0),ready(false),unitMap(4)
- {
-
- }
-
- DataqSdkDeviceImplementation::~DataqSdkDeviceImplementation()
- {
- if(isOpen)
- {
- di_stop_scan();
- di_close();
- }
- if(driver->isLoaded())
- {
- driver->unload();
- }
- }
-
- /*:976*/
- #line 541 "./typica.w"
-
- /*323:*/
- #line 7280 "./typica.w"
-
- void FakeDAQImplementation::measure()
- {
- msleep((int)(1000/clockRate));
- QTime time= QTime::currentTime();
- for(int i= 0;i<channels;i++)
- {
- Measurement measure(qrand()%500,time);
- channelMap[i]->input(measure);
- }
- }
-
- /*:323*//*324:*/
- #line 7294 "./typica.w"
-
- void FakeDAQImplementation::run()
- {
- setPriority(QThread::TimeCriticalPriority);
- while(ready)
- {
- measure();
- }
- }
-
- FakeDAQImplementation::FakeDAQImplementation():QThread(NULL),channelMap(4),
- channels(0),ready(false),clockRate(1)
- {
-
- }
-
- FakeDAQImplementation::~FakeDAQImplementation()
- {
-
- }
-
- /*:324*//*325:*/
- #line 7319 "./typica.w"
-
- void FakeDAQ::start()
- {
- if(imp->ready)
- {
- imp->start();
- }
- }
-
- FakeDAQ::FakeDAQ(QString):imp(new FakeDAQImplementation())
- {
- imp->ready= true;
- }
-
- Channel*FakeDAQ::newChannel(int,int)
- {
- Channel*retval;
- if(imp->ready)
- {
- retval= new Channel();
- imp->channelMap[imp->channels]= retval;
- imp->channels++;
- }
- else
- {
- return NULL;
- }
- return retval;
- }
-
- void FakeDAQ::setClockRate(double Hz)
- {
- if(imp->ready)
- {
- imp->clockRate= Hz;
- }
- }
-
- FakeDAQ::~FakeDAQ()
- {
- imp->ready= false;
- imp->wait(ULONG_MAX);
- delete imp;
- }
-
- /*:325*/
- #line 542 "./typica.w"
-
- /*330:*/
- #line 7450 "./typica.w"
-
- Channel::Channel():QObject(NULL)
- {
-
- }
-
- Channel::~Channel()
- {
-
- }
-
- void Channel::input(Measurement measurement)
- {
- emit newData(measurement);
- }
-
- /*:330*/
- #line 543 "./typica.w"
-
- /*346:*/
- #line 7855 "./typica.w"
-
- void TemperatureDisplay::setRelativeMode(bool relative)
- {
- r= relative;
- }
-
- /*:346*//*347:*/
- #line 7872 "./typica.w"
-
- void TemperatureDisplay::setValue(Measurement temperature)
- {
- QString number;
- switch(unit)
- {
- case Units::Fahrenheit:
- display(QString("%1'F").
- arg(number.setNum(temperature.toFahrenheit().temperature(),'f',
- 2)));
- break;
- case Units::Celsius:
- if(!r){
- display(QString("%1'C").
- arg(number.setNum(temperature.toCelsius().temperature(),'f',
- 2)));
- }else{
- number.setNum(temperature.temperature()*(5.0/9.0),'f',2);
- display(QString("%1'C").arg(number));
- }
- break;
- case Units::Kelvin:
- if(!r){
- display(QString("%1").
- arg(number.setNum(temperature.toKelvin().temperature(),'f',
- 2)));
- }else{
- number.setNum(temperature.temperature()*(5.0/9.0),'f',2);
- display(QString("%1").arg(number));
- }
- break;
- case Units::Rankine:
- display(QString("%1'r").
- arg(number.setNum(temperature.toRankine().temperature(),'f',
- 2)));
- break;
- case Units::Unitless:
- display(QString("%1").arg(number.setNum(temperature.temperature(),'f',0)));
- break;
- default:
- switch(temperature.scale())
- {
- case Units::Fahrenheit:
- display(QString("%1'F").
- arg(number.setNum(temperature.temperature(),'f',2)));
- break;
- case Units::Celsius:
- display(QString("%1'C").
- arg(number.setNum(temperature.temperature(),'f',2)));
- break;
- case Units::Kelvin:
- display(QString("%1").
- arg(number.setNum(temperature.temperature(),'f',2)));
- break;
- case Units::Rankine:
- display(QString("%1'r").
- arg(number.setNum(temperature.temperature(),'f',2)));
- break;
- case Units::Unitless:
- display(QString("%1").arg(number.setNum(temperature.temperature(),'f',0)));
- break;
- default:
- qDebug()<<"Warning: Attempting to convert a non-temperature unit to a temperature unit";
- break;
- }
- break;
- }
- }
-
- /*:347*//*348:*/
- #line 7951 "./typica.w"
-
- TemperatureDisplay::TemperatureDisplay(QWidget*parent):
- QLCDNumber(8,parent),unit(Units::Fahrenheit),r(false)
- {
- setSegmentStyle(Filled);
- display("---.--'F");
- }
-
- /*:348*//*349:*/
- #line 7967 "./typica.w"
-
- void TemperatureDisplay::invalidate()
- {
- display("---.--'F");
- }
-
- /*:349*//*350:*/
- #line 7979 "./typica.w"
-
- void TemperatureDisplay::setDisplayUnits(Units::Unit scale)
- {
- unit= scale;
- }
-
- /*:350*//*351:*/
- #line 7987 "./typica.w"
-
- TemperatureDisplay::~TemperatureDisplay()
- {
-
- }
-
- /*:351*/
- #line 544 "./typica.w"
-
- /*357:*/
- #line 8087 "./typica.w"
-
- void MeasurementTimeOffset::newMeasurement(Measurement measure)
- {
- if(measure.time()<epoch)
- {
- if(hasPrevious)
- {
- QTime jitBase(epoch.hour()-1,epoch.minute(),epoch.second(),
- epoch.msec());
- QTime jitComp(epoch.hour(),measure.time().minute(),
- measure.time().second(),measure.time().msec());
- int relTime= jitBase.msecsTo(jitComp);
- /*358:*/
- #line 8121 "./typica.w"
-
- QTime newTime(0,0,0,0);
- newTime= newTime.addMSecs(relTime);
- if(newTime.hour()> 0)
- {
- newTime.setHMS(0,newTime.minute(),newTime.second(),newTime.msec());
- }
- Measurement rel= measure;
- rel.setTime(newTime);
- emit measurement(rel);
-
- /*:358*/
- #line 8099 "./typica.w"
-
- }
- else
- {
- Measurement rel= measure;
- rel.setTime(QTime(0,0,0,0));
- emit measurement(rel);
- }
- }
- else
- {
- int relTime= epoch.msecsTo(measure.time());
- /*358:*/
- #line 8121 "./typica.w"
-
- QTime newTime(0,0,0,0);
- newTime= newTime.addMSecs(relTime);
- if(newTime.hour()> 0)
- {
- newTime.setHMS(0,newTime.minute(),newTime.second(),newTime.msec());
- }
- Measurement rel= measure;
- rel.setTime(newTime);
- emit measurement(rel);
-
- /*:358*/
- #line 8111 "./typica.w"
-
- }
- hasPrevious= true;
- previous= measure.time();
- }
-
- /*:357*//*359:*/
- #line 8134 "./typica.w"
-
- MeasurementTimeOffset::MeasurementTimeOffset(QTime zero):epoch(zero),
- previous(0,0,0,0),hasPrevious(false)
- {
-
- }
-
- QTime MeasurementTimeOffset::zeroTime()
- {
- return epoch;
- }
-
- void MeasurementTimeOffset::setZeroTime(QTime zero)
- {
- epoch= zero;
- hasPrevious= false;
- }
-
- /*:359*/
- #line 545 "./typica.w"
-
- /*369:*/
- #line 8332 "./typica.w"
-
- ZeroEmitter::ZeroEmitter(int tempcolumn):QObject(NULL),col(tempcolumn)
- {
-
- }
-
- int ZeroEmitter::column()
- {
- return col;
- }
-
- double ZeroEmitter::lastTemperature()
- {
- return cache.temperature();
- }
-
- void ZeroEmitter::newMeasurement(Measurement measure)
- {
- cache= measure;
- }
-
- void ZeroEmitter::setColumn(int column)
- {
- col= column;
- }
-
- void ZeroEmitter::emitZero()
- {
- cache.setTime(QTime(0,0,0,0));
- emit measurement(cache,col);
- }
-
- /*:369*/
- #line 546 "./typica.w"
-
- /*374:*/
- #line 8422 "./typica.w"
-
- MeasurementAdapter::MeasurementAdapter(int tempcolumn):col(tempcolumn)
- {
-
- }
-
- int MeasurementAdapter::column()
- {
- return col;
- }
-
- void MeasurementAdapter::newMeasurement(Measurement measure)
- {
- emit measurement(measure,col);
- }
-
- void MeasurementAdapter::setColumn(int column)
- {
- col= column;
- }
-
- /*:374*/
- #line 547 "./typica.w"
-
- /*379:*/
- #line 8544 "./typica.w"
-
- GraphView::GraphView(QWidget*parent):QGraphicsView(parent),
- theScene(new QGraphicsScene),
- graphLines(new QMap<int,QList<QGraphicsLineItem*> *> ),
- prevPoints(new QMap<int,QPointF> ),
- translations(new QMap<int,double> ),
- gridLinesF(new QList<QGraphicsItem*> ),
- gridLinesC(new QList<QGraphicsItem*> ),
- relativeGridLines(new QList<QGraphicsItem*> ),
- relativeEnabled(false),
- timeIndicatorEnabled(false),
- timeLine(new QGraphicsLineItem),
- relativeAdjuster(new LinearSplineInterpolator)
- {
- setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- setScene(theScene);
- setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
- QPen timePen;
- timePen.setColor(QColor(160,160,164,127));
- timeLine->setPen(timePen);
- timeLine->setLine(0,0,0,-500);
- timeLine->hide();
- theScene->addItem(timeLine);
- /*380:*/
- #line 8584 "./typica.w"
-
- QGraphicsLineItem*tempaxis= new QGraphicsLineItem;
- tempaxis->setLine(-10,-500,-10,0);
- theScene->addItem(tempaxis);
- QGraphicsLineItem*gridLine;
- QGraphicsTextItem*label;
- for(int y= -100;y> -600;y-= 100)
- {
- gridLine= new QGraphicsLineItem;
- gridLine->setLine(0,y,1200,y);
- theScene->addItem(gridLine);
- label= new QGraphicsTextItem;
- label->setHtml(QString("%1°F").arg(-y));
- label->setPos(-55,y-(label->boundingRect().height()/2));
- theScene->addItem(label);
- gridLinesF->append(gridLine);
- gridLinesF->append(label);
- }
- for(int degC= 50;degC<=250;degC+= 50)
- {
- gridLine= new QGraphicsLineItem;
- int y= -(degC*(9.0/5.0)+32);
- gridLine->setLine(0,y,1200,y);
- gridLine->hide();
- theScene->addItem(gridLine);
- gridLinesC->append(gridLine);
- label= new QGraphicsTextItem;
- label->setHtml(QString("%1°C").arg(degC));
- label->setPos(-55,y-(label->boundingRect().height()/2));
- label->hide();
- theScene->addItem(label);
- gridLinesC->append(label);
- }
-
- /*:380*/
- #line 8568 "./typica.w"
- ;
- /*381:*/
- #line 8625 "./typica.w"
-
- QSettings settings;
- if(settings.contains("settings/graph/relative/enable"))
- {
- if(settings.value("settings/graph/relative/enable").toBool())
- {
- relativeEnabled= true;
- QColor relativeColor= QColor(settings.value("settings/graph/relative/color").toString());
- QString unit= QString(settings.value("settings/graph/relative/unit").toInt()==0?"F":"C");
- QMap<double,QString> relativeAxisPairs;
- QStringList relativeAxisLabels= settings.value("settings/graph/relative/grid").toString().split(QRegExp("[\\s,]+"),QString::SkipEmptyParts);
- foreach(QString item,relativeAxisLabels)
- {
- relativeAxisPairs.insert(item.toDouble(),item);
- }
- if(relativeAxisPairs.size()> 1)
- {
- double skip= 500.0/(relativeAxisPairs.size()-1);
- double y= 0;
- foreach(double key,relativeAxisPairs.keys())
- {
- gridLine= new QGraphicsLineItem;
- gridLine->setLine(0,y,1205,y);
- gridLine->setPen(QPen(relativeColor));
- theScene->addItem(gridLine);
- relativeGridLines->append(gridLine);
- label= new QGraphicsTextItem;
- label->setHtml(QString("%1°%2").arg(relativeAxisPairs.value(key)).arg(unit));
- label->setPos(1210,y-(label->boundingRect().height()/2));
- theScene->addItem(label);
- relativeGridLines->append(label);
- if(unit=="F")
- {
- relativeAdjuster->add_pair(key,-y);
- }
- else
- {
- relativeAdjuster->add_pair(key*(9.0/5.0),-y);
- }
- y-= skip;
- }
- }
- }
- }
-
- /*:381*/
- #line 8569 "./typica.w"
-
- /*383:*/
- #line 8702 "./typica.w"
-
- QGraphicsLineItem*timeaxis= new QGraphicsLineItem;
- timeaxis->setLine(0,10,1200,10);
- theScene->addItem(timeaxis);
- for(int x= 0;x<1201;x+= 120)
- {
- QGraphicsLineItem*tick= new QGraphicsLineItem;
- tick->setLine(x,0,x,20);
- theScene->addItem(tick);
- QGraphicsTextItem*label= new QGraphicsTextItem;
- label->setPlainText(QString("%1").arg(x/60));
- label->setPos(x-(label->boundingRect().width()/2),20);
- theScene->addItem(label);
- }
-
- /*:383*/
- #line 8570 "./typica.w"
- ;
- fitInView(theScene->sceneRect().adjusted(-50,-50,50,50));
- }
-
- /*:379*//*382:*/
- #line 8672 "./typica.w"
-
- void GraphView::showF()
- {
- for(int i= 0;i<gridLinesF->size();i++)
- {
- gridLinesF->at(i)->show();
- }
- for(int i= 0;i<gridLinesC->size();i++)
- {
- gridLinesC->at(i)->hide();
- }
- }
-
- void GraphView::showC()
- {
- for(int i= 0;i<gridLinesF->size();i++)
- {
- gridLinesF->at(i)->hide();
- }
- for(int i= 0;i<gridLinesC->size();i++)
- {
- gridLinesC->at(i)->show();
- }
- }
-
- /*:382*//*384:*/
- #line 8721 "./typica.w"
-
- void GraphView::resizeEvent(QResizeEvent*)
- {
- fitInView(theScene->sceneRect().adjusted(-50,-50,50,50));
- }
-
- /*:384*//*385:*/
- #line 8735 "./typica.w"
-
- #define FULLTIMETOINT(t) (t.msec() + (t.second() * 1000) + (t.minute() * 60 * 1000))
-
- void GraphView::newMeasurement(Measurement measure,int tempcolumn)
- {
- double offset= 0;
- if(measure.contains("relative"))
- {
- if(measure.value("relative").toBool())
- {
- if(relativeEnabled)
- {
- measure.setTemperature(relativeAdjuster->newMeasurement(measure).temperature());
- }
- else
- {
- return;
- }
- }
- }
- if(translations->contains(tempcolumn))
- {
- offset= translations->value(tempcolumn);
- }
- if(prevPoints->contains(tempcolumn))
- {
- /*387:*/
- #line 8812 "./typica.w"
-
- QGraphicsLineItem*segment= new QGraphicsLineItem;
- QPointF nextPoint(FULLTIMETOINT(measure.time())/1000,measure.temperature());
- segment->setLine(prevPoints->value(tempcolumn).x()+offset,
- -(prevPoints->value(tempcolumn).y()),
- nextPoint.x()+offset,-(nextPoint.y()));
- static QColor p[12]= {Qt::yellow,Qt::blue,Qt::cyan,Qt::red,Qt::magenta,
- Qt::green,Qt::darkGreen,Qt::darkMagenta,
- Qt::darkRed,Qt::darkCyan,Qt::darkBlue,
- Qt::darkYellow};
- segment->setPen(p[tempcolumn%12]);
- theScene->addItem(segment);
- prevPoints->insert(tempcolumn,nextPoint);
- if(timeIndicatorEnabled)
- {
- timeLine->setLine(nextPoint.x()+offset,0,nextPoint.x()+offset,-500);
- }
-
- /*:387*/
- #line 8761 "./typica.w"
-
- if(graphLines->contains(tempcolumn))
- {
-
- graphLines->value(tempcolumn)->append(segment);
- }
- else
- {
-
- QList<QGraphicsLineItem*> *newLine=
- new QList<QGraphicsLineItem*> ;
- newLine->append(segment);
- graphLines->insert(tempcolumn,newLine);
- }
- }
- else
- {
- /*386:*/
- #line 8797 "./typica.w"
-
- int x= FULLTIMETOINT(measure.time())/1000;
- prevPoints->insert(tempcolumn,QPointF(x,measure.temperature()));
- if(timeIndicatorEnabled)
- {
- timeLine->setLine(x,0,x,-500);
- }
-
- /*:386*/
- #line 8778 "./typica.w"
-
- }
- }
-
- /*:385*//*388:*/
- #line 8833 "./typica.w"
-
- void GraphView::clear()
- {
- int i;
- foreach(i,prevPoints->keys())
- {
- removeSeries(i);
- }
- translations->clear();
- }
-
- /*:388*//*389:*/
- #line 8847 "./typica.w"
-
- void GraphView::removeSeries(int column)
- {
- if(graphLines->contains(column))
- {
- QList<QGraphicsLineItem*> *series= graphLines->value(column);
- QGraphicsLineItem*segment;
- foreach(segment,*series)
- {
- theScene->removeItem(segment);
- }
- qDeleteAll(*series);
- }
- graphLines->remove(column);
- prevPoints->remove(column);
- }
-
- /*:389*//*390:*/
- #line 8866 "./typica.w"
-
- void GraphView::setSeriesTranslation(int column,double offset)
- {
- if(graphLines->contains(column))
- {
- QList<QGraphicsLineItem*> *series= graphLines->value(column);
- QGraphicsLineItem*segment;
- foreach(segment,*series)
- {
- segment->setPos(segment->pos().x()+offset,segment->pos().y());
- }
- }
- if(translations->contains(column))
- {
- translations->insert(column,offset+translations->value(column));
- }
- else
- {
- translations->insert(column,offset);
- }
- }
-
- /*:390*//*391:*/
- #line 8893 "./typica.w"
-
- void GraphView::setTimeIndicatorEnabled(bool enabled)
- {
- timeIndicatorEnabled= enabled;
- if(enabled)
- {
- timeLine->show();
- }
- else
- {
- timeLine->hide();
- }
- }
-
- /*:391*/
- #line 548 "./typica.w"
-
- /*397:*/
- #line 9037 "./typica.w"
-
- void ZoomLog::newMeasurement(Measurement measure,int tempcolumn)
- {
- if(measure.time()!=QTime(0,0,0,0))
- {
- /*399:*/
- #line 9111 "./typica.w"
-
- if(lastMeasurement.contains(tempcolumn))
- {
- if(lastMeasurement[tempcolumn].time()<measure.time())
- {
- QList<QTime> timelist;
- for(QTime i= lastMeasurement.value(tempcolumn).time().addSecs(1);i<measure.time();i= i.addSecs(1))
- {
- timelist.append(i);
- }
- for(int i= 0;i<timelist.size();i++)
- {
- Measurement synthesized= measure;
- synthesized.setTime(timelist[i]);
- newMeasurement(synthesized,tempcolumn);
- }
- }
- }
-
- /*:399*/
- #line 9042 "./typica.w"
-
- }
- model_ms->newMeasurement(measure,tempcolumn);
- if(lastMeasurement.contains(tempcolumn))
- {
- if(measure.time().second()!=
- lastMeasurement.value(tempcolumn).time().second())
- {
- Measurement adjusted= measure;
- QTime adjtime(0,measure.time().minute(),measure.time().second(),0);
- adjusted.setTime(adjtime);
- model_1s->newMeasurement(adjusted,tempcolumn);
- if(adjusted.time().second()%5==0)
- {
- model_5s->newMeasurement(adjusted,tempcolumn);
- if(adjusted.time().second()%10==0)
- {
- model_10s->newMeasurement(adjusted,tempcolumn);
- }
- if(adjusted.time().second()%15==0)
- {
- model_15s->newMeasurement(adjusted,tempcolumn);
- if(adjusted.time().second()%30==0)
- {
- model_30s->newMeasurement(adjusted,tempcolumn);
- if(adjusted.time().second()==0)
- {
- model_1m->newMeasurement(adjusted,tempcolumn);
- }
- }
- }
- }
- }
- /*401:*/
- #line 9155 "./typica.w"
-
- if(currentColumnSet.contains(tempcolumn))
- {
- int replicationcolumn;
- foreach(replicationcolumn,currentColumnSet)
- {
- if(replicationcolumn!=tempcolumn)
- {
- if(lastMeasurement.contains(replicationcolumn))
- {
- if(measure.time()> lastMeasurement.value(replicationcolumn).time())
- {
- Measurement synthetic= lastMeasurement.value(replicationcolumn);
- synthetic.setTime(measure.time());
- model_ms->newMeasurement(synthetic,replicationcolumn);
- if(synthetic.time().second()!=lastMeasurement.value(replicationcolumn).time().second())
- {
- Measurement adjusted= synthetic;
- adjusted.setTime(QTime(0,synthetic.time().minute(),synthetic.time().second(),0));
- model_1s->newMeasurement(adjusted,replicationcolumn);
- if(adjusted.time().second()%5==0)
- {
- model_5s->newMeasurement(adjusted,replicationcolumn);
- if(adjusted.time().second()%10==0)
- {
- model_10s->newMeasurement(adjusted,replicationcolumn);
- }
- if(adjusted.time().second()%15==0)
- {
- model_15s->newMeasurement(adjusted,replicationcolumn);
- if(adjusted.time().second()%30==0)
- {
- model_30s->newMeasurement(adjusted,replicationcolumn);
- if(adjusted.time().second()==0)
- {
- model_1m->newMeasurement(adjusted,replicationcolumn);
- }
- }
- }
- }
- }
- lastMeasurement[replicationcolumn]= synthetic;
- }
- }
- }
- }
- }
-
- /*:401*/
- #line 9075 "./typica.w"
-
- }
- else
- {
- /*398:*/
- #line 9087 "./typica.w"
-
- MeasurementModel*m;
- foreach(m,modelSet)
- {
- m->newMeasurement(measure,tempcolumn);
- }
-
- /*:398*/
- #line 9079 "./typica.w"
-
- }
- lastMeasurement.insert(tempcolumn,measure);
- }
-
- /*:397*//*400:*/
- #line 9141 "./typica.w"
-
- void ZoomLog::addToCurrentColumnSet(int column)
- {
- currentColumnSet.append(column);
- }
-
- void ZoomLog::clearCurrentColumnSet()
- {
- currentColumnSet.clear();
- }
-
- /*:400*//*402:*/
- #line 9225 "./typica.w"
-
- void ZoomLog::newAnnotation(QString annotation,int tempcolumn,
- int annotationcolumn)
- {
- model_ms->newAnnotation(annotation,tempcolumn,annotationcolumn);
- MeasurementModel*m;
- if(lastMeasurement.contains(tempcolumn))
- {
- foreach(m,modelSet)
- {
- m->newMeasurement(lastMeasurement.value(tempcolumn),tempcolumn);
- }
- }
- foreach(m,modelSet)
- {
- m->newAnnotation(annotation,tempcolumn,annotationcolumn);
- }
- }
-
- /*:402*//*403:*/
- #line 9249 "./typica.w"
-
- void ZoomLog::centerOn(int row)
- {
- scrollTo(currentModel->index(row,0),QAbstractItemView::PositionAtCenter);
- }
-
- /*:403*//*404:*/
- #line 9259 "./typica.w"
-
- void ZoomLog::clear()
- {
- MeasurementModel*m;
- foreach(m,modelSet)
- {
- m->clear();
- }
- lastMeasurement.clear();
- saveTempCols.clear();
- saveControlCols.clear();
- saveNoteCols.clear();
- }
-
- /*:404*//*405:*/
- #line 9277 "./typica.w"
-
- QVariant ZoomLog::data(int row,int column)const
- {
- return model_ms->data(model_ms->index(row,column,QModelIndex()),
- Qt::DisplayRole);
- }
-
- int ZoomLog::rowCount()
- {
- return model_ms->rowCount();
- }
-
- /*:405*//*406:*/
- #line 9300 "./typica.w"
-
- bool ZoomLog::saveXML(QIODevice*device)
- {
- Units::Unit prevUnits= model_ms->displayUnits();
- if(prevUnits!=Units::Fahrenheit)
- {
- model_ms->setDisplayUnits(Units::Fahrenheit);
- }
- XMLOutput writer(model_ms,device,0);
- int c;
- foreach(c,saveTempCols)
- {
- writer.addTemperatureColumn(model_ms->headerData(c,Qt::Horizontal).
- toString(),c);
- }
- foreach(c,saveControlCols)
- {
- writer.addControlColumn(model_ms->headerData(c,Qt::Horizontal).
- toString(),c);
- }
- foreach(c,saveNoteCols)
- {
- writer.addAnnotationColumn(model_ms->headerData(c,Qt::Horizontal).
- toString(),c);
- }
- bool retval= writer.output();
- if(prevUnits!=Units::Fahrenheit)
- {
- model_ms->setDisplayUnits(prevUnits);
- }
- return retval;
- }
-
- /*:406*//*407:*/
- #line 9336 "./typica.w"
-
- bool ZoomLog::saveCSV(QIODevice*device)
- {
- CSVOutput writer(currentModel,device,0);
- int c;
- foreach(c,saveTempCols)
- {
- writer.addTemperatureColumn(model_ms->headerData(c,Qt::Horizontal).
- toString(),c);
- }
- foreach(c,saveControlCols)
- {
- writer.addControlColumn(model_ms->headerData(c,Qt::Horizontal).
- toString(),c);
- }
- foreach(c,saveNoteCols)
- {
- writer.addAnnotationColumn(model_ms->headerData(c,Qt::Horizontal).
- toString(),c);
- }
- return writer.output();
- }
-
- /*:407*//*408:*/
- #line 9365 "./typica.w"
-
- void ZoomLog::switchLOD(MeasurementModel*m)
- {
- disconnect(currentModel,SIGNAL(rowChanged(int)),this,0);
- setModel(m);
- currentModel= m;
- connect(currentModel,SIGNAL(rowChanged(int)),this,SLOT(centerOn(int)));
- }
-
- void ZoomLog::LOD_ms()
- {
- switchLOD(model_ms);
- }
-
- void ZoomLog::LOD_1s()
- {
- switchLOD(model_1s);
- }
-
- void ZoomLog::LOD_5s()
- {
- switchLOD(model_5s);
- }
-
- void ZoomLog::LOD_10s()
- {
- switchLOD(model_10s);
- }
-
- void ZoomLog::LOD_15s()
- {
- switchLOD(model_15s);
- }
-
- void ZoomLog::LOD_30s()
- {
- switchLOD(model_30s);
- }
-
- void ZoomLog::LOD_1m()
- {
- switchLOD(model_1m);
- }
-
- /*:408*//*409:*/
- #line 9413 "./typica.w"
-
- void ZoomLog::setDisplayUnits(Units::Unit scale)
- {
- model_ms->setDisplayUnits(scale);
- model_1s->setDisplayUnits(scale);
- model_5s->setDisplayUnits(scale);
- model_10s->setDisplayUnits(scale);
- model_15s->setDisplayUnits(scale);
- model_30s->setDisplayUnits(scale);
- model_1m->setDisplayUnits(scale);
- }
-
- Units::Unit ZoomLog::displayUnits()
- {
- return model_ms->displayUnits();
- }
-
- /*:409*//*410:*/
- #line 9433 "./typica.w"
-
- QString ZoomLog::lastTime(int series)
- {
- Measurement measure= lastMeasurement.value(series);
- QTime time= measure.time();
- return time.toString("h:mm:ss.zzz");
- }
-
- /*:410*//*411:*/
- #line 9443 "./typica.w"
-
- ZoomLog::ZoomLog():QTableView(NULL),model_ms(new MeasurementModel(this)),
- model_1s(new MeasurementModel(this)),model_5s(new MeasurementModel(this)),
- model_10s(new MeasurementModel(this)),model_15s(new MeasurementModel(this)),
- model_30s(new MeasurementModel(this)),model_1m(new MeasurementModel(this))
- {
- setEditTriggers(QAbstractItemView::NoEditTriggers);
- setSelectionMode(QAbstractItemView::NoSelection);
- modelSet<<model_ms<<model_1s<<model_5s<<model_10s<<model_15s<<
- model_30s<<model_1m;
- currentModel= model_30s;
- setModel(currentModel);
- connect(currentModel,SIGNAL(rowChanged(int)),this,SLOT(centerOn(int)));
- connect(horizontalHeader(),SIGNAL(sectionResized(int,int,int)),
- this,SLOT(persistColumnResize(int,int,int)));
- connect(horizontalHeader(),SIGNAL(sectionCountChanged(int,int)),
- this,SLOT(restoreColumnWidths()));
- }
-
- /*:411*//*412:*/
- #line 9466 "./typica.w"
-
- void ZoomLog::setHeaderData(int section,QString text)
- {
- MeasurementModel*m;
- foreach(m,modelSet)
- {
- m->setHeaderData(section,Qt::Horizontal,QVariant(text));
- }
- }
-
- /*:412*//*413:*/
- #line 9484 "./typica.w"
-
- void ZoomLog::addOutputTemperatureColumn(int column)
- {
- saveTempCols.append(column);
- }
-
- void ZoomLog::addOutputControlColumn(int column)
- {
- saveControlCols.append(column);
- }
-
- void ZoomLog::addOutputAnnotationColumn(int column)
- {
- saveNoteCols.append(column);
- }
-
- void ZoomLog::clearOutputColumns()
- {
- saveTempCols.clear();
- saveControlCols.clear();
- saveNoteCols.clear();
- }
-
- /*:413*//*414:*/
- #line 9510 "./typica.w"
-
- void ZoomLog::persistColumnResize(int column,int,int newsize)
- {
- /*629:*/
- #line 13656 "./typica.w"
-
- QSettings settings;
- /*630:*/
- #line 13669 "./typica.w"
-
- QWidget*topLevelWidget= this;
- while(topLevelWidget->parentWidget())
- {
- topLevelWidget= topLevelWidget->parentWidget();
- }
-
- /*:630*/
- #line 13658 "./typica.w"
-
- settings.setValue(QString("columnWidths/%1/%2/%3").
- arg(topLevelWidget->objectName()).
- arg(objectName()).arg(column),
- QVariant(newsize));
-
- /*:629*/
- #line 9513 "./typica.w"
-
- }
-
- void ZoomLog::restoreColumnWidths()
- {
- /*632:*/
- #line 13689 "./typica.w"
-
- QSettings settings;
- /*630:*/
- #line 13669 "./typica.w"
-
- QWidget*topLevelWidget= this;
- while(topLevelWidget->parentWidget())
- {
- topLevelWidget= topLevelWidget->parentWidget();
- }
-
- /*:630*/
- #line 13691 "./typica.w"
-
- QString baseKey=
- QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
- arg(objectName());
- for(int i= 0;i<model()->columnCount();i++)
- {
- QString key= QString("%1/%2").arg(baseKey).arg(i);
- if(settings.contains(key))
- {
- setColumnWidth(i,settings.value(key).toInt());
- }
- }
-
- /*:632*/
- #line 9518 "./typica.w"
-
- }
-
- void ZoomLog::setVisible(bool visibility)
- {
- QTableView::setVisible(visibility);
- }
-
- void ZoomLog::showEvent(QShowEvent*)
- {
- /*632:*/
- #line 13689 "./typica.w"
-
- QSettings settings;
- /*630:*/
- #line 13669 "./typica.w"
-
- QWidget*topLevelWidget= this;
- while(topLevelWidget->parentWidget())
- {
- topLevelWidget= topLevelWidget->parentWidget();
- }
-
- /*:630*/
- #line 13691 "./typica.w"
-
- QString baseKey=
- QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
- arg(objectName());
- for(int i= 0;i<model()->columnCount();i++)
- {
- QString key= QString("%1/%2").arg(baseKey).arg(i);
- if(settings.contains(key))
- {
- setColumnWidth(i,settings.value(key).toInt());
- }
- }
-
- /*:632*/
- #line 9528 "./typica.w"
-
- }
-
- /*:414*/
- #line 549 "./typica.w"
-
- /*423:*/
- #line 9761 "./typica.w"
-
- bool MeasurementList::operator<(const MeasurementList&other)const
- {
- return this->first().toTime()<other.first().toTime();
- }
-
- bool MeasurementList::operator==(const MeasurementList&other)const
- {
- return this->first().toTime()==other.first().toTime();
- }
-
- /*:423*//*424:*/
- #line 9777 "./typica.w"
-
- QModelIndex MeasurementModel::parent(const QModelIndex&)const
- {
- return QModelIndex();
- }
-
- /*:424*//*425:*/
- #line 9787 "./typica.w"
-
- void MeasurementModel::newMeasurement(Measurement measure,int tempcolumn)
- {
- if(measure.scale()==Units::Unitless)
- {
- controlColumns->insert(tempcolumn,true);
- }
- else
- {
- controlColumns->insert(tempcolumn,false);
- }
- MeasurementList*temp;
- temp= new MeasurementList;
- temp->append(QVariant(measure.time()));
- /*426:*/
- #line 9846 "./typica.w"
-
- /*427:*/
- #line 9891 "./typica.w"
-
- QList<MeasurementList*> ::iterator i= lastInsertion;
- bool quickscan= false;
- if(entries->size()> 5)
- {
- if(**i<*temp)
- {
- i+= 1;
- for(int j= 10;j> 0;j--)
- {
- if(i!=entries->end())
- {
- if(**i<*temp)
- {
- i+= 1;
- }
- else
- {
- quickscan= true;
- break;
- }
- }
- else
- {
- quickscan= true;
- break;
- }
- }
- }
- else
- {
- if(**i==*temp)
- {
- quickscan= true;
- }
- }
- }
-
- /*:427*/
- #line 9847 "./typica.w"
-
- if(quickscan==false)
- {
- i= entries->begin();
- QList<MeasurementList*> ::iterator u= entries->end();
- QList<MeasurementList*> ::iterator midpoint;
- int n= u-i;
- int rA;
- while(n> 0)
- {
- rA= n>>1;
- midpoint= i+rA;
- if(**midpoint<*temp)
- {
- i= midpoint+1;
- n-= rA+1;
- }
- else
- {
- n= rA;
- }
- }
- }
-
- /*:426*/
- #line 9801 "./typica.w"
-
- MeasurementList*newEntry;
- int insertion;
- if(i!=entries->end())
- {
- insertion= entries->indexOf(*i);
- if((*i)->first().toTime()==measure.time())
- {
- /*428:*/
- #line 9933 "./typica.w"
-
- if((*i)->size()<tempcolumn+1)
- {
- for(int j= (*i)->size()-1;j<tempcolumn+1;j++)
- {
- (*i)->append(QVariant());
- }
- }
- (*i)->replace(tempcolumn,measure);
- lastInsertion= i;
- emit dataChanged(createIndex(insertion,tempcolumn),
- createIndex(insertion,tempcolumn));
- lastTemperature->insert(tempcolumn,insertion);
-
- /*:428*/
- #line 9809 "./typica.w"
-
- }
- else
- {
- /*429:*/
- #line 9951 "./typica.w"
-
- beginInsertRows(QModelIndex(),insertion,insertion);
- newEntry= new MeasurementList;
- newEntry->append(QVariant(measure.time()));
- for(int j= 0;j<tempcolumn+1;j++)
- {
- newEntry->append(QVariant());
- }
- newEntry->replace(tempcolumn,measure);
- lastInsertion= entries->insert(i,newEntry);
- endInsertRows();
- lastTemperature->insert(tempcolumn,insertion);
-
- /*:429*/
- #line 9813 "./typica.w"
-
- }
- }
- else
- {
- /*430:*/
- #line 9969 "./typica.w"
-
- insertion= entries->size();
- /*429:*/
- #line 9951 "./typica.w"
-
- beginInsertRows(QModelIndex(),insertion,insertion);
- newEntry= new MeasurementList;
- newEntry->append(QVariant(measure.time()));
- for(int j= 0;j<tempcolumn+1;j++)
- {
- newEntry->append(QVariant());
- }
- newEntry->replace(tempcolumn,measure);
- lastInsertion= entries->insert(i,newEntry);
- endInsertRows();
- lastTemperature->insert(tempcolumn,insertion);
-
- /*:429*/
- #line 9971 "./typica.w"
-
-
- /*:430*/
- #line 9818 "./typica.w"
-
- }
- if(tempcolumn>=colcount)
- {
- colcount= tempcolumn+1;
- }
- emit rowChanged(insertion);
- delete temp;
- }
-
- /*:425*//*431:*/
- #line 9981 "./typica.w"
-
- void MeasurementModel::newAnnotation(QString annotation,int tempcolumn,
- int annotationColumn)
- {
- int r;
- if(lastTemperature->contains(tempcolumn))
- {
- r= lastTemperature->value(tempcolumn);
- }
- else
- {
- r= 0;
- }
- if(r==0&&entries->size()==0)
- {
- /*432:*/
- #line 10019 "./typica.w"
-
- beginInsertRows(QModelIndex(),0,0);
- MeasurementList*newEntry= new MeasurementList;
- newEntry->append(QVariant(QTime(0,0,0,0)));
- entries->append(newEntry);
- endInsertRows();
-
- /*:432*/
- #line 9996 "./typica.w"
-
- }
- MeasurementList*row= entries->at(r);
- if(row->size()<=annotationColumn)
- {
- for(int i= row->size()-1;i<annotationColumn+1;i++)
- {
- row->append(QVariant());
- }
- }
- row->replace(annotationColumn,annotation);
- emit dataChanged(createIndex(r,annotationColumn),
- createIndex(r,annotationColumn));
- emit rowChanged(r);
- if(annotationColumn> colcount-1)
- {
- colcount= annotationColumn+1;
- }
- }
-
- /*:431*//*433:*/
- #line 10030 "./typica.w"
-
- void MeasurementModel::clear()
- {
- beginRemoveRows(QModelIndex(),0,entries->size());
- while(entries->size()!=0)
- {
- MeasurementList*row= entries->takeFirst();
- delete row;
- }
- endRemoveRows();
- colcount= hData->size();
- lastTemperature->clear();
- reset();
- }
-
- /*:433*//*434:*/
- #line 10063 "./typica.w"
-
- bool MeasurementModel::setData(const QModelIndex&index,
- const QVariant&value,int role)
- {
- if(role!=Qt::EditRole&&role!=Qt::DisplayRole)
- {
- return false;
- }
- /*435:*/
- #line 10095 "./typica.w"
-
- bool valid= false;
- if(index.isValid())
- {
- if(index.row()<entries->size())
- {
- if(index.column()<colcount)
- {
- valid= true;
- }
- }
- }
-
- /*:435*/
- #line 10071 "./typica.w"
-
- if(!valid)
- {
- return false;
- }
- MeasurementList*row= entries->at(index.row());
- if(index.column()>=row->size())
- {
- /*436:*/
- #line 10112 "./typica.w"
-
- for(int i= row->size()-1;i<index.column();i++)
- {
- row->append(QVariant());
- }
-
- /*:436*/
- #line 10079 "./typica.w"
-
- }
- if(index.column()==0)
- {
- /*437:*/
- #line 10127 "./typica.w"
-
- QTime time;
- if(!(time= QTime::fromString(value.toString(),"m:s.z")).isValid())
- {
- if(!(time= QTime::fromString(value.toString(),"m:s")).isValid())
- {
- return false;
- }
- }
- row= entries->takeAt(index.row());
- row->replace(index.column(),QVariant(time));
- MeasurementList*temp= row;
- /*426:*/
- #line 9846 "./typica.w"
-
- /*427:*/
- #line 9891 "./typica.w"
-
- QList<MeasurementList*> ::iterator i= lastInsertion;
- bool quickscan= false;
- if(entries->size()> 5)
- {
- if(**i<*temp)
- {
- i+= 1;
- for(int j= 10;j> 0;j--)
- {
- if(i!=entries->end())
- {
- if(**i<*temp)
- {
- i+= 1;
- }
- else
- {
- quickscan= true;
- break;
- }
- }
- else
- {
- quickscan= true;
- break;
- }
- }
- }
- else
- {
- if(**i==*temp)
- {
- quickscan= true;
- }
- }
- }
-
- /*:427*/
- #line 9847 "./typica.w"
-
- if(quickscan==false)
- {
- i= entries->begin();
- QList<MeasurementList*> ::iterator u= entries->end();
- QList<MeasurementList*> ::iterator midpoint;
- int n= u-i;
- int rA;
- while(n> 0)
- {
- rA= n>>1;
- midpoint= i+rA;
- if(**midpoint<*temp)
- {
- i= midpoint+1;
- n-= rA+1;
- }
- else
- {
- n= rA;
- }
- }
- }
-
- /*:426*/
- #line 10139 "./typica.w"
-
- entries->insert(i,row);
- int newRow= entries->indexOf(*i);
- if(newRow<index.row())
- {
- emit dataChanged(createIndex(newRow,index.column()),index);
- }
- else
- {
- emit dataChanged(index,createIndex(newRow,index.column()));
- }
-
- /*:437*/
- #line 10083 "./typica.w"
-
- }
- else
- {
- /*438:*/
- #line 10153 "./typica.w"
-
- row->replace(index.column(),value);
- emit dataChanged(index,index);
-
- /*:438*/
- #line 10087 "./typica.w"
-
- }
- return true;
- }
-
- /*:434*//*439:*/
- #line 10161 "./typica.w"
-
- MeasurementModel::MeasurementModel(QObject*parent):QAbstractItemModel(parent),
- unit(Units::Fahrenheit),hData(new QStringList),
- lastTemperature(new QHash<int,int> ),
- controlColumns(new QHash<int,bool> )
- {
- colcount= 1;
- entries= new QList<MeasurementList*> ;
- lastInsertion= entries->begin();
- hData->append(tr("Time"));
- }
-
- /*:439*//*440:*/
- #line 10175 "./typica.w"
-
- MeasurementModel::~MeasurementModel()
- {
- clear();
- delete entries;
- delete hData;
- }
-
- /*:440*//*441:*/
- #line 10187 "./typica.w"
-
- int MeasurementModel::rowCount(const QModelIndex&parent)const
- {
- if(parent==QModelIndex())
- {
- return entries->size();
- }
- return 0;
- }
-
- int MeasurementModel::columnCount(const QModelIndex&parent)const
- {
- if(parent==QModelIndex())
- {
- return colcount;
- }
- return 0;
- }
-
- /*:441*//*442:*/
- #line 10214 "./typica.w"
-
- bool MeasurementModel::setHeaderData(int section,Qt::Orientation orientation,
- const QVariant&value,int)
- {
- if(orientation==Qt::Horizontal)
- {
- if(hData->size()<section+1)
- {
- for(int i= hData->size();i<section+1;i++)
- {
- if(colcount<i)
- {
- beginInsertColumns(QModelIndex(),i,i);
- }
- hData->append(QString());
- if(colcount<i)
- {
- endInsertColumns();
- }
- }
- }
- hData->replace(section,value.toString());
- emit headerDataChanged(orientation,section,section);
- if(colcount<section+1)
- {
- colcount= section+1;
- }
- return true;
- }
- return false;
- }
-
- /*:442*//*443:*/
- #line 10254 "./typica.w"
-
- void MeasurementModel::setDisplayUnits(Units::Unit scale)
- {
- beginResetModel();
- unit= scale;
- endResetModel();
- }
-
- Units::Unit MeasurementModel::displayUnits()
- {
- return unit;
- }
-
- /*:443*//*444:*/
- #line 10280 "./typica.w"
-
- QVariant MeasurementModel::data(const QModelIndex&index,int role)const
- {
- /*435:*/
- #line 10095 "./typica.w"
-
- bool valid= false;
- if(index.isValid())
- {
- if(index.row()<entries->size())
- {
- if(index.column()<colcount)
- {
- valid= true;
- }
- }
- }
-
- /*:435*/
- #line 10283 "./typica.w"
-
- if(!valid)
- {
- return QVariant();
- }
- MeasurementList*row= entries->at(index.row());
- if(role==Qt::UserRole)
- {
- return QVariant(row->at(index.column()));
- }
- if(role==Qt::DisplayRole||role==Qt::EditRole)
- {
- if(index.column()> row->size())
- {
- return QVariant();
- }
- else
- {
- if(index.column()==0)
- {
- return QVariant(row->at(0).toTime().toString("mm:ss.zzz"));
- }
- else if(lastTemperature->contains(index.column()))
- {
- QVariantMap v= row->at(index.column()).toMap();
- if(!v.contains("measurement"))
- {
- return QVariant();
- }
- if((Units::Unit)(v.value("unit").toInt())==Units::Unitless)
- {
- return v.value("measurement");
- }
- else
- {
- if(v.contains("relative"))
- {
- if(v.value("relative").toBool())
- {
- return QVariant(QString("%1").arg(Units::convertRelativeTemperature(v.value("measurement").
- toDouble(),(Units::Unit)(v.value("unit").toInt()),unit)));
- }
- }
- return QVariant(QString("%1").
- arg(Units::convertTemperature(v.value("measurement").toDouble(),
- (Units::Unit)(v.value("unit").toInt()),unit)));
- }
- }
- return QVariant(row->at(index.column()).toString());
- }
- }
- return QVariant();
- }
-
- /*:444*//*445:*/
- #line 10339 "./typica.w"
-
- QVariant MeasurementModel::headerData(int section,Qt::Orientation orientation,
- int role)const
- {
- if(orientation==Qt::Horizontal)
- {
- if(role==Qt::DisplayRole)
- {
- if(section<hData->size())
- {
- return QVariant(hData->at(section));
- }
- }
- }
- return QVariant();
- }
-
- /*:445*//*446:*/
- #line 10366 "./typica.w"
-
- Qt::ItemFlags MeasurementModel::flags(const QModelIndex&index)const
- {
- /*435:*/
- #line 10095 "./typica.w"
-
- bool valid= false;
- if(index.isValid())
- {
- if(index.row()<entries->size())
- {
- if(index.column()<colcount)
- {
- valid= true;
- }
- }
- }
-
- /*:435*/
- #line 10369 "./typica.w"
-
- if(valid)
- {
- return Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable;
- }
- return 0;
- }
-
- /*:446*//*447:*/
- #line 10381 "./typica.w"
-
- QModelIndex MeasurementModel::index(int row,int column,
- const QModelIndex&parent)const
- {
- if(parent==QModelIndex())
- {
- if(row<entries->size()&&entries->isEmpty()==false)
- {
- if(column<entries->at(row)->size())
- {
- return createIndex(row,column);
- }
- }
- }
- return QModelIndex();
- }
-
- /*:447*/
- #line 550 "./typica.w"
-
- /*449:*/
- #line 10432 "./typica.w"
-
- AnnotationButton::AnnotationButton(const QString&text,QWidget*parent):
- QPushButton(text,parent),note(""),tc(0),ac(0),count(0)
- {
- connect(this,SIGNAL(clicked()),this,SLOT(annotate()));
- }
-
- /*:449*//*450:*/
- #line 10447 "./typica.w"
-
- void AnnotationButton::annotate()
- {
- if(note.contains("%1"))
- {
- count++;
- emit annotation(note.arg(count),tc,ac);
- }
- else
- {
- emit annotation(note,tc,ac);
- }
- }
-
- /*:450*//*451:*/
- #line 10465 "./typica.w"
-
- void AnnotationButton::setTemperatureColumn(int tempcolumn)
- {
- tc= tempcolumn;
- }
-
- void AnnotationButton::setAnnotationColumn(int annotationcolumn)
- {
- ac= annotationcolumn;
- }
-
- void AnnotationButton::setAnnotation(const QString&annotation)
- {
- note= annotation;
- }
-
- /*:451*//*452:*/
- #line 10484 "./typica.w"
-
- void AnnotationButton::resetCount()
- {
- count= 0;
- }
-
- /*:452*/
- #line 551 "./typica.w"
-
- /*457:*/
- #line 10567 "./typica.w"
-
- AnnotationSpinBox::AnnotationSpinBox(const QString&pret,
- const QString&postt,
- QWidget*parent)
- :QDoubleSpinBox(parent),pretext(pret),posttext(postt)
- {
- resetChange();
- connect(this,SIGNAL(editingFinished()),this,SLOT(annotate()));
- connect(this,SIGNAL(valueChanged(double)),this,SLOT(resetChange()));
- }
-
- /*:457*//*458:*/
- #line 10584 "./typica.w"
-
- void AnnotationSpinBox::resetChange()
- {
- change= true;
- }
-
- /*:458*//*459:*/
- #line 10595 "./typica.w"
-
- void AnnotationSpinBox::annotate()
- {
- if(change)
- {
- change= false;
- emit annotation(QString("%1%2%3").arg(pretext).
- arg(value()).arg(posttext),tc,ac);
- }
- }
-
- /*:459*//*460:*/
- #line 10608 "./typica.w"
-
- void AnnotationSpinBox::setTemperatureColumn(int tempcolumn)
- {
- tc= tempcolumn;
- }
-
- void AnnotationSpinBox::setAnnotationColumn(int annotationcolumn)
- {
- ac= annotationcolumn;
- }
-
- void AnnotationSpinBox::setPretext(const QString&pret)
- {
- pretext= pret;
- }
-
- void AnnotationSpinBox::setPosttext(const QString&postt)
- {
- posttext= postt;
- }
-
- /*:460*/
- #line 552 "./typica.w"
-
- /*467:*/
- #line 10777 "./typica.w"
-
- TimerDisplay::TimerDisplay(QWidget*parent):QLCDNumber(8,parent),
- s(QTime(0,0,0)),r(QTime(0,0,0)),clock(NULL),m(TimerDisplay::CountUp),
- running(false),ar(false),startAction(new QAction(tr("Start"),NULL)),
- stopAction(new QAction(tr("Stop"),NULL)),
- resetAction(new QAction(tr("Reset"),NULL)),f(QString("hh:mm:ss")),
- relative(QTime::currentTime()),base(QTime(0,0,0))
- {
- connect(startAction,SIGNAL(triggered(bool)),this,SLOT(startTimer()));
- connect(stopAction,SIGNAL(triggered(bool)),this,SLOT(stopTimer()));
- connect(resetAction,SIGNAL(triggered(bool)),this,SLOT(reset()));
- clock.setInterval(500);
- clock.setSingleShot(false);
- connect(&clock,SIGNAL(timeout()),this,SLOT(updateTime()));
- setSegmentStyle(Filled);
- updateDisplay();
- }
-
- /*:467*//*468:*/
- #line 10798 "./typica.w"
-
- void TimerDisplay::updateTime()
- {
- QTime time;
- int cseconds= 0;
- int oseconds= 0;
- int r= 0;
- QTime nt= QTime(0,0,0);
- int n= 0;
- int bseconds= 0;
- switch(m)
- {
- case TimerDisplay::CountUp:
- /*469:*/
- #line 10830 "./typica.w"
-
- /*470:*/
- #line 10843 "./typica.w"
-
- #define TIMETOINT(t) ((t.hour() * 60 * 60) + (t.minute() * 60) + (t.second()))
-
- time= QTime::currentTime();
- cseconds= TIMETOINT(time);
- oseconds= TIMETOINT(relative);
- r= cseconds-oseconds;
-
- /*:470*/
- #line 10831 "./typica.w"
-
- nt= nt.addSecs(r);
- if(nt!=s)
- {
- s= nt;
- emit valueChanged(s);
- }
-
- /*:469*/
- #line 10811 "./typica.w"
- ;
- break;
- case TimerDisplay::CountDown:
- /*471:*/
- #line 10855 "./typica.w"
-
- if(s> QTime(0,0,0))
- {
- /*470:*/
- #line 10843 "./typica.w"
-
- #define TIMETOINT(t) ((t.hour() * 60 * 60) + (t.minute() * 60) + (t.second()))
-
- time= QTime::currentTime();
- cseconds= TIMETOINT(time);
- oseconds= TIMETOINT(relative);
- r= cseconds-oseconds;
-
- /*:470*/
- #line 10858 "./typica.w"
-
- bseconds= TIMETOINT(base);
- n= bseconds-r;
- nt= nt.addSecs(n);
- if(nt!=s)
- {
- s= nt;
- emit valueChanged(s);
- }
- }else{
- stopTimer();
- }
-
- /*:471*/
- #line 10814 "./typica.w"
- ;
- break;
- case TimerDisplay::Clock:
- /*472:*/
- #line 10874 "./typica.w"
-
- time= QTime::currentTime();
- if(time!=s)
- {
- s= time;
- emit valueChanged(s);
- }
-
- /*:472*/
- #line 10817 "./typica.w"
- ;
- break;
- default:
- Q_ASSERT_X(false,"updateTime","invalid timer mode");
- break;
- }
- updateDisplay();
- }
-
- /*:468*//*473:*/
- #line 10886 "./typica.w"
-
- #define TIMESUBTRACT(t1, t2) (t1.addSecs(-(TIMETOINT(t2))).addSecs(-t2.msec()))
-
- void TimerDisplay::startTimer()
- {
- if(!running)
- {
- relative= QTime::currentTime();
- if(ar)
- {
- reset();
- }
- else
- {
- relative= TIMESUBTRACT(relative,s);
- }
- if(m==Clock)
- {
- updateTime();
- }
- base= s;
- clock.start();
- running= true;
- emit runStateChanged(true);
- }
- }
-
- /*:473*//*474:*/
- #line 10916 "./typica.w"
-
- void TimerDisplay::stopTimer()
- {
- if(running)
- {
- clock.stop();
- running= false;
- emit runStateChanged(false);
- }
- }
-
- /*:474*//*475:*/
- #line 10929 "./typica.w"
-
- TimerDisplay::~TimerDisplay()
- {
- clock.stop();
- }
-
- /*:475*//*476:*/
- #line 10938 "./typica.w"
-
- void TimerDisplay::setCountUpMode()
- {
- m= TimerDisplay::CountUp;
- }
-
- void TimerDisplay::setCountDownMode()
- {
- m= TimerDisplay::CountDown;
- }
-
- void TimerDisplay::setClockMode()
- {
- m= TimerDisplay::Clock;
- }
-
- /*:476*//*477:*/
- #line 10956 "./typica.w"
-
- QString TimerDisplay::value()
- {
- return s.toString(f);
- }
-
- QTime TimerDisplay::seconds()
- {
- return s;
- }
-
- TimerDisplay::TimerMode TimerDisplay::mode()
- {
- return m;
- }
-
- bool TimerDisplay::isRunning()
- {
- return running;
- }
-
- QTime TimerDisplay::resetValue()
- {
- return r;
- }
-
- QString TimerDisplay::displayFormat()
- {
- return f;
- }
-
- bool TimerDisplay::autoReset()
- {
- return ar;
- }
-
- /*:477*//*478:*/
- #line 10994 "./typica.w"
-
- void TimerDisplay::setTimer(QTime value)
- {
- if(value.isValid())
- {
- s= value;
- updateDisplay();
- emit valueChanged(value);
- }
- }
-
- void TimerDisplay::setMode(TimerDisplay::TimerMode mode)
- {
- m= mode;
- }
-
- void TimerDisplay::setResetValue(QTime value)
- {
- r= value;
- }
-
- void TimerDisplay::setDisplayFormat(QString format)
- {
- f= format;
- setNumDigits(format.length());
- }
-
- void TimerDisplay::setAutoReset(bool reset)
- {
- ar= reset;
- }
-
- /*:478*//*479:*/
- #line 11029 "./typica.w"
-
- void TimerDisplay::copyTimer()
- {
- QApplication::clipboard()->setText(value());
- }
-
- /*:479*//*480:*/
- #line 11038 "./typica.w"
-
- void TimerDisplay::reset()
- {
- if(!running)
- {
- s= r;
- updateDisplay();
- }
- }
-
- /*:480*//*481:*/
- #line 11051 "./typica.w"
-
- void TimerDisplay::updateDisplay()
- {
- display(value());
- }
-
- /*:481*/
- #line 553 "./typica.w"
-
- /*488:*/
- #line 11176 "./typica.w"
-
- int PackLayout::doLayout(const QRect&rect,bool testOnly)const
- {
- int x= rect.x();
- int y= rect.y();
- QLayoutItem*item;
- if(orientation==Qt::Horizontal)
- {
- /*489:*/
- #line 11200 "./typica.w"
-
- foreach(item,itemList)
- {
- int nextX= x+item->sizeHint().width()+spacing();
- int right= x+item->sizeHint().width();
- if(item==itemList.last())
- {
- right= rect.right();
- }
- int bottom= rect.bottom();
- if(!testOnly)
- {
- item->setGeometry(QRect(QPoint(x,y),QPoint(right,bottom)));
- }
- x= nextX;
- }
-
- /*:489*/
- #line 11184 "./typica.w"
-
- }
- else
- {
- /*490:*/
- #line 11219 "./typica.w"
-
- foreach(item,itemList)
- {
- int nextY= y+item->sizeHint().height()+spacing();
- int bottom= y+item->sizeHint().height();
- if(item==itemList.last())
- {
- bottom= rect.bottom();
- }
- int right= rect.right();
- if(!testOnly)
- {
- item->setGeometry(QRect(QPoint(x,y),QPoint(right,bottom)));
- }
- y= nextY;
- }
-
- /*:490*/
- #line 11188 "./typica.w"
-
- }
- return y;
- }
-
- /*:488*//*491:*/
- #line 11243 "./typica.w"
-
- QSize PackLayout::minimumSize()const
- {
- QSize size;
- QLayoutItem*item;
- foreach(item,itemList)
- {
- if(orientation==Qt::Horizontal)
- {
- size+= QSize(item->minimumSize().width(),0);
- if(size.height()<item->minimumSize().height())
- {
- size.setHeight(item->minimumSize().height());
- }
- }
- else
- {
- size+= QSize(0,item->minimumSize().height());
- if(size.width()<item->minimumSize().width())
- {
- size.setWidth(item->minimumSize().width());
- }
- }
- }
- size+= QSize(2*margin(),2*margin());
- return size;
- }
-
- /*:491*//*492:*/
- #line 11275 "./typica.w"
-
- PackLayout::PackLayout(QWidget*parent,int margin,int spacing):
- QLayout(parent)
- {
- setMargin(margin);
- setSpacing(spacing);
- setOrientation(Qt::Horizontal);
- }
-
- PackLayout::PackLayout(int spacing)
- {
- setSpacing(spacing);
- setOrientation(Qt::Horizontal);
- }
-
- /*:492*//*493:*/
- #line 11293 "./typica.w"
-
- PackLayout::~PackLayout()
- {
- QLayoutItem*item;
- while((item= takeAt(0)))
- {
- delete item;
- }
- }
-
- /*:493*//*494:*/
- #line 11307 "./typica.w"
-
- QLayoutItem*PackLayout::takeAt(int index)
- {
- if(index>=0&&index<itemList.size())
- {
- return itemList.takeAt(index);
- }
- else
- {
- return NULL;
- }
- }
-
- /*:494*//*495:*/
- #line 11323 "./typica.w"
-
- QLayoutItem*PackLayout::itemAt(int index)const
- {
- if(index>=0&&index<itemList.size())
- {
- return itemList.at(index);
- }
- else
- {
- return NULL;
- }
- }
-
- /*:495*//*496:*/
- #line 11346 "./typica.w"
-
- void PackLayout::addItem(QLayoutItem*item)
- {
- itemList.append(item);
- }
-
- /*:496*//*497:*/
- #line 11354 "./typica.w"
-
- int PackLayout::count()const
- {
- return itemList.size();
- }
-
- /*:497*//*498:*/
- #line 11366 "./typica.w"
-
- Qt::Orientations PackLayout::expandingDirections()const
- {
- return Qt::Vertical|Qt::Horizontal;
- }
-
- bool PackLayout::hasHeightForWidth()const
- {
- return false;
- }
-
- int PackLayout::heightForWidth(int width)const
- {
- return doLayout(QRect(0,0,width,0),true);
- }
-
- void PackLayout::setGeometry(const QRect&rect)
- {
- QLayout::setGeometry(rect);
- doLayout(rect,false);
- }
-
- QSize PackLayout::sizeHint()const
- {
- return minimumSize();
- }
-
- /*:498*//*499:*/
- #line 11397 "./typica.w"
-
- void PackLayout::setOrientation(Qt::Orientations direction)
- {
- orientation= direction;
- doLayout(geometry(),false);
- }
-
- /*:499*/
- #line 554 "./typica.w"
-
- /*501:*/
- #line 11436 "./typica.w"
-
- SceneButton::SceneButton():QGraphicsScene()
- {
-
- }
-
- SceneButton::~SceneButton()
- {
-
- }
-
- void SceneButton::mousePressEvent(QGraphicsSceneMouseEvent*mouseEvent)
- {
- emit clicked(mouseEvent->buttonDownScreenPos(mouseEvent->button()));
- }
-
- /*:501*/
- #line 555 "./typica.w"
-
- /*503:*/
- #line 11482 "./typica.w"
-
- WidgetDecorator::WidgetDecorator(QWidget*widget,const QString&labeltext,
- Qt::Orientations orientation,
- QWidget*parent,Qt::WindowFlags f):
- QWidget(parent,f),label(new QGraphicsView()),
- scene(new SceneButton())
- {
- layout= new PackLayout(this);
- layout->setOrientation(orientation);
- /*504:*/
- #line 11502 "./typica.w"
-
- label->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- label->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- label->setFrameShape(QFrame::NoFrame);
- label->setInteractive(true);
-
- /*:504*/
- #line 11491 "./typica.w"
-
- /*505:*/
- #line 11513 "./typica.w"
-
- scene->setBackgroundBrush(Qt::cyan);
- text= scene->addText(labeltext);
- if(orientation==Qt::Horizontal)
- {
- text->rotate(270.0);
- }
- label->setScene(scene);
-
- /*:505*/
- #line 11492 "./typica.w"
-
- /*506:*/
- #line 11531 "./typica.w"
-
- if(orientation==Qt::Horizontal)
- {
- label->setMaximumWidth((int)(text->boundingRect().height()+1));
- }
- else
- {
- label->setMaximumHeight((int)(text->boundingRect().height()+1));
- }
- label->centerOn(text);
-
- /*:506*/
- #line 11493 "./typica.w"
-
- /*507:*/
- #line 11546 "./typica.w"
-
- layout->addWidget(label);
- layout->addWidget(widget);
- if(orientation==Qt::Horizontal)
- {
- setMinimumSize(widget->sizeHint().width()+label->sizeHint().width(),
- widget->sizeHint().height());
- }
- else
- {
- setMinimumSize(widget->sizeHint().width(),
- widget->sizeHint().height()+label->sizeHint().height());
- }
-
- /*:507*/
- #line 11494 "./typica.w"
-
- }
-
- /*:503*//*508:*/
- #line 11563 "./typica.w"
-
- void WidgetDecorator::setBackgroundBrush(QBrush background)
- {
- scene->setBackgroundBrush(background);
- }
-
- void WidgetDecorator::setTextColor(QColor color)
- {
- text->setDefaultTextColor(color);
- }
-
- /*:508*//*509:*/
- #line 11576 "./typica.w"
-
- WidgetDecorator::~WidgetDecorator()
- {
-
- }
-
- /*:509*/
- #line 556 "./typica.w"
-
- /*514:*/
- #line 11675 "./typica.w"
-
- void LogEditWindow::addTheRows()
- {
- QTime s= startTime->time();
- while(s<endTime->time())
- {
- model->newMeasurement(Measurement(0,s),1);
- s= s.addSecs(interval->value());
- }
- model->newMeasurement(Measurement(0,endTime->time()),1);
- }
-
- /*:514*//*515:*/
- #line 11689 "./typica.w"
-
- LogEditWindow::LogEditWindow():QMainWindow(NULL),
- centralWidget(new QWidget(NULL)),mainLayout(new PackLayout(0)),
- addRowsLayout(new QHBoxLayout(NULL)),
- startTimeLabel(new QLabel("Start Time")),
- startTime(new QTimeEdit(QTime(0,0,0,0))),
- endTimeLabel(new QLabel("End Time")),
- endTime(new QTimeEdit(QTime(0,20,0,0))),
- intervalLabel(new QLabel("Interval (seconds)")),
- interval(new QSpinBox()),
- addRows(new QPushButton("Add Rows")),
- saveXml(new QAction(tr("Save Profile As..."),NULL)),
- saveCsv(new QAction(tr("Export CSV"),NULL)),
- openXml(new QAction(tr("Load Target Profile..."),NULL)),
- model(new MeasurementModel()),
- log(new QTableView())
- {
- /*516:*/
- #line 11726 "./typica.w"
-
- QSettings settings;
- resize(settings.value("logSize",QSize(620,400)).toSize());
- move(settings.value("logPos",QPoint(200,60)).toPoint());
-
- /*:516*/
- #line 11706 "./typica.w"
-
- /*517:*/
- #line 11739 "./typica.w"
-
- mainLayout->setOrientation(Qt::Vertical);
- addRowsLayout->addSpacing(10);
- addRowsLayout->addWidget(startTimeLabel);
- addRowsLayout->addWidget(startTime);
- addRowsLayout->addSpacing(10);
- startTime->setDisplayFormat("mm:ss");
- addRowsLayout->addWidget(endTimeLabel);
- addRowsLayout->addWidget(endTime);
- addRowsLayout->addSpacing(10);
- endTime->setDisplayFormat("mm:ss");
- addRowsLayout->addWidget(intervalLabel);
- addRowsLayout->addWidget(interval);
- addRowsLayout->addSpacing(10);
- interval->setRange(0,60);
- interval->setValue(30);
- addRowsLayout->addWidget(addRows);
- addRowsLayout->addSpacing(10);
- connect(addRows,SIGNAL(clicked()),this,SLOT(addTheRows()));
-
- /*:517*/
- #line 11707 "./typica.w"
-
- /*518:*/
- #line 11762 "./typica.w"
-
- model->setHeaderData(0,Qt::Horizontal,"Time");
- model->setHeaderData(1,Qt::Horizontal,"Temperature");
- model->setHeaderData(2,Qt::Horizontal,"Annotation");
- model->clear();
-
- /*:518*/
- #line 11708 "./typica.w"
-
- /*519:*/
- #line 11771 "./typica.w"
-
- log->setModel(model);
- log->setColumnWidth(0,100);
- log->setColumnWidth(1,100);
- log->setColumnWidth(2,100);
-
- /*:519*/
- #line 11709 "./typica.w"
-
- mainLayout->addItem(addRowsLayout);
- mainLayout->addWidget(log);
- centralWidget->setLayout(mainLayout);
- setCentralWidget(centralWidget);
- QMenu*fileMenu= menuBar()->addMenu(tr("&File"));
- fileMenu->addAction(openXml);
- connect(openXml,SIGNAL(triggered()),this,SLOT(openXML()));
- fileMenu->addAction(saveXml);
- connect(saveXml,SIGNAL(triggered()),this,SLOT(saveXML()));
- fileMenu->addAction(saveCsv);
- connect(saveCsv,SIGNAL(triggered()),this,SLOT(saveCSV()));
- }
-
- /*:515*//*520:*/
- #line 11782 "./typica.w"
-
- void LogEditWindow::saveXML()
- {
- QSettings settings;
- QString lastDir= settings.value("lastDirectory").toString();
- QString filename= QFileDialog::getSaveFileName(this,tr("Save Log As..."),
- lastDir,"",0);
- QFile file(filename);
- XMLOutput writer(model,&file,0);
- writer.addTemperatureColumn("Temperature",1);
- writer.addAnnotationColumn("Annotation",2);
- if(writer.output())
- {
- QFileInfo info(filename);
- QDir directory= info.dir();
- lastDir= directory.path();
- settings.setValue("lastDirectory",lastDir);
- }
- }
-
- void LogEditWindow::saveCSV()
- {
- QSettings settings;
- QString lastDir= settings.value("lastDirectory").toString();
- QString filename= QFileDialog::getSaveFileName(this,tr("Export As..."),
- lastDir,"",0);
- QFile file(filename);
- CSVOutput writer(model,&file,0);
- writer.addTemperatureColumn("Temperature",1);
- writer.addAnnotationColumn("Annotation",2);
- if(writer.output())
- {
- QFileInfo info(filename);
- QDir directory= info.dir();
- lastDir= directory.path();
- settings.setValue("lastDirectory",lastDir);
- }
- }
-
- /*:520*//*521:*/
- #line 11825 "./typica.w"
-
- void LogEditWindow::openXML()
- {
- QSettings settings;
- QString lastDir= settings.value("lastDirectory").toString();
- QString filename= QFileDialog::getOpenFileName(this,tr("Open XML Log..."),
- lastDir,"",0);
- if(filename.isNull())
- {
- return;
- }
- QFile file(filename);
- XMLInput reader(&file,1);
- connect(&reader,SIGNAL(measure(Measurement,int)),
- model,SLOT(newMeasurement(Measurement,int)));
- connect(&reader,SIGNAL(annotation(QString,int,int)),
- model,SLOT(newAnnotation(QString,int,int)));
- if(reader.input())
- {
- QFileInfo info(filename);
- setWindowTitle(QString(tr("%1 - %2")).
- arg(QCoreApplication::applicationName()).arg(info.baseName()));
- QDir directory= info.dir();
- lastDir= directory.path();
- settings.setValue("lastDirectory",lastDir);
- }
- }
-
- /*:521*//*522:*/
- #line 11856 "./typica.w"
-
- void LogEditWindow::closeEvent(QCloseEvent*event)
- {
- QSettings settings;
- settings.setValue("logSize",size());
- settings.setValue("logPos",pos());
- event->accept();
- }
-
- /*:522*/
- #line 557 "./typica.w"
-
- /*528:*/
- #line 11971 "./typica.w"
-
- bool XMLOutput::output()
- {
- if(!out->open(QIODevice::WriteOnly|QIODevice::Text))
- {
- return false;
- }
- QXmlStreamWriter xmlout(out);
- xmlout.writeStartDocument("1.0");
- xmlout.writeDTD("<!DOCTYPE roastlog3.0>");
- xmlout.writeStartElement("roastlog");
- /*529:*/
- #line 12004 "./typica.w"
-
- foreach(int c,temperatureColumns.keys())
- {
- xmlout.writeStartElement("tempseries");
- xmlout.writeAttribute("name",temperatureColumns.value(c));
- xmlout.writeEndElement();
- }
- foreach(int c,controlColumns.keys())
- {
- xmlout.writeStartElement("controlseries");
- xmlout.writeAttribute("name",controlColumns.value(c));
- xmlout.writeEndElement();
- }
- foreach(int c,annotationColumns.keys())
- {
- xmlout.writeStartElement("noteseries");
- xmlout.writeAttribute("name",annotationColumns.value(c));
- xmlout.writeEndElement();
- }
-
- /*:529*/
- #line 11982 "./typica.w"
-
- xmlout.writeStartElement("roast");
- bool oresult;
- for(int i= 0;i<data->rowCount();i++)
- {
- /*530:*/
- #line 12029 "./typica.w"
-
- oresult= false;
- foreach(int c,temperatureColumns.keys())
- {
- if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
- !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
- {
- oresult= true;
- break;
- }
- }
- foreach(int c,controlColumns.keys())
- {
- if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
- !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
- {
- oresult= true;
- break;
- }
- }
- if(oresult==false)
- {
- foreach(int c,annotationColumns.keys())
- {
- if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
- !(data->data(data->index(i,c),Qt::DisplayRole).toString().
- isEmpty()))
- {
- oresult= true;
- break;
- }
- }
- }
-
- /*:530*/
- #line 11987 "./typica.w"
-
- if(oresult)
- {
- /*531:*/
- #line 12068 "./typica.w"
-
- xmlout.writeStartElement("tuple");
- xmlout.writeTextElement("time",data->data(data->index(i,time),
- Qt::DisplayRole).toString());
- foreach(int c,temperatureColumns.keys())
- {
- if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
- !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
- {
- xmlout.writeStartElement("temperature");
- xmlout.writeAttribute("series",temperatureColumns.value(c));
- if(data->data(data->index(i,c),Qt::UserRole).toMap().contains("relative"))
- {
- if(data->data(data->index(i,c),Qt::UserRole).toMap().value("relative").toBool())
- {
- xmlout.writeAttribute("relative","true");
- }
- }
- xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).
- toString());
- xmlout.writeEndElement();
- }
- }
- foreach(int c,controlColumns.keys())
- {
- if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
- !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
- {
- xmlout.writeStartElement("control");
- xmlout.writeAttribute("series",controlColumns.value(c));
- xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).toString());
- xmlout.writeEndElement();
- }
- }
- foreach(int c,annotationColumns.keys())
- {
- if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
- !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
- {
- xmlout.writeStartElement("annotation");
- xmlout.writeAttribute("series",annotationColumns.value(c));
- xmlout.writeCharacters(data->data(data->index(i,c),Qt::DisplayRole).
- toString());
- xmlout.writeEndElement();
- }
- }
- xmlout.writeEndElement();
-
- /*:531*/
- #line 11990 "./typica.w"
-
- }
- }
- xmlout.writeEndElement();
- xmlout.writeEndElement();
- xmlout.writeEndDocument();
- out->close();
- return true;
- }
-
- /*:528*//*532:*/
- #line 12118 "./typica.w"
-
- XMLOutput::XMLOutput(MeasurementModel*model,QIODevice*device,int timec)
- :QObject(NULL),data(model),out(device),time(timec)
- {
-
- }
-
- void XMLOutput::setModel(MeasurementModel*model)
- {
- data= model;
- }
-
- void XMLOutput::setTimeColumn(int column)
- {
- time= column;
- }
-
- void XMLOutput::setDevice(QIODevice*device)
- {
- out= device;
- }
-
- /*:532*//*533:*/
- #line 12147 "./typica.w"
-
- void XMLOutput::addTemperatureColumn(const QString&series,int column)
- {
- temperatureColumns.insert(column,series);
- }
-
- void XMLOutput::addControlColumn(const QString&series,int column)
- {
- controlColumns.insert(column,series);
- }
-
- void XMLOutput::addAnnotationColumn(const QString&series,int column)
- {
- annotationColumns.insert(column,series);
- }
-
- /*:533*/
- #line 558 "./typica.w"
-
- /*535:*/
- #line 12204 "./typica.w"
-
- bool XMLInput::input()
- {
- if(!in->open(QIODevice::ReadOnly|QIODevice::Text))
- {
- return false;
- }
- QXmlStreamReader xmlin(in);
- QMap<QString,int> temperatureColumns;
- QMap<QString,int> annotationColumns;
- int nextColumn= firstc;
- /*536:*/
- #line 12235 "./typica.w"
-
- while(!xmlin.isDTD())
- {
- xmlin.readNext();
- }
- if(xmlin.isDTD())
- {
- if(xmlin.text()=="<!DOCTYPE roastlog>")
- {
- /*537:*/
- #line 12257 "./typica.w"
-
- emit newTemperatureColumn(firstc,"Bean");
- emit newAnnotationColumn(firstc+1,"Note");
- emit lastColumn(firstc+1);
-
- /*:537*/
- #line 12244 "./typica.w"
-
- }
- else
- {
- xmlin.readNext();
- /*538:*/
- #line 12266 "./typica.w"
-
- while(xmlin.name()!="roast")
- {
- if(xmlin.isStartElement())
- {
- if((xmlin.name()=="tempseries")||(xmlin.name()=="controlseries"))
- {
- temperatureColumns.insert(xmlin.attributes().value("name").
- toString(),
- nextColumn);
- emit newTemperatureColumn(nextColumn,
- xmlin.attributes().value("name").
- toString());
- nextColumn++;
- }
- else if(xmlin.name()=="noteseries")
- {
- annotationColumns.insert(xmlin.attributes().value("name").
- toString(),nextColumn);
- emit newAnnotationColumn(nextColumn,
- xmlin.attributes().value("name").
- toString());
- nextColumn++;
- }
- }
- xmlin.readNext();
- }
- emit lastColumn(nextColumn-1);
-
- /*:538*/
- #line 12249 "./typica.w"
-
- }
- }
-
- /*:536*/
- #line 12215 "./typica.w"
-
- QTime timeval= QTime();
- double tempval= 0;
- QString noteval= QString();
- int column;
- int counter= 0;
- while(!xmlin.atEnd())
- {
- /*539:*/
- #line 12307 "./typica.w"
-
- xmlin.readNext();
- if(xmlin.isStartElement())
- {
- /*540:*/
- #line 12333 "./typica.w"
-
- if(xmlin.name()=="time")
- {
- timeval= QTime::fromString(xmlin.readElementText(),"mm:ss.zzz");
- }
- else if(xmlin.name()=="temperature")
- {
- column= xmlin.attributes().hasAttribute("series")?
- temperatureColumns.value(xmlin.attributes().value("series").toString()):firstc;
- bool relative= (xmlin.attributes().value("relative")=="true");
- tempval= xmlin.readElementText().toDouble();
- Measurement measurement(tempval,timeval);
- if(relative)
- {
- measurement.insert("relative",true);
- }
- emit measure(measurement,column);
- }
- else if(xmlin.name()=="control")
- {
- column= xmlin.attributes().value("series").toString().isEmpty()?
- firstc:temperatureColumns.value(xmlin.attributes().
- value("series").toString());
- tempval= xmlin.readElementText().toDouble();
- Measurement measurement(tempval,timeval,Units::Unitless);
- emit measure(measurement,column);
- }
- else if(xmlin.name()=="annotation")
- {
- column= xmlin.attributes().value("series").toString().isEmpty()?
- firstc+1:annotationColumns.value(xmlin.attributes().
- value("series").toString());
- noteval= xmlin.readElementText();
- if(!noteval.isEmpty())
- {
- emit annotation(noteval,firstc,column);
- }
- }
-
- /*:540*/
- #line 12311 "./typica.w"
-
- }
- counter++;
- if(counter%100==0)
- {
- QCoreApplication::processEvents();
- }
-
- /*:539*/
- #line 12223 "./typica.w"
-
- }
- return true;
- }
-
- /*:535*//*541:*/
- #line 12374 "./typica.w"
-
- XMLInput::XMLInput(QIODevice*input,int c):
- firstc(c),in(input)
- {
-
- }
-
- void XMLInput::setFirstColumn(int column)
- {
- firstc= column;
- }
-
- void XMLInput::setDevice(QIODevice*device)
- {
- in= device;
- }
-
- /*:541*/
- #line 559 "./typica.w"
-
- /*546:*/
- #line 12465 "./typica.w"
-
- bool CSVOutput::output()
- {
- if(!out->open(QIODevice::WriteOnly|QIODevice::Text))
- {
- return false;
- }
- QTextStream output(out);
- /*547:*/
- #line 12489 "./typica.w"
-
- output<<"Time";
- foreach(int c,temperatureColumns.keys())
- {
- output<<','<<temperatureColumns.value(c);
- }
- foreach(int c,controlColumns.keys())
- {
- output<<','<<controlColumns.value(c);
- }
- foreach(int c,annotationColumns.keys())
- {
- output<<','<<annotationColumns.value(c);
- }
- output<<'\n';
-
- /*:547*/
- #line 12473 "./typica.w"
-
- bool oresult;
- for(int i= 0;i<data->rowCount();i++)
- {
- /*530:*/
- #line 12029 "./typica.w"
-
- oresult= false;
- foreach(int c,temperatureColumns.keys())
- {
- if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
- !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
- {
- oresult= true;
- break;
- }
- }
- foreach(int c,controlColumns.keys())
- {
- if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
- !(data->data(data->index(i,c),Qt::DisplayRole).toString().isEmpty()))
- {
- oresult= true;
- break;
- }
- }
- if(oresult==false)
- {
- foreach(int c,annotationColumns.keys())
- {
- if(data->data(data->index(i,c),Qt::DisplayRole).isValid()&&
- !(data->data(data->index(i,c),Qt::DisplayRole).toString().
- isEmpty()))
- {
- oresult= true;
- break;
- }
- }
- }
-
- /*:530*/
- #line 12477 "./typica.w"
-
- if(oresult)
- {
- /*548:*/
- #line 12514 "./typica.w"
-
- output<<data->data(data->index(i,time),Qt::DisplayRole).toString();
- foreach(int c,temperatureColumns.keys())
- {
- output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
- }
- foreach(int c,controlColumns.keys())
- {
- output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
- }
- foreach(int c,annotationColumns.keys())
- {
- output<<','<<data->data(data->index(i,c),Qt::DisplayRole).toString();
- }
- output<<'\n';
-
- /*:548*/
- #line 12480 "./typica.w"
-
- }
- }
- out->close();
- return true;
- }
-
- /*:546*//*549:*/
- #line 12533 "./typica.w"
-
- CSVOutput::CSVOutput(MeasurementModel*model,QIODevice*device,int timec):
- data(model),out(device),time(timec)
- {
-
- }
-
- void CSVOutput::setModel(MeasurementModel*model)
- {
- data= model;
- }
-
- void CSVOutput::setTimeColumn(int column)
- {
- time= column;
- }
-
- void CSVOutput::addTemperatureColumn(const QString&series,int column)
- {
- temperatureColumns.insert(column,series);
- }
-
- void CSVOutput::addControlColumn(const QString&series,int column)
- {
- controlColumns.insert(column,series);
- }
-
- void CSVOutput::addAnnotationColumn(const QString&series,int column)
- {
- annotationColumns.insert(column,series);
- }
-
- void CSVOutput::setDevice(QIODevice*device)
- {
- out= device;
- }
-
- #line 1 "./webview.w"
- /*:549*/
- #line 560 "./typica.w"
-
- /*584:*/
- #line 12794 "./typica.w"
-
- QString SaltModel::arrayLiteral(int column,int role)const
- {
- QString literal= "'{";
- for(int i= 0;i<rowCount();i++)
- {
- QString datum= data(index(i,column),role).toString();
- if(!datum.isEmpty())
- {
- literal.append(datum);
- literal.append(", ");
- }
- }
- if(literal.size()> 2)
- {
- literal.chop(2);
- }
- literal.append("}'");
- return literal;
- }
-
- QString SaltModel::quotedArrayLiteral(int column,int role)const
- {
- QString literal= "'{";
- for(int i= 0;i<rowCount();i++)
- {
- QString datum= data(index(i,column),role).toString();
- if(!datum.isEmpty())
- {
- literal.append("\"");
- literal.append(datum);
- literal.append("\", ");
- }
- }
- if(literal.size()> 2)
- {
- literal.chop(2);
- }
- literal.append("}'");
- return literal;
- }
-
- /*:584*//*585:*/
- #line 12838 "./typica.w"
-
- QModelIndex SaltModel::parent(const QModelIndex&)const
- {
- return QModelIndex();
- }
-
- /*:585*//*586:*/
- #line 12857 "./typica.w"
-
- bool SaltModel::setData(const QModelIndex&index,const QVariant&value,
- int role)
- {
- /*587:*/
- #line 12888 "./typica.w"
-
- bool valid= false;
- if(index.isValid())
- {
- if(index.row()<modelData.size())
- {
- if(index.column()<colcount)
- {
- valid= true;
- }
- }
- }
-
- /*:587*/
- #line 12861 "./typica.w"
-
- if(!valid)
- {
- return false;
- }
- if(index.row()==modelData.size()-1)
- {
- beginInsertRows(QModelIndex(),modelData.size(),modelData.size());
- /*588:*/
- #line 12904 "./typica.w"
-
- QList<QMap<int,QVariant> > newRow;
- QMap<int,QVariant> defaults;
- for(int i= 0;i<colcount;i++)
- {
- newRow.append(defaults);
- }
- modelData.append(newRow);
-
- /*:588*/
- #line 12869 "./typica.w"
-
- endInsertRows();
- }
- QList<QMap<int,QVariant> > row= modelData.at(index.row());
- QMap<int,QVariant> cell= row.at(index.column());
- cell.insert(role,value);
- if(role==Qt::EditRole)
- {
- cell.insert(Qt::DisplayRole,value);
- }
- row.replace(index.column(),cell);
- modelData.replace(index.row(),row);
- emit dataChanged(index,index);
- return true;
- }
-
- /*:586*//*589:*/
- #line 12915 "./typica.w"
-
- SaltModel::SaltModel(int columns):QAbstractItemModel(),colcount(columns)
- {
- for(int i= 0;i<columns;i++)
- {
- hData<<"";
- }
- /*588:*/
- #line 12904 "./typica.w"
-
- QList<QMap<int,QVariant> > newRow;
- QMap<int,QVariant> defaults;
- for(int i= 0;i<colcount;i++)
- {
- newRow.append(defaults);
- }
- modelData.append(newRow);
-
- /*:588*/
- #line 12922 "./typica.w"
-
- }
-
- /*:589*//*590:*/
- #line 12927 "./typica.w"
-
- SaltModel::~SaltModel()
- {
-
- }
-
- /*:590*//*591:*/
- #line 12937 "./typica.w"
-
- int SaltModel::rowCount(const QModelIndex&parent)const
- {
- return(parent==QModelIndex()?modelData.size():0);
- }
-
- int SaltModel::columnCount(const QModelIndex&parent)const
- {
- return(parent==QModelIndex()?colcount:0);
- }
-
- /*:591*//*592:*/
- #line 12950 "./typica.w"
-
- bool SaltModel::setHeaderData(int section,Qt::Orientation orientation,
- const QVariant&value,int)
- {
- if(orientation==Qt::Horizontal&§ion<colcount)
- {
- hData.replace(section,value.toString());
- emit headerDataChanged(orientation,section,section);
- return true;
- }
- return false;
- }
-
- /*:592*//*593:*/
- #line 12965 "./typica.w"
-
- QVariant SaltModel::data(const QModelIndex&index,int role)const
- {
- /*587:*/
- #line 12888 "./typica.w"
-
- bool valid= false;
- if(index.isValid())
- {
- if(index.row()<modelData.size())
- {
- if(index.column()<colcount)
- {
- valid= true;
- }
- }
- }
-
- /*:587*/
- #line 12968 "./typica.w"
-
- if(!valid)
- {
- return QVariant();
- }
- QList<QMap<int,QVariant> > row= modelData.at(index.row());
- QMap<int,QVariant> cell= row.at(index.column());
- return cell.value(role,QVariant());
- }
-
- QVariant SaltModel::headerData(int section,Qt::Orientation orientation,
- int role)const
- {
- if(orientation==Qt::Horizontal&&role==Qt::DisplayRole&&
- section<colcount)
- {
- return QVariant(hData.at(section));
- }
- return QVariant();
- }
-
- /*:593*//*594:*/
- #line 12992 "./typica.w"
-
- Qt::ItemFlags SaltModel::flags(const QModelIndex&index)const
- {
- /*587:*/
- #line 12888 "./typica.w"
-
- bool valid= false;
- if(index.isValid())
- {
- if(index.row()<modelData.size())
- {
- if(index.column()<colcount)
- {
- valid= true;
- }
- }
- }
-
- /*:587*/
- #line 12995 "./typica.w"
-
- if(valid)
- {
- return Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable|Qt::ItemIsDropEnabled;
- }
- return 0;
- }
-
- /*:594*//*595:*/
- #line 13006 "./typica.w"
-
- QModelIndex SaltModel::index(int row,int column,
- const QModelIndex&parent)const
- {
- if(parent==QModelIndex())
- {
- if(row<modelData.size()&&column<colcount)
- {
- return createIndex(row,column);
- }
- }
- return QModelIndex();
- }
-
- /*:595*//*596:*/
- #line 13024 "./typica.w"
-
- void SaltModel::clear()
- {
- beginResetModel();
- modelData.clear();
- /*588:*/
- #line 12904 "./typica.w"
-
- QList<QMap<int,QVariant> > newRow;
- QMap<int,QVariant> defaults;
- for(int i= 0;i<colcount;i++)
- {
- newRow.append(defaults);
- }
- modelData.append(newRow);
-
- /*:588*/
- #line 13029 "./typica.w"
-
- endResetModel();
- }
-
- /*:596*//*597:*/
- #line 13038 "./typica.w"
-
- bool SaltModel::removeRows(int row,int count,
- const QModelIndex&parent)
- {
- if(parent==QModelIndex())
- {
- if(row>=0&&count> 0&&(row+count-1)<modelData.size())
- {
- beginRemoveRows(parent,row,row+count-1);
- for(int i= 0;i<count;i++)
- {
- modelData.removeAt(row);
- }
- endRemoveRows();
- if(modelData.size()==0)
- {
- beginInsertRows(parent,0,0);
- /*588:*/
- #line 12904 "./typica.w"
-
- QList<QMap<int,QVariant> > newRow;
- QMap<int,QVariant> defaults;
- for(int i= 0;i<colcount;i++)
- {
- newRow.append(defaults);
- }
- modelData.append(newRow);
-
- /*:588*/
- #line 13055 "./typica.w"
-
- endInsertRows();
- }
- return true;
- }
- }
- return false;
- }
-
- /*:597*//*598:*/
- #line 13069 "./typica.w"
-
- int SaltModel::findData(const QVariant&value,int column,int role)
- {
- for(int i= 0;i<modelData.size();i++)
- {
- if(modelData.at(i).size()> column)
- {
- if(modelData.at(i).at(column).contains(role))
- {
- if(modelData.at(i).at(column).value(role)==value)
- {
- return i;
- }
- }
- }
- }
- return-1;
- }
-
- /*:598*/
- #line 561 "./typica.w"
-
- /*600:*/
- #line 13133 "./typica.w"
-
- SqlComboBox*SqlComboBox::clone(QWidget*parent)
- {
- SqlComboBox*widget= new SqlComboBox();
- widget->setParent(parent);
- for(int i= 0;i<count();i++)
- {
- widget->addItem(itemText(i),itemData(i));
- }
- return widget;
- }
-
- /*:600*//*601:*/
- #line 13150 "./typica.w"
-
- void SqlComboBox::showData(bool show)
- {
- dataColumnShown= show;
- }
-
- /*:601*//*602:*/
- #line 13164 "./typica.w"
-
- void SqlComboBox::addNullOption()
- {
- addItem(specialNullText,specialNullData);
- }
-
- void SqlComboBox::setNullText(QString nullText)
- {
- specialNullText= nullText;
- }
-
- void SqlComboBox::setNullData(QVariant nullData)
- {
- specialNullData= nullData;
- }
-
- /*:602*//*603:*/
- #line 13187 "./typica.w"
-
- void SqlComboBox::setDataColumn(int column)
- {
- dataColumn= column;
- }
-
- void SqlComboBox::setDisplayColumn(int column)
- {
- displayColumn= column;
- }
-
- /*:603*//*604:*/
- #line 13201 "./typica.w"
-
- void SqlComboBox::addSqlOptions(QString query)
- {
- SqlQueryConnection h;
- QSqlQuery*dbquery= h.operator->();
- if(!dbquery->exec(query))
- {
- QSqlError error= dbquery->lastError();
- qDebug()<<error.databaseText();
- qDebug()<<error.driverText();
- qDebug()<<error.text();
- qDebug()<<dbquery->lastQuery();
-
- }
- while(dbquery->next())
- {
- QString displayValue(dbquery->value(displayColumn).toString());
- QString dataValue(dbquery->value(dataColumn).toString());
- if(dataColumnShown)
- {
- displayValue.append(QString(" (%1)").arg(dataValue));
- }
- addItem(displayValue,dataValue);
- }
- }
-
- /*:604*//*605:*/
- #line 13237 "./typica.w"
-
- SqlComboBox::SqlComboBox():
- dataColumn(0),displayColumn(0),dataColumnShown(false),
- specialNullText(tr("Unknown")),specialNullData(QVariant::String)
- {
- view()->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
- }
-
- SqlComboBox::~SqlComboBox()
- {
-
- }
-
- /*:605*/
- #line 562 "./typica.w"
-
- /*607:*/
- #line 13276 "./typica.w"
-
- void SqlComboBoxDelegate::setWidget(SqlComboBox*widget)
- {
- delegate= widget;
- }
-
- /*:607*//*608:*/
- #line 13285 "./typica.w"
-
- QWidget*SqlComboBoxDelegate::createEditor(QWidget*parent,
- const QStyleOptionViewItem&,
- const QModelIndex&)const
- {
- return delegate->clone(parent);
- }
-
- /*:608*//*609:*/
- #line 13296 "./typica.w"
-
- void SqlComboBoxDelegate::setEditorData(QWidget*editor,
- const QModelIndex&index)const
- {
- SqlComboBox*self= qobject_cast<SqlComboBox*> (editor);
- self->setCurrentIndex(self->findData(
- index.model()->data(index,
- Qt::UserRole).toString()));
- }
-
- /*:609*//*610:*/
- #line 13309 "./typica.w"
-
- void SqlComboBoxDelegate::setModelData(QWidget*editor,
- QAbstractItemModel*model,
- const QModelIndex&index)const
- {
- SqlComboBox*self= qobject_cast<SqlComboBox*> (editor);
- model->setData(index,self->itemData(self->currentIndex(),Qt::UserRole),
- Qt::UserRole);
- model->setData(index,self->currentText(),Qt::DisplayRole);
- }
-
- /*:610*//*611:*/
- #line 13322 "./typica.w"
-
- void SqlComboBoxDelegate::updateEditorGeometry(QWidget*editor,
- const QStyleOptionViewItem&option,
- const QModelIndex&)const
- {
- editor->setGeometry(option.rect);
- }
-
- /*:611*//*612:*/
- #line 13333 "./typica.w"
-
- QSize SqlComboBoxDelegate::sizeHint()const
- {
- return delegate->sizeHint();
- }
-
- /*:612*//*613:*/
- #line 13341 "./typica.w"
-
- SqlComboBoxDelegate::SqlComboBoxDelegate(QObject*parent)
- :QItemDelegate(parent)
- {
-
- }
-
- /*:613*/
- #line 563 "./typica.w"
-
- /*576:*/
- #line 12603 "./typica.w"
-
- Application::Application(int&argc,char**argv):QApplication(argc,argv)
- {
- /*577:*/
- #line 12618 "./typica.w"
-
- setOrganizationName("Wilson's Coffee & Tea");
- setOrganizationDomain("wilsonscoffee.com");
- setApplicationName(PROGRAM_NAME);
-
- /*:577*/
- #line 12606 "./typica.w"
-
- /*578:*/
- #line 12627 "./typica.w"
-
- QTranslator*base= new QTranslator;
- if(base->load(QString("qt_%1").arg(QLocale::system().name()),QString("%1/Translations").arg(QCoreApplication::applicationDirPath())))
- {
- installTranslator(base);
- }
- QTranslator*app= new QTranslator;
- if(app->load(QString("%1_%2").arg("Typica").arg(QLocale::system().name()),QString("%1/Translations").arg(QCoreApplication::applicationDirPath())))
- {
- installTranslator(app);
- }
-
- /*:578*/
- #line 12607 "./typica.w"
-
- /*295:*/
- #line 123 "./measurement.w"
-
- qRegisterMetaType<Measurement> ("Measurement");
-
- /*:295*/
- #line 12608 "./typica.w"
-
- /*784:*/
- #line 16622 "./typica.w"
-
- NodeInserter*inserter= new NodeInserter(tr("NI DAQmx Base Device"),
- tr("NI DAQmx Base"),
- "nidaqmxbase",NULL);
- topLevelNodeInserters.append(inserter);
-
- /*:784*//*792:*/
- #line 16853 "./typica.w"
-
- #ifdef Q_OS_WIN32
- inserter= new NodeInserter(tr("NI DAQmx Device"),tr("NI DAQmx"),"nidaqmx",NULL);
- topLevelNodeInserters.append(inserter);
- #endif
-
- /*:792*//*816:*/
- #line 17816 "./typica.w"
-
- #if 0
- inserter= new NodeInserter(tr("Modbus RTU Port"),tr("Modbus RTU Port"),"modbusrtuport",NULL);
- topLevelNodeInserters.append(inserter);
- #endif
-
- /*:816*//*865:*/
- #line 19329 "./typica.w"
-
- inserter= new NodeInserter(tr("Modbus RTU Device"),tr("Modbus RTU Device"),"modbusrtu",NULL);
- topLevelNodeInserters.append(inserter);
-
- #line 1 "./unsupportedserial.w"
- /*:865*//*875:*/
- #line 272 "./unsupportedserial.w"
-
- inserter= new NodeInserter(tr("Other Device"),tr("Other Device"),
- "unsupporteddevice",NULL);
- topLevelNodeInserters.append(inserter);
-
- /*:875*//*909:*/
- #line 190 "./phidgets.w"
-
- QLibrary phidgetsCheck("phidget21");
- if(phidgetsCheck.load())
- {
- inserter= new NodeInserter(tr("Phidgets 1048"),tr("Phidgets 1048"),
- "phidgets1048",NULL);
- topLevelNodeInserters.append(inserter);
- phidgetsCheck.unload();
- }
- else
- {
- phidgetsCheck.setFileName("Phidget21.framework/Phidget21");
- if(phidgetsCheck.load())
- {
- inserter= new NodeInserter(tr("Phidgets 1048"),tr("Phidgets 1048"),
- "phidgets1048",NULL);
- topLevelNodeInserters.append(inserter);
- phidgetsCheck.unload();
- }
- }
-
- /*:909*//*1000:*/
- #line 1241 "./dataqsdk.w"
-
- #ifdef Q_OS_WIN32
- inserter= new NodeInserter(tr("DATAQ SDK Device"),tr("DATAQ Device"),
- "dataqsdk",NULL);
- topLevelNodeInserters.append(inserter);
- #endif
-
- #line 19979 "./typica.w"
-
- #line 1 "./scales.w"
- /*:1000*//*1025:*/
- #line 495 "./scales.w"
-
- inserter= new NodeInserter(tr("Serial Scale"),tr("Scale"),"scale",NULL);
- topLevelNodeInserters.append(inserter);
-
- #line 19981 "./typica.w"
-
- #line 1 "./valueannotation.w"
- /*:1025*/
- #line 12609 "./typica.w"
-
- }
-
- /*:576*//*580:*/
- #line 12650 "./typica.w"
-
- QDomDocument*Application::configuration()
- {
- return&conf;
- }
-
- /*:580*//*581:*/
- #line 12659 "./typica.w"
-
- QSqlDatabase Application::database()
- {
- QString connectionName;
- QSqlDatabase connection=
- QSqlDatabase::database(QLatin1String(QSqlDatabase::defaultConnection),false);
- do
- {
- connectionName= QUuid::createUuid().toString();
- }while(QSqlDatabase::connectionNames().contains(connectionName));
- return QSqlDatabase::cloneDatabase(connection,QString(connectionName));
- }
-
- /*:581*//*719:*/
- #line 15155 "./typica.w"
-
- void Application::saveDeviceConfiguration()
- {
- QSettings settings;
- settings.setValue("DeviceConfiguration",
- QVariant(deviceConfigurationDocument.toByteArray()));
- }
-
- /*:719*//*720:*/
- #line 15167 "./typica.w"
-
- QDomDocument Application::deviceConfiguration()
- {
- if(deviceConfigurationDocument.isNull())
- {
- /*721:*/
- #line 15181 "./typica.w"
-
- QSettings settings;
- QByteArray document= settings.value("DeviceConfiguration").toByteArray();
- QString etext;
- int eline;
- int ecol;
- if(document.length()==0)
- {
- qDebug()<<"Loaded settings length is 0. Creating new configuration.";
- /*722:*/
- #line 15205 "./typica.w"
-
- QFile emptyDocument(":/resources/xml/EmptyDeviceConfiguration.xml");
- emptyDocument.open(QIODevice::ReadOnly);
- if(!deviceConfigurationDocument.setContent(&emptyDocument,false,
- &etext,&eline,&ecol))
- {
- /*723:*/
- #line 15222 "./typica.w"
-
- qDebug()<<QString(tr("An error occurred loading device configuration."));
- qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
- qDebug()<<etext;
-
- /*:723*/
- #line 15211 "./typica.w"
-
- }
- else
- {
- saveDeviceConfiguration();
- }
-
- /*:722*/
- #line 15190 "./typica.w"
-
- }
- else
- {
- if(!deviceConfigurationDocument.setContent(document,false,
- &etext,&eline,&ecol))
- {
- /*723:*/
- #line 15222 "./typica.w"
-
- qDebug()<<QString(tr("An error occurred loading device configuration."));
- qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
- qDebug()<<etext;
-
- /*:723*/
- #line 15197 "./typica.w"
-
- /*722:*/
- #line 15205 "./typica.w"
-
- QFile emptyDocument(":/resources/xml/EmptyDeviceConfiguration.xml");
- emptyDocument.open(QIODevice::ReadOnly);
- if(!deviceConfigurationDocument.setContent(&emptyDocument,false,
- &etext,&eline,&ecol))
- {
- /*723:*/
- #line 15222 "./typica.w"
-
- qDebug()<<QString(tr("An error occurred loading device configuration."));
- qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
- qDebug()<<etext;
-
- /*:723*/
- #line 15211 "./typica.w"
-
- }
- else
- {
- saveDeviceConfiguration();
- }
-
- /*:722*/
- #line 15198 "./typica.w"
-
- }
- }
-
- /*:721*/
- #line 15172 "./typica.w"
-
- }
- return deviceConfigurationDocument;
- }
-
- /*:720*//*751:*/
- #line 15823 "./typica.w"
-
- void Application::registerDeviceConfigurationWidget(QString driver,
- QMetaObject widget)
- {
- deviceConfigurationWidgets.insert(driver,widget);
- }
-
- /*:751*//*752:*/
- #line 15839 "./typica.w"
-
- QWidget*Application::deviceConfigurationWidget(DeviceTreeModel*model,
- const QModelIndex&index)
- {
- QVariant nodeReference= index.data(Qt::UserRole);
- QDomElement referenceElement= model->referenceElement(
- model->data(index,Qt::UserRole).toString());
- QMetaObject metaObject=
- deviceConfigurationWidgets.value(referenceElement.attribute("driver"),
- QWidget::staticMetaObject);
- QWidget*editor;
- if(metaObject.className()==QWidget::staticMetaObject.className())
- {
- editor= NULL;
- }
- else
- {
- editor= qobject_cast<QWidget*> (
- metaObject.newInstance(Q_ARG(DeviceTreeModel*,model),
- Q_ARG(QModelIndex,index)));
- }
- return editor;
- }
-
- /*:752*/
- #line 564 "./typica.w"
-
- /*622:*/
- #line 13489 "./typica.w"
-
- SqlConnectionSetup::SqlConnectionSetup():
- formLayout(new QFormLayout),driver(new QComboBox),hostname(new QLineEdit),
- portnumber(new QLineEdit),
- dbname(new QLineEdit),user(new QLineEdit),password(new QLineEdit),
- layout(new QVBoxLayout),buttons(new QHBoxLayout),
- cancelButton(new QPushButton(tr("Cancel"))),
- connectButton(new QPushButton(tr("Connect")))
- {
- driver->addItem("PostgreSQL","QPSQL");
- formLayout->addRow(tr("Database driver:"),driver);
- formLayout->addRow(tr("Host name:"),hostname);
- formLayout->addRow(tr("Port number:"),portnumber);
- portnumber->setText("5432");
- formLayout->addRow(tr("Database name:"),dbname);
- formLayout->addRow(tr("User name:"),user);
- password->setEchoMode(QLineEdit::Password);
- formLayout->addRow(tr("Password:"),password);
- layout->addLayout(formLayout);
- buttons->addStretch(1);
- buttons->addWidget(cancelButton);
- connect(cancelButton,SIGNAL(clicked(bool)),this,SLOT(reject()));
- buttons->addWidget(connectButton);
- layout->addLayout(buttons);
- connect(connectButton,SIGNAL(clicked(bool)),this,SLOT(testConnection()));
- connectButton->setDefault(true);
- setLayout(layout);
- setModal(true);
- }
-
- SqlConnectionSetup::~SqlConnectionSetup()
- {
-
- }
-
- /*:622*//*623:*/
- #line 13527 "./typica.w"
-
- void SqlConnectionSetup::testConnection()
- {
- QSqlDatabase database=
- QSqlDatabase::addDatabase(driver->itemData(driver->currentIndex()).
- toString());
- database.setConnectOptions("application_name=Typica");
- database.setHostName(hostname->text());
- database.setPort(portnumber->text().toInt());
- database.setDatabaseName(dbname->text());
- database.setUserName(user->text());
- database.setPassword(password->text());
- if(database.open())
- {
- QSettings settings;
- settings.setValue("database/exists","true");
- settings.setValue("database/driver",
- driver->itemData(driver->currentIndex()).toString());
- settings.setValue("database/hostname",hostname->text());
- settings.setValue("database/portnumber",portnumber->text());
- settings.setValue("database/dbname",dbname->text());
- settings.setValue("database/user",user->text());
- settings.setValue("database/password",password->text());
- database.close();
- accept();
- }
- else
- {
- QMessageBox::information(this,tr("Database connection failed"),
- tr("Failed to connect to database."));
- }
- }
-
- /*:623*/
- #line 565 "./typica.w"
-
- /*627:*/
- #line 13632 "./typica.w"
-
- SqlQueryView::SqlQueryView(QWidget*parent):QTableView(parent)
- {
- setModel(new QSqlQueryModel);
- connect(this,SIGNAL(doubleClicked(QModelIndex)),
- this,SLOT(openRow(QModelIndex)));
- connect(horizontalHeader(),SIGNAL(sectionResized(int,int,int)),
- this,SLOT(persistColumnResize(int,int,int)));
- }
-
- /*:627*//*628:*/
- #line 13647 "./typica.w"
-
- void SqlQueryView::persistColumnResize(int column,int,int newsize)
- {
- /*629:*/
- #line 13656 "./typica.w"
-
- QSettings settings;
- /*630:*/
- #line 13669 "./typica.w"
-
- QWidget*topLevelWidget= this;
- while(topLevelWidget->parentWidget())
- {
- topLevelWidget= topLevelWidget->parentWidget();
- }
-
- /*:630*/
- #line 13658 "./typica.w"
-
- settings.setValue(QString("columnWidths/%1/%2/%3").
- arg(topLevelWidget->objectName()).
- arg(objectName()).arg(column),
- QVariant(newsize));
-
- /*:629*/
- #line 13650 "./typica.w"
-
- }
-
- /*:628*//*631:*/
- #line 13679 "./typica.w"
-
- void SqlQueryView::showEvent(QShowEvent*event)
- {
- /*632:*/
- #line 13689 "./typica.w"
-
- QSettings settings;
- /*630:*/
- #line 13669 "./typica.w"
-
- QWidget*topLevelWidget= this;
- while(topLevelWidget->parentWidget())
- {
- topLevelWidget= topLevelWidget->parentWidget();
- }
-
- /*:630*/
- #line 13691 "./typica.w"
-
- QString baseKey=
- QString("columnWidths/%1/%2").arg(topLevelWidget->objectName()).
- arg(objectName());
- for(int i= 0;i<model()->columnCount();i++)
- {
- QString key= QString("%1/%2").arg(baseKey).arg(i);
- if(settings.contains(key))
- {
- setColumnWidth(i,settings.value(key).toInt());
- }
- }
-
- /*:632*/
- #line 13682 "./typica.w"
-
- event->accept();
- }
-
- /*:631*//*633:*/
- #line 13706 "./typica.w"
-
- void SqlQueryView::openRow(const QModelIndex&index)
- {
- emit openEntry(((QSqlQueryModel*)model())->record(index.row()).value(0).toString());
- emit openEntryRow(index.row());
- }
-
- /*:633*//*634:*/
- #line 13715 "./typica.w"
-
- void SqlQueryView::setQuery(const QString&query)
- {
- QSqlDatabase database= AppInstance->database();
- database.open();
- QSqlQuery q(query,database);
- ((QSqlQueryModel*)model())->setQuery(q);
- database.close();
- }
-
- bool SqlQueryView::setHeaderData(int section,Qt::Orientation orientation,
- const QVariant&value,int role)
- {
- return model()->setHeaderData(section,orientation,value,role);
- }
-
- /*:634*//*635:*/
- #line 13733 "./typica.w"
-
- QVariant SqlQueryView::data(int row,int column,int role)
- {
- return model()->data(model()->index(row,column),role);
- }
-
- /*:635*/
- #line 566 "./typica.w"
-
- /*170:*/
- #line 3936 "./typica.w"
-
- SqlQueryConnection::SqlQueryConnection(const QString&query)
- {
- QSqlDatabase database= AppInstance->database();
- database.open();
- q= new QSqlQuery(query,database);
- connection= database.connectionName();
- }
-
- /*:170*//*171:*/
- #line 3949 "./typica.w"
-
- SqlQueryConnection::~SqlQueryConnection()
- {
- delete q;
- {
- QSqlDatabase database= QSqlDatabase::database(connection);
- database.close();
- }
- QSqlDatabase::removeDatabase(connection);
- }
-
- /*:171*//*172:*/
- #line 3963 "./typica.w"
-
- QSqlQuery*SqlQueryConnection::operator->()const
- {
- return q;
- }
-
- /*:172*/
- #line 567 "./typica.w"
-
- /*654:*/
- #line 14092 "./typica.w"
-
- ReportTable::ReportTable(QTextFrame*frame,QDomElement description):
- area(frame),configuration(description)
- {
- refresh();
- }
-
- ReportTable::~ReportTable()
- {
-
- }
-
- /*:654*//*655:*/
- #line 14108 "./typica.w"
-
- void ReportTable::bind(QString placeholder,QVariant value)
- {
- bindings.insert(placeholder,value);
- }
-
- /*:655*//*656:*/
- #line 14118 "./typica.w"
-
- void ReportTable::refresh()
- {
- /*657:*/
- #line 14139 "./typica.w"
-
- QTextCursor cursor= area->firstCursorPosition();
- while(cursor<area->lastCursorPosition())
- {
- cursor.movePosition(QTextCursor::Right,QTextCursor::KeepAnchor);
- }
- cursor.removeSelectedText();
-
- /*:657*/
- #line 14121 "./typica.w"
-
- int rows= 1;
- int columns= 1;
- int currentRow= 0;
- QTextTable*table= cursor.insertTable(rows,columns);
- /*658:*/
- #line 14152 "./typica.w"
-
- QTextTableFormat format= table->format();
- format.setBorderStyle(QTextFrameFormat::BorderStyle_None);
- if(configuration.hasAttribute("align"))
- {
- if(configuration.attribute("align")=="center")
- {
- format.setAlignment(Qt::AlignHCenter);
- }
- }
- table->setFormat(format);
-
- /*:658*/
- #line 14126 "./typica.w"
-
- /*659:*/
- #line 14166 "./typica.w"
-
- QDomNodeList children= configuration.childNodes();
- for(int i= 0;i<children.count();i++)
- {
- QDomNode current;
- QDomElement currentElement;
- current= children.at(i);
- if(current.isElement())
- {
- currentElement= current.toElement();
- if(currentElement.tagName()=="query")
- {
- /*660:*/
- #line 14193 "./typica.w"
-
- SqlQueryConnection h;
- QSqlQuery*query= h.operator->();
- query->prepare(currentElement.text());
- foreach(QString key,bindings.uniqueKeys())
- {
- if(currentElement.text().contains(key))
- {
- query->bindValue(key,bindings.value(key));
- }
- }
- query->exec();
- if(!query->next())
- {
- continue;
- }
- if(query->record().count()> columns)
- {
- table->appendColumns(query->record().count()-columns);
- }
- do
- {
- table->appendRows(1);
- rows++;
- currentRow++;
- for(int j= 0;j<query->record().count();j++)
- {
- QTextTableCell cell= table->cellAt(currentRow,j);
- cursor= cell.firstCursorPosition();
- cursor.insertText(query->value(j).toString());
- }
- }while(query->next());
-
- /*:660*/
- #line 14178 "./typica.w"
-
- }
- else if(currentElement.tagName()=="row")
- {
- /*661:*/
- #line 14233 "./typica.w"
-
- table->appendRows(1);
- currentRow++;
- rows++;
- QDomNodeList rowChildren= currentElement.childNodes();
- int currentColumn= 0;
- for(int j= 0;j<rowChildren.count();j++)
- {
- QDomNode node;
- QDomElement nodeElement;
- node= rowChildren.at(j);
- if(node.isElement())
- {
- nodeElement= node.toElement();
- if(nodeElement.tagName()=="cell")
- {
- if(currentColumn==columns)
- {
- table->appendColumns(1);
- columns++;
- }
- QTextTableCell cell= table->cellAt(currentRow,currentColumn);
- cursor= cell.firstCursorPosition();
- cursor.insertText(nodeElement.text());
- currentColumn++;
- }
- }
- }
-
- /*:661*/
- #line 14182 "./typica.w"
-
- }
- }
- }
-
- /*:659*/
- #line 14127 "./typica.w"
-
- if(rows> 1)
- {
- table->removeRows(0,1);
- }
- }
-
- /*:656*/
- #line 568 "./typica.w"
-
- /*687:*/
- #line 14337 "./typica.w"
-
- FormArray::FormArray(QDomElement description):configuration(description),
- maxwidth(-1),maxheight(-1)
- {
- setWidget(&itemContainer);
- itemContainer.setLayout(&itemLayout);
- }
-
- /*:687*//*688:*/
- #line 14354 "./typica.w"
-
- void FormArray::addElements(int copies)
- {
- QStack<QWidget*> *widgetStack= new QStack<QWidget*> ;
- QStack<QLayout*> *layoutStack= new QStack<QLayout*> ;
- QWidget*widget;
- for(int i= 0;i<copies;i++)
- {
- widget= new QWidget;
- if(maxwidth> -1)
- {
- widget->setMaximumWidth(maxwidth);
- }
- if(maxheight> -1)
- {
- widget->setMaximumHeight(maxheight);
- }
- if(configuration.hasChildNodes())
- {
- widgetStack->push(widget);
- populateWidget(configuration,widgetStack,layoutStack);
- widgetStack->pop();
- widget->setMinimumHeight(widget->sizeHint().height());
- itemLayout.addWidget(widget);
- if(widget->sizeHint().height()> maxheight&&maxheight> -1)
- {
- itemContainer.setMinimumHeight(maxheight*elements()+50);
- }
- else
- {
- itemContainer.setMinimumHeight(itemContainer.sizeHint().height()
- +widget->sizeHint().height());
- }
- if(maxwidth> -1)
- {
- itemContainer.setMinimumWidth(maxwidth+50);
- }
- else
- {
- itemContainer.setMinimumWidth(widget->sizeHint().width()+50);
- }
- }
- }
- }
-
- /*:688*//*689:*/
- #line 14404 "./typica.w"
-
- QWidget*FormArray::elementAt(int index)
- {
- if(index<itemLayout.count())
- {
- QLayoutItem*item= itemLayout.itemAt(index);
- return item->widget();
- }
- else
- {
- return NULL;
- }
- }
-
- /*:689*//*690:*/
- #line 14421 "./typica.w"
-
- void FormArray::removeAllElements()
- {
- while(itemLayout.count()> 0)
- {
- QLayoutItem*item;
- item= itemLayout.itemAt(0);
- item->widget()->hide();
- itemLayout.removeWidget(item->widget());
- }
- itemContainer.setMinimumHeight(0);
- }
-
- /*:690*//*691:*/
- #line 14437 "./typica.w"
-
- int FormArray::elements()
- {
- return itemLayout.count();
- }
-
- /*:691*//*692:*/
- #line 14448 "./typica.w"
-
- void FormArray::setMaximumElementWidth(int width)
- {
- maxwidth= width;
- }
-
- void FormArray::setMaximumElementHeight(int height)
- {
- maxheight= height;
- }
-
- /*:692*/
- #line 569 "./typica.w"
-
- /*698:*/
- #line 14579 "./typica.w"
-
- ScaleControl::ScaleControl():QGraphicsView(NULL,NULL),nonScoredValue(-1),
- scoredValue(-1),initialSet(false),finalSet(false),scaleDown(false)
- {
- left<<QPointF(0,5)<<QPointF(10,0)<<QPointF(10,10)<<
- QPointF(0,5);
- right<<QPointF(10,5)<<QPointF(0,0)<<QPointF(0,10)<<
- QPointF(10,5);
- down<<QPointF(0,0)<<QPointF(-5,-10)<<QPointF(5,-10)<<
- QPointF(0,0);
- up<<QPointF(0,0)<<QPointF(-5,10)<<QPointF(4,10)<<QPointF(0,0);
- initialBrush.setColor(QColor(170,170,255));
- initialBrush.setStyle(Qt::SolidPattern);
- finalBrush.setColor(Qt::blue);
- finalBrush.setStyle(Qt::SolidPattern);
- initialDecrement.setPolygon(left);
- initialDecrement.setBrush(initialBrush);
- initialDecrement.setPos(0,0);
- scene.addItem(&initialDecrement);
- initialIncrement.setPolygon(right);
- initialIncrement.setBrush(initialBrush);
- initialIncrement.setPos(122,0);
- scene.addItem(&initialIncrement);
- finalDecrement.setPolygon(left);
- finalDecrement.setBrush(finalBrush);
- finalDecrement.setPos(0,12);
- scene.addItem(&finalDecrement);
- finalIncrement.setPolygon(right);
- finalIncrement.setBrush(finalBrush);
- finalIncrement.setPos(122,12);
- scene.addItem(&finalIncrement);
- scalePath.moveTo(0,10);
- scalePath.lineTo(100,10);
- scalePath.moveTo(0,0);
- scalePath.lineTo(0,20);
- scalePath.moveTo(10,5);
- scalePath.lineTo(10,15);
- scalePath.moveTo(20,5);
- scalePath.lineTo(20,15);
- scalePath.moveTo(30,5);
- scalePath.lineTo(30,15);
- scalePath.moveTo(40,5);
- scalePath.lineTo(40,15);
- scalePath.moveTo(50,0);
- scalePath.lineTo(50,20);
- scalePath.moveTo(60,5);
- scalePath.lineTo(60,15);
- scalePath.moveTo(70,5);
- scalePath.lineTo(70,15);
- scalePath.moveTo(80,5);
- scalePath.lineTo(80,15);
- scalePath.moveTo(90,5);
- scalePath.lineTo(90,15);
- scalePath.moveTo(100,0);
- scalePath.lineTo(100,20);
- scaleLine.setPath(scalePath);
- scaleLine.setPos(16,1);
- scene.addItem(&scaleLine);
- setScene(&scene);
- initialIndicator.setPolygon(down);
- initialIndicator.setBrush(initialBrush);
- finalIndicator.setPolygon(up);
- finalIndicator.setBrush(finalBrush);
- setMinimumSize(sizeHint());
- setMaximumSize(sizeHint());
- setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- setMinimumSize(sizeHint());
- }
-
- /*:698*//*699:*/
- #line 14652 "./typica.w"
-
- QSize ScaleControl::sizeHint()const
- {
- return QSize(140,30);
- }
-
- /*:699*//*700:*/
- #line 14661 "./typica.w"
-
- void ScaleControl::setInitialValue(double value)
- {
- if(value>=0&&value<=10)
- {
- nonScoredValue= value;
- if(!initialSet)
- {
- scene.addItem(&initialIndicator);
- }
- initialSet= true;
- initialIndicator.setPos(value*10+16,10);
- emit initialChanged(value);
- if(!finalSet)
- {
- setFinalValue(value);
- }
- }
- }
-
- void ScaleControl::setFinalValue(double value)
- {
- if(value>=0&&value<=10)
- {
- scoredValue= value;
- if(!finalSet)
- {
- scene.addItem(&finalIndicator);
- }
- finalSet= true;
- finalIndicator.setPos(value*10+16,11);
- emit finalChanged(value);
- }
- }
-
- /*:700*//*701:*/
- #line 14698 "./typica.w"
-
- double ScaleControl::initialValue(void)
- {
- return nonScoredValue;
- }
-
- double ScaleControl::finalValue(void)
- {
- return scoredValue;
- }
-
- /*:701*//*702:*/
- #line 14719 "./typica.w"
-
- void ScaleControl::mousePressEvent(QMouseEvent*event)
- {
- /*703:*/
- #line 14731 "./typica.w"
-
- if(event->button()!=Qt::LeftButton)
- {
- event->ignore();
- return;
- }
-
- /*:703*/
- #line 14722 "./typica.w"
-
- scaleDown= true;
- event->accept();
- }
-
- /*:702*//*704:*/
- #line 14742 "./typica.w"
-
- void ScaleControl::mouseReleaseEvent(QMouseEvent*event)
- {
- /*703:*/
- #line 14731 "./typica.w"
-
- if(event->button()!=Qt::LeftButton)
- {
- event->ignore();
- return;
- }
-
- /*:703*/
- #line 14745 "./typica.w"
-
- if(!scaleDown)
- {
- event->ignore();
- return;
- }
- scaleDown= false;
- QPointF sceneCoordinate= mapToScene(event->x(),event->y());
- /*705:*/
- #line 14767 "./typica.w"
-
- if(sceneCoordinate.x()>=0&&sceneCoordinate.x()<=10)
- {
- if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
- {
- if(initialSet)
- {
- setInitialValue(nonScoredValue-0.05);
- }
- event->accept();
- return;
- }
- else if(sceneCoordinate.y()>=12&&sceneCoordinate.y()<=22)
- {
- if(finalSet)
- {
- setFinalValue(scoredValue-0.05);
- event->accept();
- return;
- }
- }
- }
-
- /*:705*/
- #line 14753 "./typica.w"
-
- /*706:*/
- #line 14793 "./typica.w"
-
- else if(sceneCoordinate.x()>=122&&sceneCoordinate.x()<=132)
- {
- if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
- {
- if(initialSet)
- {
- setInitialValue(nonScoredValue+0.05);
- event->accept();
- return;
- }
- }
- else if(sceneCoordinate.y()>=12&&sceneCoordinate.y()<=22)
- {
- if(finalSet)
- {
- setFinalValue(scoredValue+0.05);
- event->accept();
- return;
- }
- }
- }
-
- /*:706*/
- #line 14754 "./typica.w"
-
- /*707:*/
- #line 14819 "./typica.w"
-
- double relativeX= sceneCoordinate.x()-16;
- if(initialSet)
- {
- if(relativeX>=0&&relativeX<=100)
- {
- setFinalValue(relativeX/10.0);
- event->accept();
- return;
- }
- }
- else
- {
- if(relativeX>=0&&relativeX<=100)
- {
- setInitialValue(relativeX/10.0);
- event->accept();
- return;
- }
- }
-
- /*:707*/
- #line 14755 "./typica.w"
-
- event->ignore();
- return;
- }
-
- /*:704*/
- #line 570 "./typica.w"
-
- /*709:*/
- #line 14885 "./typica.w"
-
- IntensityControl::IntensityControl():QGraphicsView(NULL,NULL),theValue(-1),
- valueSet(false),scaleDown(false)
- {
- setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- left<<QPointF(0,0)<<QPointF(10,-5)<<QPointF(10,5)<<QPointF(0,0);
- down<<QPointF(0,0)<<QPointF(10,0)<<QPointF(5,10)<<QPointF(0,0);
- up<<QPointF(0,10)<<QPointF(10,10)<<QPointF(5,0)<<QPointF(0,10);
- theBrush.setColor(Qt::blue);
- theBrush.setStyle(Qt::SolidPattern);
- increment.setPolygon(up);
- increment.setBrush(theBrush);
- increment.setPos(0,0);
- scene.addItem(&increment);
- decrement.setPolygon(down);
- decrement.setBrush(theBrush);
- decrement.setPos(0,122);
- scene.addItem(&decrement);
- scalePath.moveTo(5,0);
- scalePath.lineTo(5,100);
- scalePath.moveTo(0,0);
- scalePath.lineTo(10,0);
- scalePath.moveTo(0,10);
- scalePath.lineTo(10,10);
- scalePath.moveTo(0,20);
- scalePath.lineTo(10,20);
- scalePath.moveTo(0,30);
- scalePath.lineTo(10,30);
- scalePath.moveTo(0,40);
- scalePath.lineTo(10,40);
- scalePath.moveTo(0,50);
- scalePath.lineTo(10,50);
- scalePath.moveTo(0,60);
- scalePath.lineTo(10,60);
- scalePath.moveTo(0,70);
- scalePath.lineTo(10,70);
- scalePath.moveTo(0,80);
- scalePath.lineTo(10,80);
- scalePath.moveTo(0,90);
- scalePath.lineTo(10,90);
- scalePath.moveTo(0,100);
- scalePath.lineTo(10,100);
- scaleLine.setPath(scalePath);
- scaleLine.setPos(0,16);
- scene.addItem(&scaleLine);
- setScene(&scene);
- indicator.setPolygon(left);
- indicator.setBrush(theBrush);
- setMinimumSize(sizeHint());
- setMaximumSize(sizeHint());
- }
-
- /*:709*//*710:*/
- #line 14940 "./typica.w"
-
- QSize IntensityControl::sizeHint()const
- {
- return QSize(25,160);
- }
-
- /*:710*//*711:*/
- #line 14955 "./typica.w"
-
- void IntensityControl::setValue(double val)
- {
- if(val>=0&&val<=10)
- {
- theValue= val;
- if(!valueSet)
- {
- scene.addItem(&indicator);
- }
- valueSet= true;
- indicator.setPos(6,(100-(val*10))+16);
- emit(valueChanged(val));
- }
- else if(val<1)
- {
- setValue(0);
- }
- else
- {
- setValue(10);
- }
- }
-
- double IntensityControl::value()
- {
- return theValue;
- }
-
- /*:711*//*712:*/
- #line 14987 "./typica.w"
-
- void IntensityControl::mousePressEvent(QMouseEvent*event)
- {
- /*703:*/
- #line 14731 "./typica.w"
-
- if(event->button()!=Qt::LeftButton)
- {
- event->ignore();
- return;
- }
-
- /*:703*/
- #line 14990 "./typica.w"
-
- scaleDown= true;
- event->accept();
- }
-
- /*:712*//*713:*/
- #line 15001 "./typica.w"
-
- void IntensityControl::mouseReleaseEvent(QMouseEvent*event)
- {
- /*703:*/
- #line 14731 "./typica.w"
-
- if(event->button()!=Qt::LeftButton)
- {
- event->ignore();
- return;
- }
-
- /*:703*/
- #line 15004 "./typica.w"
-
- if(!scaleDown)
- {
- event->ignore();
- return;
- }
- scaleDown= false;
- QPointF sceneCoordinate= mapToScene(event->x(),event->y());
- if(sceneCoordinate.x()>=0&&sceneCoordinate.x()<=16)
- {
- if(sceneCoordinate.y()>=0&&sceneCoordinate.y()<=10)
- {
- if(valueSet)
- {
- setValue(theValue+0.05);
- }
- event->accept();
- return;
- }
- else if(sceneCoordinate.y()>=122&&sceneCoordinate.y()<=132)
- {
- if(valueSet)
- {
- setValue(theValue-0.05);
- }
- event->accept();
- return;
- }
- else if(sceneCoordinate.y()>=16&&sceneCoordinate.y()<=116)
- {
- setValue(10-((sceneCoordinate.y()-16)/10.0));
- event->accept();
- return;
- }
- }
- }
-
- /*:713*/
- #line 571 "./typica.w"
-
- /*364:*/
- #line 8230 "./typica.w"
-
- void ThresholdDetector::newMeasurement(Measurement measure)
- {
- if((currentDirection==Ascending&&previousValue<threshold&&
- previousValue>=0)||(currentDirection==Descending&&
- previousValue> threshold&&previousValue>=0))
- {
- if((currentDirection==Ascending&&measure.temperature()>=threshold)||
- (currentDirection==Descending&&measure.temperature()<=threshold))
- {
- double offset= measure.time().hour()*60*60;
- offset+= measure.time().minute()*60;
- offset+= measure.time().second();
- offset+= measure.time().msec()/1000;
- emit timeForValue(offset);
- }
- }
- previousValue= measure.temperature();
- }
-
- ThresholdDetector::ThresholdDetector(double value):QObject(NULL),
- previousValue(-1),threshold(value),currentDirection(Ascending)
- {
-
- }
-
- void ThresholdDetector::setThreshold(double value)
- {
- threshold= value;
- }
-
- void ThresholdDetector::setEdgeDirection(EdgeDirection direction)
- {
- currentDirection= direction;
- }
-
- /*:364*/
- #line 572 "./typica.w"
-
- /*795:*/
- #line 16893 "./typica.w"
-
- PortSelector::PortSelector(QWidget*parent):QComboBox(parent),
- lister(new QextSerialEnumerator)
- {
- QList<QextPortInfo> ports= QextSerialEnumerator::getPorts();
- QextPortInfo port;
- foreach(port,ports)
- {
- #ifdef Q_OS_WIN32
- addItem(port.portName);
- #else
- addItem(port.physName);
- #endif
- }
- lister->setUpNotifications();
- connect(lister,SIGNAL(deviceDiscovered(QextPortInfo)),
- this,SLOT(addDevice(QextPortInfo)));
- setEditable(true);
- }
-
- void PortSelector::addDevice(QextPortInfo port)
- {
- addItem(port.portName);
- }
-
- /*:795*/
- #line 573 "./typica.w"
-
- /*797:*/
- #line 16985 "./typica.w"
-
- BaudSelector::BaudSelector(QWidget*parent):QComboBox(parent)
- {
- QMetaObject meta= BaudSelector::staticMetaObject;
- QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("BaudRateType"));
- for(int i= 0;i<type.keyCount();i++)
- {
- addItem(QString("%1").arg(type.value(i)));
- }
- }
-
- /*:797*/
- #line 574 "./typica.w"
-
- /*799:*/
- #line 17023 "./typica.w"
-
- ParitySelector::ParitySelector(QWidget*parent):QComboBox(parent)
- {
- QMetaObject meta= ParitySelector::staticMetaObject;
- QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("ParityType"));
- for(int i= 0;i<type.keyCount();i++)
- {
- addItem(QString(type.key(i)),QVariant(type.value(i)));
- }
- }
-
- /*:799*/
- #line 575 "./typica.w"
-
- /*801:*/
- #line 17053 "./typica.w"
-
- FlowSelector::FlowSelector(QWidget*parent):QComboBox(parent)
- {
- QMetaObject meta= FlowSelector::staticMetaObject;
- QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("FlowType"));
- for(int i= 0;i<type.keyCount();i++)
- {
- addItem(QString(type.key(i)),QVariant(type.value(i)));
- }
- }
-
- /*:801*/
- #line 576 "./typica.w"
-
- /*803:*/
- #line 17088 "./typica.w"
-
- StopSelector::StopSelector(QWidget*parent):QComboBox(parent)
- {
- QMetaObject meta= StopSelector::staticMetaObject;
- QMetaEnum type= meta.enumerator(meta.indexOfEnumerator("StopBitsType"));
- for(int i= 0;i<type.keyCount();i++)
- {
- addItem(QString(type.key(i)),QVariant(type.value(i)));
- }
- }
-
- /*:803*/
- #line 577 "./typica.w"
-
- /*863:*/
- #line 18870 "./typica.w"
-
- ModbusConfigurator::ModbusConfigurator(DeviceTreeModel*model,const QModelIndex&index)
- :BasicDeviceConfigurationWidget(model,index),
- port(new PortSelector),baud(new BaudSelector),parity(new ParitySelector),
- flow(new FlowSelector),stop(new StopSelector),station(new QSpinBox),
- decimalQuery(new QCheckBox(tr("Enable"))),
- decimalAddress(new ShortHexSpinBox),decimalPosition(new QSpinBox),
- unitQuery(new QCheckBox(tr("Enable"))),
- unitAddress(new ShortHexSpinBox),valueF(new QSpinBox),
- valueC(new QSpinBox),fixedUnit(new QComboBox),
- pVAddress(new ShortHexSpinBox),
- sVEnabled(new QCheckBox(tr("Enable"))),
- sVReadAddress(new ShortHexSpinBox),
- deviceLimit(new QCheckBox(tr("Enable"))),
- sVLowerAddr(new ShortHexSpinBox),sVUpperAddr(new ShortHexSpinBox),
- sVLower(new QDoubleSpinBox),sVUpper(new QDoubleSpinBox),
- sVWritable(new QCheckBox(tr("Enable"))),
- sVOutputAddr(new ShortHexSpinBox),
- pVColumnName(new QLineEdit),sVColumnName(new QLineEdit)
- {
- QHBoxLayout*layout= new QHBoxLayout;
- QWidget*form= new QWidget;
- QHBoxLayout*masterLayout= new QHBoxLayout;
- QVBoxLayout*portAndDeviceLayout= new QVBoxLayout;
- QVBoxLayout*seriesLayout= new QVBoxLayout;
- QFormLayout*serialSection= new QFormLayout;
- serialSection->addRow(QString(tr("Port:")),port);
- serialSection->addRow(QString(tr("Baud rate:")),baud);
- serialSection->addRow(QString(tr("Parity:")),parity);
- serialSection->addRow(QString(tr("Flow control:")),flow);
- serialSection->addRow(QString(tr("Stop bits:")),stop);
- QGroupBox*serialSectionBox= new QGroupBox(tr("Serial Port Configuration"));
- serialSectionBox->setLayout(serialSection);
- portAndDeviceLayout->addWidget(serialSectionBox);
- QFormLayout*deviceSection= new QFormLayout;
- station->setMinimum(1);
- station->setMaximum(255);
- decimalPosition->setMinimum(0);
- decimalPosition->setMaximum(9);
- valueF->setMinimum(0);
- valueF->setMaximum(0xFFFF);
- valueC->setMinimum(0);
- valueC->setMaximum(0xFFFF);
- fixedUnit->addItem(tr("Fahrenheit"),QVariant(QString("F")));
- fixedUnit->addItem(tr("Celsius"),QVariant(QString("C")));
- deviceSection->addRow(tr("Station:"),station);
- deviceSection->addRow(tr("Decimal position from device:"),decimalQuery);
- deviceSection->addRow(tr("Decimal position relative address:"),decimalAddress);
- deviceSection->addRow(tr("Fixed decimal position:"),decimalPosition);
- deviceSection->addRow(tr("Measurement unit from device:"),unitQuery);
- deviceSection->addRow(tr("Current unit relative address:"),unitAddress);
- deviceSection->addRow(tr("Value for Fahrenheit:"),valueF);
- deviceSection->addRow(tr("Value for Celsius:"),valueC);
- deviceSection->addRow(tr("Fixed unit:"),fixedUnit);
- QGroupBox*deviceSectionBox= new QGroupBox(tr("Device Configuration"));
- deviceSectionBox->setLayout(deviceSection);
- portAndDeviceLayout->addWidget(deviceSectionBox);
- QFormLayout*pVSection= new QFormLayout;
- pVSection->addRow(tr("Value relative address:"),pVAddress);
- pVSection->addRow(tr("PV column name:"),pVColumnName);
- QCheckBox*pVHideBox= new QCheckBox(tr("Hide this channel"));
- pVSection->addRow(pVHideBox);
- QGroupBox*processValueBox= new QGroupBox(tr("Process Value"));
- processValueBox->setLayout(pVSection);
- seriesLayout->addWidget(processValueBox);
- QFormLayout*sVSection= new QFormLayout;
- sVLower->setDecimals(1);
- sVLower->setMinimum(0.0);
- sVLower->setMaximum(999.9);
- sVUpper->setDecimals(1);
- sVUpper->setMinimum(0.0);
- sVUpper->setMaximum(999.9);
- sVSection->addRow(tr("Set value:"),sVEnabled);
- sVSection->addRow(tr("Read relative address:"),sVReadAddress);
- sVSection->addRow(tr("SV column name:"),sVColumnName);
- sVSection->addRow(tr("Limits from device:"),deviceLimit);
- sVSection->addRow(tr("Lower limit relative address:"),sVLowerAddr);
- sVSection->addRow(tr("Upper limit relative address:"),sVUpperAddr);
- sVSection->addRow(tr("Lower limit:"),sVLower);
- sVSection->addRow(tr("Upper limit:"),sVUpper);
- sVSection->addRow(tr("Output set value:"),sVWritable);
- sVSection->addRow(tr("Output relative address:"),sVOutputAddr);
- QCheckBox*sVHideBox= new QCheckBox(tr("Hide this channel"));
- sVSection->addRow(sVHideBox);
- QGroupBox*setValueBox= new QGroupBox(tr("Set Value"));
- setValueBox->setLayout(sVSection);
- seriesLayout->addWidget(setValueBox);
- masterLayout->addLayout(portAndDeviceLayout);
- masterLayout->addLayout(seriesLayout);
- form->setLayout(masterLayout);
- /*771:*/
- #line 16334 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:771*/
- #line 18960 "./typica.w"
-
- for(int i= 0;i<configData.size();i++)
- {
- node= configData.at(i).toElement();
- if(node.attribute("name")=="port")
- {
- QString portname= node.attribute("value");
- int idx= port->findText(portname);
- if(idx>=0)
- {
- port->setCurrentIndex(idx);
- }
- else
- {
- port->addItem(portname);
- }
- }
- else if(node.attribute("name")=="baud")
- {
- baud->setCurrentIndex(baud->findText(node.attribute("value")));
- }
- else if(node.attribute("name")=="parity")
- {
- parity->setCurrentIndex(parity->findData(node.attribute("value")));
- }
- else if(node.attribute("name")=="flow")
- {
- flow->setCurrentIndex(flow->findData(node.attribute("value")));
- }
- else if(node.attribute("name")=="stop")
- {
- stop->setCurrentIndex(stop->findData(node.attribute("value")));
- }
- else if(node.attribute("name")=="station")
- {
- station->setValue(node.attribute("value").toInt());
- }
- else if(node.attribute("name")=="decimalQuery")
- {
- if(node.attribute("value")=="true")
- {
- decimalQuery->setChecked(true);
- }
- else
- {
- decimalQuery->setChecked(false);
- }
- }
- else if(node.attribute("name")=="decimalAddress")
- {
- decimalAddress->setValue(node.attribute("value").toInt());
- }
- else if(node.attribute("name")=="decimalPosition")
- {
- decimalPosition->setValue(node.attribute("value").toInt());
- }
- else if(node.attribute("name")=="unitQuery")
- {
- if(node.attribute("value")=="true")
- {
- unitQuery->setChecked(true);
- }
- else
- {
- unitQuery->setChecked(false);
- }
- }
- else if(node.attribute("name")=="unitAddress")
- {
- unitAddress->setValue(node.attribute("value").toInt());
- }
- else if(node.attribute("name")=="valueF")
- {
- valueF->setValue(node.attribute("value").toInt());
- }
- else if(node.attribute("name")=="valueC")
- {
- valueC->setValue(node.attribute("value").toInt());
- }
- else if(node.attribute("name")=="fixedUnit")
- {
- fixedUnit->setCurrentIndex(fixedUnit->findText(node.attribute("value")));
- }
- else if(node.attribute("name")=="pVAddress")
- {
- pVAddress->setValue(node.attribute("value").toInt());
- }
- else if(node.attribute("name")=="sVEnabled")
- {
- if(node.attribute("value")=="true")
- {
- sVEnabled->setChecked(true);
- }
- else
- {
- sVEnabled->setChecked(false);
- }
- }
- else if(node.attribute("name")=="sVReadAddress")
- {
- sVReadAddress->setValue(node.attribute("value").toInt());
- }
- else if(node.attribute("name")=="deviceLimit")
- {
- if(node.attribute("value")=="true")
- {
- deviceLimit->setChecked(true);
- }
- else
- {
- deviceLimit->setChecked(false);
- }
- }
- else if(node.attribute("name")=="sVLowerAddr")
- {
- sVLowerAddr->setValue(node.attribute("value").toInt());
- }
- else if(node.attribute("name")=="sVUpperAddr")
- {
- sVUpperAddr->setValue(node.attribute("value").toInt());
- }
- else if(node.attribute("name")=="sVLower")
- {
- sVLower->setValue(node.attribute("value").toDouble());
- }
- else if(node.attribute("name")=="sVUpper")
- {
- sVUpper->setValue(node.attribute("value").toDouble());
- }
- else if(node.attribute("name")=="sVWritable")
- {
- if(node.attribute("value")=="true")
- {
- sVWritable->setChecked(true);
- }
- else
- {
- sVWritable->setChecked(false);
- }
- }
- else if(node.attribute("name")=="sVOutputAddr")
- {
- sVOutputAddr->setValue(node.attribute("value").toInt());
- }
- else if(node.attribute("name")=="pvcolname")
- {
- pVColumnName->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="svcolname")
- {
- sVColumnName->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="pvhidden")
- {
- pVHideBox->setChecked(node.attribute("value")=="true");
- }
- else if(node.attribute("name")=="svhidden")
- {
- sVHideBox->setChecked(node.attribute("value")=="true");
- }
- }
- updatePort(port->currentText());
- updateBaudRate(baud->currentText());
- updateParity(parity->itemData(parity->currentIndex()).toString());
- updateFlowControl(flow->itemData(flow->currentIndex()).toString());
- updateStopBits(stop->itemData(stop->currentIndex()).toString());
- updateStation(station->value());
- updateFixedDecimal(decimalQuery->isChecked());
- updateDecimalAddress(decimalAddress->value());
- updateDecimalPosition(decimalPosition->value());
- updateFixedUnit(unitQuery->isChecked());
- updateUnitAddress(unitAddress->value());
- updateValueForF(valueF->value());
- updateValueForC(valueC->value());
- updateUnit(fixedUnit->currentText());
- updatePVAddress(pVAddress->value());
- updateSVEnabled(sVEnabled->isChecked());
- updateSVReadAddress(sVReadAddress->value());
- updateDeviceLimit(deviceLimit->isChecked());
- updateSVLowerAddress(sVLowerAddr->value());
- updateSVUpperAddress(sVUpperAddr->value());
- updateSVLower(sVLower->value());
- updateSVUpper(sVUpper->value());
- updateSVWritable(sVWritable->isChecked());
- updateSVWriteAddress(sVOutputAddr->value());
- updatePVColumnName(pVColumnName->text());
- updateSVColumnName(sVColumnName->text());
- updatePVHidden(pVHideBox->isChecked());
- updateSVHidden(sVHideBox->isChecked());
- connect(port,SIGNAL(currentIndexChanged(QString)),this,SLOT(updatePort(QString)));
- connect(port,SIGNAL(editTextChanged(QString)),this,SLOT(updatePort(QString)));
- connect(baud,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateBaudRate(QString)));
- connect(parity,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateParity(QString)));
- connect(flow,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateFlowControl(QString)));
- connect(stop,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateStopBits(QString)));
- connect(station,SIGNAL(valueChanged(int)),this,SLOT(updateStation(int)));
- connect(decimalQuery,SIGNAL(toggled(bool)),this,SLOT(updateFixedDecimal(bool)));
- connect(decimalAddress,SIGNAL(valueChanged(int)),this,SLOT(updateDecimalAddress(int)));
- connect(decimalPosition,SIGNAL(valueChanged(int)),this,SLOT(updateDecimalPosition(int)));
- connect(unitQuery,SIGNAL(toggled(bool)),this,SLOT(updateFixedUnit(bool)));
- connect(unitAddress,SIGNAL(valueChanged(int)),this,SLOT(updateUnitAddress(int)));
- connect(valueF,SIGNAL(valueChanged(int)),this,SLOT(updateValueForF(int)));
- connect(valueC,SIGNAL(valueChanged(int)),this,SLOT(updateValueForC(int)));
- connect(fixedUnit,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateUnit(QString)));
- connect(pVAddress,SIGNAL(valueChanged(int)),this,SLOT(updatePVAddress(int)));
- connect(sVEnabled,SIGNAL(toggled(bool)),this,SLOT(updateSVEnabled(bool)));
- connect(sVReadAddress,SIGNAL(valueChanged(int)),this,SLOT(updateSVReadAddress(int)));
- connect(deviceLimit,SIGNAL(toggled(bool)),this,SLOT(updateDeviceLimit(bool)));
- connect(sVLowerAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVLowerAddress(int)));
- connect(sVUpperAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVUpperAddress(int)));
- connect(sVLower,SIGNAL(valueChanged(double)),this,SLOT(updateSVLower(double)));
- connect(sVUpper,SIGNAL(valueChanged(double)),this,SLOT(updateSVUpper(double)));
- connect(sVWritable,SIGNAL(toggled(bool)),this,SLOT(updateSVWritable(bool)));
- connect(sVOutputAddr,SIGNAL(valueChanged(int)),this,SLOT(updateSVWriteAddress(int)));
- connect(pVColumnName,SIGNAL(textEdited(QString)),this,SLOT(updatePVColumnName(QString)));
- connect(sVColumnName,SIGNAL(textEdited(QString)),this,SLOT(updateSVColumnName(QString)));
- connect(pVHideBox,SIGNAL(toggled(bool)),this,SLOT(updatePVHidden(bool)));
- connect(sVHideBox,SIGNAL(toggled(bool)),this,SLOT(updateSVHidden(bool)));
- layout->addWidget(form);
- setLayout(layout);
- }
-
- void ModbusConfigurator::updatePort(const QString&newPort)
- {
- updateAttribute("port",newPort);
- }
-
- void ModbusConfigurator::updateBaudRate(const QString&newRate)
- {
- updateAttribute("baud",newRate);
- }
-
- void ModbusConfigurator::updateParity(const QString&)
- {
- updateAttribute("parity",parity->itemData(parity->currentIndex()).toString());
- }
-
- void ModbusConfigurator::updateFlowControl(const QString&)
- {
- updateAttribute("flow",flow->itemData(flow->currentIndex()).toString());
- }
-
- void ModbusConfigurator::updateStopBits(const QString&)
- {
- updateAttribute("stop",stop->itemData(stop->currentIndex()).toString());
- }
-
- void ModbusConfigurator::updateStation(int station)
- {
- updateAttribute("station",QString("%1").arg(station));
- }
-
- void ModbusConfigurator::updateFixedDecimal(bool fixed)
- {
- updateAttribute("decimalQuery",fixed?"true":"false");
- }
-
- void ModbusConfigurator::updateDecimalAddress(int address)
- {
- updateAttribute("decimalAddress",QString("%1").arg(address));
- }
-
- void ModbusConfigurator::updateDecimalPosition(int position)
- {
- updateAttribute("decimalPosition",QString("%1").arg(position));
- }
-
- void ModbusConfigurator::updateFixedUnit(bool fixed)
- {
- updateAttribute("unitQuery",fixed?"true":"false");
- }
-
- void ModbusConfigurator::updateUnitAddress(int address)
- {
- updateAttribute("unitAddress",QString("%1").arg(address));
- }
-
- void ModbusConfigurator::updateValueForF(int value)
- {
- updateAttribute("valueF",QString("%1").arg(value));
- }
-
- void ModbusConfigurator::updateValueForC(int value)
- {
- updateAttribute("valueC",QString("%1").arg(value));
- }
-
- void ModbusConfigurator::updateUnit(const QString&newUnit)
- {
- updateAttribute("fixedUnit",newUnit);
- }
-
- void ModbusConfigurator::updatePVAddress(int address)
- {
- updateAttribute("pVAddress",QString("%1").arg(address));
- }
-
- void ModbusConfigurator::updateSVEnabled(bool enabled)
- {
- updateAttribute("sVEnabled",enabled?"true":"false");
- }
-
- void ModbusConfigurator::updateSVReadAddress(int address)
- {
- updateAttribute("sVReadAddress",QString("%1").arg(address));
- }
-
- void ModbusConfigurator::updateDeviceLimit(bool query)
- {
- updateAttribute("deviceLimit",query?"true":"false");
- }
-
- void ModbusConfigurator::updateSVLowerAddress(int address)
- {
- updateAttribute("sVLowerAddr",QString("%1").arg(address));
- }
-
- void ModbusConfigurator::updateSVUpperAddress(int address)
- {
- updateAttribute("sVUpperAddr",QString("%1").arg(address));
- }
-
- void ModbusConfigurator::updateSVLower(double value)
- {
- updateAttribute("sVLower",QString("%1").arg(value));
- }
-
- void ModbusConfigurator::updateSVUpper(double value)
- {
- updateAttribute("sVUpper",QString("%1").arg(value));
- }
-
- void ModbusConfigurator::updateSVWritable(bool canWriteSV)
- {
- updateAttribute("sVWritable",canWriteSV?"true":"false");
- }
-
- void ModbusConfigurator::updateSVWriteAddress(int address)
- {
- updateAttribute("sVOutputAddr",QString("%1").arg(address));
- }
-
- void ModbusConfigurator::updatePVColumnName(const QString&name)
- {
- updateAttribute("pvcolname",name);
- }
-
- void ModbusConfigurator::updateSVColumnName(const QString&name)
- {
- updateAttribute("svcolname",name);
- }
-
- void ModbusConfigurator::updatePVHidden(bool hidden)
- {
- updateAttribute("pvhidden",hidden?"true":"false");
- }
-
- void ModbusConfigurator::updateSVHidden(bool hidden)
- {
- updateAttribute("svhidden",hidden?"true":"false");
- }
-
- /*:863*/
- #line 578 "./typica.w"
-
- /*806:*/
- #line 17137 "./typica.w"
-
- ShortHexSpinBox::ShortHexSpinBox(QWidget*parent):QSpinBox(parent)
- {
- setMinimum(0);
- setMaximum(0xFFFF);
- setPrefix("0x");
- setMinimumWidth(65);
- }
-
- QValidator::State ShortHexSpinBox::validate(QString&input,int&)const
- {
- if(input.size()==2)
- {
- return QValidator::Intermediate;
- }
- bool okay;
- input.toInt(&okay,16);
- if(okay)
- {
- return QValidator::Acceptable;
- }
- return QValidator::Invalid;
- }
-
- int ShortHexSpinBox::valueFromText(const QString&text)const
- {
- return text.toInt(NULL,16);
- }
-
- QString ShortHexSpinBox::textFromValue(int value)const
- {
- QString retval;
- retval.setNum(value,16);
- while(retval.size()<4)
- {
- retval.prepend("0");
- }
- return retval.toUpper();
- }
-
- /*:806*/
- #line 579 "./typica.w"
-
- /*847:*/
- #line 18169 "./typica.w"
-
- ModbusRTUDevice::ModbusRTUDevice(DeviceTreeModel*model,const QModelIndex&index)
- :QObject(NULL),messageDelayTimer(new QTimer),commTimeout(new QTimer),unitIsF(true),readingsv(false),
- waiting(false)
- {
- qDebug()<<"Initializing Modbus RTU Device";
- QDomElement portReferenceElement= model->referenceElement(model->data(index,
- Qt::UserRole).toString());
- QDomNodeList portConfigData= portReferenceElement.elementsByTagName("attribute");
- QDomElement node;
- QVariantMap attributes;
- for(int i= 0;i<portConfigData.size();i++)
- {
- node= portConfigData.at(i).toElement();
- attributes.insert(node.attribute("name"),node.attribute("value"));
- }
- port= new QextSerialPort(attributes.value("port").toString(),
- QextSerialPort::EventDriven);
- int baudRate= attributes.value("baud").toInt();
- port->setBaudRate((BaudRateType)baudRate);
- double temp= ((double)(1)/(double)(baudRate))*48;
- delayTime= (int)(temp*3000);
- messageDelayTimer->setSingleShot(true);
- commTimeout->setSingleShot(true);
- connect(messageDelayTimer,SIGNAL(timeout()),this,SLOT(sendNextMessage()));
- connect(commTimeout,SIGNAL(timeout()),this,SLOT(timeout()));
- port->setDataBits(DATA_8);
- port->setParity((ParityType)attributes.value("parity").toInt());
- port->setStopBits((StopBitsType)attributes.value("stop").toInt());
- port->setFlowControl((FlowType)attributes.value("flow").toInt());
- connect(port,SIGNAL(readyRead()),this,SLOT(dataAvailable()));
- port->open(QIODevice::ReadWrite);
- station= (char)attributes.value("station").toInt();
- if(attributes.value("decimalQuery")=="true")
- {
- decimalPosition= 0;
- QByteArray message;
- message.append(station);
- message.append((char)0x03);
- quint16 address= (quint16)attributes.value("decimalAddress").toInt();
- char*addressBytes= (char*)&address;
- message.append(addressBytes[1]);
- message.append(addressBytes[0]);
- message.append((char)0x00);
- message.append((char)0x01);
- queueMessage(message,this,"decimalResponse(QByteArray)");
- }
- else
- {
- decimalPosition= attributes.value("decimalPosition").toInt();
- }
- valueF= attributes.value("valueF").toInt();
- valueC= attributes.value("valueC").toInt();
- if(attributes.value("unitQuery")=="true")
- {
- QByteArray message;
- message.append(station);
- message.append((char)0x03);
- quint16 address= (quint16)attributes.value("unitAddress").toInt();
- char*addressBytes= (char*)&address;
- message.append(addressBytes[1]);
- message.append(addressBytes[0]);
- message.append((char)0x00);
- message.append((char)0x01);
- queueMessage(message,this,"unitResponse(QByteArray)");
- }
- else
- {
- if(attributes.value("fixedUnit")=="Celsius")
- {
- unitIsF= false;
- }
- }
- if(attributes.value("sVWritable")=="true")
- {
- if(attributes.value("deviceLimit")=="true")
- {
- QByteArray lmessage;
- lmessage.append(station);
- lmessage.append((char)0x03);
- quint16 laddress= (quint16)attributes.value("sVLowerAddr").toInt();
- char*addressBytes= (char*)&laddress;
- lmessage.append(addressBytes[1]);
- lmessage.append(addressBytes[0]);
- lmessage.append((char)0x00);
- lmessage.append((char)0x01);
- queueMessage(lmessage,this,"svlResponse(QByteArray)");
- QByteArray umessage;
- umessage.append(station);
- umessage.append((char)0x03);
- quint16 uaddress= (quint16)attributes.value("sVUpperAddr").toInt();
- addressBytes= (char*)&uaddress;
- umessage.append(addressBytes[1]);
- umessage.append(addressBytes[0]);
- umessage.append((char)0x00);
- umessage.append((char)0x01);
- queueMessage(umessage,this,"svuResponse(QByteArray)");
- }
- else
- {
- outputSVLower= attributes.value("sVLower").toDouble();
- outputSVUpper= attributes.value("sVUpper").toDouble();
- }
- outputSVStub.append(station);
- outputSVStub.append((char)0x06);
- quint16 address= (quint16)attributes.value("sVOutputAddr").toInt();
- char*addressBytes= (char*)&address;
- outputSVStub.append(addressBytes[1]);
- outputSVStub.append(addressBytes[0]);
- }
- Channel*pv= new Channel;
- channels.append(pv);
- pvStub.append(station);
- pvStub.append((char)0x04);
- pvaddress= (quint16)attributes.value("pVAddress").toInt();
- char*pvac= (char*)&pvaddress;
- pvStub.append(pvac[1]);
- pvStub.append(pvac[0]);
- pvStub.append((char)0x00);
- pvStub.append((char)0x01);
- svenabled= attributes.value("sVEnabled").toBool();
- if(svenabled)
- {
- Channel*sv= new Channel;
- channels.append(sv);
- svStub.append(station);
- svStub.append((char)0x04);
- svaddress= (quint16)attributes.value("sVReadAddress").toInt();
- char*svac= (char*)&svaddress;
- svStub.append(svac[1]);
- svStub.append(svac[0]);
- svStub.append((char)0x00);
- svStub.append((char)0x01);
- if(svaddress-pvaddress==1)
- {
- mStub.append(station);
- mStub.append((char)0x04);
- mStub.append(pvac[1]);
- mStub.append(pvac[0]);
- mStub.append((char)0x00);
- mStub.append((char)0x02);
- }
- }
- connect(this,SIGNAL(queueEmpty()),this,SLOT(requestMeasurement()));
- requestMeasurement();
- }
-
- double ModbusRTUDevice::SVLower()
- {
- return outputSVLower;
- }
-
- double ModbusRTUDevice::SVUpper()
- {
- return outputSVUpper;
- }
-
- int ModbusRTUDevice::decimals()
- {
- return decimalPosition;
- }
-
- void ModbusRTUDevice::decimalResponse(QByteArray response)
- {
- quint16 temp;
- char*tchar= (char*)&temp;
- tchar[1]= response.at(3);
- tchar[0]= response.at(4);
- decimalPosition= temp;
- emit SVDecimalChanged(decimalPosition);
- qDebug()<<"Received decimal response";
- }
-
- void ModbusRTUDevice::unitResponse(QByteArray response)
- {
- quint16 temp;
- char*tchar= (char*)&temp;
- tchar[1]= response.at(3);
- tchar[0]= response.at(4);
- int value= temp;
- if(value==valueF)
- {
- unitIsF= true;
- }
- else
- {
- unitIsF= false;
- }
- qDebug()<<"Received unit response";
- }
-
- void ModbusRTUDevice::svlResponse(QByteArray response)
- {
- quint16 temp;
- char*tchar= (char*)&temp;
- tchar[1]= response.at(3);
- tchar[0]= response.at(4);
- outputSVLower= (double)temp;
- for(int i= 0;i<decimalPosition;i++)
- {
- outputSVLower/= 10;
- }
- emit SVLowerChanged(outputSVLower);
- qDebug()<<"Received set value lower bound response";
- }
-
- void ModbusRTUDevice::svuResponse(QByteArray response)
- {
- quint16 temp;
- char*tchar= (char*)&temp;
- tchar[1]= response.at(3);
- tchar[0]= response.at(4);
- outputSVUpper= (double)temp;
- for(int i= 0;i<decimalPosition;i++)
- {
- outputSVUpper/= 10;
- }
- emit SVUpperChanged(outputSVUpper);
- qDebug()<<"Received set value upper bound response";
- }
-
- void ModbusRTUDevice::requestMeasurement()
- {
- if(mStub.length()> 0)
- {
- queueMessage(mStub,this,"mResponse(QByteArray)");
- }
- else
- {
- queueMessage(pvStub,this,"mResponse(QByteArray)");
- if(svenabled)
- {
- queueMessage(svStub,this,"mResponse(QByteArray)");
- }
- }
- }
-
- void ModbusRTUDevice::mResponse(QByteArray response)
- {
- QTime time= QTime::currentTime();
- if(response.at(2)==0x04)
- {
- /*848:*/
- #line 18424 "./typica.w"
-
- quint16 pv;
- quint16 sv;
- char*pvBytes= (char*)&pv;
- char*svBytes= (char*)&sv;
- pvBytes[1]= response.at(3);
- pvBytes[0]= response.at(4);
- svBytes[1]= response.at(5);
- svBytes[0]= response.at(6);
- double pvOut= (double)pv;
- double svOut= (double)sv;
- for(int i= 0;i<decimalPosition;i++)
- {
- pvOut/= 10;
- svOut/= 10;
- }
- if(!unitIsF)
- {
- pvOut= pvOut*9/5+32;
- svOut= svOut*9/5+32;
- }
- Measurement pvm(pvOut,time,Units::Fahrenheit);
- Measurement svm(svOut,time,Units::Fahrenheit);
- channels.at(0)->input(pvm);
- channels.at(1)->input(svm);
-
- /*:848*/
- #line 18411 "./typica.w"
-
- }
- else
- {
- /*849:*/
- #line 18454 "./typica.w"
-
- quint16 value;
- char*valueBytes= (char*)&value;
- valueBytes[1]= response.at(3);
- valueBytes[0]= response.at(4);
- double valueOut= (double)value;
- for(int i= 0;i<decimalPosition;i++)
- {
- valueOut/= 10;
- }
- if(!unitIsF)
- {
- valueOut= valueOut*9/5+32;
- }
- if(!svenabled)
- {
- Measurement vm(valueOut,time,Units::Fahrenheit);
- channels.at(0)->input(vm);
- }
- else
- {
- if(readingsv)
- {
- Measurement pvm(savedpv,time,Units::Fahrenheit);
- Measurement svm(valueOut,time,Units::Fahrenheit);
- channels.at(0)->input(pvm);
- channels.at(1)->input(svm);
- readingsv= false;
- }
- else
- {
- savedpv= valueOut;
- readingsv= true;
- }
- }
-
- /*:849*/
- #line 18415 "./typica.w"
-
- }
- }
-
- /*:847*//*850:*/
- #line 18492 "./typica.w"
-
- ModbusRTUDevice::~ModbusRTUDevice()
- {
- commTimeout->stop();
- messageDelayTimer->stop();
- port->close();
- }
-
- /*:850*//*851:*/
- #line 18519 "./typica.w"
-
- void ModbusRTUDevice::dataAvailable()
- {
- if(messageDelayTimer->isActive())
- {
- messageDelayTimer->stop();
- }
- responseBuffer.append(port->readAll());
- /*852:*/
- #line 18565 "./typica.w"
-
- if(responseBuffer.size()<5)
- {
- return;
- }
- switch(responseBuffer.at(1))
- {
- case 0x01:
- case 0x02:
- if(responseBuffer.size()<6)
- {
- return;
- }
- responseBuffer= responseBuffer.left(6);
- break;
- case 0x03:
- case 0x04:
- if(responseBuffer.size()<5+responseBuffer.at(2))
- {
- return;
- }
- responseBuffer= responseBuffer.left(5+responseBuffer.at(2));
- break;
- case 0x05:
- case 0x06:
- case 0x10:
- if(responseBuffer.size()<8)
- {
- return;
- }
- responseBuffer= responseBuffer.left(8);
- break;
- }
-
- /*:852*/
- #line 18527 "./typica.w"
-
- commTimeout->stop();
- if(calculateCRC(responseBuffer)==0)
- {
- QObject*object= retObjQueue.at(0);
- char*method= callbackQueue.at(0);
- QMetaMethod metamethod= object->metaObject()->
- method(object->metaObject()->
- indexOfMethod(QMetaObject::normalizedSignature(method)));
- metamethod.invoke(object,Qt::QueuedConnection,
- Q_ARG(QByteArray,responseBuffer));
- messageQueue.removeAt(0);
- retObjQueue.removeAt(0);
- callbackQueue.removeAt(0);
- }
- else
- {
- qDebug()<<"CRC failed";
- }
- messageDelayTimer->start(delayTime);
- waiting= false;
- responseBuffer.clear();
- }
-
- /*:851*//*853:*/
- #line 18607 "./typica.w"
-
- quint16 ModbusRTUDevice::calculateCRC(QByteArray data)
- {
- quint16 retval= 0xFFFF;
- int i= 0;
- while(i<data.size())
- {
- retval^= 0x00FF&(quint16)data.at(i);
- for(int j= 0;j<8;j++)
- {
- if(retval&1)
- {
- retval= (retval>>1)^0xA001;
- }
- else
- {
- retval>>= 1;
- }
- }
- i++;
- }
- return retval;
- }
-
- /*:853*//*854:*/
- #line 18638 "./typica.w"
-
- void ModbusRTUDevice::queueMessage(QByteArray request,QObject*object,
- const char*callback)
- {
- messageQueue.append(request);
- retObjQueue.append(object);
- callbackQueue.append(const_cast<char*> (callback));
- if(messageQueue.size()==1&&!(messageDelayTimer->isActive()))
- {
- sendNextMessage();
- }
- }
-
- void ModbusRTUDevice::sendNextMessage()
- {
- if(messageQueue.size()> 0&&!waiting)
- {
- QByteArray message= messageQueue.at(0);
- quint16 crc= calculateCRC(message);
- char*check= (char*)&crc;
- message.append(check[0]);
- message.append(check[1]);
- port->write(message);
- commTimeout->start(2000);
- messageDelayTimer->start(delayTime);
- waiting= true;
- }
- else
- {
- emit queueEmpty();
- }
- }
-
- void ModbusRTUDevice::outputSV(double value)
- {
- for(int i= 0;i<decimalPosition;i++)
- {
- value*= 10;
- }
- quint16 outval= (quint16)value;
- QByteArray message(outputSVStub);
- char*valBytes= (char*)&outval;
- message.append(valBytes[1]);
- message.append(valBytes[0]);
- queueMessage(message,this,"ignore(QByteArray)");
- }
-
- /*:854*//*855:*/
- #line 18687 "./typica.w"
-
- void ModbusRTUDevice::ignore(QByteArray)
- {
- return;
- }
-
- /*:855*//*856:*/
- #line 18700 "./typica.w"
-
- void ModbusRTUDevice::timeout()
- {
- qDebug()<<"Communications timeout.";
- responseBuffer.clear();
- waiting= false;
- messageDelayTimer->start();
- }
-
- /*:856*/
- #line 580 "./typica.w"
-
- /*725:*/
- #line 15259 "./typica.w"
-
- DeviceTreeModelNode::DeviceTreeModelNode(QDomNode&node,int row,
- DeviceTreeModelNode*parent)
- :domNode(node),rowNumber(row),parentItem(parent)
- {
-
- }
-
- DeviceTreeModelNode::~DeviceTreeModelNode()
- {
- QHash<int,DeviceTreeModelNode*> ::iterator i;
- for(i= children.begin();i!=children.end();i++)
- {
- delete i.value();
- }
- }
-
- DeviceTreeModelNode*DeviceTreeModelNode::parent()
- {
- return parentItem;
- }
-
- int DeviceTreeModelNode::row()
- {
- return rowNumber;
- }
-
- QDomNode DeviceTreeModelNode::node()const
- {
- return domNode;
- }
-
- DeviceTreeModelNode*DeviceTreeModelNode::child(int index)
- {
- if(children.contains(index))
- {
- return children[index];
- }
- if(index>=0&&index<domNode.childNodes().count())
- {
- QDomNode childNode= domNode.childNodes().item(index);
- DeviceTreeModelNode*childItem= new DeviceTreeModelNode(childNode,
- index,this);
- children[index]= childItem;
- return childItem;
- }
- return NULL;
- }
-
- /*:725*/
- #line 581 "./typica.w"
-
- /*727:*/
- #line 15348 "./typica.w"
-
- DeviceTreeModel::DeviceTreeModel(QObject*parent)
- :QAbstractItemModel(parent)
- {
- document= AppInstance->deviceConfiguration();
- QDomNodeList elements= document.elementsByTagName("devices");
- if(elements.size()!=1)
- {
- qDebug()<<"Unexpected result when loading device map.";
- }
- treeRoot= elements.at(0);
- root= new DeviceTreeModelNode(treeRoot,0);
- elements= document.elementsByTagName("references");
- if(elements.size()!=1)
- {
- qDebug()<<"No references section. Creating.";
- referenceSection= document.createElement("references");
- document.appendChild(referenceSection);
- }
- else
- {
- referenceSection= elements.at(0);
- }
- connect(this,SIGNAL(dataChanged(QModelIndex,QModelIndex)),
- AppInstance,SLOT(saveDeviceConfiguration()));
- connect(this,SIGNAL(modelReset()),
- AppInstance,SLOT(saveDeviceConfiguration()));
- connect(this,SIGNAL(rowsInserted(QModelIndex,int,int)),
- AppInstance,SLOT(saveDeviceConfiguration()));
- }
-
- /*:727*//*728:*/
- #line 15383 "./typica.w"
-
- int DeviceTreeModel::columnCount(const QModelIndex&)const
- {
- return 1;
- }
-
- int DeviceTreeModel::rowCount(const QModelIndex&parent)const
- {
- if(parent.column()> 0)
- {
- return 0;
- }
- /*729:*/
- #line 15402 "./typica.w"
-
- DeviceTreeModelNode*parentItem;
- if(!parent.isValid())
- {
- parentItem= root;
- }
- else
- {
- parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
- }
-
- /*:729*/
- #line 15395 "./typica.w"
-
- return parentItem->node().childNodes().count();
- }
-
- /*:728*//*730:*/
- #line 15416 "./typica.w"
-
- QModelIndex DeviceTreeModel::index(int row,int column,
- const QModelIndex&parent)const
- {
- if(!hasIndex(row,column,parent))
- {
- return QModelIndex();
- }
- /*729:*/
- #line 15402 "./typica.w"
-
- DeviceTreeModelNode*parentItem;
- if(!parent.isValid())
- {
- parentItem= root;
- }
- else
- {
- parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
- }
-
- /*:729*/
- #line 15424 "./typica.w"
-
- DeviceTreeModelNode*childItem= parentItem->child(row);
- if(childItem)
- {
- return createIndex(row,column,childItem);
- }
- return QModelIndex();
- }
-
- /*:730*//*731:*/
- #line 15435 "./typica.w"
-
- QModelIndex DeviceTreeModel::parent(const QModelIndex&child)const
- {
- if(!child.isValid())
- {
- return QModelIndex();
- }
- DeviceTreeModelNode*childItem=
- static_cast<DeviceTreeModelNode*> (child.internalPointer());
- DeviceTreeModelNode*parentItem= childItem->parent();
- if(!parentItem||parentItem==root)
- {
- return QModelIndex();
- }
- return createIndex(parentItem->row(),0,parentItem);
- }
-
- /*:731*//*732:*/
- #line 15454 "./typica.w"
-
- Qt::ItemFlags DeviceTreeModel::flags(const QModelIndex&index)const
- {
- if(!index.isValid())
- {
- return 0;
- }
- return Qt::ItemIsEnabled|Qt::ItemIsSelectable|Qt::ItemIsEditable;
- }
-
- /*:732*//*733:*/
- #line 15469 "./typica.w"
-
- QVariant DeviceTreeModel::data(const QModelIndex&index,int role)const
- {
- if(!index.isValid())
- {
- return QVariant();
- }
- if(role!=Qt::DisplayRole&&role!=Qt::UserRole&&role!=Qt::EditRole)
- {
- return QVariant();
- }
- DeviceTreeModelNode*item=
- static_cast<DeviceTreeModelNode*> (index.internalPointer());
- QDomNode node= item->node();
- QDomElement element= node.toElement();
- switch(role)
- {
- case Qt::DisplayRole:
- case Qt::EditRole:
- return QVariant(element.attribute("name"));
- case Qt::UserRole:
- return QVariant(element.attribute("reference"));
- default:
- return QVariant();
- }
- return QVariant();
- }
-
- /*:733*//*734:*/
- #line 15501 "./typica.w"
-
- bool DeviceTreeModel::setData(const QModelIndex&index,
- const QVariant&value,int)
- {
- if(!index.isValid())
- {
- return false;
- }
- DeviceTreeModelNode*item=
- static_cast<DeviceTreeModelNode*> (index.internalPointer());
- QDomNode node= item->node();
- QDomElement element= node.toElement();
- element.setAttribute("name",value.toString());
- emit dataChanged(index,index);
- return true;
- }
-
- /*:734*//*735:*/
- #line 15524 "./typica.w"
-
- void DeviceTreeModel::newNode(const QString&name,const QString&driver,
- const QModelIndex&parent)
- {
- QString referenceID= QUuid::createUuid().toString();
- /*729:*/
- #line 15402 "./typica.w"
-
- DeviceTreeModelNode*parentItem;
- if(!parent.isValid())
- {
- parentItem= root;
- }
- else
- {
- parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
- }
-
- /*:729*/
- #line 15529 "./typica.w"
-
- QDomNode parentNode= parentItem->node();
- int newRowNumber= rowCount(parent);
- beginInsertRows(parent,newRowNumber,newRowNumber);
- QDomElement deviceElement= document.createElement("node");
- deviceElement.setAttribute("name",name);
- deviceElement.setAttribute("reference",referenceID);
- parentNode.appendChild(deviceElement);
- QDomElement referenceElement= document.createElement("reference");
- referenceElement.setAttribute("id",referenceID);
- referenceElement.setAttribute("driver",driver);
- referenceSection.appendChild(referenceElement);
- endInsertRows();
- }
-
- /*:735*//*736:*/
- #line 15547 "./typica.w"
-
- bool DeviceTreeModel::removeRows(int row,int count,const QModelIndex&parent)
- {
- /*729:*/
- #line 15402 "./typica.w"
-
- DeviceTreeModelNode*parentItem;
- if(!parent.isValid())
- {
- parentItem= root;
- }
- else
- {
- parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
- }
-
- /*:729*/
- #line 15550 "./typica.w"
-
- QDomNode parentNode= parentItem->node();
- QDomNodeList childNodes= parentNode.childNodes();
- if(childNodes.size()<row+count)
- {
- return false;
- }
- beginRemoveRows(parent,row,row+count-1);
- QList<QDomElement> removalList;
- for(int i= row;i<row+count;i++)
- {
- removalList.append(childNodes.at(i).toElement());
- }
- QDomElement element;
- QDomElement reference;
- for(int i= 0;i<count;i++)
- {
- element= removalList.at(i);
- if(element.hasAttribute("reference"))
- {
- reference= referenceElement(element.attribute("reference"));
- if(!reference.isNull())
- {
- referenceSection.removeChild(reference);
- }
- }
- parentNode.removeChild(element);
- }
- endRemoveRows();
- beginResetModel();
- delete root;
- root= new DeviceTreeModelNode(treeRoot,0);
- endResetModel();
- return true;
- }
-
- /*:736*//*737:*/
- #line 15589 "./typica.w"
-
- QDomElement DeviceTreeModel::referenceElement(const QString&id)
- {
- QDomNodeList childNodes= referenceSection.childNodes();
- QDomElement element;
- for(int i= 0;i<childNodes.size();i++)
- {
- element= childNodes.at(i).toElement();
- if(element.hasAttribute("id"))
- {
- if(element.attribute("id")==id)
- {
- return element;
- }
- }
- }
- return QDomElement();
- }
-
- /*:737*//*738:*/
- #line 15610 "./typica.w"
-
- QVariant DeviceTreeModel::headerData(int,Qt::Orientation,int)const
- {
- return QVariant();
- }
-
- /*:738*//*739:*/
- #line 15619 "./typica.w"
-
- DeviceTreeModel::~DeviceTreeModel()
- {
- delete root;
- }
-
- /*:739*/
- #line 582 "./typica.w"
-
- /*766:*/
- #line 16119 "./typica.w"
-
- BasicDeviceConfigurationWidget::BasicDeviceConfigurationWidget(
- DeviceTreeModel*model,const QModelIndex&index)
- :QWidget(NULL),deviceModel(model),currentNode(index)
- {
-
- }
-
- /*:766*//*767:*/
- #line 16131 "./typica.w"
-
- void BasicDeviceConfigurationWidget::updateAttribute(const QString&name,
- const QString&value)
- {
- QDomElement referenceElement= deviceModel->referenceElement(
- deviceModel->data(currentNode,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
- bool found= false;
- for(int i= 0;i<configData.size();i++)
- {
- node= configData.at(i).toElement();
- if(node.attribute("name")==name)
- {
- node.setAttribute("value",value);
- found= true;
- break;
- }
- }
- if(!found)
- {
- node= AppInstance->deviceConfiguration().createElement("attribute");
- node.setAttribute("name",name);
- node.setAttribute("value",value);
- referenceElement.appendChild(node);
- }
- AppInstance->saveDeviceConfiguration();
- }
-
- /*:767*//*768:*/
- #line 16165 "./typica.w"
-
- void BasicDeviceConfigurationWidget::insertChildNode(const QString&name,
- const QString&driver)
- {
- deviceModel->newNode(name,driver,currentNode);
- }
-
- /*:768*/
- #line 583 "./typica.w"
-
- /*757:*/
- #line 15963 "./typica.w"
-
- DeviceConfigurationWindow::DeviceConfigurationWindow():QWidget(NULL),
- view(new QTreeView),configArea(new QScrollArea)
- {
- QSplitter*splitter= new QSplitter;
- QWidget*leftWidget= new QWidget;
- leftWidget->setMinimumWidth(200);
- QVBoxLayout*left= new QVBoxLayout;
- view->setAnimated(true);
- view->setSelectionMode(QAbstractItemView::SingleSelection);
- document= AppInstance->deviceConfiguration();
- model= new DeviceTreeModel;
- view->setModel(model);
- view->setTextElideMode(Qt::ElideNone);
- view->expandAll();
- view->resizeColumnToContents(0);
- connect(model,SIGNAL(modelReset()),view,SLOT(expandAll()));
- QHBoxLayout*treeButtons= new QHBoxLayout;
- QToolButton*addDeviceButton= new QToolButton;
- addDeviceButton->setIcon(QIcon::fromTheme("list-add"));
- addDeviceButton->setToolTip(tr("New Roaster"));
- connect(addDeviceButton,SIGNAL(clicked()),
- this,SLOT(addDevice()));
- QToolButton*removeNodeButton= new QToolButton;
- removeNodeButton->setIcon(QIcon::fromTheme("list-remove"));
- removeNodeButton->setToolTip(tr("Delete Selection"));
- connect(removeNodeButton,SIGNAL(clicked()),this,SLOT(removeNode()));
- treeButtons->addWidget(addDeviceButton);
- treeButtons->addWidget(removeNodeButton);
- left->addWidget(view);
- left->addLayout(treeButtons);
- leftWidget->setLayout(left);
- splitter->addWidget(leftWidget);
- configArea->setMinimumWidth(580);
- configArea->setMinimumHeight(460);
- configArea->setWidgetResizable(true);
- splitter->addWidget(configArea);
- QVBoxLayout*centralLayout= new QVBoxLayout;
- centralLayout->addWidget(splitter);
- setLayout(centralLayout);
- connect(view,SIGNAL(activated(QModelIndex)),
- this,SLOT(newSelection(QModelIndex)));
- connect(view,SIGNAL(clicked(QModelIndex)),
- this,SLOT(newSelection(QModelIndex)));
- connect(model,SIGNAL(rowsInserted(QModelIndex,int,int)),
- view,SLOT(expand(QModelIndex)));
- connect(model,SIGNAL(rowsInserted(QModelIndex,int,int)),
- this,SLOT(resizeColumn()));
- connect(model,SIGNAL(rowsRemoved(QModelIndex,int,int)),
- this,SLOT(resizeColumn()));
- }
-
- /*:757*//*758:*/
- #line 16018 "./typica.w"
-
- void DeviceConfigurationWindow::addDevice()
- {
- model->newNode(tr("New Roaster"),"roaster",QModelIndex());
- }
-
- /*:758*//*759:*/
- #line 16026 "./typica.w"
-
- void DeviceConfigurationWindow::removeNode()
- {
- QModelIndex index= view->currentIndex();
- if(index.isValid())
- {
- int row= index.row();
- QModelIndex parent= index.parent();
- model->removeRow(row,parent);
- }
- }
-
- /*:759*//*760:*/
- #line 16042 "./typica.w"
-
- void DeviceConfigurationWindow::newSelection(const QModelIndex&index)
- {
- QWidget*editor= AppInstance->deviceConfigurationWidget(model,index);
- if(editor)
- {
- configArea->setWidget(editor);
- editor->show();
- }
- }
-
- /*:760*//*761:*/
- #line 16059 "./typica.w"
-
- void DeviceConfigurationWindow::resizeColumn()
- {
- view->resizeColumnToContents(0);
- }
-
- /*:761*/
- #line 584 "./typica.w"
-
- /*781:*/
- #line 16540 "./typica.w"
-
- Ni9211TcConfWidget::Ni9211TcConfWidget(DeviceTreeModel*model,
- const QModelIndex&index):
- BasicDeviceConfigurationWidget(model,index)
- {
- QFormLayout*layout= new QFormLayout;
- QLineEdit*columnName= new QLineEdit;
- layout->addRow(tr("Column Name:"),columnName);
- QComboBox*typeSelector= new QComboBox;
- typeSelector->addItem("J");
- typeSelector->addItem("K");
- typeSelector->addItem("T");
- typeSelector->addItem("B");
- typeSelector->addItem("E");
- typeSelector->addItem("N");
- typeSelector->addItem("R");
- typeSelector->addItem("S");
- layout->addRow(tr("Thermocouple Type:"),typeSelector);
- QCheckBox*hideSeries= new QCheckBox("Hide this channel");
- layout->addRow(hideSeries);
- setLayout(layout);
- /*771:*/
- #line 16334 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:771*/
- #line 16561 "./typica.w"
-
- for(int i= 0;i<configData.size();i++)
- {
- node= configData.at(i).toElement();
- if(node.attribute("name")=="type")
- {
- typeSelector->setCurrentIndex(
- typeSelector->findText(node.attribute("value")));
- }
- else if(node.attribute("name")=="columnname")
- {
- columnName->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="hidden")
- {
- hideSeries->setChecked(node.attribute("value")=="true");
- }
- }
- updateThermocoupleType(typeSelector->currentText());
- updateColumnName(columnName->text());
- updateHidden(hideSeries->isChecked());
- connect(typeSelector,SIGNAL(currentIndexChanged(QString)),
- this,SLOT(updateThermocoupleType(QString)));
- connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
- connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
- }
-
- /*:781*//*782:*/
- #line 16591 "./typica.w"
-
- void Ni9211TcConfWidget::updateThermocoupleType(const QString&type)
- {
- updateAttribute("type",type);
- }
-
- void Ni9211TcConfWidget::updateColumnName(const QString&name)
- {
- updateAttribute("columnname",name);
- }
-
- void Ni9211TcConfWidget::updateHidden(bool hidden)
- {
- updateAttribute("hidden",hidden?"true":"false");
- }
-
- /*:782*/
- #line 585 "./typica.w"
-
- /*777:*/
- #line 16454 "./typica.w"
-
- NiDaqMxBase9211ConfWidget::NiDaqMxBase9211ConfWidget(DeviceTreeModel*model,
- const QModelIndex&index)
- :BasicDeviceConfigurationWidget(model,index)
- {
- QVBoxLayout*layout= new QVBoxLayout;
- QHBoxLayout*deviceIdLayout= new QHBoxLayout;
- QLabel*label= new QLabel(tr("Device ID:"));
- QLineEdit*deviceId= new QLineEdit;
- deviceIdLayout->addWidget(label);
- deviceIdLayout->addWidget(deviceId);
- QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
- layout->addLayout(deviceIdLayout);
- layout->addWidget(addChannelButton);
- /*771:*/
- #line 16334 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:771*/
- #line 16468 "./typica.w"
-
- for(int i= 0;i<configData.size();i++)
- {
- node= configData.at(i).toElement();
- if(node.attribute("name")=="deviceID")
- {
- deviceId->setText(node.attribute("value","Dev1"));
- break;
- }
- }
- updateDeviceId(deviceId->text());
- connect(addChannelButton,SIGNAL(clicked()),
- this,SLOT(addChannel()));
- connect(deviceId,SIGNAL(textEdited(QString)),
- this,SLOT(updateDeviceId(QString)));
- setLayout(layout);
- }
-
- /*:777*//*778:*/
- #line 16490 "./typica.w"
-
- void NiDaqMxBase9211ConfWidget::updateDeviceId(const QString&newId)
- {
- updateAttribute("deviceID",newId);
- }
-
- /*:778*//*779:*/
- #line 16498 "./typica.w"
-
- void NiDaqMxBase9211ConfWidget::addChannel()
- {
- insertChildNode(tr("Thermocouple channel"),"ni9211seriestc");
- }
-
- /*:779*/
- #line 586 "./typica.w"
-
- /*775:*/
- #line 16405 "./typica.w"
-
- NiDaqMxBaseDriverConfWidget::NiDaqMxBaseDriverConfWidget(
- DeviceTreeModel*model,const QModelIndex&index):
- BasicDeviceConfigurationWidget(model,index)
- {
- QHBoxLayout*layout= new QHBoxLayout;
- QToolButton*addDeviceButton= new QToolButton;
- addDeviceButton->setText(tr("Add Device"));
- NodeInserter*add9211= new NodeInserter("NI USB 9211","NI USB 9211",
- "nidaqmxbase9211series");
- NodeInserter*add9211a= new NodeInserter("NI USB 9211A","NI USB 9211A",
- "nidaqmxbase9211series");
- connect(add9211,SIGNAL(triggered(QString,QString)),
- this,SLOT(insertChildNode(QString,QString)));
- connect(add9211a,SIGNAL(triggered(QString,QString)),
- this,SLOT(insertChildNode(QString,QString)));
- QMenu*deviceMenu= new QMenu;
- deviceMenu->addAction(add9211);
- deviceMenu->addAction(add9211a);
- addDeviceButton->setMenu(deviceMenu);
- addDeviceButton->setPopupMode(QToolButton::InstantPopup);
- layout->addWidget(addDeviceButton);
- setLayout(layout);
- }
-
- /*:775*/
- #line 587 "./typica.w"
-
- /*642:*/
- #line 13879 "./typica.w"
-
- ReportAction::ReportAction(const QString&fileName,const QString&reportName,
- QObject*parent):
- QAction(reportName,parent),reportFile(fileName)
- {
- connect(this,SIGNAL(triggered()),this,SLOT(createReport()));
- }
-
- /*:642*//*643:*/
- #line 13895 "./typica.w"
-
- void ReportAction::createReport()
- {
- QFile file(reportFile);
- QDomDocument document;
- if(file.open(QIODevice::ReadOnly))
- {
- document.setContent(&file,true);
- QDomElement element= document.documentElement();
- QScriptEngine*engine= AppInstance->engine;
- QScriptContext*context= engine->pushContext();
- QScriptValue object;
- QString targetID= reportFile;
- /*198:*/
- #line 4629 "./typica.w"
-
- ScriptQMainWindow*window= new ScriptQMainWindow;
- window->setObjectName(targetID);
- object= engine->newQObject(window);
- setQMainWindowProperties(object,engine);
- QWidget*central= new(QWidget);
- central->setParent(window);
- central->setObjectName("centralWidget");
- window->setCentralWidget(central);
- if(element.hasChildNodes())
- {
- /*199:*/
- #line 4664 "./typica.w"
-
- QStack<QWidget*> widgetStack;
- QStack<QLayout*> layoutStack;
- QString windowScript;
- widgetStack.push(central);
- QDomNodeList windowChildren= element.childNodes();
- int i= 0;
- while(i<windowChildren.count())
- {
- QDomNode current;
- QDomElement element;
- current= windowChildren.at(i);
- if(current.isElement())
- {
- element= current.toElement();
- if(element.tagName()=="program")
- {
- windowScript.append(element.text());
- }
- else if(element.tagName()=="layout")
- {
- element.setAttribute("trcontext","configuration");
- addLayoutToWidget(element,&widgetStack,&layoutStack);
- }
- else if(element.tagName()=="menu")
- {
- /*200:*/
- #line 4712 "./typica.w"
-
- QMenuBar*bar= window->menuBar();
- bar->setParent(window);
- bar->setObjectName("menuBar");
- if(element.hasAttribute("name"))
- {
- QMenu*menu= bar->addMenu(QCoreApplication::translate("configuration",
- element.attribute("name").toUtf8().data()));
- menu->setParent(bar);
- if(element.hasAttribute("type"))
- {
- if(element.attribute("type")=="reports")
- {
- if(element.hasAttribute("src"))
- {
- /*640:*/
- #line 13839 "./typica.w"
-
- QSettings settings;
- QString reportDirectory= QString("%1/%2").arg(settings.value("config").
- toString()).
- arg(element.attribute("src"));
- QDir::addSearchPath("reports",reportDirectory);
- QDir directory(reportDirectory);
- directory.setFilter(QDir::Files);
- directory.setSorting(QDir::Name);
- QStringList nameFilter;
- nameFilter<<"*.xml";
- directory.setNameFilters(nameFilter);
- QFileInfoList reportFiles= directory.entryInfoList();
- for(int i= 0;i<reportFiles.size();i++)
- {
- QFileInfo reportFile= reportFiles.at(i);
- /*644:*/
- #line 13919 "./typica.w"
-
- QString path= reportFile.absoluteFilePath();
- QFile file(path);
- if(file.open(QIODevice::ReadOnly))
- {
- QDomDocument document;
- document.setContent(&file,true);
- QDomElement root= document.documentElement();
- QString translationContext= root.attribute("id");
- QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
- if(!titleNode.isNull())
- {
- QDomElement titleElement= titleNode.toElement();
- QString title= QCoreApplication::translate("configuration",
- titleElement.text().toUtf8().data());
- if(!title.isEmpty())
- {
- QStringList hierarchy= title.split(":->");
- QMenu*insertionPoint= menu;
- /*645:*/
- #line 13948 "./typica.w"
-
- for(int j= 0;j<hierarchy.size()-1;j++)
- {
- QObjectList menuList= insertionPoint->children();
- bool menuFound= false;
- for(int k= 0;k<menuList.size();k++)
- {
- QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
- if(currentItem)
- {
- if(currentItem->title()==hierarchy.at(j))
- {
- menuFound= true;
- insertionPoint= currentItem;
- break;
- }
- }
- }
- if(!menuFound)
- {
- insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
- }
- }
-
- /*:645*/
- #line 13938 "./typica.w"
-
- ReportAction*action= new ReportAction(path,hierarchy.last());
- insertionPoint->addAction(action);
- }
- }
- }
-
- /*:644*/
- #line 13855 "./typica.w"
-
- }
-
- /*:640*/
- #line 4727 "./typica.w"
-
- }
- }
- }
- if(element.hasChildNodes())
- {
- /*201:*/
- #line 4740 "./typica.w"
-
- QDomNodeList menuItems= element.childNodes();
- int j= 0;
- while(j<menuItems.count())
- {
- QDomNode item= menuItems.at(j);
- if(item.isElement())
- {
- QDomElement itemElement= item.toElement();
- if(itemElement.tagName()=="item")
- {
- QAction*itemAction= new QAction(QCoreApplication::translate("configuration",
- itemElement.text().toUtf8().data()),menu);
- if(itemElement.hasAttribute("id"))
- {
- itemAction->setObjectName(itemElement.attribute("id"));
- }
- if(itemElement.hasAttribute("shortcut"))
- {
- itemAction->setShortcut(itemElement.attribute("shortcut"));
- }
- menu->addAction(itemAction);
- }
- else if(itemElement.tagName()=="separator")
- {
- menu->addSeparator();
- }
- }
- j++;
- }
-
- #line 1 "./helpmenu.w"
- /*:201*/
- #line 4733 "./typica.w"
-
- }
- }
-
- /*:200*/
- #line 4690 "./typica.w"
-
- }
- }
- i++;
- }
- QScriptValue oldThis= context->thisObject();
- context->setThisObject(object);
- QScriptValue result= engine->evaluate(windowScript);
- /*192:*/
- #line 4446 "./typica.w"
-
- if(engine->hasUncaughtException())
- {
- int line= engine->uncaughtExceptionLineNumber();
- qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
- result.toString();
- QString trace;
- foreach(trace,engine->uncaughtExceptionBacktrace())
- {
- qDebug()<<trace;
- }
- }
-
- /*:192*/
- #line 4698 "./typica.w"
-
- context->setThisObject(oldThis);
-
- /*:199*/
- #line 4640 "./typica.w"
-
- }
- /*202:*/
- #line 9 "./helpmenu.w"
-
- HelpMenu*helpMenu= new HelpMenu();
- window->menuBar()->addMenu(helpMenu);
-
- /*:202*/
- #line 4642 "./typica.w"
-
- window->show();
-
- /*:198*/
- #line 13908 "./typica.w"
-
- file.close();
- engine->popContext();
- }
- }
-
- /*:643*/
- #line 588 "./typica.w"
-
- /*241:*/
- #line 5826 "./typica.w"
-
- NumericDelegate::NumericDelegate(QObject*parent):
- QItemDelegate(parent)
- {
-
- }
-
- /*:241*//*242:*/
- #line 5838 "./typica.w"
-
- void NumericDelegate::setEditorData(QWidget*editor,
- const QModelIndex&index)const
- {
- QString value= index.model()->data(index,Qt::EditRole).toString();
- QLineEdit*line= static_cast<QLineEdit*> (editor);
- line->setText(value);
- }
-
- /*:242*//*243:*/
- #line 5853 "./typica.w"
-
- void NumericDelegate::setModelData(QWidget*editor,QAbstractItemModel*model,
- const QModelIndex&index)const
- {
- QLineEdit*line= static_cast<QLineEdit*> (editor);
- model->setData(index,line->text(),Qt::EditRole);
- QScriptEngine*engine= AppInstance->engine;
- engine->pushContext();
- QString script= QString("Number(%1)").arg(line->text());
- QScriptValue result= engine->evaluate(line->text());
- if(result.isNumber())
- {
- model->setData(index,result.toVariant(),Qt::DisplayRole);
- }
- else
- {
- model->setData(index,QVariant(),Qt::DisplayRole);
- }
- engine->popContext();
- }
-
- /*:243*//*244:*/
- #line 5876 "./typica.w"
-
- QWidget*NumericDelegate::createEditor(QWidget*parent,
- const QStyleOptionViewItem&,
- const QModelIndex&)const
- {
- return(new QLineEdit(parent));
- }
-
- /*:244*//*245:*/
- #line 5887 "./typica.w"
-
- void NumericDelegate::updateEditorGeometry(QWidget*editor,
- const QStyleOptionViewItem&option,
- const QModelIndex&)const
- {
- editor->setGeometry(option.rect);
- }
-
- /*:245*/
- #line 589 "./typica.w"
-
- /*786:*/
- #line 16650 "./typica.w"
-
- NiDaqMxDriverConfWidget::NiDaqMxDriverConfWidget(DeviceTreeModel*model,
- const QModelIndex&index)
- :BasicDeviceConfigurationWidget(model,index)
- {
- QHBoxLayout*layout= new QHBoxLayout;
- QToolButton*addDeviceButton= new QToolButton;
- addDeviceButton->setText(tr("Add Device"));
- NodeInserter*add9211a= new NodeInserter("NI USB 9211A","NI USB 9211A",
- "nidaqmx9211series");
- NodeInserter*addtc01= new NodeInserter("NI USB TC01","NI USB TC01",
- "nidaqmxtc01");
- connect(add9211a,SIGNAL(triggered(QString,QString)),
- this,SLOT(insertChildNode(QString,QString)));
- connect(addtc01,SIGNAL(triggered(QString,QString)),
- this,SLOT(insertChildNode(QString,QString)));
- QMenu*deviceMenu= new QMenu;
- deviceMenu->addAction(add9211a);
- deviceMenu->addAction(addtc01);
- addDeviceButton->setMenu(deviceMenu);
- addDeviceButton->setPopupMode(QToolButton::InstantPopup);
- layout->addWidget(addDeviceButton);
- setLayout(layout);
- }
-
- /*:786*/
- #line 590 "./typica.w"
-
- /*788:*/
- #line 16699 "./typica.w"
-
- NiDaqMx9211ConfWidget::NiDaqMx9211ConfWidget(DeviceTreeModel*model,
- const QModelIndex&index)
- :BasicDeviceConfigurationWidget(model,index)
- {
- QVBoxLayout*layout= new QVBoxLayout;
- QHBoxLayout*deviceIdLayout= new QHBoxLayout;
- QLabel*label= new QLabel(tr("Device ID:"));
- QLineEdit*deviceId= new QLineEdit;
- deviceIdLayout->addWidget(label);
- deviceIdLayout->addWidget(deviceId);
- QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
- layout->addLayout(deviceIdLayout);
- layout->addWidget(addChannelButton);
- /*771:*/
- #line 16334 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:771*/
- #line 16713 "./typica.w"
-
- for(int i= 0;i<configData.size();i++)
- {
- node= configData.at(i).toElement();
- if(node.attribute("name")=="deviceID")
- {
- deviceId->setText(node.attribute("value","Dev1"));
- break;
- }
- }
- updateDeviceId(deviceId->text());
- connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
- connect(deviceId,SIGNAL(textEdited(QString)),
- this,SLOT(updateDeviceId(QString)));
- setLayout(layout);
- }
-
- void NiDaqMx9211ConfWidget::updateDeviceId(const QString&newId)
- {
- updateAttribute("deviceID",newId);
- }
-
- void NiDaqMx9211ConfWidget::addChannel()
- {
- insertChildNode(tr("Thermocouple channel"),"ni9211seriestc");
- }
-
- /*:788*/
- #line 591 "./typica.w"
-
- /*790:*/
- #line 16764 "./typica.w"
-
- NiDaqMxTc01ConfWidget::NiDaqMxTc01ConfWidget(DeviceTreeModel*model,
- const QModelIndex&index)
- :BasicDeviceConfigurationWidget(model,index)
- {
- QFormLayout*layout= new QFormLayout;
- QLineEdit*deviceId= new QLineEdit;
- layout->addRow(tr("Device ID:"),deviceId);
- QLineEdit*columnName= new QLineEdit;
- layout->addRow(tr("Column Name:"),columnName);
- QComboBox*typeSelector= new QComboBox;
- typeSelector->addItem("J");
- typeSelector->addItem("K");
- typeSelector->addItem("T");
- typeSelector->addItem("B");
- typeSelector->addItem("E");
- typeSelector->addItem("N");
- typeSelector->addItem("R");
- typeSelector->addItem("S");
- layout->addRow(tr("Thermocouple Type:"),typeSelector);
- QCheckBox*hideSeries= new QCheckBox(tr("Hide this channel"));
- layout->addRow(hideSeries);
- /*771:*/
- #line 16334 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:771*/
- #line 16786 "./typica.w"
-
- for(int i= 0;i<configData.size();i++)
- {
- node= configData.at(i).toElement();
- if(node.attribute("name")=="deviceID")
- {
- deviceId->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="type")
- {
- typeSelector->setCurrentIndex(typeSelector->findText(node.attribute("value")));
- }
- else if(node.attribute("name")=="columnname")
- {
- columnName->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="hidden")
- {
- hideSeries->setChecked(node.attribute("value")=="true");
- }
- }
- updateDeviceId(deviceId->text());
- updateThermocoupleType(typeSelector->currentText());
- updateColumnName(columnName->text());
- updateHidden(hideSeries->isChecked());
- connect(deviceId,SIGNAL(textEdited(QString)),this,SLOT(updateDeviceId(QString)));
- connect(typeSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateThermocoupleType(QString)));
- connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
- setLayout(layout);
- connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
- }
-
- void NiDaqMxTc01ConfWidget::updateDeviceId(const QString&newId)
- {
- updateAttribute("deviceID",newId);
- }
-
- void NiDaqMxTc01ConfWidget::updateThermocoupleType(const QString&type)
- {
- updateAttribute("type",type);
- }
-
- void NiDaqMxTc01ConfWidget::updateColumnName(const QString&name)
- {
- updateAttribute("columnname",name);
- }
-
- void NiDaqMxTc01ConfWidget::updateHidden(bool hidden)
- {
- updateAttribute("hidden",hidden?"true":"false");
- }
-
- /*:790*/
- #line 592 "./typica.w"
-
- /*808:*/
- #line 17202 "./typica.w"
-
- ModbusRtuPortConfWidget::ModbusRtuPortConfWidget(DeviceTreeModel*model,
- const QModelIndex&index)
- :BasicDeviceConfigurationWidget(model,index)
- {
- QFormLayout*layout= new QFormLayout;
- QToolButton*addDeviceButton= new QToolButton;
- addDeviceButton->setText(tr("Add Device"));
- NodeInserter*addModbusRtuDevice= new NodeInserter("Modbus RTU Device",
- "Modbus RTU Device",
- "modbusrtudevice");
- connect(addModbusRtuDevice,SIGNAL(triggered(QString,QString)),
- this,SLOT(insertChildNode(QString,QString)));
- QMenu*deviceMenu= new QMenu;
- deviceMenu->addAction(addModbusRtuDevice);
- addDeviceButton->setMenu(deviceMenu);
- addDeviceButton->setPopupMode(QToolButton::InstantPopup);
- layout->addRow(QString(),addDeviceButton);
- PortSelector*port= new PortSelector;
- layout->addRow(tr("Port:"),port);
- connect(port,SIGNAL(currentIndexChanged(QString)),
- this,SLOT(updatePort(QString)));
- connect(port,SIGNAL(editTextChanged(QString)),
- this,SLOT(updatePort(QString)));
- BaudSelector*rate= new BaudSelector;
- layout->addRow(tr("Baud:"),rate);
- connect(rate,SIGNAL(currentIndexChanged(QString)),
- this,SLOT(updateBaudRate(QString)));
- ParitySelector*parity= new ParitySelector;
- layout->addRow(tr("Parity:"),parity);
- connect(parity,SIGNAL(currentIndexChanged(QString)),
- this,SLOT(updateParity(QString)));
- FlowSelector*flow= new FlowSelector;
- layout->addRow(tr("Flow Control:"),flow);
- connect(flow,SIGNAL(currentIndexChanged(QString)),
- this,SLOT(updateFlowControl(QString)));
- StopSelector*stop= new StopSelector;
- layout->addRow(tr("Stop Bits:"),stop);
- connect(stop,SIGNAL(currentIndexChanged(QString)),
- this,SLOT(updateStopBits(QString)));
- /*771:*/
- #line 16334 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:771*/
- #line 17242 "./typica.w"
-
- for(int i= 0;i<configData.size();i++)
- {
- node= configData.at(i).toElement();
- if(node.attribute("name")=="port")
- {
- int j= port->findText(node.attribute("value"));
- if(j>=0)
- {
- port->setCurrentIndex(j);
- }
- else
- {
- port->insertItem(0,node.attribute("value"));
- port->setCurrentIndex(0);
- }
- }
- else if(node.attribute("name")=="baudrate")
- {
- rate->setCurrentIndex(rate->findText(node.attribute("value")));
- }
- else if(node.attribute("name")=="parity")
- {
- parity->setCurrentIndex(parity->findText(node.attribute("value")));
- }
- else if(node.attribute("name")=="flowcontrol")
- {
- flow->setCurrentIndex(flow->findText(node.attribute("value")));
- }
- else if(node.attribute("name")=="stopbits")
- {
- stop->setCurrentIndex(stop->findText(node.attribute("value")));
- }
- }
- updatePort(port->currentText());
- updateBaudRate(rate->currentText());
- updateParity(parity->currentText());
- updateFlowControl(flow->currentText());
- updateStopBits(stop->currentText());
- setLayout(layout);
- }
-
- void ModbusRtuPortConfWidget::updatePort(const QString&newPort)
- {
- updateAttribute("port",newPort);
- }
-
- void ModbusRtuPortConfWidget::updateBaudRate(const QString&newRate)
- {
- updateAttribute("baudrate",newRate);
- }
-
- void ModbusRtuPortConfWidget::updateParity(const QString&newParity)
- {
- updateAttribute("parity",newParity);
- }
-
- void ModbusRtuPortConfWidget::updateFlowControl(const QString&newFlow)
- {
- updateAttribute("flowcontrol",newFlow);
- }
-
- void ModbusRtuPortConfWidget::updateStopBits(const QString&newStopBits)
- {
- updateAttribute("stopbits",newStopBits);
- }
-
- /*:808*/
- #line 593 "./typica.w"
-
- /*810:*/
- #line 17365 "./typica.w"
-
- ModbusRtuDeviceConfWidget::ModbusRtuDeviceConfWidget(DeviceTreeModel*model,
- const QModelIndex&index)
- :BasicDeviceConfigurationWidget(model,index),
- unitSpecificationLayout(new QStackedLayout),
- decimalSpecificationLayout(new QStackedLayout)
- {
- QVBoxLayout*layout= new QVBoxLayout;
- QToolButton*addChannelButton= new QToolButton;
- addChannelButton->setText(tr("Add Channel"));
- NodeInserter*addTemperaturePV= new NodeInserter("Temperature Process Value",
- "Temperature Process Value",
- "modbustemperaturepv");
- NodeInserter*addTemperatureSV= new NodeInserter("Temperature Set Value",
- "Temperature Set Value",
- "modbustemperaturesv");
- connect(addTemperaturePV,SIGNAL(triggered(QString,QString)),
- this,SLOT(insertChildNode(QString,QString)));
- connect(addTemperatureSV,SIGNAL(triggered(QString,QString)),
- this,SLOT(insertChildNode(QString,QString)));
- QMenu*channelMenu= new QMenu;
- channelMenu->addAction(addTemperaturePV);
- channelMenu->addAction(addTemperatureSV);
- addChannelButton->setMenu(channelMenu);
- addChannelButton->setPopupMode(QToolButton::InstantPopup);
- layout->addWidget(addChannelButton);
- QHBoxLayout*stationLayout= new QHBoxLayout;
- QLabel*stationLabel= new QLabel(tr("Station:"));
- QSpinBox*stationNumber= new QSpinBox;
- stationNumber->setMinimum(0);
- stationNumber->setMaximum(255);
- stationLayout->addWidget(stationLabel);
- stationLayout->addWidget(stationNumber);
- layout->addLayout(stationLayout);
- QCheckBox*fixedUnit= new QCheckBox(tr("Fixed Temperature Unit"));
- layout->addWidget(fixedUnit);
- QWidget*fixedUnitPlaceholder= new QWidget(this);
- QHBoxLayout*fixedUnitLayout= new QHBoxLayout;
- QLabel*fixedUnitLabel= new QLabel(tr("Temperature Unit:"));
- QComboBox*fixedUnitSelector= new QComboBox;
- fixedUnitSelector->addItem("Fahrenheit");
- fixedUnitSelector->addItem("Celsius");
- fixedUnitLayout->addWidget(fixedUnitLabel);
- fixedUnitLayout->addWidget(fixedUnitSelector);
- fixedUnitPlaceholder->setLayout(fixedUnitLayout);
- unitSpecificationLayout->addWidget(fixedUnitPlaceholder);
- QWidget*queriedUnitPlaceholder= new QWidget(this);
- QFormLayout*queriedUnitLayout= new QFormLayout;
- ShortHexSpinBox*unitAddress= new ShortHexSpinBox;
- queriedUnitLayout->addRow(tr("Function 0x03 Unit Address:"),unitAddress);
- QSpinBox*valueF= new QSpinBox;
- valueF->setMinimum(0);
- valueF->setMaximum(65535);
- queriedUnitLayout->addRow(tr("Value for Fahrenheit"),valueF);
- QSpinBox*valueC= new QSpinBox;
- valueC->setMinimum(0);
- valueC->setMaximum(65535);
- queriedUnitLayout->addRow(tr("Value for Celsius"),valueC);
- queriedUnitPlaceholder->setLayout(queriedUnitLayout);
- unitSpecificationLayout->addWidget(queriedUnitPlaceholder);
- layout->addLayout(unitSpecificationLayout);
- QCheckBox*fixedPrecision= new QCheckBox(tr("Fixed Precision"));
- layout->addWidget(fixedPrecision);
- QWidget*fixedPrecisionPlaceholder= new QWidget(this);
- QFormLayout*fixedPrecisionLayout= new QFormLayout;
- QSpinBox*fixedPrecisionValue= new QSpinBox;
- fixedPrecisionValue->setMinimum(0);
- fixedPrecisionValue->setMaximum(9);
- fixedPrecisionLayout->addRow("Places after the decimal point:",
- fixedPrecisionValue);
- fixedPrecisionPlaceholder->setLayout(fixedPrecisionLayout);
- decimalSpecificationLayout->addWidget(fixedPrecisionPlaceholder);
- QWidget*queriedPrecisionPlaceholder= new QWidget(this);
- QFormLayout*queriedPrecisionLayout= new QFormLayout;
- ShortHexSpinBox*precisionAddress= new ShortHexSpinBox;
- queriedPrecisionLayout->addRow("Function 0x03 Decimal Position Address:",
- precisionAddress);
- queriedPrecisionPlaceholder->setLayout(queriedPrecisionLayout);
- decimalSpecificationLayout->addWidget(queriedPrecisionPlaceholder);
- layout->addLayout(decimalSpecificationLayout);
- /*771:*/
- #line 16334 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:771*/
- #line 17445 "./typica.w"
-
- for(int i= 0;i<configData.size();i++)
- {
- node= configData.at(i).toElement();
- if(node.attribute("name")=="station")
- {
- stationNumber->setValue(node.attribute("value").toInt());
- }
- else if(node.attribute("name")=="fixedunit")
- {
- if(node.attribute("value")=="true")
- {
- fixedUnit->setCheckState(Qt::Checked);
- }
- else if(node.attribute("value")=="false")
- {
- fixedUnit->setCheckState(Qt::Unchecked);
- }
- }
- else if(node.attribute("name")=="fixedprecision")
- {
- fixedPrecisionValue->setValue(node.attribute("value").toInt());
- }
- else if(node.attribute("name")=="unit")
- {
- fixedUnitSelector->setCurrentIndex(fixedUnitSelector->findText(node.attribute("value")));
- }
- else if(node.attribute("name")=="unitaddress")
- {
- unitAddress->setValue(node.attribute("value").toInt());
- }
- else if(node.attribute("name")=="fvalue")
- {
- valueF->setValue(node.attribute("value").toInt());
- }
- else if(node.attribute("name")=="cvalue")
- {
- valueC->setValue(node.attribute("value").toInt());
- }
- else if(node.attribute("name")=="precisionaddress")
- {
- precisionAddress->setValue(node.attribute("value").toInt());
- }
- else if(node.attribute("name")=="precision")
- {
- fixedPrecisionValue->setValue(node.attribute("value").toInt());
- }
- }
- updateStationNumber(stationNumber->value());
- updateFixedUnit(fixedUnit->isChecked());
- updateFixedDecimal(fixedPrecision->isChecked());
- updateUnit(fixedUnitSelector->currentText());
- updateUnitAddress(unitAddress->value());
- updateValueF(valueF->value());
- updateValueC(valueC->value());
- updatePrecisionAddress(precisionAddress->value());
- updatePrecisionValue(fixedPrecisionValue->value());
- connect(stationNumber,SIGNAL(valueChanged(int)),
- this,SLOT(updateStationNumber(int)));
- connect(fixedUnitSelector,SIGNAL(currentIndexChanged(QString)),
- this,SLOT(updateUnit(QString)));
- connect(unitAddress,SIGNAL(valueChanged(int)),
- this,SLOT(updateUnitAddress(int)));
- connect(valueF,SIGNAL(valueChanged(int)),
- this,SLOT(updateValueF(int)));
- connect(valueC,SIGNAL(valueChanged(int)),
- this,SLOT(updateValueC(int)));
- connect(fixedUnit,SIGNAL(toggled(bool)),
- this,SLOT(updateFixedUnit(bool)));
- connect(fixedPrecision,SIGNAL(toggled(bool)),
- this,SLOT(updateFixedDecimal(bool)));
- connect(fixedPrecisionValue,SIGNAL(valueChanged(int)),
- this,SLOT(updatePrecisionValue(int)));
- connect(precisionAddress,SIGNAL(valueChanged(int)),
- this,SLOT(updatePrecisionAddress(int)));
- setLayout(layout);
- }
-
- void ModbusRtuDeviceConfWidget::updateStationNumber(int newStation)
- {
- updateAttribute("station",QString("%1").arg(newStation));
- }
-
- void ModbusRtuDeviceConfWidget::updateFixedUnit(bool newFixed)
- {
- if(newFixed)
- {
- unitSpecificationLayout->setCurrentIndex(0);
- updateAttribute("fixedunit","true");
- }
- else
- {
- unitSpecificationLayout->setCurrentIndex(1);
- updateAttribute("fixedunit","false");
- }
- }
-
- void ModbusRtuDeviceConfWidget::updateFixedDecimal(bool newFixed)
- {
- if(newFixed)
- {
- decimalSpecificationLayout->setCurrentIndex(0);
- updateAttribute("fixedprecision","true");
- }
- else
- {
- decimalSpecificationLayout->setCurrentIndex(1);
- updateAttribute("fixedprecision","false");
- }
- }
-
- void ModbusRtuDeviceConfWidget::updateUnit(const QString&newUnit)
- {
- updateAttribute("unit",newUnit);
- }
-
- void ModbusRtuDeviceConfWidget::updateUnitAddress(int newAddress)
- {
- updateAttribute("unitaddress",QString("%1").arg(newAddress));
- }
-
- void ModbusRtuDeviceConfWidget::updateValueF(int newValue)
- {
- updateAttribute("fvalue",QString("%1").arg(newValue));
- }
-
- void ModbusRtuDeviceConfWidget::updateValueC(int newValue)
- {
- updateAttribute("cvalue",QString("%1").arg(newValue));
- }
-
- void ModbusRtuDeviceConfWidget::updatePrecisionAddress(int newAddress)
- {
- updateAttribute("precisionaddress",QString("%1").arg(newAddress));
- }
-
- void ModbusRtuDeviceConfWidget::updatePrecisionValue(int newValue)
- {
- updateAttribute("precision",QString("%1").arg(newValue));
- }
-
- /*:810*/
- #line 594 "./typica.w"
-
- /*812:*/
- #line 17608 "./typica.w"
-
- ModbusRtuDeviceTPvConfWidget::ModbusRtuDeviceTPvConfWidget(DeviceTreeModel*model,
- const QModelIndex&index)
- :BasicDeviceConfigurationWidget(model,index)
- {
- QFormLayout*layout= new QFormLayout;
- ShortHexSpinBox*address= new ShortHexSpinBox;
- layout->addRow(tr("Function 0x04 Process Value Address"),address);
- /*771:*/
- #line 16334 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:771*/
- #line 17616 "./typica.w"
-
- for(int i= 0;i<configData.size();i++)
- {
- node= configData.at(i).toElement();
- if(node.attribute("name")=="address")
- {
- address->setValue(node.attribute("value").toInt());
- break;
- }
- }
- updateAddress(address->value());
- connect(address,SIGNAL(valueChanged(int)),this,SLOT(updateAddress(int)));
- setLayout(layout);
- }
-
- void ModbusRtuDeviceTPvConfWidget::updateAddress(int newAddress)
- {
- updateAttribute("address",QString("%1").arg(newAddress));
- }
-
- /*:812*/
- #line 595 "./typica.w"
-
- /*814:*/
- #line 17664 "./typica.w"
-
- ModbusRtuDeviceTSvConfWidget::ModbusRtuDeviceTSvConfWidget(DeviceTreeModel*model,
- const QModelIndex&index)
- :BasicDeviceConfigurationWidget(model,index),boundsLayout(new QStackedLayout)
- {
- QVBoxLayout*layout= new QVBoxLayout;
- QFormLayout*addressLayout= new QFormLayout;
- ShortHexSpinBox*readAddress= new ShortHexSpinBox;
- ShortHexSpinBox*writeAddress= new ShortHexSpinBox;
- addressLayout->addRow(tr("Function 0x04 Read Set Value Address:"),readAddress);
- addressLayout->addRow(tr("Function 0x06 Write Set Value Address:"),writeAddress);
- layout->addLayout(addressLayout);
- QCheckBox*fixedRange= new QCheckBox(tr("Fixed Set Value Range"));
- layout->addWidget(fixedRange);
- QWidget*queriedRangePlaceholder= new QWidget(this);
- QFormLayout*queriedRangeLayout= new QFormLayout;
- ShortHexSpinBox*lowerAddress= new ShortHexSpinBox;
- ShortHexSpinBox*upperAddress= new ShortHexSpinBox;
- queriedRangeLayout->addRow(tr("Function 0x03 Minimum Set Value Address"),
- lowerAddress);
- queriedRangeLayout->addRow(tr("Function 0x03 Maximum Set Value Address"),
- upperAddress);
- queriedRangePlaceholder->setLayout(queriedRangeLayout);
- boundsLayout->addWidget(queriedRangePlaceholder);
- QWidget*fixedRangePlaceholder= new QWidget(this);
- QFormLayout*fixedRangeLayout= new QFormLayout;
- QLineEdit*fixedLower= new QLineEdit;
- QLineEdit*fixedUpper= new QLineEdit;
- fixedRangeLayout->addRow(tr("Minimum Set Value:"),fixedLower);
- fixedRangeLayout->addRow(tr("Maximum Set Value:"),fixedUpper);
- fixedRangePlaceholder->setLayout(fixedRangeLayout);
- boundsLayout->addWidget(fixedRangePlaceholder);
- layout->addLayout(boundsLayout);
- /*771:*/
- #line 16334 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:771*/
- #line 17697 "./typica.w"
-
- for(int i= 0;i<configData.size();i++)
- {
- node= configData.at(i).toElement();
- if(node.attribute("name")=="readaddress")
- {
- readAddress->setValue(node.attribute("value").toInt());
- }
- else if(node.attribute("name")=="writeaddress")
- {
- writeAddress->setValue(node.attribute("value").toInt());
- }
- else if(node.attribute("name")=="fixedrange")
- {
- if(node.attribute("value")=="true")
- {
- fixedRange->setCheckState(Qt::Checked);
- }
- else if(node.attribute("value")=="false")
- {
- fixedRange->setCheckState(Qt::Unchecked);
- }
- }
- else if(node.attribute("name")=="fixedlower")
- {
- fixedLower->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="fixedupper")
- {
- fixedUpper->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="loweraddress")
- {
- lowerAddress->setValue(node.attribute("value").toInt());
- }
- else if(node.attribute("name")=="upperaddress")
- {
- upperAddress->setValue(node.attribute("value").toInt());
- }
- }
- updateReadAddress(readAddress->value());
- updateWriteAddress(writeAddress->value());
- updateFixedRange(fixedRange->isChecked());
- updateLower(fixedLower->text());
- updateUpper(fixedUpper->text());
- updateLowerAddress(lowerAddress->value());
- updateUpperAddress(upperAddress->value());
- connect(readAddress,SIGNAL(valueChanged(int)),
- this,SLOT(updateReadAddress(int)));
- connect(writeAddress,SIGNAL(valueChanged(int)),
- this,SLOT(updateWriteAddress(int)));
- connect(fixedRange,SIGNAL(toggled(bool)),this,SLOT(updateFixedRange(bool)));
- connect(fixedLower,SIGNAL(textChanged(QString)),
- this,SLOT(updateLower(QString)));
- connect(fixedUpper,SIGNAL(textChanged(QString)),
- this,SLOT(updateUpper(QString)));
- connect(lowerAddress,SIGNAL(valueChanged(int)),
- this,SLOT(updateLowerAddress(int)));
- connect(upperAddress,SIGNAL(valueChanged(int)),
- this,SLOT(updateUpperAddress(int)));
- setLayout(layout);
- }
-
- void ModbusRtuDeviceTSvConfWidget::updateReadAddress(int newAddress)
- {
- updateAttribute("readaddress",QString("%1").arg(newAddress));
- }
-
- void ModbusRtuDeviceTSvConfWidget::updateWriteAddress(int newAddress)
- {
- updateAttribute("writeaddress",QString("%1").arg(newAddress));
- }
-
- void ModbusRtuDeviceTSvConfWidget::updateFixedRange(bool fixed)
- {
- if(fixed)
- {
- updateAttribute("fixedrange","true");
- boundsLayout->setCurrentIndex(1);
- }
- else
- {
- updateAttribute("fixedrange","false");
- boundsLayout->setCurrentIndex(0);
- }
- }
-
- void ModbusRtuDeviceTSvConfWidget::updateLower(const QString&lower)
- {
- updateAttribute("fixedlower",lower);
- }
-
- void ModbusRtuDeviceTSvConfWidget::updateUpper(const QString&upper)
- {
- updateAttribute("fixedupper",upper);
- }
-
- void ModbusRtuDeviceTSvConfWidget::updateLowerAddress(int newAddress)
- {
- updateAttribute("loweraddress",QString("%1").arg(newAddress));
- }
-
- void ModbusRtuDeviceTSvConfWidget::updateUpperAddress(int newAddress)
- {
- updateAttribute("upperaddress",QString("%1").arg(newAddress));
- }
-
- /*:814*/
- #line 596 "./typica.w"
-
- /*770:*/
- #line 16204 "./typica.w"
-
- RoasterConfWidget::RoasterConfWidget(DeviceTreeModel*model,const QModelIndex&index)
- :BasicDeviceConfigurationWidget(model,index)
- {
- QVBoxLayout*layout= new QVBoxLayout;
- QPushButton*addDeviceButton= new QPushButton(tr("Add Device"));
- QMenu*deviceMenu= new QMenu;
- NodeInserter*insertAction;
- foreach(insertAction,AppInstance->topLevelNodeInserters)
- {
- connect(insertAction,SIGNAL(triggered(QString,QString)),
- this,SLOT(insertChildNode(QString,QString)));
- deviceMenu->addAction(insertAction);
- }
- addDeviceButton->setMenu(deviceMenu);
- layout->addWidget(addDeviceButton);
- QPushButton*addAnnotationControlButton= new QPushButton(tr("Add Annotation Control"));
- QMenu*annotationMenu= new QMenu;
- NodeInserter*basicButtonInserter= new NodeInserter(tr("Annotation Button"),tr("Annotation Button"),"annotationbutton");
- NodeInserter*countingButtonInserter= new NodeInserter(tr("Counting Button"),tr("Counting Button"),"reconfigurablebutton");
- NodeInserter*spinBoxInserter= new NodeInserter(tr("Numeric Entry"),tr("Numeric Entry"),"annotationspinbox");
- NodeInserter*freeAnnotationInserter= new NodeInserter(tr("Free Text"),
- tr("Free Text"),
- "freeannotation");
- annotationMenu->addAction(basicButtonInserter);
- annotationMenu->addAction(countingButtonInserter);
- annotationMenu->addAction(spinBoxInserter);
- annotationMenu->addAction(freeAnnotationInserter);
- connect(basicButtonInserter,SIGNAL(triggered(QString,QString)),
- this,SLOT(insertChildNode(QString,QString)));
- connect(countingButtonInserter,SIGNAL(triggered(QString,QString)),
- this,SLOT(insertChildNode(QString,QString)));
- connect(spinBoxInserter,SIGNAL(triggered(QString,QString)),
- this,SLOT(insertChildNode(QString,QString)));
- connect(freeAnnotationInserter,SIGNAL(triggered(QString,QString)),
- this,SLOT(insertChildNode(QString,QString)));
- /*1033:*/
- #line 144 "./valueannotation.w"
-
- NodeInserter*valueAnnotationInserter= new NodeInserter(tr("Value Annotation"),
- tr("Value Annotation"),
- "valueannotation");
- annotationMenu->addAction(valueAnnotationInserter);
- connect(valueAnnotationInserter,SIGNAL(triggered(QString,QString)),
- this,SLOT(insertChildNode(QString,QString)));
-
- /*:1033*/
- #line 16240 "./typica.w"
-
- addAnnotationControlButton->setMenu(annotationMenu);
- layout->addWidget(addAnnotationControlButton);
-
- QPushButton*timersButton= new QPushButton(tr("Extra Timers"));
- QMenu*timersMenu= new QMenu;
- NodeInserter*coolingTimerInserter= new NodeInserter(tr("Cooling Timer"),tr("Cooling Timer"),"coolingtimer");
- NodeInserter*rangeTimerInserter= new NodeInserter(tr("Range Timer"),tr("Range Timer"),"rangetimer");
- NodeInserter*multirangeTimerInserter= new NodeInserter(tr("Multi-Range Timer"),tr("Multi-Range Timer"),"multirangetimer");
- timersMenu->addAction(coolingTimerInserter);
- timersMenu->addAction(rangeTimerInserter);
- timersMenu->addAction(multirangeTimerInserter);
- connect(coolingTimerInserter,SIGNAL(triggered(QString,QString)),
- this,SLOT(insertChildNode(QString,QString)));
- connect(rangeTimerInserter,SIGNAL(triggered(QString,QString)),
- this,SLOT(insertChildNode(QString,QString)));
- connect(multirangeTimerInserter,SIGNAL(triggered(QString,QString)),
- this,SLOT(insertChildNode(QString,QString)));
- timersButton->setMenu(timersMenu);
- layout->addWidget(timersButton);
-
- QPushButton*advancedButton= new QPushButton(tr("Advanced Features"));
- QMenu*advancedMenu= new QMenu;
- NodeInserter*linearsplineinserter= new NodeInserter(tr("Linear Spline Interpolated Series"),tr("Linear Spline Interpolated Series"),"linearspline");
- advancedMenu->addAction(linearsplineinserter);
- NodeInserter*translationinserter= new NodeInserter(tr("Profile Translation"),tr("Profile Translation"),"translation");
- advancedMenu->addAction(translationinserter);
- connect(linearsplineinserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
- connect(translationinserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
- /*959:*/
- #line 258 "./rate.w"
-
- NodeInserter*rateOfChangeInserter= new NodeInserter(tr("Rate of Change"),tr("Rate of Change"),"rate");
- connect(rateOfChangeInserter,SIGNAL(triggered(QString,QString)),this,SLOT(insertChildNode(QString,QString)));
- advancedMenu->addAction(rateOfChangeInserter);
-
- /*:959*/
- #line 16269 "./typica.w"
-
- advancedButton->setMenu(advancedMenu);
- layout->addWidget(advancedButton);
-
- QHBoxLayout*idLayout= new QHBoxLayout;
- QLabel*idLabel= new QLabel(tr("Machine ID for database:"));
- idLayout->addWidget(idLabel);
- QSpinBox*id= new QSpinBox;
- idLayout->addWidget(id);
- idLayout->addStretch();
- layout->addLayout(idLayout);
- QHBoxLayout*capacityLayout= new QHBoxLayout;
- QCheckBox*capacityCheckEnabled= new QCheckBox(tr("Maximum batch size:"));
- QDoubleSpinBox*capacity= new QDoubleSpinBox;
- capacity->setMinimum(0.0);
- capacity->setDecimals(3);
- capacity->setMaximum(999999.999);
- QComboBox*capacityUnit= new QComboBox;
- capacityUnit->addItem("g");
- capacityUnit->addItem("Kg");
- capacityUnit->addItem("oz");
- capacityUnit->addItem("Lb");
- capacityUnit->setCurrentIndex(3);
- capacityLayout->addWidget(capacityCheckEnabled);
- capacityLayout->addWidget(capacity);
- capacityLayout->addWidget(capacityUnit);
- capacityLayout->addStretch();
- layout->addLayout(capacityLayout);
- layout->addStretch();
- /*771:*/
- #line 16334 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:771*/
- #line 16298 "./typica.w"
-
- for(int i= 0;i<configData.size();i++)
- {
- node= configData.at(i).toElement();
- if(node.attribute("name")=="databaseid")
- {
- id->setValue(node.attribute("value").toInt());
- }
- else if(node.attribute("name")=="checkcapacity")
- {
- capacityCheckEnabled->setChecked(node.attribute("value")=="true");
- }
- else if(node.attribute("name")=="capacity")
- {
- capacity->setValue(node.attribute("value").toDouble());
- }
- else if(node.attribute("name")=="capacityunit")
- {
- capacityUnit->setCurrentIndex(capacityUnit->findText(node.attribute("value")));
- }
- }
- updateRoasterId(id->value());
- connect(id,SIGNAL(valueChanged(int)),this,SLOT(updateRoasterId(int)));
- connect(capacityCheckEnabled,SIGNAL(stateChanged(int)),this,SLOT(updateCapacityCheck(int)));
- connect(capacity,SIGNAL(valueChanged(QString)),this,SLOT(updateCapacity(QString)));
- connect(capacityUnit,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateCapacityUnit(QString)));
- setLayout(layout);
- }
-
- /*:770*//*772:*/
- #line 16344 "./typica.w"
-
- void RoasterConfWidget::updateRoasterId(int id)
- {
- updateAttribute("databaseid",QString("%1").arg(id));
- }
-
- void RoasterConfWidget::updateCapacityCheck(int value)
- {
- updateAttribute("checkcapacity",value==Qt::Checked?"true":"false");
- }
-
- void RoasterConfWidget::updateCapacity(const QString&value)
- {
- updateAttribute("capacity",value);
- }
-
- void RoasterConfWidget::updateCapacityUnit(const QString&value)
- {
- updateAttribute("capacityunit",value);
- }
-
- /*:772*/
- #line 597 "./typica.w"
-
- /*818:*/
- #line 17847 "./typica.w"
-
- AnnotationButtonConfWidget::AnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index)
- :BasicDeviceConfigurationWidget(model,index)
- {
- QFormLayout*layout= new QFormLayout;
- QLineEdit*buttonTextEdit= new QLineEdit;
- QLineEdit*annotationTextEdit= new QLineEdit;
- layout->addRow(tr("Button Text:"),buttonTextEdit);
- layout->addRow(tr("Annotation Text:"),annotationTextEdit);
- /*771:*/
- #line 16334 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:771*/
- #line 17856 "./typica.w"
-
- for(int i= 0;i<configData.size();i++)
- {
- node= configData.at(i).toElement();
- if(node.attribute("name")=="buttontext")
- {
- buttonTextEdit->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="annotationtext")
- {
- annotationTextEdit->setText(node.attribute("value"));
- }
- }
- updateButtonText(buttonTextEdit->text());
- updateAnnotationText(annotationTextEdit->text());
- connect(buttonTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateButtonText(QString)));
- connect(annotationTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateAnnotationText(QString)));
- setLayout(layout);
- }
-
- /*:818*//*819:*/
- #line 17878 "./typica.w"
-
- void AnnotationButtonConfWidget::updateButtonText(const QString&text)
- {
- updateAttribute("buttontext",text);
- }
-
- void AnnotationButtonConfWidget::updateAnnotationText(const QString&text)
- {
- updateAttribute("annotationtext",text);
- }
-
- /*:819*//*822:*/
- #line 17916 "./typica.w"
-
- ReconfigurableAnnotationButtonConfWidget::ReconfigurableAnnotationButtonConfWidget(DeviceTreeModel*model,const QModelIndex&index)
- :BasicDeviceConfigurationWidget(model,index)
- {
- QFormLayout*layout= new QFormLayout;
- QLineEdit*buttonTextEdit= new QLineEdit;
- QLineEdit*annotationTextEdit= new QLineEdit;
- layout->addRow(tr("Button Text:"),buttonTextEdit);
- layout->addRow(tr("Annotation Text:"),annotationTextEdit);
- /*771:*/
- #line 16334 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:771*/
- #line 17925 "./typica.w"
-
- for(int i= 0;i<configData.size();i++)
- {
- node= configData.at(i).toElement();
- if(node.attribute("name")=="buttontext")
- {
- buttonTextEdit->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="annotationtext")
- {
- annotationTextEdit->setText(node.attribute("value"));
- }
- }
- updateButtonText(buttonTextEdit->text());
- updateAnnotationText(annotationTextEdit->text());
- connect(buttonTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateButtonText(QString)));
- connect(annotationTextEdit,SIGNAL(textEdited(QString)),this,SLOT(updateAnnotationText(QString)));
- QTextEdit*documentation= new QTextEdit;
- 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."));
- documentation->setReadOnly(true);
- layout->addRow("",documentation);
- setLayout(layout);
- }
-
- void ReconfigurableAnnotationButtonConfWidget::updateButtonText(const QString&text)
- {
- updateAttribute("buttontext",text);
- }
-
- void ReconfigurableAnnotationButtonConfWidget::updateAnnotationText(const QString&text)
- {
- updateAttribute("annotationtext",text);
- }
-
- /*:822*/
- #line 598 "./typica.w"
-
- /*825:*/
- #line 17993 "./typica.w"
-
- NoteSpinConfWidget::NoteSpinConfWidget(DeviceTreeModel*model,const QModelIndex&index)
- :BasicDeviceConfigurationWidget(model,index)
- {
- QFormLayout*layout= new QFormLayout;
- QLineEdit*labelEdit= new QLineEdit;
- layout->addRow(tr("Control Label: "),labelEdit);
- QLineEdit*minimumEdit= new QLineEdit;
- layout->addRow(tr("Minimum Value: "),minimumEdit);
- QLineEdit*maximumEdit= new QLineEdit;
- layout->addRow(tr("Maximum Value: "),maximumEdit);
- QSpinBox*precisionEdit= new QSpinBox;
- precisionEdit->setMinimum(0);
- precisionEdit->setMaximum(9);
- layout->addRow(tr("Precision"),precisionEdit);
- QLineEdit*pretext= new QLineEdit;
- layout->addRow(tr("Prefix text"),pretext);
- QLineEdit*posttext= new QLineEdit;
- layout->addRow(tr("Suffix text"),posttext);
- /*771:*/
- #line 16334 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:771*/
- #line 18012 "./typica.w"
-
- for(int i= 0;i<configData.size();i++)
- {
- node= configData.at(i).toElement();
- if(node.attribute("name")=="label")
- {
- labelEdit->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="minimum")
- {
- minimumEdit->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="maximum")
- {
- maximumEdit->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="precision")
- {
- precisionEdit->setValue(node.attribute("value").toInt());
- }
- else if(node.attribute("name")=="pretext")
- {
- pretext->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="posttext")
- {
- posttext->setText(node.attribute("value"));
- }
- }
- updateLabel(labelEdit->text());
- updateMinimum(minimumEdit->text());
- updateMaximum(maximumEdit->text());
- updatePrecision(precisionEdit->value());
- updatePretext(pretext->text());
- updatePosttext(posttext->text());
- connect(labelEdit,SIGNAL(textEdited(QString)),this,SLOT(updateLabel(QString)));
- connect(minimumEdit,SIGNAL(textEdited(QString)),this,SLOT(updateMinimum(QString)));
- connect(maximumEdit,SIGNAL(textEdited(QString)),this,SLOT(updateMaximum(QString)));
- connect(precisionEdit,SIGNAL(valueChanged(int)),this,SLOT(updatePrecision(int)));
- connect(pretext,SIGNAL(textEdited(QString)),this,SLOT(updatePretext(QString)));
- connect(posttext,SIGNAL(textEdited(QString)),this,SLOT(updatePosttext(QString)));
- setLayout(layout);
- }
-
- void NoteSpinConfWidget::updateLabel(const QString&text)
- {
- updateAttribute("label",text);
- }
-
- void NoteSpinConfWidget::updateMinimum(const QString&minimum)
- {
- updateAttribute("minimum",minimum);
- }
-
- void NoteSpinConfWidget::updateMaximum(const QString&maximum)
- {
- updateAttribute("maximum",maximum);
- }
-
- void NoteSpinConfWidget::updatePrecision(int precision)
- {
- updateAttribute("precision",QString("%1").arg(precision));
- }
-
- void NoteSpinConfWidget::updatePretext(const QString&text)
- {
- updateAttribute("pretext",text);
- }
-
- void NoteSpinConfWidget::updatePosttext(const QString&text)
- {
- updateAttribute("posttext",text);
- }
-
- /*:825*/
- #line 599 "./typica.w"
-
- /*334:*/
- #line 7546 "./typica.w"
-
- LinearCalibrator::LinearCalibrator(QObject*parent):
- QObject(parent),Lo1(0),Lo2(0),Up1(1),Up2(1),sensitivitySetting(0.0),clamp(false)
- {
- connect(this,SIGNAL(measurement(Measurement)),this,SIGNAL(newData(Measurement)));
- }
-
- /*:334*//*335:*/
- #line 7560 "./typica.w"
-
- Measurement LinearCalibrator::newMeasurement(Measurement measure)
- {
- double outval= Lo1+(measure.temperature()-Lo2)*(Up1-Lo1)/(Up2-Lo2);
- if(clamp)
- {
- if(outval<Lo1)
- {
- outval= Lo1;
- }
- else if(outval> Up1)
- {
- outval= Up1;
- }
- }
- if(sensitivitySetting>=0.05)
- {
- int temp= qRound(outval/sensitivitySetting);
- outval= temp*sensitivitySetting;
- }
- Measurement adjusted(outval,measure.time(),measure.scale());
- emit measurement(adjusted);
- return adjusted;
- }
-
- /*:335*//*336:*/
- #line 7587 "./typica.w"
-
- double LinearCalibrator::measuredLower()
- {
- return Lo2;
- }
-
- double LinearCalibrator::measuredUpper()
- {
- return Up2;
- }
-
- double LinearCalibrator::mappedLower()
- {
- return Lo1;
- }
-
- double LinearCalibrator::mappedUpper()
- {
- return Up1;
- }
-
- bool LinearCalibrator::isClosedRange()
- {
- return clamp;
- }
-
- void LinearCalibrator::setMeasuredLower(double lower)
- {
- Lo2= lower;
- }
-
- void LinearCalibrator::setMeasuredUpper(double upper)
- {
- Up2= upper;
- }
-
- void LinearCalibrator::setMappedLower(double lower)
- {
- Lo1= lower;
- }
-
- void LinearCalibrator::setMappedUpper(double upper)
- {
- Up1= upper;
- }
-
- void LinearCalibrator::setClosedRange(bool closed)
- {
- clamp= closed;
- }
-
- void LinearCalibrator::setSensitivity(double sensitivity)
- {
- sensitivitySetting= sensitivity;
- }
-
- double LinearCalibrator::sensitivity()
- {
- return sensitivitySetting;
- }
-
- /*:336*/
- #line 600 "./typica.w"
-
- /*341:*/
- #line 7720 "./typica.w"
-
- void LinearSplineInterpolator::add_pair(double source,double destination)
- {
- pairs->insert(source,destination);
- make_interpolators();
- }
-
- void LinearSplineInterpolator::make_interpolators()
- {
- if(pairs->size()> 1)
- {
- while(interpolators->size()> 0)
- {
- LinearCalibrator*removed= interpolators->takeFirst();
- removed->deleteLater();
- }
- QMap<double,double> ::const_iterator i= pairs->constBegin();
- QMap<double,double> ::const_iterator j= i+1;
- while(j!=pairs->constEnd())
- {
- LinearCalibrator*segment= new LinearCalibrator();
- segment->setMeasuredLower(i.key());
- segment->setMappedLower(i.value());
- segment->setMeasuredUpper(j.key());
- segment->setMappedUpper(j.value());
- segment->setClosedRange(false);
- interpolators->append(segment);
- connect(segment,SIGNAL(measurement(Measurement)),this,SIGNAL(newData(Measurement)));
- i++;
- j++;
- }
- }
- }
-
- LinearSplineInterpolator::LinearSplineInterpolator(QObject*parent):
- QObject(parent),pairs(new QMap<double,double> ),
- interpolators(new QList<LinearCalibrator*> )
- {
-
- }
-
- Measurement LinearSplineInterpolator::newMeasurement(Measurement measure)
- {
- QMap<double,double> ::const_iterator i= pairs->constBegin();
- int index= -1;
- while(i!=pairs->constEnd())
- {
- if(measure.temperature()<=i.key())
- {
- break;
- }
- i++;
- index++;
- }
- if(index<0)
- {
- index= 0;
- }
- if(index>=interpolators->size())
- {
- index= interpolators->size()-1;
- }
- if(interpolators->at(index)!=NULL)
- {
- return interpolators->at(index)->newMeasurement(measure);
- }
- return Measurement();
- }
-
- /*:341*/
- #line 601 "./typica.w"
-
- /*924:*/
- #line 19361 "./typica.w"
-
- LinearSplineInterpolationConfWidget::LinearSplineInterpolationConfWidget(DeviceTreeModel*model,const QModelIndex&index)
- :BasicDeviceConfigurationWidget(model,index),tablemodel(new SaltModel(2))
- {
- QFormLayout*layout= new QFormLayout;
- QLineEdit*source= new QLineEdit;
- layout->addRow(tr("Source column name:"),source);
- QLineEdit*destination= new QLineEdit;
- layout->addRow(tr("Destination column name:"),destination);
- tablemodel->setHeaderData(0,Qt::Horizontal,"Input");
- tablemodel->setHeaderData(1,Qt::Horizontal,"Output");
- QTableView*mappingTable= new QTableView;
- mappingTable->setModel(tablemodel);
- NumericDelegate*delegate= new NumericDelegate;
- mappingTable->setItemDelegate(delegate);
- layout->addRow(tr("Mapping data:"),mappingTable);
- /*771:*/
- #line 16334 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:771*/
- #line 19377 "./typica.w"
-
- for(int i= 0;i<configData.size();i++)
- {
- node= configData.at(i).toElement();
- if(node.attribute("name")=="source")
- {
- source->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="destination")
- {
- destination->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="sourcevalues")
- {
- /*925:*/
- #line 19416 "./typica.w"
-
- QString data= node.attribute("value");
- if(data.length()> 3)
- {
- data.chop(2);
- data= data.remove(0,2);
- }
- QStringList itemList= data.split(",");
-
- /*:925*/
- #line 19391 "./typica.w"
-
- int column= 0;
- /*926:*/
- #line 19428 "./typica.w"
-
- for(int j= 0;j<itemList.size();j++)
- {
- tablemodel->setData(tablemodel->index(j,column),
- QVariant(itemList.at(j).toDouble()),
- Qt::DisplayRole);
- }
-
- /*:926*/
- #line 19393 "./typica.w"
-
-
- }
- else if(node.attribute("name")=="destinationvalues")
- {
- /*925:*/
- #line 19416 "./typica.w"
-
- QString data= node.attribute("value");
- if(data.length()> 3)
- {
- data.chop(2);
- data= data.remove(0,2);
- }
- QStringList itemList= data.split(",");
-
- /*:925*/
- #line 19398 "./typica.w"
-
- int column= 1;
- /*926:*/
- #line 19428 "./typica.w"
-
- for(int j= 0;j<itemList.size();j++)
- {
- tablemodel->setData(tablemodel->index(j,column),
- QVariant(itemList.at(j).toDouble()),
- Qt::DisplayRole);
- }
-
- /*:926*/
- #line 19400 "./typica.w"
-
- }
- }
- updateSourceColumn(source->text());
- updateDestinationColumn(destination->text());
- updateKnots();
- connect(source,SIGNAL(textEdited(QString)),this,SLOT(updateSourceColumn(QString)));
- connect(destination,SIGNAL(textEdited(QString)),this,SLOT(updateDestinationColumn(QString)));
- connect(tablemodel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(updateKnots()));
- setLayout(layout);
- }
-
- /*:924*//*927:*/
- #line 19439 "./typica.w"
-
- void LinearSplineInterpolationConfWidget::updateKnots()
- {
- updateAttribute("sourcevalues",tablemodel->arrayLiteral(0,Qt::DisplayRole));
- updateAttribute("destinationvalues",tablemodel->arrayLiteral(1,Qt::DisplayRole));
- }
-
- void LinearSplineInterpolationConfWidget::updateSourceColumn(const QString&source)
- {
- updateAttribute("source",source);
- }
-
- void LinearSplineInterpolationConfWidget::updateDestinationColumn(const QString&dest)
- {
- updateAttribute("destination",dest);
- }
-
- /*:927*/
- #line 602 "./typica.w"
-
- /*944:*/
- #line 19908 "./typica.w"
-
- TranslationConfWidget::TranslationConfWidget(DeviceTreeModel*model,const QModelIndex&index)
- :BasicDeviceConfigurationWidget(model,index),
- temperatureValue(new QDoubleSpinBox),unitSelector(new QComboBox)
- {
- unitSelector->addItem("Fahrenheit");
- unitSelector->addItem("Celsius");
- temperatureValue->setMinimum(0);
- temperatureValue->setMaximum(1000);
- QFormLayout*layout= new QFormLayout;
- QLineEdit*column= new QLineEdit;
- layout->addRow(tr("Column to match:"),column);
- layout->addRow(tr("Unit:"),unitSelector);
- layout->addRow(tr("Value:"),temperatureValue);
- /*771:*/
- #line 16334 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:771*/
- #line 19922 "./typica.w"
-
- for(int i= 0;i<configData.size();i++)
- {
- node= configData.at(i).toElement();
- if(node.attribute("name")=="column")
- {
- column->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="unit")
- {
- unitSelector->setCurrentIndex(unitSelector->findText(node.attribute("value")));
- }
- else if(node.attribute("name")=="value")
- {
- temperatureValue->setValue(node.attribute("value").toDouble());
- }
- }
- updateMatchingColumn(column->text());
- updateTemperature();
- connect(column,SIGNAL(textEdited(QString)),this,SLOT(updateMatchingColumn(QString)));
- connect(unitSelector,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateTemperature()));
- connect(temperatureValue,SIGNAL(valueChanged(double)),this,SLOT(updateTemperature()));
- setLayout(layout);
- }
-
- /*:944*//*945:*/
- #line 19951 "./typica.w"
-
- void TranslationConfWidget::updateTemperature()
- {
- updateAttribute("unit",unitSelector->currentText());
- updateAttribute("value",QString("%1").arg(temperatureValue->value()));
- if(unitSelector->currentText()=="Fahrenheit")
- {
- updateAttribute("FValue",QString("%1").arg(temperatureValue->value()));
- }
- else
- {
- updateAttribute("FValue",QString("%1").arg(temperatureValue->value()*9/5+32));
- }
- }
-
- void TranslationConfWidget::updateMatchingColumn(const QString&column)
- {
- updateAttribute("column",column);
- }
-
- /*:945*/
- #line 603 "./typica.w"
-
- /*828:*/
- #line 24 "./freeannotation.w"
-
- FreeAnnotationConfWidget::FreeAnnotationConfWidget(DeviceTreeModel*model,
- const QModelIndex&index)
- :BasicDeviceConfigurationWidget(model,index)
- {
- QFormLayout*layout= new QFormLayout;
- QLineEdit*labelEdit= new QLineEdit;
- layout->addRow(tr("Label Text:"),labelEdit);
- /*771:*/
- #line 16334 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:771*/
- #line 32 "./freeannotation.w"
-
- for(int i= 0;i<configData.size();i++)
- {
- node= configData.at(i).toElement();
- if(node.attribute("name")=="labeltext")
- {
- labelEdit->setText(node.attribute("value"));
- }
- }
- updateLabel(labelEdit->text());
- connect(labelEdit,SIGNAL(textEdited(QString)),
- this,SLOT(updateLabel(QString)));
- setLayout(layout);
- }
-
- /*:828*//*829:*/
- #line 49 "./freeannotation.w"
-
- void FreeAnnotationConfWidget::updateLabel(const QString&text)
- {
- updateAttribute("labeltext",text);
- }
-
- /*:829*/
- #line 604 "./typica.w"
-
- /*948:*/
- #line 39 "./rate.w"
-
- void RateOfChange::newMeasurement(Measurement measure)
- {
- cache.append(measure);
- /*949:*/
- #line 64 "./rate.w"
-
- if(cache.size()> 2)
- {
- bool done= false;
- while(!done)
- {
- if(cache.front().time().secsTo(cache.back().time())> ct)
- {
- cache.removeFirst();
- }
- else if(cache.back().time()<cache.front().time())
- {
- cache.removeFirst();
- done= true;
- }
- else
- {
- done= true;
- }
- if(cache.size()<3)
- {
- done= true;
- }
- }
- }
-
- /*:949*/
- #line 43 "./rate.w"
-
- if(cache.size()>=2)
- {
- /*950:*/
- #line 96 "./rate.w"
-
- int N= cache.size();
- double SXY= 0;
- double SX= 0;
- double SXX= 0;
- double SY= 0;
- double y;
- double x;
- for(int i= 0;i<N;i++)
- {
- y= cache.at(i).temperature();
- SY+= y;
- x= cache.at(0).time().msecsTo(cache.at(i).time())/1000.0;
- SX+= x;
- SXX+= (x*x);
- SXY+= (x*y);
- }
- double M= ((N*SXY)-(SX*SY))/((N*SXX)-(SX*SX));
- Measurement value(M*st,cache.back().time(),cache.back().scale());
- value.insert("relative",true);
- emit newData(value);
-
- /*:950*/
- #line 46 "./rate.w"
-
- }
- }
-
- /*:948*//*951:*/
- #line 120 "./rate.w"
-
- RateOfChange::RateOfChange(int cachetime,int scaletime):ct(cachetime),st(1)
- {
- setScaleTime(scaletime);
- }
-
- void RateOfChange::setCacheTime(int seconds)
- {
- ct= seconds;
- }
-
- void RateOfChange::setScaleTime(int seconds)
- {
- st= (seconds> 0?seconds:1);
- }
-
- /*:951*/
- #line 605 "./typica.w"
-
- /*832:*/
- #line 26 "./settings.w"
-
- SettingsWindow::SettingsWindow():QMainWindow(NULL)
- {
- QTabWidget*settingsTab= new QTabWidget;
- DeviceConfigurationWindow*deviceSettings= new DeviceConfigurationWindow;
- settingsTab->addTab(deviceSettings,tr("Roasters"));
- GraphSettingsWidget*graphSettings= new GraphSettingsWidget;
- settingsTab->addTab(graphSettings,tr("Graph"));
- AdvancedSettingsWidget*advancedSettings= new AdvancedSettingsWidget;
- settingsTab->addTab(advancedSettings,tr("Advanced"));
- setCentralWidget(settingsTab);
- }
-
- /*:832*/
- #line 606 "./typica.w"
-
- /*837:*/
- #line 27 "./graphsettings.w"
-
- GraphSettingsWidget::GraphSettingsWidget():QWidget(NULL)
- {
- QTabWidget*graphCategories= new QTabWidget;
- GraphSettingsRelativeTab*relative= new GraphSettingsRelativeTab;
- graphCategories->addTab(relative,tr("Relative Temperatures"));
- QVBoxLayout*layout= new QVBoxLayout;
- layout->addWidget(graphCategories);
- setLayout(layout);
- }
-
- /*:837*//*839:*/
- #line 65 "./graphsettings.w"
-
- GraphSettingsRelativeTab::GraphSettingsRelativeTab():QWidget(NULL),
- colorEdit(new QLineEdit)
- {
- QSettings settings;
- QVBoxLayout*layout= new QVBoxLayout;
- QCheckBox*enable= new QCheckBox(tr("Graph relative temperatures"));
- enable->setChecked(settings.value("settings/graph/relative/enable",true).toBool());
- updateEnableSetting(enable->isChecked());
- connect(enable,SIGNAL(toggled(bool)),this,SLOT(updateEnableSetting(bool)));
- layout->addWidget(enable);
- QHBoxLayout*colorLayout= new QHBoxLayout;
- QLabel*colorLabel= new QLabel(tr("Axis color:"));
- colorEdit->setText(settings.value("settings/graph/relative/color","#000000").toString());
- updateColorSetting(colorEdit->text());
- connect(colorEdit,SIGNAL(textChanged(QString)),this,SLOT(updateColorSetting(QString)));
- QToolButton*colorPickerButton= new QToolButton();
- colorPickerButton->setIcon(QIcon::fromTheme("applications-graphics"));
- connect(colorPickerButton,SIGNAL(clicked()),this,SLOT(showColorPicker()));
- colorLayout->addWidget(colorLabel);
- colorLayout->addWidget(colorEdit);
- colorLayout->addWidget(colorPickerButton);
- colorLayout->addStretch();
- layout->addLayout(colorLayout);
- QHBoxLayout*unitLayout= new QHBoxLayout;
- QLabel*unitLabel= new QLabel(tr("Unit"));
- QComboBox*unitSelector= new QComboBox;
- unitSelector->addItem(tr("Fahrenheit"));
- unitSelector->addItem(tr("Celsius"));
- unitSelector->setCurrentIndex(settings.value("settings/graph/relative/unit",0).toInt());
- updateUnit(unitSelector->currentIndex());
- connect(unitSelector,SIGNAL(currentIndexChanged(int)),this,SLOT(updateUnit(int)));
- unitLayout->addWidget(unitLabel);
- unitLayout->addWidget(unitSelector);
- unitLayout->addStretch();
- layout->addLayout(unitLayout);
- QHBoxLayout*axisLayout= new QHBoxLayout;
- QLabel*axisLabel= new QLabel(tr("Grid line positions (comma separated):"));
- QLineEdit*axisEdit= new QLineEdit;
- axisEdit->setText(settings.value("settings/graph/relative/grid","-300, -100, -10, 0, 10, 30, 50").toString());
- updateAxisSetting(axisEdit->text());
- connect(axisEdit,SIGNAL(textChanged(QString)),this,SLOT(updateAxisSetting(QString)));
- axisLayout->addWidget(axisLabel);
- axisLayout->addWidget(axisEdit);
- layout->addLayout(axisLayout);
- layout->addStretch();
- setLayout(layout);
- }
-
- /*:839*//*840:*/
- #line 116 "./graphsettings.w"
-
- void GraphSettingsRelativeTab::updateEnableSetting(bool enabled)
- {
- QSettings settings;
- settings.setValue("settings/graph/relative/enable",enabled);
- }
-
- void GraphSettingsRelativeTab::updateColorSetting(const QString&color)
- {
- QSettings settings;
- settings.setValue("settings/graph/relative/color",color);
- }
-
- void GraphSettingsRelativeTab::updateAxisSetting(const QString&gridList)
- {
- QSettings settings;
- QString settingValue;
- QStringList points= gridList.split(QRegExp("[\\s,]+"),QString::SkipEmptyParts);
- QStringList numbers;
- foreach(QString text,points)
- {
- bool okay= false;
- text.toDouble(&okay);
- if(okay)
- {
- numbers.append(text);
- }
- }
- numbers.removeDuplicates();
- settings.setValue("settings/graph/relative/grid",numbers.join(","));
- }
-
- void GraphSettingsRelativeTab::updateUnit(int unit)
- {
- QSettings settings;
- settings.setValue("settings/graph/relative/unit",unit);
- }
-
- /*:840*//*841:*/
- #line 159 "./graphsettings.w"
-
- void GraphSettingsRelativeTab::showColorPicker()
- {
- QColor color= QColorDialog::getColor(QColor(colorEdit->text()),this);
- colorEdit->setText(color.name());
- }
- #line 62 "./settings.w"
-
- #line 1 "./advancedsettings.w"
- /*:841*/
- #line 607 "./typica.w"
-
- /*983:*/
- #line 682 "./dataqsdk.w"
-
- DataqSdkDeviceConfWidget::DataqSdkDeviceConfWidget(DeviceTreeModel*model,
- const QModelIndex&index)
- :BasicDeviceConfigurationWidget(model,index),
- deviceIdStack(new QStackedWidget)
- {
- QVBoxLayout*layout= new QVBoxLayout;
- QCheckBox*autoDetect= new QCheckBox("Automatically select device");
- layout->addWidget(autoDetect);
- QWidget*autoLayerWidget= new QWidget;
- QHBoxLayout*autoLayerLayout= new QHBoxLayout;
- QLabel*autoLabel= new QLabel(tr("Device number"));
- QSpinBox*autoNumber= new QSpinBox;
- autoNumber->setMinimum(1);
- autoNumber->setMaximum(99);
- autoLayerLayout->addWidget(autoLabel);
- autoLayerLayout->addWidget(autoNumber);
- autoLayerWidget->setLayout(autoLayerLayout);
- QWidget*fixedLayerWidget= new QWidget;
- QHBoxLayout*fixedLayerLayout= new QHBoxLayout;
- QLabel*fixedLabel= new QLabel(tr("Device port"));
- QComboBox*portSelection= new QComboBox;
- portSelection->setEditable(true);
- portSelection->addItems(DataqSdkDevice::detectHardware());
- fixedLayerLayout->addWidget(fixedLabel);
- fixedLayerLayout->addWidget(portSelection);
- fixedLayerWidget->setLayout(fixedLayerLayout);
- deviceIdStack->addWidget(autoLayerWidget);
- deviceIdStack->addWidget(fixedLayerWidget);
- layout->addWidget(deviceIdStack);
- QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
- layout->addWidget(addChannelButton);
- /*771:*/
- #line 16334 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:771*/
- #line 714 "./dataqsdk.w"
-
- for(int i= 0;i<configData.size();i++)
- {
- node= configData.at(i).toElement();
- if(node.attribute("name")=="autoSelect")
- {
- autoDetect->setChecked(node.attribute("value")=="true"?true:false);
- }
- else if(node.attribute("name")=="deviceNumber")
- {
- autoNumber->setValue(node.attribute("value").toInt());
- }
- else if(node.attribute("name")=="port")
- {
- int index= portSelection->findText(node.attribute("value"));
- if(index> -1)
- {
- portSelection->setCurrentIndex(index);
- }
- else
- {
- portSelection->setEditText(node.attribute("value"));
- }
- }
- }
- updateAutoSelect(autoDetect->isChecked());
- updateDeviceNumber(autoNumber->value());
- updatePort(portSelection->currentText());
- connect(autoDetect,SIGNAL(toggled(bool)),this,SLOT(updateAutoSelect(bool)));
- connect(autoNumber,SIGNAL(valueChanged(int)),this,SLOT(updateDeviceNumber(int)));
- connect(portSelection,SIGNAL(currentIndexChanged(QString)),this,SLOT(updatePort(QString)));
- connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
- setLayout(layout);
- }
-
- /*:983*//*984:*/
- #line 758 "./dataqsdk.w"
-
- void DataqSdkDeviceConfWidget::updateAutoSelect(bool automatic)
- {
- if(automatic)
- {
- updateAttribute("autoSelect","true");
- deviceIdStack->setCurrentIndex(0);
- }
- else
- {
- updateAttribute("autoSelect","false");
- deviceIdStack->setCurrentIndex(1);
- }
- }
-
- /*:984*//*985:*/
- #line 775 "./dataqsdk.w"
-
- void DataqSdkDeviceConfWidget::updateDeviceNumber(int deviceNumber)
- {
- updateAttribute("deviceNumber",QString("%1").arg(deviceNumber));
- }
-
- void DataqSdkDeviceConfWidget::updatePort(QString portId)
- {
- updateAttribute("port",portId);
- }
-
- /*:985*//*986:*/
- #line 788 "./dataqsdk.w"
-
- void DataqSdkDeviceConfWidget::addChannel()
- {
- insertChildNode(tr("Channel"),"dataqsdkchannel");
- }
-
- /*:986*//*989:*/
- #line 868 "./dataqsdk.w"
-
- DataqSdkChannelConfWidget::DataqSdkChannelConfWidget(DeviceTreeModel*model,
- const QModelIndex&index)
- :BasicDeviceConfigurationWidget(model,index),
- startButton(new QPushButton(tr("Start"))),
- resetButton(new QPushButton(tr("Reset"))),
- stopButton(new QPushButton(tr("Stop"))),
- calibrator(new LinearCalibrator),
- currentMeasurement(new QLineEdit),minimumMeasurement(new QLineEdit),
- maximumMeasurement(new QLineEdit),averageMeasurement(new QLineEdit),
- currentMapped(new QLineEdit),minimumMapped(new QLineEdit),
- maximumMapped(new QLineEdit),averageMapped(new QLineEdit),
- rmCount(0),cmCount(0),
- rmin(std::numeric_limits<double> ::max()),
- rmax(std::numeric_limits<double> ::min()),rmean(0),
- cmin(std::numeric_limits<double> ::max()),
- cmax(std::numeric_limits<double> ::min()),cmean(0)
- {
- /*993:*/
- #line 1107 "./dataqsdk.w"
-
- QDomElement parentReference= model->referenceElement(model->data(index.parent(),Qt::UserRole).toString());
- QDomNodeList deviceConfigData= parentReference.elementsByTagName("attribute");
- QDomElement deviceNode;
- QString configPort;
- QString configAuto;
- for(int i= 0;i<deviceConfigData.size();i++)
- {
- deviceNode= deviceConfigData.at(i).toElement();
- if(deviceNode.attribute("name")=="autoSelect")
- {
- autoSelect= (deviceNode.attribute("value")=="true");
- }
- else if(deviceNode.attribute("name")=="deviceNumber")
- {
- configAuto= deviceNode.attribute("value");
- }
- else if(deviceNode.attribute("name")=="port")
- {
- configPort= deviceNode.attribute("value");
- }
- }
- deviceID= autoSelect?configAuto:configPort;
- channelOfInterest= index.row();
-
- /*:993*/
- #line 886 "./dataqsdk.w"
-
- resetButton->setEnabled(false);
- stopButton->setEnabled(false);
- connect(startButton,SIGNAL(clicked()),this,SLOT(startCalibration()));
- connect(resetButton,SIGNAL(clicked()),this,SLOT(resetCalibration()));
- connect(stopButton,SIGNAL(clicked()),this,SLOT(stopCalibration()));
- QVBoxLayout*layout= new QVBoxLayout;
- QFormLayout*topLayout= new QFormLayout;
- QLineEdit*columnEdit= new QLineEdit;
- topLayout->addRow(tr("Column name"),columnEdit);
- QComboBox*unitSelector= new QComboBox;
- unitSelector->addItem(tr("Temperature"));
- unitSelector->addItem(tr("Control"));
- topLayout->addRow(tr("Measurement type"),unitSelector);
- QCheckBox*smoothingBox= new QCheckBox(tr("Enable smoothing"));
- topLayout->addRow(smoothingBox);
- layout->addLayout(topLayout);
- QCheckBox*hideSeries= new QCheckBox(tr("Hide this channel"));
- topLayout->addRow(hideSeries);
- QLabel*calibrationLabel= new QLabel(tr("Calibration settings"));
- layout->addWidget(calibrationLabel);
- QHBoxLayout*calibrationLayout= new QHBoxLayout;
- QFormLayout*calibrationControlsLayout= new QFormLayout;
- QLineEdit*measuredLowerEdit= new QLineEdit;
- measuredLowerEdit->setText("0");
- QLineEdit*measuredUpperEdit= new QLineEdit;
- measuredUpperEdit->setText("10");
- QLineEdit*mappedLowerEdit= new QLineEdit;
- mappedLowerEdit->setText("0");
- QLineEdit*mappedUpperEdit= new QLineEdit;
- mappedUpperEdit->setText("10");
- calibrationControlsLayout->addRow(tr("Measured lower value"),measuredLowerEdit);
- calibrationControlsLayout->addRow(tr("Mapped lower value"),mappedLowerEdit);
- calibrationControlsLayout->addRow(tr("Measured upper value"),measuredUpperEdit);
- calibrationControlsLayout->addRow(tr("Mapped upper value"),mappedUpperEdit);
- QCheckBox*closedBox= new QCheckBox(tr("Closed range"));
- calibrationControlsLayout->addRow(closedBox);
- QLineEdit*sensitivityEdit= new QLineEdit;
- sensitivityEdit->setText("0");
- calibrationControlsLayout->addRow(tr("Discrete interval skip"),sensitivityEdit);
- QVBoxLayout*calibrationTestLayout= new QVBoxLayout;
- QHBoxLayout*deviceControlLayout= new QHBoxLayout;
- deviceControlLayout->addWidget(startButton);
- deviceControlLayout->addWidget(resetButton);
- deviceControlLayout->addWidget(stopButton);
- QFormLayout*indicatorLayout= new QFormLayout;
- currentMeasurement->setReadOnly(true);
- minimumMeasurement->setReadOnly(true);
- maximumMeasurement->setReadOnly(true);
- averageMeasurement->setReadOnly(true);
- currentMapped->setReadOnly(true);
- minimumMapped->setReadOnly(true);
- maximumMapped->setReadOnly(true);
- averageMapped->setReadOnly(true);
- indicatorLayout->addRow(tr("Measured Values"),new QWidget);
- indicatorLayout->addRow(tr("Current"),currentMeasurement);
- indicatorLayout->addRow(tr("Minimum"),minimumMeasurement);
- indicatorLayout->addRow(tr("Maximum"),maximumMeasurement);
- indicatorLayout->addRow(tr("Mean"),averageMeasurement);
- indicatorLayout->addRow(tr("Mapped Values"),new QWidget);
- indicatorLayout->addRow(tr("Current Mapped"),currentMapped);
- indicatorLayout->addRow(tr("Minimum Mapped"),minimumMapped);
- indicatorLayout->addRow(tr("Maximum Mapped"),maximumMapped);
- indicatorLayout->addRow(tr("Mean Mapped"),averageMapped);
- calibrationTestLayout->addLayout(deviceControlLayout);
- calibrationTestLayout->addLayout(indicatorLayout);
- calibrationLayout->addLayout(calibrationControlsLayout);
- calibrationLayout->addLayout(calibrationTestLayout);
- layout->addLayout(calibrationLayout);
- /*771:*/
- #line 16334 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:771*/
- #line 955 "./dataqsdk.w"
-
- for(int i= 0;i<configData.size();i++)
- {
- node= configData.at(i).toElement();
- if(node.attribute("name")=="column")
- {
- columnEdit->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="type")
- {
- unitSelector->setCurrentIndex(unitSelector->findText(node.attribute("value")));
- }
- else if(node.attribute("name")=="smoothing")
- {
- smoothingBox->setChecked(node.attribute("value")=="true");
- }
- else if(node.attribute("name")=="calibrationMeasuredLower")
- {
- measuredLowerEdit->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="calibrationMeasuredUpper")
- {
- measuredUpperEdit->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="calibrationMappedLower")
- {
- mappedLowerEdit->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="calibrationMappedUpper")
- {
- mappedUpperEdit->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="calibrationClosedInterval")
- {
- closedBox->setChecked(node.attribute("value")=="true");
- }
- else if(node.attribute("name")=="calibrationSensitivity")
- {
- sensitivityEdit->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="hidden")
- {
- hideSeries->setChecked(node.attribute("value")=="true");
- }
- }
- updateColumnName(columnEdit->text());
- updateUnits(unitSelector->currentText());
- updateSmoothingEnabled(smoothingBox->isChecked());
- updateMeasuredLower(measuredLowerEdit->text());
- updateMeasuredUpper(measuredUpperEdit->text());
- updateMappedLower(mappedLowerEdit->text());
- updateMappedUpper(mappedUpperEdit->text());
- updateClosedInterval(closedBox->isChecked());
- updateSensitivity(sensitivityEdit->text());
- updateHidden(hideSeries->isChecked());
- connect(columnEdit,SIGNAL(textChanged(QString)),
- this,SLOT(updateColumnName(QString)));
- connect(unitSelector,SIGNAL(currentIndexChanged(QString)),
- this,SLOT(updateUnits(QString)));
- connect(smoothingBox,SIGNAL(toggled(bool)),
- this,SLOT(updateSmoothingEnabled(bool)));
- connect(measuredLowerEdit,SIGNAL(textChanged(QString)),
- this,SLOT(updateMeasuredLower(QString)));
- connect(mappedLowerEdit,SIGNAL(textChanged(QString)),
- this,SLOT(updateMappedLower(QString)));
- connect(measuredUpperEdit,SIGNAL(textChanged(QString)),
- this,SLOT(updateMeasuredUpper(QString)));
- connect(mappedUpperEdit,SIGNAL(textChanged(QString)),
- this,SLOT(updateMappedUpper(QString)));
- connect(closedBox,SIGNAL(toggled(bool)),
- this,SLOT(updateClosedInterval(bool)));
- connect(sensitivityEdit,SIGNAL(textChanged(QString)),
- this,SLOT(updateSensitivity(QString)));
- connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
- setLayout(layout);
- }
-
- /*:989*//*990:*/
- #line 1038 "./dataqsdk.w"
-
- void DataqSdkChannelConfWidget::updateUnits(const QString&unit)
- {
- updateAttribute("type",unit);
- }
-
- /*:990*//*991:*/
- #line 1047 "./dataqsdk.w"
-
- void DataqSdkChannelConfWidget::updateMeasuredLower(const QString&value)
- {
- updateAttribute("calibrationMeasuredLower",value);
- calibrator->setMeasuredLower(value.toDouble());
- }
-
- void DataqSdkChannelConfWidget::updateMeasuredUpper(const QString&value)
- {
- updateAttribute("calibrationMeasuredUpper",value);
- calibrator->setMeasuredUpper(value.toDouble());
- }
-
- void DataqSdkChannelConfWidget::updateMappedLower(const QString&value)
- {
- updateAttribute("calibrationMappedLower",value);
- calibrator->setMappedLower(value.toDouble());
- }
-
- void DataqSdkChannelConfWidget::updateMappedUpper(const QString&value)
- {
- updateAttribute("calibrationMappedUpper",value);
- calibrator->setMappedUpper(value.toDouble());
- }
-
- void DataqSdkChannelConfWidget::updateClosedInterval(bool closed)
- {
- updateAttribute("calibrationClosedInterval",closed?"true":"false");
- calibrator->setClosedRange(closed);
- }
-
- void DataqSdkChannelConfWidget::updateSmoothingEnabled(bool enabled)
- {
- updateAttribute("smoothing",enabled?"true":"false");
- }
-
- void DataqSdkChannelConfWidget::updateSensitivity(const QString&value)
- {
- updateAttribute("calibrationSensitivity",value);
- calibrator->setSensitivity(value.toDouble());
- }
-
- void DataqSdkChannelConfWidget::updateHidden(bool hidden)
- {
- updateAttribute("hidden",hidden?"true":"false");
- }
-
- /*:991*//*994:*/
- #line 1136 "./dataqsdk.w"
-
- void DataqSdkChannelConfWidget::startCalibration()
- {
- startButton->setEnabled(false);
- stopButton->setEnabled(true);
- resetButton->setEnabled(true);
- calibrationDevice= new DataqSdkDevice(deviceID);
- Channel*channel;
- for(unsigned int i= 0;i<=channelOfInterest;i++)
- {
- channel= calibrationDevice->newChannel(Units::Unitless);
- }
- connect(channel,SIGNAL(newData(Measurement)),this,SLOT(updateInput(Measurement)));
- connect(channel,SIGNAL(newData(Measurement)),calibrator,SLOT(newMeasurement(Measurement)));
- connect(calibrator,SIGNAL(newData(Measurement)),this,SLOT(updateOutput(Measurement)));
- calibrationDevice->setClockRate(6.0/(1.0+channelOfInterest));
- calibrationDevice->start();
- }
-
- void DataqSdkChannelConfWidget::stopCalibration()
- {
- startButton->setEnabled(true);
- stopButton->setEnabled(false);
- resetButton->setEnabled(false);
- calibrationDevice->deleteLater();
- /*996:*/
- #line 1181 "./dataqsdk.w"
-
- rmCount= 0;
- cmCount= 0;
- rmin= std::numeric_limits<double> ::max();
- rmax= std::numeric_limits<double> ::min();
- rmean= 0;
- cmin= std::numeric_limits<double> ::max();
- cmax= std::numeric_limits<double> ::min();
- cmean= 0;
-
- /*:996*/
- #line 1161 "./dataqsdk.w"
-
- }
-
- /*:994*//*995:*/
- #line 1172 "./dataqsdk.w"
-
- void DataqSdkChannelConfWidget::resetCalibration()
- {
- /*996:*/
- #line 1181 "./dataqsdk.w"
-
- rmCount= 0;
- cmCount= 0;
- rmin= std::numeric_limits<double> ::max();
- rmax= std::numeric_limits<double> ::min();
- rmean= 0;
- cmin= std::numeric_limits<double> ::max();
- cmax= std::numeric_limits<double> ::min();
- cmean= 0;
-
- /*:996*/
- #line 1175 "./dataqsdk.w"
-
- }
-
- /*:995*//*997:*/
- #line 1195 "./dataqsdk.w"
-
- void DataqSdkChannelConfWidget::updateInput(Measurement measure)
- {
- double nv= measure.temperature();
- currentMeasurement->setText(QString("%1").arg(nv));
- rmin= qMin(nv,rmin);
- minimumMeasurement->setText(QString("%1").arg(rmin));
- rmax= qMax(nv,rmax);
- maximumMeasurement->setText(QString("%1").arg(rmax));
- rmean= ((rmean*rmCount)+nv)/(rmCount+1);
- rmCount++;
- averageMeasurement->setText(QString("%1").arg(rmean));
- }
-
- void DataqSdkChannelConfWidget::updateOutput(Measurement measure)
- {
- double nv= measure.temperature();
- currentMapped->setText(QString("%1").arg(nv));
- cmin= qMin(nv,cmin);
- minimumMapped->setText(QString("%1").arg(cmin));
- cmax= qMax(nv,cmax);
- maximumMapped->setText(QString("%1").arg(cmax));
- cmean= ((cmean*cmCount)+nv)/(cmCount+1);
- cmCount++;
- averageMapped->setText(QString("%1").arg(cmean));
- }
-
- /*:997*//*998:*/
- #line 1224 "./dataqsdk.w"
-
- void DataqSdkChannelConfWidget::updateColumnName(const QString&value)
- {
- updateAttribute("column",value);
- }
-
-
- /*:998*/
- #line 608 "./typica.w"
-
- /*1022:*/
- #line 393 "./scales.w"
-
- SerialScaleConfWidget::SerialScaleConfWidget(DeviceTreeModel*model,
- const QModelIndex&index)
- :BasicDeviceConfigurationWidget(model,index),
- port(new PortSelector),baud(new BaudSelector),parity(new ParitySelector),
- flow(new FlowSelector),stop(new StopSelector)
- {
- QFormLayout*layout= new QFormLayout;
- layout->addRow(tr("Port:"),port);
- connect(port,SIGNAL(currentIndexChanged(QString)),
- this,SLOT(updatePort(QString)));
- connect(port,SIGNAL(editTextChanged(QString)),
- this,SLOT(updatePort(QString)));
- layout->addRow(tr("Baud:"),baud);
- connect(baud,SIGNAL(currentIndexChanged(QString)),
- this,SLOT(updateBaudRate(QString)));
- layout->addRow(tr("Parity:"),parity);
- connect(parity,SIGNAL(currentIndexChanged(int)),
- this,SLOT(updateParity(int)));
- layout->addRow(tr("Flow Control:"),flow);
- connect(flow,SIGNAL(currentIndexChanged(int)),
- this,SLOT(updateFlowControl(int)));
- layout->addRow(tr("Stop Bits:"),stop);
- connect(stop,SIGNAL(currentIndexChanged(int)),
- this,SLOT(updateStopBits(int)));
- /*771:*/
- #line 16334 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:771*/
- #line 418 "./scales.w"
-
- for(int i= 0;i<configData.size();i++)
- {
- node= configData.at(i).toElement();
- if(node.attribute("name")=="port")
- {
- int j= port->findText(node.attribute("value"));
- if(j>=0)
- {
- port->setCurrentIndex(j);
- }
- else
- {
- port->insertItem(0,node.attribute("value"));
- port->setCurrentIndex(0);
- }
- }
- else if(node.attribute("name")=="baudrate")
- {
- baud->setCurrentIndex(baud->findText(node.attribute("value")));
- }
- else if(node.attribute("name")=="parity")
- {
- parity->setCurrentIndex(parity->findData(node.attribute("value")));
- }
- else if(node.attribute("name")=="flowcontrol")
- {
- flow->setCurrentIndex(flow->findData(node.attribute("value")));
- }
- else if(node.attribute("name")=="stopbits")
- {
- stop->setCurrentIndex(stop->findData(node.attribute("value")));
- }
- }
- updatePort(port->currentText());
- updateBaudRate(baud->currentText());
- updateParity(parity->currentIndex());
- updateFlowControl(flow->currentIndex());
- updateStopBits(stop->currentIndex());
- setLayout(layout);
- }
-
- /*:1022*//*1023:*/
- #line 462 "./scales.w"
-
- void SerialScaleConfWidget::updatePort(const QString&newPort)
- {
- updateAttribute("port",newPort);
- }
-
- void SerialScaleConfWidget::updateBaudRate(const QString&rate)
- {
- updateAttribute("baudrate",rate);
- }
-
- void SerialScaleConfWidget::updateParity(int index)
- {
- updateAttribute("parity",parity->itemData(index).toString());
- }
-
- void SerialScaleConfWidget::updateFlowControl(int index)
- {
- updateAttribute("flowcontrol",flow->itemData(index).toString());
- }
-
- void SerialScaleConfWidget::updateStopBits(int index)
- {
- updateAttribute("stopbits",stop->itemData(index).toString());
- }
-
- /*:1023*/
- #line 609 "./typica.w"
-
- /*1035:*/
- #line 195 "./valueannotation.w"
-
- void ValueAnnotation::newMeasurement(Measurement measure)
- {
- for(int i= 0;i<values.size();i++)
- {
- if(measure.temperature()> values.at(i)-tolerance&&
- measure.temperature()<values.at(i)+tolerance)
- {
- if(i!=lastIndex)
- {
- lastIndex= i;
- emit annotation(annotations.at(i),measurementColumn,annotationColumn);
- }
- }
- }
- }
-
- /*:1035*//*1036:*/
- #line 216 "./valueannotation.w"
-
- void ValueAnnotation::annotate()
- {
- if(lastIndex> -1)
- {
- emit annotation(annotations.at(lastIndex),measurementColumn,annotationColumn);
- }
- }
-
- /*:1036*//*1037:*/
- #line 228 "./valueannotation.w"
-
- void ValueAnnotation::setAnnotation(double value,const QString&annotation)
- {
- values.append(value);
- annotations.append(annotation);
- }
-
- /*:1037*//*1038:*/
- #line 237 "./valueannotation.w"
-
- void ValueAnnotation::setAnnotationColumn(int column)
- {
- annotationColumn= column;
- }
-
- void ValueAnnotation::setTemperatureColumn(int column)
- {
- measurementColumn= column;
- }
-
- void ValueAnnotation::setTolerance(double epsilon)
- {
- tolerance= epsilon;
- }
-
- /*:1038*//*1039:*/
- #line 255 "./valueannotation.w"
-
- ValueAnnotation::ValueAnnotation():QObject(),
- lastIndex(-1),annotationColumn(2),measurementColumn(1),tolerance(0.05)
- {
-
- }
-
- /*:1039*/
- #line 610 "./typica.w"
-
- /*1027:*/
- #line 33 "./valueannotation.w"
-
- ValueAnnotationConfWidget::ValueAnnotationConfWidget(DeviceTreeModel*model,
- const QModelIndex&index)
- :BasicDeviceConfigurationWidget(model,index),
- tablemodel(new SaltModel(2))
- {
- QFormLayout*layout= new QFormLayout;
- QLineEdit*source= new QLineEdit;
- layout->addRow(tr("Source column name:"),source);
- QCheckBox*noteOnStart= new QCheckBox(tr("Produce Start State Annotation"));
- noteOnStart->setChecked(true);
- layout->addRow(noteOnStart);
- tablemodel->setHeaderData(0,Qt::Horizontal,"Value");
- tablemodel->setHeaderData(1,Qt::Horizontal,"Annotation");
- QTableView*annotationTable= new QTableView;
- annotationTable->setModel(tablemodel);
- NumericDelegate*delegate= new NumericDelegate;
- annotationTable->setItemDelegateForColumn(0,delegate);
- layout->addRow(tr("Annotations for values:"),annotationTable);
- /*771:*/
- #line 16334 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:771*/
- #line 52 "./valueannotation.w"
-
- for(int i= 0;i<configData.size();i++)
- {
- node= configData.at(i).toElement();
- if(node.attribute("name")=="source")
- {
- source->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="emitOnStart")
- {
- noteOnStart->setChecked(node.attribute("value")=="true"?true:false);
- }
- else if(node.attribute("name")=="measuredValues")
- {
- /*925:*/
- #line 19416 "./typica.w"
-
- QString data= node.attribute("value");
- if(data.length()> 3)
- {
- data.chop(2);
- data= data.remove(0,2);
- }
- QStringList itemList= data.split(",");
-
- /*:925*/
- #line 66 "./valueannotation.w"
-
- int column= 0;
- /*926:*/
- #line 19428 "./typica.w"
-
- for(int j= 0;j<itemList.size();j++)
- {
- tablemodel->setData(tablemodel->index(j,column),
- QVariant(itemList.at(j).toDouble()),
- Qt::DisplayRole);
- }
-
- /*:926*/
- #line 68 "./valueannotation.w"
-
- }
- else if(node.attribute("name")=="annotations")
- {
- /*1028:*/
- #line 89 "./valueannotation.w"
-
- QString data= node.attribute("value");
- if(data.length()> 3)
- {
- data.chop(2);
- data= data.remove(0,2);
- }
- QStringList itemList= data.split(",");
- for(int i= 0;i<itemList.size();i++)
- {
- itemList[i]= itemList[i].simplified();
- }
-
- /*:1028*/
- #line 72 "./valueannotation.w"
-
- int column= 1;
- /*1029:*/
- #line 104 "./valueannotation.w"
-
- for(int i= 0;i<itemList.size();i++)
- {
- tablemodel->setData(tablemodel->index(i,column),
- QVariant(itemList.at(i)),
- Qt::DisplayRole);
- }
-
- /*:1029*/
- #line 74 "./valueannotation.w"
-
- }
- }
- updateSourceColumn(source->text());
- updateStart(noteOnStart->isChecked());
- updateAnnotations();
- connect(source,SIGNAL(textEdited(QString)),this,SLOT(updateSourceColumn(QString)));
- connect(noteOnStart,SIGNAL(toggled(bool)),this,SLOT(updateStart(bool)));
- connect(tablemodel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(updateAnnotations()));
- setLayout(layout);
- }
-
- /*:1027*//*1030:*/
- #line 115 "./valueannotation.w"
-
- void ValueAnnotationConfWidget::updateAnnotations()
- {
- updateAttribute("measuredValues",tablemodel->arrayLiteral(0,Qt::DisplayRole));
- updateAttribute("annotations",tablemodel->arrayLiteral(1,Qt::DisplayRole));
- }
-
- /*:1030*//*1031:*/
- #line 125 "./valueannotation.w"
-
- void ValueAnnotationConfWidget::updateSourceColumn(const QString&source)
- {
- updateAttribute("source",source);
- }
-
- void ValueAnnotationConfWidget::updateStart(bool noteOnStart)
- {
- updateAttribute("emitOnStart",noteOnStart?"true":"false");
- }
-
- /*:1031*/
- #line 611 "./typica.w"
-
-
- /*:4*//*250:*/
- #line 5952 "./typica.w"
-
- /*247:*/
- #line 5915 "./typica.w"
-
- void ScriptValidator::fixup(QString&input)const
- {
- QScriptEngine*engine= AppInstance->engine;
- engine->pushContext();
- input= engine->evaluate(input).toString();
- engine->popContext();
- }
-
- /*:247*//*248:*/
- #line 5928 "./typica.w"
-
- QValidator::State ScriptValidator::validate(QString&input,int&pos)const
- {
- if(v)
- {
- if(v->validate(input,pos)==QValidator::Acceptable)
- {
- return QValidator::Acceptable;
- }
- }
- return QValidator::Intermediate;
- }
-
- /*:248*//*249:*/
- #line 5943 "./typica.w"
-
- ScriptValidator::ScriptValidator(QValidator*validator,QObject*parent)
- :QValidator(parent),v(validator)
- {
-
- }
-
- /*:249*/
- #line 5953 "./typica.w"
-
-
- /*:250*//*845:*/
- #line 60 "./advancedsettings.w"
-
- /*843:*/
- #line 26 "./advancedsettings.w"
-
- AdvancedSettingsWidget::AdvancedSettingsWidget():QWidget(NULL)
- {
- QSettings settings;
- QFormLayout*layout= new QFormLayout;
- QCheckBox*logDiagnostics= new QCheckBox;
- logDiagnostics->setCheckState(
- settings.value("settings/advanced/logging",false).toBool()?
- Qt::Checked:Qt::Unchecked);
- connect(logDiagnostics,SIGNAL(toggled(bool)),this,SLOT(enableDiagnosticLogging(bool)));
- layout->addRow(tr("Enable diagnostic logging"),logDiagnostics);
- setLayout(layout);
- }
-
- /*:843*//*844:*/
- #line 43 "./advancedsettings.w"
-
- void AdvancedSettingsWidget::enableDiagnosticLogging(bool enabled)
- {
- QSettings settings;
- settings.setValue("settings/advanced/logging",enabled);
- if(enabled)
- {
- qInstallMsgHandler(messageFileOutput);
- }
- else
- {
- qInstallMsgHandler(0);
- }
- }
-
- /*:844*/
- #line 61 "./advancedsettings.w"
-
- #line 18094 "./typica.w"
-
- /*:845*//*892:*/
- #line 639 "./unsupportedserial.w"
-
- /*867:*/
- #line 58 "./unsupportedserial.w"
-
- UnsupportedSerialDeviceConfWidget::UnsupportedSerialDeviceConfWidget(DeviceTreeModel*model,
- const QModelIndex&index)
- :BasicDeviceConfigurationWidget(model,index),
- deviceSettingsModel(new SaltModel(2)),
- scriptEditor(new QTextEdit)
- {
- scriptEditor->setTabStopWidth(20);
- QVBoxLayout*dummyLayout= new QVBoxLayout;
- QTabWidget*central= new QTabWidget;
- QWidget*deviceConfigurationWidget= new QWidget;
- QVBoxLayout*deviceConfigurationLayout= new QVBoxLayout;
- QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
- deviceConfigurationLayout->addWidget(addChannelButton);
- connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
- QLabel*deviceSettingsLabel= new QLabel(tr("Device Settings:"));
- deviceConfigurationLayout->addWidget(deviceSettingsLabel);
- QTableView*deviceSettingsView= new QTableView;
- deviceSettingsModel->setHeaderData(0,Qt::Horizontal,tr("Key"));
- deviceSettingsModel->setHeaderData(1,Qt::Horizontal,tr("Value"));
- deviceSettingsView->setModel(deviceSettingsModel);
- deviceConfigurationLayout->addWidget(deviceSettingsView);
-
- deviceConfigurationWidget->setLayout(deviceConfigurationLayout);
- central->addTab(deviceConfigurationWidget,tr("Configuration"));
- central->addTab(scriptEditor,tr("Script"));
- dummyLayout->addWidget(central);
-
- /*771:*/
- #line 16334 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:771*/
- #line 86 "./unsupportedserial.w"
-
- for(int i= 0;i<configData.size();i++)
- {
- node= configData.at(i).toElement();
- if(node.attribute("name")=="keys"||node.attribute("name")=="values")
- {
- int column= 0;
- if(node.attribute("name")=="values")
- {
- column= 1;
- }
- QString data= node.attribute("value");
- if(data.length()> 3)
- {
- data.chop(2);
- data= data.remove(0,2);
- }
- QStringList keyList= data.split(", ");
- for(int j= 0;j<keyList.size();j++)
- {
- deviceSettingsModel->setData(deviceSettingsModel->index(j,column),
- QVariant(keyList.at(j)),
- Qt::EditRole);
- }
- }
- else if(node.attribute("name")=="script")
- {
- scriptEditor->setPlainText(node.attribute("value"));
- }
- }
-
- connect(deviceSettingsModel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),
- this,SLOT(updateConfiguration()));
- connect(scriptEditor,SIGNAL(textChanged()),this,SLOT(saveScript()));
- setLayout(dummyLayout);
- }
-
- /*:867*//*868:*/
- #line 131 "./unsupportedserial.w"
-
- void UnsupportedSerialDeviceConfWidget::updateConfiguration()
- {
- updateAttribute("keys",deviceSettingsModel->arrayLiteral(0,Qt::DisplayRole));
- updateAttribute("values",deviceSettingsModel->arrayLiteral(1,Qt::DisplayRole));
- }
-
- /*:868*//*869:*/
- #line 144 "./unsupportedserial.w"
-
- void UnsupportedSerialDeviceConfWidget::saveScript()
- {
- updateAttribute("script",scriptEditor->toPlainText());
- }
-
- /*:869*//*870:*/
- #line 155 "./unsupportedserial.w"
-
- void UnsupportedSerialDeviceConfWidget::addChannel()
- {
- insertChildNode(tr("Channel"),"unsupporteddevicechannel");
- }
-
- /*:870*//*872:*/
- #line 183 "./unsupportedserial.w"
-
- UnsupportedDeviceChannelConfWidget::UnsupportedDeviceChannelConfWidget(DeviceTreeModel*model,
- const QModelIndex&index)
- :BasicDeviceConfigurationWidget(model,index),
- channelSettingsModel(new SaltModel(2))
- {
- QFormLayout*layout= new QFormLayout;
- QLineEdit*columnName= new QLineEdit;
- layout->addRow(tr("Column Name:"),columnName);
- QCheckBox*hideSeries= new QCheckBox("Hide this channel");
- layout->addRow(hideSeries);
- QTableView*channelSettings= new QTableView;
- channelSettingsModel->setHeaderData(0,Qt::Horizontal,"Key");
- channelSettingsModel->setHeaderData(1,Qt::Horizontal,"Value");
- channelSettings->setModel(channelSettingsModel);
- layout->addRow(channelSettings);
- setLayout(layout);
- /*771:*/
- #line 16334 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:771*/
- #line 200 "./unsupportedserial.w"
-
- for(int i= 0;i<configData.size();i++)
- {
- node= configData.at(i).toElement();
- if(node.attribute("name")=="columnname")
- {
- columnName->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="hidden")
- {
- hideSeries->setChecked(node.attribute("value")=="true");
- }
- else if(node.attribute("name")=="keys"||node.attribute("name")=="values")
- {
- int column= 0;
- if(node.attribute("name")=="values")
- {
- column= 1;
- }
- QString data= node.attribute("value");
- if(data.length()> 3)
- {
- data.chop(2);
- data= data.remove(0,2);
- }
- QStringList keyList= data.split(", ");
- for(int j= 0;j<keyList.size();j++)
- {
- channelSettingsModel->setData(channelSettingsModel->index(j,column),
- QVariant(keyList.at(j)),
- Qt::EditRole);
- }
- }
- }
- connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
- connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
- connect(channelSettingsModel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),
- this,SLOT(updateConfiguration()));
- }
-
- /*:872*//*873:*/
- #line 244 "./unsupportedserial.w"
-
- void UnsupportedDeviceChannelConfWidget::updateColumnName(const QString&value)
- {
- updateAttribute("columnname",value);
- }
-
- void UnsupportedDeviceChannelConfWidget::updateHidden(bool hidden)
- {
- updateAttribute("hidden",hidden?"true":"false");
- }
-
- void UnsupportedDeviceChannelConfWidget::updateConfiguration()
- {
- updateAttribute("keys",channelSettingsModel->arrayLiteral(0,Qt::DisplayRole));
- updateAttribute("values",channelSettingsModel->arrayLiteral(1,Qt::DisplayRole));
- }
-
- /*:873*/
- #line 640 "./unsupportedserial.w"
-
- /*880:*/
- #line 371 "./unsupportedserial.w"
-
- void JavaScriptDevice::start()
- {
- QScriptValue object= scriptengine->newQObject(this);
- /*881:*/
- #line 390 "./unsupportedserial.w"
-
- QScriptValue settingsObject= scriptengine->newObject();
- QVariantMap::const_iterator i= deviceSettings.constBegin();
- while(i!=deviceSettings.constEnd())
- {
- settingsObject.setProperty(i.key(),i.value().toString());
- i++;
- }
- object.setProperty("settings",settingsObject);
-
- /*:881*/
- #line 375 "./unsupportedserial.w"
-
- /*882:*/
- #line 405 "./unsupportedserial.w"
-
- QScriptValue channelsArray= scriptengine->newArray(channelCount());
- for(int i= 0;i<channelCount();i++)
- {
- QScriptValue channelObject= scriptengine->newQObject(getChannel(i));
- QScriptValue channelSettingsObject= scriptengine->newObject();
- QVariantMap::const_iterator j= channelSettings.at(i).constBegin();
- while(j!=channelSettings.at(i).constEnd())
- {
- channelSettingsObject.setProperty(j.key(),j.value().toString());
- j++;
- }
- channelObject.setProperty("settings",channelSettingsObject);
- channelsArray.setProperty(i,channelObject);
- }
- object.setProperty("channels",channelsArray);
-
- /*:882*/
- #line 376 "./unsupportedserial.w"
-
- QScriptContext*context= scriptengine->currentContext();
- QScriptValue oldThis= context->thisObject();
- context->setThisObject(object);
- QScriptValue result= scriptengine->evaluate(deviceScript);
- QScriptEngine*engine= scriptengine;
- /*192:*/
- #line 4446 "./typica.w"
-
- if(engine->hasUncaughtException())
- {
- int line= engine->uncaughtExceptionLineNumber();
- qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
- result.toString();
- QString trace;
- foreach(trace,engine->uncaughtExceptionBacktrace())
- {
- qDebug()<<trace;
- }
- }
-
- /*:192*/
- #line 382 "./unsupportedserial.w"
-
- context->setThisObject(oldThis);
- }
-
- /*:880*//*885:*/
- #line 446 "./unsupportedserial.w"
-
- void JavaScriptDevice::stop()
- {
- emit deviceStopRequested();
- }
-
- /*:885*//*886:*/
- #line 459 "./unsupportedserial.w"
-
- JavaScriptDevice::JavaScriptDevice(const QModelIndex&index,
- QScriptEngine*engine):
- QObject(NULL),scriptengine(engine)
- {
- DeviceTreeModel*model= (DeviceTreeModel*)(index.model());
- QDomElement deviceReferenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList deviceConfigData= deviceReferenceElement.elementsByTagName("attribute");
- QDomElement node;
- QStringList deviceKeys;
- QStringList deviceValues;
- for(int i= 0;i<deviceConfigData.size();i++)
- {
- node= deviceConfigData.at(i).toElement();
- if(node.attribute("name")=="keys")
- {
- QString data= node.attribute("value");
- if(data.length()> 3)
- {
- data.chop(2);
- data= data.remove(0,2);
- }
- deviceKeys= data.split(", ");
- }
- else if(node.attribute("name")=="values")
- {
- QString data= node.attribute("value");
- if(data.length()> 3)
- {
- data.chop(2);
- data= data.remove(0,2);
- }
- deviceValues= data.split(", ");
- }
- else if(node.attribute("name")=="script")
- {
- deviceScript= node.attribute("value");
- }
- deviceSettings.insert(node.attribute("name"),node.attribute("value"));
- }
- for(int i= 0;i<qMin(deviceKeys.length(),deviceValues.length());i++)
- {
- deviceSettings.insert(deviceKeys[i],deviceValues[i]);
- }
- if(model->hasChildren(index))
- {
- for(int i= 0;i<model->rowCount(index);i++)
- {
- QModelIndex channelIndex= model->index(i,0,index);
- QDomElement channelReference= model->referenceElement(model->data(channelIndex,32).toString());
- channelList.append(new Channel);
- QDomElement channelReferenceElement=
- model->referenceElement(model->data(channelIndex,Qt::UserRole).toString());
- QDomNodeList channelConfigData=
- channelReferenceElement.elementsByTagName("attribute");
- QStringList channelKeys;
- QStringList channelValues;
- for(int j= 0;j<channelConfigData.size();j++)
- {
- node= channelConfigData.at(j).toElement();
- if(node.attribute("name")=="keys")
- {
- QString data= node.attribute("value");
- if(data.length()> 3)
- {
- data.chop(2);
- data= data.remove(0,2);
- }
- channelKeys= data.split(", ");
- }
- else if(node.attribute("name")=="values")
- {
- QString data= node.attribute("value");
- if(data.length()> 3)
- {
- data.chop(2);
- data= data.remove(0,2);
- }
- channelValues= data.split(", ");
- }
- else if(node.attribute("name")=="hidden")
- {
- hiddenState.append(node.attribute("value")=="true");
- }
- else if(node.attribute("name")=="columnname")
- {
- columnNames.append(node.attribute("value"));
- }
- }
- QVariantMap cs;
- for(int j= 0;j<qMin(channelKeys.length(),channelValues.length());j++)
- {
- cs.insert(channelKeys[j],channelValues[j]);
- }
- channelSettings.append(cs);
- indicatorTexts.append(model->data(channelIndex,Qt::DisplayRole).toString());
- channelUnits.append(Units::Fahrenheit);
- }
- }
- }
-
- /*:886*//*887:*/
- #line 564 "./unsupportedserial.w"
-
- int JavaScriptDevice::channelCount()
- {
- return channelList.length();
- }
-
- Channel*JavaScriptDevice::getChannel(int channel)
- {
- return channelList.at(channel);
- }
-
- bool JavaScriptDevice::isChannelHidden(int channel)
- {
- return hiddenState.at(channel);
- }
-
- Units::Unit JavaScriptDevice::expectedChannelUnit(int channel)
- {
- return channelUnits.at(channel);
- }
-
- QString JavaScriptDevice::channelColumnName(int channel)
- {
- if(channel>=0&&channel<columnNames.length())
- {
- return columnNames.at(channel);
- }
- return QString();
- }
-
- QString JavaScriptDevice::channelIndicatorText(int channel)
- {
- return indicatorTexts.at(channel);
- }
-
- /*:887*//*888:*/
- #line 601 "./unsupportedserial.w"
-
- void JavaScriptDevice::setTemperatureColumn(int tcol)
- {
- annotationTemperatureColumn= tcol;
- }
-
- void JavaScriptDevice::setAnnotationColumn(int ncol)
- {
- annotationNoteColumn= ncol;
- }
-
- /*:888*/
- #line 641 "./unsupportedserial.w"
-
-
- /*:892*//*918:*/
- #line 444 "./phidgets.w"
-
- /*902:*/
- #line 31 "./phidgets.w"
-
- PhidgetsTemperatureSensorConfWidget::PhidgetsTemperatureSensorConfWidget(DeviceTreeModel*model,
- const QModelIndex&index)
- :BasicDeviceConfigurationWidget(model,index)
- {
- QFormLayout*layout= new QFormLayout;
- QPushButton*addChannelButton= new QPushButton(tr("Add Channel"));
- QSpinBox*sampleRate= new QSpinBox;
- sampleRate->setMinimum(40);
- sampleRate->setMaximum(600);
- sampleRate->setSingleStep(40);
- sampleRate->setValue(360);
-
- /*771:*/
- #line 16334 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:771*/
- #line 44 "./phidgets.w"
-
- for(int i= 0;i<configData.size();i++)
- {
- node= configData.at(i).toElement();
- if(node.attribute("name")=="sampleRate")
- {
- sampleRate->setValue(node.attribute("value").toInt());
- }
- }
- updateRate(sampleRate->value());
-
- connect(sampleRate,SIGNAL(valueChanged(int)),this,SLOT(updateRate(int)));
- connect(addChannelButton,SIGNAL(clicked()),this,SLOT(addChannel()));
-
- layout->addRow(addChannelButton);
- layout->addRow(tr("Sample rate:"),sampleRate);
- setLayout(layout);
- }
-
- /*:902*//*903:*/
- #line 66 "./phidgets.w"
-
- void PhidgetsTemperatureSensorConfWidget::addChannel()
- {
- insertChildNode(tr("Channel"),"phidgets1048channel");
- }
-
- /*:903*//*904:*/
- #line 74 "./phidgets.w"
-
- void PhidgetsTemperatureSensorConfWidget::updateRate(int ms)
- {
- updateAttribute("sampleRate",QString("%1").arg(ms));
- }
-
- /*:904*//*906:*/
- #line 103 "./phidgets.w"
-
- PhidgetTemperatureSensorChannelConfWidget::PhidgetTemperatureSensorChannelConfWidget(
- DeviceTreeModel*model,const QModelIndex&index)
- :BasicDeviceConfigurationWidget(model,index),
- tcType(new QComboBox)
- {
- QFormLayout*layout= new QFormLayout;
- QLineEdit*columnName= new QLineEdit;
- layout->addRow(tr("Column Name:"),columnName);
- QCheckBox*hideSeries= new QCheckBox("Hide this channel");
- layout->addRow(hideSeries);
- layout->addRow(tr("Thermocouple Type:"),tcType);
- tcType->addItem("Type K","1");
- tcType->addItem("Type J","2");
- tcType->addItem("Type E","3");
- tcType->addItem("Type T","4");
- QSpinBox*channel= new QSpinBox;
- layout->addRow(tr("Channel:"),channel);
- channel->setMinimum(0);
- channel->setMaximum(3);
- setLayout(layout);
- /*771:*/
- #line 16334 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:771*/
- #line 124 "./phidgets.w"
-
- for(int i= 0;i<configData.size();i++)
- {
- node= configData.at(i).toElement();
- if(node.attribute("name")=="columnname")
- {
- columnName->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="hidden")
- {
- hideSeries->setChecked(node.attribute("value")=="true");
- }
- else if(node.attribute("name")=="tctype")
- {
- tcType->setCurrentIndex(tcType->findData(node.attribute("value")));
- }
- else if(node.attribute("name")=="channel")
- {
- channel->setValue(node.attribute("value").toInt());
- }
- }
- updateColumnName(columnName->text());
- updateHidden(hideSeries->isChecked());
- updateTC(tcType->currentIndex());
- updateChannel(channel->value());
- connect(columnName,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
- connect(hideSeries,SIGNAL(toggled(bool)),this,SLOT(updateHidden(bool)));
- connect(tcType,SIGNAL(currentIndexChanged(int)),this,SLOT(updateTC(int)));
- connect(channel,SIGNAL(valueChanged(int)),this,SLOT(updateChannel(int)));
- }
-
- /*:906*//*907:*/
- #line 157 "./phidgets.w"
-
- void PhidgetTemperatureSensorChannelConfWidget::updateColumnName(const QString&value)
- {
- updateAttribute("columnname",value);
- }
-
- void PhidgetTemperatureSensorChannelConfWidget::updateHidden(bool hidden)
- {
- updateAttribute("hidden",hidden?"true":"false");
- }
-
- void PhidgetTemperatureSensorChannelConfWidget::updateTC(int index)
- {
- updateAttribute("tctype",tcType->itemData(index).toString());
- }
-
- void PhidgetTemperatureSensorChannelConfWidget::updateChannel(int channel)
- {
- updateAttribute("channel",QString("%1").arg(channel));
- }
-
- /*:907*//*911:*/
- #line 246 "./phidgets.w"
-
- PhidgetsTemperatureSensor::PhidgetsTemperatureSensor(const QModelIndex&index)
- :QObject(NULL),driver("phidget21"),device(NULL)
- {
- DeviceTreeModel*model= (DeviceTreeModel*)(index.model());
- QDomElement deviceReferenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList deviceConfigData= deviceReferenceElement.elementsByTagName("attribute");
- QDomElement node;
- for(int i= 0;i<deviceConfigData.size();i++)
- {
- node= deviceConfigData.at(i).toElement();
- if(node.attribute("name")=="sampleRate")
- {
- sampleTimer.setInterval(node.attribute("value").toInt());
- }
- }
- if(model->hasChildren(index))
- {
- for(int i= 0;i<model->rowCount(index);i++)
- {
- QModelIndex channelIndex= model->index(i,0,index);
- QDomElement channelReference= model->referenceElement(model->data(channelIndex,32).toString());
- QDomElement channelReferenceElement= model->referenceElement(model->data(channelIndex,Qt::UserRole).toString());
- QDomNodeList channelConfigData= channelReferenceElement.elementsByTagName("attribute");
- for(int j= 0;j<channelConfigData.size();j++)
- {
- node= channelConfigData.at(j).toElement();
- if(node.attribute("name")=="channel")
- {
- int channelID= node.attribute("value").toInt();
- channelIndices.append(channelID);
- Channel*channel= new Channel;
- channelList.append(channel);
- channelMap.insert(channelID,channel);
- }
- else if(node.attribute("name")=="hidden")
- {
- hiddenState.append(node.attribute("value")=="true");
- }
- else if(node.attribute("name")=="columnname")
- {
- columnNames.append(node.attribute("value"));
- }
- else if(node.attribute("name")=="tctype")
- {
- tctypes.append(node.attribute("value").toInt());
- }
- }
- indicatorTexts.append(model->data(channelIndex,Qt::DisplayRole).toString());
- }
- }
- }
-
- /*:911*//*912:*/
- #line 306 "./phidgets.w"
-
- int PhidgetsTemperatureSensor::channelCount()
- {
- return channelList.length();
- }
-
- Channel*PhidgetsTemperatureSensor::getChannel(int channel)
- {
- return channelList.at(channel);
- }
-
- /*:912*//*913:*/
- #line 319 "./phidgets.w"
-
- bool PhidgetsTemperatureSensor::isChannelHidden(int channel)
- {
- return hiddenState.at(channel);
- }
-
- QString PhidgetsTemperatureSensor::channelColumnName(int channel)
- {
- if(channel>=0&&channel<columnNames.length())
- {
- return columnNames.at(channel);
- }
- return QString();
- }
-
- QString PhidgetsTemperatureSensor::channelIndicatorText(int channel)
- {
- if(channel>=0&&channel<indicatorTexts.length())
- {
- return indicatorTexts.at(channel);
- }
- return QString();
- }
-
- /*:913*//*915:*/
- #line 371 "./phidgets.w"
-
- void PhidgetsTemperatureSensor::start()
- {
- if(!driver.load())
- {
- driver.setFileName("Phidget21.framework/Phidget21");
- if(!driver.load())
- {
- QMessageBox::critical(NULL,tr("Typica: Driver not found"),
- tr("Failed to find phidget21. Please install it."));
- return;
- }
- }
- if((createDevice= (PhidgetHandleOnly)driver.resolve("CPhidgetTemperatureSensor_create"))==0||
- (openDevice= (PhidgetHandleInt)driver.resolve("CPhidget_open"))==0||
- (waitForOpen= (PhidgetHandleInt)driver.resolve("CPhidget_waitForAttachment"))==0||
- (setTCType= (PhidgetHandleIntInt)driver.resolve("CPhidgetTemperatureSensor_setThermocoupleType"))==0||
- (getTemperature= (PhidgetHandleIntDoubleOut)driver.resolve("CPhidgetTemperatureSensor_getTemperature"))==0||
- (closeDevice= (PhidgetHandleOnly)driver.resolve("CPhidget_close"))==0||
- (deleteDevice= (PhidgetHandleOnly)driver.resolve("CPhidget_delete"))==0)
- {
- QMessageBox::critical(NULL,tr("Typica: Link error"),
- tr("Failed to link a required symbol in phidget21."));
- return;
- }
- createDevice(&device);
- openDevice(device,-1);
- int error;
- if((error= waitForOpen(device,10000)))
- {
- closeDevice(device);
- deleteDevice(device);
- QMessageBox::critical(NULL,tr("Typica: Failed to Open Device"),
- tr("CPhidget_waitForAttachment returns error %n",0,error));
- return;
- }
- for(int i= 0;i<channelIndices.length();i++)
- {
- setTCType(device,channelIndices.at(i),tctypes.at(i));
- }
- connect(&sampleTimer,SIGNAL(timeout()),this,SLOT(getMeasurements()));
- sampleTimer.start();
- }
-
- /*:915*//*916:*/
- #line 418 "./phidgets.w"
-
- void PhidgetsTemperatureSensor::getMeasurements()
- {
- double value= 0.0;
- QTime time= QTime::currentTime();
- foreach(int i,channelIndices)
- {
- getTemperature(device,i,&value);
- Measurement measure(value*9.0/5.0+32.0,time);
- channelMap[i]->input(measure);
- }
- }
-
- /*:916*//*917:*/
- #line 433 "./phidgets.w"
-
- void PhidgetsTemperatureSensor::stop()
- {
- sampleTimer.stop();
- closeDevice(device);
- deleteDevice(device);
- driver.unload();
- }
-
- /*:917*/
- #line 445 "./phidgets.w"
-
-
- /*:918*//*932:*/
- #line 19524 "./typica.w"
-
- /*930:*/
- #line 19486 "./typica.w"
-
- CoolingTimerConfWidget::CoolingTimerConfWidget(DeviceTreeModel*model,
- const QModelIndex&index)
- :BasicDeviceConfigurationWidget(model,index)
- {
- QHBoxLayout*layout= new QHBoxLayout;
- QLabel*label= new QLabel(tr("Cooling Time: "));
- QTimeEdit*editor= new QTimeEdit;
- editor->setDisplayFormat("mm:ss");
- /*771:*/
- #line 16334 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:771*/
- #line 19495 "./typica.w"
-
- for(int i= 0;i<configData.size();i++)
- {
- node= configData.at(i).toElement();
- if(node.attribute("name")=="reset")
- {
- editor->setTime(QTime::fromString(node.attribute("value"),"mm:ss"));
- }
- }
- updateResetTime(editor->time());
- connect(editor,SIGNAL(timeChanged(QTime)),
- this,SLOT(updateResetTime(QTime)));
- layout->addWidget(label);
- layout->addWidget(editor);
- setLayout(layout);
- }
-
- void CoolingTimerConfWidget::updateResetTime(QTime time)
- {
- updateAttribute("reset",time.toString("mm:ss"));
- }
-
- /*:930*/
- #line 19525 "./typica.w"
-
-
- /*:932*//*937:*/
- #line 19783 "./typica.w"
-
- /*934:*/
- #line 19557 "./typica.w"
-
- RangeTimerConfWidget::RangeTimerConfWidget(DeviceTreeModel*model,const QModelIndex&index)
- :BasicDeviceConfigurationWidget(model,index)
- {
- QVBoxLayout*layout= new QVBoxLayout;
-
- QGroupBox*startConfigurationGroup= new QGroupBox(tr("Start trigger"));
- QRadioButton*startBatchOption= new QRadioButton(tr("Start of batch"));
- QRadioButton*buttonOption= new QRadioButton(tr("Manual"));
- QRadioButton*thresholdOption= new QRadioButton(tr("At temperature"));
- QButtonGroup*startOptionGroup= new QButtonGroup;
- startOptionGroup->addButton(startBatchOption,1);
- startOptionGroup->addButton(buttonOption,2);
- startOptionGroup->addButton(thresholdOption,3);
- startBatchOption->setChecked(true);
- QGridLayout*startOptions= new QGridLayout;
- startOptions->addWidget(startBatchOption,0,0);
- startOptions->addWidget(buttonOption,1,0);
- startOptions->addWidget(thresholdOption,2,0);
- QLabel*buttonTextLabel= new QLabel(tr("Button Text: "));
- QLineEdit*buttonTextEdit= new QLineEdit;
- QHBoxLayout*buttonTextOptions= new QHBoxLayout;
- buttonTextOptions->addWidget(buttonTextLabel);
- buttonTextOptions->addWidget(buttonTextEdit);
- startOptions->addLayout(buttonTextOptions,1,1);
- QFormLayout*thresholdOptions= new QFormLayout;
- QLineEdit*startColumnName= new QLineEdit;
- QLineEdit*startValue= new QLineEdit;
- thresholdOptions->addRow(tr("Column Name: "),startColumnName);
- thresholdOptions->addRow(tr("Value: "),startValue);
- startOptions->addLayout(thresholdOptions,2,1);
- startConfigurationGroup->setLayout(startOptions);
- layout->addWidget(startConfigurationGroup);
-
- QGroupBox*stopConfigurationGroup= new QGroupBox(tr("Stop trigger"));
- QRadioButton*stopBatchOption= new QRadioButton(tr("End of batch"));
- QRadioButton*stopButtonOption= new QRadioButton(tr("Manual"));
- QRadioButton*stopThresholdOption= new QRadioButton(tr("At temperature"));
- QButtonGroup*stopOptionGroup= new QButtonGroup;
- stopOptionGroup->addButton(stopBatchOption,1);
- stopOptionGroup->addButton(stopButtonOption,2);
- stopOptionGroup->addButton(stopThresholdOption,3);
- stopBatchOption->setChecked(true);
- QGridLayout*stopOptions= new QGridLayout;
- stopOptions->addWidget(stopBatchOption,0,0);
- stopOptions->addWidget(stopButtonOption,1,0);
- stopOptions->addWidget(stopThresholdOption,2,0);
- QLabel*stopButtonLabel= new QLabel(tr("Button Text: "));
- QLineEdit*stopButtonEdit= new QLineEdit;
- QHBoxLayout*stopButtonTextOptions= new QHBoxLayout;
- stopButtonTextOptions->addWidget(stopButtonLabel);
- stopButtonTextOptions->addWidget(stopButtonEdit);
- stopOptions->addLayout(stopButtonTextOptions,1,1);
- QLineEdit*stopColumnName= new QLineEdit;
- QLineEdit*stopValue= new QLineEdit;
- QFormLayout*stopThresholdOptions= new QFormLayout;
- stopThresholdOptions->addRow(tr("Column Name: "),stopColumnName);
- stopThresholdOptions->addRow(tr("Value: "),stopValue);
- stopOptions->addLayout(stopThresholdOptions,2,1);
- stopConfigurationGroup->setLayout(stopOptions);
- layout->addWidget(stopConfigurationGroup);
-
- /*771:*/
- #line 16334 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:771*/
- #line 19619 "./typica.w"
-
- for(int i= 0;i<configData.size();i++)
- {
- node= configData.at(i).toElement();
- if(node.attribute("name")=="startbuttontext")
- {
- buttonTextEdit->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="stopbuttontext")
- {
- stopButtonEdit->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="startcolumnname")
- {
- startColumnName->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="stopcolumnname")
- {
- stopColumnName->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="startvalue")
- {
- startValue->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="stopvalue")
- {
- stopValue->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="starttrigger")
- {
- if(node.attribute("value")=="batch")
- {
- startBatchOption->setChecked(true);
- }
- else if(node.attribute("value")=="manual")
- {
- buttonOption->setChecked(true);
- }
- else if(node.attribute("value")=="value")
- {
- thresholdOption->setChecked(true);
- }
- }
- else if(node.attribute("name")=="stoptrigger")
- {
- if(node.attribute("value")=="batch")
- {
- stopBatchOption->setChecked(true);
- }
- else if(node.attribute("value")=="manual")
- {
- stopButtonOption->setChecked(true);
- }
- else if(node.attribute("value")=="value")
- {
- stopThresholdOption->setChecked(true);
- }
- }
- }
- updateStartButtonText(buttonTextEdit->text());
- updateStopButtonText(stopButtonEdit->text());
- updateStartColumnName(startColumnName->text());
- updateStopColumnName(stopColumnName->text());
- updateStartValue(startValue->text());
- updateStopValue(stopValue->text());
- updateStartTrigger(startOptionGroup->checkedId());
- updateStopTrigger(stopOptionGroup->checkedId());
-
- setLayout(layout);
-
- connect(buttonTextEdit,SIGNAL(textChanged(QString)),
- this,SLOT(updateStartButtonText(QString)));
- connect(stopButtonEdit,SIGNAL(textChanged(QString)),
- this,SLOT(updateStopButtonText(QString)));
- connect(startColumnName,SIGNAL(textChanged(QString)),
- this,SLOT(updateStartColumnName(QString)));
- connect(stopColumnName,SIGNAL(textChanged(QString)),
- this,SLOT(updateStopColumnName(QString)));
- connect(startValue,SIGNAL(textChanged(QString)),
- this,SLOT(updateStartValue(QString)));
- connect(stopValue,SIGNAL(textChanged(QString)),
- this,SLOT(updateStopValue(QString)));
- connect(startOptionGroup,SIGNAL(buttonClicked(int)),
- this,SLOT(updateStartTrigger(int)));
- connect(stopOptionGroup,SIGNAL(buttonClicked(int)),
- this,SLOT(updateStopTrigger(int)));
- }
-
- /*:934*//*935:*/
- #line 19709 "./typica.w"
-
- void RangeTimerConfWidget::updateStartButtonText(const QString&text)
- {
- updateAttribute("startbuttontext",text);
- }
-
- void RangeTimerConfWidget::updateStopButtonText(const QString&text)
- {
- updateAttribute("stopbuttontext",text);
- }
-
- void RangeTimerConfWidget::updateStartColumnName(const QString&text)
- {
- updateAttribute("startcolumnname",text);
- }
-
- void RangeTimerConfWidget::updateStopColumnName(const QString&text)
- {
- updateAttribute("stopcolumnname",text);
- }
-
- void RangeTimerConfWidget::updateStartValue(const QString&text)
- {
- updateAttribute("startvalue",text);
- }
-
- void RangeTimerConfWidget::updateStopValue(const QString&text)
- {
- updateAttribute("stopvalue",text);
- }
-
- void RangeTimerConfWidget::updateStartTrigger(int option)
- {
- switch(option)
- {
- case 1:
- updateAttribute("starttrigger","batch");
- break;
- case 2:
- updateAttribute("starttrigger","manual");
- break;
- case 3:
- updateAttribute("starttrigger","value");
- break;
- default:
- break;
- }
- }
-
- void RangeTimerConfWidget::updateStopTrigger(int option)
- {
- switch(option)
- {
- case 1:
- updateAttribute("stoptrigger","batch");
- break;
- case 2:
- updateAttribute("stoptrigger","manual");
- break;
- case 3:
- updateAttribute("stoptrigger","value");
- break;
- default:
- break;
- }
- }
-
- /*:935*/
- #line 19784 "./typica.w"
-
-
- /*:937*//*942:*/
- #line 19884 "./typica.w"
-
- /*939:*/
- #line 19808 "./typica.w"
-
- MultiRangeTimerConfWidget::MultiRangeTimerConfWidget(DeviceTreeModel*model,
- const QModelIndex&index)
- :BasicDeviceConfigurationWidget(model,index),tablemodel(new SaltModel(2))
- {
- QFormLayout*layout= new QFormLayout;
- QLineEdit*trigger= new QLineEdit;
- layout->addRow(tr("Trigger column name:"),trigger);
- tablemodel->setHeaderData(0,Qt::Horizontal,"Range Name");
- tablemodel->setHeaderData(1,Qt::Horizontal,"End Temperature");
- QTableView*rangeTable= new QTableView;
- rangeTable->setModel(tablemodel);
- layout->addRow(tr("Range data:"),rangeTable);
- /*771:*/
- #line 16334 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:771*/
- #line 19821 "./typica.w"
-
- for(int i= 0;i<configData.size();i++)
- {
- node= configData.at(i).toElement();
- if(node.attribute("name")=="trigger")
- {
- trigger->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="rangenames")
- {
- QString data= node.attribute("value");
- if(data.length()> 3)
- {
- data.chop(2);
- data= data.remove(0,2);
- }
- QStringList itemList= data.split(", ");
- for(int j= 0;j<itemList.size();j++)
- {
- QString item= itemList.at(j);
- item.chop(1);
- item= item.remove(0,1);
- tablemodel->setData(tablemodel->index(j,0),
- QVariant(item),Qt::DisplayRole);
- }
- }
- else if(node.attribute("name")=="endtemps")
- {
- /*925:*/
- #line 19416 "./typica.w"
-
- QString data= node.attribute("value");
- if(data.length()> 3)
- {
- data.chop(2);
- data= data.remove(0,2);
- }
- QStringList itemList= data.split(",");
-
- /*:925*/
- #line 19849 "./typica.w"
-
- int column= 1;
- /*926:*/
- #line 19428 "./typica.w"
-
- for(int j= 0;j<itemList.size();j++)
- {
- tablemodel->setData(tablemodel->index(j,column),
- QVariant(itemList.at(j).toDouble()),
- Qt::DisplayRole);
- }
-
- /*:926*/
- #line 19851 "./typica.w"
-
- }
- }
- updateColumnName(trigger->text());
- updateRangeData();
- connect(trigger,SIGNAL(textEdited(QString)),this,SLOT(updateColumnName(QString)));
- connect(tablemodel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(updateRangeData()));
- setLayout(layout);
- }
-
- /*:939*//*940:*/
- #line 19865 "./typica.w"
-
- void MultiRangeTimerConfWidget::updateRangeData()
- {
- updateAttribute("rangenames",tablemodel->quotedArrayLiteral(0,Qt::DisplayRole));
- updateAttribute("endtemps",tablemodel->arrayLiteral(1,Qt::DisplayRole));
- }
-
- void MultiRangeTimerConfWidget::updateColumnName(const QString&text)
- {
- updateAttribute("trigger",text);
- }
-
- /*:940*/
- #line 19885 "./typica.w"
-
-
- /*:942*//*960:*/
- #line 265 "./rate.w"
-
- /*956:*/
- #line 191 "./rate.w"
-
- RateOfChangeConfWidget::RateOfChangeConfWidget(DeviceTreeModel*model,const QModelIndex&index)
- :BasicDeviceConfigurationWidget(model,index)
- {
- QFormLayout*layout= new QFormLayout;
- QLineEdit*column= new QLineEdit;
- layout->addRow(tr("Primary series column name:"),column);
- QSpinBox*cacheTime= new QSpinBox;
- cacheTime->setMinimum(0);
- cacheTime->setMaximum(300);
- layout->addRow(tr("Cache time:"),cacheTime);
- QSpinBox*scaleTime= new QSpinBox;
- scaleTime->setMinimum(1);
- scaleTime->setMaximum(300);
- layout->addRow(tr("Scale time:"),scaleTime);
- /*771:*/
- #line 16334 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:771*/
- #line 206 "./rate.w"
-
- for(int i= 0;i<configData.size();i++)
- {
- node= configData.at(i).toElement();
- if(node.attribute("name")=="column")
- {
- column->setText(node.attribute("value"));
- }
- else if(node.attribute("name")=="cache")
- {
- cacheTime->setValue(node.attribute("value").toInt());
- }
- else if(node.attribute("name")=="scale")
- {
- scaleTime->setValue(node.attribute("value").toInt());
- }
- }
- updateColumn(column->text());
- updateCacheTime(cacheTime->text());
- updateScaleTime(scaleTime->text());
- connect(column,SIGNAL(textEdited(QString)),this,SLOT(updateColumn(QString)));
- connect(cacheTime,SIGNAL(valueChanged(QString)),this,SLOT(updateCacheTime(QString)));
- connect(scaleTime,SIGNAL(valueChanged(QString)),this,SLOT(updateScaleTime(QString)));
- setLayout(layout);
- }
-
- /*:956*//*957:*/
- #line 235 "./rate.w"
-
- void RateOfChangeConfWidget::updateColumn(const QString&column)
- {
- updateAttribute("column",column);
- }
-
- void RateOfChangeConfWidget::updateCacheTime(const QString&seconds)
- {
- updateAttribute("cache",seconds);
- }
-
- void RateOfChangeConfWidget::updateScaleTime(const QString&seconds)
- {
- updateAttribute("scale",seconds);
- }
-
- /*:957*/
- #line 266 "./rate.w"
-
- #line 19977 "./typica.w"
-
- #line 1 "./dataqsdk.w"
- /*:960*/
- #line 529 "./typica.w"
-
- /*8:*/
- #line 672 "./typica.w"
-
- template<class TYPE> TYPE getself(QScriptContext*context)
- {
- TYPE self= qobject_cast<TYPE> (context->thisObject().toQObject());
- return self;
- }
-
- template<> QTime getself(QScriptContext*context)
- {
- QTime self= context->thisObject().toVariant().toTime();
- return self;
- }
-
- template<> QByteArray getself(QScriptContext*context)
- {
- QByteArray self= context->thisObject().toVariant().toByteArray();
- return self;
- }
-
- template<> SqlQueryConnection*getself(QScriptContext*context)
- {
- SqlQueryConnection*self=
- (SqlQueryConnection*)qscriptvalue_cast<void*> (context->thisObject());
- return self;
- }
-
- template<> QXmlQuery*getself(QScriptContext*context)
- {
- QXmlQuery*self=
- (QXmlQuery*)qscriptvalue_cast<void*> (context->thisObject());
- return self;
- }
-
- template<> QXmlStreamWriter*getself(QScriptContext*context)
- {
- QXmlStreamWriter*self=
- (QXmlStreamWriter*)qscriptvalue_cast<void*> (context->thisObject());
- return self;
- }
-
- template<> QXmlStreamReader*getself(QScriptContext*context)
- {
- QXmlStreamReader*self=
- (QXmlStreamReader*)qscriptvalue_cast<void*> (context->thisObject());
- return self;
- }
-
- /*:8*//*9:*/
- #line 723 "./typica.w"
-
- template<class TYPE> TYPE argument(int arg,QScriptContext*context)
- {
- TYPE argument= qobject_cast<TYPE> (context->argument(arg).toQObject());
- return argument;
- }
-
- template<> QString argument(int arg,QScriptContext*context)
- {
- return context->argument(arg).toString();
- }
-
- template<> QVariant argument(int arg,QScriptContext*context)
- {
- return context->argument(arg).toVariant();
- }
-
- template<> int argument(int arg,QScriptContext*context)
- {
- return context->argument(arg).toInt32();
- }
-
- template<> SqlQueryConnection*argument(int arg,QScriptContext*context)
- {
- return(SqlQueryConnection*)
- qscriptvalue_cast<void*> (context->argument(arg));
- }
-
- template<> QModelIndex argument(int arg,QScriptContext*context)
- {
- return qscriptvalue_cast<QModelIndex> (context->argument(arg));
- }
-
- template<> double argument(int arg,QScriptContext*context)
- {
- return(double)(context->argument(arg).toNumber());
- }
-
- template<> Units::Unit argument(int arg,QScriptContext*context)
- {
- return(Units::Unit)(context->argument(arg).toInt32());
- }
-
- template<> QByteArray argument(int arg,QScriptContext*context)
- {
- return qscriptvalue_cast<QByteArray> (context->argument(arg));
- }
-
- /*:9*//*13:*/
- #line 815 "./typica.w"
-
- void setQObjectProperties(QScriptValue,QScriptEngine*)
- {
-
- }
-
- /*:13*//*15:*/
- #line 829 "./typica.w"
-
- void setQPaintDeviceProperties(QScriptValue,QScriptEngine*)
- {
-
- }
-
- void setQLayoutItemProperties(QScriptValue,QScriptEngine*)
- {
-
- }
-
- /*:15*//*18:*/
- #line 868 "./typica.w"
-
- QScriptValue constructQWidget(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new QWidget);
- setQWidgetProperties(object,engine);
- return object;
- }
-
- void setQWidgetProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQObjectProperties(value,engine);
- setQPaintDeviceProperties(value,engine);
- value.setProperty("setLayout",engine->newFunction(QWidget_setLayout));
- value.setProperty("activateWindow",
- engine->newFunction(QWidget_activateWindow));
- }
-
- /*:18*//*19:*/
- #line 890 "./typica.w"
-
- QScriptValue QWidget_setLayout(QScriptContext*context,QScriptEngine*)
- {
- if(context->argumentCount()==1)
- {
- QWidget*self= getself<QWidget*> (context);
- QLayout*layout= argument<QLayout*> (0,context);
- if(layout)
- {
- self->setLayout(layout);
- }
- else
- {
- context->throwError("Incorrect argument type passed to "
- "QWidget::setLayout(). This method requires "
- "a QLayout.");
- }
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QWidget::setLayout(). This method takes one "
- "QLayout as an argument.");
- }
- return QScriptValue();
- }
-
- QScriptValue QWidget_activateWindow(QScriptContext*context,
- QScriptEngine*)
- {
- QWidget*self= getself<QWidget*> (context);
- self->activateWindow();
- return QScriptValue();
- }
-
- /*:19*//*22:*/
- #line 952 "./typica.w"
-
- QScriptValue displayWarning(QScriptContext*context,QScriptEngine*)
- {
- QMessageBox::StandardButton selection= QMessageBox::warning(NULL,
- argument<QString> (0,context),
- argument<QString> (1,context),
- QMessageBox::Ok|QMessageBox::Cancel);
- if(selection==QMessageBox::Ok){
- return QScriptValue(true);
- }
- return QScriptValue(false);
- }
-
- QScriptValue displayError(QScriptContext*context,QScriptEngine*)
- {
- QMessageBox::critical(NULL,argument<QString> (0,context),
- argument<QString> (1,context));
- return QScriptValue();
- }
-
- /*:22*//*24:*/
- #line 1019 "./typica.w"
-
- ScriptQMainWindow::ScriptQMainWindow():QMainWindow(NULL),
- cprompt(tr("Closing this window may result in loss of data. Continue?"))
- {
-
- }
-
- void ScriptQMainWindow::saveSizeAndPosition(const QString&key)
- {
- QSettings settings;
- settings.beginGroup(key);
- settings.setValue("pos",pos());
- settings.setValue("size",size());
- settings.endGroup();
- }
-
- void ScriptQMainWindow::restoreSizeAndPosition(const QString&key)
- {
- QSettings settings;
- settings.beginGroup(key);
- if(settings.contains("size"))
- {
- resize(settings.value("size").toSize());
- }
- if(settings.contains("pos"))
- {
- move(settings.value("pos").toPoint());
- }
- settings.endGroup();
- }
-
- void ScriptQMainWindow::displayStatus(const QString&message)
- {
- statusBar()->showMessage(message);
- }
-
- void ScriptQMainWindow::showEvent(QShowEvent*event)
- {
- if(!event->spontaneous())
- {
- /*29:*/
- #line 1131 "./typica.w"
-
- QSettings settings;
- restoreGeometry(settings.value(QString("geometries/%1").arg(objectName())).
- toByteArray());
-
- /*:29*/
- #line 1059 "./typica.w"
-
- event->accept();
- }
- else
- {
- event->ignore();
- }
- }
-
- void ScriptQMainWindow::show()
- {
- QMainWindow::show();
- }
-
- /*:24*//*25:*/
- #line 1080 "./typica.w"
-
- void ScriptQMainWindow::closeEvent(QCloseEvent*event)
- {
- if(isWindowModified()){
- /*26:*/
- #line 1094 "./typica.w"
-
- QMessageBox::StandardButton result;
- result= QMessageBox::warning(this,"Typica",closePrompt(),
- QMessageBox::Ok|QMessageBox::Cancel);
- if(result==QMessageBox::Cancel)
- {
- event->ignore();
- return;
- }
-
- /*:26*/
- #line 1084 "./typica.w"
-
- }
- emit aboutToClose();
- /*28:*/
- #line 1125 "./typica.w"
-
- QSettings settings;
- settings.setValue(QString("geometries/%1").arg(objectName()),saveGeometry());
-
- /*:28*/
- #line 1087 "./typica.w"
-
- event->accept();
- }
-
- /*:25*//*27:*/
- #line 1106 "./typica.w"
-
- QString ScriptQMainWindow::closePrompt()
- {
- return cprompt;
- }
-
- void ScriptQMainWindow::setClosePrompt(QString prompt)
- {
- cprompt= prompt;
- }
-
- /*:27*//*32:*/
- #line 1159 "./typica.w"
-
- QScriptValue constructQMainWindow(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new ScriptQMainWindow);
- setQMainWindowProperties(object,engine);
- return object;
- }
-
- void setQMainWindowProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQWidgetProperties(value,engine);
- value.setProperty("setCentralWidget",
- engine->newFunction(QMainWindow_setCentralWidget));
- value.setProperty("menuBar",engine->newFunction(QMainWindow_menuBar));
- }
-
- /*:32*//*33:*/
- #line 1181 "./typica.w"
-
- QScriptValue QMainWindow_setCentralWidget(QScriptContext*context,
- QScriptEngine*)
- {
- if(context->argumentCount()==1)
- {
- QMainWindow*self= getself<QMainWindow*> (context);
- QWidget*widget= argument<QWidget*> (0,context);
- if(widget)
- {
- self->setCentralWidget(widget);
- }
- else
- {
- context->throwError("Incorrect argument type passed to "
- "QMainWindow::setCentralWidget(). This "
- "method requires a QWidget.");
- }
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QMainWindow::setCentralWidget(). This method "
- "takes one QWidget as an argument.");
- }
- return QScriptValue();
- }
-
- /*:33*//*34:*/
- #line 1215 "./typica.w"
-
- QScriptValue QMainWindow_menuBar(QScriptContext*context,QScriptEngine*engine)
- {
- QScriptValue object;
- if(context->argumentCount()==0)
- {
- QMainWindow*self= getself<QMainWindow*> (context);
- QMenuBar*bar= self->menuBar();
- object= engine->newQObject(bar);
- setQMenuBarProperties(object,engine);
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QMainWindow::menuBar(). This method takes no "
- "arguments.");
- }
- return object;
- }
-
- /*:34*//*36:*/
- #line 1245 "./typica.w"
-
- void setQMenuBarProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQWidgetProperties(value,engine);
- value.setProperty("addMenu",engine->newFunction(QMenuBar_addMenu));
- }
-
- /*:36*//*37:*/
- #line 1260 "./typica.w"
-
- QScriptValue QMenuBar_addMenu(QScriptContext*context,QScriptEngine*engine)
- {
- QScriptValue object;
- if(context->argumentCount()==1)
- {
- QMenuBar*self= getself<QMenuBar*> (context);
- QString title= argument<QString> (0,context);
- object= engine->newQObject(self->addMenu(title));
- setQMenuProperties(object,engine);
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QMenuBar::addMenu(). This method takes one "
- "string as an argument.");
- }
- return object;
- }
-
- /*:37*//*39:*/
- #line 1290 "./typica.w"
-
- void setQMenuProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQWidgetProperties(value,engine);
- value.setProperty("addAction",engine->newFunction(QMenu_addAction));
- value.setProperty("addSeparator",engine->newFunction(QMenu_addSeparator));
- }
-
- /*:39*//*40:*/
- #line 1300 "./typica.w"
-
- QScriptValue QMenu_addAction(QScriptContext*context,QScriptEngine*)
- {
- if(context->argumentCount()==1)
- {
- QMenu*self= getself<QMenu*> (context);
- QAction*action= argument<QAction*> (0,context);
- if(action)
- {
- self->addAction(action);
- }
- else
- {
- context->throwError("Incorrect argument type passed to "
- "QMenu::addAction(). This method requires a "
- "QAction.");
- }
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QMenu::addAction(). This method takes one "
- "QAction as an argument.");
- }
- return QScriptValue();
- }
-
- QScriptValue QMenu_addSeparator(QScriptContext*context,QScriptEngine*)
- {
- if(context->argumentCount()==0)
- {
- QMenu*self= getself<QMenu*> (context);
- self->addSeparator();
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QMenu::addSeparator(). This method takes no "
- "arguments.");
- }
- return QScriptValue();
- }
-
- /*:40*//*43:*/
- #line 1362 "./typica.w"
-
- QScriptValue constructQFrame(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new QFrame);
- setQFrameProperties(object,engine);
- return object;
- }
-
- void setQFrameProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQWidgetProperties(value,engine);
- }
-
- /*:43*//*46:*/
- #line 1396 "./typica.w"
-
- QScriptValue constructQLabel(QScriptContext*context,QScriptEngine*engine)
- {
- QString text;
- if(context->argumentCount()==1)
- {
- text= argument<QString> (0,context);
- }
- QScriptValue object= engine->newQObject(new QLabel(text));
- setQLabelProperties(object,engine);
- return object;
- }
-
- void setQLabelProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQFrameProperties(value,engine);
- }
-
- /*:46*//*49:*/
- #line 1438 "./typica.w"
-
- QScriptValue constructQSvgWidget(QScriptContext*,
- QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new QSvgWidget);
- setQSvgWidgetProperties(object,engine);
- return object;
- }
-
- /*:49*//*50:*/
- #line 1449 "./typica.w"
-
- void setQSvgWidgetProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQWidgetProperties(value,engine);
- value.setProperty("loadDevice",
- engine->newFunction(QSvgWidget_loadDevice));
- }
-
- QScriptValue QSvgWidget_loadDevice(QScriptContext*context,QScriptEngine*)
- {
- if(context->argumentCount()==1)
- {
- QSvgWidget*self= getself<QSvgWidget*> (context);
- QIODevice*device= argument<QIODevice*> (0,context);
- device->reset();
- QByteArray data= device->readAll();
- self->load(data);
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QSvgWidget::loadData(). This method takes one "
- "QIODevice as an argument.");
- }
- return QScriptValue();
- }
-
- /*:50*//*52:*/
- #line 1487 "./typica.w"
-
- void addSvgWidgetToLayout(QDomElement element,QStack<QWidget*> *,
- QStack<QLayout*> *layoutStack)
- {
- QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
- QSvgWidget*widget= new QSvgWidget;
- layout->addWidget(widget);
- QString id= element.attribute("id");
- if(!id.isEmpty())
- {
- widget->setObjectName(id);
- }
- }
-
- /*:52*//*55:*/
- #line 1520 "./typica.w"
-
- QScriptValue constructQLineEdit(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new QLineEdit());
- setQLineEditProperties(object,engine);
- return object;
- }
-
- /*:55*//*56:*/
- #line 1531 "./typica.w"
-
- void setQLineEditProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQWidgetProperties(value,engine);
- }
-
- /*:56*//*59:*/
- #line 1567 "./typica.w"
-
- QScriptValue constructQSplitter(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new QSplitter);
- setQSplitterProperties(object,engine);
- return object;
- }
-
- void setQSplitterProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQFrameProperties(value,engine);
- value.setProperty("addWidget",engine->newFunction(QSplitter_addWidget));
- value.setProperty("saveState",engine->newFunction(QSplitter_saveState));
- value.setProperty("restoreState",
- engine->newFunction(QSplitter_restoreState));
- value.setProperty("count",engine->newFunction(QSplitter_count));
- }
-
- /*:59*//*60:*/
- #line 1588 "./typica.w"
-
- QScriptValue QSplitter_addWidget(QScriptContext*context,QScriptEngine*)
- {
- if(context->argumentCount()==1)
- {
- QSplitter*self= getself<QSplitter*> (context);
- QWidget*widget= argument<QWidget*> (0,context);
- if(widget)
- {
- self->addWidget(widget);
- }
- else
- {
- context->throwError("Incorrect argument type passed to "
- "QSplitter::addWidget(). This method "
- "requires a QWidget.");
- }
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QSplitter::addWidget(). This method takes one "
- "QWidget as an argument.");
- }
- return QScriptValue();
- }
-
- /*:60*//*61:*/
- #line 1625 "./typica.w"
-
- QScriptValue QSplitter_count(QScriptContext*context,QScriptEngine*)
- {
- QSplitter*self= getself<QSplitter*> (context);
- return QScriptValue(self->count());
- }
-
- /*:61*//*62:*/
- #line 1638 "./typica.w"
-
- QScriptValue QSplitter_saveState(QScriptContext*context,QScriptEngine*)
- {
- if(context->argumentCount()==1)
- {
- QSplitter*self= getself<QSplitter*> (context);
- QString key= argument<QString> (0,context);
- QSettings settings;
- settings.setValue(key,self->saveState());
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QSplitter::saveState(). This method takes one "
- "string as an argument.");
- }
- return QScriptValue();
- }
-
- QScriptValue QSplitter_restoreState(QScriptContext*context,QScriptEngine*)
- {
- if(context->argumentCount()==1)
- {
- QSplitter*self= getself<QSplitter*> (context);
- QString key= argument<QString> (0,context);
- QSettings settings;
- self->restoreState(settings.value(key).toByteArray());
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QSplitter::restoreState(). This method takes "
- "one string as an argument.");
- }
- return QScriptValue();
- }
-
- /*:62*//*64:*/
- #line 1691 "./typica.w"
-
- void setQLayoutProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQLayoutItemProperties(value,engine);
- value.setProperty("addWidget",engine->newFunction(QLayout_addWidget));
- }
-
- QScriptValue QLayout_addWidget(QScriptContext*context,QScriptEngine*)
- {
- if(context->argumentCount()==1)
- {
- QLayout*self= getself<QLayout*> (context);
- QWidget*widget= argument<QWidget*> (0,context);
- if(widget)
- {
- self->addWidget(widget);
- }
- else
- {
- context->throwError("Incorrect argument type passed to "
- "QLayout::addWidget(). This method requires "
- "a QWidget.");
- }
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QLayout::addWidget(). This method takes one "
- "QWidget as an argument.");
- }
- return QScriptValue();
- }
-
- /*:64*//*67:*/
- #line 1758 "./typica.w"
-
- QScriptValue constructQBoxLayout(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object=
- engine->newQObject(new QBoxLayout(QBoxLayout::LeftToRight));
- setQBoxLayoutProperties(object,engine);
- return object;
- }
-
- void setQBoxLayoutProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQLayoutProperties(value,engine);
- value.setProperty("addLayout",engine->newFunction(QBoxLayout_addLayout));
- value.setProperty("addWidget",engine->newFunction(QBoxLayout_addWidget));
- }
-
- QScriptValue QBoxLayout_addLayout(QScriptContext*context,QScriptEngine*)
- {
- if(context->argumentCount()> 0&&context->argumentCount()<3)
- {
- QBoxLayout*self= getself<QBoxLayout*> (context);
- QLayout*layout= argument<QLayout*> (0,context);
- int stretch= 0;
- if(context->argumentCount()==2)
- {
- stretch= argument<int> (1,context);
- }
- if(layout)
- {
- self->addLayout(layout,stretch);
- }
- else
- {
- context->throwError("Incorrect argument type passed to "
- "QLayout::addLayout(). This method requires "
- "a QLayout.");
- }
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QLayout::addLayout(). This method takes one "
- "QLayout as an argument and optionally one integer.");
- }
- return QScriptValue();
- }
-
- /*:67*//*68:*/
- #line 1809 "./typica.w"
-
- QScriptValue QBoxLayout_addWidget(QScriptContext*context,QScriptEngine*)
- {
- if(context->argumentCount()> 0&&context->argumentCount()<4)
- {
- QBoxLayout*self= getself<QBoxLayout*> (context);
- QWidget*widget= argument<QWidget*> (0,context);
- int stretch= 0;
- Qt::Alignment alignment= 0;
- if(context->argumentCount()> 1)
- {
- stretch= argument<int> (1,context);
- }
- if(context->argumentCount()> 2)
- {
- alignment= (Qt::Alignment)(argument<int> (2,context));
- }
- if(widget)
- {
- self->addWidget(widget,stretch,alignment);
- }
- else
- {
- context->throwError("Incorrect argument type passed to "
- "QBoxLayout::addWidget(). This method requires "
- "a QWidget.");
- }
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QBoxLayout::addWidget(). This method takes one "
- "QWidget and optionally up to two integers as "
- "arguments.");
- }
- return QScriptValue();
- }
-
- /*:68*//*71:*/
- #line 1873 "./typica.w"
-
- QScriptValue constructQAction(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new QAction(NULL));
- setQActionProperties(object,engine);
- return object;
- }
-
- void setQActionProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQObjectProperties(value,engine);
- value.setProperty("setShortcut",engine->newFunction(QAction_setShortcut));
- }
-
- QScriptValue QAction_setShortcut(QScriptContext*context,QScriptEngine*)
- {
- if(context->argumentCount()==1)
- {
- QAction*self= getself<QAction*> (context);
- self->setShortcut(argument<QString> (0,context));
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QAction::setShortcut(). This method takes one "
- "string as an argument.");
- }
- return QScriptValue();
- }
-
- /*:71*//*74:*/
- #line 1931 "./typica.w"
-
- QScriptValue QFileDialog_getOpenFileName(QScriptContext*context,
- QScriptEngine*engine)
- {
- QScriptValue retval;
- if(context->argumentCount()==3)
- {
- QWidget*widget= argument<QWidget*> (0,context);
- if(widget)
- {
- QString caption= argument<QString> (1,context);
- QString dir= argument<QString> (2,context);
- retval= QScriptValue(engine,
- QFileDialog::getOpenFileName(widget,caption,
- dir,"",0,0));
- setQFileDialogProperties(retval,engine);
- }
- else
- {
- context->throwError("Incorrect argument type passed to "
- "QFileDialog::getOpenFileName(). The first "
- "argument to this method must be a QWidget.");
- }
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QFileDialog::getOpenFileName(). This method "
- "takes one QWidget followed by two strings for a "
- "total of three arguments.");
- }
- return retval;
- }
-
- /*:74*//*75:*/
- #line 1967 "./typica.w"
-
- QScriptValue QFileDialog_getSaveFileName(QScriptContext*context,
- QScriptEngine*engine)
- {
- QScriptValue retval;
- if(context->argumentCount()==3)
- {
- QWidget*widget= argument<QWidget*> (0,context);
- if(widget)
- {
- QString caption= argument<QString> (1,context);
- QString dir= argument<QString> (2,context);
- retval= QScriptValue(engine,
- QFileDialog::getSaveFileName(widget,caption,
- dir,"",0,0));
-
- setQFileDialogProperties(retval,engine);
- }
- else
- {
- context->throwError("Incorrect argument type passed to "
- "QFileDialog::getSaveFileName(). The first "
- "argument to this method must be a QWidget.");
- }
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QFileDialog::getSaveFileName(). This method "
- "takes one QWidget followed by two strings for a "
- "total of three arguments.");
- }
- return retval;
- }
-
- /*:75*//*76:*/
- #line 2004 "./typica.w"
-
- void setQFileDialogProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQDialogProperties(value,engine);
- }
-
- void setQDialogProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQWidgetProperties(value,engine);
- }
-
- /*:76*//*79:*/
- #line 2045 "./typica.w"
-
- QScriptValue constructQFile(QScriptContext*context,QScriptEngine*engine)
- {
- QScriptValue object=
- engine->newQObject(new QFile(argument<QString> (0,context)));
- setQFileProperties(object,engine);
- return object;
- }
-
- /*:79*//*80:*/
- #line 2056 "./typica.w"
-
- void setQFileProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQIODeviceProperties(value,engine);
- value.setProperty("remove",engine->newFunction(QFile_remove));
- }
-
- QScriptValue QFile_remove(QScriptContext*context,QScriptEngine*engine)
- {
- QFile*self= getself<QFile*> (context);
- bool retval= self->remove();
- return QScriptValue(engine,retval);
- }
-
- /*:80*//*81:*/
- #line 2078 "./typica.w"
-
- void setQIODeviceProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQObjectProperties(value,engine);
- value.setProperty("open",engine->newFunction(QIODevice_open));
- value.setProperty("close",engine->newFunction(QIODevice_close));
- value.setProperty("readToString",
- engine->newFunction(QIODevice_readToString));
- value.setProperty("putChar",engine->newFunction(QIODevice_putChar));
- value.setProperty("writeString",engine->newFunction(QIODevice_writeString));
- value.setProperty("writeBytes",engine->newFunction(QIODevice_writeBytes));
- value.setProperty("readBytes",engine->newFunction(QIODevice_readBytes));
- value.setProperty("peek",engine->newFunction(QIODevice_peek));
- value.setProperty("read",engine->newFunction(QIODevice_read));
- }
-
- /*:81*//*82:*/
- #line 2099 "./typica.w"
-
- QScriptValue QIODevice_open(QScriptContext*context,QScriptEngine*)
- {
- QIODevice*self= getself<QIODevice*> (context);
- bool retval= false;
- if(context->argumentCount()==1)
- {
- switch(argument<int> (0,context))
- {
- case 1:
- retval= self->open(QIODevice::ReadOnly);
- break;
- case 2:
- retval= self->open(QIODevice::WriteOnly);
- break;
- case 3:
- retval= self->open(QIODevice::ReadWrite);
- break;
- default:
- break;
- }
- }
- else
- {
- retval= self->open(QIODevice::ReadWrite);
- }
- return QScriptValue(retval);
- }
-
- QScriptValue QIODevice_close(QScriptContext*context,QScriptEngine*)
- {
- QIODevice*self= getself<QIODevice*> (context);
- self->close();
- return QScriptValue();
- }
-
- /*:82*//*83:*/
- #line 2139 "./typica.w"
-
- QScriptValue QIODevice_readToString(QScriptContext*context,QScriptEngine*)
- {
- QIODevice*self= getself<QIODevice*> (context);
- self->reset();
- return QScriptValue(QString(self->readAll()));
- }
-
- /*:83*//*84:*/
- #line 2155 "./typica.w"
-
- QScriptValue QIODevice_putChar(QScriptContext*context,QScriptEngine*)
- {
- QIODevice*self= getself<QIODevice*> (context);
- if(context->argumentCount()==1)
- {
- return QScriptValue(self->putChar(argument<QString> (0,context).toUtf8().at(0)));
- }
- context->throwError("Incorrect number of arguments passed to "
- "QIODevice::putChar()");
- return QScriptValue();
- }
-
- /*:84*//*85:*/
- #line 2173 "./typica.w"
-
- QScriptValue QIODevice_writeString(QScriptContext*context,QScriptEngine*)
- {
- QIODevice*self= getself<QIODevice*> (context);
- if(context->argumentCount()==1)
- {
- self->write(argument<QString> (0,context).toUtf8());
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QIODevice::writeString()");
- }
- return QScriptValue();
- }
-
- QScriptValue QIODevice_writeBytes(QScriptContext*context,QScriptEngine*)
- {
- QIODevice*self= getself<QIODevice*> (context);
- if(context->argumentCount()==1)
- {
- self->write(argument<QByteArray> (0,context));
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QIODevice::writeBytes()");
- }
- return QScriptValue();
- }
-
- /*:85*//*86:*/
- #line 2207 "./typica.w"
-
- QScriptValue QIODevice_readBytes(QScriptContext*context,QScriptEngine*engine)
- {
- QIODevice*self= getself<QIODevice*> (context);
- QScriptValue value= engine->toScriptValue<QByteArray> (self->readAll());
- setQByteArrayProperties(value,engine);
- return value;
- }
-
- /*:86*//*87:*/
- #line 2218 "./typica.w"
-
- QScriptValue QIODevice_peek(QScriptContext*context,QScriptEngine*engine)
- {
- QIODevice*self= getself<QIODevice*> (context);
- QScriptValue value= engine->toScriptValue<QByteArray> (
- self->peek(argument<int> (0,context)));
- setQByteArrayProperties(value,engine);
- return value;
- }
-
- QScriptValue QIODevice_read(QScriptContext*context,QScriptEngine*engine)
- {
- QIODevice*self= getself<QIODevice*> (context);
- QScriptValue value= engine->toScriptValue<QByteArray> (
- self->read(argument<int> (0,context)));
- setQByteArrayProperties(value,engine);
- return value;
- }
-
- /*:87*//*90:*/
- #line 2263 "./typica.w"
-
- QScriptValue constructQProcess(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new QProcess);
- setQProcessProperties(object,engine);
- return object;
- }
-
- /*:90*//*91:*/
- #line 2274 "./typica.w"
-
- void setQProcessProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQIODeviceProperties(value,engine);
- value.setProperty("execute",engine->newFunction(QProcess_execute));
- value.setProperty("startDetached",engine->newFunction(QProcess_startDetached));
- value.setProperty("setWorkingDirectory",engine->newFunction(QProcess_setWorkingDirectory));
- value.setProperty("start",engine->newFunction(QProcess_start));
- }
-
- /*:91*//*92:*/
- #line 2288 "./typica.w"
-
- QScriptValue QProcess_execute(QScriptContext*context,QScriptEngine*)
- {
- QProcess*self= getself<QProcess*> (context);
- QString program= argument<QString> (0,context);
- QStringList arguments= QStringList();
- if(context->argumentCount()> 1){
- arguments= argument<QVariant> (1,context).toStringList();
- }
- int retval= self->execute(program,arguments);
- return QScriptValue(retval);
- }
-
- /*:92*//*93:*/
- #line 2303 "./typica.w"
-
- QScriptValue QProcess_startDetached(QScriptContext*context,QScriptEngine*)
- {
- QProcess*self= getself<QProcess*> (context);
- QString program= argument<QString> (0,context);
- QStringList arguments= QStringList();
- if(context->argumentCount()> 1){
- arguments= argument<QVariant> (1,context).toStringList();
- }
- QString workingDirectory= "";
- if(context->argumentCount()> 2){
- workingDirectory= argument<QString> (2,context);
- }
- bool retval;
- switch(context->argumentCount())
- {
- case 1:
- retval= self->startDetached(program);
- break;
- case 2:
- retval= self->startDetached(program,arguments);
- break;
- case 3:
- retval= self->startDetached(program,arguments,workingDirectory);
- break;
- default:
- retval= false;
- }
- return QScriptValue(retval);
- }
-
- /*:93*//*94:*/
- #line 2336 "./typica.w"
-
- QScriptValue QProcess_setWorkingDirectory(QScriptContext*context,QScriptEngine*)
- {
- QProcess*self= getself<QProcess*> (context);
- QString directory= argument<QString> (0,context);
- self->setWorkingDirectory(directory);
- return QScriptValue();
- }
-
- /*:94*//*95:*/
- #line 2348 "./typica.w"
-
- QScriptValue QProcess_start(QScriptContext*context,QScriptEngine*)
- {
- QProcess*self= getself<QProcess*> (context);
- QString program= argument<QString> (0,context);
- QStringList arguments= QStringList();
- if(context->argumentCount()> 1){
- arguments= argument<QVariant> (1,context).toStringList();
- }
- self->start(program,arguments);
- return QScriptValue();
- }
-
- /*:95*//*97:*/
- #line 2389 "./typica.w"
-
- QScriptValue QByteArray_toScriptValue(QScriptEngine*engine,const QByteArray&bytes)
- {
- QScriptValue object= engine->newVariant(QVariant(bytes));
- setQByteArrayProperties(object,engine);
- return object;
- }
-
- void QByteArray_fromScriptValue(const QScriptValue&value,QByteArray&bytes)
- {
- bytes= value.toVariant().toByteArray();
- }
-
- /*:97*//*99:*/
- #line 2412 "./typica.w"
-
- QScriptValue constructQByteArray(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object= engine->toScriptValue<QByteArray> (QByteArray());
- setQByteArrayProperties(object,engine);
- return object;
- }
-
- /*:99*//*100:*/
- #line 2423 "./typica.w"
-
- void setQByteArrayProperties(QScriptValue value,QScriptEngine*engine)
- {
- value.setProperty("fromHex",engine->newFunction(QByteArray_fromHex));
- value.setProperty("getAt",engine->newFunction(QByteArray_getAt));
- value.setProperty("setAt",engine->newFunction(QByteArray_setAt));
- value.setProperty("appendBytes",engine->newFunction(QByteArray_appendBytes));
- value.setProperty("appendString",engine->newFunction(QByteArray_appendString));
- value.setProperty("size",engine->newFunction(QByteArray_size));
- value.setProperty("left",engine->newFunction(QByteArray_left));
- value.setProperty("right",engine->newFunction(QByteArray_right));
- value.setProperty("mid",engine->newFunction(QByteArray_mid));
- value.setProperty("chop",engine->newFunction(QByteArray_chop));
- value.setProperty("remove",engine->newFunction(QByteArray_remove));
- value.setProperty("toInt8",engine->newFunction(QByteArray_toInt8));
- value.setProperty("toInt16",engine->newFunction(QByteArray_toInt16));
- value.setProperty("toInt32",engine->newFunction(QByteArray_toInt32));
- value.setProperty("toFloat",engine->newFunction(QByteArray_toFloat));
- value.setProperty("toDouble",engine->newFunction(QByteArray_toDouble));
- }
-
- /*:100*//*101:*/
- #line 2447 "./typica.w"
-
- QScriptValue QByteArray_fromHex(QScriptContext*context,QScriptEngine*engine)
- {
- QByteArray self= getself<QByteArray> (context);
- QByteArray retval;
- retval= self.fromHex(argument<QString> (0,context).toUtf8());
- QScriptValue value= engine->toScriptValue<QByteArray> (retval);
- setQByteArrayProperties(value,engine);
- return value;
- }
-
- /*:101*//*102:*/
- #line 2461 "./typica.w"
-
- QScriptValue QByteArray_getAt(QScriptContext*context,QScriptEngine*)
- {
- QByteArray self= getself<QByteArray> (context);
- return QScriptValue((int)(self.at(argument<int> (0,context))));
- }
-
- QScriptValue QByteArray_setAt(QScriptContext*context,QScriptEngine*)
- {
- QByteArray self= getself<QByteArray> (context);
- self[argument<int> (0,context)]= (char)(argument<int> (1,context));
- return QScriptValue();
- }
-
- /*:102*//*103:*/
- #line 2479 "./typica.w"
-
- QScriptValue QByteArray_appendBytes(QScriptContext*context,QScriptEngine*engine)
- {
- QByteArray self= getself<QByteArray> (context);
- QScriptValue value=
- engine->toScriptValue<QByteArray> (
- self.append(argument<QByteArray> (0,context)));
- setQByteArrayProperties(value,engine);
- return value;
- }
-
- QScriptValue QByteArray_appendString(QScriptContext*context,QScriptEngine*engine)
- {
- QByteArray self= getself<QByteArray> (context);
- QScriptValue value= engine->toScriptValue<QByteArray> (
- self.append(argument<QString> (0,context)));
- setQByteArrayProperties(value,engine);
- return value;
- }
-
- /*:103*//*104:*/
- #line 2501 "./typica.w"
-
- QScriptValue QByteArray_size(QScriptContext*context,QScriptEngine*)
- {
- QByteArray self= getself<QByteArray> (context);
- return QScriptValue(self.size());
- }
-
- /*:104*//*105:*/
- #line 2511 "./typica.w"
-
- QScriptValue QByteArray_left(QScriptContext*context,QScriptEngine*engine)
- {
- QByteArray self= getself<QByteArray> (context);
- QScriptValue value= engine->toScriptValue<QByteArray> (
- self.left(argument<int> (0,context)));
- setQByteArrayProperties(value,engine);
- return value;
- }
-
- QScriptValue QByteArray_right(QScriptContext*context,QScriptEngine*engine)
- {
- QByteArray self= getself<QByteArray> (context);
- QScriptValue value= engine->toScriptValue<QByteArray> (
- self.right(argument<int> (0,context)));
- setQByteArrayProperties(value,engine);
- return value;
- }
-
- QScriptValue QByteArray_mid(QScriptContext*context,QScriptEngine*engine)
- {
- QByteArray self= getself<QByteArray> (context);
- int length= -1;
- if(context->argumentCount()> 1)
- {
- length= argument<int> (1,context);
- }
- QScriptValue value= engine->toScriptValue<QByteArray> (
- self.mid(argument<int> (0,context),length));
- setQByteArrayProperties(value,engine);
- return value;
- }
-
- /*:105*//*106:*/
- #line 2546 "./typica.w"
-
- QScriptValue QByteArray_chop(QScriptContext*context,QScriptEngine*)
- {
- QByteArray self= getself<QByteArray> (context);
- self.chop(argument<int> (0,context));
- return QScriptValue();
- }
-
- QScriptValue QByteArray_remove(QScriptContext*context,QScriptEngine*engine)
- {
- QByteArray self= getself<QByteArray> (context);
- QScriptValue value= engine->toScriptValue<QByteArray> (
- self.remove(argument<int> (0,context),argument<int> (1,context)));
- setQByteArrayProperties(value,engine);
- return value;
- }
-
- /*:106*//*107:*/
- #line 2569 "./typica.w"
-
- QScriptValue QByteArray_toInt8(QScriptContext*context,QScriptEngine*)
- {
- QByteArray self= getself<QByteArray> (context);
- int value= 0;
- char*bytes= (char*)&value;
- bytes[0]= self[0];
- return QScriptValue(value);
- }
-
- QScriptValue QByteArray_toInt16(QScriptContext*context,QScriptEngine*)
- {
- QByteArray self= getself<QByteArray> (context);
- int value= 0;
- char*bytes= (char*)&value;
- bytes[0]= self[0];
- bytes[1]= self[1];
- return QScriptValue(value);
- }
-
- QScriptValue QByteArray_toInt32(QScriptContext*context,QScriptEngine*)
- {
- QByteArray self= getself<QByteArray> (context);
- int value= 0;
- char*bytes= (char*)&value;
- bytes[0]= self[0];
- bytes[1]= self[1];
- bytes[2]= self[2];
- bytes[3]= self[3];
- return QScriptValue(value);
- }
-
- /*:107*//*108:*/
- #line 2605 "./typica.w"
-
- QScriptValue QByteArray_toFloat(QScriptContext*context,QScriptEngine*)
- {
- QByteArray self= getself<QByteArray> (context);
- float value= 0.0;
- char*bytes= (char*)&value;
- bytes[0]= self[0];
- bytes[1]= self[1];
- bytes[2]= self[2];
- bytes[3]= self[3];
- return QScriptValue(value);
- }
-
- QScriptValue QByteArray_toDouble(QScriptContext*context,QScriptEngine*)
- {
- QByteArray self= getself<QByteArray> (context);
- double value= 0.0;
- char*bytes= (char*)&value;
- bytes[0]= self[0];
- bytes[1]= self[1];
- bytes[2]= self[2];
- bytes[3]= self[3];
- bytes[4]= self[4];
- bytes[5]= self[5];
- bytes[6]= self[6];
- bytes[7]= self[7];
- return QScriptValue(value);
- }
-
- /*:108*//*111:*/
- #line 2660 "./typica.w"
-
- QScriptValue bytesFromInt8(QScriptContext*context,QScriptEngine*engine)
- {
- qint8 value= (qint8)(argument<int> (0,context));
- char*bytes= (char*)&value;
- QByteArray retval;
- retval.resize(1);
- retval[0]= bytes[0];
- QScriptValue v= engine->toScriptValue<QByteArray> (retval);
- setQByteArrayProperties(v,engine);
- return v;
- }
-
- QScriptValue bytesFromInt16(QScriptContext*context,QScriptEngine*engine)
- {
- qint16 value= (qint16)(argument<int> (0,context));
- char*bytes= (char*)&value;
- QByteArray retval;
- retval.resize(2);
- retval[0]= bytes[0];
- retval[1]= bytes[1];
- QScriptValue v= engine->toScriptValue<QByteArray> (retval);
- setQByteArrayProperties(v,engine);
- return v;
- }
-
- QScriptValue bytesFromInt32(QScriptContext*context,QScriptEngine*engine)
- {
- qint32 value= (qint32)(argument<int> (0,context));
- char*bytes= (char*)&value;
- QByteArray retval;
- retval.resize(4);
- retval[0]= bytes[0];
- retval[1]= bytes[1];
- retval[2]= bytes[2];
- retval[3]= bytes[3];
- QScriptValue v= engine->toScriptValue<QByteArray> (retval);
- setQByteArrayProperties(v,engine);
- return v;
- }
-
- QScriptValue bytesFromFloat(QScriptContext*context,QScriptEngine*engine)
- {
- float value= (float)(argument<double> (0,context));
- char*bytes= (char*)&value;
- QByteArray retval;
- retval.resize(4);
- retval[0]= bytes[0];
- retval[1]= bytes[1];
- retval[2]= bytes[2];
- retval[3]= bytes[3];
- QScriptValue v= engine->toScriptValue<QByteArray> (retval);
- setQByteArrayProperties(v,engine);
- return v;
- }
-
- QScriptValue bytesFromDouble(QScriptContext*context,QScriptEngine*engine)
- {
- double value= (double)(argument<double> (0,context));
- char*bytes= (char*)&value;
- QByteArray retval;
- retval.resize(8);
- retval[0]= bytes[0];
- retval[1]= bytes[1];
- retval[2]= bytes[2];
- retval[3]= bytes[3];
- retval[4]= bytes[4];
- retval[5]= bytes[5];
- retval[6]= bytes[6];
- retval[7]= bytes[7];
- QScriptValue v= engine->toScriptValue<QByteArray> (retval);
- setQByteArrayProperties(v,engine);
- return v;
- }
-
- /*:111*//*114:*/
- #line 2757 "./typica.w"
-
- QScriptValue constructQBuffer(QScriptContext*context,QScriptEngine*engine)
- {
- QByteArray*array= new QByteArray(argument<QString> (0,context).toAscii());
- QScriptValue object= engine->newQObject(new QBuffer(array));
- setQBufferProperties(object,engine);
- return object;
- }
-
- void setQBufferProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQIODeviceProperties(value,engine);
- value.setProperty("setData",engine->newFunction(QBuffer_setData));
- }
-
- QScriptValue QBuffer_setData(QScriptContext*context,QScriptEngine*)
- {
- QBuffer*self= getself<QBuffer*> (context);
- self->setData(argument<QString> (0,context).toAscii());
- return QScriptValue();
- }
-
- /*:114*//*117:*/
- #line 2806 "./typica.w"
-
- QScriptValue constructXQuery(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object= engine->toScriptValue<void*> (new QXmlQuery);
- setXQueryProperties(object,engine);
- return object;
- }
-
- QScriptValue XQuery_invalidate(QScriptContext*context,QScriptEngine*)
- {
- QXmlQuery*self= getself<QXmlQuery*> (context);
- delete self;
- return QScriptValue();
- }
-
- void setXQueryProperties(QScriptValue value,QScriptEngine*engine)
- {
- value.setProperty("bind",engine->newFunction(XQuery_bind));
- value.setProperty("exec",engine->newFunction(XQuery_exec));
- value.setProperty("setQuery",engine->newFunction(XQuery_setQuery));
- value.setProperty("invalidate",engine->newFunction(XQuery_invalidate));
- }
-
- /*:117*//*118:*/
- #line 2832 "./typica.w"
-
- QScriptValue XQuery_bind(QScriptContext*context,QScriptEngine*)
- {
- QXmlQuery*self= getself<QXmlQuery*> (context);
- QIODevice*buffer= argument<QIODevice*> (1,context);
- self->bindVariable(argument<QString> (0,context),buffer);
- return QScriptValue();
- }
-
- /*:118*//*119:*/
- #line 2843 "./typica.w"
-
- QScriptValue XQuery_setQuery(QScriptContext*context,QScriptEngine*)
- {
- QXmlQuery*self= getself<QXmlQuery*> (context);
- self->setQuery(argument<QString> (0,context));
- return QScriptValue();
- }
-
- /*:119*//*120:*/
- #line 2853 "./typica.w"
-
- QScriptValue XQuery_exec(QScriptContext*context,QScriptEngine*)
- {
- QXmlQuery*self= getself<QXmlQuery*> (context);
- QString result;
- self->evaluateTo(&result);
- return QScriptValue(result);
- }
-
- /*:120*//*123:*/
- #line 2908 "./typica.w"
-
- QScriptValue constructXmlWriter(QScriptContext*context,QScriptEngine*engine)
- {
- QXmlStreamWriter*retval;
- if(context->argumentCount()==1)
- {
- retval= new QXmlStreamWriter(argument<QIODevice*> (0,context));
- }
- else
- {
- retval= new QXmlStreamWriter;
- }
- QScriptValue object= engine->toScriptValue<void*> (retval);
- setXmlWriterProperties(object,engine);
- return object;
- }
-
- void setXmlWriterProperties(QScriptValue value,QScriptEngine*engine)
- {
- value.setProperty("setDevice",engine->newFunction(XmlWriter_setDevice));
- value.setProperty("writeAttribute",
- engine->newFunction(XmlWriter_writeAttribute));
- value.setProperty("writeCDATA",engine->newFunction(XmlWriter_writeCDATA));
- value.setProperty("writeCharacters",
- engine->newFunction(XmlWriter_writeCharacters));
- value.setProperty("writeDTD",engine->newFunction(XmlWriter_writeDTD));
- value.setProperty("writeEmptyElement",
- engine->newFunction(XmlWriter_writeEmptyElement));
- value.setProperty("writeEndDocument",
- engine->newFunction(XmlWriter_writeEndDocument));
- value.setProperty("writeEndElement",
- engine->newFunction(XmlWriter_writeEndElement));
- value.setProperty("writeEntityReference",
- engine->newFunction(XmlWriter_writeEntityReference));
- value.setProperty("writeProcessingInstruction",
- engine->newFunction(XmlWriter_writeProcessingInstruction));
- value.setProperty("writeStartDocument",
- engine->newFunction(XmlWriter_writeStartDocument));
- value.setProperty("writeStartElement",
- engine->newFunction(XmlWriter_writeStartElement));
- value.setProperty("writeTextElement",
- engine->newFunction(XmlWriter_writeTextElement));
- }
-
- /*:123*//*124:*/
- #line 2955 "./typica.w"
-
- QScriptValue XmlWriter_setDevice(QScriptContext*context,QScriptEngine*)
- {
- QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
- QIODevice*device= argument<QIODevice*> (0,context);
- self->setDevice(device);
- return QScriptValue();
- }
-
- /*:124*//*125:*/
- #line 2969 "./typica.w"
-
- QScriptValue XmlWriter_writeStartDocument(QScriptContext*context,
- QScriptEngine*)
- {
- QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
- self->writeStartDocument(argument<QString> (0,context));
- return QScriptValue();
- }
-
- QScriptValue XmlWriter_writeEndDocument(QScriptContext*context,
- QScriptEngine*)
- {
- QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
- self->writeEndDocument();
- return QScriptValue();
- }
-
- /*:125*//*126:*/
- #line 2988 "./typica.w"
-
- QScriptValue XmlWriter_writeDTD(QScriptContext*context,QScriptEngine*)
- {
- QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
- self->writeDTD(argument<QString> (0,context));
- return QScriptValue();
- }
-
- /*:126*//*127:*/
- #line 2999 "./typica.w"
-
- QScriptValue XmlWriter_writeStartElement(QScriptContext*context,
- QScriptEngine*)
- {
- QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
- self->writeStartElement(argument<QString> (0,context));
- return QScriptValue();
- }
-
- QScriptValue XmlWriter_writeAttribute(QScriptContext*context,QScriptEngine*)
- {
- QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
- self->writeAttribute(argument<QString> (0,context),
- argument<QString> (1,context));
- return QScriptValue();
- }
-
- QScriptValue XmlWriter_writeCharacters(QScriptContext*context,QScriptEngine*)
- {
- QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
- self->writeCharacters(argument<QString> (0,context));
- return QScriptValue();
- }
-
- QScriptValue XmlWriter_writeEndElement(QScriptContext*context,QScriptEngine*)
- {
- QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
- self->writeEndElement();
- return QScriptValue();
- }
-
- /*:127*//*128:*/
- #line 3035 "./typica.w"
-
- QScriptValue XmlWriter_writeEmptyElement(QScriptContext*context,
- QScriptEngine*)
- {
- QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
- self->writeEmptyElement(argument<QString> (0,context));
- return QScriptValue();
- }
-
- QScriptValue XmlWriter_writeTextElement(QScriptContext*context,
- QScriptEngine*)
- {
- QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
- self->writeTextElement(argument<QString> (0,context),
- argument<QString> (1,context));
- return QScriptValue();
- }
-
- /*:128*//*129:*/
- #line 3056 "./typica.w"
-
- QScriptValue XmlWriter_writeCDATA(QScriptContext*context,QScriptEngine*)
- {
- QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
- self->writeCDATA(argument<QString> (0,context));
- return QScriptValue();
- }
-
- QScriptValue XmlWriter_writeEntityReference(QScriptContext*context,
- QScriptEngine*)
- {
- QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
- self->writeEntityReference(argument<QString> (0,context));
- return QScriptValue();
- }
-
- QScriptValue XmlWriter_writeProcessingInstruction(QScriptContext*context,
- QScriptEngine*)
- {
- QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
- self->writeProcessingInstruction(argument<QString> (0,context),
- argument<QString> (1,context));
- return QScriptValue();
- }
-
- /*:129*//*132:*/
- #line 3115 "./typica.w"
-
- QScriptValue constructXmlReader(QScriptContext*context,QScriptEngine*engine)
- {
- QXmlStreamReader*retval=
- new QXmlStreamReader(argument<QIODevice*> (0,context));
- QScriptValue object= engine->toScriptValue<void*> (retval);
- setXmlReaderProperties(object,engine);
- return object;
- }
-
- void setXmlReaderProperties(QScriptValue value,QScriptEngine*engine)
- {
- value.setProperty("atEnd",engine->newFunction(XmlReader_atEnd));
- value.setProperty("attribute",engine->newFunction(XmlReader_attribute));
- value.setProperty("hasAttribute",
- engine->newFunction(XmlReader_hasAttribute));
- value.setProperty("isDTD",engine->newFunction(XmlReader_isDTD));
- value.setProperty("isStartElement",
- engine->newFunction(XmlReader_isStartElement));
- value.setProperty("name",engine->newFunction(XmlReader_name));
- value.setProperty("readElementText",
- engine->newFunction(XmlReader_readElementText));
- value.setProperty("readNext",
- engine->newFunction(XmlReader_readNext));
- value.setProperty("text",engine->newFunction(XmlReader_text));
- }
-
- /*:132*//*133:*/
- #line 3145 "./typica.w"
-
- QScriptValue XmlReader_attribute(QScriptContext*context,QScriptEngine*)
- {
- QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
- QString retval=
- self->attributes().value(argument<QString> (0,context)).toString();
- return QScriptValue(retval);
- }
-
- QScriptValue XmlReader_hasAttribute(QScriptContext*context,QScriptEngine*)
- {
- QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
- bool retval=
- self->attributes().hasAttribute(argument<QString> (0,context));
- return QScriptValue(retval);
- }
-
- /*:133*//*134:*/
- #line 3165 "./typica.w"
-
- QScriptValue XmlReader_atEnd(QScriptContext*context,QScriptEngine*)
- {
- QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
- return QScriptValue(self->atEnd());
- }
-
- QScriptValue XmlReader_isDTD(QScriptContext*context,QScriptEngine*)
- {
- QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
- return QScriptValue(self->isDTD());
- }
-
- QScriptValue XmlReader_isStartElement(QScriptContext*context,QScriptEngine*)
- {
- QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
- return QScriptValue(self->isStartElement());
- }
-
- /*:134*//*135:*/
- #line 3186 "./typica.w"
-
- QScriptValue XmlReader_readNext(QScriptContext*context,QScriptEngine*)
- {
- QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
- self->readNext();
- return QScriptValue();
- }
-
- /*:135*//*136:*/
- #line 3196 "./typica.w"
-
- QScriptValue XmlReader_name(QScriptContext*context,QScriptEngine*)
- {
- QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
- return QScriptValue(self->name().toString());
- }
-
- QScriptValue XmlReader_readElementText(QScriptContext*context,QScriptEngine*)
- {
- QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
- return QScriptValue(self->readElementText());
- }
-
- QScriptValue XmlReader_text(QScriptContext*context,QScriptEngine*)
- {
- QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
- return QScriptValue(self->text().toString());
- }
-
- /*:136*//*139:*/
- #line 3238 "./typica.w"
-
- void setQSettingsProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQObjectProperties(value,engine);
- value.setProperty("value",engine->newFunction(QSettings_value));
- value.setProperty("setValue",engine->newFunction(QSettings_setValue));
- }
-
- /*:139*//*140:*/
- #line 3250 "./typica.w"
-
- QScriptValue QSettings_value(QScriptContext*context,QScriptEngine*engine)
- {
- QScriptValue object;
- if(context->argumentCount()==1||context->argumentCount()==2)
- {
- QSettings settings;
- QString key= argument<QString> (0,context);
- QVariant value;
- QVariant retval;
- if(context->argumentCount()> 1)
- {
- value= argument<QVariant> (1,context);
- retval= settings.value(key,value);
- }
- else
- {
- retval= settings.value(key);
- }
- object= engine->newVariant(retval);
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QSettings::value(). This method takes one "
- "string and one optional variant type.");
- }
- return object;
- }
-
- QScriptValue QSettings_setValue(QScriptContext*context,QScriptEngine*)
- {
- if(context->argumentCount()==2)
- {
- QSettings settings;
- QString key= argument<QString> (0,context);
- QVariant value= argument<QVariant> (1,context);
- settings.setValue(key,value);
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QSettings::setValue(). This method takes one "
- "string and one variant type for a total of two "
- "arguments.");
- }
- return QScriptValue();
- }
-
- /*:140*//*143:*/
- #line 3319 "./typica.w"
-
- QScriptValue constructQLCDNumber(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new QLCDNumber());
- setQLCDNumberProperties(object,engine);
- return object;
- }
-
- void setQLCDNumberProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQFrameProperties(value,engine);
- }
-
- /*:143*//*146:*/
- #line 3377 "./typica.w"
-
- QScriptValue constructQTime(QScriptContext*context,
- QScriptEngine*engine)
- {
- QScriptValue object;
- if(context->argumentCount()==0||
- (context->argumentCount()>=2&&context->argumentCount()<=4))
- {
- int arg1= 0;
- int arg2= 0;
- int arg3= 0;
- int arg4= 0;
- switch(context->argumentCount())
- {
- case 4:
- arg4= argument<int> (3,context);
- case 3:
- arg3= argument<int> (2,context);
- case 2:
- arg2= argument<int> (1,context);
- arg1= argument<int> (0,context);
- default:
- break;
- }
- if(context->argumentCount())
- {
- object= engine->toScriptValue<QTime> (QTime(arg1,arg2,arg3,
- arg4));
- }
- else
- {
- object= engine->toScriptValue<QTime> (QTime());
- }
- setQTimeProperties(object,engine);
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QTime::QTime(). This method takes zero, two, "
- "three, or four integer arguments.");
- }
- return object;
- }
-
- /*:146*//*147:*/
- #line 3425 "./typica.w"
-
- void setQTimeProperties(QScriptValue value,QScriptEngine*engine)
- {
- value.setProperty("addMSecs",engine->newFunction(QTime_addMSecs));
- value.setProperty("addSecs",engine->newFunction(QTime_addSecs));
- value.setProperty("elapsed",engine->newFunction(QTime_elapsed));
- value.setProperty("hour",engine->newFunction(QTime_hour));
- value.setProperty("isNull",engine->newFunction(QTime_isNull));
- value.setProperty("isValid",engine->newFunction(QTime_isValid));
- value.setProperty("minute",engine->newFunction(QTime_minute));
- value.setProperty("msec",engine->newFunction(QTime_msec));
- value.setProperty("msecsTo",engine->newFunction(QTime_msecsTo));
- value.setProperty("restart",engine->newFunction(QTime_restart));
- value.setProperty("second",engine->newFunction(QTime_second));
- value.setProperty("secsTo",engine->newFunction(QTime_secsTo));
- value.setProperty("setHMS",engine->newFunction(QTime_setHMS));
- value.setProperty("start",engine->newFunction(QTime_start));
- value.setProperty("toString",engine->newFunction(QTime_toString));
- value.setProperty("currentTime",engine->newFunction(QTime_currentTime));
- value.setProperty("fromString",engine->newFunction(QTime_fromString));
- value.setProperty("valueOf",engine->newFunction(QTime_valueOf));
- }
-
- /*:147*//*148:*/
- #line 3454 "./typica.w"
-
- QScriptValue QTime_valueOf(QScriptContext*context,QScriptEngine*)
- {
- QTime self= getself<QTime> (context);
- int retval= (self.hour()*60*60*1000)+(self.minute()*60*1000)+
- (self.second()*1000)+self.msec();
- return QScriptValue(retval);
- }
-
- /*:148*//*149:*/
- #line 3468 "./typica.w"
-
- QScriptValue QTime_addMSecs(QScriptContext*context,QScriptEngine*engine)
- {
- QTime time;
- QScriptValue retval;
- if(context->argumentCount()==1)
- {
- QTime self= getself<QTime> (context);
- time= self.addMSecs(argument<int> (0,context));
- retval= engine->toScriptValue<QTime> (time);
- setQTimeProperties(retval,engine);
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QTime::addMSecs(). This method takes one "
- "integer as an argument.");
- }
- return retval;
- }
-
- QScriptValue QTime_addSecs(QScriptContext*context,QScriptEngine*engine)
- {
- QTime time;
- QScriptValue retval;
- if(context->argumentCount()==1)
- {
- QTime self= getself<QTime> (context);
- time= self.addSecs(argument<int> (0,context));
- retval= engine->toScriptValue<QTime> (time);
- setQTimeProperties(retval,engine);
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QTime::addSecs(). This method takes one "
- "integer as an argument.");
- }
- return retval;
- }
-
- /*:149*//*150:*/
- #line 3511 "./typica.w"
-
- QScriptValue QTime_elapsed(QScriptContext*context,QScriptEngine*engine)
- {
- QScriptValue retval;
- if(context->argumentCount()==0)
- {
- QTime self= getself<QTime> (context);
- retval= QScriptValue(engine,self.elapsed());
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QTime::elapsed(). This method takes no "
- "arguments.");
- }
- return retval;
- }
-
- /*:150*//*151:*/
- #line 3532 "./typica.w"
-
- QScriptValue QTime_hour(QScriptContext*context,QScriptEngine*engine)
- {
- QScriptValue retval;
- if(context->argumentCount()==0)
- {
- QTime self= getself<QTime> (context);
- retval= QScriptValue(engine,self.hour());
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QTime::hour(). This method takes no "
- "arguments.");
- }
- return retval;
- }
-
- /*:151*//*152:*/
- #line 3552 "./typica.w"
-
- QScriptValue QTime_minute(QScriptContext*context,QScriptEngine*engine)
- {
- QScriptValue retval;
- if(context->argumentCount()==0)
- {
- QTime self= getself<QTime> (context);
- retval= QScriptValue(engine,self.minute());
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QTime::minute(). This method takes no "
- "arguments.");
- }
- return retval;
- }
-
- QScriptValue QTime_second(QScriptContext*context,QScriptEngine*engine)
- {
- QScriptValue retval;
- if(context->argumentCount()==0)
- {
- QTime self= getself<QTime> (context);
- retval= QScriptValue(engine,self.second());
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QTime::second(). This method takes no "
- "arguments.");
- }
- return retval;
- }
-
- QScriptValue QTime_msec(QScriptContext*context,QScriptEngine*engine)
- {
- QScriptValue retval;
- if(context->argumentCount()==0)
- {
- QTime self= getself<QTime> (context);
- retval= QScriptValue(engine,self.msec());
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QTime::msec(). This method takes no "
- "arguments.");
- }
- return retval;
- }
-
- /*:152*//*153:*/
- #line 3608 "./typica.w"
-
- QScriptValue QTime_isNull(QScriptContext*context,QScriptEngine*engine)
- {
- QScriptValue retval;
- if(context->argumentCount()==0)
- {
- QTime self= getself<QTime> (context);
- retval= QScriptValue(engine,self.isNull());
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QTime::isNull(). This method takes no "
- "arguments.");
- }
- return retval;
- }
-
- QScriptValue QTime_isValid(QScriptContext*context,QScriptEngine*engine)
- {
- QScriptValue retval;
- if(context->argumentCount()==0)
- {
- QTime self= getself<QTime> (context);
- retval= QScriptValue(engine,self.isValid());
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QTime::isValid(). This method takes no "
- "arguments.");
- }
- return retval;
- }
-
- /*:153*//*154:*/
- #line 3646 "./typica.w"
-
- QScriptValue QTime_msecsTo(QScriptContext*context,QScriptEngine*engine)
- {
- QScriptValue retval;
- if(context->argumentCount()==1)
- {
- QTime self= getself<QTime> (context);
- QTime arg= argument<QVariant> (0,context).toTime();
- retval= QScriptValue(engine,self.msecsTo(arg));
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QTime::msecsTo(). This method takes one QTime.");
- }
- return retval;
- }
-
- QScriptValue QTime_secsTo(QScriptContext*context,QScriptEngine*engine)
- {
- QScriptValue retval;
- if(context->argumentCount()==1)
- {
- QTime self= getself<QTime> (context);
- QTime arg= argument<QVariant> (0,context).toTime();
- retval= QScriptValue(engine,self.secsTo(arg));
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QTime::secsTo(). This method takes one QTime.");
- }
- return retval;
- }
-
- /*:154*//*155:*/
- #line 3685 "./typica.w"
-
- QScriptValue QTime_restart(QScriptContext*context,QScriptEngine*engine)
- {
- QScriptValue retval;
- if(context->argumentCount()==0)
- {
- QTime self= getself<QTime> (context);
- retval= QScriptValue(engine,self.restart());
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QTime::restart(). This method takes no "
- "arguments.");
- }
- return retval;
- }
-
- QScriptValue QTime_start(QScriptContext*context,QScriptEngine*)
- {
- if(context->argumentCount()==0)
- {
- QTime self= getself<QTime> (context);
- self.start();
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QTime::start(). This method takes no arguments.");
- }
- return QScriptValue();
- }
-
- /*:155*//*156:*/
- #line 3721 "./typica.w"
-
- QScriptValue QTime_setHMS(QScriptContext*context,QScriptEngine*engine)
- {
- QScriptValue retval;
- if(context->argumentCount()==3||context->argumentCount()==4)
- {
- QTime self= getself<QTime> (context);
- int arg1= 0;
- int arg2= 0;
- int arg3= 0;
- int arg4= 0;
- switch(context->argumentCount())
- {
- case 4:
- arg4= argument<int> (3,context);
- case 3:
- arg3= argument<int> (2,context);
- arg2= argument<int> (1,context);
- arg1= argument<int> (0,context);
- default:
- break;
- }
- retval= QScriptValue(engine,self.setHMS(arg1,arg2,arg3,arg4));
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QTime::setHMS(). This method takes three or "
- "four integer arguments.");
- }
- return retval;
- }
-
- /*:156*//*157:*/
- #line 3757 "./typica.w"
-
- QScriptValue QTime_toString(QScriptContext*context,QScriptEngine*engine)
- {
- QScriptValue retval;
- if(context->argumentCount()==1)
- {
- QTime self= getself<QTime> (context);
- retval= QScriptValue(engine,self.toString(argument<QString> (0,context)));
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QTime::toString(). This method takes one QString "
- "as an argument.");
- }
- return retval;
- }
-
- /*:157*//*158:*/
- #line 3778 "./typica.w"
-
- QScriptValue QTime_currentTime(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object;
- object= engine->toScriptValue<QTime> (QTime::currentTime());
- setQTimeProperties(object,engine);
- return object;
- }
-
- QScriptValue QTime_fromString(QScriptContext*context,QScriptEngine*engine)
- {
- QScriptValue object;
- if(context->argumentCount()==2)
- {
- QString time= argument<QString> (0,context);
- QString format= argument<QString> (1,context);
- object= engine->toScriptValue<QTime> (QTime::fromString(time,format));
- setQTimeProperties(object,engine);
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QTime::fromString(). This method takes two "
- "string arguments.");
- }
- return object;
- }
-
- /*:158*//*159:*/
- #line 3809 "./typica.w"
-
- template<> QTime argument(int arg,QScriptContext*context)
- {
- return qscriptvalue_cast<QTime> (context->argument(arg));
- }
-
- /*:159*//*161:*/
- #line 3827 "./typica.w"
-
- void setQAbstractScrollAreaProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQFrameProperties(value,engine);
- }
-
- /*:161*//*163:*/
- #line 3841 "./typica.w"
-
- void setQAbstractItemViewProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQAbstractScrollAreaProperties(value,engine);
- }
-
- /*:163*//*165:*/
- #line 3855 "./typica.w"
-
- void setQGraphicsViewProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQAbstractScrollAreaProperties(value,engine);
- }
-
- void setQTableViewProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQAbstractItemViewProperties(value,engine);
- }
-
- /*:165*//*168:*/
- #line 3888 "./typica.w"
-
- QScriptValue constructQPushButton(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new QPushButton());
- setQPushButtonProperties(object,engine);
- return object;
- }
-
- void setQPushButtonProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQAbstractButtonProperties(value,engine);
- }
-
- void setQAbstractButtonProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQWidgetProperties(value,engine);
- }
-
- /*:168*//*175:*/
- #line 4000 "./typica.w"
-
- QScriptValue constructQSqlQuery(QScriptContext*,QScriptEngine*engine)
- {
- SqlQueryConnection*obj= new SqlQueryConnection();
- QScriptValue object=
- engine->toScriptValue<void*> (obj);
- setQSqlQueryProperties(object,engine);
- return object;
- }
-
- /*:175*//*176:*/
- #line 4013 "./typica.w"
-
- void setQSqlQueryProperties(QScriptValue value,QScriptEngine*engine)
- {
- value.setProperty("bind",engine->newFunction(QSqlQuery_bind));
- value.setProperty("bindFileData",
- engine->newFunction(QSqlQuery_bindFileData));
- value.setProperty("bindDeviceData",
- engine->newFunction(QSqlQuery_bindDeviceData));
- value.setProperty("exec",engine->newFunction(QSqlQuery_exec));
- value.setProperty("executedQuery",engine->newFunction(QSqlQuery_executedQuery));
- value.setProperty("invalidate",engine->newFunction(QSqlQuery_invalidate));
- value.setProperty("next",engine->newFunction(QSqlQuery_next));
- value.setProperty("prepare",engine->newFunction(QSqlQuery_prepare));
- value.setProperty("value",engine->newFunction(QSqlQuery_value));
- }
-
- /*:176*//*177:*/
- #line 4031 "./typica.w"
-
- QScriptValue QSqlQuery_exec(QScriptContext*context,QScriptEngine*engine)
- {
- QSqlQuery*q= getself<SqlQueryConnection*> (context)->operator->();
- QScriptValue retval;
- if(context->argumentCount()==1)
- {
- retval= QScriptValue(engine,
- q->exec(argument<QString> (0,context)));
- }
- else
- {
- retval= QScriptValue(engine,q->exec());
- }
- if(q->lastError().isValid())
- {
- qDebug()<<q->lastQuery();
- qDebug()<<q->lastError().text();
- }
- return retval;
- }
-
- QScriptValue QSqlQuery_executedQuery(QScriptContext*context,QScriptEngine*)
- {
- QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
- return QScriptValue(query->lastQuery());
- }
-
- QScriptValue QSqlQuery_next(QScriptContext*context,QScriptEngine*engine)
- {
- QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
- return QScriptValue(engine,query->next());
- }
-
- QScriptValue QSqlQuery_value(QScriptContext*context,QScriptEngine*engine)
- {
- QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
- return QScriptValue(engine,
- query->value(argument<int> (0,context)).toString());
- }
-
- /*:177*//*178:*/
- #line 4075 "./typica.w"
-
- QScriptValue QSqlQuery_prepare(QScriptContext*context,QScriptEngine*engine)
- {
- QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
- return QScriptValue(engine,query->prepare(argument<QString> (0,context)));
- }
-
- QScriptValue QSqlQuery_bind(QScriptContext*context,QScriptEngine*)
- {
- QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
- query->bindValue(argument<QString> (0,context),
- argument<QVariant> (1,context));
- return QScriptValue();
- }
-
- QScriptValue QSqlQuery_bindFileData(QScriptContext*context,
- QScriptEngine*)
- {
- QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
- QString placeholder= argument<QString> (0,context);
- QString filename= argument<QString> (1,context);
- QFile file(filename);
- QByteArray data;
- if(file.open(QIODevice::ReadOnly))
- {
- data= file.readAll();
- file.close();
- }
- query->bindValue(placeholder,data);
- return QScriptValue();
- }
-
- QScriptValue QSqlQuery_bindDeviceData(QScriptContext*context,
- QScriptEngine*)
- {
- QSqlQuery*query= getself<SqlQueryConnection*> (context)->operator->();
- QString placeholder= argument<QString> (0,context);
- QIODevice*device= argument<QIODevice*> (1,context);
- device->reset();
- QByteArray data;
- data= device->readAll();
- query->bindValue(placeholder,data);
- return QScriptValue();
- }
-
- /*:178*//*179:*/
- #line 4127 "./typica.w"
-
- QScriptValue QSqlQuery_invalidate(QScriptContext*context,QScriptEngine*)
- {
- SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
- delete query;
- return QScriptValue::UndefinedValue;
- }
-
- /*:179*//*182:*/
- #line 4174 "./typica.w"
-
- QScriptValue baseName(QScriptContext*context,QScriptEngine*engine)
- {
- QFileInfo info(argument<QString> (0,context));
- QScriptValue retval(engine,info.baseName());
- return retval;
- }
-
- QScriptValue dir(QScriptContext*context,QScriptEngine*engine)
- {
- QFileInfo info(argument<QString> (0,context));
- QDir dir= info.dir();
- QScriptValue retval(engine,dir.path());
- return retval;
- }
-
- /*:182*//*183:*/
- #line 4193 "./typica.w"
-
- QScriptValue saveFileFromDatabase(QScriptContext*context,QScriptEngine*)
- {
- SqlQueryConnection h;
- QSqlQuery*query= h.operator->();
- QString q= "SELECT file FROM files WHERE id = :file";
- query->prepare(q);
- query->bindValue(":file",argument<int> (0,context));
- query->exec();
- query->next();
- QByteArray array= query->value(0).toByteArray();
- QFile file(argument<QString> (1,context));
- file.open(QIODevice::WriteOnly);
- file.write(array);
- file.close();
- return QScriptValue();
- }
-
- /*:183*//*184:*/
- #line 4214 "./typica.w"
-
- QScriptValue sqlToArray(QScriptContext*context,QScriptEngine*engine)
- {
- QString source= argument<QString> (0,context);
- source.remove(0,1);
- source.chop(1);
- QStringList elements= source.split(",");
- QString element;
- QScriptValue dest= engine->newArray(elements.size());
- int i= 0;
- foreach(element,elements)
- {
- if(element.startsWith("\"")&&element.endsWith("\""))
- {
- element.chop(1);
- element= element.remove(0,1);
- }
- dest.setProperty(i,QScriptValue(engine,element));
- i++;
- }
- return dest;
- }
-
- /*:184*//*185:*/
- #line 4240 "./typica.w"
-
- QScriptValue setFont(QScriptContext*context,QScriptEngine*)
- {
- QString font= argument<QString> (0,context);
- QString classname;
- if(context->argumentCount()> 1)
- {
- classname= argument<QString> (1,context);
- QApplication::setFont(QFont(font),classname.toLatin1().constData());
- }
- else
- {
- QApplication::setFont(QFont(font));
- }
- return QScriptValue();
- }
-
- /*:185*//*186:*/
- #line 4260 "./typica.w"
-
- QScriptValue annotationFromRecord(QScriptContext*context,QScriptEngine*)
- {
- SqlQueryConnection h;
- QSqlQuery*query= h.operator->();
- QString q= "SELECT file FROM files WHERE id = :file";
- query->prepare(q);
- query->bindValue(":file",argument<int> (0,context));
- query->exec();
- query->next();
- QByteArray array= query->value(0).toByteArray();
- QBuffer buffer(&array);
- buffer.open(QIODevice::ReadOnly);
- QXmlQuery xquery;
- xquery.bindVariable("profile",&buffer);
- QString xq;
- xq= "for $b in doc($profile) //tuple where exists($b/annotation) return $b";
- xquery.setQuery(xq);
- QString result;
- xquery.evaluateTo(&result);
- return QScriptValue(result);
- }
-
- /*:186*//*187:*/
- #line 4287 "./typica.w"
-
- QScriptValue setTabOrder(QScriptContext*context,QScriptEngine*)
- {
- QWidget::setTabOrder(argument<QWidget*> (0,context),
- argument<QWidget*> (1,context));
- return QScriptValue();
- }
-
- /*:187*//*188:*/
- #line 4298 "./typica.w"
-
- QScriptValue scriptTr(QScriptContext*context,QScriptEngine*)
- {
- return QScriptValue(QCoreApplication::translate(
- "configuration",
- argument<QString> (1,context).toUtf8().data()));
- }
-
- /*:188*//*195:*/
- #line 4550 "./typica.w"
-
- QScriptValue createWindow(QScriptContext*context,QScriptEngine*engine)
- {
- QString targetID= argument<QString> (0,context);
- QDomNode element;
- QScriptValue object;
- /*197:*/
- #line 4597 "./typica.w"
-
- QDomNodeList windows=
- AppInstance->configuration()->documentElement().elementsByTagName("window");
- QDomNode nullNode;
- int i= 0;
- element= nullNode;
- while(i<windows.count())
- {
- element= windows.at(i);
- QDomNamedNodeMap attributes= element.attributes();
- if(attributes.contains("id"))
- {
- if(attributes.namedItem("id").toAttr().value()==targetID)
- {
- break;
- }
- }
- element= nullNode;
- i++;
- }
-
- /*:197*/
- #line 4556 "./typica.w"
-
- if(!element.isNull())
- {
- /*198:*/
- #line 4629 "./typica.w"
-
- ScriptQMainWindow*window= new ScriptQMainWindow;
- window->setObjectName(targetID);
- object= engine->newQObject(window);
- setQMainWindowProperties(object,engine);
- QWidget*central= new(QWidget);
- central->setParent(window);
- central->setObjectName("centralWidget");
- window->setCentralWidget(central);
- if(element.hasChildNodes())
- {
- /*199:*/
- #line 4664 "./typica.w"
-
- QStack<QWidget*> widgetStack;
- QStack<QLayout*> layoutStack;
- QString windowScript;
- widgetStack.push(central);
- QDomNodeList windowChildren= element.childNodes();
- int i= 0;
- while(i<windowChildren.count())
- {
- QDomNode current;
- QDomElement element;
- current= windowChildren.at(i);
- if(current.isElement())
- {
- element= current.toElement();
- if(element.tagName()=="program")
- {
- windowScript.append(element.text());
- }
- else if(element.tagName()=="layout")
- {
- element.setAttribute("trcontext","configuration");
- addLayoutToWidget(element,&widgetStack,&layoutStack);
- }
- else if(element.tagName()=="menu")
- {
- /*200:*/
- #line 4712 "./typica.w"
-
- QMenuBar*bar= window->menuBar();
- bar->setParent(window);
- bar->setObjectName("menuBar");
- if(element.hasAttribute("name"))
- {
- QMenu*menu= bar->addMenu(QCoreApplication::translate("configuration",
- element.attribute("name").toUtf8().data()));
- menu->setParent(bar);
- if(element.hasAttribute("type"))
- {
- if(element.attribute("type")=="reports")
- {
- if(element.hasAttribute("src"))
- {
- /*640:*/
- #line 13839 "./typica.w"
-
- QSettings settings;
- QString reportDirectory= QString("%1/%2").arg(settings.value("config").
- toString()).
- arg(element.attribute("src"));
- QDir::addSearchPath("reports",reportDirectory);
- QDir directory(reportDirectory);
- directory.setFilter(QDir::Files);
- directory.setSorting(QDir::Name);
- QStringList nameFilter;
- nameFilter<<"*.xml";
- directory.setNameFilters(nameFilter);
- QFileInfoList reportFiles= directory.entryInfoList();
- for(int i= 0;i<reportFiles.size();i++)
- {
- QFileInfo reportFile= reportFiles.at(i);
- /*644:*/
- #line 13919 "./typica.w"
-
- QString path= reportFile.absoluteFilePath();
- QFile file(path);
- if(file.open(QIODevice::ReadOnly))
- {
- QDomDocument document;
- document.setContent(&file,true);
- QDomElement root= document.documentElement();
- QString translationContext= root.attribute("id");
- QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
- if(!titleNode.isNull())
- {
- QDomElement titleElement= titleNode.toElement();
- QString title= QCoreApplication::translate("configuration",
- titleElement.text().toUtf8().data());
- if(!title.isEmpty())
- {
- QStringList hierarchy= title.split(":->");
- QMenu*insertionPoint= menu;
- /*645:*/
- #line 13948 "./typica.w"
-
- for(int j= 0;j<hierarchy.size()-1;j++)
- {
- QObjectList menuList= insertionPoint->children();
- bool menuFound= false;
- for(int k= 0;k<menuList.size();k++)
- {
- QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
- if(currentItem)
- {
- if(currentItem->title()==hierarchy.at(j))
- {
- menuFound= true;
- insertionPoint= currentItem;
- break;
- }
- }
- }
- if(!menuFound)
- {
- insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
- }
- }
-
- /*:645*/
- #line 13938 "./typica.w"
-
- ReportAction*action= new ReportAction(path,hierarchy.last());
- insertionPoint->addAction(action);
- }
- }
- }
-
- /*:644*/
- #line 13855 "./typica.w"
-
- }
-
- /*:640*/
- #line 4727 "./typica.w"
-
- }
- }
- }
- if(element.hasChildNodes())
- {
- /*201:*/
- #line 4740 "./typica.w"
-
- QDomNodeList menuItems= element.childNodes();
- int j= 0;
- while(j<menuItems.count())
- {
- QDomNode item= menuItems.at(j);
- if(item.isElement())
- {
- QDomElement itemElement= item.toElement();
- if(itemElement.tagName()=="item")
- {
- QAction*itemAction= new QAction(QCoreApplication::translate("configuration",
- itemElement.text().toUtf8().data()),menu);
- if(itemElement.hasAttribute("id"))
- {
- itemAction->setObjectName(itemElement.attribute("id"));
- }
- if(itemElement.hasAttribute("shortcut"))
- {
- itemAction->setShortcut(itemElement.attribute("shortcut"));
- }
- menu->addAction(itemAction);
- }
- else if(itemElement.tagName()=="separator")
- {
- menu->addSeparator();
- }
- }
- j++;
- }
-
- #line 1 "./helpmenu.w"
- /*:201*/
- #line 4733 "./typica.w"
-
- }
- }
-
- /*:200*/
- #line 4690 "./typica.w"
-
- }
- }
- i++;
- }
- QScriptValue oldThis= context->thisObject();
- context->setThisObject(object);
- QScriptValue result= engine->evaluate(windowScript);
- /*192:*/
- #line 4446 "./typica.w"
-
- if(engine->hasUncaughtException())
- {
- int line= engine->uncaughtExceptionLineNumber();
- qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
- result.toString();
- QString trace;
- foreach(trace,engine->uncaughtExceptionBacktrace())
- {
- qDebug()<<trace;
- }
- }
-
- /*:192*/
- #line 4698 "./typica.w"
-
- context->setThisObject(oldThis);
-
- /*:199*/
- #line 4640 "./typica.w"
-
- }
- /*202:*/
- #line 9 "./helpmenu.w"
-
- HelpMenu*helpMenu= new HelpMenu();
- window->menuBar()->addMenu(helpMenu);
-
- /*:202*/
- #line 4642 "./typica.w"
-
- window->show();
-
- /*:198*/
- #line 4559 "./typica.w"
-
- }
- return object;
- }
-
- /*:195*//*196:*/
- #line 4570 "./typica.w"
-
- QScriptValue createReport(QScriptContext*context,QScriptEngine*engine)
- {
- QString targetID= argument<QString> (0,context);
- QFile file(QString("reports:%1").arg(targetID));
- QScriptValue object;
- if(file.open(QIODevice::ReadOnly))
- {
- QDomDocument document;
- document.setContent(&file,true);
- QDomElement element= document.documentElement();
- if(!element.isNull())
- {
- /*198:*/
- #line 4629 "./typica.w"
-
- ScriptQMainWindow*window= new ScriptQMainWindow;
- window->setObjectName(targetID);
- object= engine->newQObject(window);
- setQMainWindowProperties(object,engine);
- QWidget*central= new(QWidget);
- central->setParent(window);
- central->setObjectName("centralWidget");
- window->setCentralWidget(central);
- if(element.hasChildNodes())
- {
- /*199:*/
- #line 4664 "./typica.w"
-
- QStack<QWidget*> widgetStack;
- QStack<QLayout*> layoutStack;
- QString windowScript;
- widgetStack.push(central);
- QDomNodeList windowChildren= element.childNodes();
- int i= 0;
- while(i<windowChildren.count())
- {
- QDomNode current;
- QDomElement element;
- current= windowChildren.at(i);
- if(current.isElement())
- {
- element= current.toElement();
- if(element.tagName()=="program")
- {
- windowScript.append(element.text());
- }
- else if(element.tagName()=="layout")
- {
- element.setAttribute("trcontext","configuration");
- addLayoutToWidget(element,&widgetStack,&layoutStack);
- }
- else if(element.tagName()=="menu")
- {
- /*200:*/
- #line 4712 "./typica.w"
-
- QMenuBar*bar= window->menuBar();
- bar->setParent(window);
- bar->setObjectName("menuBar");
- if(element.hasAttribute("name"))
- {
- QMenu*menu= bar->addMenu(QCoreApplication::translate("configuration",
- element.attribute("name").toUtf8().data()));
- menu->setParent(bar);
- if(element.hasAttribute("type"))
- {
- if(element.attribute("type")=="reports")
- {
- if(element.hasAttribute("src"))
- {
- /*640:*/
- #line 13839 "./typica.w"
-
- QSettings settings;
- QString reportDirectory= QString("%1/%2").arg(settings.value("config").
- toString()).
- arg(element.attribute("src"));
- QDir::addSearchPath("reports",reportDirectory);
- QDir directory(reportDirectory);
- directory.setFilter(QDir::Files);
- directory.setSorting(QDir::Name);
- QStringList nameFilter;
- nameFilter<<"*.xml";
- directory.setNameFilters(nameFilter);
- QFileInfoList reportFiles= directory.entryInfoList();
- for(int i= 0;i<reportFiles.size();i++)
- {
- QFileInfo reportFile= reportFiles.at(i);
- /*644:*/
- #line 13919 "./typica.w"
-
- QString path= reportFile.absoluteFilePath();
- QFile file(path);
- if(file.open(QIODevice::ReadOnly))
- {
- QDomDocument document;
- document.setContent(&file,true);
- QDomElement root= document.documentElement();
- QString translationContext= root.attribute("id");
- QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
- if(!titleNode.isNull())
- {
- QDomElement titleElement= titleNode.toElement();
- QString title= QCoreApplication::translate("configuration",
- titleElement.text().toUtf8().data());
- if(!title.isEmpty())
- {
- QStringList hierarchy= title.split(":->");
- QMenu*insertionPoint= menu;
- /*645:*/
- #line 13948 "./typica.w"
-
- for(int j= 0;j<hierarchy.size()-1;j++)
- {
- QObjectList menuList= insertionPoint->children();
- bool menuFound= false;
- for(int k= 0;k<menuList.size();k++)
- {
- QMenu*currentItem= qobject_cast<QMenu*> (menuList.at(k));
- if(currentItem)
- {
- if(currentItem->title()==hierarchy.at(j))
- {
- menuFound= true;
- insertionPoint= currentItem;
- break;
- }
- }
- }
- if(!menuFound)
- {
- insertionPoint= insertionPoint->addMenu(hierarchy.at(j));
- }
- }
-
- /*:645*/
- #line 13938 "./typica.w"
-
- ReportAction*action= new ReportAction(path,hierarchy.last());
- insertionPoint->addAction(action);
- }
- }
- }
-
- /*:644*/
- #line 13855 "./typica.w"
-
- }
-
- /*:640*/
- #line 4727 "./typica.w"
-
- }
- }
- }
- if(element.hasChildNodes())
- {
- /*201:*/
- #line 4740 "./typica.w"
-
- QDomNodeList menuItems= element.childNodes();
- int j= 0;
- while(j<menuItems.count())
- {
- QDomNode item= menuItems.at(j);
- if(item.isElement())
- {
- QDomElement itemElement= item.toElement();
- if(itemElement.tagName()=="item")
- {
- QAction*itemAction= new QAction(QCoreApplication::translate("configuration",
- itemElement.text().toUtf8().data()),menu);
- if(itemElement.hasAttribute("id"))
- {
- itemAction->setObjectName(itemElement.attribute("id"));
- }
- if(itemElement.hasAttribute("shortcut"))
- {
- itemAction->setShortcut(itemElement.attribute("shortcut"));
- }
- menu->addAction(itemAction);
- }
- else if(itemElement.tagName()=="separator")
- {
- menu->addSeparator();
- }
- }
- j++;
- }
-
- #line 1 "./helpmenu.w"
- /*:201*/
- #line 4733 "./typica.w"
-
- }
- }
-
- /*:200*/
- #line 4690 "./typica.w"
-
- }
- }
- i++;
- }
- QScriptValue oldThis= context->thisObject();
- context->setThisObject(object);
- QScriptValue result= engine->evaluate(windowScript);
- /*192:*/
- #line 4446 "./typica.w"
-
- if(engine->hasUncaughtException())
- {
- int line= engine->uncaughtExceptionLineNumber();
- qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
- result.toString();
- QString trace;
- foreach(trace,engine->uncaughtExceptionBacktrace())
- {
- qDebug()<<trace;
- }
- }
-
- /*:192*/
- #line 4698 "./typica.w"
-
- context->setThisObject(oldThis);
-
- /*:199*/
- #line 4640 "./typica.w"
-
- }
- /*202:*/
- #line 9 "./helpmenu.w"
-
- HelpMenu*helpMenu= new HelpMenu();
- window->menuBar()->addMenu(helpMenu);
-
- /*:202*/
- #line 4642 "./typica.w"
-
- window->show();
-
- /*:198*/
- #line 4583 "./typica.w"
-
- }
- file.close();
- }
- return object;
- }
-
- /*:196*//*214:*/
- #line 4785 "./typica.w"
-
- void addLayoutToWidget(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack)
- {
- if(element.hasAttribute("type"))
- {
- /*215:*/
- #line 4806 "./typica.w"
-
- QLayout*layout;
- QString layoutType= element.attribute("type");
- if(layoutType=="horizontal")
- {
- layout= new QHBoxLayout;
- layoutStack->push(layout);
- populateBoxLayout(element,widgetStack,layoutStack);
- }
- else if(layoutType=="vertical")
- {
- layout= new QVBoxLayout;
- layoutStack->push(layout);
- populateBoxLayout(element,widgetStack,layoutStack);
- }
- else if(layoutType=="grid")
- {
- layout= new QGridLayout;
- layoutStack->push(layout);
- populateGridLayout(element,widgetStack,layoutStack);
- }
- else if(layoutType=="stack")
- {
- layout= new QStackedLayout;
- layoutStack->push(layout);
- populateStackedLayout(element,widgetStack,layoutStack);
- }
- if(element.hasAttribute("id"))
- {
- layout->setObjectName(element.attribute("id"));
- }
- if(element.hasAttribute("spacing"))
- {
- layout->setSpacing(element.attribute("spacing").toInt());
- }
- if(element.hasAttribute("margin"))
- {
- int m= element.attribute("margin").toInt();
- layout->setContentsMargins(m,m,m,m);
- }
-
- /*:215*/
- #line 4791 "./typica.w"
-
- QWidget*widget= widgetStack->top();
- if(layout)
- {
- widget->setLayout(layout);
- }
- layoutStack->pop();
- }
- }
-
- /*:214*//*216:*/
- #line 4853 "./typica.w"
-
- void populateStackedLayout(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack)
- {
- QDomNodeList children= element.childNodes();
- QStackedLayout*layout= qobject_cast<QStackedLayout*> (layoutStack->top());
- for(int i= 0;i<children.count();i++)
- {
- QDomNode current;
- QDomElement currentElement;
- current= children.at(i);
- if(current.isElement())
- {
- currentElement= current.toElement();
- if(currentElement.tagName()=="page")
- {
- QWidget*widget= new QWidget;
- layout->addWidget(widget);
- widgetStack->push(widget);
- currentElement.setAttribute("trcontext","configuration");
- populateWidget(currentElement,widgetStack,layoutStack);
- widgetStack->pop();
- }
- }
- }
- }
-
- /*:216*//*217:*/
- #line 4886 "./typica.w"
-
- void populateGridLayout(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack)
- {
- QDomNodeList children= element.childNodes();
- int row= -1;
- QGridLayout*layout= qobject_cast<QGridLayout*> (layoutStack->top());
- for(int i= 0;i<children.count();i++)
- {
- QDomNode current;
- QDomElement currentElement;
- current= children.at(i);
- if(current.isElement())
- {
- currentElement= current.toElement();
- if(currentElement.tagName()=="row")
- {
- row++;
- if(currentElement.hasAttribute("height"))
- {
- layout->setRowMinimumHeight(row,
- currentElement.attribute("height").toInt());
- }
- if(currentElement.hasAttribute("stretch"))
- {
- layout->setRowStretch(row,
- currentElement.attribute("stretch").toInt());
- }
- /*218:*/
- #line 4942 "./typica.w"
-
- int column= -1;
- QDomNodeList rowChildren= currentElement.childNodes();
- for(int j= 0;j<rowChildren.count();j++)
- {
- QDomNode columnNode;
- QDomElement columnElement;
- columnNode= rowChildren.at(j);
- if(columnNode.isElement())
- {
- columnElement= columnNode.toElement();
- if(columnElement.tagName()=="column")
- {
- column++;
- if(columnElement.hasAttribute("column"))
- {
- column= columnElement.attribute("column").toInt();
- }
- if(columnElement.hasAttribute("width"))
- {
- layout->setColumnMinimumWidth(column,
- columnElement.attribute("width").toInt());
- }
- if(columnElement.hasAttribute("stretch"))
- {
- layout->setColumnStretch(column,
- columnElement.attribute("stretch").toInt());
- }
- int hspan= 1;
- int vspan= 1;
- if(columnElement.hasAttribute("rowspan"))
- {
- vspan= columnElement.attribute("rowspan").toInt();
- }
- if(columnElement.hasAttribute("colspan"))
- {
- hspan= columnElement.attribute("colspan").toInt();
- }
- QHBoxLayout*cell= new QHBoxLayout;
- layout->addLayout(cell,row,column,vspan,hspan);
- layoutStack->push(cell);
- columnElement.setAttribute("trcontext","configuration");
- populateBoxLayout(columnElement,widgetStack,layoutStack);
- layoutStack->pop();
- }
- }
- }
-
- /*:218*/
- #line 4914 "./typica.w"
-
- }
- }
- }
- }
-
- /*:217*//*219:*/
- #line 4993 "./typica.w"
-
- void populateBoxLayout(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack)
- {
- QDomNodeList children= element.childNodes();
- for(int i= 0;i<children.count();i++)
- {
- QDomNode current;
- QDomElement currentElement;
- current= children.at(i);
- if(current.isElement())
- {
- currentElement= current.toElement();
- currentElement.setAttribute("trcontext","configuration");
- if(currentElement.tagName()=="button")
- {
- addButtonToLayout(currentElement,widgetStack,layoutStack);
- }
- else if(currentElement.tagName()=="calendar")
- {
- addCalendarToLayout(currentElement,widgetStack,layoutStack);
- }
- else if(currentElement.tagName()=="decoration")
- {
- addDecorationToLayout(currentElement,widgetStack,
- layoutStack);
- }
- else if(currentElement.tagName()=="layout")
- {
- addLayoutToLayout(currentElement,widgetStack,layoutStack);
- }
- else if(currentElement.tagName()=="splitter")
- {
- addSplitterToLayout(currentElement,widgetStack,layoutStack);
- }
- else if(currentElement.tagName()=="label")
- {
- QBoxLayout*layout=
- qobject_cast<QBoxLayout*> (layoutStack->top());
- QLabel*label= new QLabel(QCoreApplication::translate(
- "configuration",
- currentElement.text().toUtf8().data()));
- layout->addWidget(label);
- }
- else if(currentElement.tagName()=="lcdtemperature")
- {
- addTemperatureDisplayToLayout(currentElement,widgetStack,
- layoutStack);
- }
- else if(currentElement.tagName()=="lcdtimer")
- {
- addTimerDisplayToLayout(currentElement,widgetStack,
- layoutStack);
- }
- else if(currentElement.tagName()=="line")
- {
- addLineToLayout(currentElement,widgetStack,layoutStack);
- }
- else if(currentElement.tagName()=="report")
- {
- addReportToLayout(currentElement,widgetStack,layoutStack);
- }
- else if(currentElement.tagName()=="sqldrop")
- {
- addSqlDropToLayout(currentElement,widgetStack,layoutStack);
- }
- else if(currentElement.tagName()=="sqltablearray")
- {
- addSaltToLayout(currentElement,widgetStack,layoutStack);
- }
- else if(currentElement.tagName()=="sqlview")
- {
- addSqlQueryViewToLayout(currentElement,widgetStack,
- layoutStack);
- }
- else if(currentElement.tagName()=="textarea")
- {
- addTextToLayout(currentElement,widgetStack,layoutStack);
- }
- else if(currentElement.tagName()=="spinbox")
- {
- addSpinBoxToLayout(currentElement,widgetStack,layoutStack);
- }
- else if(currentElement.tagName()=="formarray")
- {
- addFormArrayToLayout(currentElement,widgetStack,layoutStack);
- }
- else if(currentElement.tagName()=="hscale")
- {
- addScaleControlToLayout(currentElement,widgetStack,
- layoutStack);
- }
- else if(currentElement.tagName()=="vscale")
- {
- addIntensityControlToLayout(currentElement,widgetStack,
- layoutStack);
- }
- else if(currentElement.tagName()=="webview")
- {
- addWebViewToLayout(currentElement,widgetStack,layoutStack);
- }
- else if(currentElement.tagName()=="stretch")
- {
- QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
- layout->addStretch();
- }
- /*51:*/
- #line 1479 "./typica.w"
-
- else if(currentElement.tagName()=="svgwidget")
- {
- addSvgWidgetToLayout(currentElement,widgetStack,layoutStack);
- }
-
- /*:51*//*682:*/
- #line 451 "./daterangeselector.w"
-
- else if(currentElement.tagName()=="daterange")
- {
- addDateRangeToLayout(currentElement,widgetStack,layoutStack);
- }
-
- /*:682*/
- #line 5099 "./typica.w"
-
- }
- }
- }
-
- /*:219*//*220:*/
- #line 5107 "./typica.w"
-
- void addLayoutToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack)
- {
- QLayout*targetLayout= layoutStack->pop();
- QBoxLayout*boxLayout= qobject_cast<QBoxLayout*> (targetLayout);
- if(element.hasAttribute("type"))
- {
- /*215:*/
- #line 4806 "./typica.w"
-
- QLayout*layout;
- QString layoutType= element.attribute("type");
- if(layoutType=="horizontal")
- {
- layout= new QHBoxLayout;
- layoutStack->push(layout);
- populateBoxLayout(element,widgetStack,layoutStack);
- }
- else if(layoutType=="vertical")
- {
- layout= new QVBoxLayout;
- layoutStack->push(layout);
- populateBoxLayout(element,widgetStack,layoutStack);
- }
- else if(layoutType=="grid")
- {
- layout= new QGridLayout;
- layoutStack->push(layout);
- populateGridLayout(element,widgetStack,layoutStack);
- }
- else if(layoutType=="stack")
- {
- layout= new QStackedLayout;
- layoutStack->push(layout);
- populateStackedLayout(element,widgetStack,layoutStack);
- }
- if(element.hasAttribute("id"))
- {
- layout->setObjectName(element.attribute("id"));
- }
- if(element.hasAttribute("spacing"))
- {
- layout->setSpacing(element.attribute("spacing").toInt());
- }
- if(element.hasAttribute("margin"))
- {
- int m= element.attribute("margin").toInt();
- layout->setContentsMargins(m,m,m,m);
- }
-
- /*:215*/
- #line 5115 "./typica.w"
-
- boxLayout->addLayout(layout);
- layoutStack->pop();
- }
- layoutStack->push(targetLayout);
- }
-
- /*:220*//*221:*/
- #line 5126 "./typica.w"
-
- void addSplitterToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack)
- {
- QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
- QSplitter*splitter= new(QSplitter);
- layout->addWidget(splitter);
- /*222:*/
- #line 5139 "./typica.w"
-
- QString orientation= element.attribute("type");
- if(orientation=="horizontal")
- {
- splitter->setOrientation(Qt::Horizontal);
- }
- else if(orientation=="vertical")
- {
- splitter->setOrientation(Qt::Vertical);
- }
- QString id= element.attribute("id");
- if(!id.isEmpty())
- {
- splitter->setObjectName(id);
- }
- if(element.hasChildNodes())
- {
- widgetStack->push(splitter);
- populateSplitter(element,widgetStack,layoutStack);
- widgetStack->pop();
- }
-
- /*:222*/
- #line 5133 "./typica.w"
-
- }
-
- /*:221*//*223:*/
- #line 5165 "./typica.w"
-
- void populateSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack)
- {
- QDomNodeList children= element.childNodes();
- for(int i= 0;i<children.count();i++)
- {
- QDomNode current;
- QDomElement currentElement;
- current= children.at(i);
- if(current.isElement())
- {
- currentElement= current.toElement();
- currentElement.setAttribute("trcontext","configuration");
- if(currentElement.tagName()=="decoration")
- {
- addDecorationToSplitter(currentElement,widgetStack,
- layoutStack);
- }
- else if(currentElement.tagName()=="graph")
- {
- addGraphToSplitter(currentElement,widgetStack,layoutStack);
- }
- else if(currentElement.tagName()=="splitter")
- {
- addSplitterToSplitter(currentElement,widgetStack,layoutStack);
- }
- else if(currentElement.tagName()=="lcdtemperature")
- {
- addTemperatureDisplayToSplitter(currentElement,widgetStack,
- layoutStack);
- }
- else if(currentElement.tagName()=="lcdtimer")
- {
- addTimerDisplayToSplitter(currentElement,widgetStack,
- layoutStack);
- }
- else if(currentElement.tagName()=="measurementtable")
- {
- addZoomLogToSplitter(currentElement,widgetStack,layoutStack);
- }
- else if(currentElement.tagName()=="widget")
- {
- addWidgetToSplitter(currentElement,widgetStack,layoutStack);
- }
- }
- }
- }
-
- /*:223*//*224:*/
- #line 5216 "./typica.w"
-
- void addSplitterToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack)
- {
- QSplitter*parent= qobject_cast<QSplitter*> (widgetStack->top());
- QSplitter*splitter= new(QSplitter);
- splitter->setParent(parent);
- parent->addWidget(splitter);
- /*222:*/
- #line 5139 "./typica.w"
-
- QString orientation= element.attribute("type");
- if(orientation=="horizontal")
- {
- splitter->setOrientation(Qt::Horizontal);
- }
- else if(orientation=="vertical")
- {
- splitter->setOrientation(Qt::Vertical);
- }
- QString id= element.attribute("id");
- if(!id.isEmpty())
- {
- splitter->setObjectName(id);
- }
- if(element.hasChildNodes())
- {
- widgetStack->push(splitter);
- populateSplitter(element,widgetStack,layoutStack);
- widgetStack->pop();
- }
-
- /*:222*/
- #line 5224 "./typica.w"
-
- }
-
- /*:224*//*225:*/
- #line 5233 "./typica.w"
-
- void addTemperatureDisplayToSplitter(QDomElement element,
- QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *)
- {
- TemperatureDisplay*display= new(TemperatureDisplay);
- if(element.hasAttribute("id"))
- {
- display->setObjectName(element.attribute("id"));
- }
- QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
- splitter->addWidget(display);
- }
-
- void addTemperatureDisplayToLayout(QDomElement element,
- QStack<QWidget*> *,
- QStack<QLayout*> *layoutStack)
- {
- TemperatureDisplay*display= new(TemperatureDisplay);
- if(element.hasAttribute("id"))
- {
- display->setObjectName(element.attribute("id"));
- }
- QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
- layout->addWidget(display);
- }
-
- /*:225*//*226:*/
- #line 5264 "./typica.w"
-
- void addTimerDisplayToSplitter(QDomElement element,
- QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *)
- {
- TimerDisplay*display= new(TimerDisplay);
- if(element.hasAttribute("id"))
- {
- display->setObjectName(element.attribute("id"));
- }
- if(element.hasAttribute("format"))
- {
- display->setDisplayFormat(element.attribute("format"));
- }
- QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
- splitter->addWidget(display);
- }
-
- void addTimerDisplayToLayout(QDomElement element,
- QStack<QWidget*> *,
- QStack<QLayout*> *layoutStack)
- {
- TimerDisplay*display= new(TimerDisplay);
- if(element.hasAttribute("id"))
- {
- display->setObjectName(element.attribute("id"));
- }
- if(element.hasAttribute("format"))
- {
- display->setDisplayFormat(element.attribute("format"));
- }
- QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
- layout->addWidget(display);
- }
-
- /*:226*//*227:*/
- #line 5302 "./typica.w"
-
- void addDecorationToLayout(QDomElement element,QStack<QWidget*> *,
- QStack<QLayout*> *layoutStack)
- {
- /*228:*/
- #line 5323 "./typica.w"
-
- QString labelText=
- QCoreApplication::translate("configuration",
- element.attribute("name").toUtf8().data());
- Qt::Orientations orientation= Qt::Horizontal;
- if(element.hasAttribute("type"))
- {
- if(element.attribute("type")=="horizontal")
- {
- orientation= Qt::Horizontal;
- }
- else if(element.attribute("type")=="vertical")
- {
- orientation= Qt::Vertical;
- }
- }
- /*229:*/
- #line 5350 "./typica.w"
-
- QWidget*theWidget= NULL;
- QDomNodeList children= element.childNodes();
- for(int i= 0;i<children.count();i++)
- {
- QDomNode item= children.at(i);
- if(item.isElement())
- {
- QDomElement itemElement= item.toElement();
- if(itemElement.tagName()=="lcdtemperature")
- {
- TemperatureDisplay*display= new TemperatureDisplay;
- if(itemElement.hasAttribute("id"))
- {
- display->setObjectName(itemElement.attribute("id"));
- }
- theWidget= display;
- }
- else if(itemElement.tagName()=="lcdtimer")
- {
- TimerDisplay*display= new TimerDisplay;
- if(itemElement.hasAttribute("id"))
- {
- display->setObjectName(itemElement.attribute("id"));
- }
- if(itemElement.hasAttribute("format"))
- {
- display->setDisplayFormat(itemElement.attribute("format"));
- }
- theWidget= display;
- }
- }
- }
-
- /*:229*/
- #line 5339 "./typica.w"
-
- WidgetDecorator*decoration= new WidgetDecorator(theWidget,labelText,
- orientation);
- if(element.hasAttribute("id"))
- {
- decoration->setObjectName(element.attribute("id"));
- }
-
- /*:228*/
- #line 5306 "./typica.w"
-
- QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
- layout->addWidget(decoration);
- }
-
- void addDecorationToSplitter(QDomElement element,
- QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *)
- {
- /*228:*/
- #line 5323 "./typica.w"
-
- QString labelText=
- QCoreApplication::translate("configuration",
- element.attribute("name").toUtf8().data());
- Qt::Orientations orientation= Qt::Horizontal;
- if(element.hasAttribute("type"))
- {
- if(element.attribute("type")=="horizontal")
- {
- orientation= Qt::Horizontal;
- }
- else if(element.attribute("type")=="vertical")
- {
- orientation= Qt::Vertical;
- }
- }
- /*229:*/
- #line 5350 "./typica.w"
-
- QWidget*theWidget= NULL;
- QDomNodeList children= element.childNodes();
- for(int i= 0;i<children.count();i++)
- {
- QDomNode item= children.at(i);
- if(item.isElement())
- {
- QDomElement itemElement= item.toElement();
- if(itemElement.tagName()=="lcdtemperature")
- {
- TemperatureDisplay*display= new TemperatureDisplay;
- if(itemElement.hasAttribute("id"))
- {
- display->setObjectName(itemElement.attribute("id"));
- }
- theWidget= display;
- }
- else if(itemElement.tagName()=="lcdtimer")
- {
- TimerDisplay*display= new TimerDisplay;
- if(itemElement.hasAttribute("id"))
- {
- display->setObjectName(itemElement.attribute("id"));
- }
- if(itemElement.hasAttribute("format"))
- {
- display->setDisplayFormat(itemElement.attribute("format"));
- }
- theWidget= display;
- }
- }
- }
-
- /*:229*/
- #line 5339 "./typica.w"
-
- WidgetDecorator*decoration= new WidgetDecorator(theWidget,labelText,
- orientation);
- if(element.hasAttribute("id"))
- {
- decoration->setObjectName(element.attribute("id"));
- }
-
- /*:228*/
- #line 5315 "./typica.w"
-
- QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
- splitter->addWidget(decoration);
- }
-
- /*:227*//*230:*/
- #line 5389 "./typica.w"
-
- void addWidgetToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack)
- {
- QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
- QWidget*widget= new QWidget;
- if(element.hasAttribute("id"))
- {
- widget->setObjectName(element.attribute("id"));
- }
- splitter->addWidget(widget);
- if(element.hasChildNodes())
- {
- widgetStack->push(widget);
- populateWidget(element,widgetStack,layoutStack);
- widgetStack->pop();
- }
- }
-
- void populateWidget(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack)
- {
- QDomNodeList children= element.childNodes();
- for(int i= 0;i<children.count();i++)
- {
- QDomNode current;
- QDomElement currentElement;
- current= children.at(i);
- if(current.isElement())
- {
- currentElement= current.toElement();
- if(currentElement.tagName()=="layout")
- {
- currentElement.setAttribute("trcontext","configuration");
- addLayoutToWidget(currentElement,widgetStack,layoutStack);
- }
- }
- }
- }
-
- /*:230*//*231:*/
- #line 5433 "./typica.w"
-
- void addButtonToLayout(QDomElement element,QStack<QWidget*> *,
- QStack<QLayout*> *layoutStack)
- {
- QAbstractButton*button= NULL;
- QString text=
- QCoreApplication::translate("configuration",
- element.attribute("name").toUtf8().data());
- if(element.hasAttribute("type"))
- {
- QString type= element.attribute("type");
- if(type=="annotation")
- {
- AnnotationButton*abutton= new AnnotationButton(text);
- if(element.hasAttribute("annotation"))
- {
- abutton->setAnnotation(element.attribute("annotation"));
- }
- if(element.hasAttribute("series"))
- {
- abutton->setTemperatureColumn(element.attribute("series").
- toInt());
- }
- if(element.hasAttribute("column"))
- {
- abutton->setAnnotationColumn(element.attribute("column").
- toInt());
- }
- button= abutton;
- }
- else if(type=="check")
- {
- button= new QCheckBox(text);
- }
- else if(type=="push")
- {
- button= new QPushButton(text);
- }
- }
- if(element.hasAttribute("id"))
- {
- button->setObjectName(element.attribute("id"));
- }
- QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
- layout->addWidget(button);
- }
-
- /*:231*//*232:*/
- #line 5487 "./typica.w"
-
- void addSpinBoxToLayout(QDomElement element,QStack<QWidget*> *,
- QStack<QLayout*> *layoutStack)
- {
- AnnotationSpinBox*box= new AnnotationSpinBox("","",NULL);
- if(element.hasAttribute("pretext"))
- {
- box->setPretext(QCoreApplication::translate(
- "configuration",
- element.attribute("pretext").toUtf8().data()));
- }
- if(element.hasAttribute("posttext"))
- {
- box->setPosttext(QCoreApplication::translate(
- "configuration",
- element.attribute("posttext").toUtf8().data()));
- }
- if(element.hasAttribute("series"))
- {
- box->setTemperatureColumn(element.attribute("series").toInt());
- }
- if(element.hasAttribute("column"))
- {
- box->setAnnotationColumn(element.attribute("column").toInt());
- }
- if(element.hasAttribute("min"))
- {
- box->setMinimum(element.attribute("min").toDouble());
- }
- if(element.hasAttribute("max"))
- {
- box->setMaximum(element.attribute("max").toDouble());
- }
- if(element.hasAttribute("decimals"))
- {
- box->setDecimals(element.attribute("decimals").toInt());
- }
- if(element.hasAttribute("step"))
- {
- box->setSingleStep(element.attribute("step").toDouble());
- }
- if(element.hasAttribute("id"))
- {
- box->setObjectName(element.attribute("id"));
- }
- QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
- layout->addWidget(box);
- }
-
- /*:232*//*233:*/
- #line 5547 "./typica.w"
-
- void addZoomLogToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *)
- {
- ZoomLog*widget= new ZoomLog;
- if(element.hasAttribute("id"))
- {
- widget->setObjectName(element.attribute("id"));
- }
- if(element.hasChildNodes())
- {
- QDomNodeList children= element.childNodes();
- int column= 0;
- for(int i= 0;i<children.count();i++)
- {
- QDomNode current;
- QDomElement currentElement;
- current= children.at(i);
- if(current.isElement())
- {
- currentElement= current.toElement();
- if(currentElement.tagName()=="column")
- {
- QString text=
- QCoreApplication::translate(
- "configuration",
- currentElement.text().toUtf8().data());
- widget->setHeaderData(column,text);
- column++;
- }
- }
- }
- }
- QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
- if(splitter)
- {
- splitter->addWidget(widget);
- }
- else
- {
- qDebug()<<"Splitter not found at top of widget stack!";
- }
- }
-
- /*:233*//*234:*/
- #line 5594 "./typica.w"
-
- void addGraphToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *)
- {
- GraphView*view= new GraphView;
- if(element.hasAttribute("id"))
- {
- view->setObjectName(element.attribute("id"));
- }
- QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
- splitter->addWidget(view);
- }
-
- /*:234*//*235:*/
- #line 5611 "./typica.w"
-
- void addSqlDropToLayout(QDomElement element,QStack<QWidget*> *,
- QStack<QLayout*> *layoutStack)
- {
- SqlComboBox*box= new SqlComboBox();
- if(element.hasAttribute("data"))
- {
- box->setDataColumn(element.attribute("data").toInt());
- }
- if(element.hasAttribute("display"))
- {
- box->setDisplayColumn(element.attribute("display").toInt());
- }
- if(element.hasAttribute("showdata"))
- {
- if(element.attribute("showdata")=="true")
- {
- box->showData(true);
- }
- }
- if(element.hasAttribute("editable"))
- {
- if(element.attribute("editable")=="true")
- {
- box->setEditable(true);
- }
- }
- if(element.hasChildNodes())
- {
- QDomNodeList children= element.childNodes();
- for(int i= 0;i<children.count();i++)
- {
- QDomNode current;
- QDomElement currentElement;
- current= children.at(i);
- if(current.isElement())
- {
- currentElement= current.toElement();
- if(currentElement.tagName()=="null")
- {
- box->addNullOption();
- }
- else if(currentElement.tagName()=="query")
- {
- box->addSqlOptions(currentElement.text());
- }
- }
- }
- }
- if(element.hasAttribute("id"))
- {
- box->setObjectName(element.attribute("id"));
- }
- QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
- layout->addWidget(box);
- }
-
- /*:235*//*236:*/
- #line 5690 "./typica.w"
-
- void addSaltToLayout(QDomElement element,QStack<QWidget*> *,
- QStack<QLayout*> *layoutStack)
- {
- QTableView*view= new QTableView;
- view->setProperty("tabletype",QVariant(QString("SaltTable")));
- SaltModel*model= new SaltModel(element.childNodes().count());
- if(element.hasAttribute("id"))
- {
- view->setObjectName(element.attribute("id"));
- }
- if(element.hasChildNodes())
- {
- QDomNodeList children= element.childNodes();
- int currentColumn= 0;
- for(int i= 0;i<children.count();i++)
- {
- QDomNode current;
- QDomElement currentElement;
- current= children.at(i);
- if(current.isElement())
- {
- currentElement= current.toElement();
- if(currentElement.tagName()=="column")
- {
- if(currentElement.hasAttribute("name"))
- {
- model->setHeaderData(currentColumn,
- Qt::Horizontal,
- QCoreApplication::translate(
- "configuration",
- currentElement.attribute("name").toUtf8().data()));
- }
- if(currentElement.hasAttribute("delegate"))
- {
- /*237:*/
- #line 5741 "./typica.w"
-
- if(currentElement.attribute("delegate")=="sql")
- {
- /*238:*/
- #line 5757 "./typica.w"
-
- SqlComboBoxDelegate*delegate= new SqlComboBoxDelegate;
- SqlComboBox*widget= new SqlComboBox();
- if(currentElement.hasAttribute("nulltext"))
- {
- widget->setNullText(currentElement.attribute("nulltext"));
- }
- if(currentElement.hasAttribute("nulldata"))
- {
- widget->setNullData(QVariant(currentElement.attribute("nulldata")));
- }
- if(currentElement.hasAttribute("null"))
- {
- if(currentElement.attribute("null")=="true")
- {
- widget->addNullOption();
- }
- }
- if(currentElement.hasAttribute("showdata"))
- {
- if(currentElement.attribute("showdata")=="true")
- {
- widget->showData(true);
- }
- }
- if(currentElement.hasAttribute("data"))
- {
- widget->setDataColumn(currentElement.attribute("data").toInt());
- }
- if(currentElement.hasAttribute("display"))
- {
- widget->setDisplayColumn(currentElement.attribute("display").toInt());
- }
- widget->addSqlOptions(currentElement.text());
- delegate->setWidget(widget);
- view->setItemDelegateForColumn(currentColumn,delegate);
-
- /*:238*/
- #line 5744 "./typica.w"
-
- }
- else if(currentElement.attribute("delegate")=="numeric")
- {
- /*239:*/
- #line 5798 "./typica.w"
-
- NumericDelegate*delegate= new NumericDelegate;
- view->setItemDelegateForColumn(currentColumn,delegate);
-
- /*:239*/
- #line 5748 "./typica.w"
-
- }
-
- /*:237*/
- #line 5725 "./typica.w"
-
- }
- currentColumn++;
- }
- }
- }
- }
- view->setModel(model);
- QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
- layout->addWidget(view);
- }
-
- /*:236*//*251:*/
- #line 5971 "./typica.w"
-
- void addLineToLayout(QDomElement element,QStack<QWidget*> *,
- QStack<QLayout*> *layoutStack)
- {
- QLineEdit*widget= new QLineEdit(element.text());
- if(element.hasAttribute("id"))
- {
- widget->setObjectName(element.attribute("id"));
- }
- if(element.hasAttribute("writable"))
- {
- if(element.attribute("writable")=="false")
- {
- widget->setReadOnly(true);
- }
- }
- if(element.hasAttribute("validator"))
- {
- if(element.attribute("validator")=="numeric")
- {
- widget->setValidator(new ScriptValidator(new QDoubleValidator));
- }
- else if(element.attribute("validator")=="integer")
- {
- widget->setValidator(new ScriptValidator(new QIntValidator));
- }
- else if(element.attribute("validator")=="expression"&&
- element.hasAttribute("expression"))
- {
- widget->setValidator(new QRegExpValidator(
- QRegExp(element.attribute("expression")),
- NULL));
- }
- }
- QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
- layout->addWidget(widget);
- }
-
- /*:251*//*252:*/
- #line 6012 "./typica.w"
-
- void addTextToLayout(QDomElement element,QStack<QWidget*> *,
- QStack<QLayout*> *layoutStack)
- {
- QTextEdit*widget= new QTextEdit;
- if(element.hasAttribute("id"))
- {
- widget->setObjectName(element.attribute("id"));
- }
- QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
- layout->addWidget(widget);
- }
-
- /*:252*//*253:*/
- #line 6029 "./typica.w"
-
- void addSqlQueryViewToLayout(QDomElement element,
- QStack<QWidget*> *,
- QStack<QLayout*> *layoutStack)
- {
- SqlQueryView*view= new SqlQueryView;
- if(element.hasAttribute("id"))
- {
- view->setObjectName(element.attribute("id"));
- }
- QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
- layout->addWidget(view);
- }
-
- /*:253*//*254:*/
- #line 6046 "./typica.w"
-
- void addCalendarToLayout(QDomElement element,QStack<QWidget*> *,
- QStack<QLayout*> *layoutStack)
- {
- QWidget*widget;
- if(element.hasAttribute("time"))
- {
- if(element.attribute("time")=="true")
- {
- QDateTimeEdit*edit= new QDateTimeEdit;
- edit->setDateTime(QDateTime::currentDateTime());
- edit->setCalendarPopup(true);
- edit->setDisplayFormat("yyyy-MM-dd hh:mm:ss");
- widget= qobject_cast<QWidget*> (edit);
- }
- else
- {
- QDateEdit*edit= new QDateEdit;
- edit->setDate(QDate::currentDate());
- edit->setCalendarPopup(true);
- edit->setDisplayFormat("yyyy-MM-dd");
- widget= qobject_cast<QWidget*> (edit);
- }
- }
- else
- {
- QDateEdit*edit= new QDateEdit;
- edit->setDate(QDate::currentDate());
- edit->setCalendarPopup(true);
- edit->setDisplayFormat("yyyy-MM-dd");
- widget= qobject_cast<QWidget*> (edit);
- }
- if(element.hasAttribute("id"))
- {
- widget->setObjectName(element.attribute("id"));
- }
- QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
- layout->addWidget(widget);
- }
-
- /*:254*//*255:*/
- #line 6089 "./typica.w"
-
- void setQDateEditProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQDateTimeEditProperties(value,engine);
- }
-
- void setQDateTimeEditProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQAbstractSpinBoxProperties(value,engine);
- value.setProperty("setDate",engine->newFunction(QDateTimeEdit_setDate));
- value.setProperty("day",engine->newFunction(QDateTimeEdit_day));
- value.setProperty("month",engine->newFunction(QDateTimeEdit_month));
- value.setProperty("year",engine->newFunction(QDateTimeEdit_year));
- value.setProperty("setToCurrentTime",
- engine->newFunction(QDateTimeEdit_setToCurrentTime));
- }
-
- /*:255*//*256:*/
- #line 6111 "./typica.w"
-
- QScriptValue QDateTimeEdit_setDate(QScriptContext*context,QScriptEngine*)
- {
- QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
- if(context->argumentCount()==3)
- {
- self->setDate(QDate(argument<int> (0,context),
- argument<int> (1,context),
- argument<int> (2,context)));
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "QDateTimeEdit::setDate(). This method takes three integer arguments "
- "specifying the year, month, and day.");
- }
- return QScriptValue();
- }
-
- QScriptValue QDateTimeEdit_day(QScriptContext*context,QScriptEngine*)
- {
- QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
- return QScriptValue(self->date().day());
- }
-
- QScriptValue QDateTimeEdit_month(QScriptContext*context,QScriptEngine*)
- {
- QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
- return QScriptValue(self->date().month());
- }
-
- QScriptValue QDateTimeEdit_year(QScriptContext*context,QScriptEngine*)
- {
- QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
- return QScriptValue(self->date().year());
- }
-
- QScriptValue QDateTimeEdit_setToCurrentTime(QScriptContext*context,QScriptEngine*)
- {
- QDateTimeEdit*self= getself<QDateTimeEdit*> (context);
- self->setDateTime(QDateTime::currentDateTime());
- return QScriptValue();
- }
-
- /*:256*//*260:*/
- #line 6186 "./typica.w"
-
- QScriptValue findChildObject(QScriptContext*context,QScriptEngine*engine)
- {
- QObject*parent= argument<QObject*> (0,context);
- QString name= argument<QString> (1,context);
- QObject*object= parent->findChild<QObject*> (name);
- QScriptValue value;
- if(object)
- {
- value= engine->newQObject(object);
- QString className= object->metaObject()->className();
- /*261:*/
- #line 6204 "./typica.w"
-
- if(className=="TemperatureDisplay")
- {
- setTemperatureDisplayProperties(value,engine);
- }
- else if(className=="TimerDisplay")
- {
- setTimerDisplayProperties(value,engine);
- }
- else if(className=="QAction")
- {
- setQActionProperties(value,engine);
- }
- else if(className=="QBoxLayout")
- {
- setQBoxLayoutProperties(value,engine);
- }
- else if(className=="QDateEdit")
- {
- setQDateEditProperties(value,engine);
- }
- else if(className=="QDateTimeEdit")
- {
- setQDateTimeEditProperties(value,engine);
- }
- else if(className=="QFrame")
- {
- setQFrameProperties(value,engine);
- }
- else if(className=="QHBoxLayout")
- {
- setQBoxLayoutProperties(value,engine);
- }
- else if(className=="QLCDNumber")
- {
- setQLCDNumberProperties(value,engine);
- }
- else if(className=="QMenu")
- {
- setQMenuProperties(value,engine);
- }
- else if(className=="QMenuBar")
- {
- setQMenuBarProperties(value,engine);
- }
- else if(className=="QPushButton")
- {
- setQPushButtonProperties(value,engine);
- }
- else if(className=="QSplitter")
- {
- setQSplitterProperties(value,engine);
- }
- else if(className=="QTableView")
- {
- if(object->property("tabletype").isValid())
- {
- if(object->property("tabletype").toString()=="SaltTable")
- {
- setSaltTableProperties(value,engine);
- }
- }
- }
- else if(className=="QVBoxLayout")
- {
- setQBoxLayoutProperties(value,engine);
- }
- else if(className=="QWidget")
- {
- setQWidgetProperties(value,engine);
- }
- else if(className=="ScriptQMainWindow")
- {
- setQMainWindowProperties(value,engine);
- }
- else if(className=="SqlComboBox")
- {
- setSqlComboBoxProperties(value,engine);
- }
- else if(className=="SqlQueryView")
- {
- setSqlQueryViewProperties(value,engine);
- }
- else if(className=="ZoomLog")
- {
- setZoomLogProperties(value,engine);
- }
- else if(className=="QTextEdit")
- {
- setQTextEditProperties(value,engine);
- }
- else if(className=="QWebView")
- {
- setQWebViewProperties(value,engine);
- }
- else if(className=="QLineEdit")
- {
- setQLineEditProperties(value,engine);
- }
- else if(className=="QSvgWidget")
- {
- setQSvgWidgetProperties(value,engine);
- }
-
- /*:261*/
- #line 6197 "./typica.w"
-
- }
- return value;
- }
-
- /*:260*//*263:*/
- #line 6337 "./typica.w"
-
- QScriptValue SaltTable_columnSum(QScriptContext*context,QScriptEngine*engine)
- {
- QTableView*self= getself<QTableView*> (context);
- SaltModel*model= qobject_cast<SaltModel*> (self->model());
- QString datum;
- double total= 0.0;
- int column= argument<int> (0,context);
- int role= argument<int> (1,context);
- for(int i= 0;i<model->rowCount();i++)
- {
- datum= model->data(model->index(i,column),role).toString();
- if(!datum.isEmpty())
- {
- total+= datum.toDouble();
- }
- }
- return QScriptValue(engine,total);
- }
-
- /*:263*//*264:*/
- #line 6361 "./typica.w"
-
- QScriptValue SaltTable_columnArray(QScriptContext*context,
- QScriptEngine*engine)
- {
- QTableView*self= getself<QTableView*> (context);
- SaltModel*model= qobject_cast<SaltModel*> (self->model());
- int column= argument<int> (0,context);
- int role= argument<int> (1,context);
- QString literal= model->arrayLiteral(column,role);
- return QScriptValue(engine,literal);
- }
-
- QScriptValue SaltTable_quotedColumnArray(QScriptContext*context,
- QScriptEngine*engine)
- {
- QTableView*self= getself<QTableView*> (context);
- SaltModel*model= qobject_cast<SaltModel*> (self->model());
- int column= argument<int> (0,context);
- int role= argument<int> (1,context);
- QString literal= model->quotedArrayLiteral(column,role);
- return QScriptValue(engine,literal);
- }
-
- QScriptValue SaltTable_bindableColumnArray(QScriptContext*context,
- QScriptEngine*engine)
- {
- QTableView*self= getself<QTableView*> (context);
- SaltModel*model= qobject_cast<SaltModel*> (self->model());
- int column= argument<int> (0,context);
- int role= argument<int> (1,context);
- QString literal= model->arrayLiteral(column,role);
- literal.chop(1);
- literal= literal.remove(0,1);
- return QScriptValue(engine,literal);
- }
-
- QScriptValue SaltTable_bindableQuotedColumnArray(QScriptContext*context,
- QScriptEngine*engine)
- {
- QTableView*self= getself<QTableView*> (context);
- SaltModel*model= qobject_cast<SaltModel*> (self->model());
- int column= argument<int> (0,context);
- int role= argument<int> (1,context);
- QString literal= model->quotedArrayLiteral(column,role);
- literal.chop(1);
- literal= literal.remove(0,1);
- return QScriptValue(engine,literal);
- }
-
- /*:264*//*265:*/
- #line 6413 "./typica.w"
-
- QScriptValue SaltTable_model(QScriptContext*context,QScriptEngine*engine)
- {
- QTableView*self= getself<QTableView*> (context);
- QScriptValue value= engine->newQObject(self->model());
- return value;
- }
-
- /*:265*//*266:*/
- #line 6427 "./typica.w"
-
- QScriptValue SaltTable_setData(QScriptContext*context,QScriptEngine*)
- {
- QTableView*self= getself<QTableView*> (context);
- int row= argument<int> (0,context);
- int column= argument<int> (1,context);
- QVariant value= argument<QVariant> (2,context);
- int role= argument<int> (3,context);
- SaltModel*model= qobject_cast<SaltModel*> (self->model());
- QModelIndex cell= model->index(row,column);
- model->setData(cell,value,role);
- self->update(cell);
- return QScriptValue();
- }
-
- /*:266*//*267:*/
- #line 6445 "./typica.w"
-
- QScriptValue SaltTable_data(QScriptContext*context,QScriptEngine*engine)
- {
- QTableView*self= getself<QTableView*> (context);
- int row= argument<int> (0,context);
- int column= argument<int> (1,context);
- int role= argument<int> (2,context);
- SaltModel*model= qobject_cast<SaltModel*> (self->model());
- QModelIndex cell= model->index(row,column);
- QVariant value= model->data(cell,role);
- QScriptValue retval= engine->newVariant(value);
- retval.setProperty("value",QScriptValue(value.toString()));
- return retval;
- }
-
- /*:267*//*268:*/
- #line 6465 "./typica.w"
-
- QScriptValue SaltTable_clear(QScriptContext*context,QScriptEngine*)
- {
- QTableView*self= getself<QTableView*> (context);
- SaltModel*model= qobject_cast<SaltModel*> (self->model());
- model->clear();
- return QScriptValue();
- }
-
- /*:268*//*269:*/
- #line 6477 "./typica.w"
-
- QScriptValue SaltTable_removeRow(QScriptContext*context,QScriptEngine*engine)
- {
- QTableView*self= getself<QTableView*> (context);
- SaltModel*model= qobject_cast<SaltModel*> (self->model());
- int row= argument<int> (0,context);
- return engine->newVariant(model->removeRow(row));
- }
-
- /*:269*//*270:*/
- #line 6490 "./typica.w"
-
- QScriptValue SaltTable_findData(QScriptContext*context,QScriptEngine*engine)
- {
- QTableView*self= getself<QTableView*> (context);
- SaltModel*model= qobject_cast<SaltModel*> (self->model());
- QVariant value= argument<QVariant> (0,context);
- int column= argument<int> (1,context);
- return engine->newVariant(model->findData(value,column));
- }
-
- /*:270*//*271:*/
- #line 6503 "./typica.w"
-
- void setSaltTableProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQWidgetProperties(value,engine);
- value.setProperty("columnArray",
- engine->newFunction(SaltTable_columnArray));
- value.setProperty("quotedColumnArray",
- engine->newFunction(SaltTable_quotedColumnArray));
- value.setProperty("bindableColumnArray",
- engine->newFunction(SaltTable_bindableColumnArray));
- value.setProperty("bindableQuotedColumnArray",
- engine->newFunction(SaltTable_bindableQuotedColumnArray));
- value.setProperty("columnSum",engine->newFunction(SaltTable_columnSum));
- value.setProperty("data",engine->newFunction(SaltTable_data));
- value.setProperty("model",engine->newFunction(SaltTable_model));
- value.setProperty("setData",engine->newFunction(SaltTable_setData));
- value.setProperty("clear",engine->newFunction(SaltTable_clear));
- value.setProperty("removeRow",engine->newFunction(SaltTable_removeRow));
- value.setProperty("findData",engine->newFunction(SaltTable_findData));
- }
-
- /*:271*//*273:*/
- #line 6540 "./typica.w"
-
- void setSqlComboBoxProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQComboBoxProperties(value,engine);
- }
-
- void setQComboBoxProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQWidgetProperties(value,engine);
- value.setProperty("currentData",
- engine->newFunction(QComboBox_currentData));
- value.setProperty("addItem",engine->newFunction(QComboBox_addItem));
- value.setProperty("setModel",engine->newFunction(QComboBox_setModel));
- value.setProperty("findText",engine->newFunction(QComboBox_findText));
- value.setProperty("findData",engine->newFunction(QComboBox_findData));
- }
-
- QScriptValue QComboBox_currentData(QScriptContext*context,
- QScriptEngine*engine)
- {
- QComboBox*self= getself<QComboBox*> (context);
- return QScriptValue(engine,
- self->itemData(self->currentIndex()).toString());
- }
-
- QScriptValue QComboBox_addItem(QScriptContext*context,QScriptEngine*)
- {
- QComboBox*self= getself<QComboBox*> (context);
- self->addItem(argument<QString> (0,context));
- return QScriptValue();
- }
-
- QScriptValue QComboBox_setModel(QScriptContext*context,QScriptEngine*)
- {
- QComboBox*self= getself<QComboBox*> (context);
- self->setModel(argument<QAbstractItemModel*> (0,context));
- return QScriptValue();
- }
-
- QScriptValue QComboBox_findText(QScriptContext*context,QScriptEngine*engine)
- {
- QComboBox*self= getself<QComboBox*> (context);
- return QScriptValue(engine,self->findText(argument<QString> (0,context)));
- }
-
- QScriptValue QComboBox_findData(QScriptContext*context,QScriptEngine*engine)
- {
- QComboBox*self= getself<QComboBox*> (context);
- return QScriptValue(engine,self->findData(argument<QVariant> (0,context)));
- }
-
- #line 1 "./abouttypica.w"
- /*:273*//*286:*/
- #line 401 "./units.w"
-
- QScriptValue Units_convertTemperature(QScriptContext*context,QScriptEngine*)
- {
- return QScriptValue(Units::convertTemperature(argument<double> (0,context),
- argument<Units::Unit> (1,context),
- argument<Units::Unit> (2,context)));
- }
-
- QScriptValue Units_convertRelativeTemperature(QScriptContext*context,
- QScriptEngine*)
- {
- return QScriptValue(Units::convertRelativeTemperature(
- argument<double> (0,context),
- argument<Units::Unit> (1,context),
- argument<Units::Unit> (2,context)));
- }
-
- QScriptValue Units_isTemperatureUnit(QScriptContext*context,QScriptEngine*)
- {
- return QScriptValue(Units::isTemperatureUnit(argument<Units::Unit> (0,context)));
- }
-
- QScriptValue Units_convertWeight(QScriptContext*context,QScriptEngine*)
- {
- return QScriptValue(Units::convertWeight(argument<double> (0,context),
- argument<Units::Unit> (1,context),
- argument<Units::Unit> (2,context)));
- }
-
- QScriptValue Units_isWeightUnit(QScriptContext*context,QScriptEngine*)
- {
- return QScriptValue(Units::isWeightUnit(argument<Units::Unit> (0,context)));
- }
-
- /*:286*//*289:*/
- #line 449 "./units.w"
-
- QScriptValue Unit_toScriptValue(QScriptEngine*engine,const Units::Unit&value)
- {
- return engine->newVariant(QVariant(value));
- }
-
- void Unit_fromScriptValue(const QScriptValue&sv,Units::Unit&value)
- {
- value= sv.toVariant().value<Units::Unit> ();
- }
-
- /*:289*//*299:*/
- #line 149 "./measurement.w"
-
- QScriptValue constructMeasurement(QScriptContext*context,QScriptEngine*engine)
- {
- QScriptValue object;
- if(context->argumentCount()==2||context->argumentCount()==3)
- {
- double measurement= argument<double> (0,context);
- QTime timestamp= argument<QTime> (1,context);
- Units::Unit unit= Units::Fahrenheit;
- if(context->argumentCount()==3)
- {
- unit= argument<Units::Unit> (2,context);
- }
- object= engine->toScriptValue<Measurement> (Measurement(measurement,timestamp,unit));
- setMeasurementProperties(object,engine);
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "Measurement::Measurement(). This method takes two "
- "or three arguments.");
- }
- return object;
- }
-
- /*:299*//*300:*/
- #line 176 "./measurement.w"
-
- void setMeasurementProperties(QScriptValue,QScriptEngine*)
- {
-
- }
-
- /*:300*//*301:*/
- #line 184 "./measurement.w"
-
- QScriptValue Measurement_toScriptValue(QScriptEngine*engine,const Measurement&measurement)
- {
- QVariant var;
- var.setValue(measurement);
- return engine->newVariant(var);
- }
-
- void Measurement_fromScriptValue(const QScriptValue&value,Measurement&measurement)
- {
- measurement= value.toVariant().value<Measurement> ();
- }
- #line 6609 "./typica.w"
-
- /*:301*//*319:*/
- #line 7187 "./typica.w"
-
- QScriptValue constructDAQ(QScriptContext*context,QScriptEngine*engine)
- {
- QScriptValue object;
- if(context->argumentCount()==1)
- {
- object= engine->newQObject(new DAQ(argument<QString> (0,context)),
- QScriptEngine::ScriptOwnership);
- setDAQProperties(object,engine);
- }
- else if(context->argumentCount()==2)
- {
- object= engine->newQObject(new DAQ(argument<QString> (0,context),
- argument<QString> (1,context)),
- QScriptEngine::ScriptOwnership);
- setDAQProperties(object,engine);
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to DAQ"
- "constructor. The DAQ constructor takes one"
- "string as an argument specifying a device name."
- "Example: Dev1");
- }
- return object;
- }
-
- /*:319*//*320:*/
- #line 7217 "./typica.w"
-
- void setDAQProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQObjectProperties(value,engine);
- value.setProperty("newChannel",engine->newFunction(DAQ_newChannel));
- }
-
- /*:320*//*321:*/
- #line 7227 "./typica.w"
-
- QScriptValue DAQ_newChannel(QScriptContext*context,QScriptEngine*engine)
- {
- DAQ*self= getself<DAQ*> (context);
- QScriptValue object;
- if(self)
- {
- object=
- engine->newQObject(self->newChannel(argument<int> (0,context),
- argument<int> (1,context)));
- setChannelProperties(object,engine);
- }
- return object;
- }
-
- /*:321*//*328:*/
- #line 7383 "./typica.w"
-
- QScriptValue constructFakeDAQ(QScriptContext*context,
- QScriptEngine*engine)
- {
- QScriptValue object;
- if(context->argumentCount()==1)
- {
- object=
- engine->newQObject(new FakeDAQ(argument<QString> (0,context)),
- QScriptEngine::ScriptOwnership);
- setFakeDAQProperties(object,engine);
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to DAQ"
- "constructor. The DAQ constructor takes one"
- "string as an argument specifying a device name."
- "Example: Dev1");
- }
- return object;
- }
-
- void setFakeDAQProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQObjectProperties(value,engine);
- value.setProperty("newChannel",engine->newFunction(FakeDAQ_newChannel));
- }
-
- QScriptValue FakeDAQ_newChannel(QScriptContext*context,QScriptEngine*engine)
- {
- FakeDAQ*self= getself<FakeDAQ*> (context);
- QScriptValue object;
- if(self)
- {
- object=
- engine->newQObject(self->newChannel(argument<int> (0,context),
- argument<int> (1,context)));
- setChannelProperties(object,engine);
- }
- return object;
- }
-
- /*:328*//*332:*/
- #line 7474 "./typica.w"
-
- void setChannelProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQObjectProperties(value,engine);
- }
-
- /*:332*//*339:*/
- #line 7666 "./typica.w"
-
- QScriptValue constructLinearCalibrator(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new LinearCalibrator(NULL));
- setLinearCalibratorProperties(object,engine);
- return object;
- }
-
- void setLinearCalibratorProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQObjectProperties(value,engine);
- }
-
- /*:339*//*344:*/
- #line 7804 "./typica.w"
-
- QScriptValue constructLinearSplineInterpolator(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new LinearSplineInterpolator(NULL));
- setLinearSplineInterpolatorProperties(object,engine);
- return object;
- }
-
- void setLinearSplineInterpolatorProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQObjectProperties(value,engine);
- }
-
-
- /*:344*//*354:*/
- #line 8013 "./typica.w"
-
- QScriptValue constructTemperatureDisplay(QScriptContext*,
- QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new TemperatureDisplay);
- setTemperatureDisplayProperties(object,engine);
- return object;
- }
-
- void setTemperatureDisplayProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQLCDNumberProperties(value,engine);
- value.setProperty("setDisplayUnits",
- engine->newFunction(TemperatureDisplay_setDisplayUnits));
- }
-
- /*:354*//*355:*/
- #line 8037 "./typica.w"
-
- QScriptValue TemperatureDisplay_setDisplayUnits(QScriptContext*context,QScriptEngine*)
- {
- TemperatureDisplay*self= getself<TemperatureDisplay*> (context);
- self->setDisplayUnits((Units::Unit)argument<int> (0,context));
- return QScriptValue();
- }
-
- /*:355*//*362:*/
- #line 8174 "./typica.w"
-
- QScriptValue constructMeasurementTimeOffset(QScriptContext*,
- QScriptEngine*engine)
- {
- QScriptValue object=
- engine->newQObject(new MeasurementTimeOffset(QTime::currentTime()));
- setMeasurementTimeOffsetProperties(object,engine);
- return object;
- }
-
- void setMeasurementTimeOffsetProperties(QScriptValue value,
- QScriptEngine*engine)
- {
- setQObjectProperties(value,engine);
- }
-
- /*:362*//*367:*/
- #line 8283 "./typica.w"
-
- QScriptValue constructThresholdDetector(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new ThresholdDetector(300));
- return object;
- }
-
- void setThresholdDetectorProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQObjectProperties(value,engine);
- }
-
- /*:367*//*372:*/
- #line 8380 "./typica.w"
-
- QScriptValue constructZeroEmitter(QScriptContext*context,
- QScriptEngine*engine)
- {
- QScriptValue object=
- engine->newQObject(new ZeroEmitter(argument<int> (0,context)));
- setZeroEmitterProperties(object,engine);
- return object;
- }
-
- void setZeroEmitterProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQObjectProperties(value,engine);
- }
-
- /*:372*//*377:*/
- #line 8460 "./typica.w"
-
- QScriptValue constructMeasurementAdapter(QScriptContext*context,
- QScriptEngine*engine)
- {
- QScriptValue object=
- engine->newQObject(new MeasurementAdapter(argument<int> (0,context)));
- setMeasurementAdapterProperties(object,engine);
- return object;
- }
-
- void setMeasurementAdapterProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQObjectProperties(value,engine);
- }
-
- /*:377*//*394:*/
- #line 8922 "./typica.w"
-
- QScriptValue constructGraphView(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new GraphView);
- setGraphViewProperties(object,engine);
- return object;
- }
-
- void setGraphViewProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQGraphicsViewProperties(value,engine);
- }
-
- /*:394*//*417:*/
- #line 9560 "./typica.w"
-
- QScriptValue constructZoomLog(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new ZoomLog);
- setZoomLogProperties(object,engine);
- return object;
- }
-
- void setZoomLogProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQTableViewProperties(value,engine);
- value.setProperty("saveXML",engine->newFunction(ZoomLog_saveXML));
- value.setProperty("saveCSV",engine->newFunction(ZoomLog_saveCSV));
- value.setProperty("saveState",engine->newFunction(ZoomLog_saveState));
- value.setProperty("restoreState",
- engine->newFunction(ZoomLog_restoreState));
- value.setProperty("lastTime",engine->newFunction(ZoomLog_lastTime));
- value.setProperty("saveTemporary",
- engine->newFunction(ZoomLog_saveTemporary));
- value.setProperty("setDisplayUnits",engine->newFunction(ZoomLog_setDisplayUnits));
- }
-
- /*:417*//*418:*/
- #line 9587 "./typica.w"
-
- QScriptValue ZoomLog_saveXML(QScriptContext*context,QScriptEngine*engine)
- {
- ZoomLog*self= getself<ZoomLog*> (context);
- bool retval= self->saveXML(argument<QIODevice*> (0,context));
- return QScriptValue(engine,retval);
- }
-
- QScriptValue ZoomLog_saveCSV(QScriptContext*context,QScriptEngine*engine)
- {
- ZoomLog*self= getself<ZoomLog*> (context);
- bool retval= self->saveCSV(argument<QIODevice*> (0,context));
- return QScriptValue(engine,retval);
- }
-
- QScriptValue ZoomLog_saveTemporary(QScriptContext*context,
- QScriptEngine*engine)
- {
- ZoomLog*self= getself<ZoomLog*> (context);
- QString filename= QDir::tempPath();
- filename.append("/");
- filename.append(QUuid::createUuid().toString());
- filename.append(".xml");
- QFile*file= new QFile(filename);
- self->saveXML(file);
- file->close();
- delete file;
- return QScriptValue(engine,filename);
- }
-
- /*:418*//*419:*/
- #line 9635 "./typica.w"
-
- QScriptValue ZoomLog_saveState(QScriptContext*context,QScriptEngine*)
- {
- ZoomLog*self= getself<ZoomLog*> (context);
- QString key= argument<QString> (0,context);
- int columns= argument<int> (1,context);
- QSettings settings;
- for(int i= 0;i<columns;i++)
- {
- if(self->columnWidth(i))
- {
- settings.beginGroup(key);
- settings.setValue(QString("%1").arg(i),self->columnWidth(i));
- settings.endGroup();
- }
- }
- return QScriptValue();
- }
-
- QScriptValue ZoomLog_restoreState(QScriptContext*context,QScriptEngine*)
- {
- ZoomLog*self= getself<ZoomLog*> (context);
- QString key= argument<QString> (0,context);
- int columns= argument<int> (1,context);
- QSettings settings;
- for(int i= 0;i<columns;i++)
- {
- settings.beginGroup(key);
- self->setColumnWidth(i,
- settings.value(QString("%1").arg(i),80).toInt());
- if(settings.value(QString("%1").arg(i),80).toInt()==0)
- {
- self->setColumnWidth(i,80);
- }
- settings.endGroup();
- }
- return QScriptValue();
- }
-
- QScriptValue ZoomLog_lastTime(QScriptContext*context,QScriptEngine*engine)
- {
- ZoomLog*self= getself<ZoomLog*> (context);
- return QScriptValue(engine,self->lastTime(argument<int> (0,context)));
- }
-
- /*:419*//*420:*/
- #line 9688 "./typica.w"
-
- QScriptValue ZoomLog_setDisplayUnits(QScriptContext*context,QScriptEngine*)
- {
- ZoomLog*self= getself<ZoomLog*> (context);
- self->setDisplayUnits((Units::Unit)argument<int> (0,context));
- return QScriptValue();
- }
-
- /*:420*//*455:*/
- #line 10508 "./typica.w"
-
- QScriptValue constructAnnotationButton(QScriptContext*context,
- QScriptEngine*engine)
- {
- QScriptValue object=
- engine->newQObject(new AnnotationButton(argument<QString> (0,context)));
- setAnnotationButtonProperties(object,engine);
- return object;
- }
-
- void setAnnotationButtonProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQPushButtonProperties(value,engine);
- }
-
- /*:455*//*463:*/
- #line 10651 "./typica.w"
-
- QScriptValue constructAnnotationSpinBox(QScriptContext*context,
- QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new AnnotationSpinBox(
- argument<QString> (0,context),argument<QString> (1,context)));
- setAnnotationSpinBoxProperties(object,engine);
- return object;
- }
-
- void setAnnotationSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQDoubleSpinBoxProperties(value,engine);
- }
-
- void setQDoubleSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQAbstractSpinBoxProperties(value,engine);
- }
-
- void setQAbstractSpinBoxProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQWidgetProperties(value,engine);
- }
-
- /*:463*//*484:*/
- #line 11074 "./typica.w"
-
- QScriptValue constructTimerDisplay(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new TimerDisplay);
- setTimerDisplayProperties(object,engine);
- return object;
- }
-
- void setTimerDisplayProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQLCDNumberProperties(value,engine);
- value.setProperty("setTimerMode",engine->newFunction(TimerDisplay_setTimerMode));
- }
-
- /*:484*//*485:*/
- #line 11093 "./typica.w"
-
- QScriptValue TimerDisplay_setTimerMode(QScriptContext*context,QScriptEngine*)
- {
- TimerDisplay*self= getself<TimerDisplay*> (context);
- if(self)
- {
- switch(argument<int> (0,context))
- {
- case 0:
- self->setMode(TimerDisplay::CountUp);
- break;
- case 1:
- self->setMode(TimerDisplay::CountDown);
- break;
- case 2:
- self->setMode(TimerDisplay::Clock);
- break;
- default:
- break;
- }
- }
- return QScriptValue();
- }
-
-
- /*:485*//*512:*/
- #line 11599 "./typica.w"
-
- QScriptValue constructWidgetDecorator(QScriptContext*context,
- QScriptEngine*engine)
- {
- QWidget*widget= argument<QWidget*> (0,context);
- QString text= argument<QString> (1,context);
- Qt::Orientations orientation;
- switch(argument<int> (2,context))
- {
- case 2:
- orientation= Qt::Vertical;
- break;
- default:
- orientation= Qt::Horizontal;
- break;
- }
- QScriptValue object=
- engine->newQObject(new WidgetDecorator(widget,text,orientation));
- setWidgetDecoratorProperties(object,engine);
- return object;
- }
-
- void setWidgetDecoratorProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQWidgetProperties(value,engine);
- }
-
- /*:512*//*525:*/
- #line 11880 "./typica.w"
-
- QScriptValue constructLogEditWindow(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new LogEditWindow);
- return object;
- }
-
- /*:525*//*544:*/
- #line 12407 "./typica.w"
-
- QScriptValue constructXMLInput(QScriptContext*context,QScriptEngine*engine)
- {
- QIODevice*device= argument<QIODevice*> (0,context);
- QScriptValue object= engine->newQObject(new XMLInput(&*device,
- argument<int> (1,context)));
- object.setProperty("input",engine->newFunction(XMLInput_input));
- return object;
- }
-
- QScriptValue XMLInput_input(QScriptContext*context,QScriptEngine*)
- {
- XMLInput*self= getself<XMLInput*> (context);
- self->input();
- return QScriptValue();
- }
-
- /*:544*//*558:*/
- #line 157 "./webview.w"
-
- QScriptValue constructWebView(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new TypicaWebView);
- setQWebViewProperties(object,engine);
- return object;
- }
-
- void setQWebViewProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQWidgetProperties(value,engine);
- }
-
- /*:558*//*559:*/
- #line 174 "./webview.w"
-
- void addWebViewToLayout(QDomElement element,QStack<QWidget*> *,
- QStack<QLayout*> *layoutStack)
- {
- TypicaWebView*view= new TypicaWebView;
- if(element.hasAttribute("id"))
- {
- view->setObjectName(element.attribute("id"));
- }
- QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
- layout->addWidget(view);
- }
-
- /*:559*//*564:*/
- #line 225 "./webview.w"
-
- QScriptValue QWebElement_toScriptValue(QScriptEngine*engine,const QWebElement&element)
- {
- QVariant var;
- var.setValue(element);
- QScriptValue object= engine->newVariant(var);
- return object;
- }
-
- void QWebElement_fromScriptValue(const QScriptValue&value,QWebElement&element)
- {
- element= value.toVariant().value<QWebElement> ();
- }
-
- /*:564*//*569:*/
- #line 290 "./webview.w"
-
- template<> QWebElement argument(int arg,QScriptContext*context)
- {
- return qscriptvalue_cast<QWebElement> (context->argument(arg));
- }
-
- /*:569*//*570:*/
- #line 299 "./webview.w"
-
- QScriptValue constructWebElement(QScriptContext*context,
- QScriptEngine*engine)
- {
- QWebElement element= argument<QWebElement> (0,context);
- QScriptValue object= engine->newQObject(new TypicaWebElement(element));
- return object;
- }
-
- /*:570*//*638:*/
- #line 13760 "./typica.w"
-
- QScriptValue constructSqlQueryView(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new SqlQueryView);
- setSqlQueryViewProperties(object,engine);
- return object;
- }
-
- void setSqlQueryViewProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQTableViewProperties(value,engine);
- value.setProperty("setHeaderData",
- engine->newFunction(SqlQueryView_setHeaderData));
- value.setProperty("setQuery",engine->newFunction(SqlQueryView_setQuery));
- }
-
- /*:638*//*639:*/
- #line 13778 "./typica.w"
-
- QScriptValue SqlQueryView_setQuery(QScriptContext*context,QScriptEngine*)
- {
- SqlQueryView*self= getself<SqlQueryView*> (context);
- QString query= argument<QString> (0,context);
- self->setQuery(query);
- self->reset();
- return QScriptValue();
- }
-
- QScriptValue SqlQueryView_setHeaderData(QScriptContext*context,
- QScriptEngine*)
- {
- SqlQueryView*self= getself<SqlQueryView*> (context);
- int section= argument<int> (0,context);
- QString data= argument<QString> (1,context);
- self->setHeaderData(section,Qt::Horizontal,data,Qt::DisplayRole);
- return QScriptValue();
- }
-
- /*:639*//*647:*/
- #line 13987 "./typica.w"
-
- void addReportToLayout(QDomElement element,QStack<QWidget*> *,
- QStack<QLayout*> *layoutStack)
- {
- QTextEdit*widget= new QTextEdit;
- if(element.hasAttribute("id"))
- {
- widget->setObjectName(element.attribute("id"));
- }
- QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
- layout->addWidget(widget);
- QTextDocument*document= new QTextDocument;
- QFont defaultFont;
- defaultFont.setPointSize(11);
- document->setDefaultFont(defaultFont);
- QTextCursor cursor(document);
- /*648:*/
- #line 14010 "./typica.w"
-
- QDomNodeList children= element.childNodes();
- for(int i= 0;i<children.count();i++)
- {
- QDomNode current;
- QDomElement currentElement;
- current= children.at(i);
- if(current.isElement())
- {
- currentElement= current.toElement();
- /*649:*/
- #line 14027 "./typica.w"
-
- if(currentElement.tagName()=="style")
- {
- document->setDefaultStyleSheet(currentElement.text());
- }
-
- /*:649*//*650:*/
- #line 14038 "./typica.w"
-
- if(currentElement.tagName()=="html")
- {
- cursor.insertHtml(currentElement.text());
- }
-
- /*:650*//*651:*/
- #line 14048 "./typica.w"
-
- if(currentElement.tagName()=="text")
- {
- cursor.insertText(currentElement.text());
- }
-
- /*:651*//*652:*/
- #line 14058 "./typica.w"
-
- if(currentElement.tagName()=="table")
- {
- QTextFrame*frame= cursor.insertFrame(QTextFrameFormat());
- ReportTable*table= new ReportTable(frame,currentElement);
- table->setParent(widget);
- if(currentElement.hasAttribute("id"))
- {
- table->setObjectName(currentElement.attribute("id"));
- }
- }
-
- /*:652*/
- #line 14020 "./typica.w"
-
- }
- }
-
- /*:648*/
- #line 14003 "./typica.w"
-
- widget->setDocument(document);
- }
-
- /*:647*//*663:*/
- #line 14271 "./typica.w"
-
- QScriptValue QTextEdit_print(QScriptContext*context,QScriptEngine*)
- {
- QTextEdit*self= getself<QTextEdit*> (context);
- QTextDocument*document= self->document();
- QPrinter printer;
-
- QPrintDialog printwindow(&printer,self);
- if(printwindow.exec()!=QDialog::Accepted)
- {
- return QScriptValue();
- }
- document->print(&printer);
- return QScriptValue();
- }
-
- /*:663*//*664:*/
- #line 14289 "./typica.w"
-
- void setQTextEditProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQAbstractScrollAreaProperties(value,engine);
- value.setProperty("print",engine->newFunction(QTextEdit_print));
- }
-
- #line 1 "./daterangeselector.w"
- /*:664*//*683:*/
- #line 461 "./daterangeselector.w"
-
- void addDateRangeToLayout(QDomElement element,QStack<QWidget*> *,
- QStack<QLayout*> *layoutStack)
- {
- DateRangeSelector*widget= new DateRangeSelector;
- if(element.hasAttribute("id"))
- {
- widget->setObjectName(element.attribute("id"));
- }
- if(element.hasAttribute("initial"))
- {
- widget->setCurrentIndex(element.attribute("initial").toInt());
- }
- QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
- layout->addWidget(widget);
- }
-
- /*:683*//*694:*/
- #line 14469 "./typica.w"
-
- void addFormArrayToLayout(QDomElement element,QStack<QWidget*> *,
- QStack<QLayout*> *layoutStack)
- {
- FormArray*widget= new FormArray(element);
- if(element.hasAttribute("id"))
- {
- widget->setObjectName(element.attribute("id"));
- }
- QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
- layout->addWidget(widget);
- }
-
- /*:694*//*715:*/
- #line 15056 "./typica.w"
-
- void addScaleControlToLayout(QDomElement element,QStack<QWidget*> *,
- QStack<QLayout*> *layoutStack)
- {
- ScaleControl*scale= new ScaleControl;
- if(element.hasAttribute("id"))
- {
- scale->setObjectName(element.attribute("id"));
- }
- QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
- layout->addWidget(scale);
- }
-
- void addIntensityControlToLayout(QDomElement element,QStack<QWidget*> *,
- QStack<QLayout*> *layoutStack)
- {
- IntensityControl*scale= new IntensityControl;
- if(element.hasAttribute("id"))
- {
- scale->setObjectName(element.attribute("id"));
- }
- QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
- layout->addWidget(scale);
- }
-
-
-
- /*:715*//*741:*/
- #line 15646 "./typica.w"
-
- QScriptValue constructDeviceTreeModel(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new DeviceTreeModel);
- setDeviceTreeModelProperties(object,engine);
- return object;
- }
-
- /*:741*//*743:*/
- #line 15669 "./typica.w"
-
- void setDeviceTreeModelProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQAbstractItemModelProperties(value,engine);
- value.setProperty("referenceElement",
- engine->newFunction(DeviceTreeModel_referenceElement));
- }
-
- void setQAbstractItemModelProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQObjectProperties(value,engine);
- value.setProperty("data",engine->newFunction(QAbstractItemModel_data));
- value.setProperty("index",engine->newFunction(QAbstractItemModel_index));
- value.setProperty("rowCount",engine->newFunction(QAbstractItemModel_rowCount));
- value.setProperty("hasChildren",engine->newFunction(QAbstractItemModel_hasChildren));
- }
-
- /*:743*//*744:*/
- #line 15696 "./typica.w"
-
- QScriptValue DeviceTreeModel_referenceElement(QScriptContext*context,
- QScriptEngine*engine)
- {
- DeviceTreeModel*model= getself<DeviceTreeModel*> (context);
- QDomElement referenceElement= model->referenceElement(argument<QString> (0,context));
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
- QVariantMap retval;
- retval.insert("driver",referenceElement.attribute("driver"));
- for(int i= 0;i<configData.size();i++)
- {
- node= configData.at(i).toElement();
- retval.insert(node.attribute("name"),node.attribute("value"));
- }
- return engine->toScriptValue(retval);
- }
-
- QScriptValue QAbstractItemModel_data(QScriptContext*context,QScriptEngine*engine)
- {
- QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
- QModelIndex index= argument<QModelIndex> (0,context);
- int role= argument<int> (1,context);
- return engine->toScriptValue(model->data(index,role));
- }
-
- QScriptValue QAbstractItemModel_index(QScriptContext*context,QScriptEngine*engine)
- {
- QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
- int row= 0;
- int column= 0;
- QModelIndex index;
- if(context->argumentCount()> 1)
- {
- row= argument<int> (0,context);
- column= argument<int> (1,context);
- }
- if(context->argumentCount()> 2)
- {
- index= argument<QModelIndex> (2,context);
- }
- QModelIndex retval= model->index(row,column,index);
- return engine->toScriptValue(retval);
- }
-
- QScriptValue QAbstractItemModel_rowCount(QScriptContext*context,
- QScriptEngine*)
- {
- QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
- QModelIndex index;
- if(context->argumentCount()==1)
- {
- index= argument<QModelIndex> (0,context);
- }
- return QScriptValue(model->rowCount(index));
- }
-
- QScriptValue QAbstractItemModel_hasChildren(QScriptContext*context,
- QScriptEngine*engine)
- {
- QAbstractItemModel*model= getself<QAbstractItemModel*> (context);
- QModelIndex index;
- if(context->argumentCount()==1)
- {
- index= argument<QModelIndex> (0,context);
- }
- return QScriptValue(engine,model->hasChildren(index));
- }
-
- /*:744*//*747:*/
- #line 15780 "./typica.w"
-
- QScriptValue QModelIndex_toScriptValue(QScriptEngine*engine,const QModelIndex&index)
- {
- QVariant var;
- var.setValue(index);
- QScriptValue object= engine->newVariant(var);
- return object;
- }
-
- void QModelIndex_fromScriptValue(const QScriptValue&value,QModelIndex&index)
- {
- index= value.toVariant().value<QModelIndex> ();
- }
-
- /*:747*//*763:*/
- #line 16078 "./typica.w"
-
- QScriptValue constructDeviceConfigurationWindow(QScriptContext*,
- QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new DeviceConfigurationWindow);
- return object;
- }
-
- /*:763*//*834:*/
- #line 47 "./settings.w"
-
- QScriptValue constructSettingsWindow(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new SettingsWindow);
- return object;
- }
-
- /*:834*//*859:*/
- #line 18728 "./typica.w"
-
- QScriptValue constructModbusRTUDevice(QScriptContext*context,QScriptEngine*engine)
- {
- QScriptValue object;
- if(context->argumentCount()==2)
- {
- object= engine->newQObject(new ModbusRTUDevice(argument<DeviceTreeModel*> (0,context),
- argument<QModelIndex> (1,context)),
- QScriptEngine::ScriptOwnership);
- setModbusRTUDeviceProperties(object,engine);
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "ModbusRTUDevice constructor. This takes the configuration model "
- "and an index.");
- }
- return object;
- }
-
- /*:859*//*860:*/
- #line 18750 "./typica.w"
-
- QScriptValue ModbusRTUDevice_pVChannel(QScriptContext*context,QScriptEngine*engine)
- {
- ModbusRTUDevice*self= getself<ModbusRTUDevice*> (context);
- QScriptValue object;
- if(self)
- {
- if(self->channels.size()> 0)
- {
- object= engine->newQObject(self->channels.at(0));
- setChannelProperties(object,engine);
- }
- }
- return object;
- }
-
- QScriptValue ModbusRTUDevice_sVChannel(QScriptContext*context,QScriptEngine*engine)
- {
- ModbusRTUDevice*self= getself<ModbusRTUDevice*> (context);
- QScriptValue object;
- if(self)
- {
- if(self->channels.size()> 1)
- {
- object= engine->newQObject(self->channels.at(1));
- setChannelProperties(object,engine);
- }
- }
- return object;
- }
-
- /*:860*//*861:*/
- #line 18783 "./typica.w"
-
- void setModbusRTUDeviceProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQObjectProperties(value,engine);
- value.setProperty("pVChannel",engine->newFunction(ModbusRTUDevice_pVChannel));
- value.setProperty("sVChannel",engine->newFunction(ModbusRTUDevice_sVChannel));
- }
-
- /*:861*//*879:*/
- #line 357 "./unsupportedserial.w"
-
- QScriptValue createDevice(QScriptContext*context,QScriptEngine*engine)
- {
- QModelIndex deviceIndex= argument<QModelIndex> (0,context);
- JavaScriptDevice*device= new JavaScriptDevice(deviceIndex,engine);
- QScriptValue object= engine->newQObject(device);
- setQObjectProperties(object,engine);
- object.setProperty("getChannel",engine->newFunction(JavaScriptDevice_getChannel));
- return object;
- }
-
- /*:879*//*884:*/
- #line 430 "./unsupportedserial.w"
-
- QScriptValue JavaScriptDevice_getChannel(QScriptContext*context,QScriptEngine*engine)
- {
- JavaScriptDevice*self= getself<JavaScriptDevice*> (context);
- QScriptValue object;
- if(self)
- {
- object= engine->newQObject(self->getChannel(argument<int> (0,context)));
- setChannelProperties(object,engine);
- }
- return object;
- }
-
- /*:884*//*891:*/
- #line 630 "./unsupportedserial.w"
-
- QScriptValue getMeasurementTimestamp(QScriptContext*,QScriptEngine*engine)
- {
- return engine->toScriptValue<QTime> (QTime::currentTime());
- }
-
- /*:891*//*895:*/
- #line 667 "./unsupportedserial.w"
-
- QScriptValue constructSerialPort(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new QextSerialPort());
- setSerialPortProperties(object,engine);
- return object;
- }
-
- /*:895*//*896:*/
- #line 678 "./unsupportedserial.w"
-
- void setSerialPortProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQIODeviceProperties(value,engine);
- value.setProperty("flush",engine->newFunction(SerialPort_flush));
- }
-
- /*:896*//*897:*/
- #line 687 "./unsupportedserial.w"
-
- QScriptValue SerialPort_flush(QScriptContext*context,QScriptEngine*)
- {
- QextSerialPort*self= getself<QextSerialPort*> (context);
- self->flush();
- return QScriptValue();
- }
-
- /*:897*//*900:*/
- #line 721 "./unsupportedserial.w"
-
- void setQTimerProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQObjectProperties(value,engine);
- }
-
- QScriptValue constructQTimer(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new QTimer);
- setQTimerProperties(object,engine);
- return object;
- }
-
-
-
-
- #line 19334 "./typica.w"
-
- #line 1 "./phidgets.w"
- /*:900*//*921:*/
- #line 463 "./phidgets.w"
-
- QScriptValue constructPhidgetsTemperatureSensor(QScriptContext*context,QScriptEngine*engine)
- {
- if(context->argumentCount()!=1)
- {
- context->throwError("Incorrect number of arguments passed to "
- "PhidgetsTemperatureSensor constructor. This takes "
- "a QModelIndex.");
- }
- QScriptValue object= engine->newQObject(new PhidgetsTemperatureSensor(argument<QModelIndex> (0,context)),QScriptEngine::ScriptOwnership);
- setQObjectProperties(object,engine);
- object.setProperty("getChannel",engine->newFunction(Phidgets_getChannel));
- return object;
- }
-
- /*:921*//*922:*/
- #line 480 "./phidgets.w"
-
- QScriptValue Phidgets_getChannel(QScriptContext*context,QScriptEngine*engine)
- {
- PhidgetsTemperatureSensor*self= getself<PhidgetsTemperatureSensor*> (context);
- QScriptValue object;
- if(self)
- {
- object= engine->newQObject(self->getChannel(argument<int> (0,context)));
- setChannelProperties(object,engine);
- }
- return object;
- }
- #line 19336 "./typica.w"
-
- /*:922*//*954:*/
- #line 151 "./rate.w"
-
- QScriptValue constructRateOfChange(QScriptContext*context,QScriptEngine*engine)
- {
- int cachetime= 1;
- int scaletime= 1;
- if(context->argumentCount()> 0)
- {
- cachetime= argument<int> (0,context);
- if(context->argumentCount()> 1)
- {
- scaletime= argument<int> (1,context);
- }
- }
- QScriptValue object= engine->newQObject(new RateOfChange(cachetime,scaletime));
- setRateOfChangeProperties(object,engine);
- return object;
- }
-
- void setRateOfChangeProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQObjectProperties(value,engine);
- }
-
- /*:954*//*979:*/
- #line 614 "./dataqsdk.w"
-
- QScriptValue constructDataqSdkDevice(QScriptContext*context,QScriptEngine*engine)
- {
- QScriptValue object;
- if(context->argumentCount()==1)
- {
- object= engine->newQObject(new DataqSdkDevice(argument<QString> (0,context)),
- QScriptEngine::ScriptOwnership);
- setDataqSdkDeviceProperties(object,engine);
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "DataqSdkDevice. The constructor takes one string "
- "as an argument specifying a device name. "
- "Example: Dev1");
- }
- return object;
- }
-
- /*:979*//*980:*/
- #line 637 "./dataqsdk.w"
-
- void setDataqSdkDeviceProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQObjectProperties(value,engine);
- value.setProperty("newChannel",engine->newFunction(DataqSdkDevice_newChannel));
- }
-
- /*:980*//*981:*/
- #line 647 "./dataqsdk.w"
-
- QScriptValue DataqSdkDevice_newChannel(QScriptContext*context,QScriptEngine*engine)
- {
- DataqSdkDevice*self= getself<DataqSdkDevice*> (context);
- QScriptValue object;
- if(self)
- {
- object= engine->newQObject(self->newChannel((Units::Unit)argument<int> (0,context)));
- setChannelProperties(object,engine);
- }
- return object;
- }
-
- /*:981*//*1006:*/
- #line 80 "./scales.w"
-
- QScriptValue constructDragLabel(QScriptContext*context,QScriptEngine*engine)
- {
- QScriptValue object;
- QString labelText= "";
- if(context->argumentCount()==1)
- {
- labelText= argument<QString> (0,context);
- }
- object= engine->newQObject(new DragLabel(labelText));
- setDragLabelProperties(object,engine);
- return object;
- }
-
- void setDragLabelProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQLabelProperties(value,engine);
- }
-
- /*:1006*//*1016:*/
- #line 272 "./scales.w"
-
- QScriptValue BaudRateType_toScriptValue(QScriptEngine*engine,const BaudRateType&value)
- {
- return engine->newVariant(QVariant((int)(value)));
- }
-
- void BaudRateType_fromScriptValue(const QScriptValue&sv,BaudRateType&value)
- {
- value= (BaudRateType)(sv.toVariant().toInt());
- }
-
- QScriptValue DataBitsType_toScriptValue(QScriptEngine*engine,const DataBitsType&value)
- {
- return engine->newVariant(QVariant((int)(value)));
- }
-
- void DataBitsType_fromScriptValue(const QScriptValue&sv,DataBitsType&value)
- {
- value= (DataBitsType)(sv.toVariant().toInt());
- }
-
- QScriptValue ParityType_toScriptValue(QScriptEngine*engine,const ParityType&value)
- {
- return engine->newVariant(QVariant((int)(value)));
- }
-
- void ParityType_fromScriptValue(const QScriptValue&sv,ParityType&value)
- {
- value= (ParityType)(sv.toVariant().toInt());
- }
-
- QScriptValue StopBitsType_toScriptValue(QScriptEngine*engine,const StopBitsType&value)
- {
- return engine->newVariant(QVariant((int)(value)));
- }
-
- void StopBitsType_fromScriptValue(const QScriptValue&sv,StopBitsType&value)
- {
- value= (StopBitsType)(sv.toVariant().toInt());
- }
-
- QScriptValue FlowType_toScriptValue(QScriptEngine*engine,const FlowType&value)
- {
- return engine->newVariant(QVariant((int)(value)));
- }
-
- void FlowType_fromScriptValue(const QScriptValue&sv,FlowType&value)
- {
- value= (FlowType)(sv.toVariant().toInt());
- }
-
- /*:1016*//*1019:*/
- #line 341 "./scales.w"
-
- void setSerialScaleProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQIODeviceProperties(value,engine);
- }
-
- /*:1019*//*1020:*/
- #line 349 "./scales.w"
-
- QScriptValue constructSerialScale(QScriptContext*context,QScriptEngine*engine)
- {
- QScriptValue object;
- if(context->argumentCount()==1)
- {
- object= engine->newQObject(new SerialScale(argument<QString> (0,context)));
- setSerialScaleProperties(object,engine);
- }
- else
- {
- context->throwError("Incorrect number of arguments passed to "
- "SerialScale. The constructor takes one string "
- "as an argument specifying a port name.");
- }
- return object;
- }
-
- /*:1020*//*1042:*/
- #line 278 "./valueannotation.w"
-
- QScriptValue constructValueAnnotation(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new ValueAnnotation);
- setValueAnnotationProperties(object,engine);
- return object;
- }
-
- void setValueAnnotationProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQObjectProperties(value,engine);
- }
- #line 19983 "./typica.w"
-
- /*:1042*/
- #line 530 "./typica.w"
-
- /*617:*/
- #line 13395 "./typica.w"
-
- void messageFileOutput(QtMsgType,const char*msg)
- {
- QFile output("Typica-"+QDate::currentDate().toString("yyyy-MM-dd")+".log");
- output.open(QIODevice::WriteOnly|QIODevice::Append);
- QTextStream outstream(&output);
- outstream<<msg<<"\r\n";
- }
-
- /*:617*/
- #line 531 "./typica.w"
-
- /*614:*/
- #line 13356 "./typica.w"
-
- int main(int argc,char**argv)
- {
- int*c= &argc;
- Application app(*c,argv);
- QSettings settings;
- /*615:*/
- #line 13382 "./typica.w"
-
- if(settings.value("settings/advanced/logging",false).toBool())
- {
- qInstallMsgHandler(messageFileOutput);
- }
-
- /*:615*/
- #line 13362 "./typica.w"
-
- /*618:*/
- #line 13408 "./typica.w"
-
- QStringList themeSearchPath= QIcon::themeSearchPaths();
- themeSearchPath.append(":/resources/icons/tango");
- QIcon::setThemeSearchPaths(themeSearchPath);
- QIcon::setThemeName(":/resources/icons/tango");
- app.setWindowIcon(QIcon(":/resources/icons/appicons/logo.svg"));
-
- /*:618*/
- #line 13363 "./typica.w"
-
- /*619:*/
- #line 13428 "./typica.w"
-
- QFile entypo(":/resources/fonts/entypo.ttf");
- entypo.open(QIODevice::ReadOnly);
- QFontDatabase::addApplicationFontFromData(entypo.readAll());
- entypo.close();
- QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-regular.otf");
- QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-bold.otf");
- QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-bolditalic.otf");
- QFontDatabase::addApplicationFont(":/resources/fonts/texgyrepagella-italic.otf");
- QWebSettings::globalSettings()->setFontFamily(QWebSettings::StandardFont,"Tex Gyre Pagella");
-
- /*:619*/
- #line 13364 "./typica.w"
-
-
- /*773:*/
- #line 16368 "./typica.w"
-
- app.registerDeviceConfigurationWidget("roaster",RoasterConfWidget::staticMetaObject);
-
- /*:773*//*783:*/
- #line 16610 "./typica.w"
-
- app.registerDeviceConfigurationWidget("nidaqmxbase",
- NiDaqMxBaseDriverConfWidget::staticMetaObject);
- app.registerDeviceConfigurationWidget("nidaqmxbase9211series",
- NiDaqMxBase9211ConfWidget::staticMetaObject);
- app.registerDeviceConfigurationWidget("ni9211seriestc",
- Ni9211TcConfWidget::staticMetaObject);
-
- /*:783*//*791:*/
- #line 16841 "./typica.w"
-
- app.registerDeviceConfigurationWidget("nidaqmx",NiDaqMxDriverConfWidget::staticMetaObject);
- app.registerDeviceConfigurationWidget("nidaqmx9211series",NiDaqMx9211ConfWidget::staticMetaObject);
- app.registerDeviceConfigurationWidget("nidaqmxtc01",NiDaqMxTc01ConfWidget::staticMetaObject);
-
- /*:791*//*815:*/
- #line 17806 "./typica.w"
-
- app.registerDeviceConfigurationWidget("modbusrtuport",ModbusRtuPortConfWidget::staticMetaObject);
- app.registerDeviceConfigurationWidget("modbusrtudevice",ModbusRtuDeviceConfWidget::staticMetaObject);
- app.registerDeviceConfigurationWidget("modbustemperaturepv",ModbusRtuDeviceTPvConfWidget::staticMetaObject);
- app.registerDeviceConfigurationWidget("modbustemperaturesv",ModbusRtuDeviceTSvConfWidget::staticMetaObject);
-
- /*:815*//*820:*/
- #line 17891 "./typica.w"
-
- app.registerDeviceConfigurationWidget("annotationbutton",AnnotationButtonConfWidget::staticMetaObject);
-
- /*:820*//*823:*/
- #line 17961 "./typica.w"
-
- app.registerDeviceConfigurationWidget("reconfigurablebutton",ReconfigurableAnnotationButtonConfWidget::staticMetaObject);
-
- /*:823*//*826:*/
- #line 18088 "./typica.w"
-
- app.registerDeviceConfigurationWidget("annotationspinbox",NoteSpinConfWidget::staticMetaObject);
-
- #line 1 "./freeannotation.w"
- /*:826*//*830:*/
- #line 57 "./freeannotation.w"
-
- app.registerDeviceConfigurationWidget("freeannotation",
- FreeAnnotationConfWidget::staticMetaObject);
- #line 18092 "./typica.w"
-
- #line 1 "./settings.w"
- /*:830*//*864:*/
- #line 19324 "./typica.w"
-
- app.registerDeviceConfigurationWidget("modbusrtu",ModbusConfigurator::staticMetaObject);
-
- /*:864*//*874:*/
- #line 264 "./unsupportedserial.w"
-
- app.registerDeviceConfigurationWidget("unsupporteddevicechannel",
- UnsupportedDeviceChannelConfWidget::staticMetaObject);
- app.registerDeviceConfigurationWidget("unsupporteddevice",
- UnsupportedSerialDeviceConfWidget::staticMetaObject);
-
- /*:874*//*908:*/
- #line 181 "./phidgets.w"
-
- app.registerDeviceConfigurationWidget("phidgets1048",
- PhidgetsTemperatureSensorConfWidget::staticMetaObject);
- app.registerDeviceConfigurationWidget("phidgets1048channel",
- PhidgetTemperatureSensorChannelConfWidget::staticMetaObject);
-
- /*:908*//*928:*/
- #line 19458 "./typica.w"
-
- app.registerDeviceConfigurationWidget("linearspline",LinearSplineInterpolationConfWidget::staticMetaObject);
-
- /*:928*//*931:*/
- #line 19518 "./typica.w"
-
- app.registerDeviceConfigurationWidget("coolingtimer",
- CoolingTimerConfWidget::staticMetaObject);
-
- /*:931*//*936:*/
- #line 19777 "./typica.w"
-
- app.registerDeviceConfigurationWidget("rangetimer",
- RangeTimerConfWidget::staticMetaObject);
-
- /*:936*//*941:*/
- #line 19878 "./typica.w"
-
- app.registerDeviceConfigurationWidget("multirangetimer",
- MultiRangeTimerConfWidget::staticMetaObject);
-
- /*:941*//*946:*/
- #line 19973 "./typica.w"
-
- app.registerDeviceConfigurationWidget("translation",TranslationConfWidget::staticMetaObject);
-
- #line 1 "./rate.w"
- /*:946*//*958:*/
- #line 253 "./rate.w"
-
- app.registerDeviceConfigurationWidget("rate",RateOfChangeConfWidget::staticMetaObject);
-
- /*:958*//*999:*/
- #line 1233 "./dataqsdk.w"
-
- app.registerDeviceConfigurationWidget("dataqsdk",DataqSdkDeviceConfWidget::staticMetaObject);
- app.registerDeviceConfigurationWidget("dataqsdkchannel",
- DataqSdkChannelConfWidget::staticMetaObject);
-
- /*:999*//*1024:*/
- #line 490 "./scales.w"
-
- app.registerDeviceConfigurationWidget("scale",SerialScaleConfWidget::staticMetaObject);
-
- /*:1024*//*1032:*/
- #line 138 "./valueannotation.w"
-
- app.registerDeviceConfigurationWidget("valueannotation",
- ValueAnnotationConfWidget::staticMetaObject);
-
- /*:1032*/
- #line 13366 "./typica.w"
-
- /*620:*/
- #line 13445 "./typica.w"
-
- if(settings.value("database/exists","false").toString()=="true")
- {
- /*625:*/
- #line 13574 "./typica.w"
-
- QSqlDatabase database=
- QSqlDatabase::addDatabase(settings.value("database/driver").toString());
- database.setConnectOptions("application_name=Typica");
- database.setHostName(settings.value("database/hostname").toString());
- database.setPort(settings.value("database/portnumber",5432).toInt());
- database.setDatabaseName(settings.value("database/dbname").toString());
- database.setUserName(settings.value("database/user").toString());
- database.setPassword(settings.value("database/password").toString());
- if(!database.open())
- {
- settings.setValue("database/exists","false");
- }
- else
- {
- database.close();
- }
-
- /*:625*/
- #line 13448 "./typica.w"
-
- }
- if(settings.value("database/exists","false").toString()=="false")
- {
- /*624:*/
- #line 13565 "./typica.w"
-
- SqlConnectionSetup dialog;
- dialog.exec();
-
- /*:624*/
- #line 13452 "./typica.w"
-
- }
-
-
- /*:620*/
- #line 13367 "./typica.w"
-
- /*189:*/
- #line 4332 "./typica.w"
-
- QStringList arguments= QCoreApplication::arguments();
- int position= arguments.indexOf("-c");
- QString filename= QString();
- if(position!=-1)
- {
- if(arguments.size()>=position+1)
- {
- filename= arguments.at(position+1);
- }
- }
- if(filename.isEmpty())
- {
- filename= QFileDialog::getOpenFileName(NULL,"Open Configuration File",
- settings.value("config","").toString());
- }
- QDir directory;
- if(!filename.isEmpty())
- {
- QFile file(filename);
- QFileInfo info(filename);
- directory= info.dir();
- QTextCodec::setCodecForTr(QTextCodec::codecForName("utf-8"));
- QTranslator*configtr= new QTranslator;
- if(configtr->load(QString("config.%1").arg(QLocale::system().name()),
- QString("%1/Translations").arg(directory.canonicalPath())))
- {
- QCoreApplication::installTranslator(configtr);
- }
- settings.setValue("config",directory.path());
- if(file.open(QIODevice::ReadOnly))
- {
- app.configuration()->setContent(&file,true);
- }
- }
- /*190:*/
- #line 4373 "./typica.w"
-
- QDomElement root= app.configuration()->documentElement();
- QDomNodeList children= root.childNodes();
- QString replacementDoc;
- QDomDocument includedDoc;
- QDomDocumentFragment fragment;
- for(int i= 0;i<children.size();i++)
- {
- QDomNode currentNode= children.at(i);
- QDomElement currentElement;
- if(currentNode.nodeName()=="include")
- {
- currentElement= currentNode.toElement();
- if(currentElement.hasAttribute("src"))
- {
- replacementDoc= directory.path();
- replacementDoc.append('/');
- replacementDoc.append(currentElement.attribute("src"));
- QFile doc(replacementDoc);
- if(doc.open(QIODevice::ReadOnly))
- {
- includedDoc.setContent(&doc,true);
- fragment= includedDoc.createDocumentFragment();
- fragment.appendChild(includedDoc.documentElement());
- root.replaceChild(fragment,currentNode);
- doc.close();
- }
- }
- }
- }
-
- /*:190*/
- #line 4367 "./typica.w"
-
-
- /*:189*/
- #line 13368 "./typica.w"
-
- /*7:*/
- #line 660 "./typica.w"
-
- QScriptEngine*engine= new QScriptEngine;
- QScriptValue constructor;
- QScriptValue value;
-
- /*:7*//*17:*/
- #line 857 "./typica.w"
-
- constructor= engine->newFunction(constructQWidget);
- value= engine->newQMetaObject(&QWidget::staticMetaObject,constructor);
- engine->globalObject().setProperty("QWidget",value);
-
- /*:17*//*21:*/
- #line 944 "./typica.w"
-
- constructor= engine->newFunction(displayWarning);
- engine->globalObject().setProperty("displayWarning",constructor);
- constructor= engine->newFunction(displayError);
- engine->globalObject().setProperty("displayError",constructor);
-
- /*:21*//*31:*/
- #line 1150 "./typica.w"
-
- constructor= engine->newFunction(constructQMainWindow);
- value= engine->newQMetaObject(&ScriptQMainWindow::staticMetaObject,
- constructor);
- engine->globalObject().setProperty("QMainWindow",value);
-
- /*:31*//*42:*/
- #line 1355 "./typica.w"
-
- constructor= engine->newFunction(constructQFrame);
- value= engine->newQMetaObject(&QFrame::staticMetaObject,constructor);
- engine->globalObject().setProperty("QFrame",value);
-
- /*:42*//*45:*/
- #line 1388 "./typica.w"
-
- constructor= engine->newFunction(constructQLabel);
- value= engine->newQMetaObject(&QLabel::staticMetaObject,constructor);
- engine->globalObject().setProperty("QLabel",value);
-
- /*:45*//*48:*/
- #line 1431 "./typica.w"
-
- constructor= engine->newFunction(constructQSvgWidget);
- value= engine->newQMetaObject(&QSvgWidget::staticMetaObject,constructor);
- engine->globalObject().setProperty("QSvgWidget",value);
-
- /*:48*//*54:*/
- #line 1513 "./typica.w"
-
- constructor= engine->newFunction(constructQLineEdit);
- value= engine->newQMetaObject(&QLineEdit::staticMetaObject,constructor);
- engine->globalObject().setProperty("QLineEdit",value);
-
- /*:54*//*58:*/
- #line 1560 "./typica.w"
-
- constructor= engine->newFunction(constructQSplitter);
- value= engine->newQMetaObject(&QSplitter::staticMetaObject,constructor);
- engine->globalObject().setProperty("QSplitter",value);
-
- /*:58*//*66:*/
- #line 1749 "./typica.w"
-
- constructor= engine->newFunction(constructQBoxLayout);
- value= engine->newQMetaObject(&QBoxLayout::staticMetaObject,constructor);
- engine->globalObject().setProperty("QBoxLayout",value);
-
- /*:66*//*70:*/
- #line 1861 "./typica.w"
-
- constructor= engine->newFunction(constructQAction);
- value= engine->newQMetaObject(&QAction::staticMetaObject,constructor);
- engine->globalObject().setProperty("QAction",value);
-
- /*:70*//*73:*/
- #line 1920 "./typica.w"
-
- value= engine->newQMetaObject(&QFileDialog::staticMetaObject);
- value.setProperty("getOpenFileName",
- engine->newFunction(QFileDialog_getOpenFileName));
- value.setProperty("getSaveFileName",
- engine->newFunction(QFileDialog_getSaveFileName));
- engine->globalObject().setProperty("QFileDialog",value);
-
- /*:73*//*78:*/
- #line 2038 "./typica.w"
-
- constructor= engine->newFunction(constructQFile);
- value= engine->newQMetaObject(&QFile::staticMetaObject,constructor);
- engine->globalObject().setProperty("QFile",value);
-
- /*:78*//*89:*/
- #line 2256 "./typica.w"
-
- constructor= engine->newFunction(constructQProcess);
- value= engine->newQMetaObject(&QProcess::staticMetaObject,constructor);
- engine->globalObject().setProperty("QProcess",value);
-
- /*:89*//*98:*/
- #line 2405 "./typica.w"
-
- qScriptRegisterMetaType(engine,QByteArray_toScriptValue,QByteArray_fromScriptValue);
- constructor= engine->newFunction(constructQByteArray);
- engine->globalObject().setProperty("QByteArray",constructor);
-
- /*:98*//*110:*/
- #line 2647 "./typica.w"
-
- engine->globalObject().setProperty("bytesFromInt8",engine->newFunction(bytesFromInt8));
- engine->globalObject().setProperty("bytesFromInt16",engine->newFunction(bytesFromInt16));
- engine->globalObject().setProperty("bytesFromInt32",engine->newFunction(bytesFromInt32));
- engine->globalObject().setProperty("bytesFromFloat",engine->newFunction(bytesFromFloat));
- engine->globalObject().setProperty("bytesFromDouble",engine->newFunction(bytesFromDouble));
-
- /*:110*//*113:*/
- #line 2750 "./typica.w"
-
- constructor= engine->newFunction(constructQBuffer);
- value= engine->newQMetaObject(&QBuffer::staticMetaObject,constructor);
- engine->globalObject().setProperty("QBuffer",value);
-
- /*:113*//*116:*/
- #line 2799 "./typica.w"
-
- constructor= engine->newFunction(constructXQuery);
- engine->globalObject().setProperty("XQuery",constructor);
-
- /*:116*//*122:*/
- #line 2901 "./typica.w"
-
- constructor= engine->newFunction(constructXmlWriter);
- engine->globalObject().setProperty("XmlWriter",constructor);
-
- /*:122*//*131:*/
- #line 3107 "./typica.w"
-
- constructor= engine->newFunction(constructXmlReader);
- engine->globalObject().setProperty("XmlReader",constructor);
-
- /*:131*//*138:*/
- #line 3231 "./typica.w"
-
- value= engine->newQObject(&settings);
- setQSettingsProperties(value,engine);
- engine->globalObject().setProperty("QSettings",value);
-
- /*:138*//*142:*/
- #line 3312 "./typica.w"
-
- constructor= engine->newFunction(constructQLCDNumber);
- value= engine->newQMetaObject(&QLCDNumber::staticMetaObject,constructor);
- engine->globalObject().setProperty("QLCDNumber",value);
-
- /*:142*//*145:*/
- #line 3368 "./typica.w"
-
- constructor= engine->newFunction(constructQTime);
- engine->globalObject().setProperty("QTime",constructor);
-
- /*:145*//*167:*/
- #line 3881 "./typica.w"
-
- constructor= engine->newFunction(constructQPushButton);
- value= engine->newQMetaObject(&QPushButton::staticMetaObject,constructor);
- engine->globalObject().setProperty("QPushButton",value);
-
- /*:167*//*174:*/
- #line 3992 "./typica.w"
-
- constructor= engine->newFunction(constructQSqlQuery);
- engine->globalObject().setProperty("QSqlQuery",constructor);
-
- /*:174*//*181:*/
- #line 4156 "./typica.w"
-
- engine->globalObject().setProperty("baseName",engine->newFunction(baseName));
- engine->globalObject().setProperty("dir",engine->newFunction(dir));
- engine->globalObject().setProperty("sqlToArray",
- engine->newFunction(sqlToArray));
- engine->globalObject().setProperty("setFont",engine->newFunction(setFont));
- engine->globalObject().setProperty("annotationFromRecord",
- engine->newFunction(annotationFromRecord));
- engine->globalObject().setProperty("setTabOrder",
- engine->newFunction(setTabOrder));
- engine->globalObject().setProperty("saveFileFromDatabase",
- engine->newFunction(saveFileFromDatabase));
- engine->globalObject().setProperty("TTR",engine->newFunction(scriptTr));
-
- /*:181*//*194:*/
- #line 4540 "./typica.w"
-
- engine->globalObject().setProperty("createWindow",
- engine->newFunction(createWindow));
- engine->globalObject().setProperty("createReport",
- engine->newFunction(createReport));
-
- /*:194*//*259:*/
- #line 6178 "./typica.w"
-
- engine->globalObject().setProperty("findChildObject",
- engine->newFunction(findChildObject));
-
- /*:259*//*285:*/
- #line 389 "./units.w"
-
- value= engine->newQMetaObject(&Units::staticMetaObject);
- value.setProperty("convertTemperature",engine->newFunction(Units_convertTemperature));
- value.setProperty("convertRelativeTemperature",
- engine->newFunction(Units_convertRelativeTemperature));
- value.setProperty("isTemperatureUnit",engine->newFunction(Units_isTemperatureUnit));
- value.setProperty("convertWeight",engine->newFunction(Units_convertWeight));
- value.setProperty("isWeightUnit",engine->newFunction(Units_isWeightUnit));
- engine->globalObject().setProperty("Units",value);
-
- /*:285*//*290:*/
- #line 462 "./units.w"
-
- qScriptRegisterMetaType(engine,Unit_toScriptValue,Unit_fromScriptValue);
-
- #line 6602 "./typica.w"
-
- /*:290*//*298:*/
- #line 141 "./measurement.w"
-
- constructor= engine->newFunction(constructMeasurement);
- engine->globalObject().setProperty("Measurement",constructor);
- qScriptRegisterMetaType(engine,Measurement_toScriptValue,Measurement_fromScriptValue);
-
- /*:298*//*318:*/
- #line 7173 "./typica.w"
-
- constructor= engine->newFunction(constructDAQ);
- value= engine->newQMetaObject(&DAQ::staticMetaObject,constructor);
- value.setProperty("Fahrenheit",Units::Fahrenheit);
- value.setProperty("Celsius",Units::Celsius);
- value.setProperty("Kelvin",Units::Kelvin);
- value.setProperty("Rankine",Units::Rankine);
- engine->globalObject().setProperty("DAQ",value);
-
- /*:318*//*327:*/
- #line 7375 "./typica.w"
-
- constructor= engine->newFunction(constructFakeDAQ);
- value= engine->newQMetaObject(&FakeDAQ::staticMetaObject,constructor);
- engine->globalObject().setProperty("FakeDAQ",value);
-
- /*:327*//*338:*/
- #line 7658 "./typica.w"
-
- constructor= engine->newFunction(constructLinearCalibrator);
- value= engine->newQMetaObject(&LinearCalibrator::staticMetaObject,
- constructor);
- engine->globalObject().setProperty("LinearCalibrator",value);
-
- /*:338*//*343:*/
- #line 7797 "./typica.w"
-
- constructor= engine->newFunction(constructLinearSplineInterpolator);
- value= engine->newQMetaObject(&LinearSplineInterpolator::staticMetaObject,constructor);
- engine->globalObject().setProperty("LinearSplineInterpolator",value);
-
- /*:343*//*353:*/
- #line 8005 "./typica.w"
-
- constructor= engine->newFunction(constructTemperatureDisplay);
- value= engine->newQMetaObject(&TemperatureDisplay::staticMetaObject,
- constructor);
- engine->globalObject().setProperty("TemperatureDisplay",value);
-
- /*:353*//*361:*/
- #line 8163 "./typica.w"
-
- constructor= engine->newFunction(constructMeasurementTimeOffset);
- value= engine->newQMetaObject(&MeasurementTimeOffset::staticMetaObject,
- constructor);
- engine->globalObject().setProperty("MeasurementTimeOffset",value);
-
- /*:361*//*366:*/
- #line 8274 "./typica.w"
-
- constructor= engine->newFunction(constructThresholdDetector);
- value= engine->newQMetaObject(&ThresholdDetector::staticMetaObject,constructor);
- engine->globalObject().setProperty("ThresholdDetector",value);
-
- /*:366*//*371:*/
- #line 8373 "./typica.w"
-
- constructor= engine->newFunction(constructZeroEmitter);
- value= engine->newQMetaObject(&ZeroEmitter::staticMetaObject,constructor);
- engine->globalObject().setProperty("ZeroEmitter",value);
-
- /*:371*//*376:*/
- #line 8452 "./typica.w"
-
- constructor= engine->newFunction(constructMeasurementAdapter);
- value= engine->newQMetaObject(&MeasurementAdapter::staticMetaObject,
- constructor);
- engine->globalObject().setProperty("MeasurementAdapter",value);
-
- /*:376*//*393:*/
- #line 8915 "./typica.w"
-
- constructor= engine->newFunction(constructGraphView);
- value= engine->newQMetaObject(&GraphView::staticMetaObject,constructor);
- engine->globalObject().setProperty("GraphView",value);
-
- /*:393*//*416:*/
- #line 9552 "./typica.w"
-
- constructor= engine->newFunction(constructZoomLog);
- value= engine->newQMetaObject(&ZoomLog::staticMetaObject,constructor);
- engine->globalObject().setProperty("ZoomLog",value);
-
- /*:416*//*454:*/
- #line 10500 "./typica.w"
-
- constructor= engine->newFunction(constructAnnotationButton);
- value= engine->newQMetaObject(&AnnotationButton::staticMetaObject,
- constructor);
- engine->globalObject().setProperty("AnnotationButton",value);
-
- /*:454*//*462:*/
- #line 10642 "./typica.w"
-
- constructor= engine->newFunction(constructAnnotationSpinBox);
- value= engine->newQMetaObject(&AnnotationSpinBox::staticMetaObject,
- constructor);
- engine->globalObject().setProperty("AnnotationSpinBox",value);
-
- /*:462*//*483:*/
- #line 11067 "./typica.w"
-
- constructor= engine->newFunction(constructTimerDisplay);
- value= engine->newQMetaObject(&TimerDisplay::staticMetaObject,constructor);
- engine->globalObject().setProperty("TimerDisplay",value);
-
- /*:483*//*511:*/
- #line 11591 "./typica.w"
-
- constructor= engine->newFunction(constructWidgetDecorator);
- value= engine->newQMetaObject(&WidgetDecorator::staticMetaObject,constructor);
- engine->globalObject().setProperty("WidgetDecorator",value);
-
- /*:511*//*524:*/
- #line 11873 "./typica.w"
-
- constructor= engine->newFunction(constructLogEditWindow);
- value= engine->newQMetaObject(&LogEditWindow::staticMetaObject,constructor);
- engine->globalObject().setProperty("LogEditWindow",value);
-
- /*:524*//*543:*/
- #line 12400 "./typica.w"
-
- constructor= engine->newFunction(constructXMLInput);
- value= engine->newQMetaObject(&XMLInput::staticMetaObject,constructor);
- engine->globalObject().setProperty("XMLInput",value);
-
- /*:543*//*557:*/
- #line 149 "./webview.w"
-
- constructor= engine->newFunction(constructWebView);
- value= engine->newQMetaObject(&TypicaWebView::staticMetaObject,constructor);
- engine->globalObject().setProperty("WebView",value);
-
- /*:557*//*565:*/
- #line 241 "./webview.w"
-
- qScriptRegisterMetaType(engine,QWebElement_toScriptValue,QWebElement_fromScriptValue);
-
- /*:565*//*568:*/
- #line 283 "./webview.w"
-
- constructor= engine->newFunction(constructWebElement);
- engine->globalObject().setProperty("WebElement",constructor);
-
- /*:568*//*579:*/
- #line 12643 "./typica.w"
-
- value= engine->newQObject(AppInstance);
- engine->globalObject().setProperty("Application",value);
-
- /*:579*//*637:*/
- #line 13752 "./typica.w"
-
- constructor= engine->newFunction(constructSqlQueryView);
- value= engine->newQMetaObject(&SqlQueryView::staticMetaObject,constructor);
- engine->globalObject().setProperty("SqlQueryView",value);
-
- /*:637*//*742:*/
- #line 15656 "./typica.w"
-
- constructor= engine->newFunction(constructDeviceTreeModel);
- value= engine->newQMetaObject(&DeviceTreeModel::staticMetaObject,
- constructor);
- engine->globalObject().setProperty("DeviceTreeModel",value);
-
- /*:742*//*748:*/
- #line 15796 "./typica.w"
-
- qScriptRegisterMetaType(engine,QModelIndex_toScriptValue,QModelIndex_fromScriptValue);
-
- /*:748*//*764:*/
- #line 16088 "./typica.w"
-
- constructor= engine->newFunction(constructDeviceConfigurationWindow);
- value= engine->newQMetaObject(&DeviceConfigurationWindow::staticMetaObject,
- constructor);
- engine->globalObject().setProperty("DeviceConfigurationWindow",value);
-
- /*:764*//*835:*/
- #line 56 "./settings.w"
-
- constructor= engine->newFunction(constructSettingsWindow);
- value= engine->newQMetaObject(&DeviceConfigurationWindow::staticMetaObject,constructor);
- engine->globalObject().setProperty("SettingsWindow",value);
-
- #line 1 "./graphsettings.w"
- /*:835*//*858:*/
- #line 18719 "./typica.w"
-
- constructor= engine->newFunction(constructModbusRTUDevice);
- value= engine->newQMetaObject(&ModbusRTUDevice::staticMetaObject,constructor);
- engine->globalObject().setProperty("ModbusRTUDevice",value);
-
- /*:858*//*878:*/
- #line 350 "./unsupportedserial.w"
-
- engine->globalObject().setProperty("createDevice",
- engine->newFunction(createDevice));
-
- /*:878*//*890:*/
- #line 622 "./unsupportedserial.w"
-
- engine->globalObject().setProperty("getMeasurementTimestamp",
- engine->newFunction(getMeasurementTimestamp));
-
- /*:890*//*894:*/
- #line 658 "./unsupportedserial.w"
-
- constructor= engine->newFunction(constructSerialPort);
- value= engine->newQMetaObject(&QextSerialPort::staticMetaObject,constructor);
- engine->globalObject().setProperty("SerialPort",value);
-
- /*:894*//*899:*/
- #line 713 "./unsupportedserial.w"
-
- constructor= engine->newFunction(constructQTimer);
- value= engine->newQMetaObject(&QTimer::staticMetaObject,constructor);
- engine->globalObject().setProperty("Timer",value);
-
- /*:899*//*919:*/
- #line 450 "./phidgets.w"
-
- constructor= engine->newFunction(constructPhidgetsTemperatureSensor);
- value= engine->newQMetaObject(&PhidgetsTemperatureSensor::staticMetaObject,constructor);
- engine->globalObject().setProperty("PhidgetsTemperatureSensor",value);
-
- /*:919*//*953:*/
- #line 144 "./rate.w"
-
- constructor= engine->newFunction(constructRateOfChange);
- value= engine->newQMetaObject(&RateOfChange::staticMetaObject,constructor);
- engine->globalObject().setProperty("RateOfChange",value);
-
- /*:953*//*978:*/
- #line 604 "./dataqsdk.w"
-
- constructor= engine->newFunction(constructDataqSdkDevice);
- value= engine->newQMetaObject(&DataqSdkDevice::staticMetaObject,constructor);
- engine->globalObject().setProperty("DataqSdkDevice",value);
-
- /*:978*//*1005:*/
- #line 73 "./scales.w"
-
- constructor= engine->newFunction(constructDragLabel);
- value= engine->newQMetaObject(&DragLabel::staticMetaObject,constructor);
- engine->globalObject().setProperty("DragLabel",value);
-
- /*:1005*//*1013:*/
- #line 239 "./scales.w"
-
- constructor= engine->newFunction(constructSerialScale);
- value= engine->newQMetaObject(&SerialScale::staticMetaObject,constructor);
- engine->globalObject().setProperty("SerialScale",value);
-
- /*:1013*//*1017:*/
- #line 325 "./scales.w"
-
- qScriptRegisterMetaType(engine,BaudRateType_toScriptValue,BaudRateType_fromScriptValue);
- qScriptRegisterMetaType(engine,DataBitsType_toScriptValue,DataBitsType_fromScriptValue);
- qScriptRegisterMetaType(engine,ParityType_toScriptValue,ParityType_fromScriptValue);
- qScriptRegisterMetaType(engine,StopBitsType_toScriptValue,StopBitsType_fromScriptValue);
- qScriptRegisterMetaType(engine,FlowType_toScriptValue,FlowType_fromScriptValue);
-
- /*:1017*//*1041:*/
- #line 271 "./valueannotation.w"
-
- constructor= engine->newFunction(constructValueAnnotation);
- value= engine->newQMetaObject(&ValueAnnotation::staticMetaObject,constructor);
- engine->globalObject().setProperty("ValueAnnotation",value);
-
- /*:1041*/
- #line 13369 "./typica.w"
-
- app.engine= engine;
- /*191:*/
- #line 4421 "./typica.w"
-
- QString styleText;
- QString programText;
- QDomElement currentElement;
- for(int i= 0;i<children.size();i++)
- {
- QDomNode currentNode= children.at(i);
- if(currentNode.nodeName()=="style")
- {
- currentElement= currentNode.toElement();
- styleText.append(currentElement.text());
- }
- else if(currentNode.nodeName()=="program")
- {
- currentElement= currentNode.toElement();
- programText.append(currentElement.text());
- }
- }
- app.setStyleSheet(styleText);
- QScriptValue result= engine->evaluate(programText);
- /*192:*/
- #line 4446 "./typica.w"
-
- if(engine->hasUncaughtException())
- {
- int line= engine->uncaughtExceptionLineNumber();
- qDebug()<<"Uncaught excpetion at line "<<line<<" : "<<
- result.toString();
- QString trace;
- foreach(trace,engine->uncaughtExceptionBacktrace())
- {
- qDebug()<<trace;
- }
- }
-
- /*:192*/
- #line 4441 "./typica.w"
-
-
- /*:191*/
- #line 13371 "./typica.w"
-
-
- int retval= app.exec();
- delete engine;
- return retval;
- }
-
- /*:614*/
- #line 532 "./typica.w"
-
- #include "moc_typica.cpp"
-
- /*:3*/
|