xboxscene.org forums

Author Topic: 24h Clockpanel  (Read 267 times)

Mad3 Max3

  • Archived User
  • Newbie
  • *
  • Posts: 9
24h Clockpanel
« on: February 18, 2005, 06:28:00 PM »

I got a request to add this code for all of you that don't use the 12h and uses english as language in your xbox!

This code applies to them that has added the clockpanel to your dash!

main_menu/default.xap
find
CODE

geometry Text { font "body" justify "middle" translate false text }

replace with
CODE

geometry Text { font "body" justify "middle" translate false text "Error" }


default/default.xap
place this function at the end of the xap!
CODE

function UpdateListClock()
{
   var d = new Date;
   var c = theMainMenu.children[0].children[0];
   var vDay;
   var vMonth;
   var vMinutes;
   
   vMinutes = "14";
   
   if((d.getMonth() + 1) < 10) {
  vMonth = "0" + (d.getMonth() + 1);
   }
   else {
  vMonth = d.getMonth() + 1;
   }
   
   if(d.getDate() < 10) {
  vDay = "0" + d.getDate();
   }
   else {
  vDay = d.getDate();
   }
   
   if(d.getMinutes() < 10) {
  vMinutes = "0" + d.getMinutes();
   }
   else {
  vMinutes = d.getMinutes();
   }
  
   c.theClock_text.children[0].children[0].geometry.text = d.getFullYear() + "/" + vMonth + "/" + vDay + "  " + d.getHours() + ":" + vMinutes;
   c.Clock_panel_header_text.text = "Date";
   c.Clock_panel_support_03_text.text = "Time";

}

find
CODE

function OnActivate()
    {
  EnableAudio();
  CurrentViewpoint = theMainMenuViewpoint;
  CurrentAltViewpoint = theMainMenuAlternateViewpoint;
    }

make it look like this
CODE

function OnActivate()
    {
       EnableAudio();
  CurrentViewpoint = theMainMenuViewpoint;
  CurrentAltViewpoint = theMainMenuAlternateViewpoint;
   }
   behavior
     {
         sleep 5;
  if(CurrentViewpoint == theMainMenuViewpoint)
  {
     if(bInScreenSaverView==false)
     {
    UpdateListClock();
     }
  }
   }


find
CODE

MusicOnBootCheck();
UpdateMainMenu();
UpDateMainMenuButtonsText();
MainMenuAttract();
EnableAudio();

add after the last function call
CODE

UpdateListClock();


I think this will do the trick.. I might have forgotten something, if so tell me and I'll fix  it. If you want to be able to change between 12h and 24h in the config, let  me know and I add that.

Logged

ImOkRuOk

  • Archived User
  • Full Member
  • *
  • Posts: 116
24h Clockpanel
« Reply #1 on: February 19, 2005, 02:41:00 PM »

QUOTE
I think this will do the trick.. I might have forgotten something, if so tell me and I'll fix it. If you want to be able to change between 12h and 24h in the config, let me know and I add that.


I'd love it:)
Logged

Mad3 Max3

  • Archived User
  • Newbie
  • *
  • Posts: 9
24h Clockpanel
« Reply #2 on: February 20, 2005, 09:28:00 AM »

Here's a update of the code so you can set the 24h in config.

Find function UpdateListClock() and replace it with this!
CODE

function UpdateListClock()
{
   var d = new Date;
   var c = theMainMenu.children[0].children[0];
   var vDay;
   var vMonth;
   var vMinutes;
   
   if(bUse24h==true)
   {
  if((d.getMonth() + 1) < 10) {
     vMonth = "0" + (d.getMonth() + 1);
  }
  else {
     vMonth = d.getMonth() + 1;
  }
  
  if(d.getDate() < 10) {
     vDay = "0" + d.getDate();
  }
  else {
     vDay = d.getDate();
  }
  
  if(d.getMinutes() < 10) {
     vMinutes = "0" + d.getMinutes();
  }
  else {
     vMinutes = d.getMinutes();
  }
  
  c.theClock_text.children[0].children[0].geometry.text = d.getFullYear() + "/" + vMonth + "/" + vDay + "  " + d.getHours() + ":" + vMinutes;
   }
   else
   {
  c.theClock_text.children[0].children[0].geometry.text = "";
   }
   
   c.Clock_panel_header_text.text = "Date";
   c.Clock_panel_support_03_text.text = "Time";
}

Find this
CODE

            else if(nCurMainMenuItem == 3)
            {
                theSettingsMenuIn.Play();
                GoToSettings();
             }

and make it look like this!
CODE

            else if(nCurMainMenuItem == 3)
            {
                theSettingsMenuIn.Play();
                GoToSettings();
                bCheckIni = true; // In case you changed someting in the ini! *!*
            }

 
