1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061 |
- /*16:*/
- #line 757 "./typica.w"
-
- #define PROGRAM_NAME "Typica"
-
- /*18:*/
- #line 849 "./typica.w"
-
- #include <QtCore>
- #include <QtGui>
- #include <QtScript>
- #include <QtScriptTools>
- #include <QtXml>
- #include <QtSql>
- #include <QtDebug>
- #include <QtXmlPatterns>
- #include <QtWebKit>
-
- /*:18*//*19:*/
- #line 864 "./typica.w"
-
- #include "helpmenu.h"
-
- /*:19*//*247:*/
- #line 5783 "./typica.w"
-
- #include "units.h"
-
- #line 1 "./measurement.w"
- /*:247*//*510:*/
- #line 192 "./webview.w"
-
- #include "webview.h"
-
- /*:510*//*523:*/
- #line 370 "./webview.w"
-
- #include "webelement.h"
-
- #line 11713 "./typica.w"
-
- /*:523*//*715:*/
- #line 15794 "./typica.w"
-
- #include "qextserialport.h"
- #include "qextserialenumerator.h"
-
- /*:715*//*810:*/
- #line 124 "./dataqsdk.w"
-
- #ifdef Q_OS_WIN32
- #include <windef.h>
- #else
- #define PASCAL
- #endif
-
- /*:810*//*834:*/
- #line 862 "./dataqsdk.w"
-
- #include <limits>
-
- /*:834*//*849:*/
- #line 62 "./scales.w"
-
- #include "draglabel.h"
-
- /*:849*//*864:*/
- #line 335 "./scales.w"
-
- #include "scale.h"
-
- /*:864*/
- #line 760 "./typica.w"
-
- /*33:*/
- #line 1168 "./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;
- };
-
- /*:33*//*143:*/
- #line 3366 "./typica.w"
-
- class SqlQueryConnection:public QSqlQuery
- {
- public:
- SqlQueryConnection(const QString&query= QString());
- ~SqlQueryConnection();
- QSqlQuery*operator->();
- private:
- QString connection;
- QSqlQuery*q;
- };
-
- /*:143*//*204:*/
- #line 5145 "./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;
- };
-
- /*:204*//*243:*/
- #line 433 "./units.w"
-
- Q_DECLARE_METATYPE(Units::Unit)
-
- /*:243*//*248:*/
- #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();
- };
-
- /*:248*//*253:*/
- #line 5847 "./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
- };
- };
-
- /*:253*//*254:*/
- #line 5885 "./typica.w"
-
- class DAQImplementation:public QThread
- {
- Q_OBJECT
- public:
- DAQImplementation(const QString&driverinfo);
- ~DAQImplementation();
- void run();
- void measure();
- /*255:*/
- #line 5905 "./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;
-
- /*:255*/
- #line 5894 "./typica.w"
-
- /*256:*/
- #line 5921 "./typica.w"
-
- bool useBase;
- QString device;
- QVector<Channel*> channelMap;
- unsigned int handle;
- int error;
- int channels;
- bool ready;
- QLibrary driver;
- QVector<Units::Unit> unitMap;
-
- /*:256*/
- #line 5895 "./typica.w"
-
- };
-
- /*:254*//*272:*/
- #line 6425 "./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();
- };
-
- /*:272*//*279:*/
- #line 6612 "./typica.w"
-
- class Channel:public QObject
- {
- Q_OBJECT
- public:
- Channel();
- ~Channel();
- public slots:
- void input(Measurement measurement);
- signals:
- void newData(Measurement);
- };
-
- /*:279*//*283:*/
- #line 6679 "./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;
- };
-
- /*:283*//*290:*/
- #line 6875 "./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;
- };
-
- /*:290*//*295:*/
- #line 7011 "./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);
- };
-
- /*:295*//*306:*/
- #line 7227 "./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);
- };
-
- /*:306*//*313:*/
- #line 7379 "./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;
- };
-
- /*:313*//*318:*/
- #line 7485 "./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);
- };
-
- /*:318*//*323:*/
- #line 7579 "./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);
- };
-
- /*:323*//*328:*/
- #line 7668 "./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();
- };
-
- /*:328*//*345:*/
- #line 8133 "./typica.w"
-
- class MeasurementModel;
- class ZoomLog:public QTableView
- {
- Q_OBJECT
- /*346:*/
- #line 8182 "./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;
-
- /*:346*/
- #line 8138 "./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);
- };
-
- /*:345*//*371:*/
- #line 8878 "./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);
- };
-
- /*:371*//*372:*/
- #line 8922 "./typica.w"
-
- class MeasurementList:public QVariantList
- {
- public:
- bool operator<(const MeasurementList&other)const;
- bool operator==(const MeasurementList&other)const;
- };
-
- /*:372*//*398:*/
- #line 9577 "./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);
- };
-
- /*:398*//*406:*/
- #line 9702 "./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);
- };
-
- /*:406*//*414:*/
- #line 9861 "./typica.w"
-
- class TimerDisplay:public QLCDNumber
- {
- Q_OBJECT
- /*415:*/
- #line 9911 "./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)
-
- /*:415*/
- #line 9865 "./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:
- /*416:*/
- #line 9921 "./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;
-
- /*:416*/
- #line 9902 "./typica.w"
-
- };
-
- /*:414*//*436:*/
- #line 10280 "./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);
- };
-
- /*:436*//*449:*/
- #line 10558 "./typica.w"
-
- class SceneButton:public QGraphicsScene
- {
- Q_OBJECT
- public:
- SceneButton();
- ~SceneButton();
- protected:
- void mousePressEvent(QGraphicsSceneMouseEvent*mouseEvent);
- signals:
- void clicked(QPoint pos);
- };
-
- /*:449*//*451:*/
- #line 10600 "./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);
- };
-
- /*:451*//*462:*/
- #line 10775 "./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();
- };
-
- /*:462*//*476:*/
- #line 11083 "./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();
- };
-
- /*:476*//*483:*/
- #line 11319 "./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);
- };
-
- /*:483*//*494:*/
- #line 11578 "./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();
- };
-
- /*:494*//*524:*/
- #line 11721 "./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();
- /*639:*/
- #line 14140 "./typica.w"
-
- QDomDocument deviceConfiguration();
-
- /*:639*//*672:*/
- #line 14813 "./typica.w"
-
- void registerDeviceConfigurationWidget(QString driver,QMetaObject widget);
- QWidget*deviceConfigurationWidget(DeviceTreeModel*model,
- const QModelIndex&index);
-
- /*:672*//*677:*/
- #line 14917 "./typica.w"
-
- QList<NodeInserter*> topLevelNodeInserters;
-
- /*:677*/
- #line 11732 "./typica.w"
-
- QSqlDatabase database();
- QScriptEngine*engine;
- public slots:
- /*640:*/
- #line 14147 "./typica.w"
-
- void saveDeviceConfiguration();
-
- /*:640*/
- #line 11736 "./typica.w"
-
- private:
- /*638:*/
- #line 14131 "./typica.w"
-
- QDomDocument deviceConfigurationDocument;
-
- /*:638*//*671:*/
- #line 14807 "./typica.w"
-
- QHash<QString,QMetaObject> deviceConfigurationWidgets;
-
- /*:671*/
- #line 11738 "./typica.w"
-
- QDomDocument conf;
- };
-
- /*:524*//*532:*/
- #line 11862 "./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;
- };
-
- /*:532*//*545:*/
- #line 12175 "./typica.w"
-
- class SqlComboBox:public QComboBox
- {
- Q_OBJECT
- int dataColumn;
- int displayColumn;
- bool dataColumnShown;
- 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);
- };
-
- /*:545*//*552:*/
- #line 12304 "./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;
- };
-
- /*:552*//*564:*/
- #line 12486 "./typica.w"
-
- class SqlConnectionSetup:public QDialog
- {
- Q_OBJECT
- public:
- SqlConnectionSetup();
- ~SqlConnectionSetup();
- public slots:
- void testConnection();
- private:
- QFormLayout*formLayout;
- QComboBox*driver;
- QLineEdit*hostname;
- QLineEdit*dbname;
- QLineEdit*user;
- QLineEdit*password;
- QVBoxLayout*layout;
- QHBoxLayout*buttons;
- QPushButton*cancelButton;
- QPushButton*connectButton;
- };
-
- /*:564*//*569:*/
- #line 12616 "./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);
- };
-
- /*:569*//*584:*/
- #line 12864 "./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;
- };
-
- /*:584*//*596:*/
- #line 13073 "./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();
- };
-
- /*:596*//*608:*/
- #line 13309 "./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);
- };
-
- /*:608*//*618:*/
- #line 13525 "./typica.w"
-
- class ScaleControl:public QGraphicsView
- {
- Q_OBJECT
- Q_PROPERTY(double initialValue READ initialValue WRITE setInitialValue)
- Q_PROPERTY(double finalValue READ finalValue WRITE setFinalValue)
- /*619:*/
- #line 13551 "./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;
-
- /*:619*/
- #line 13531 "./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);
- };
-
- /*:618*//*630:*/
- #line 13848 "./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);
- };
-
- /*:630*//*646:*/
- #line 14236 "./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;
- };
-
- /*:646*//*648:*/
- #line 14311 "./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;
- };
-
- /*:648*//*667:*/
- #line 14765 "./typica.w"
-
- Q_DECLARE_METATYPE(QModelIndex)
-
- /*:667*//*675:*/
- #line 14872 "./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;
- };
-
- /*:675*//*678:*/
- #line 14927 "./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;
- };
-
- /*:678*//*687:*/
- #line 15096 "./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;
- };
-
- /*:687*//*691:*/
- #line 15181 "./typica.w"
-
- class RoasterConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE RoasterConfWidget(DeviceTreeModel*model,
- const QModelIndex&index);
- private slots:
- void updateRoasterId(int id);
- };
-
- /*:691*//*696:*/
- #line 15316 "./typica.w"
-
- class NiDaqMxBaseDriverConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE NiDaqMxBaseDriverConfWidget(DeviceTreeModel*model,
- const QModelIndex&index);
- };
-
- /*:696*//*698:*/
- #line 15362 "./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);
- };
-
- /*:698*//*702:*/
- #line 15448 "./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);
- };
-
- /*:702*//*707:*/
- #line 15564 "./typica.w"
-
- class NiDaqMxDriverConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE NiDaqMxDriverConfWidget(DeviceTreeModel*model,
- const QModelIndex&index);
- };
-
- /*:707*//*709:*/
- #line 15605 "./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);
- };
-
- /*:709*//*711:*/
- #line 15674 "./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);
- };
-
- /*:711*//*716:*/
- #line 15805 "./typica.w"
-
- class PortSelector:public QComboBox
- {
- Q_OBJECT
- public:
- PortSelector(QWidget*parent= NULL);
- private slots:
- void addDevice(QextPortInfo port);
- private:
- QextSerialEnumerator*lister;
- };
-
- /*:716*//*718:*/
- #line 15853 "./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
- };
- };
-
- /*:718*//*720:*/
- #line 15924 "./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
- };
- };
-
- /*:720*//*722:*/
- #line 15962 "./typica.w"
-
- class FlowSelector:public QComboBox
- {
- Q_OBJECT
- Q_ENUMS(FlowType)
- public:
- FlowSelector(QWidget*parent= NULL);
- enum FlowType
- {
- FLOW_OFF,
- FLOW_HARDWARE,
- FLOW_XONXOFF
- };
- };
-
- /*:722*//*724:*/
- #line 15995 "./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
- };
- };
-
- /*:724*//*727:*/
- #line 16048 "./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;
- };
-
- /*:727*//*729:*/
- #line 16110 "./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);
- };
-
- /*:729*//*731:*/
- #line 16261 "./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;
- };
-
- /*:731*//*733:*/
- #line 16520 "./typica.w"
-
- class ModbusRtuDeviceTPvConfWidget:public BasicDeviceConfigurationWidget
- {
- Q_OBJECT
- public:
- Q_INVOKABLE ModbusRtuDeviceTPvConfWidget(DeviceTreeModel*model,
- const QModelIndex&index);
- private slots:
- void updateAddress(int newAddress);
- };
-
- /*:733*//*735:*/
- #line 16566 "./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;
- };
-
- /*:735*//*739:*/
- #line 16760 "./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);
- };
-
- /*:739*//*743:*/
- #line 16828 "./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);
- };
-
- /*:743*//*746:*/
- #line 16902 "./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);
- };
-
- /*:746*//*749:*/
- #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);
- };
-
- /*:749*//*753:*/
- #line 11 "./settings.w"
-
- class SettingsWindow:public QMainWindow
- {
- Q_OBJECT
- public:
- SettingsWindow();
- };
-
- /*:753*//*758:*/
- #line 8 "./graphsettings.w"
-
- class GraphSettingsWidget:public QWidget
- {
- Q_OBJECT
- public:
- GraphSettingsWidget();
- };
-
- /*:758*//*760:*/
- #line 44 "./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;
- };
-
- /*:760*//*764:*/
- #line 17027 "./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);
- private:
- QextSerialPort*port;
- QByteArray responseBuffer;
- QList<QByteArray> messageQueue;
- QList<QObject*> retObjQueue;
- QList<char*> callbackQueue;
- quint16 calculateCRC(QByteArray data);
- QTimer*messageDelayTimer;
- 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;
- };
-
- /*:764*//*779:*/
- #line 17699 "./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;
- };
-
- /*:779*//*783:*/
- #line 18233 "./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;
- };
-
- /*:783*//*789:*/
- #line 18357 "./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;
- };
-
- /*:789*//*793:*/
- #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;
- QMap<double,double> smoothCache;
- };
-
- /*:793*//*801:*/
- #line 196 "./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);
- };
-
- /*:801*//*807:*/
- #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();
- };
-
- /*:807*//*808:*/
- #line 49 "./dataqsdk.w"
-
- class DataqSdkDeviceImplementation:public QThread
- {
- Q_OBJECT
- public:
- DataqSdkDeviceImplementation();
- ~DataqSdkDeviceImplementation();
- void run();
- /*809:*/
- #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;
-
- /*:809*/
- #line 57 "./dataqsdk.w"
-
- /*811:*/
- #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;
-
- /*:811*/
- #line 58 "./dataqsdk.w"
-
- public slots:
- void measure();
- private:
- qint16*buffer;
- };
-
- /*:808*//*828:*/
- #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;
- };
-
- /*:828*//*833:*/
- #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;
- /*838:*/
- #line 1098 "./dataqsdk.w"
-
- bool autoSelect;
- QString deviceID;
- int channelOfInterest;
-
- /*:838*/
- #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;
- };
-
- /*:833*//*860:*/
- #line 247 "./scales.w"
-
- Q_DECLARE_METATYPE(BaudRateType)
- Q_DECLARE_METATYPE(DataBitsType)
- Q_DECLARE_METATYPE(ParityType)
- Q_DECLARE_METATYPE(StopBitsType)
- Q_DECLARE_METATYPE(FlowType)
-
- /*:860*//*867:*/
- #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;
- };
-
- /*:867*//*872:*/
- #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;
- };
-
- /*:872*//*880:*/
- #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;
- };
-
- /*:880*/
- #line 761 "./typica.w"
-
- /*25:*/
- #line 1029 "./typica.w"
-
- void setQObjectProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:25*//*27:*/
- #line 1044 "./typica.w"
-
- void setQPaintDeviceProperties(QScriptValue value,QScriptEngine*engine);
- void setQLayoutItemProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:27*//*29:*/
- #line 1069 "./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);
-
- /*:29*//*40:*/
- #line 1313 "./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);
-
- /*:40*//*45:*/
- #line 1412 "./typica.w"
-
- void setQMenuBarProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue QMenuBar_addMenu(QScriptContext*context,QScriptEngine*engine);
-
- /*:45*//*48:*/
- #line 1457 "./typica.w"
-
- void setQMenuProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue QMenu_addAction(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QMenu_addSeparator(QScriptContext*context,QScriptEngine*engine);
-
- /*:48*//*51:*/
- #line 1523 "./typica.w"
-
- void setQFrameProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue constructQFrame(QScriptContext*context,QScriptEngine*engine);
-
- /*:51*//*54:*/
- #line 1556 "./typica.w"
-
- void setQLabelProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue constructQLabel(QScriptContext*context,QScriptEngine*engine);
-
- /*:54*//*57:*/
- #line 1594 "./typica.w"
-
- void setQLineEditProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue constructQLineEdit(QScriptContext*context,QScriptEngine*engine);
-
- /*:57*//*61:*/
- #line 1633 "./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);
- void setQSplitterProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:61*//*66:*/
- #line 1752 "./typica.w"
-
- void setQLayoutProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue QLayout_addWidget(QScriptContext*context,QScriptEngine*engine);
-
- /*:66*//*68:*/
- #line 1807 "./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);
-
- /*:68*//*72:*/
- #line 1920 "./typica.w"
-
- QScriptValue constructQAction(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QAction_setShortcut(QScriptContext*context,
- QScriptEngine*engine);
- void setQActionProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:72*//*75:*/
- #line 1976 "./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);
-
- /*:75*//*80:*/
- #line 2087 "./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);
-
- /*:80*//*87:*/
- #line 2209 "./typica.w"
-
- QScriptValue constructQBuffer(QScriptContext*context,QScriptEngine*engine);
- void setQBufferProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue QBuffer_setData(QScriptContext*context,QScriptEngine*engine);
-
- /*:87*//*90:*/
- #line 2254 "./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);
- void setXQueryProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:90*//*96:*/
- #line 2327 "./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);
-
- /*:96*//*105:*/
- #line 2545 "./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);
-
- /*:105*//*112:*/
- #line 2680 "./typica.w"
-
- QScriptValue QSettings_value(QScriptContext*context,QScriptEngine*engine);
- QScriptValue QSettings_setValue(QScriptContext*context,QScriptEngine*engine);
- void setQSettingsProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:112*//*116:*/
- #line 2762 "./typica.w"
-
- QScriptValue constructQLCDNumber(QScriptContext*context,
- QScriptEngine*engine);
- void setQLCDNumberProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:116*//*119:*/
- #line 2800 "./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);
-
- /*:119*//*134:*/
- #line 3269 "./typica.w"
-
- void setQAbstractScrollAreaProperties(QScriptValue value,
- QScriptEngine*engine);
-
- /*:134*//*136:*/
- #line 3284 "./typica.w"
-
- void setQAbstractItemViewProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:136*//*138:*/
- #line 3297 "./typica.w"
-
- void setQGraphicsViewProperties(QScriptValue value,QScriptEngine*engine);
- void setQTableViewProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:138*//*140:*/
- #line 3321 "./typica.w"
-
- void setQAbstractButtonProperties(QScriptValue value,QScriptEngine*engine);
- void setQPushButtonProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue constructQPushButton(QScriptContext*context,
- QScriptEngine*engine);
-
- /*:140*//*147:*/
- #line 3420 "./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);
-
- /*:147*//*154:*/
- #line 3590 "./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);
-
- /*:154*//*165:*/
- #line 3873 "./typica.w"
-
- QScriptValue createWindow(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);
-
- /*:165*//*216:*/
- #line 5398 "./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);
-
- /*:216*//*217:*/
- #line 5413 "./typica.w"
-
- QScriptValue findChildObject(QScriptContext*context,QScriptEngine*engine);
-
- /*:217*//*221:*/
- #line 5544 "./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);
-
- /*:221*//*228:*/
- #line 5714 "./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);
-
- /*:228*//*240:*/
- #line 374 "./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);
-
- /*:240*//*244:*/
- #line 438 "./units.w"
-
- QScriptValue Unit_toScriptValue(QScriptEngine*engine,const Units::Unit&value);
- void Unit_fromScriptValue(const QScriptValue&sv,Units::Unit&value);
-
- /*:244*//*267:*/
- #line 6340 "./typica.w"
-
- QScriptValue constructDAQ(QScriptContext*context,QScriptEngine*engine);
- QScriptValue DAQ_newChannel(QScriptContext*context,QScriptEngine*engine);
- void setDAQProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:267*//*276:*/
- #line 6545 "./typica.w"
-
- QScriptValue constructFakeDAQ(QScriptContext*context,QScriptEngine*engine);
- QScriptValue FakeDAQ_newChannel(QScriptContext*context,QScriptEngine*engine);
- void setFakeDAQProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:276*//*281:*/
- #line 6646 "./typica.w"
-
- void setChannelProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:281*//*287:*/
- #line 6828 "./typica.w"
-
- QScriptValue constructLinearCalibrator(QScriptContext*context,
- QScriptEngine*engine);
- void setLinearCalibratorProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:287*//*292:*/
- #line 6968 "./typica.w"
-
- QScriptValue constructLinearSplineInterpolator(QScriptContext*context,QScriptEngine*engine);
- void setLinearSplineInterpolatorProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:292*//*302:*/
- #line 7170 "./typica.w"
-
- QScriptValue constructTemperatureDisplay(QScriptContext*context,
- QScriptEngine*engine);
- void setTemperatureDisplayProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue TemperatureDisplay_setDisplayUnits(QScriptContext*context,
- QScriptEngine*engine);
-
- /*:302*//*310:*/
- #line 7329 "./typica.w"
-
- QScriptValue constructMeasurementTimeOffset(QScriptContext*context,
- QScriptEngine*engine);
- void setMeasurementTimeOffsetProperties(QScriptValue value,
- QScriptEngine*engine);
-
- /*:310*//*315:*/
- #line 7442 "./typica.w"
-
- QScriptValue constructThresholdDetector(QScriptContext*context,QScriptEngine*engine);
- void setThresholdDetectorProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:315*//*320:*/
- #line 7540 "./typica.w"
-
- QScriptValue constructZeroEmitter(QScriptContext*context,
- QScriptEngine*engine);
- void setZeroEmitterProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:320*//*325:*/
- #line 7619 "./typica.w"
-
- QScriptValue constructMeasurementAdapter(QScriptContext*context,
- QScriptEngine*engine);
- void setMeasurementAdapterProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:325*//*342:*/
- #line 8083 "./typica.w"
-
- void setGraphViewProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue constructGraphView(QScriptContext*context,QScriptEngine*engine);
-
- /*:342*//*365:*/
- #line 8710 "./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);
-
- /*:365*//*403:*/
- #line 9664 "./typica.w"
-
- QScriptValue constructAnnotationButton(QScriptContext*context,
- QScriptEngine*engine);
- void setAnnotationButtonProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:403*//*411:*/
- #line 9804 "./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);
-
- /*:411*//*432:*/
- #line 10227 "./typica.w"
-
- QScriptValue constructTimerDisplay(QScriptContext*context,
- QScriptEngine*engine);
- void setTimerDisplayProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:432*//*459:*/
- #line 10721 "./typica.w"
-
- void setWidgetDecoratorProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue constructWidgetDecorator(QScriptContext*context,
- QScriptEngine*engine);
-
- /*:459*//*472:*/
- #line 11004 "./typica.w"
-
- QScriptValue constructLogEditWindow(QScriptContext*context,
- QScriptEngine*engine);
-
- /*:472*//*491:*/
- #line 11536 "./typica.w"
-
- QScriptValue constructXMLInput(QScriptContext*context,QScriptEngine*engine);
- QScriptValue XMLInput_input(QScriptContext*context,QScriptEngine*engine);
-
- /*:491*//*509:*/
- #line 184 "./webview.w"
-
- QScriptValue constructWebView(QScriptContext*context,QScriptEngine*engine);
- void setQWebViewProperties(QScriptValue value,QScriptEngine*engine);
- void addWebViewToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
-
- /*:509*//*512:*/
- #line 214 "./webview.w"
-
- QScriptValue QWebElement_toScriptValue(QScriptEngine*engine,const QWebElement&element);
- void QWebElement_fromScriptValue(const QScriptValue&value,QWebElement&element);
-
- /*:512*//*516:*/
- #line 272 "./webview.w"
-
- QScriptValue constructWebElement(QScriptContext*context,
- QScriptEngine*engine);
-
- /*:516*//*579:*/
- #line 12751 "./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);
-
- /*:579*//*589:*/
- #line 12980 "./typica.w"
-
- void addReportToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
-
- /*:589*//*605:*/
- #line 13264 "./typica.w"
-
- void setQTextEditProperties(QScriptValue value,QScriptEngine*engine);
- QScriptValue QTextEdit_print(QScriptContext*context,QScriptEngine*engine);
-
- /*:605*//*615:*/
- #line 13459 "./typica.w"
-
- void addFormArrayToLayout(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
-
- /*:615*//*636:*/
- #line 14043 "./typica.w"
-
- void addScaleControlToLayout(QDomElement element,
- QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
- void addIntensityControlToLayout(QDomElement element,
- QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack);
-
- /*:636*//*662:*/
- #line 14629 "./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);
-
- /*:662*//*668:*/
- #line 14771 "./typica.w"
-
- QScriptValue QModelIndex_toScriptValue(QScriptEngine*engine,const QModelIndex&index);
- void QModelIndex_fromScriptValue(const QScriptValue&value,QModelIndex&index);
-
- /*:668*//*684:*/
- #line 15068 "./typica.w"
-
- QScriptValue constructDeviceConfigurationWindow(QScriptContext*context,
- QScriptEngine*engine);
-
- /*:684*//*755:*/
- #line 37 "./settings.w"
-
- QScriptValue constructSettingsWindow(QScriptContext*context,QScriptEngine*engine);
-
- /*:755*//*774:*/
- #line 17606 "./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);
-
- /*:774*//*798:*/
- #line 157 "./rate.w"
-
- QScriptValue constructRateOfChange(QScriptContext*context,QScriptEngine*engine);
- void setRateOfChangeProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:798*//*823:*/
- #line 597 "./dataqsdk.w"
-
- QScriptValue constructDataqSdkDevice(QScriptContext*context,QScriptEngine*engine);
- QScriptValue DataqSdkDevice_newChannel(QScriptContext*context,QScriptEngine*engine);
- void setDataqSdkDeviceProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:823*//*850:*/
- #line 67 "./scales.w"
-
- QScriptValue constructDragLabel(QScriptContext*context,QScriptEngine*engine);
- void setDragLabelProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:850*//*858:*/
- #line 233 "./scales.w"
-
- QScriptValue constructSerialScale(QScriptContext*context,QScriptEngine*engine);
- void setSerialScaleProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:858*//*861:*/
- #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);
-
- /*:861*//*886:*/
- #line 265 "./valueannotation.w"
-
- QScriptValue constructValueAnnotation(QScriptContext*context,QScriptEngine*engine);
- void setValueAnnotationProperties(QScriptValue value,QScriptEngine*engine);
-
- /*:886*/
- #line 762 "./typica.w"
-
- /*17:*/
- #line 770 "./typica.w"
-
- /*676:*/
- #line 14892 "./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);
- }
-
- /*:676*/
- #line 771 "./typica.w"
-
- /*249:*/
- #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());
- }
-
- /*:249*//*250:*/
- #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);
- }
-
- /*:250*/
- #line 772 "./typica.w"
-
- /*257:*/
- #line 5946 "./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++)
- {
- Measurement measure(buffer[j+(i*channels)],time,
- unitMap[j]);
- channelMap[j]->input(measure);
- }
- }
- }
- }
- }
-
- /*:257*//*258:*/
- #line 5988 "./typica.w"
-
- void DAQImplementation::run()
- {
- setPriority(QThread::TimeCriticalPriority);
- while(ready)
- {
- measure();
- }
- }
-
- /*:258*//*259:*/
- #line 6004 "./typica.w"
-
- void DAQ::threadFinished()
- {
- if(imp->error)
- {
- /*260:*/
- #line 6055 "./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();
-
- /*:260*/
- #line 6009 "./typica.w"
-
- }
- }
-
- /*:259*//*261:*/
- #line 6080 "./typica.w"
-
- void DAQ::start()
- {
- if(imp->ready)
- {
- imp->error= imp->startTask(imp->handle);
- if(imp->error)
- {
- /*260:*/
- #line 6055 "./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();
-
- /*:260*/
- #line 6088 "./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)
- {
- /*260:*/
- #line 6055 "./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();
-
- /*:260*/
- #line 6112 "./typica.w"
-
- }
- imp->error= imp->clearTask(imp->handle);
- if(imp->error)
- {
- /*260:*/
- #line 6055 "./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();
-
- /*:260*/
- #line 6117 "./typica.w"
-
- }
- }
- }
-
- /*:261*//*262:*/
- #line 6127 "./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)
- {
- /*260:*/
- #line 6055 "./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();
-
- /*:260*/
- #line 6134 "./typica.w"
-
- }
- else
- {
- imp->ready= true;
- }
- }
-
- /*:262*//*263:*/
- #line 6148 "./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)
- {
- /*260:*/
- #line 6055 "./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();
-
- /*:260*/
- #line 6183 "./typica.w"
-
- }
- }
- return retval;
- }
-
- /*:263*//*264:*/
- #line 6197 "./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)
- {
- /*260:*/
- #line 6055 "./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();
-
- /*:260*/
- #line 6207 "./typica.w"
-
- }
- }
- }
-
- /*:264*//*265:*/
- #line 6217 "./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;
- }
-
- /*:265*//*266:*/
- #line 6248 "./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();
- }
-
- /*:266*/
- #line 773 "./typica.w"
-
- /*812:*/
- #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);
- }
- }
-
- /*:812*//*813:*/
- #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}};
- 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();
- }
- }
-
- /*:813*//*814:*/
- #line 386 "./dataqsdk.w"
-
- void DataqSdkDevice::threadFinished()
- {
- if(imp->error)
- {
- /*815:*/
- #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();
-
- /*:815*/
- #line 391 "./dataqsdk.w"
-
- }
- }
-
- /*:814*//*816:*/
- #line 417 "./dataqsdk.w"
-
- void DataqSdkDevice::start()
- {
- connect(imp,SIGNAL(finished()),this,SLOT(threadFinished()));
- imp->start();
- }
-
- /*:816*//*817:*/
- #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;
- }
-
- /*:817*//*818:*/
- #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;
- 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;
- }
-
- /*:818*//*819:*/
- #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;
- }
-
- /*:819*//*820:*/
- #line 547 "./dataqsdk.w"
-
- void DataqSdkDevice::setClockRate(double Hz)
- {
- imp->sampleRate= Hz;
- }
-
- /*:820*//*821:*/
- #line 557 "./dataqsdk.w"
-
- DataqSdkDevice::~DataqSdkDevice()
- {
- if(imp->ready)
- {
- imp->ready= false;
- }
- imp->wait(ULONG_MAX);
- delete imp;
- }
-
- /*:821*//*822:*/
- #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();
- }
- }
-
- /*:822*/
- #line 774 "./typica.w"
-
- /*273:*/
- #line 6457 "./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);
- }
- }
-
- /*:273*//*274:*/
- #line 6471 "./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()
- {
-
- }
-
- /*:274*//*275:*/
- #line 6496 "./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;
- }
-
- /*:275*/
- #line 775 "./typica.w"
-
- /*280:*/
- #line 6627 "./typica.w"
-
- Channel::Channel():QObject(NULL)
- {
-
- }
-
- Channel::~Channel()
- {
-
- }
-
- void Channel::input(Measurement measurement)
- {
- emit newData(measurement);
- }
-
- /*:280*/
- #line 776 "./typica.w"
-
- /*296:*/
- #line 7032 "./typica.w"
-
- void TemperatureDisplay::setRelativeMode(bool relative)
- {
- r= relative;
- }
-
- /*:296*//*297:*/
- #line 7049 "./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;
- }
- break;
- }
- }
-
- /*:297*//*298:*/
- #line 7125 "./typica.w"
-
- TemperatureDisplay::TemperatureDisplay(QWidget*parent):
- QLCDNumber(8,parent),unit(Units::Fahrenheit),r(false)
- {
- setSegmentStyle(Filled);
- display("---.--'F");
- }
-
- /*:298*//*299:*/
- #line 7141 "./typica.w"
-
- void TemperatureDisplay::invalidate()
- {
- display("---.--'F");
- }
-
- /*:299*//*300:*/
- #line 7153 "./typica.w"
-
- void TemperatureDisplay::setDisplayUnits(Units::Unit scale)
- {
- unit= scale;
- }
-
- /*:300*//*301:*/
- #line 7161 "./typica.w"
-
- TemperatureDisplay::~TemperatureDisplay()
- {
-
- }
-
- /*:301*/
- #line 777 "./typica.w"
-
- /*307:*/
- #line 7261 "./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);
- /*308:*/
- #line 7295 "./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);
-
- /*:308*/
- #line 7273 "./typica.w"
-
- }
- else
- {
- Measurement rel= measure;
- rel.setTime(QTime(0,0,0,0));
- emit measurement(rel);
- }
- }
- else
- {
- int relTime= epoch.msecsTo(measure.time());
- /*308:*/
- #line 7295 "./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);
-
- /*:308*/
- #line 7285 "./typica.w"
-
- }
- hasPrevious= true;
- previous= measure.time();
- }
-
- /*:307*//*309:*/
- #line 7308 "./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;
- }
-
- /*:309*/
- #line 778 "./typica.w"
-
- /*319:*/
- #line 7506 "./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);
- }
-
- /*:319*/
- #line 779 "./typica.w"
-
- /*324:*/
- #line 7596 "./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;
- }
-
- /*:324*/
- #line 780 "./typica.w"
-
- /*329:*/
- #line 7718 "./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);
- /*330:*/
- #line 7758 "./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);
- }
-
- /*:330*/
- #line 7742 "./typica.w"
- ;
- /*331:*/
- #line 7799 "./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;
- }
- }
- }
- }
-
- /*:331*/
- #line 7743 "./typica.w"
-
- /*333:*/
- #line 7876 "./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);
- }
-
- /*:333*/
- #line 7744 "./typica.w"
- ;
- fitInView(theScene->sceneRect().adjusted(-50,-50,50,50));
- }
-
- /*:329*//*332:*/
- #line 7846 "./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();
- }
- }
-
- /*:332*//*334:*/
- #line 7895 "./typica.w"
-
- void GraphView::resizeEvent(QResizeEvent*)
- {
- fitInView(theScene->sceneRect().adjusted(-50,-50,50,50));
- }
-
- /*:334*//*335:*/
- #line 7909 "./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))
- {
- /*337:*/
- #line 7986 "./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);
- }
-
- /*:337*/
- #line 7935 "./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
- {
- /*336:*/
- #line 7971 "./typica.w"
-
- int x= FULLTIMETOINT(measure.time())/1000;
- prevPoints->insert(tempcolumn,QPointF(x,measure.temperature()));
- if(timeIndicatorEnabled)
- {
- timeLine->setLine(x,0,x,-500);
- }
-
- /*:336*/
- #line 7952 "./typica.w"
-
- }
- }
-
- /*:335*//*338:*/
- #line 8007 "./typica.w"
-
- void GraphView::clear()
- {
- int i;
- foreach(i,prevPoints->keys())
- {
- removeSeries(i);
- }
- translations->clear();
- }
-
- /*:338*//*339:*/
- #line 8021 "./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);
- }
-
- /*:339*//*340:*/
- #line 8040 "./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);
- }
- }
-
- /*:340*//*341:*/
- #line 8067 "./typica.w"
-
- void GraphView::setTimeIndicatorEnabled(bool enabled)
- {
- timeIndicatorEnabled= enabled;
- if(enabled)
- {
- timeLine->show();
- }
- else
- {
- timeLine->hide();
- }
- }
-
- /*:341*/
- #line 781 "./typica.w"
-
- /*347:*/
- #line 8211 "./typica.w"
-
- void ZoomLog::newMeasurement(Measurement measure,int tempcolumn)
- {
- if(measure.time()!=QTime(0,0,0,0))
- {
- /*349:*/
- #line 8285 "./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);
- }
- }
- }
-
- /*:349*/
- #line 8216 "./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);
- }
- }
- }
- }
- }
- /*351:*/
- #line 8329 "./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;
- }
- }
- }
- }
- }
-
- /*:351*/
- #line 8249 "./typica.w"
-
- }
- else
- {
- /*348:*/
- #line 8261 "./typica.w"
-
- MeasurementModel*m;
- foreach(m,modelSet)
- {
- m->newMeasurement(measure,tempcolumn);
- }
-
- /*:348*/
- #line 8253 "./typica.w"
-
- }
- lastMeasurement.insert(tempcolumn,measure);
- }
-
- /*:347*//*350:*/
- #line 8315 "./typica.w"
-
- void ZoomLog::addToCurrentColumnSet(int column)
- {
- currentColumnSet.append(column);
- }
-
- void ZoomLog::clearCurrentColumnSet()
- {
- currentColumnSet.clear();
- }
-
- /*:350*//*352:*/
- #line 8399 "./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);
- }
- }
-
- /*:352*//*353:*/
- #line 8423 "./typica.w"
-
- void ZoomLog::centerOn(int row)
- {
- scrollTo(currentModel->index(row,0),QAbstractItemView::PositionAtCenter);
- }
-
- /*:353*//*354:*/
- #line 8433 "./typica.w"
-
- void ZoomLog::clear()
- {
- MeasurementModel*m;
- foreach(m,modelSet)
- {
- m->clear();
- }
- lastMeasurement.clear();
- saveTempCols.clear();
- saveControlCols.clear();
- saveNoteCols.clear();
- }
-
- /*:354*//*355:*/
- #line 8451 "./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();
- }
-
- /*:355*//*356:*/
- #line 8474 "./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;
- }
-
- /*:356*//*357:*/
- #line 8510 "./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();
- }
-
- /*:357*//*358:*/
- #line 8539 "./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);
- }
-
- /*:358*//*359:*/
- #line 8587 "./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();
- }
-
- /*:359*//*360:*/
- #line 8607 "./typica.w"
-
- QString ZoomLog::lastTime(int series)
- {
- Measurement measure= lastMeasurement.value(series);
- QTime time= measure.time();
- return time.toString("h:mm:ss.zzz");
- }
-
- /*:360*//*361:*/
- #line 8617 "./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()));
- }
-
- /*:361*//*362:*/
- #line 8640 "./typica.w"
-
- void ZoomLog::setHeaderData(int section,QString text)
- {
- MeasurementModel*m;
- foreach(m,modelSet)
- {
- m->setHeaderData(section,Qt::Horizontal,QVariant(text));
- }
- }
-
- /*:362*//*363:*/
- #line 8658 "./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();
- }
-
- /*:363*//*364:*/
- #line 8684 "./typica.w"
-
- void ZoomLog::persistColumnResize(int column,int,int newsize)
- {
- /*572:*/
- #line 12665 "./typica.w"
-
- QSettings settings;
- /*573:*/
- #line 12678 "./typica.w"
-
- QWidget*topLevelWidget= this;
- while(topLevelWidget->parentWidget())
- {
- topLevelWidget= topLevelWidget->parentWidget();
- }
-
- /*:573*/
- #line 12667 "./typica.w"
-
- settings.setValue(QString("columnWidths/%1/%2/%3").
- arg(topLevelWidget->objectName()).
- arg(objectName()).arg(column),
- QVariant(newsize));
-
- /*:572*/
- #line 8687 "./typica.w"
-
- }
-
- void ZoomLog::restoreColumnWidths()
- {
- /*575:*/
- #line 12698 "./typica.w"
-
- QSettings settings;
- /*573:*/
- #line 12678 "./typica.w"
-
- QWidget*topLevelWidget= this;
- while(topLevelWidget->parentWidget())
- {
- topLevelWidget= topLevelWidget->parentWidget();
- }
-
- /*:573*/
- #line 12700 "./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());
- }
- }
-
- /*:575*/
- #line 8692 "./typica.w"
-
- }
-
- void ZoomLog::setVisible(bool visibility)
- {
- QTableView::setVisible(visibility);
- }
-
- void ZoomLog::showEvent(QShowEvent*)
- {
- /*575:*/
- #line 12698 "./typica.w"
-
- QSettings settings;
- /*573:*/
- #line 12678 "./typica.w"
-
- QWidget*topLevelWidget= this;
- while(topLevelWidget->parentWidget())
- {
- topLevelWidget= topLevelWidget->parentWidget();
- }
-
- /*:573*/
- #line 12700 "./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());
- }
- }
-
- /*:575*/
- #line 8702 "./typica.w"
-
- }
-
- /*:364*/
- #line 782 "./typica.w"
-
- /*373:*/
- #line 8935 "./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();
- }
-
- /*:373*//*374:*/
- #line 8951 "./typica.w"
-
- QModelIndex MeasurementModel::parent(const QModelIndex&)const
- {
- return QModelIndex();
- }
-
- /*:374*//*375:*/
- #line 8961 "./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()));
- /*376:*/
- #line 9020 "./typica.w"
-
- /*377:*/
- #line 9065 "./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;
- }
- }
- }
-
- /*:377*/
- #line 9021 "./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;
- }
- }
- }
-
- /*:376*/
- #line 8975 "./typica.w"
-
- MeasurementList*newEntry;
- int insertion;
- if(i!=entries->end())
- {
- insertion= entries->indexOf(*i);
- if((*i)->first().toTime()==measure.time())
- {
- /*378:*/
- #line 9107 "./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);
-
- /*:378*/
- #line 8983 "./typica.w"
-
- }
- else
- {
- /*379:*/
- #line 9125 "./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);
-
- /*:379*/
- #line 8987 "./typica.w"
-
- }
- }
- else
- {
- /*380:*/
- #line 9143 "./typica.w"
-
- insertion= entries->size();
- /*379:*/
- #line 9125 "./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);
-
- /*:379*/
- #line 9145 "./typica.w"
-
-
- /*:380*/
- #line 8992 "./typica.w"
-
- }
- if(tempcolumn>=colcount)
- {
- colcount= tempcolumn+1;
- }
- emit rowChanged(insertion);
- delete temp;
- }
-
- /*:375*//*381:*/
- #line 9155 "./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)
- {
- /*382:*/
- #line 9193 "./typica.w"
-
- beginInsertRows(QModelIndex(),0,0);
- MeasurementList*newEntry= new MeasurementList;
- newEntry->append(QVariant(QTime(0,0,0,0)));
- entries->append(newEntry);
- endInsertRows();
-
- /*:382*/
- #line 9170 "./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;
- }
- }
-
- /*:381*//*383:*/
- #line 9204 "./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();
- }
-
- /*:383*//*384:*/
- #line 9237 "./typica.w"
-
- bool MeasurementModel::setData(const QModelIndex&index,
- const QVariant&value,int role)
- {
- if(role!=Qt::EditRole&&role!=Qt::DisplayRole)
- {
- return false;
- }
- /*385:*/
- #line 9269 "./typica.w"
-
- bool valid= false;
- if(index.isValid())
- {
- if(index.row()<entries->size())
- {
- if(index.column()<colcount)
- {
- valid= true;
- }
- }
- }
-
- /*:385*/
- #line 9245 "./typica.w"
-
- if(!valid)
- {
- return false;
- }
- MeasurementList*row= entries->at(index.row());
- if(index.column()>=row->size())
- {
- /*386:*/
- #line 9286 "./typica.w"
-
- for(int i= row->size()-1;i<index.column();i++)
- {
- row->append(QVariant());
- }
-
- /*:386*/
- #line 9253 "./typica.w"
-
- }
- if(index.column()==0)
- {
- /*387:*/
- #line 9301 "./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;
- /*376:*/
- #line 9020 "./typica.w"
-
- /*377:*/
- #line 9065 "./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;
- }
- }
- }
-
- /*:377*/
- #line 9021 "./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;
- }
- }
- }
-
- /*:376*/
- #line 9313 "./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()));
- }
-
- /*:387*/
- #line 9257 "./typica.w"
-
- }
- else
- {
- /*388:*/
- #line 9327 "./typica.w"
-
- row->replace(index.column(),value);
- emit dataChanged(index,index);
-
- /*:388*/
- #line 9261 "./typica.w"
-
- }
- return true;
- }
-
- /*:384*//*389:*/
- #line 9335 "./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"));
- }
-
- /*:389*//*390:*/
- #line 9349 "./typica.w"
-
- MeasurementModel::~MeasurementModel()
- {
- clear();
- delete entries;
- delete hData;
- }
-
- /*:390*//*391:*/
- #line 9361 "./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;
- }
-
- /*:391*//*392:*/
- #line 9388 "./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;
- }
-
- /*:392*//*393:*/
- #line 9428 "./typica.w"
-
- void MeasurementModel::setDisplayUnits(Units::Unit scale)
- {
- beginResetModel();
- unit= scale;
- endResetModel();
- }
-
- Units::Unit MeasurementModel::displayUnits()
- {
- return unit;
- }
-
- /*:393*//*394:*/
- #line 9454 "./typica.w"
-
- QVariant MeasurementModel::data(const QModelIndex&index,int role)const
- {
- /*385:*/
- #line 9269 "./typica.w"
-
- bool valid= false;
- if(index.isValid())
- {
- if(index.row()<entries->size())
- {
- if(index.column()<colcount)
- {
- valid= true;
- }
- }
- }
-
- /*:385*/
- #line 9457 "./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")==true)
- {
- 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();
- }
-
- /*:394*//*395:*/
- #line 9510 "./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();
- }
-
- /*:395*//*396:*/
- #line 9537 "./typica.w"
-
- Qt::ItemFlags MeasurementModel::flags(const QModelIndex&index)const
- {
- /*385:*/
- #line 9269 "./typica.w"
-
- bool valid= false;
- if(index.isValid())
- {
- if(index.row()<entries->size())
- {
- if(index.column()<colcount)
- {
- valid= true;
- }
- }
- }
-
- /*:385*/
- #line 9540 "./typica.w"
-
- if(valid)
- {
- return Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable;
- }
- return 0;
- }
-
- /*:396*//*397:*/
- #line 9552 "./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();
- }
-
- /*:397*/
- #line 783 "./typica.w"
-
- /*399:*/
- #line 9603 "./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()));
- }
-
- /*:399*//*400:*/
- #line 9618 "./typica.w"
-
- void AnnotationButton::annotate()
- {
- if(note.contains("%1"))
- {
- count++;
- emit annotation(note.arg(count),tc,ac);
- }
- else
- {
- emit annotation(note,tc,ac);
- }
- }
-
- /*:400*//*401:*/
- #line 9636 "./typica.w"
-
- void AnnotationButton::setTemperatureColumn(int tempcolumn)
- {
- tc= tempcolumn;
- }
-
- void AnnotationButton::setAnnotationColumn(int annotationcolumn)
- {
- ac= annotationcolumn;
- }
-
- void AnnotationButton::setAnnotation(const QString&annotation)
- {
- note= annotation;
- }
-
- /*:401*//*402:*/
- #line 9655 "./typica.w"
-
- void AnnotationButton::resetCount()
- {
- count= 0;
- }
-
- /*:402*/
- #line 784 "./typica.w"
-
- /*407:*/
- #line 9738 "./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()));
- }
-
- /*:407*//*408:*/
- #line 9755 "./typica.w"
-
- void AnnotationSpinBox::resetChange()
- {
- change= true;
- }
-
- /*:408*//*409:*/
- #line 9766 "./typica.w"
-
- void AnnotationSpinBox::annotate()
- {
- if(change)
- {
- change= false;
- emit annotation(QString("%1%2%3").arg(pretext).
- arg(value()).arg(posttext),tc,ac);
- }
- }
-
- /*:409*//*410:*/
- #line 9779 "./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;
- }
-
- /*:410*/
- #line 785 "./typica.w"
-
- /*417:*/
- #line 9947 "./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();
- }
-
- /*:417*//*418:*/
- #line 9968 "./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:
- /*419:*/
- #line 10000 "./typica.w"
-
- /*420:*/
- #line 10013 "./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;
-
- /*:420*/
- #line 10001 "./typica.w"
-
- nt= nt.addSecs(r);
- if(nt!=s)
- {
- s= nt;
- emit valueChanged(s);
- }
-
- /*:419*/
- #line 9981 "./typica.w"
- ;
- break;
- case TimerDisplay::CountDown:
- /*421:*/
- #line 10025 "./typica.w"
-
- if(s> QTime(0,0,0))
- {
- /*420:*/
- #line 10013 "./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;
-
- /*:420*/
- #line 10028 "./typica.w"
-
- bseconds= TIMETOINT(base);
- n= bseconds-r;
- nt= nt.addSecs(n);
- if(nt!=s)
- {
- s= nt;
- emit valueChanged(s);
- }
- }
-
- /*:421*/
- #line 9984 "./typica.w"
- ;
- break;
- case TimerDisplay::Clock:
- /*422:*/
- #line 10042 "./typica.w"
-
- time= QTime::currentTime();
- if(time!=s)
- {
- s= time;
- emit valueChanged(s);
- }
-
- /*:422*/
- #line 9987 "./typica.w"
- ;
- break;
- default:
- Q_ASSERT_X(false,"updateTime","invalid timer mode");
- break;
- }
- updateDisplay();
- }
-
- /*:418*//*423:*/
- #line 10054 "./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);
- }
- }
-
- /*:423*//*424:*/
- #line 10084 "./typica.w"
-
- void TimerDisplay::stopTimer()
- {
- if(running)
- {
- clock.stop();
- running= false;
- emit runStateChanged(false);
- }
- }
-
- /*:424*//*425:*/
- #line 10097 "./typica.w"
-
- TimerDisplay::~TimerDisplay()
- {
- clock.stop();
- }
-
- /*:425*//*426:*/
- #line 10106 "./typica.w"
-
- void TimerDisplay::setCountUpMode()
- {
- m= TimerDisplay::CountUp;
- }
-
- void TimerDisplay::setCountDownMode()
- {
- m= TimerDisplay::CountDown;
- }
-
- void TimerDisplay::setClockMode()
- {
- m= TimerDisplay::Clock;
- }
-
- /*:426*//*427:*/
- #line 10124 "./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;
- }
-
- /*:427*//*428:*/
- #line 10162 "./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;
- }
-
- /*:428*//*429:*/
- #line 10197 "./typica.w"
-
- void TimerDisplay::copyTimer()
- {
- QApplication::clipboard()->setText(value());
- }
-
- /*:429*//*430:*/
- #line 10206 "./typica.w"
-
- void TimerDisplay::reset()
- {
- if(!running)
- {
- s= r;
- updateDisplay();
- }
- }
-
- /*:430*//*431:*/
- #line 10219 "./typica.w"
-
- void TimerDisplay::updateDisplay()
- {
- display(value());
- }
-
- /*:431*/
- #line 786 "./typica.w"
-
- /*437:*/
- #line 10313 "./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)
- {
- /*438:*/
- #line 10337 "./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;
- }
-
- /*:438*/
- #line 10321 "./typica.w"
-
- }
- else
- {
- /*439:*/
- #line 10356 "./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;
- }
-
- /*:439*/
- #line 10325 "./typica.w"
-
- }
- return y;
- }
-
- /*:437*//*440:*/
- #line 10380 "./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;
- }
-
- /*:440*//*441:*/
- #line 10412 "./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);
- }
-
- /*:441*//*442:*/
- #line 10430 "./typica.w"
-
- PackLayout::~PackLayout()
- {
- QLayoutItem*item;
- while((item= takeAt(0)))
- {
- delete item;
- }
- }
-
- /*:442*//*443:*/
- #line 10444 "./typica.w"
-
- QLayoutItem*PackLayout::takeAt(int index)
- {
- if(index>=0&&index<itemList.size())
- {
- return itemList.takeAt(index);
- }
- else
- {
- return NULL;
- }
- }
-
- /*:443*//*444:*/
- #line 10460 "./typica.w"
-
- QLayoutItem*PackLayout::itemAt(int index)const
- {
- if(index>=0&&index<itemList.size())
- {
- return itemList.at(index);
- }
- else
- {
- return NULL;
- }
- }
-
- /*:444*//*445:*/
- #line 10483 "./typica.w"
-
- void PackLayout::addItem(QLayoutItem*item)
- {
- itemList.append(item);
- }
-
- /*:445*//*446:*/
- #line 10491 "./typica.w"
-
- int PackLayout::count()const
- {
- return itemList.size();
- }
-
- /*:446*//*447:*/
- #line 10503 "./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();
- }
-
- /*:447*//*448:*/
- #line 10534 "./typica.w"
-
- void PackLayout::setOrientation(Qt::Orientations direction)
- {
- orientation= direction;
- doLayout(geometry(),false);
- }
-
- /*:448*/
- #line 787 "./typica.w"
-
- /*450:*/
- #line 10573 "./typica.w"
-
- SceneButton::SceneButton():QGraphicsScene()
- {
-
- }
-
- SceneButton::~SceneButton()
- {
-
- }
-
- void SceneButton::mousePressEvent(QGraphicsSceneMouseEvent*mouseEvent)
- {
- emit clicked(mouseEvent->buttonDownScreenPos(mouseEvent->button()));
- }
-
- /*:450*/
- #line 788 "./typica.w"
-
- /*452:*/
- #line 10619 "./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);
- /*453:*/
- #line 10639 "./typica.w"
-
- label->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- label->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- label->setFrameShape(QFrame::NoFrame);
- label->setInteractive(true);
-
- /*:453*/
- #line 10628 "./typica.w"
-
- /*454:*/
- #line 10650 "./typica.w"
-
- scene->setBackgroundBrush(Qt::cyan);
- text= scene->addText(labeltext);
- if(orientation==Qt::Horizontal)
- {
- text->rotate(270.0);
- }
- label->setScene(scene);
-
- /*:454*/
- #line 10629 "./typica.w"
-
- /*455:*/
- #line 10668 "./typica.w"
-
- if(orientation==Qt::Horizontal)
- {
- label->setMaximumWidth((int)(text->boundingRect().height()+1));
- }
- else
- {
- label->setMaximumHeight((int)(text->boundingRect().height()+1));
- }
- label->centerOn(text);
-
- /*:455*/
- #line 10630 "./typica.w"
-
- /*456:*/
- #line 10683 "./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());
- }
-
- /*:456*/
- #line 10631 "./typica.w"
-
- }
-
- /*:452*//*457:*/
- #line 10700 "./typica.w"
-
- void WidgetDecorator::setBackgroundBrush(QBrush background)
- {
- scene->setBackgroundBrush(background);
- }
-
- void WidgetDecorator::setTextColor(QColor color)
- {
- text->setDefaultTextColor(color);
- }
-
- /*:457*//*458:*/
- #line 10713 "./typica.w"
-
- WidgetDecorator::~WidgetDecorator()
- {
-
- }
-
- /*:458*/
- #line 789 "./typica.w"
-
- /*463:*/
- #line 10812 "./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);
- }
-
- /*:463*//*464:*/
- #line 10826 "./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())
- {
- /*465:*/
- #line 10863 "./typica.w"
-
- QSettings settings;
- resize(settings.value("logSize",QSize(620,400)).toSize());
- move(settings.value("logPos",QPoint(200,60)).toPoint());
-
- /*:465*/
- #line 10843 "./typica.w"
-
- /*466:*/
- #line 10876 "./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()));
-
- /*:466*/
- #line 10844 "./typica.w"
-
- /*467:*/
- #line 10899 "./typica.w"
-
- model->setHeaderData(0,Qt::Horizontal,"Time");
- model->setHeaderData(1,Qt::Horizontal,"Temperature");
- model->setHeaderData(2,Qt::Horizontal,"Annotation");
- model->clear();
-
- /*:467*/
- #line 10845 "./typica.w"
-
- /*468:*/
- #line 10908 "./typica.w"
-
- log->setModel(model);
- log->setColumnWidth(0,100);
- log->setColumnWidth(1,100);
- log->setColumnWidth(2,100);
-
- /*:468*/
- #line 10846 "./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()));
- }
-
- /*:464*//*469:*/
- #line 10919 "./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);
- }
- }
-
- /*:469*//*470:*/
- #line 10962 "./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);
- }
- }
-
- /*:470*//*471:*/
- #line 10993 "./typica.w"
-
- void LogEditWindow::closeEvent(QCloseEvent*event)
- {
- QSettings settings;
- settings.setValue("logSize",size());
- settings.setValue("logPos",pos());
- event->accept();
- }
-
- /*:471*/
- #line 790 "./typica.w"
-
- /*477:*/
- #line 11108 "./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");
- /*478:*/
- #line 11141 "./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();
- }
-
- /*:478*/
- #line 11119 "./typica.w"
-
- xmlout.writeStartElement("roast");
- bool oresult;
- for(int i= 0;i<data->rowCount();i++)
- {
- /*479:*/
- #line 11166 "./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;
- }
- }
- }
-
- /*:479*/
- #line 11124 "./typica.w"
-
- if(oresult)
- {
- /*480:*/
- #line 11205 "./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()==true)
- {
- 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();
-
- /*:480*/
- #line 11127 "./typica.w"
-
- }
- }
- xmlout.writeEndElement();
- xmlout.writeEndElement();
- xmlout.writeEndDocument();
- out->close();
- return true;
- }
-
- /*:477*//*481:*/
- #line 11255 "./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;
- }
-
- /*:481*//*482:*/
- #line 11284 "./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);
- }
-
- /*:482*/
- #line 791 "./typica.w"
-
- /*484:*/
- #line 11341 "./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;
- /*485:*/
- #line 11372 "./typica.w"
-
- while(!xmlin.isDTD())
- {
- xmlin.readNext();
- }
- if(xmlin.isDTD())
- {
- if(xmlin.text()=="<!DOCTYPE roastlog>")
- {
- /*486:*/
- #line 11394 "./typica.w"
-
- emit newTemperatureColumn(firstc,"Bean");
- emit newAnnotationColumn(firstc+1,"Note");
- emit lastColumn(firstc+1);
-
- /*:486*/
- #line 11381 "./typica.w"
-
- }
- else
- {
- xmlin.readNext();
- /*487:*/
- #line 11403 "./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);
-
- /*:487*/
- #line 11386 "./typica.w"
-
- }
- }
-
- /*:485*/
- #line 11352 "./typica.w"
-
- QTime timeval= QTime();
- double tempval= 0;
- QString noteval= QString();
- int column;
- int counter= 0;
- while(!xmlin.atEnd())
- {
- /*488:*/
- #line 11444 "./typica.w"
-
- xmlin.readNext();
- if(xmlin.isStartElement())
- {
- /*489:*/
- #line 11470 "./typica.w"
-
- if(xmlin.name()=="time")
- {
- timeval= QTime::fromString(xmlin.readElementText(),"mm:ss.zzz");
- }
- else if(xmlin.name()=="temperature")
- {
- column= xmlin.attributes().value("series").toString().isEmpty()?
- firstc:temperatureColumns.value(xmlin.attributes().
- value("series").toString());
- bool relative= false;
- if(xmlin.attributes().value("relative")=="true")
- {
- 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);
- }
- }
-
- /*:489*/
- #line 11448 "./typica.w"
-
- }
- counter++;
- if(counter%100==0)
- {
- QCoreApplication::processEvents();
- }
-
- /*:488*/
- #line 11360 "./typica.w"
-
- }
- return true;
- }
-
- /*:484*//*490:*/
- #line 11516 "./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;
- }
-
- /*:490*/
- #line 792 "./typica.w"
-
- /*495:*/
- #line 11607 "./typica.w"
-
- bool CSVOutput::output()
- {
- if(!out->open(QIODevice::WriteOnly|QIODevice::Text))
- {
- return false;
- }
- QTextStream output(out);
- /*496:*/
- #line 11631 "./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';
-
- /*:496*/
- #line 11615 "./typica.w"
-
- bool oresult;
- for(int i= 0;i<data->rowCount();i++)
- {
- /*479:*/
- #line 11166 "./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;
- }
- }
- }
-
- /*:479*/
- #line 11619 "./typica.w"
-
- if(oresult)
- {
- /*497:*/
- #line 11656 "./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';
-
- /*:497*/
- #line 11622 "./typica.w"
-
- }
- }
- out->close();
- return true;
- }
-
- /*:495*//*498:*/
- #line 11675 "./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"
- /*:498*/
- #line 793 "./typica.w"
-
- /*533:*/
- #line 11931 "./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;
- }
-
- /*:533*//*534:*/
- #line 11975 "./typica.w"
-
- QModelIndex SaltModel::parent(const QModelIndex&)const
- {
- return QModelIndex();
- }
-
- /*:534*//*535:*/
- #line 11994 "./typica.w"
-
- bool SaltModel::setData(const QModelIndex&index,const QVariant&value,
- int role)
- {
- /*536:*/
- #line 12025 "./typica.w"
-
- bool valid= false;
- if(index.isValid())
- {
- if(index.row()<modelData.size())
- {
- if(index.column()<colcount)
- {
- valid= true;
- }
- }
- }
-
- /*:536*/
- #line 11998 "./typica.w"
-
- if(!valid)
- {
- return false;
- }
- if(index.row()==modelData.size()-1)
- {
- beginInsertRows(QModelIndex(),modelData.size(),modelData.size());
- /*537:*/
- #line 12041 "./typica.w"
-
- QList<QMap<int,QVariant> > newRow;
- QMap<int,QVariant> defaults;
- for(int i= 0;i<colcount;i++)
- {
- newRow.append(defaults);
- }
- modelData.append(newRow);
-
- /*:537*/
- #line 12006 "./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;
- }
-
- /*:535*//*538:*/
- #line 12052 "./typica.w"
-
- SaltModel::SaltModel(int columns):QAbstractItemModel(),colcount(columns)
- {
- for(int i= 0;i<columns;i++)
- {
- hData<<"";
- }
- /*537:*/
- #line 12041 "./typica.w"
-
- QList<QMap<int,QVariant> > newRow;
- QMap<int,QVariant> defaults;
- for(int i= 0;i<colcount;i++)
- {
- newRow.append(defaults);
- }
- modelData.append(newRow);
-
- /*:537*/
- #line 12059 "./typica.w"
-
- }
-
- /*:538*//*539:*/
- #line 12064 "./typica.w"
-
- SaltModel::~SaltModel()
- {
-
- }
-
- /*:539*//*540:*/
- #line 12074 "./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);
- }
-
- /*:540*//*541:*/
- #line 12087 "./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;
- }
-
- /*:541*//*542:*/
- #line 12102 "./typica.w"
-
- QVariant SaltModel::data(const QModelIndex&index,int role)const
- {
- /*536:*/
- #line 12025 "./typica.w"
-
- bool valid= false;
- if(index.isValid())
- {
- if(index.row()<modelData.size())
- {
- if(index.column()<colcount)
- {
- valid= true;
- }
- }
- }
-
- /*:536*/
- #line 12105 "./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();
- }
-
- /*:542*//*543:*/
- #line 12129 "./typica.w"
-
- Qt::ItemFlags SaltModel::flags(const QModelIndex&index)const
- {
- /*536:*/
- #line 12025 "./typica.w"
-
- bool valid= false;
- if(index.isValid())
- {
- if(index.row()<modelData.size())
- {
- if(index.column()<colcount)
- {
- valid= true;
- }
- }
- }
-
- /*:536*/
- #line 12132 "./typica.w"
-
- if(valid)
- {
- return Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable|Qt::ItemIsDropEnabled;
- }
- return 0;
- }
-
- /*:543*//*544:*/
- #line 12143 "./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();
- }
-
- /*:544*/
- #line 794 "./typica.w"
-
- /*546:*/
- #line 12198 "./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;
- }
-
- /*:546*//*547:*/
- #line 12215 "./typica.w"
-
- void SqlComboBox::showData(bool show)
- {
- dataColumnShown= show;
- }
-
- /*:547*//*548:*/
- #line 12226 "./typica.w"
-
- void SqlComboBox::addNullOption()
- {
- addItem(tr("Unknown"),QVariant(QVariant::String));
- }
-
- /*:548*//*549:*/
- #line 12239 "./typica.w"
-
- void SqlComboBox::setDataColumn(int column)
- {
- dataColumn= column;
- }
-
- void SqlComboBox::setDisplayColumn(int column)
- {
- displayColumn= column;
- }
-
- /*:549*//*550:*/
- #line 12253 "./typica.w"
-
- void SqlComboBox::addSqlOptions(QString query)
- {
- SqlQueryConnection*dbquery= new SqlQueryConnection;
- 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);
- }
- delete dbquery;
- }
-
- /*:550*//*551:*/
- #line 12289 "./typica.w"
-
- SqlComboBox::SqlComboBox():
- dataColumn(0),displayColumn(0),dataColumnShown(false)
- {
- view()->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
- }
-
- SqlComboBox::~SqlComboBox()
- {
-
- }
-
- /*:551*/
- #line 795 "./typica.w"
-
- /*553:*/
- #line 12327 "./typica.w"
-
- void SqlComboBoxDelegate::setWidget(SqlComboBox*widget)
- {
- delegate= widget;
- }
-
- /*:553*//*554:*/
- #line 12336 "./typica.w"
-
- QWidget*SqlComboBoxDelegate::createEditor(QWidget*parent,
- const QStyleOptionViewItem&,
- const QModelIndex&)const
- {
- return delegate->clone(parent);
- }
-
- /*:554*//*555:*/
- #line 12347 "./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()));
- }
-
- /*:555*//*556:*/
- #line 12360 "./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);
- }
-
- /*:556*//*557:*/
- #line 12373 "./typica.w"
-
- void SqlComboBoxDelegate::updateEditorGeometry(QWidget*editor,
- const QStyleOptionViewItem&option,
- const QModelIndex&)const
- {
- editor->setGeometry(option.rect);
- }
-
- /*:557*//*558:*/
- #line 12384 "./typica.w"
-
- QSize SqlComboBoxDelegate::sizeHint()const
- {
- return delegate->sizeHint();
- }
-
- /*:558*//*559:*/
- #line 12392 "./typica.w"
-
- SqlComboBoxDelegate::SqlComboBoxDelegate(QObject*parent)
- :QItemDelegate(parent)
- {
-
- }
-
- /*:559*/
- #line 796 "./typica.w"
-
- /*525:*/
- #line 11745 "./typica.w"
-
- Application::Application(int&argc,char**argv):QApplication(argc,argv)
- {
- /*526:*/
- #line 11760 "./typica.w"
-
- setOrganizationName("Wilson's Coffee & Tea");
- setOrganizationDomain("wilsonscoffee.com");
- setApplicationName(PROGRAM_NAME);
-
- /*:526*/
- #line 11748 "./typica.w"
-
- /*527:*/
- #line 11769 "./typica.w"
-
- QTranslator base;
- if(base.load(QString("qt_%1").arg(QLocale::system().name())))
- {
- installTranslator(&base);
- }
- QTranslator app;
- if(app.load(QString("%1_%2").arg("Typica").arg(QLocale::system().name())))
- {
- installTranslator(&app);
- }
-
- /*:527*/
- #line 11749 "./typica.w"
-
- /*251:*/
- #line 123 "./measurement.w"
-
- qRegisterMetaType<Measurement> ("Measurement");
- #line 5787 "./typica.w"
-
- /*:251*/
- #line 11750 "./typica.w"
-
- /*706:*/
- #line 15548 "./typica.w"
-
- NodeInserter*inserter= new NodeInserter(tr("NI DAQmx Base Device"),
- tr("NI DAQmx Base"),
- "nidaqmxbase",NULL);
- topLevelNodeInserters.append(inserter);
-
- /*:706*//*714:*/
- #line 15779 "./typica.w"
-
- #ifdef Q_OS_WIN32
- inserter= new NodeInserter(tr("NI DAQmx Device"),tr("NI DAQmx"),"nidaqmx",NULL);
- topLevelNodeInserters.append(inserter);
- #endif
-
- /*:714*//*738:*/
- #line 16742 "./typica.w"
-
- #if 0
- inserter= new NodeInserter(tr("Modbus RTU Port"),tr("Modbus RTU Port"),"modbusrtuport",NULL);
- topLevelNodeInserters.append(inserter);
- #endif
-
- /*:738*//*782:*/
- #line 18224 "./typica.w"
-
- inserter= new NodeInserter(tr("Modbus RTU Device"),tr("Modbus RTU Device"),"modbusrtu",NULL);
- topLevelNodeInserters.append(inserter);
-
- /*:782*//*846:*/
- #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 18444 "./typica.w"
-
- #line 1 "./scales.w"
- /*:846*//*871:*/
- #line 495 "./scales.w"
-
- inserter= new NodeInserter(tr("Serial Scale"),tr("Scale"),"scale",NULL);
- topLevelNodeInserters.append(inserter);
-
- #line 18446 "./typica.w"
-
- #line 1 "./valueannotation.w"
- /*:871*/
- #line 11751 "./typica.w"
-
- }
-
- /*:525*//*529:*/
- #line 11792 "./typica.w"
-
- QDomDocument*Application::configuration()
- {
- return&conf;
- }
-
- /*:529*//*530:*/
- #line 11801 "./typica.w"
-
- QSqlDatabase Application::database()
- {
- QString connectionName;
- QSqlDatabase connection= QSqlDatabase::database();
- do
- {
- connectionName= QUuid::createUuid().toString();
- }while(QSqlDatabase::connectionNames().contains(connectionName));
- return QSqlDatabase::cloneDatabase(connection,connectionName);
- }
-
- /*:530*//*641:*/
- #line 14152 "./typica.w"
-
- void Application::saveDeviceConfiguration()
- {
- QSettings settings;
- settings.setValue("DeviceConfiguration",
- QVariant(deviceConfigurationDocument.toByteArray()));
- }
-
- /*:641*//*642:*/
- #line 14164 "./typica.w"
-
- QDomDocument Application::deviceConfiguration()
- {
- if(deviceConfigurationDocument.isNull())
- {
- /*643:*/
- #line 14178 "./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.";
- /*644:*/
- #line 14202 "./typica.w"
-
- QFile emptyDocument(":/resources/xml/EmptyDeviceConfiguration.xml");
- emptyDocument.open(QIODevice::ReadOnly);
- if(!deviceConfigurationDocument.setContent(&emptyDocument,false,
- &etext,&eline,&ecol))
- {
- /*645:*/
- #line 14219 "./typica.w"
-
- qDebug()<<QString(tr("An error occurred loading device configuration."));
- qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
- qDebug()<<etext;
-
- /*:645*/
- #line 14208 "./typica.w"
-
- }
- else
- {
- saveDeviceConfiguration();
- }
-
- /*:644*/
- #line 14187 "./typica.w"
-
- }
- else
- {
- if(!deviceConfigurationDocument.setContent(document,false,
- &etext,&eline,&ecol))
- {
- /*645:*/
- #line 14219 "./typica.w"
-
- qDebug()<<QString(tr("An error occurred loading device configuration."));
- qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
- qDebug()<<etext;
-
- /*:645*/
- #line 14194 "./typica.w"
-
- /*644:*/
- #line 14202 "./typica.w"
-
- QFile emptyDocument(":/resources/xml/EmptyDeviceConfiguration.xml");
- emptyDocument.open(QIODevice::ReadOnly);
- if(!deviceConfigurationDocument.setContent(&emptyDocument,false,
- &etext,&eline,&ecol))
- {
- /*645:*/
- #line 14219 "./typica.w"
-
- qDebug()<<QString(tr("An error occurred loading device configuration."));
- qDebug()<<QString(tr("Line %1, Column %2")).arg(eline).arg(ecol);
- qDebug()<<etext;
-
- /*:645*/
- #line 14208 "./typica.w"
-
- }
- else
- {
- saveDeviceConfiguration();
- }
-
- /*:644*/
- #line 14195 "./typica.w"
-
- }
- }
-
- /*:643*/
- #line 14169 "./typica.w"
-
- }
- return deviceConfigurationDocument;
- }
-
- /*:642*//*673:*/
- #line 14820 "./typica.w"
-
- void Application::registerDeviceConfigurationWidget(QString driver,
- QMetaObject widget)
- {
- deviceConfigurationWidgets.insert(driver,widget);
- }
-
- /*:673*//*674:*/
- #line 14836 "./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;
- }
-
- /*:674*/
- #line 797 "./typica.w"
-
- /*565:*/
- #line 12510 "./typica.w"
-
- SqlConnectionSetup::SqlConnectionSetup():
- formLayout(new QFormLayout),driver(new QComboBox),hostname(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("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()));
- setLayout(layout);
- setModal(true);
- }
-
- SqlConnectionSetup::~SqlConnectionSetup()
- {
-
- }
-
- /*:565*//*566:*/
- #line 12544 "./typica.w"
-
- void SqlConnectionSetup::testConnection()
- {
- QSqlDatabase database=
- QSqlDatabase::addDatabase(driver->itemData(driver->currentIndex()).
- toString());
- database.setConnectOptions("application_name=Typica");
- database.setHostName(hostname->text());
- 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/dbname",dbname->text());
- settings.setValue("database/user",user->text());
- settings.setValue("database/password",password->text());
- accept();
- }
- else
- {
- QMessageBox::information(this,tr("Database connection failed"),
- tr("Failed to connect to database."));
- }
- }
-
- /*:566*/
- #line 798 "./typica.w"
-
- /*570:*/
- #line 12641 "./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)));
- }
-
- /*:570*//*571:*/
- #line 12656 "./typica.w"
-
- void SqlQueryView::persistColumnResize(int column,int,int newsize)
- {
- /*572:*/
- #line 12665 "./typica.w"
-
- QSettings settings;
- /*573:*/
- #line 12678 "./typica.w"
-
- QWidget*topLevelWidget= this;
- while(topLevelWidget->parentWidget())
- {
- topLevelWidget= topLevelWidget->parentWidget();
- }
-
- /*:573*/
- #line 12667 "./typica.w"
-
- settings.setValue(QString("columnWidths/%1/%2/%3").
- arg(topLevelWidget->objectName()).
- arg(objectName()).arg(column),
- QVariant(newsize));
-
- /*:572*/
- #line 12659 "./typica.w"
-
- }
-
- /*:571*//*574:*/
- #line 12688 "./typica.w"
-
- void SqlQueryView::showEvent(QShowEvent*event)
- {
- /*575:*/
- #line 12698 "./typica.w"
-
- QSettings settings;
- /*573:*/
- #line 12678 "./typica.w"
-
- QWidget*topLevelWidget= this;
- while(topLevelWidget->parentWidget())
- {
- topLevelWidget= topLevelWidget->parentWidget();
- }
-
- /*:573*/
- #line 12700 "./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());
- }
- }
-
- /*:575*/
- #line 12691 "./typica.w"
-
- event->accept();
- }
-
- /*:574*//*576:*/
- #line 12715 "./typica.w"
-
- void SqlQueryView::openRow(const QModelIndex&index)
- {
- emit openEntry(((QSqlQueryModel*)model())->record(index.row()).value(0).toString());
- emit openEntryRow(index.row());
- }
-
- /*:576*//*577:*/
- #line 12726 "./typica.w"
-
- void SqlQueryView::setQuery(const QString&query)
- {
- QSqlDatabase database= AppInstance->database();
- database.open();
- QSqlQuery q(query,database);
- ((QSqlQueryModel*)model())->setQuery(q);
- }
-
- bool SqlQueryView::setHeaderData(int section,Qt::Orientation orientation,
- const QVariant&value,int role)
- {
- return model()->setHeaderData(section,orientation,value,role);
- }
-
- /*:577*//*578:*/
- #line 12743 "./typica.w"
-
- QVariant SqlQueryView::data(int row,int column,int role)
- {
- return model()->data(model()->index(row,column),role);
- }
-
- /*:578*/
- #line 799 "./typica.w"
-
- /*144:*/
- #line 3384 "./typica.w"
-
- SqlQueryConnection::SqlQueryConnection(const QString&query)
- {
- QSqlDatabase database= AppInstance->database();
- database.open();
- q= new QSqlQuery(query,database);
- connection= database.connectionName();
- }
-
- /*:144*//*145:*/
- #line 3397 "./typica.w"
-
- SqlQueryConnection::~SqlQueryConnection()
- {
- delete q;
- {
- QSqlDatabase database= QSqlDatabase::database(connection);
- database.close();
- }
- QSqlDatabase::removeDatabase(connection);
- }
-
- /*:145*//*146:*/
- #line 3411 "./typica.w"
-
- QSqlQuery*SqlQueryConnection::operator->()
- {
- return q;
- }
-
- /*:146*/
- #line 800 "./typica.w"
-
- /*597:*/
- #line 13092 "./typica.w"
-
- ReportTable::ReportTable(QTextFrame*frame,QDomElement description):
- area(frame),configuration(description)
- {
- refresh();
- }
-
- ReportTable::~ReportTable()
- {
-
- }
-
- /*:597*//*598:*/
- #line 13108 "./typica.w"
-
- void ReportTable::bind(QString placeholder,QVariant value)
- {
- bindings.insert(placeholder,value);
- }
-
- /*:598*//*599:*/
- #line 13118 "./typica.w"
-
- void ReportTable::refresh()
- {
- /*600:*/
- #line 13139 "./typica.w"
-
- QTextCursor cursor= area->firstCursorPosition();
- while(cursor<area->lastCursorPosition())
- {
- cursor.movePosition(QTextCursor::Right,QTextCursor::KeepAnchor);
- }
- cursor.removeSelectedText();
-
- /*:600*/
- #line 13121 "./typica.w"
-
- int rows= 1;
- int columns= 1;
- int currentRow= 0;
- QTextTable*table= cursor.insertTable(rows,columns);
- /*601:*/
- #line 13152 "./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);
-
- /*:601*/
- #line 13126 "./typica.w"
-
- /*602:*/
- #line 13166 "./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")
- {
- /*603:*/
- #line 13193 "./typica.w"
-
- SqlQueryConnection query;
- 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());
-
- /*:603*/
- #line 13178 "./typica.w"
-
- }
- else if(currentElement.tagName()=="row")
- {
- /*604:*/
- #line 13232 "./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++;
- }
- }
- }
-
- /*:604*/
- #line 13182 "./typica.w"
-
- }
- }
- }
-
- /*:602*/
- #line 13127 "./typica.w"
-
- if(rows> 1)
- {
- table->removeRows(0,1);
- }
- }
-
- /*:599*/
- #line 801 "./typica.w"
-
- /*609:*/
- #line 13334 "./typica.w"
-
- FormArray::FormArray(QDomElement description):configuration(description),
- maxwidth(-1),maxheight(-1)
- {
- setWidget(&itemContainer);
- itemContainer.setLayout(&itemLayout);
- }
-
- /*:609*//*610:*/
- #line 13351 "./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);
- }
- }
- }
- }
-
- /*:610*//*611:*/
- #line 13401 "./typica.w"
-
- QWidget*FormArray::elementAt(int index)
- {
- if(index<itemLayout.count())
- {
- QLayoutItem*item= itemLayout.itemAt(index);
- return item->widget();
- }
- else
- {
- return NULL;
- }
- }
-
- /*:611*//*612:*/
- #line 13418 "./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);
- }
-
- /*:612*//*613:*/
- #line 13434 "./typica.w"
-
- int FormArray::elements()
- {
- return itemLayout.count();
- }
-
- /*:613*//*614:*/
- #line 13445 "./typica.w"
-
- void FormArray::setMaximumElementWidth(int width)
- {
- maxwidth= width;
- }
-
- void FormArray::setMaximumElementHeight(int height)
- {
- maxheight= height;
- }
-
- /*:614*/
- #line 802 "./typica.w"
-
- /*620:*/
- #line 13576 "./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());
- }
-
- /*:620*//*621:*/
- #line 13649 "./typica.w"
-
- QSize ScaleControl::sizeHint()const
- {
- return QSize(140,30);
- }
-
- /*:621*//*622:*/
- #line 13658 "./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);
- }
- }
-
- /*:622*//*623:*/
- #line 13695 "./typica.w"
-
- double ScaleControl::initialValue(void)
- {
- return nonScoredValue;
- }
-
- double ScaleControl::finalValue(void)
- {
- return scoredValue;
- }
-
- /*:623*//*624:*/
- #line 13716 "./typica.w"
-
- void ScaleControl::mousePressEvent(QMouseEvent*event)
- {
- /*625:*/
- #line 13728 "./typica.w"
-
- if(event->button()!=Qt::LeftButton)
- {
- event->ignore();
- return;
- }
-
- /*:625*/
- #line 13719 "./typica.w"
-
- scaleDown= true;
- event->accept();
- }
-
- /*:624*//*626:*/
- #line 13739 "./typica.w"
-
- void ScaleControl::mouseReleaseEvent(QMouseEvent*event)
- {
- /*625:*/
- #line 13728 "./typica.w"
-
- if(event->button()!=Qt::LeftButton)
- {
- event->ignore();
- return;
- }
-
- /*:625*/
- #line 13742 "./typica.w"
-
- if(!scaleDown)
- {
- event->ignore();
- return;
- }
- scaleDown= false;
- QPointF sceneCoordinate= mapToScene(event->x(),event->y());
- /*627:*/
- #line 13764 "./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;
- }
- }
- }
-
- /*:627*/
- #line 13750 "./typica.w"
-
- /*628:*/
- #line 13790 "./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;
- }
- }
- }
-
- /*:628*/
- #line 13751 "./typica.w"
-
- /*629:*/
- #line 13816 "./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;
- }
- }
-
- /*:629*/
- #line 13752 "./typica.w"
-
- event->ignore();
- return;
- }
-
- /*:626*/
- #line 803 "./typica.w"
-
- /*631:*/
- #line 13882 "./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());
- }
-
- /*:631*//*632:*/
- #line 13937 "./typica.w"
-
- QSize IntensityControl::sizeHint()const
- {
- return QSize(25,160);
- }
-
- /*:632*//*633:*/
- #line 13952 "./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;
- }
-
- /*:633*//*634:*/
- #line 13984 "./typica.w"
-
- void IntensityControl::mousePressEvent(QMouseEvent*event)
- {
- /*625:*/
- #line 13728 "./typica.w"
-
- if(event->button()!=Qt::LeftButton)
- {
- event->ignore();
- return;
- }
-
- /*:625*/
- #line 13987 "./typica.w"
-
- scaleDown= true;
- event->accept();
- }
-
- /*:634*//*635:*/
- #line 13998 "./typica.w"
-
- void IntensityControl::mouseReleaseEvent(QMouseEvent*event)
- {
- /*625:*/
- #line 13728 "./typica.w"
-
- if(event->button()!=Qt::LeftButton)
- {
- event->ignore();
- return;
- }
-
- /*:625*/
- #line 14001 "./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;
- }
- }
- }
-
- /*:635*/
- #line 804 "./typica.w"
-
- /*314:*/
- #line 7404 "./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;
- }
-
- /*:314*/
- #line 805 "./typica.w"
-
- /*717:*/
- #line 15819 "./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);
- }
-
- /*:717*/
- #line 806 "./typica.w"
-
- /*719:*/
- #line 15911 "./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)));
- }
- }
-
- /*:719*/
- #line 807 "./typica.w"
-
- /*721:*/
- #line 15949 "./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)));
- }
- }
-
- /*:721*/
- #line 808 "./typica.w"
-
- /*723:*/
- #line 15979 "./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)));
- }
- }
-
- /*:723*/
- #line 809 "./typica.w"
-
- /*725:*/
- #line 16014 "./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)));
- }
- }
-
- /*:725*/
- #line 810 "./typica.w"
-
- /*780:*/
- #line 17765 "./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);
- /*693:*/
- #line 15275 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:693*/
- #line 17855 "./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");
- }
-
- /*:780*/
- #line 811 "./typica.w"
-
- /*728:*/
- #line 16063 "./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();
- }
-
- /*:728*/
- #line 812 "./typica.w"
-
- /*765:*/
- #line 17093 "./typica.w"
-
- ModbusRTUDevice::ModbusRTUDevice(DeviceTreeModel*model,const QModelIndex&index)
- :QObject(NULL),messageDelayTimer(new QTimer),unitIsF(true),readingsv(false),
- waiting(false)
- {
- 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);
- connect(messageDelayTimer,SIGNAL(timeout()),this,SLOT(sendNextMessage()));
- 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;
- }
- }
-
- 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);
- }
-
- 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);
- }
-
- 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)
- {
- /*766:*/
- #line 17342 "./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);
-
- /*:766*/
- #line 17329 "./typica.w"
-
- }
- else
- {
- /*767:*/
- #line 17372 "./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;
- }
- }
-
- /*:767*/
- #line 17333 "./typica.w"
-
- }
- }
-
- /*:765*//*768:*/
- #line 17410 "./typica.w"
-
- ModbusRTUDevice::~ModbusRTUDevice()
- {
- messageDelayTimer->stop();
- port->close();
- }
-
- /*:768*//*769:*/
- #line 17432 "./typica.w"
-
- void ModbusRTUDevice::dataAvailable()
- {
- if(messageDelayTimer->isActive())
- {
- messageDelayTimer->stop();
- }
- responseBuffer.append(port->readAll());
- /*770:*/
- #line 17477 "./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;
- }
-
- /*:770*/
- #line 17440 "./typica.w"
-
- 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);
- messageDelayTimer->start(delayTime);
- }
- else
- {
- qDebug()<<"CRC failed";
- }
- waiting= false;
- responseBuffer.clear();
- }
-
- /*:769*//*771:*/
- #line 17519 "./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;
- }
-
- /*:771*//*772:*/
- #line 17550 "./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);
- 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)");
- }
-
- /*:772*//*773:*/
- #line 17598 "./typica.w"
-
- void ModbusRTUDevice::ignore(QByteArray)
- {
- return;
- }
-
- /*:773*/
- #line 813 "./typica.w"
-
- /*647:*/
- #line 14256 "./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;
- }
-
- /*:647*/
- #line 814 "./typica.w"
-
- /*649:*/
- #line 14345 "./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()));
- }
-
- /*:649*//*650:*/
- #line 14380 "./typica.w"
-
- int DeviceTreeModel::columnCount(const QModelIndex&)const
- {
- return 1;
- }
-
- int DeviceTreeModel::rowCount(const QModelIndex&parent)const
- {
- if(parent.column()> 0)
- {
- return 0;
- }
- /*651:*/
- #line 14399 "./typica.w"
-
- DeviceTreeModelNode*parentItem;
- if(!parent.isValid())
- {
- parentItem= root;
- }
- else
- {
- parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
- }
-
- /*:651*/
- #line 14392 "./typica.w"
-
- return parentItem->node().childNodes().count();
- }
-
- /*:650*//*652:*/
- #line 14413 "./typica.w"
-
- QModelIndex DeviceTreeModel::index(int row,int column,
- const QModelIndex&parent)const
- {
- if(!hasIndex(row,column,parent))
- {
- return QModelIndex();
- }
- /*651:*/
- #line 14399 "./typica.w"
-
- DeviceTreeModelNode*parentItem;
- if(!parent.isValid())
- {
- parentItem= root;
- }
- else
- {
- parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
- }
-
- /*:651*/
- #line 14421 "./typica.w"
-
- DeviceTreeModelNode*childItem= parentItem->child(row);
- if(childItem)
- {
- return createIndex(row,column,childItem);
- }
- return QModelIndex();
- }
-
- /*:652*//*653:*/
- #line 14432 "./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);
- }
-
- /*:653*//*654:*/
- #line 14451 "./typica.w"
-
- Qt::ItemFlags DeviceTreeModel::flags(const QModelIndex&index)const
- {
- if(!index.isValid())
- {
- return 0;
- }
- return Qt::ItemIsEnabled|Qt::ItemIsSelectable|Qt::ItemIsEditable;
- }
-
- /*:654*//*655:*/
- #line 14466 "./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();
- }
-
- /*:655*//*656:*/
- #line 14498 "./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;
- }
-
- /*:656*//*657:*/
- #line 14521 "./typica.w"
-
- void DeviceTreeModel::newNode(const QString&name,const QString&driver,
- const QModelIndex&parent)
- {
- QString referenceID= QUuid::createUuid().toString();
- /*651:*/
- #line 14399 "./typica.w"
-
- DeviceTreeModelNode*parentItem;
- if(!parent.isValid())
- {
- parentItem= root;
- }
- else
- {
- parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
- }
-
- /*:651*/
- #line 14526 "./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();
- }
-
- /*:657*//*658:*/
- #line 14544 "./typica.w"
-
- bool DeviceTreeModel::removeRows(int row,int count,const QModelIndex&parent)
- {
- /*651:*/
- #line 14399 "./typica.w"
-
- DeviceTreeModelNode*parentItem;
- if(!parent.isValid())
- {
- parentItem= root;
- }
- else
- {
- parentItem= static_cast<DeviceTreeModelNode*> (parent.internalPointer());
- }
-
- /*:651*/
- #line 14547 "./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;
- }
-
- /*:658*//*659:*/
- #line 14586 "./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();
- }
-
- /*:659*//*660:*/
- #line 14607 "./typica.w"
-
- QVariant DeviceTreeModel::headerData(int,Qt::Orientation,int)const
- {
- return QVariant();
- }
-
- /*:660*//*661:*/
- #line 14616 "./typica.w"
-
- DeviceTreeModel::~DeviceTreeModel()
- {
- delete root;
- }
-
- /*:661*/
- #line 815 "./typica.w"
-
- /*688:*/
- #line 15115 "./typica.w"
-
- BasicDeviceConfigurationWidget::BasicDeviceConfigurationWidget(
- DeviceTreeModel*model,const QModelIndex&index)
- :QWidget(NULL),deviceModel(model),currentNode(index)
- {
-
- }
-
- /*:688*//*689:*/
- #line 15127 "./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();
- }
-
- /*:689*//*690:*/
- #line 15161 "./typica.w"
-
- void BasicDeviceConfigurationWidget::insertChildNode(const QString&name,
- const QString&driver)
- {
- deviceModel->newNode(name,driver,currentNode);
- }
-
- /*:690*/
- #line 816 "./typica.w"
-
- /*679:*/
- #line 14960 "./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);
- 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()));
- }
-
- /*:679*//*680:*/
- #line 15014 "./typica.w"
-
- void DeviceConfigurationWindow::addDevice()
- {
- model->newNode(tr("New Roaster"),"roaster",QModelIndex());
- }
-
- /*:680*//*681:*/
- #line 15022 "./typica.w"
-
- void DeviceConfigurationWindow::removeNode()
- {
- QModelIndex index= view->currentIndex();
- if(index.isValid())
- {
- int row= index.row();
- QModelIndex parent= index.parent();
- model->removeRow(row,parent);
- }
- }
-
- /*:681*//*682:*/
- #line 15038 "./typica.w"
-
- void DeviceConfigurationWindow::newSelection(const QModelIndex&index)
- {
- QWidget*editor= AppInstance->deviceConfigurationWidget(model,index);
- if(editor)
- {
- configArea->setWidget(editor);
- editor->show();
- }
- }
-
- /*:682*//*683:*/
- #line 15055 "./typica.w"
-
- void DeviceConfigurationWindow::resizeColumn()
- {
- view->resizeColumnToContents(0);
- }
-
- /*:683*/
- #line 817 "./typica.w"
-
- /*703:*/
- #line 15466 "./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);
- /*693:*/
- #line 15275 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:693*/
- #line 15487 "./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)));
- }
-
- /*:703*//*704:*/
- #line 15517 "./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");
- }
-
- /*:704*/
- #line 818 "./typica.w"
-
- /*699:*/
- #line 15380 "./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);
- /*693:*/
- #line 15275 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:693*/
- #line 15394 "./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);
- }
-
- /*:699*//*700:*/
- #line 15416 "./typica.w"
-
- void NiDaqMxBase9211ConfWidget::updateDeviceId(const QString&newId)
- {
- updateAttribute("deviceID",newId);
- }
-
- /*:700*//*701:*/
- #line 15424 "./typica.w"
-
- void NiDaqMxBase9211ConfWidget::addChannel()
- {
- insertChildNode(tr("Thermocouple channel"),"ni9211seriestc");
- }
-
- /*:701*/
- #line 819 "./typica.w"
-
- /*697:*/
- #line 15331 "./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);
- }
-
- /*:697*/
- #line 820 "./typica.w"
-
- /*585:*/
- #line 12881 "./typica.w"
-
- ReportAction::ReportAction(const QString&fileName,const QString&reportName,
- QObject*parent):
- QAction(reportName,parent),reportFile(fileName)
- {
- connect(this,SIGNAL(triggered()),this,SLOT(createReport()));
- }
-
- /*:585*//*586:*/
- #line 12897 "./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;
- /*169:*/
- #line 3998 "./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())
- {
- /*170:*/
- #line 4033 "./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")
- {
- addLayoutToWidget(element,&widgetStack,&layoutStack);
- }
- else if(element.tagName()=="menu")
- {
- /*171:*/
- #line 4080 "./typica.w"
-
- QMenuBar*bar= window->menuBar();
- bar->setParent(window);
- bar->setObjectName("menuBar");
- if(element.hasAttribute("name"))
- {
- QMenu*menu= bar->addMenu(element.attribute("name"));
- menu->setParent(bar);
- if(element.hasAttribute("type"))
- {
- if(element.attribute("type")=="reports")
- {
- if(element.hasAttribute("src"))
- {
- /*583:*/
- #line 12844 "./typica.w"
-
- QSettings settings;
- QDir directory(QString("%1/%2").arg(settings.value("config").toString()).
- arg(element.attribute("src")));
- 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);
- /*587:*/
- #line 12921 "./typica.w"
-
- QString path= reportFile.absoluteFilePath();
- QFile file(path);
- if(file.open(QIODevice::ReadOnly))
- {
- QDomDocument document;
- document.setContent(&file,true);
- QDomElement root= document.documentElement();
- QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
- if(!titleNode.isNull())
- {
- QDomElement titleElement= titleNode.toElement();
- QString title= titleElement.text();
- if(!title.isEmpty())
- {
- QStringList hierarchy= title.split(":->");
- QMenu*insertionPoint= menu;
- /*588:*/
- #line 12948 "./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));
- }
- }
-
- /*:588*/
- #line 12938 "./typica.w"
-
- ReportAction*action= new ReportAction(path,hierarchy.last());
- insertionPoint->addAction(action);
- }
- }
- }
-
- /*:587*/
- #line 12857 "./typica.w"
-
- }
-
- /*:583*/
- #line 4094 "./typica.w"
-
- }
- }
- }
- if(element.hasChildNodes())
- {
- /*172:*/
- #line 4107 "./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(itemElement.text(),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"
- /*:172*/
- #line 4100 "./typica.w"
-
- }
- }
-
- /*:171*/
- #line 4058 "./typica.w"
-
- }
- }
- i++;
- }
- QScriptValue oldThis= context->thisObject();
- context->setThisObject(object);
- QScriptValue result= engine->evaluate(windowScript);
- /*164:*/
- #line 3847 "./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;
- }
- }
-
- /*:164*/
- #line 4066 "./typica.w"
-
- context->setThisObject(oldThis);
-
- /*:170*/
- #line 4009 "./typica.w"
-
- }
- /*173:*/
- #line 9 "./helpmenu.w"
-
- HelpMenu*helpMenu= new HelpMenu();
- window->menuBar()->addMenu(helpMenu);
-
- /*:173*/
- #line 4011 "./typica.w"
-
- window->show();
-
- /*:169*/
- #line 12910 "./typica.w"
-
- file.close();
- engine->popContext();
- }
- }
-
- /*:586*/
- #line 821 "./typica.w"
-
- /*205:*/
- #line 5164 "./typica.w"
-
- NumericDelegate::NumericDelegate(QObject*parent):
- QItemDelegate(parent)
- {
-
- }
-
- /*:205*//*206:*/
- #line 5176 "./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);
- }
-
- /*:206*//*207:*/
- #line 5191 "./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();
- }
-
- /*:207*//*208:*/
- #line 5214 "./typica.w"
-
- QWidget*NumericDelegate::createEditor(QWidget*parent,
- const QStyleOptionViewItem&,
- const QModelIndex&)const
- {
- return(new QLineEdit(parent));
- }
-
- /*:208*//*209:*/
- #line 5225 "./typica.w"
-
- void NumericDelegate::updateEditorGeometry(QWidget*editor,
- const QStyleOptionViewItem&option,
- const QModelIndex&)const
- {
- editor->setGeometry(option.rect);
- }
-
- /*:209*/
- #line 822 "./typica.w"
-
- /*708:*/
- #line 15576 "./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);
- }
-
- /*:708*/
- #line 823 "./typica.w"
-
- /*710:*/
- #line 15625 "./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);
- /*693:*/
- #line 15275 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:693*/
- #line 15639 "./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");
- }
-
- /*:710*/
- #line 824 "./typica.w"
-
- /*712:*/
- #line 15690 "./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);
- /*693:*/
- #line 15275 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:693*/
- #line 15712 "./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");
- }
-
- /*:712*/
- #line 825 "./typica.w"
-
- /*730:*/
- #line 16128 "./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)));
- /*693:*/
- #line 15275 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:693*/
- #line 16168 "./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);
- }
-
- /*:730*/
- #line 826 "./typica.w"
-
- /*732:*/
- #line 16291 "./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);
- /*693:*/
- #line 15275 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:693*/
- #line 16371 "./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));
- }
-
- /*:732*/
- #line 827 "./typica.w"
-
- /*734:*/
- #line 16534 "./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);
- /*693:*/
- #line 15275 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:693*/
- #line 16542 "./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));
- }
-
- /*:734*/
- #line 828 "./typica.w"
-
- /*736:*/
- #line 16590 "./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);
- /*693:*/
- #line 15275 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:693*/
- #line 16623 "./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));
- }
-
- /*:736*/
- #line 829 "./typica.w"
-
- /*692:*/
- #line 15197 "./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)));
- /*879:*/
- #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)));
-
- /*:879*/
- #line 15233 "./typica.w"
-
- addAnnotationControlButton->setMenu(annotationMenu);
- layout->addWidget(addAnnotationControlButton);
- 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)));
- /*805:*/
- #line 277 "./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);
-
- /*:805*/
- #line 15244 "./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);
- layout->addLayout(idLayout);
- /*693:*/
- #line 15275 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:693*/
- #line 15253 "./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());
- break;
- }
- }
- updateRoasterId(id->value());
- connect(id,SIGNAL(valueChanged(int)),this,SLOT(updateRoasterId(int)));
- setLayout(layout);
- }
-
- /*:692*//*694:*/
- #line 15285 "./typica.w"
-
- void RoasterConfWidget::updateRoasterId(int id)
- {
- updateAttribute("databaseid",QString("%1").arg(id));
- }
-
- /*:694*/
- #line 830 "./typica.w"
-
- /*740:*/
- #line 16773 "./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);
- /*693:*/
- #line 15275 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:693*/
- #line 16782 "./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);
- }
-
- /*:740*//*741:*/
- #line 16804 "./typica.w"
-
- void AnnotationButtonConfWidget::updateButtonText(const QString&text)
- {
- updateAttribute("buttontext",text);
- }
-
- void AnnotationButtonConfWidget::updateAnnotationText(const QString&text)
- {
- updateAttribute("annotationtext",text);
- }
-
- /*:741*//*744:*/
- #line 16842 "./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);
- /*693:*/
- #line 15275 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:693*/
- #line 16851 "./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);
- }
-
- /*:744*/
- #line 831 "./typica.w"
-
- /*747:*/
- #line 16919 "./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);
- /*693:*/
- #line 15275 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:693*/
- #line 16938 "./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);
- }
-
- /*:747*/
- #line 832 "./typica.w"
-
- /*284:*/
- #line 6723 "./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)));
- }
-
- /*:284*//*285:*/
- #line 6737 "./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;
- }
-
- /*:285*//*286:*/
- #line 6764 "./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;
- }
-
- /*:286*/
- #line 833 "./typica.w"
-
- /*291:*/
- #line 6897 "./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();
- }
-
- /*:291*/
- #line 834 "./typica.w"
-
- /*784:*/
- #line 18252 "./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);
- /*693:*/
- #line 15275 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:693*/
- #line 18268 "./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")
- {
- /*785:*/
- #line 18307 "./typica.w"
-
- QString data= node.attribute("value");
- if(data.length()> 3)
- {
- data.chop(2);
- data= data.remove(0,2);
- }
- QStringList itemList= data.split(",");
-
- /*:785*/
- #line 18282 "./typica.w"
-
- int column= 0;
- /*786:*/
- #line 18319 "./typica.w"
-
- for(int i= 0;i<itemList.size();i++)
- {
- tablemodel->setData(tablemodel->index(i,column),
- QVariant(itemList.at(i).toDouble()),
- Qt::DisplayRole);
- }
-
- /*:786*/
- #line 18284 "./typica.w"
-
-
- }
- else if(node.attribute("name")=="destinationvalues")
- {
- /*785:*/
- #line 18307 "./typica.w"
-
- QString data= node.attribute("value");
- if(data.length()> 3)
- {
- data.chop(2);
- data= data.remove(0,2);
- }
- QStringList itemList= data.split(",");
-
- /*:785*/
- #line 18289 "./typica.w"
-
- int column= 1;
- /*786:*/
- #line 18319 "./typica.w"
-
- for(int i= 0;i<itemList.size();i++)
- {
- tablemodel->setData(tablemodel->index(i,column),
- QVariant(itemList.at(i).toDouble()),
- Qt::DisplayRole);
- }
-
- /*:786*/
- #line 18291 "./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);
- }
-
- /*:784*//*787:*/
- #line 18330 "./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);
- }
-
- /*:787*/
- #line 835 "./typica.w"
-
- /*790:*/
- #line 18373 "./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);
- /*693:*/
- #line 15275 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:693*/
- #line 18387 "./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);
- }
-
- /*:790*//*791:*/
- #line 18416 "./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);
- }
-
- /*:791*/
- #line 836 "./typica.w"
-
- /*750:*/
- #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);
- /*693:*/
- #line 15275 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:693*/
- #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);
- }
-
- /*:750*//*751:*/
- #line 49 "./freeannotation.w"
-
- void FreeAnnotationConfWidget::updateLabel(const QString&text)
- {
- updateAttribute("labeltext",text);
- }
-
- /*:751*/
- #line 837 "./typica.w"
-
- /*794:*/
- #line 40 "./rate.w"
-
- void RateOfChange::newMeasurement(Measurement measure)
- {
- cache.append(measure);
- /*795:*/
- #line 65 "./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;
- }
- }
- }
-
- /*:795*/
- #line 44 "./rate.w"
-
- if(cache.size()>=2)
- {
- /*796:*/
- #line 100 "./rate.w"
-
- QList<double> rates;
- for(int i= 1;i<cache.size();i++)
- {
- double mdiff= cache.at(i).temperature()-cache.at(i-1).temperature();
- double tdiff= (double)(cache.at(i-1).time().msecsTo(cache.at(i).time()))/1000.0;
- rates.append(mdiff/tdiff);
- }
- double acc= 0.0;
- for(int i= 0;i<rates.size();i++)
- {
- acc+= rates.at(i);
- }
- double pavg= acc/= rates.size();
- double v2= pavg*st;
- double refm= cache.back().temperature()-cache.front().temperature();
- double reft= (double)(cache.front().time().msecsTo(cache.back().time()))/1000.0;
- double ref= refm/reft;
- Measurement value(v2,cache.back().time(),cache.back().scale());
- value.insert("relative",true);
- emit newData(value);
- double calcdiff= ref-pavg;
- if(calcdiff<0)
- {
- calcdiff= -calcdiff;
- }
- if(pavg<0)
- {
- pavg= -pavg;
- }
- if(calcdiff> (pavg*0.2))
- {
- Measurement save= cache.back();
- cache.clear();
- cache.append(save);
- }
-
- /*:796*/
- #line 47 "./rate.w"
-
- }
- }
-
- /*:794*//*797:*/
- #line 139 "./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);
- }
-
- /*:797*/
- #line 838 "./typica.w"
-
- /*754:*/
- #line 23 "./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"));
- setCentralWidget(settingsTab);
- }
-
- /*:754*/
- #line 839 "./typica.w"
-
- /*759:*/
- #line 25 "./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);
- }
-
- /*:759*//*761:*/
- #line 63 "./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);
- }
-
- /*:761*//*762:*/
- #line 114 "./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);
- }
-
- /*:762*//*763:*/
- #line 157 "./graphsettings.w"
-
- void GraphSettingsRelativeTab::showColorPicker()
- {
- QColor color= QColorDialog::getColor(QColor(colorEdit->text()),this);
- colorEdit->setText(color.name());
- }
- #line 17020 "./typica.w"
-
- /*:763*/
- #line 840 "./typica.w"
-
- /*829:*/
- #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);
- /*693:*/
- #line 15275 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:693*/
- #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);
- }
-
- /*:829*//*830:*/
- #line 758 "./dataqsdk.w"
-
- void DataqSdkDeviceConfWidget::updateAutoSelect(bool automatic)
- {
- if(automatic)
- {
- updateAttribute("autoSelect","true");
- deviceIdStack->setCurrentIndex(0);
- }
- else
- {
- updateAttribute("autoSelect","false");
- deviceIdStack->setCurrentIndex(1);
- }
- }
-
- /*:830*//*831:*/
- #line 775 "./dataqsdk.w"
-
- void DataqSdkDeviceConfWidget::updateDeviceNumber(int deviceNumber)
- {
- updateAttribute("deviceNumber",QString("%1").arg(deviceNumber));
- }
-
- void DataqSdkDeviceConfWidget::updatePort(QString portId)
- {
- updateAttribute("port",portId);
- }
-
- /*:831*//*832:*/
- #line 788 "./dataqsdk.w"
-
- void DataqSdkDeviceConfWidget::addChannel()
- {
- insertChildNode(tr("Channel"),"dataqsdkchannel");
- }
-
- /*:832*//*835:*/
- #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)
- {
- /*839:*/
- #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();
-
- /*:839*/
- #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);
- /*693:*/
- #line 15275 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:693*/
- #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);
- }
-
- /*:835*//*836:*/
- #line 1038 "./dataqsdk.w"
-
- void DataqSdkChannelConfWidget::updateUnits(const QString&unit)
- {
- updateAttribute("type",unit);
- }
-
- /*:836*//*837:*/
- #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");
- }
-
- /*:837*//*840:*/
- #line 1136 "./dataqsdk.w"
-
- void DataqSdkChannelConfWidget::startCalibration()
- {
- startButton->setEnabled(false);
- stopButton->setEnabled(true);
- resetButton->setEnabled(true);
- calibrationDevice= new DataqSdkDevice(deviceID);
- Channel*channel;
- for(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();
- /*842:*/
- #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;
-
- /*:842*/
- #line 1161 "./dataqsdk.w"
-
- }
-
- /*:840*//*841:*/
- #line 1172 "./dataqsdk.w"
-
- void DataqSdkChannelConfWidget::resetCalibration()
- {
- /*842:*/
- #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;
-
- /*:842*/
- #line 1175 "./dataqsdk.w"
-
- }
-
- /*:841*//*843:*/
- #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));
- }
-
- /*:843*//*844:*/
- #line 1224 "./dataqsdk.w"
-
- void DataqSdkChannelConfWidget::updateColumnName(const QString&value)
- {
- updateAttribute("column",value);
- }
-
-
- /*:844*/
- #line 841 "./typica.w"
-
- /*868:*/
- #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)));
- /*693:*/
- #line 15275 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:693*/
- #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);
- }
-
- /*:868*//*869:*/
- #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());
- }
-
- /*:869*/
- #line 842 "./typica.w"
-
- /*881:*/
- #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);
- }
- }
- }
- }
-
- /*:881*//*882:*/
- #line 216 "./valueannotation.w"
-
- void ValueAnnotation::annotate()
- {
- if(lastIndex> -1)
- {
- emit annotation(annotations.at(lastIndex),measurementColumn,annotationColumn);
- }
- }
-
- /*:882*//*883:*/
- #line 228 "./valueannotation.w"
-
- void ValueAnnotation::setAnnotation(double value,const QString&annotation)
- {
- values.append(value);
- annotations.append(annotation);
- }
-
- /*:883*//*884:*/
- #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;
- }
-
- /*:884*//*885:*/
- #line 255 "./valueannotation.w"
-
- ValueAnnotation::ValueAnnotation():QObject(),
- lastIndex(-1),annotationColumn(2),measurementColumn(1),tolerance(0.05)
- {
-
- }
-
- /*:885*/
- #line 843 "./typica.w"
-
- /*873:*/
- #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);
- /*693:*/
- #line 15275 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:693*/
- #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")
- {
- /*785:*/
- #line 18307 "./typica.w"
-
- QString data= node.attribute("value");
- if(data.length()> 3)
- {
- data.chop(2);
- data= data.remove(0,2);
- }
- QStringList itemList= data.split(",");
-
- /*:785*/
- #line 66 "./valueannotation.w"
-
- int column= 0;
- /*786:*/
- #line 18319 "./typica.w"
-
- for(int i= 0;i<itemList.size();i++)
- {
- tablemodel->setData(tablemodel->index(i,column),
- QVariant(itemList.at(i).toDouble()),
- Qt::DisplayRole);
- }
-
- /*:786*/
- #line 68 "./valueannotation.w"
-
- }
- else if(node.attribute("name")=="annotations")
- {
- /*874:*/
- #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();
- }
-
- /*:874*/
- #line 72 "./valueannotation.w"
-
- int column= 1;
- /*875:*/
- #line 104 "./valueannotation.w"
-
- for(int i= 0;i<itemList.size();i++)
- {
- tablemodel->setData(tablemodel->index(i,column),
- QVariant(itemList.at(i)),
- Qt::DisplayRole);
- }
-
- /*:875*/
- #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);
- }
-
- /*:873*//*876:*/
- #line 115 "./valueannotation.w"
-
- void ValueAnnotationConfWidget::updateAnnotations()
- {
- updateAttribute("measuredValues",tablemodel->arrayLiteral(0,Qt::DisplayRole));
- updateAttribute("annotations",tablemodel->arrayLiteral(1,Qt::DisplayRole));
- }
-
- /*:876*//*877:*/
- #line 125 "./valueannotation.w"
-
- void ValueAnnotationConfWidget::updateSourceColumn(const QString&source)
- {
- updateAttribute("source",source);
- }
-
- void ValueAnnotationConfWidget::updateStart(bool noteOnStart)
- {
- updateAttribute("emitOnStart",noteOnStart?"true":"false");
- }
-
- /*:877*/
- #line 844 "./typica.w"
-
-
- /*:17*//*806:*/
- #line 284 "./rate.w"
-
- /*802:*/
- #line 210 "./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);
- /*693:*/
- #line 15275 "./typica.w"
-
- QDomElement referenceElement=
- model->referenceElement(model->data(index,Qt::UserRole).toString());
- QDomNodeList configData= referenceElement.elementsByTagName("attribute");
- QDomElement node;
-
- /*:693*/
- #line 225 "./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);
- }
-
- /*:802*//*803:*/
- #line 254 "./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);
- }
-
- /*:803*/
- #line 285 "./rate.w"
-
- #line 18442 "./typica.w"
-
- #line 1 "./dataqsdk.w"
- /*:806*/
- #line 763 "./typica.w"
-
- /*21:*/
- #line 904 "./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<> 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;
- }
-
- /*:21*//*22:*/
- #line 949 "./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());
- }
-
- /*:22*//*26:*/
- #line 1036 "./typica.w"
-
- void setQObjectProperties(QScriptValue,QScriptEngine*)
- {
-
- }
-
- /*:26*//*28:*/
- #line 1050 "./typica.w"
-
- void setQPaintDeviceProperties(QScriptValue,QScriptEngine*)
- {
-
- }
-
- void setQLayoutItemProperties(QScriptValue,QScriptEngine*)
- {
-
- }
-
- /*:28*//*31:*/
- #line 1089 "./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));
- }
-
- /*:31*//*32:*/
- #line 1111 "./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();
- }
-
- /*:32*//*34:*/
- #line 1193 "./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())
- {
- /*39:*/
- #line 1305 "./typica.w"
-
- QSettings settings;
- restoreGeometry(settings.value(QString("geometries/%1").arg(objectName())).
- toByteArray());
-
- /*:39*/
- #line 1233 "./typica.w"
-
- event->accept();
- }
- else
- {
- event->ignore();
- }
- }
-
- void ScriptQMainWindow::show()
- {
- QMainWindow::show();
- }
-
- /*:34*//*35:*/
- #line 1254 "./typica.w"
-
- void ScriptQMainWindow::closeEvent(QCloseEvent*event)
- {
- if(isWindowModified()){
- /*36:*/
- #line 1268 "./typica.w"
-
- QMessageBox::StandardButton result;
- result= QMessageBox::warning(this,"Typica",closePrompt(),
- QMessageBox::Ok|QMessageBox::Cancel);
- if(result==QMessageBox::Cancel)
- {
- event->ignore();
- return;
- }
-
- /*:36*/
- #line 1258 "./typica.w"
-
- }
- emit aboutToClose();
- /*38:*/
- #line 1299 "./typica.w"
-
- QSettings settings;
- settings.setValue(QString("geometries/%1").arg(objectName()),saveGeometry());
-
- /*:38*/
- #line 1261 "./typica.w"
-
- event->accept();
- }
-
- /*:35*//*37:*/
- #line 1280 "./typica.w"
-
- QString ScriptQMainWindow::closePrompt()
- {
- return cprompt;
- }
-
- void ScriptQMainWindow::setClosePrompt(QString prompt)
- {
- cprompt= prompt;
- }
-
- /*:37*//*42:*/
- #line 1333 "./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));
- }
-
- /*:42*//*43:*/
- #line 1355 "./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();
- }
-
- /*:43*//*44:*/
- #line 1389 "./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;
- }
-
- /*:44*//*46:*/
- #line 1419 "./typica.w"
-
- void setQMenuBarProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQWidgetProperties(value,engine);
- value.setProperty("addMenu",engine->newFunction(QMenuBar_addMenu));
- }
-
- /*:46*//*47:*/
- #line 1434 "./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;
- }
-
- /*:47*//*49:*/
- #line 1464 "./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));
- }
-
- /*:49*//*50:*/
- #line 1474 "./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();
- }
-
- /*:50*//*53:*/
- #line 1536 "./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);
- }
-
- /*:53*//*56:*/
- #line 1570 "./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);
- }
-
- /*:56*//*59:*/
- #line 1607 "./typica.w"
-
- QScriptValue constructQLineEdit(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new QLineEdit());
- setQLineEditProperties(object,engine);
- return object;
- }
-
- /*:59*//*60:*/
- #line 1618 "./typica.w"
-
- void setQLineEditProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQWidgetProperties(value,engine);
- }
-
- /*:60*//*63:*/
- #line 1652 "./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));
- }
-
- /*:63*//*64:*/
- #line 1672 "./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();
- }
-
- /*:64*//*65:*/
- #line 1705 "./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();
- }
-
- /*:65*//*67:*/
- #line 1758 "./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();
- }
-
- /*:67*//*70:*/
- #line 1825 "./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();
- }
-
- /*:70*//*71:*/
- #line 1876 "./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();
- }
-
- /*:71*//*74:*/
- #line 1940 "./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();
- }
-
- /*:74*//*77:*/
- #line 1998 "./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;
- }
-
- /*:77*//*78:*/
- #line 2034 "./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;
- }
-
- /*:78*//*79:*/
- #line 2071 "./typica.w"
-
- void setQFileDialogProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQDialogProperties(value,engine);
- }
-
- void setQDialogProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQWidgetProperties(value,engine);
- }
-
- /*:79*//*82:*/
- #line 2106 "./typica.w"
-
- QScriptValue constructQFile(QScriptContext*context,QScriptEngine*engine)
- {
- QScriptValue object=
- engine->newQObject(new QFile(argument<QString> (0,context)));
- setQFileProperties(object,engine);
- return object;
- }
-
- /*:82*//*83:*/
- #line 2117 "./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);
- }
-
- /*:83*//*84:*/
- #line 2139 "./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));
- }
-
- /*:84*//*85:*/
- #line 2154 "./typica.w"
-
- QScriptValue QIODevice_open(QScriptContext*context,QScriptEngine*)
- {
- QIODevice*self= getself<QIODevice*> (context);
- if(context->argumentCount()==1)
- {
- switch(argument<int> (0,context))
- {
- case 1:
- self->open(QIODevice::ReadOnly);
- break;
- case 2:
- self->open(QIODevice::WriteOnly);
- break;
- case 3:
- self->open(QIODevice::ReadWrite);
- break;
- default:
- break;
- }
- }
- else
- {
- self->open(QIODevice::ReadWrite);
- }
- return QScriptValue();
- }
-
- QScriptValue QIODevice_close(QScriptContext*context,QScriptEngine*)
- {
- QIODevice*self= getself<QIODevice*> (context);
- self->close();
- return QScriptValue();
- }
-
- /*:85*//*86:*/
- #line 2193 "./typica.w"
-
- QScriptValue QIODevice_readToString(QScriptContext*context,QScriptEngine*)
- {
- QIODevice*self= getself<QIODevice*> (context);
- self->reset();
- return QScriptValue(QString(self->readAll()));
- }
-
- /*:86*//*89:*/
- #line 2223 "./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();
- }
-
- /*:89*//*92:*/
- #line 2271 "./typica.w"
-
- QScriptValue constructXQuery(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object= engine->toScriptValue<void*> (new QXmlQuery);
- setXQueryProperties(object,engine);
- return object;
- }
-
- 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));
- }
-
- /*:92*//*93:*/
- #line 2289 "./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();
- }
-
- /*:93*//*94:*/
- #line 2300 "./typica.w"
-
- QScriptValue XQuery_setQuery(QScriptContext*context,QScriptEngine*)
- {
- QXmlQuery*self= getself<QXmlQuery*> (context);
- self->setQuery(argument<QString> (0,context));
- return QScriptValue();
- }
-
- /*:94*//*95:*/
- #line 2310 "./typica.w"
-
- QScriptValue XQuery_exec(QScriptContext*context,QScriptEngine*)
- {
- QXmlQuery*self= getself<QXmlQuery*> (context);
- QString result;
- self->evaluateTo(&result);
- return QScriptValue(result);
- }
-
- /*:95*//*98:*/
- #line 2365 "./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));
- }
-
- /*:98*//*99:*/
- #line 2412 "./typica.w"
-
- QScriptValue XmlWriter_setDevice(QScriptContext*context,QScriptEngine*)
- {
- QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
- QIODevice*device= argument<QIODevice*> (0,context);
- self->setDevice(device);
- return QScriptValue();
- }
-
- /*:99*//*100:*/
- #line 2426 "./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();
- }
-
- /*:100*//*101:*/
- #line 2445 "./typica.w"
-
- QScriptValue XmlWriter_writeDTD(QScriptContext*context,QScriptEngine*)
- {
- QXmlStreamWriter*self= getself<QXmlStreamWriter*> (context);
- self->writeDTD(argument<QString> (0,context));
- return QScriptValue();
- }
-
- /*:101*//*102:*/
- #line 2456 "./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();
- }
-
- /*:102*//*103:*/
- #line 2492 "./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();
- }
-
- /*:103*//*104:*/
- #line 2513 "./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();
- }
-
- /*:104*//*107:*/
- #line 2572 "./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));
- }
-
- /*:107*//*108:*/
- #line 2602 "./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);
- }
-
- /*:108*//*109:*/
- #line 2622 "./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());
- }
-
- /*:109*//*110:*/
- #line 2643 "./typica.w"
-
- QScriptValue XmlReader_readNext(QScriptContext*context,QScriptEngine*)
- {
- QXmlStreamReader*self= getself<QXmlStreamReader*> (context);
- self->readNext();
- return QScriptValue();
- }
-
- /*:110*//*111:*/
- #line 2653 "./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());
- }
-
- /*:111*//*114:*/
- #line 2695 "./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));
- }
-
- /*:114*//*115:*/
- #line 2707 "./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();
- }
-
- /*:115*//*118:*/
- #line 2776 "./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);
- }
-
- /*:118*//*121:*/
- #line 2834 "./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;
- }
-
- /*:121*//*122:*/
- #line 2882 "./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));
- }
-
- /*:122*//*123:*/
- #line 2911 "./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);
- }
-
- /*:123*//*124:*/
- #line 2925 "./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;
- }
-
- /*:124*//*125:*/
- #line 2968 "./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;
- }
-
- /*:125*//*126:*/
- #line 2989 "./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;
- }
-
- /*:126*//*127:*/
- #line 3009 "./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;
- }
-
- /*:127*//*128:*/
- #line 3065 "./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;
- }
-
- /*:128*//*129:*/
- #line 3103 "./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;
- }
-
- /*:129*//*130:*/
- #line 3142 "./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();
- }
-
- /*:130*//*131:*/
- #line 3178 "./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;
- }
-
- /*:131*//*132:*/
- #line 3214 "./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;
- }
-
- /*:132*//*133:*/
- #line 3235 "./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;
- }
-
- /*:133*//*135:*/
- #line 3275 "./typica.w"
-
- void setQAbstractScrollAreaProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQFrameProperties(value,engine);
- }
-
- /*:135*//*137:*/
- #line 3289 "./typica.w"
-
- void setQAbstractItemViewProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQAbstractScrollAreaProperties(value,engine);
- }
-
- /*:137*//*139:*/
- #line 3303 "./typica.w"
-
- void setQGraphicsViewProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQAbstractScrollAreaProperties(value,engine);
- }
-
- void setQTableViewProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQAbstractItemViewProperties(value,engine);
- }
-
- /*:139*//*142:*/
- #line 3336 "./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);
- }
-
- /*:142*//*149:*/
- #line 3448 "./typica.w"
-
- QScriptValue constructQSqlQuery(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object=
- engine->toScriptValue<void*> (new SqlQueryConnection());
- setQSqlQueryProperties(object,engine);
- return object;
- }
-
- /*:149*//*150:*/
- #line 3460 "./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));
- }
-
- /*:150*//*151:*/
- #line 3478 "./typica.w"
-
- QScriptValue QSqlQuery_exec(QScriptContext*context,QScriptEngine*engine)
- {
- SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
- QScriptValue retval;
- if(context->argumentCount()==1)
- {
- retval= QScriptValue(engine,
- query->exec(argument<QString> (0,context)));
- }
- else
- {
- retval= QScriptValue(engine,query->exec());
- }
- if(query->lastError().isValid())
- {
- qDebug()<<query->lastQuery();
- qDebug()<<query->lastError().text();
- }
- return retval;
- }
-
- QScriptValue QSqlQuery_executedQuery(QScriptContext*context,QScriptEngine*)
- {
- SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
- return QScriptValue(query->lastQuery());
- }
-
- QScriptValue QSqlQuery_next(QScriptContext*context,QScriptEngine*engine)
- {
- SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
- return QScriptValue(engine,query->next());
- }
-
- QScriptValue QSqlQuery_value(QScriptContext*context,QScriptEngine*engine)
- {
- SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
- return QScriptValue(engine,
- query->value(argument<int> (0,context)).toString());
- }
-
- /*:151*//*152:*/
- #line 3522 "./typica.w"
-
- QScriptValue QSqlQuery_prepare(QScriptContext*context,QScriptEngine*engine)
- {
- SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
- return QScriptValue(engine,query->prepare(argument<QString> (0,context)));
- }
-
- QScriptValue QSqlQuery_bind(QScriptContext*context,QScriptEngine*)
- {
- SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
- query->bindValue(argument<QString> (0,context),
- argument<QVariant> (1,context));
- return QScriptValue();
- }
-
- QScriptValue QSqlQuery_bindFileData(QScriptContext*context,
- QScriptEngine*)
- {
- SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
- 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*)
- {
- SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
- 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();
- }
-
- /*:152*//*153:*/
- #line 3574 "./typica.w"
-
- QScriptValue QSqlQuery_invalidate(QScriptContext*context,QScriptEngine*)
- {
- SqlQueryConnection*query= getself<SqlQueryConnection*> (context);
- delete query;
- return QScriptValue::UndefinedValue;
- }
-
- /*:153*//*156:*/
- #line 3615 "./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;
- }
-
- /*:156*//*157:*/
- #line 3634 "./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;
- }
-
- /*:157*//*158:*/
- #line 3660 "./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();
- }
-
- /*:158*//*159:*/
- #line 3680 "./typica.w"
-
- QScriptValue annotationFromRecord(QScriptContext*context,QScriptEngine*)
- {
- SqlQueryConnection query;
- 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);
- }
-
- /*:159*//*160:*/
- #line 3706 "./typica.w"
-
- QScriptValue setTabOrder(QScriptContext*context,QScriptEngine*)
- {
- QWidget::setTabOrder(argument<QWidget*> (0,context),
- argument<QWidget*> (1,context));
- return QScriptValue();
- }
-
- /*:160*//*167:*/
- #line 3945 "./typica.w"
-
- QScriptValue createWindow(QScriptContext*context,QScriptEngine*engine)
- {
- QString targetID= argument<QString> (0,context);
- QDomNode element;
- QScriptValue object;
- /*168:*/
- #line 3966 "./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++;
- }
-
- /*:168*/
- #line 3951 "./typica.w"
-
- if(!element.isNull())
- {
- /*169:*/
- #line 3998 "./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())
- {
- /*170:*/
- #line 4033 "./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")
- {
- addLayoutToWidget(element,&widgetStack,&layoutStack);
- }
- else if(element.tagName()=="menu")
- {
- /*171:*/
- #line 4080 "./typica.w"
-
- QMenuBar*bar= window->menuBar();
- bar->setParent(window);
- bar->setObjectName("menuBar");
- if(element.hasAttribute("name"))
- {
- QMenu*menu= bar->addMenu(element.attribute("name"));
- menu->setParent(bar);
- if(element.hasAttribute("type"))
- {
- if(element.attribute("type")=="reports")
- {
- if(element.hasAttribute("src"))
- {
- /*583:*/
- #line 12844 "./typica.w"
-
- QSettings settings;
- QDir directory(QString("%1/%2").arg(settings.value("config").toString()).
- arg(element.attribute("src")));
- 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);
- /*587:*/
- #line 12921 "./typica.w"
-
- QString path= reportFile.absoluteFilePath();
- QFile file(path);
- if(file.open(QIODevice::ReadOnly))
- {
- QDomDocument document;
- document.setContent(&file,true);
- QDomElement root= document.documentElement();
- QDomNode titleNode= root.elementsByTagName("reporttitle").at(0);
- if(!titleNode.isNull())
- {
- QDomElement titleElement= titleNode.toElement();
- QString title= titleElement.text();
- if(!title.isEmpty())
- {
- QStringList hierarchy= title.split(":->");
- QMenu*insertionPoint= menu;
- /*588:*/
- #line 12948 "./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));
- }
- }
-
- /*:588*/
- #line 12938 "./typica.w"
-
- ReportAction*action= new ReportAction(path,hierarchy.last());
- insertionPoint->addAction(action);
- }
- }
- }
-
- /*:587*/
- #line 12857 "./typica.w"
-
- }
-
- /*:583*/
- #line 4094 "./typica.w"
-
- }
- }
- }
- if(element.hasChildNodes())
- {
- /*172:*/
- #line 4107 "./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(itemElement.text(),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"
- /*:172*/
- #line 4100 "./typica.w"
-
- }
- }
-
- /*:171*/
- #line 4058 "./typica.w"
-
- }
- }
- i++;
- }
- QScriptValue oldThis= context->thisObject();
- context->setThisObject(object);
- QScriptValue result= engine->evaluate(windowScript);
- /*164:*/
- #line 3847 "./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;
- }
- }
-
- /*:164*/
- #line 4066 "./typica.w"
-
- context->setThisObject(oldThis);
-
- /*:170*/
- #line 4009 "./typica.w"
-
- }
- /*173:*/
- #line 9 "./helpmenu.w"
-
- HelpMenu*helpMenu= new HelpMenu();
- window->menuBar()->addMenu(helpMenu);
-
- /*:173*/
- #line 4011 "./typica.w"
-
- window->show();
-
- /*:169*/
- #line 3954 "./typica.w"
-
- }
- return object;
- }
-
- /*:167*//*178:*/
- #line 4149 "./typica.w"
-
- void addLayoutToWidget(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *layoutStack)
- {
- if(element.hasAttribute("type"))
- {
- /*179:*/
- #line 4170 "./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);
- }
-
- /*:179*/
- #line 4155 "./typica.w"
-
- QWidget*widget= widgetStack->top();
- if(layout)
- {
- widget->setLayout(layout);
- }
- layoutStack->pop();
- }
- }
-
- /*:178*//*180:*/
- #line 4217 "./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);
- populateWidget(currentElement,widgetStack,layoutStack);
- widgetStack->pop();
- }
- }
- }
- }
-
- /*:180*//*181:*/
- #line 4249 "./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());
- }
- /*182:*/
- #line 4305 "./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);
- populateBoxLayout(columnElement,widgetStack,layoutStack);
- layoutStack->pop();
- }
- }
- }
-
- /*:182*/
- #line 4277 "./typica.w"
-
- }
- }
- }
- }
-
- /*:181*//*183:*/
- #line 4355 "./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();
- 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(currentElement.text());
- 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();
- }
- }
- }
- }
-
- /*:183*//*184:*/
- #line 4465 "./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"))
- {
- /*179:*/
- #line 4170 "./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);
- }
-
- /*:179*/
- #line 4473 "./typica.w"
-
- boxLayout->addLayout(layout);
- layoutStack->pop();
- }
- layoutStack->push(targetLayout);
- }
-
- /*:184*//*185:*/
- #line 4484 "./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);
- /*186:*/
- #line 4497 "./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();
- }
-
- /*:186*/
- #line 4491 "./typica.w"
-
- }
-
- /*:185*//*187:*/
- #line 4523 "./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();
- 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);
- }
- }
- }
- }
-
- /*:187*//*188:*/
- #line 4573 "./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);
- /*186:*/
- #line 4497 "./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();
- }
-
- /*:186*/
- #line 4581 "./typica.w"
-
- }
-
- /*:188*//*189:*/
- #line 4590 "./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);
- }
-
- /*:189*//*190:*/
- #line 4621 "./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);
- }
-
- /*:190*//*191:*/
- #line 4659 "./typica.w"
-
- void addDecorationToLayout(QDomElement element,QStack<QWidget*> *,
- QStack<QLayout*> *layoutStack)
- {
- /*192:*/
- #line 4680 "./typica.w"
-
- QString labelText= element.attribute("name");
- 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;
- }
- }
- /*193:*/
- #line 4705 "./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;
- }
- }
- }
-
- /*:193*/
- #line 4694 "./typica.w"
-
- WidgetDecorator*decoration= new WidgetDecorator(theWidget,labelText,
- orientation);
- if(element.hasAttribute("id"))
- {
- decoration->setObjectName(element.attribute("id"));
- }
-
- /*:192*/
- #line 4663 "./typica.w"
-
- QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
- layout->addWidget(decoration);
- }
-
- void addDecorationToSplitter(QDomElement element,
- QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *)
- {
- /*192:*/
- #line 4680 "./typica.w"
-
- QString labelText= element.attribute("name");
- 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;
- }
- }
- /*193:*/
- #line 4705 "./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;
- }
- }
- }
-
- /*:193*/
- #line 4694 "./typica.w"
-
- WidgetDecorator*decoration= new WidgetDecorator(theWidget,labelText,
- orientation);
- if(element.hasAttribute("id"))
- {
- decoration->setObjectName(element.attribute("id"));
- }
-
- /*:192*/
- #line 4672 "./typica.w"
-
- QSplitter*splitter= qobject_cast<QSplitter*> (widgetStack->top());
- splitter->addWidget(decoration);
- }
-
- /*:191*//*194:*/
- #line 4744 "./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")
- {
- addLayoutToWidget(currentElement,widgetStack,layoutStack);
- }
- }
- }
- }
-
- /*:194*//*195:*/
- #line 4787 "./typica.w"
-
- void addButtonToLayout(QDomElement element,QStack<QWidget*> *,
- QStack<QLayout*> *layoutStack)
- {
- QAbstractButton*button= NULL;
- QString text= element.attribute("name");
- 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);
- }
-
- /*:195*//*196:*/
- #line 4839 "./typica.w"
-
- void addSpinBoxToLayout(QDomElement element,QStack<QWidget*> *,
- QStack<QLayout*> *layoutStack)
- {
- AnnotationSpinBox*box= new AnnotationSpinBox("","",NULL);
- if(element.hasAttribute("pretext"))
- {
- box->setPretext(element.attribute("pretext"));
- }
- if(element.hasAttribute("posttext"))
- {
- box->setPosttext(element.attribute("posttext"));
- }
- 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);
- }
-
- /*:196*//*197:*/
- #line 4895 "./typica.w"
-
- void addZoomLogToSplitter(QDomElement element,QStack<QWidget*> *widgetStack,
- QStack<QLayout*> *)
- {
- ZoomLog*widget= new ZoomLog;
- if(!widget)
- {
- qDebug()<<"Error constructing widget!";
- }
- 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= currentElement.text();
- 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!";
- }
- }
-
- /*:197*//*198:*/
- #line 4943 "./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);
- }
-
- /*:198*//*199:*/
- #line 4960 "./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);
- }
-
- /*:199*//*200:*/
- #line 5039 "./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,
- currentElement.attribute("name"));
- }
- if(currentElement.hasAttribute("delegate"))
- {
- /*201:*/
- #line 5087 "./typica.w"
-
- if(currentElement.attribute("delegate")=="sql")
- {
- /*202:*/
- #line 5103 "./typica.w"
-
- SqlComboBoxDelegate*delegate= new SqlComboBoxDelegate;
- SqlComboBox*widget= new SqlComboBox();
- 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);
-
- /*:202*/
- #line 5090 "./typica.w"
-
- }
- else if(currentElement.attribute("delegate")=="numeric")
- {
- /*203:*/
- #line 5136 "./typica.w"
-
- NumericDelegate*delegate= new NumericDelegate;
- view->setItemDelegateForColumn(currentColumn,delegate);
-
- /*:203*/
- #line 5094 "./typica.w"
-
- }
-
- /*:201*/
- #line 5071 "./typica.w"
-
- }
- currentColumn++;
- }
- }
- }
- }
- view->setModel(model);
- QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
- layout->addWidget(view);
- }
-
- /*:200*//*210:*/
- #line 5246 "./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 QDoubleValidator(NULL));
- }
- else if(element.attribute("validator")=="integer")
- {
- widget->setValidator(new QIntValidator(NULL));
- }
- 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);
- }
-
- /*:210*//*211:*/
- #line 5287 "./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);
- }
-
- /*:211*//*212:*/
- #line 5304 "./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);
- }
-
- /*:212*//*213:*/
- #line 5321 "./typica.w"
-
- void addCalendarToLayout(QDomElement element,QStack<QWidget*> *,
- QStack<QLayout*> *layoutStack)
- {
- QDateEdit*widget= new QDateEdit;
- widget->setCalendarPopup(true);
- if(element.hasAttribute("id"))
- {
- widget->setObjectName(element.attribute("id"));
- }
- widget->setDate(QDate::currentDate());
- QBoxLayout*layout= qobject_cast<QBoxLayout*> (layoutStack->top());
- layout->addWidget(widget);
- }
-
- /*:213*//*214:*/
- #line 5339 "./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));
- }
-
- /*:214*//*215:*/
- #line 5359 "./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());
- }
-
- /*:215*//*219:*/
- #line 5426 "./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();
- /*220:*/
- #line 5444 "./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=="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);
- }
-
- /*:220*/
- #line 5437 "./typica.w"
-
- }
- return value;
- }
-
- /*:219*//*222:*/
- #line 5566 "./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);
- }
-
- /*:222*//*223:*/
- #line 5590 "./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);
- }
-
- /*:223*//*224:*/
- #line 5642 "./typica.w"
-
- QScriptValue SaltTable_model(QScriptContext*context,QScriptEngine*engine)
- {
- QTableView*self= getself<QTableView*> (context);
- QScriptValue value= engine->newQObject(self->model());
- return value;
- }
-
- /*:224*//*225:*/
- #line 5656 "./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();
- }
-
- /*:225*//*226:*/
- #line 5674 "./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;
- }
-
- /*:226*//*227:*/
- #line 5692 "./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));
- }
-
- /*:227*//*229:*/
- #line 5725 "./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));
- }
-
- 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)));
- }
-
- #line 1 "./abouttypica.w"
- /*:229*//*242:*/
- #line 396 "./units.w"
-
- QScriptValue Units_convertTemperature(QScriptContext*context,QScriptEngine*engine)
- {
- return QScriptValue(Units::convertTemperature(argument<double> (0,context),
- argument<Units::Unit> (1,context),
- argument<Units::Unit> (2,context)));
- }
-
- QScriptValue Units_convertRelativeTemperature(QScriptContext*context,
- QScriptEngine*engine)
- {
- return QScriptValue(Units::convertRelativeTemperature(
- argument<double> (0,context),
- argument<Units::Unit> (1,context),
- argument<Units::Unit> (2,context)));
- }
-
- QScriptValue Units_isTemperatureUnit(QScriptContext*context,QScriptEngine*engine)
- {
- return QScriptValue(Units::isTemperatureUnit(argument<Units::Unit> (0,context)));
- }
-
- QScriptValue Units_convertWeight(QScriptContext*context,QScriptEngine*engine)
- {
- return QScriptValue(Units::convertWeight(argument<double> (0,context),
- argument<Units::Unit> (1,context),
- argument<Units::Unit> (2,context)));
- }
-
- QScriptValue Units_isWeightUnit(QScriptContext*context,QScriptEngine*engine)
- {
- return QScriptValue(Units::isWeightUnit(argument<Units::Unit> (0,context)));
- }
-
- /*:242*//*245:*/
- #line 444 "./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> ();
- }
-
- /*:245*//*269:*/
- #line 6364 "./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;
- }
-
- /*:269*//*270:*/
- #line 6394 "./typica.w"
-
- void setDAQProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQObjectProperties(value,engine);
- value.setProperty("newChannel",engine->newFunction(DAQ_newChannel));
- }
-
- /*:270*//*271:*/
- #line 6404 "./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;
- }
-
- /*:271*//*278:*/
- #line 6560 "./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;
- }
-
- /*:278*//*282:*/
- #line 6651 "./typica.w"
-
- void setChannelProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQObjectProperties(value,engine);
- }
-
- /*:282*//*289:*/
- #line 6843 "./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);
- }
-
- /*:289*//*294:*/
- #line 6981 "./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);
- }
-
-
- /*:294*//*304:*/
- #line 7187 "./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));
- }
-
- /*:304*//*305:*/
- #line 7211 "./typica.w"
-
- QScriptValue TemperatureDisplay_setDisplayUnits(QScriptContext*context,QScriptEngine*)
- {
- TemperatureDisplay*self= getself<TemperatureDisplay*> (context);
- self->setDisplayUnits((Units::Unit)argument<int> (0,context));
- return QScriptValue();
- }
-
- /*:305*//*312:*/
- #line 7348 "./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);
- }
-
- /*:312*//*317:*/
- #line 7457 "./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);
- }
-
- /*:317*//*322:*/
- #line 7554 "./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);
- }
-
- /*:322*//*327:*/
- #line 7634 "./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);
- }
-
- /*:327*//*344:*/
- #line 8096 "./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);
- }
-
- /*:344*//*367:*/
- #line 8734 "./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));
- }
-
- /*:367*//*368:*/
- #line 8761 "./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);
- }
-
- /*:368*//*369:*/
- #line 8809 "./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)));
- }
-
- /*:369*//*370:*/
- #line 8862 "./typica.w"
-
- QScriptValue ZoomLog_setDisplayUnits(QScriptContext*context,QScriptEngine*)
- {
- ZoomLog*self= getself<ZoomLog*> (context);
- self->setDisplayUnits((Units::Unit)argument<int> (0,context));
- return QScriptValue();
- }
-
- /*:370*//*405:*/
- #line 9679 "./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);
- }
-
- /*:405*//*413:*/
- #line 9822 "./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);
- }
-
- /*:413*//*434:*/
- #line 10241 "./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);
- }
-
-
- /*:434*//*461:*/
- #line 10736 "./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);
- }
-
- /*:461*//*474:*/
- #line 11017 "./typica.w"
-
- QScriptValue constructLogEditWindow(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new LogEditWindow);
- return object;
- }
-
- /*:474*//*493:*/
- #line 11549 "./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();
- }
-
- /*:493*//*507:*/
- #line 152 "./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);
- }
-
- /*:507*//*508:*/
- #line 169 "./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);
- }
-
- /*:508*//*513:*/
- #line 220 "./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> ();
- }
-
- /*:513*//*518:*/
- #line 285 "./webview.w"
-
- template<> QWebElement argument(int arg,QScriptContext*context)
- {
- return qscriptvalue_cast<QWebElement> (context->argument(arg));
- }
-
- /*:518*//*519:*/
- #line 294 "./webview.w"
-
- QScriptValue constructWebElement(QScriptContext*context,
- QScriptEngine*engine)
- {
- QWebElement element= argument<QWebElement> (0,context);
- QScriptValue object= engine->newQObject(new TypicaWebElement(element));
- return object;
- }
-
- /*:519*//*581:*/
- #line 12770 "./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));
- }
-
- /*:581*//*582:*/
- #line 12788 "./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();
- }
-
- /*:582*//*590:*/
- #line 12987 "./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);
- /*591:*/
- #line 13010 "./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();
- /*592:*/
- #line 13027 "./typica.w"
-
- if(currentElement.tagName()=="style")
- {
- document->setDefaultStyleSheet(currentElement.text());
- }
-
- /*:592*//*593:*/
- #line 13038 "./typica.w"
-
- if(currentElement.tagName()=="html")
- {
- cursor.insertHtml(currentElement.text());
- }
-
- /*:593*//*594:*/
- #line 13048 "./typica.w"
-
- if(currentElement.tagName()=="text")
- {
- cursor.insertText(currentElement.text());
- }
-
- /*:594*//*595:*/
- #line 13058 "./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"));
- }
- }
-
- /*:595*/
- #line 13020 "./typica.w"
-
- }
- }
-
- /*:591*/
- #line 13003 "./typica.w"
-
- widget->setDocument(document);
- }
-
- /*:590*//*606:*/
- #line 13270 "./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();
- }
-
- /*:606*//*607:*/
- #line 13288 "./typica.w"
-
- void setQTextEditProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQAbstractScrollAreaProperties(value,engine);
- value.setProperty("print",engine->newFunction(QTextEdit_print));
- }
-
- /*:607*//*616:*/
- #line 13466 "./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);
- }
-
- /*:616*//*637:*/
- #line 14053 "./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);
- }
-
-
-
- /*:637*//*663:*/
- #line 14643 "./typica.w"
-
- QScriptValue constructDeviceTreeModel(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new DeviceTreeModel);
- setDeviceTreeModelProperties(object,engine);
- return object;
- }
-
- /*:663*//*665:*/
- #line 14666 "./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));
- }
-
- /*:665*//*666:*/
- #line 14693 "./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));
- }
-
- /*:666*//*669:*/
- #line 14777 "./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> ();
- }
-
- /*:669*//*685:*/
- #line 15074 "./typica.w"
-
- QScriptValue constructDeviceConfigurationWindow(QScriptContext*,
- QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new DeviceConfigurationWindow);
- return object;
- }
-
- /*:685*//*756:*/
- #line 42 "./settings.w"
-
- QScriptValue constructSettingsWindow(QScriptContext*,QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new SettingsWindow);
- return object;
- }
-
- /*:756*//*776:*/
- #line 17623 "./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;
- }
-
- /*:776*//*777:*/
- #line 17645 "./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;
- }
-
- /*:777*//*778:*/
- #line 17678 "./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));
- }
-
- /*:778*//*800:*/
- #line 170 "./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);
- }
-
- /*:800*//*825:*/
- #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;
- }
-
- /*:825*//*826:*/
- #line 637 "./dataqsdk.w"
-
- void setDataqSdkDeviceProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQObjectProperties(value,engine);
- value.setProperty("newChannel",engine->newFunction(DataqSdkDevice_newChannel));
- }
-
- /*:826*//*827:*/
- #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;
- }
-
- /*:827*//*852:*/
- #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);
- }
-
- /*:852*//*862:*/
- #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());
- }
-
- /*:862*//*865:*/
- #line 341 "./scales.w"
-
- void setSerialScaleProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQIODeviceProperties(value,engine);
- }
-
- /*:865*//*866:*/
- #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;
- }
-
- /*:866*//*888:*/
- #line 278 "./valueannotation.w"
-
- QScriptValue constructValueAnnotation(QScriptContext*context,QScriptEngine*engine)
- {
- QScriptValue object= engine->newQObject(new ValueAnnotation);
- setValueAnnotationProperties(object,engine);
- return object;
- }
-
- void setValueAnnotationProperties(QScriptValue value,QScriptEngine*engine)
- {
- setQObjectProperties(value,engine);
- }
- #line 18448 "./typica.w"
-
- /*:888*/
- #line 764 "./typica.w"
-
- /*560:*/
- #line 12407 "./typica.w"
-
- int main(int argc,char**argv)
- {
- int*c= &argc;
- Application app(*c,argv);
- /*561:*/
- #line 12433 "./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"));
-
- /*:561*/
- #line 12412 "./typica.w"
-
- /*562:*/
- #line 12450 "./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");
-
- /*:562*/
- #line 12413 "./typica.w"
-
-
- QSettings settings;
-
- /*695:*/
- #line 15294 "./typica.w"
-
- app.registerDeviceConfigurationWidget("roaster",RoasterConfWidget::staticMetaObject);
-
- /*:695*//*705:*/
- #line 15536 "./typica.w"
-
- app.registerDeviceConfigurationWidget("nidaqmxbase",
- NiDaqMxBaseDriverConfWidget::staticMetaObject);
- app.registerDeviceConfigurationWidget("nidaqmxbase9211series",
- NiDaqMxBase9211ConfWidget::staticMetaObject);
- app.registerDeviceConfigurationWidget("ni9211seriestc",
- Ni9211TcConfWidget::staticMetaObject);
-
- /*:705*//*713:*/
- #line 15767 "./typica.w"
-
- app.registerDeviceConfigurationWidget("nidaqmx",NiDaqMxDriverConfWidget::staticMetaObject);
- app.registerDeviceConfigurationWidget("nidaqmx9211series",NiDaqMx9211ConfWidget::staticMetaObject);
- app.registerDeviceConfigurationWidget("nidaqmxtc01",NiDaqMxTc01ConfWidget::staticMetaObject);
-
- /*:713*//*737:*/
- #line 16732 "./typica.w"
-
- app.registerDeviceConfigurationWidget("modbusrtuport",ModbusRtuPortConfWidget::staticMetaObject);
- app.registerDeviceConfigurationWidget("modbusrtudevice",ModbusRtuDeviceConfWidget::staticMetaObject);
- app.registerDeviceConfigurationWidget("modbustemperaturepv",ModbusRtuDeviceTPvConfWidget::staticMetaObject);
- app.registerDeviceConfigurationWidget("modbustemperaturesv",ModbusRtuDeviceTSvConfWidget::staticMetaObject);
-
- /*:737*//*742:*/
- #line 16817 "./typica.w"
-
- app.registerDeviceConfigurationWidget("annotationbutton",AnnotationButtonConfWidget::staticMetaObject);
-
- /*:742*//*745:*/
- #line 16887 "./typica.w"
-
- app.registerDeviceConfigurationWidget("reconfigurablebutton",ReconfigurableAnnotationButtonConfWidget::staticMetaObject);
-
- /*:745*//*748:*/
- #line 17014 "./typica.w"
-
- app.registerDeviceConfigurationWidget("annotationspinbox",NoteSpinConfWidget::staticMetaObject);
-
- #line 1 "./freeannotation.w"
- /*:748*//*752:*/
- #line 57 "./freeannotation.w"
-
- app.registerDeviceConfigurationWidget("freeannotation",
- FreeAnnotationConfWidget::staticMetaObject);
- #line 17018 "./typica.w"
-
- #line 1 "./settings.w"
- /*:752*//*781:*/
- #line 18219 "./typica.w"
-
- app.registerDeviceConfigurationWidget("modbusrtu",ModbusConfigurator::staticMetaObject);
-
- /*:781*//*788:*/
- #line 18349 "./typica.w"
-
- app.registerDeviceConfigurationWidget("linearspline",LinearSplineInterpolationConfWidget::staticMetaObject);
-
- /*:788*//*792:*/
- #line 18438 "./typica.w"
-
- app.registerDeviceConfigurationWidget("translation",TranslationConfWidget::staticMetaObject);
-
- #line 1 "./rate.w"
- /*:792*//*804:*/
- #line 272 "./rate.w"
-
- app.registerDeviceConfigurationWidget("rate",RateOfChangeConfWidget::staticMetaObject);
-
- /*:804*//*845:*/
- #line 1233 "./dataqsdk.w"
-
- app.registerDeviceConfigurationWidget("dataqsdk",DataqSdkDeviceConfWidget::staticMetaObject);
- app.registerDeviceConfigurationWidget("dataqsdkchannel",
- DataqSdkChannelConfWidget::staticMetaObject);
-
- /*:845*//*870:*/
- #line 490 "./scales.w"
-
- app.registerDeviceConfigurationWidget("scale",SerialScaleConfWidget::staticMetaObject);
-
- /*:870*//*878:*/
- #line 138 "./valueannotation.w"
-
- app.registerDeviceConfigurationWidget("valueannotation",
- ValueAnnotationConfWidget::staticMetaObject);
-
- /*:878*/
- #line 12417 "./typica.w"
-
- /*563:*/
- #line 12467 "./typica.w"
-
- if(settings.value("database/exists","false").toString()=="true")
- {
- /*568:*/
- #line 12588 "./typica.w"
-
- QSqlDatabase database=
- QSqlDatabase::addDatabase(settings.value("database/driver").toString());
- database.setConnectOptions("application_name=Typica");
- database.setHostName(settings.value("database/hostname").toString());
- 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");
- }
-
- /*:568*/
- #line 12470 "./typica.w"
-
- }
- if(settings.value("database/exists","false").toString()=="false")
- {
- /*567:*/
- #line 12579 "./typica.w"
-
- SqlConnectionSetup dialog;
- dialog.exec();
-
- /*:567*/
- #line 12474 "./typica.w"
-
- }
-
-
- /*:563*/
- #line 12418 "./typica.w"
-
- /*161:*/
- #line 3740 "./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();
- settings.setValue("config",directory.path());
- if(file.open(QIODevice::ReadOnly))
- {
- app.configuration()->setContent(&file,true);
- }
- }
- /*162:*/
- #line 3774 "./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();
- }
- }
- }
- }
-
- /*:162*/
- #line 3768 "./typica.w"
-
-
- /*:161*/
- #line 12419 "./typica.w"
-
- /*20:*/
- #line 892 "./typica.w"
-
- QScriptEngine*engine= new QScriptEngine;
- QScriptValue constructor;
- QScriptValue value;
-
- /*:20*//*30:*/
- #line 1078 "./typica.w"
-
- constructor= engine->newFunction(constructQWidget);
- value= engine->newQMetaObject(&QWidget::staticMetaObject,constructor);
- engine->globalObject().setProperty("QWidget",value);
-
- /*:30*//*41:*/
- #line 1324 "./typica.w"
-
- constructor= engine->newFunction(constructQMainWindow);
- value= engine->newQMetaObject(&ScriptQMainWindow::staticMetaObject,
- constructor);
- engine->globalObject().setProperty("QMainWindow",value);
-
- /*:41*//*52:*/
- #line 1529 "./typica.w"
-
- constructor= engine->newFunction(constructQFrame);
- value= engine->newQMetaObject(&QFrame::staticMetaObject,constructor);
- engine->globalObject().setProperty("QFrame",value);
-
- /*:52*//*55:*/
- #line 1562 "./typica.w"
-
- constructor= engine->newFunction(constructQLabel);
- value= engine->newQMetaObject(&QLabel::staticMetaObject,constructor);
- engine->globalObject().setProperty("QLabel",value);
-
- /*:55*//*58:*/
- #line 1600 "./typica.w"
-
- constructor= engine->newFunction(constructQLineEdit);
- value= engine->newQMetaObject(&QLineEdit::staticMetaObject,constructor);
- engine->globalObject().setProperty("QLineEdit",value);
-
- /*:58*//*62:*/
- #line 1645 "./typica.w"
-
- constructor= engine->newFunction(constructQSplitter);
- value= engine->newQMetaObject(&QSplitter::staticMetaObject,constructor);
- engine->globalObject().setProperty("QSplitter",value);
-
- /*:62*//*69:*/
- #line 1816 "./typica.w"
-
- constructor= engine->newFunction(constructQBoxLayout);
- value= engine->newQMetaObject(&QBoxLayout::staticMetaObject,constructor);
- engine->globalObject().setProperty("QBoxLayout",value);
-
- /*:69*//*73:*/
- #line 1928 "./typica.w"
-
- constructor= engine->newFunction(constructQAction);
- value= engine->newQMetaObject(&QAction::staticMetaObject,constructor);
- engine->globalObject().setProperty("QAction",value);
-
- /*:73*//*76:*/
- #line 1987 "./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);
-
- /*:76*//*81:*/
- #line 2099 "./typica.w"
-
- constructor= engine->newFunction(constructQFile);
- value= engine->newQMetaObject(&QFile::staticMetaObject,constructor);
- engine->globalObject().setProperty("QFile",value);
-
- /*:81*//*88:*/
- #line 2216 "./typica.w"
-
- constructor= engine->newFunction(constructQBuffer);
- value= engine->newQMetaObject(&QBuffer::staticMetaObject,constructor);
- engine->globalObject().setProperty("QBuffer",value);
-
- /*:88*//*91:*/
- #line 2264 "./typica.w"
-
- constructor= engine->newFunction(constructXQuery);
- engine->globalObject().setProperty("XQuery",constructor);
-
- /*:91*//*97:*/
- #line 2358 "./typica.w"
-
- constructor= engine->newFunction(constructXmlWriter);
- engine->globalObject().setProperty("XmlWriter",constructor);
-
- /*:97*//*106:*/
- #line 2564 "./typica.w"
-
- constructor= engine->newFunction(constructXmlReader);
- engine->globalObject().setProperty("XmlReader",constructor);
-
- /*:106*//*113:*/
- #line 2688 "./typica.w"
-
- value= engine->newQObject(&settings);
- setQSettingsProperties(value,engine);
- engine->globalObject().setProperty("QSettings",value);
-
- /*:113*//*117:*/
- #line 2769 "./typica.w"
-
- constructor= engine->newFunction(constructQLCDNumber);
- value= engine->newQMetaObject(&QLCDNumber::staticMetaObject,constructor);
- engine->globalObject().setProperty("QLCDNumber",value);
-
- /*:117*//*120:*/
- #line 2825 "./typica.w"
-
- constructor= engine->newFunction(constructQTime);
- engine->globalObject().setProperty("QTime",constructor);
-
- /*:120*//*141:*/
- #line 3329 "./typica.w"
-
- constructor= engine->newFunction(constructQPushButton);
- value= engine->newQMetaObject(&QPushButton::staticMetaObject,constructor);
- engine->globalObject().setProperty("QPushButton",value);
-
- /*:141*//*148:*/
- #line 3440 "./typica.w"
-
- constructor= engine->newFunction(constructQSqlQuery);
- engine->globalObject().setProperty("QSqlQuery",constructor);
-
- /*:148*//*155:*/
- #line 3601 "./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));
-
- /*:155*//*166:*/
- #line 3937 "./typica.w"
-
- engine->globalObject().setProperty("createWindow",
- engine->newFunction(createWindow));
-
- /*:166*//*218:*/
- #line 5418 "./typica.w"
-
- engine->globalObject().setProperty("findChildObject",
- engine->newFunction(findChildObject));
-
- /*:218*//*241:*/
- #line 384 "./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);
-
- /*:241*//*246:*/
- #line 457 "./units.w"
-
- qScriptRegisterMetaType(engine,Unit_toScriptValue,Unit_fromScriptValue);
-
- #line 5780 "./typica.w"
-
- /*:246*//*268:*/
- #line 6350 "./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);
-
- /*:268*//*277:*/
- #line 6552 "./typica.w"
-
- constructor= engine->newFunction(constructFakeDAQ);
- value= engine->newQMetaObject(&FakeDAQ::staticMetaObject,constructor);
- engine->globalObject().setProperty("FakeDAQ",value);
-
- /*:277*//*288:*/
- #line 6835 "./typica.w"
-
- constructor= engine->newFunction(constructLinearCalibrator);
- value= engine->newQMetaObject(&LinearCalibrator::staticMetaObject,
- constructor);
- engine->globalObject().setProperty("LinearCalibrator",value);
-
- /*:288*//*293:*/
- #line 6974 "./typica.w"
-
- constructor= engine->newFunction(constructLinearSplineInterpolator);
- value= engine->newQMetaObject(&LinearSplineInterpolator::staticMetaObject,constructor);
- engine->globalObject().setProperty("LinearSplineInterpolator",value);
-
- /*:293*//*303:*/
- #line 7179 "./typica.w"
-
- constructor= engine->newFunction(constructTemperatureDisplay);
- value= engine->newQMetaObject(&TemperatureDisplay::staticMetaObject,
- constructor);
- engine->globalObject().setProperty("TemperatureDisplay",value);
-
- /*:303*//*311:*/
- #line 7337 "./typica.w"
-
- constructor= engine->newFunction(constructMeasurementTimeOffset);
- value= engine->newQMetaObject(&MeasurementTimeOffset::staticMetaObject,
- constructor);
- engine->globalObject().setProperty("MeasurementTimeOffset",value);
-
- /*:311*//*316:*/
- #line 7448 "./typica.w"
-
- constructor= engine->newFunction(constructThresholdDetector);
- value= engine->newQMetaObject(&ThresholdDetector::staticMetaObject,constructor);
- engine->globalObject().setProperty("ThresholdDetector",value);
-
- /*:316*//*321:*/
- #line 7547 "./typica.w"
-
- constructor= engine->newFunction(constructZeroEmitter);
- value= engine->newQMetaObject(&ZeroEmitter::staticMetaObject,constructor);
- engine->globalObject().setProperty("ZeroEmitter",value);
-
- /*:321*//*326:*/
- #line 7626 "./typica.w"
-
- constructor= engine->newFunction(constructMeasurementAdapter);
- value= engine->newQMetaObject(&MeasurementAdapter::staticMetaObject,
- constructor);
- engine->globalObject().setProperty("MeasurementAdapter",value);
-
- /*:326*//*343:*/
- #line 8089 "./typica.w"
-
- constructor= engine->newFunction(constructGraphView);
- value= engine->newQMetaObject(&GraphView::staticMetaObject,constructor);
- engine->globalObject().setProperty("GraphView",value);
-
- /*:343*//*366:*/
- #line 8726 "./typica.w"
-
- constructor= engine->newFunction(constructZoomLog);
- value= engine->newQMetaObject(&ZoomLog::staticMetaObject,constructor);
- engine->globalObject().setProperty("ZoomLog",value);
-
- /*:366*//*404:*/
- #line 9671 "./typica.w"
-
- constructor= engine->newFunction(constructAnnotationButton);
- value= engine->newQMetaObject(&AnnotationButton::staticMetaObject,
- constructor);
- engine->globalObject().setProperty("AnnotationButton",value);
-
- /*:404*//*412:*/
- #line 9813 "./typica.w"
-
- constructor= engine->newFunction(constructAnnotationSpinBox);
- value= engine->newQMetaObject(&AnnotationSpinBox::staticMetaObject,
- constructor);
- engine->globalObject().setProperty("AnnotationSpinBox",value);
-
- /*:412*//*433:*/
- #line 10234 "./typica.w"
-
- constructor= engine->newFunction(constructTimerDisplay);
- value= engine->newQMetaObject(&TimerDisplay::staticMetaObject,constructor);
- engine->globalObject().setProperty("TimerDisplay",value);
-
- /*:433*//*460:*/
- #line 10728 "./typica.w"
-
- constructor= engine->newFunction(constructWidgetDecorator);
- value= engine->newQMetaObject(&WidgetDecorator::staticMetaObject,constructor);
- engine->globalObject().setProperty("WidgetDecorator",value);
-
- /*:460*//*473:*/
- #line 11010 "./typica.w"
-
- constructor= engine->newFunction(constructLogEditWindow);
- value= engine->newQMetaObject(&LogEditWindow::staticMetaObject,constructor);
- engine->globalObject().setProperty("LogEditWindow",value);
-
- /*:473*//*492:*/
- #line 11542 "./typica.w"
-
- constructor= engine->newFunction(constructXMLInput);
- value= engine->newQMetaObject(&XMLInput::staticMetaObject,constructor);
- engine->globalObject().setProperty("XMLInput",value);
-
- /*:492*//*506:*/
- #line 144 "./webview.w"
-
- constructor= engine->newFunction(constructWebView);
- value= engine->newQMetaObject(&TypicaWebView::staticMetaObject,constructor);
- engine->globalObject().setProperty("WebView",value);
-
- /*:506*//*514:*/
- #line 236 "./webview.w"
-
- qScriptRegisterMetaType(engine,QWebElement_toScriptValue,QWebElement_fromScriptValue);
-
- /*:514*//*517:*/
- #line 278 "./webview.w"
-
- constructor= engine->newFunction(constructWebElement);
- engine->globalObject().setProperty("WebElement",constructor);
-
- /*:517*//*528:*/
- #line 11785 "./typica.w"
-
- value= engine->newQObject(AppInstance);
- engine->globalObject().setProperty("Application",value);
-
- /*:528*//*580:*/
- #line 12762 "./typica.w"
-
- constructor= engine->newFunction(constructSqlQueryView);
- value= engine->newQMetaObject(&SqlQueryView::staticMetaObject,constructor);
- engine->globalObject().setProperty("SqlQueryView",value);
-
- /*:580*//*664:*/
- #line 14653 "./typica.w"
-
- constructor= engine->newFunction(constructDeviceTreeModel);
- value= engine->newQMetaObject(&DeviceTreeModel::staticMetaObject,
- constructor);
- engine->globalObject().setProperty("DeviceTreeModel",value);
-
- /*:664*//*670:*/
- #line 14793 "./typica.w"
-
- qScriptRegisterMetaType(engine,QModelIndex_toScriptValue,QModelIndex_fromScriptValue);
-
- /*:670*//*686:*/
- #line 15084 "./typica.w"
-
- constructor= engine->newFunction(constructDeviceConfigurationWindow);
- value= engine->newQMetaObject(&DeviceConfigurationWindow::staticMetaObject,
- constructor);
- engine->globalObject().setProperty("DeviceConfigurationWindow",value);
-
- /*:686*//*757:*/
- #line 51 "./settings.w"
-
- constructor= engine->newFunction(constructSettingsWindow);
- value= engine->newQMetaObject(&DeviceConfigurationWindow::staticMetaObject,constructor);
- engine->globalObject().setProperty("SettingsWindow",value);
-
- #line 1 "./graphsettings.w"
- /*:757*//*775:*/
- #line 17614 "./typica.w"
-
- constructor= engine->newFunction(constructModbusRTUDevice);
- value= engine->newQMetaObject(&ModbusRTUDevice::staticMetaObject,constructor);
- engine->globalObject().setProperty("ModbusRTUDevice",value);
-
- /*:775*//*799:*/
- #line 163 "./rate.w"
-
- constructor= engine->newFunction(constructRateOfChange);
- value= engine->newQMetaObject(&RateOfChange::staticMetaObject,constructor);
- engine->globalObject().setProperty("RateOfChange",value);
-
- /*:799*//*824:*/
- #line 604 "./dataqsdk.w"
-
- constructor= engine->newFunction(constructDataqSdkDevice);
- value= engine->newQMetaObject(&DataqSdkDevice::staticMetaObject,constructor);
- engine->globalObject().setProperty("DataqSdkDevice",value);
-
- /*:824*//*851:*/
- #line 73 "./scales.w"
-
- constructor= engine->newFunction(constructDragLabel);
- value= engine->newQMetaObject(&DragLabel::staticMetaObject,constructor);
- engine->globalObject().setProperty("DragLabel",value);
-
- /*:851*//*859:*/
- #line 239 "./scales.w"
-
- constructor= engine->newFunction(constructSerialScale);
- value= engine->newQMetaObject(&SerialScale::staticMetaObject,constructor);
- engine->globalObject().setProperty("SerialScale",value);
-
- /*:859*//*863:*/
- #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);
-
- /*:863*//*887:*/
- #line 271 "./valueannotation.w"
-
- constructor= engine->newFunction(constructValueAnnotation);
- value= engine->newQMetaObject(&ValueAnnotation::staticMetaObject,constructor);
- engine->globalObject().setProperty("ValueAnnotation",value);
-
- /*:887*/
- #line 12420 "./typica.w"
-
- app.engine= engine;
- /*163:*/
- #line 3822 "./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);
- /*164:*/
- #line 3847 "./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;
- }
- }
-
- /*:164*/
- #line 3842 "./typica.w"
-
-
- /*:163*/
- #line 12422 "./typica.w"
-
-
- int retval= app.exec();
- delete engine;
- return retval;
- }
-
- /*:560*/
- #line 765 "./typica.w"
-
- #include "moc_typica.cpp"
-
- /*:16*/
|