Tanggal MakeTANGGAL(int h, int b,int t) { Tanggal T; if (IsTanggalValid(h,b,t)) { //T.DD=h;T.MM=b;T.YY=t; SetDay(&T,h);SetMonth(&T,b);SetYear(&T,t); return T; } else return T=Reset(); }
void SetCalenderTime(CalenderTime *ct) { SetYear(ct->year); SetMonth(ct->month); SetDate(ct->date); SetHour(ct->hour); SetMinute(ct->minute); SetSecond(ct->second); // RtcDisableWrite(); }
bool EditRomInfoDialog::Create() { if (!LoadWindowFromXML("game-ui.xml", "edit_metadata", this)) return false; bool err = false; UIUtilE::Assign(this, m_gamenameEdit, "title_edit", &err); UIUtilE::Assign(this, m_genreEdit, "genre_edit", &err); UIUtilE::Assign(this, m_yearEdit, "year_edit", &err); UIUtilE::Assign(this, m_countryEdit, "country_edit", &err); UIUtilE::Assign(this, m_plotEdit, "description_edit", &err); UIUtilE::Assign(this, m_publisherEdit, "publisher_edit", &err); UIUtilE::Assign(this, m_favoriteCheck, "favorite_check", &err); UIUtilE::Assign(this, m_screenshotButton, "screenshot_button", &err); UIUtilE::Assign(this, m_screenshotText, "screenshot_text", &err); UIUtilE::Assign(this, m_fanartButton, "fanart_button", &err); UIUtilE::Assign(this, m_fanartText, "fanart_text", &err); UIUtilE::Assign(this, m_boxartButton, "coverart_button", &err); UIUtilE::Assign(this, m_boxartText, "coverart_text", &err); UIUtilE::Assign(this, m_doneButton, "done_button", &err); if (err) { VERBOSE(VB_IMPORTANT, "Cannot load screen 'edit_metadata'"); return false; } fillWidgets(); BuildFocusList(); connect(m_gamenameEdit, SIGNAL(valueChanged()), SLOT(SetGamename())); connect(m_genreEdit, SIGNAL(valueChanged()), SLOT(SetGenre())); connect(m_yearEdit, SIGNAL(valueChanged()), SLOT(SetYear())); connect(m_countryEdit, SIGNAL(valueChanged()), SLOT(SetCountry())); connect(m_plotEdit, SIGNAL(valueChanged()), SLOT(SetPlot())); connect(m_publisherEdit, SIGNAL(valueChanged()), SLOT(SetPublisher())); connect(m_favoriteCheck, SIGNAL(valueChanged()), SLOT(ToggleFavorite())); connect(m_screenshotButton, SIGNAL(Clicked()), SLOT(FindScreenshot())); connect(m_fanartButton, SIGNAL(Clicked()), SLOT(FindFanart())); connect(m_boxartButton, SIGNAL(Clicked()), SLOT(FindBoxart())); connect(m_doneButton, SIGNAL(Clicked()), SLOT(SaveAndExit())); return true; }
/////////////////////////////////////////////////////////////////////// // Function: SetDate // // Author: $author$ // Date: 6/21/2009 /////////////////////////////////////////////////////////////////////// virtual EvError SetDate (const EvDate& date, bool isLocal=false, const EvTimezone* timezone=0) { EvError error = EV_ERROR_NONE; INT year=date.GetYear(); INT month=date.GetMonth(); INT day=date.GetDay(); //DBT("() %d/%d/%d\n", year, month, day); SetYear(year); SetMonth(month); SetDay(day); return error; }
void CDate_std::SetToTime(const CTime& time, CDate::EPrecision prec) { switch (prec) { case CDate::ePrecision_second: SetSecond(time.Second()); SetMinute(time.Minute()); SetHour (time.Hour()); // fall through case CDate::ePrecision_day: SetDay (time.Day()); SetMonth (time.Month()); SetYear (time.Year()); break; default: break; } }
void CVideoInfoTag::ParseNative(const TiXmlElement* movie, bool prioritise) { std::string value; float fValue; if (XMLUtils::GetString(movie, "title", value)) SetTitle(value); if (XMLUtils::GetString(movie, "originaltitle", value)) SetOriginalTitle(value); if (XMLUtils::GetString(movie, "showtitle", value)) SetShowTitle(value); if (XMLUtils::GetString(movie, "sorttitle", value)) SetSortTitle(value); const TiXmlElement* node = movie->FirstChildElement("ratings"); if (node) { for (const TiXmlElement* child = node->FirstChildElement("rating"); child != nullptr; child = child->NextSiblingElement("rating")) { CRating r; std::string name; if (child->QueryStringAttribute("name", &name) != TIXML_SUCCESS) name = "default"; XMLUtils::GetFloat(child, "value", r.rating); XMLUtils::GetInt(child, "votes", r.votes); int max_value = 10; if ((child->QueryIntAttribute("max", &max_value) == TIXML_SUCCESS) && max_value >= 1) r.rating = r.rating / max_value * 10; // Normalise the Movie Rating to between 1 and 10 SetRating(r, name); bool isDefault = false; if ((child->QueryBoolAttribute("default", &isDefault) == TIXML_SUCCESS) && isDefault) m_strDefaultRating = name; } } else if (XMLUtils::GetFloat(movie, "rating", fValue)) { CRating r(fValue, 0); if (XMLUtils::GetString(movie, "votes", value)) r.votes = StringUtils::ReturnDigits(value); int max_value = 10; const TiXmlElement* rElement = movie->FirstChildElement("rating"); if (rElement && (rElement->QueryIntAttribute("max", &max_value) == TIXML_SUCCESS) && max_value >= 1) r.rating = r.rating / max_value * 10; // Normalise the Movie Rating to between 1 and 10 SetRating(r, "default"); m_strDefaultRating = "default"; } XMLUtils::GetInt(movie, "userrating", m_iUserRating); const TiXmlElement *epbookmark = movie->FirstChildElement("episodebookmark"); if (epbookmark) { XMLUtils::GetDouble(epbookmark, "position", m_EpBookmark.timeInSeconds); const TiXmlElement *playerstate = epbookmark->FirstChildElement("playerstate"); if (playerstate) { const TiXmlElement *value = playerstate->FirstChildElement(); if (value) m_EpBookmark.playerState << *value; } } else XMLUtils::GetDouble(movie, "epbookmark", m_EpBookmark.timeInSeconds); int max_value = 10; const TiXmlElement* urElement = movie->FirstChildElement("userrating"); if (urElement && (urElement->QueryIntAttribute("max", &max_value) == TIXML_SUCCESS) && max_value >= 1) m_iUserRating = m_iUserRating / max_value * 10; // Normalise the user Movie Rating to between 1 and 10 XMLUtils::GetInt(movie, "top250", m_iTop250); XMLUtils::GetInt(movie, "season", m_iSeason); XMLUtils::GetInt(movie, "episode", m_iEpisode); XMLUtils::GetInt(movie, "track", m_iTrack); XMLUtils::GetInt(movie, "displayseason", m_iSpecialSortSeason); XMLUtils::GetInt(movie, "displayepisode", m_iSpecialSortEpisode); int after=0; XMLUtils::GetInt(movie, "displayafterseason",after); if (after > 0) { m_iSpecialSortSeason = after; m_iSpecialSortEpisode = 0x1000; // should be more than any realistic episode number } if (XMLUtils::GetString(movie, "outline", value)) SetPlotOutline(value); if (XMLUtils::GetString(movie, "plot", value)) SetPlot(value); if (XMLUtils::GetString(movie, "tagline", value)) SetTagLine(value); if (XMLUtils::GetString(movie, "runtime", value) && !value.empty()) m_duration = GetDurationFromMinuteString(StringUtils::Trim(value)); if (XMLUtils::GetString(movie, "mpaa", value)) SetMPAARating(value); XMLUtils::GetInt(movie, "playcount", m_playCount); XMLUtils::GetDate(movie, "lastplayed", m_lastPlayed); if (XMLUtils::GetString(movie, "file", value)) SetFile(value); if (XMLUtils::GetString(movie, "path", value)) SetPath(value); const TiXmlElement* uniqueid = movie->FirstChildElement("uniqueid"); if (uniqueid == nullptr) { if (XMLUtils::GetString(movie, "id", value)) SetUniqueID(value); } else { for (; uniqueid != nullptr; uniqueid = uniqueid->NextSiblingElement("uniqueid")) { if (uniqueid->FirstChild()) { if (uniqueid->QueryStringAttribute("type", &value) == TIXML_SUCCESS) SetUniqueID(uniqueid->FirstChild()->ValueStr(), value); else SetUniqueID(uniqueid->FirstChild()->ValueStr()); bool isDefault; if ((uniqueid->QueryBoolAttribute("default", &isDefault) == TIXML_SUCCESS) && isDefault) m_strDefaultUniqueID = value; } } } if (XMLUtils::GetString(movie, "filenameandpath", value)) SetFileNameAndPath(value); if (XMLUtils::GetDate(movie, "premiered", m_premiered)) { m_bHasPremiered = true; } else { int year; if (XMLUtils::GetInt(movie, "year", year)) SetYear(year); } if (XMLUtils::GetString(movie, "status", value)) SetStatus(value); if (XMLUtils::GetString(movie, "code", value)) SetProductionCode(value); XMLUtils::GetDate(movie, "aired", m_firstAired); if (XMLUtils::GetString(movie, "album", value)) SetAlbum(value); if (XMLUtils::GetString(movie, "trailer", value)) SetTrailer(value); if (XMLUtils::GetString(movie, "basepath", value)) SetBasePath(value); size_t iThumbCount = m_strPictureURL.m_url.size(); std::string xmlAdd = m_strPictureURL.m_xml; const TiXmlElement* thumb = movie->FirstChildElement("thumb"); while (thumb) { m_strPictureURL.ParseElement(thumb); if (prioritise) { std::string temp; temp << *thumb; xmlAdd = temp+xmlAdd; } thumb = thumb->NextSiblingElement("thumb"); } // prioritise thumbs from nfos if (prioritise && iThumbCount && iThumbCount != m_strPictureURL.m_url.size()) { rotate(m_strPictureURL.m_url.begin(), m_strPictureURL.m_url.begin()+iThumbCount, m_strPictureURL.m_url.end()); m_strPictureURL.m_xml = xmlAdd; } std::vector<std::string> genres(m_genre); if (XMLUtils::GetStringArray(movie, "genre", genres, prioritise, g_advancedSettings.m_videoItemSeparator)) SetGenre(genres); std::vector<std::string> country(m_country); if (XMLUtils::GetStringArray(movie, "country", country, prioritise, g_advancedSettings.m_videoItemSeparator)) SetCountry(country); std::vector<std::string> credits(m_writingCredits); if (XMLUtils::GetStringArray(movie, "credits", credits, prioritise, g_advancedSettings.m_videoItemSeparator)) SetWritingCredits(credits); std::vector<std::string> director(m_director); if (XMLUtils::GetStringArray(movie, "director", director, prioritise, g_advancedSettings.m_videoItemSeparator)) SetDirector(director); std::vector<std::string> showLink(m_showLink); if (XMLUtils::GetStringArray(movie, "showlink", showLink, prioritise, g_advancedSettings.m_videoItemSeparator)) SetShowLink(showLink); const TiXmlElement* namedSeason = movie->FirstChildElement("namedseason"); while (namedSeason != nullptr) { if (namedSeason->FirstChild() != nullptr) { int seasonNumber; std::string seasonName = namedSeason->FirstChild()->ValueStr(); if (!seasonName.empty() && namedSeason->Attribute("number", &seasonNumber) != nullptr) m_namedSeasons.insert(std::make_pair(seasonNumber, seasonName)); } namedSeason = namedSeason->NextSiblingElement("namedseason"); } // cast node = movie->FirstChildElement("actor"); if (node && node->FirstChild() && prioritise) m_cast.clear(); while (node) { const TiXmlNode *actor = node->FirstChild("name"); if (actor && actor->FirstChild()) { SActorInfo info; info.strName = actor->FirstChild()->Value(); if (XMLUtils::GetString(node, "role", value)) info.strRole = StringUtils::Trim(value); XMLUtils::GetInt(node, "order", info.order); const TiXmlElement* thumb = node->FirstChildElement("thumb"); while (thumb) { info.thumbUrl.ParseElement(thumb); thumb = thumb->NextSiblingElement("thumb"); } const char* clear=node->Attribute("clear"); if (clear && stricmp(clear,"true")) m_cast.clear(); m_cast.push_back(info); } node = node->NextSiblingElement("actor"); } // Pre-Jarvis NFO file: // <set>A set</set> if (XMLUtils::GetString(movie, "set", value)) SetSet(value); // Jarvis+: // <set><name>A set</name><overview>A set with a number of movies...</overview></set> node = movie->FirstChildElement("set"); if (node) { // No name, no set if (XMLUtils::GetString(node, "name", value)) { SetSet(value); if (XMLUtils::GetString(node, "overview", value)) SetSetOverview(value); } } std::vector<std::string> tags(m_tags); if (XMLUtils::GetStringArray(movie, "tag", tags, prioritise, g_advancedSettings.m_videoItemSeparator)) SetTags(tags); std::vector<std::string> studio(m_studio); if (XMLUtils::GetStringArray(movie, "studio", studio, prioritise, g_advancedSettings.m_videoItemSeparator)) SetStudio(studio); // artists std::vector<std::string> artist(m_artist); node = movie->FirstChildElement("artist"); if (node && node->FirstChild() && prioritise) artist.clear(); while (node) { const TiXmlNode* pNode = node->FirstChild("name"); const char* pValue=NULL; if (pNode && pNode->FirstChild()) pValue = pNode->FirstChild()->Value(); else if (node->FirstChild()) pValue = node->FirstChild()->Value(); if (pValue) { const char* clear=node->Attribute("clear"); if (clear && stricmp(clear,"true")==0) artist.clear(); std::vector<std::string> newArtists = StringUtils::Split(pValue, g_advancedSettings.m_videoItemSeparator); artist.insert(artist.end(), newArtists.begin(), newArtists.end()); } node = node->NextSiblingElement("artist"); } SetArtist(artist); node = movie->FirstChildElement("fileinfo"); if (node) { // Try to pull from fileinfo/streamdetails/[video|audio|subtitle] const TiXmlNode *nodeStreamDetails = node->FirstChild("streamdetails"); if (nodeStreamDetails) { const TiXmlNode *nodeDetail = NULL; while ((nodeDetail = nodeStreamDetails->IterateChildren("audio", nodeDetail))) { CStreamDetailAudio *p = new CStreamDetailAudio(); if (XMLUtils::GetString(nodeDetail, "codec", value)) p->m_strCodec = StringUtils::Trim(value); if (XMLUtils::GetString(nodeDetail, "language", value)) p->m_strLanguage = StringUtils::Trim(value); XMLUtils::GetInt(nodeDetail, "channels", p->m_iChannels); StringUtils::ToLower(p->m_strCodec); StringUtils::ToLower(p->m_strLanguage); m_streamDetails.AddStream(p); } nodeDetail = NULL; while ((nodeDetail = nodeStreamDetails->IterateChildren("video", nodeDetail))) { CStreamDetailVideo *p = new CStreamDetailVideo(); if (XMLUtils::GetString(nodeDetail, "codec", value)) p->m_strCodec = StringUtils::Trim(value); XMLUtils::GetFloat(nodeDetail, "aspect", p->m_fAspect); XMLUtils::GetInt(nodeDetail, "width", p->m_iWidth); XMLUtils::GetInt(nodeDetail, "height", p->m_iHeight); XMLUtils::GetInt(nodeDetail, "durationinseconds", p->m_iDuration); if (XMLUtils::GetString(nodeDetail, "stereomode", value)) p->m_strStereoMode = StringUtils::Trim(value); if (XMLUtils::GetString(nodeDetail, "language", value)) p->m_strLanguage = StringUtils::Trim(value); StringUtils::ToLower(p->m_strCodec); StringUtils::ToLower(p->m_strStereoMode); StringUtils::ToLower(p->m_strLanguage); m_streamDetails.AddStream(p); } nodeDetail = NULL; while ((nodeDetail = nodeStreamDetails->IterateChildren("subtitle", nodeDetail))) { CStreamDetailSubtitle *p = new CStreamDetailSubtitle(); if (XMLUtils::GetString(nodeDetail, "language", value)) p->m_strLanguage = StringUtils::Trim(value); StringUtils::ToLower(p->m_strLanguage); m_streamDetails.AddStream(p); } } m_streamDetails.DetermineBestStreams(); } /* if fileinfo */ const TiXmlElement *epguide = movie->FirstChildElement("episodeguide"); if (epguide) { // DEPRECIATE ME - support for old XML-encoded <episodeguide> blocks. if (epguide->FirstChild() && strnicmp("<episodeguide", epguide->FirstChild()->Value(), 13) == 0) m_strEpisodeGuide = epguide->FirstChild()->Value(); else { std::stringstream stream; stream << *epguide; m_strEpisodeGuide = stream.str(); } } // fanart const TiXmlElement *fanart = movie->FirstChildElement("fanart"); if (fanart) { // we prioritise mixed-mode nfo's with fanart set if (prioritise) { std::string temp; temp << *fanart; m_fanart.m_xml = temp+m_fanart.m_xml; } else m_fanart.m_xml << *fanart; m_fanart.Unpack(); } // resumePoint const TiXmlNode *resume = movie->FirstChild("resume"); if (resume) { XMLUtils::GetDouble(resume, "position", m_resumePoint.timeInSeconds); XMLUtils::GetDouble(resume, "total", m_resumePoint.totalTimeInSeconds); } XMLUtils::GetDateTime(movie, "dateadded", m_dateAdded); }
bool EditMetadataDialog::Create() { if (!LoadWindowFromXML("video-ui.xml", "edit_metadata", this)) return false; bool err = false; UIUtilE::Assign(this, m_titleEdit, "title_edit", &err); UIUtilE::Assign(this, m_subtitleEdit, "subtitle_edit", &err); UIUtilE::Assign(this, m_playerEdit, "player_edit", &err); UIUtilE::Assign(this, m_seasonSpin, "season", &err); UIUtilE::Assign(this, m_episodeSpin, "episode", &err); UIUtilE::Assign(this, m_categoryList, "category_select", &err); UIUtilE::Assign(this, m_levelList, "level_select", &err); UIUtilE::Assign(this, m_childList, "child_select", &err); UIUtilE::Assign(this, m_browseCheck, "browse_check", &err); UIUtilE::Assign(this, m_watchedCheck, "watched_check", &err); UIUtilE::Assign(this, m_doneButton, "done_button", &err); if (err) { LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'edit_metadata'"); return false; } UIUtilW::Assign(this, m_coverartText, "coverart_text"); UIUtilW::Assign(this, m_screenshotText, "screenshot_text"); UIUtilW::Assign(this, m_bannerText, "banner_text"); UIUtilW::Assign(this, m_fanartText, "fanart_text"); UIUtilW::Assign(this, m_trailerText, "trailer_text"); UIUtilW::Assign(this, m_coverartButton, "coverart_button"); UIUtilW::Assign(this, m_bannerButton, "banner_button"); UIUtilW::Assign(this, m_fanartButton, "fanart_button"); UIUtilW::Assign(this, m_screenshotButton, "screenshot_button"); UIUtilW::Assign(this, m_trailerButton, "trailer_button"); UIUtilW::Assign(this, m_netBannerButton, "net_banner_button"); UIUtilW::Assign(this, m_netFanartButton, "net_fanart_button"); UIUtilW::Assign(this, m_netScreenshotButton, "net_screenshot_button"); UIUtilW::Assign(this, m_netCoverartButton, "net_coverart_button"); UIUtilW::Assign(this, m_taglineEdit, "tagline_edit"); UIUtilW::Assign(this, m_ratingEdit, "rating_edit"); UIUtilW::Assign(this, m_directorEdit, "director_edit"); UIUtilW::Assign(this, m_inetrefEdit, "inetref_edit"); UIUtilW::Assign(this, m_homepageEdit, "homepage_edit"); UIUtilW::Assign(this, m_plotEdit, "description_edit"); UIUtilW::Assign(this, m_yearSpin, "year_spin"); UIUtilW::Assign(this, m_userRatingSpin, "userrating_spin"); UIUtilW::Assign(this, m_lengthSpin, "length_spin"); UIUtilW::Assign(this, m_coverart, "coverart"); UIUtilW::Assign(this, m_screenshot, "screenshot"); UIUtilW::Assign(this, m_banner, "banner"); UIUtilW::Assign(this, m_fanart, "fanart"); fillWidgets(); BuildFocusList(); connect(m_titleEdit, SIGNAL(valueChanged()), SLOT(SetTitle())); m_titleEdit->SetMaxLength(128); connect(m_subtitleEdit, SIGNAL(valueChanged()), SLOT(SetSubtitle())); m_subtitleEdit->SetMaxLength(0); connect(m_playerEdit, SIGNAL(valueChanged()), SLOT(SetPlayer())); if (m_taglineEdit) { connect(m_taglineEdit, SIGNAL(valueChanged()), SLOT(SetTagline())); m_taglineEdit->SetMaxLength(255); } if (m_ratingEdit) { connect(m_ratingEdit, SIGNAL(valueChanged()), SLOT(SetRating())); m_ratingEdit->SetMaxLength(128); } if (m_directorEdit) { connect(m_directorEdit, SIGNAL(valueChanged()), SLOT(SetDirector())); m_directorEdit->SetMaxLength(128); } if (m_inetrefEdit) connect(m_inetrefEdit, SIGNAL(valueChanged()), SLOT(SetInetRef())); if (m_homepageEdit) { connect(m_homepageEdit, SIGNAL(valueChanged()), SLOT(SetHomepage())); m_homepageEdit->SetMaxLength(0); } if (m_plotEdit) { connect(m_plotEdit, SIGNAL(valueChanged()), SLOT(SetPlot())); m_plotEdit->SetMaxLength(0); } connect(m_seasonSpin, SIGNAL(LosingFocus()), SLOT(SetSeason())); connect(m_episodeSpin, SIGNAL(LosingFocus()), SLOT(SetEpisode())); if (m_yearSpin) connect(m_yearSpin, SIGNAL(LosingFocus()), SLOT(SetYear())); if (m_userRatingSpin) connect(m_userRatingSpin, SIGNAL(LosingFocus()), SLOT(SetUserRating())); if (m_lengthSpin) connect(m_lengthSpin, SIGNAL(LosingFocus()), SLOT(SetLength())); connect(m_doneButton, SIGNAL(Clicked()), SLOT(SaveAndExit())); // Find Artwork locally if (m_coverartButton) connect(m_coverartButton, SIGNAL(Clicked()), SLOT(FindCoverArt())); if (m_bannerButton) connect(m_bannerButton, SIGNAL(Clicked()), SLOT(FindBanner())); if (m_fanartButton) connect(m_fanartButton, SIGNAL(Clicked()), SLOT(FindFanart())); if (m_screenshotButton) connect(m_screenshotButton, SIGNAL(Clicked()), SLOT(FindScreenshot())); // Find Artwork on the Internet if (m_netCoverartButton) connect(m_netCoverartButton, SIGNAL(Clicked()), SLOT(FindNetCoverArt())); if (m_netBannerButton) connect(m_netBannerButton, SIGNAL(Clicked()), SLOT(FindNetBanner())); if (m_netFanartButton) connect(m_netFanartButton, SIGNAL(Clicked()), SLOT(FindNetFanart())); if (m_netScreenshotButton) connect(m_netScreenshotButton, SIGNAL(Clicked()), SLOT(FindNetScreenshot())); if (m_trailerButton) connect(m_trailerButton, SIGNAL(Clicked()), SLOT(FindTrailer())); connect(m_browseCheck, SIGNAL(valueChanged()), SLOT(ToggleBrowse())); connect(m_watchedCheck, SIGNAL(valueChanged()), SLOT(ToggleWatched())); connect(m_childList, SIGNAL(itemSelected(MythUIButtonListItem*)), SLOT(SetChild(MythUIButtonListItem*))); connect(m_levelList, SIGNAL(itemSelected(MythUIButtonListItem*)), SLOT(SetLevel(MythUIButtonListItem*))); connect(m_categoryList, SIGNAL(itemSelected(MythUIButtonListItem*)), SLOT(SetCategory(MythUIButtonListItem*))); connect(m_categoryList, SIGNAL(itemClicked(MythUIButtonListItem*)), SLOT(NewCategoryPopup())); return true; }
void SettingsSetTimeScreen::loop() { return; int x = getTouchX(); int y = getTouchY(); // TODO if (x>54 && x<88) { //- if (y>6 && y<27) { // month uint8_t month = GetMonth(); uint8_t next_month = month - 1; if(month == 0) next_month = 12; SetMonth(next_month); renderMonth(); } if (y>40 && y<61) { // day uint8_t day = GetDate(); uint8_t next_day = day - 1; if(day == 0) next_day = 31; SetMonth(next_day); renderDay(); } if (y>73 && y<94) { // yr uint8_t year = GetYear(); uint8_t next_year = year - 1; SetYear(next_year); renderYear(); } if (y>106 && y<127) { // hr uint8_t hour = GetHour(); uint8_t next_hour = hour - 1; SetHour(next_hour); renderHour(); } if (y>140 && y<161) { // min uint8_t minute = GetMinute(); uint8_t next_minute = minute - 1; SetMinute(next_minute); renderMinute(); } if (y>173 && y<194) { // am/pm uint8_t ampm = GetAmPm(); SetAmPm(~ampm); } } if (x>104 && x<138) { //+ if (y>6 && y<27) { // month } if (y>40 && y<61) { // day } if (y>73 && y<94) { // yr } if (y>106 && y<127) { // hr } if (y>140 && y<161) { // min } if (y>173 && y<194) { // am/pm } } }
//################################################################################################################################ //-------------------------------------------------------------------------------------------------------------------------------- //函数名称:CLevel21_Sure() //-------------------------------------------------------------------------------------------------------------------------------- //函数功能:确认键的第二层第一个任务 //-------------------------------------------------------------------------------------------------------------------------------- //输入参数: tmp为第几个按键的值 //-------------------------------------------------------------------------------------------------------------------------------- //输出参数: null //-------------------------------------------------------------------------------------------------------------------------------- //说 明: //-------------------------------------------------------------------------------------------------------------------------------- //################################################################################################################################ void CLevel21_Sure(uint8 tmp) { // uint8 j; PCF8563_DATE timeAndDate; switch(tmp) { case 1: ClearScreen(0); SetLocalAddr(0,(GetSendToF(0)/100)); SetLocalAddr(1,(GetSendToF(0)%100/10)); SetLocalAddr(2,(GetSendToF(0)%10)); SetLocalDepSum(GetSendToF(1)); if((100*GetLocalAddr(0)+10*GetLocalAddr(1)+GetLocalAddr(2))>CIRCOUNT) { SetLocalAddr(0,0); SetLocalAddr(1,0); SetLocalAddr(2,0); } if(GetLocalDepSum()>DEPART) SetLocalDepSum(0); Local_Menu(GetLocalAddr(0),GetLocalAddr(1),GetLocalAddr(2),GetLocalDepSum(),1,0); break; case 2: ClearScreen(0); // SetCompRegDep(SSP1_Read_1Byte(2)); // SetCompRegAddr(SSP1_Read_1Byte(13)); // GetRegNum(GetCompRegDep()); if(GetCompRegDep()>DEPART) SetCompRegDep(0); if(GetCompRegNum()>DEPARTCOM) SetCompRegDep(0); if(GetCompRegAddr()>CIRADDRESS) SetCompRegAddr(0); CompReg_menu(GetCompRegDep(),GetCompRegNum(),0,GetCompRegAddr(),1,0); // CompReg_menu(GetCompRegDep(),GetCompRegNum(),0,GetCompRegDep(),1,0); SetComRegFlag(1); NVIC_DisableIRQ(EINT3_IRQn); break; case 3: ClearScreen(0); CompSet_Menu(GetCompSetDep(),GetCompSetNum(),GetComSetSelSet(),1,0); break; case 4: PCF8563_Read(&timeAndDate); SetYear(timeAndDate.year); SetMonth(timeAndDate.month); SetDay(timeAndDate.day); SetHour(timeAndDate.hour); SetMintue(timeAndDate.minute); SetSecond(timeAndDate.second); ClearScreen(0); DateMod_Menu(GetYear(),GetMonth(),GetDay(),GetHour(),GetMintue(),GetSecond(),1,0); break; // case 5: // ClearScreen(0); // Annotate_Menu(GetAnnDep(),GetAnnCompNum(),1); // SetAnnUartFlag(1); // break; case 5: ClearScreen(0); Waiting_menu(); EndInt(); SendDataToFlash(); CSendPSNToFlash(); SaveMaskPSN(); CSaveAnn(); StartInt(); ClearScreen(0); CSaveInfo(); break; // case 7: // // break; default:break; } }
// This runs once during program startup void Controller::setup() { // Setup code here LGSerial::init(); LGSerial::put("Hello World!"); DDRC |= 1 << DDC2;//trigger DDRC |= 1 << DDC3;//pc3 pin 26 for output DDRC |= 1 << DDC4; DDRC |= 1 << DDC5; DDRD |= 1 << DDD0; PORTD &= ~(1 << PD0); PORTC &= ~(1 << PC2); PORTC &= ~(1 << PC3); _delay_ms(500); ClockInit(); SetSecond(1); SetMinute(33); SetHour(8); SetAmPm(1);///0 for AM, 1 for PM SetDay(3); SetDate(23); SetMonth(4); SetYear(13); char Time[12]; //hh:mm:ss AM/PM while(0) { //Get the Current Time as a String if(!GetTimeString(Time))//modifies time { /* If return value is false then some error has occured Check ->DS1307 Installed Properly ->DIP Switch 1,2 are in on position */ while(1);//halt } _delay_ms(500); } uint8_t second = GetSecond(); uint8_t minute = GetMinute(); uint8_t hour = GetHour(); uint8_t AmPm = GetAmPm(); uint8_t day = GetDate(); uint8_t date = GetDate(); uint8_t month = GetMonth(); uint8_t year = GetYear(); LGSerial::print(second); LGSerial::print(minute); LGSerial::print(hour); LGSerial::print(AmPm); LGSerial::print(day); LGSerial::print(date); LGSerial::print(month); LGSerial::print(year); _delay_ms(20000); second = GetSecond(); minute = GetMinute(); LGSerial::print(second); LGSerial::print(minute); _delay_ms(20000); second = GetSecond(); minute = GetMinute(); LGSerial::print(second); LGSerial::print(minute); //uint8_t minute = GetMinute(); //uint8_t minute = 0xAA; // bool min[8]; /* min[0] = minute & 0x01; min[1] = minute & 0x02; min[2] = minute & 0x04; min[3] = minute & 0x08; min[4] = minute & 0x10; min[5] = minute & 0x20; min[6] = minute & 0x40; min[7] = minute & 0x80; */ /* min[0] = 0; min[1] = 1; min[2] = 0; min[3] = 1; min[4] = 0; min[5] = 1; min[6] = 0; min[7] = 1; */ /* int i = 0; while(1){ //make pc2 trigger PORTC |= 1 << PC2; PORTC &= ~(1 << PC2); PORTC |= 1 << PC3; PORTC &= ~(1 << PC3); PORTC |= 1 << PC3; PORTC &= ~(1 << PC3); PORTC |= 1 << PC3; PORTC &= ~(1 << PC3); for (i=0;i<8;i++){ if (min[i] == 1){ //if that bit of min is 1 PORTD |= 1 << PD0; PORTD &= ~(1 << PD0); PORTD |= 1 << PD0; PORTD &= ~(1 << PD0); PORTC &= ~(1 << PC3); PORTC |= 1 << PC3; PORTC &= ~(1 << PC3); } else {//if (min[i] == 0){ //if that bit of min is 0 PORTD |= 1 << PD0; PORTD &= ~(1 << PD0); PORTC |= 1 << PC3; PORTC &= ~(1 << PC3); PORTC |= 1 << PC3; } } } */ }
void CDate::SetDate(int year, int month, int day) { SetYear(year); SetMonth(month); SetDay(day); }
CDate::CDate(int year, int month, int day) : m_year(1988), m_month(1), m_day(15) { SetYear(year); SetMonth(month); SetDay(day); }
void cDate::Set(uint8_t month, uint8_t day, uint16_t year) { SetDay(day); SetMonth(month); SetYear(year); }