Find this
CODE

function OnActivate()
       {
       EnableAudio();
   CurrentViewpoint = theMainMenuViewpoint;
   CurrentAltViewpoint = theMainMenuAlternateViewpoint;
        }

Make it look like this
CODE

function OnActivate()
{
       EnableAudio();
   CurrentViewpoint = theMainMenuViewpoint;
   CurrentAltViewpoint = theMainMenuAlternateViewpoint;
   if(bCheckIni==true)
   {
        var IniFile = new Settings;
  IniFile.SetIniSection( "List Display" );
  var iVal = IniFile.GetIniValue( "24h" );
  if(iVal=="true") {
     bUse24h = true;
  }
  else {
     bUse24h = false;
  }
  IniFile.CloseIniFile();
  bCheckIni = false;
   }
}

Find
CODE

var b_restart;
var b_dvd;
var bInMusicMenu;
var bTrackListVisible;
var musicOnBoot;
var currentAlbum;
var currentTrack;

and add these variables at the end
CODE
var bUse24h;
var bCheckIni;

Find
CODE
function initialize()
{
   musicOnBoot = false;
   currentAlbum = 0;
   currentTrack = 0;

add
CODE

function initialize()
{
   musicOnBoot = false;
   currentAlbum = 0;
   currentTrack = 0;
        bUse24h = true;
   bCheckIni = false;

find
CODE
function ApplyDashStyle()

add this in the top of the function
CODE

var IniFile = new Settings;
IniFile.SetIniSection( "List Display" );
e = IniFile.GetIniValue("24h"); // *!*
if(e == "true") {
   bUse24h = true;
}
else {
   bUse24h = false;
}   
   
IniFile.CloseIniFile();


Now go to the config.xap
find
CODE
function BuildMainList()
{
   var i = 0;
   configList = new Array;
   configValues = new Array;
   configSelect = new Array;
   configList = "Dash Style:";
   configValues = "c-Dashboard Settings-Dash Style";
   configSelect = "ToggleMM()";
   i = i + 1;
    configList = "Menus Use Names From xbe:";
   configValues = "c-Naming Method-use xbe names";
   configSelect = "ToggleUseXBENames()";
   i = i + 1;
    configList = "AutoLaunch Inserted Media:";
   configValues = "c-AutoLaunch Media-Launch On Insert";
   configSelect = "ToggleAutoLaunchMedia()";
   i = i + 1;
   configList = "Background Music Start on Boot:";
   configValues = "c-Music On Boot-enabled"; //section-value
   configSelect = "ToggleTF()";
   i = i + 1;
   configList = "Music Initial Volume:";
   configValues = "c-Music On Boot-volume";
   configSelect = "ConfigKeyB()";
   i = i + 1;

add
CODE
configList = "24h Time System";
configValues = "c-List Display-24h";
configSelect = "ToggleTF()";
i = i + 1;


Now open up your uix.ini and and add
CODE
[List Display]
24h=false


this will do the trick.. I made the code so you don't need to restart UIX when you change between 24h and 12h time system.
Logged

ImOkRuOk

  • Archived User
  • Full Member
  • *
  • Posts: 116
24h Clockpanel
« Reply #3 on: February 20, 2005, 09:28:00 PM »

ok, got the code all in, first time i messed it, dash wouldnt load, now i got the code in all right, dash loads, config shows whats in ini, but no effect, in 24h no matter~ lemme check another xap, I might have changed...
Logged

ImOkRuOk

  • Archived User
  • Full Member
  • *
  • Posts: 116
24h Clockpanel
« Reply #4 on: February 21, 2005, 06:53:00 PM »

nope, should be fine, all code is good, shows in config, saves changes... no effect... stuck in 24 hour~
Logged

Xsmurf

  • Archived User
  • Newbie
  • *
  • Posts: 20
24h Clockpanel
« Reply #5 on: March 24, 2005, 06:36:00 AM »

Nope this isn't working for me also, would't be nice if someone could't come with a solution  :)


And is there a way to make the clock disappear when i click on the B-button.


Anyway keep up the good work

THIS DASH ROCKS
Logged

Xsmurf

  • Archived User
  • Newbie
  • *
  • Posts: 20
24h Clockpanel
« Reply #6 on: April 07, 2005, 05:36:00 PM »

Did anyone succeded in making this code to work.
Logged

esdubu

  • Archived User
  • Jr. Member
  • *
  • Posts: 94
24h Clockpanel
« Reply #7 on: May 10, 2005, 10:07:00 AM »

Just an idea off the top of my head would it be possible to get this working by when the clock gets to a certain time it adds 12 to the hour number?

eg: 1.00 pm + 12 gives 13.00 pm

Long shot and i don't really have the skills to try it for myself but you don't ask you don't get!
Logged