2010-11-13 23:34:53 +01:00
/****************************************************************************
* Copyright ( C ) 2010
* by Dimok
*
* This software is provided ' as - is ' , without any express or implied
* warranty . In no event will the authors be held liable for any
* damages arising from the use of this software .
*
* Permission is granted to anyone to use this software for any
* purpose , including commercial applications , and to alter it and
* redistribute it freely , subject to the following restrictions :
*
* 1. The origin of this software must not be misrepresented ; you
* must not claim that you wrote the original software . If you use
* this software in a product , an acknowledgment in the product
* documentation would be appreciated but is not required .
*
* 2. Altered source versions must be plainly marked as such , and
* must not be misrepresented as being the original software .
*
* 3. This notice may not be removed or altered from any source
* distribution .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
# include "GlobalSettings.hpp"
# include "themes/CTheme.h"
# include "prompts/PromptWindows.h"
2010-12-18 14:20:45 +01:00
# include "network/update.h"
2010-11-13 23:34:53 +01:00
# include "language/gettext.h"
2010-11-30 05:09:36 +01:00
# include "GUISettingsMenu.hpp"
2011-01-09 11:45:29 +01:00
# include "LoaderSettings.hpp"
2010-11-13 23:34:53 +01:00
# include "ParentalControlSM.hpp"
# include "SoundSettingsMenu.hpp"
# include "CustomPathsSM.hpp"
2011-06-18 09:00:42 +02:00
# include "FeatureSettingsMenu.hpp"
2011-06-22 19:57:37 +02:00
# include "HardDriveSM.hpp"
2012-05-06 12:59:58 +02:00
# include "BannerSettingsMenu.hpp"
2010-11-13 23:34:53 +01:00
GlobalSettings : : GlobalSettings ( )
2011-07-26 00:28:22 +02:00
: FlyingButtonsMenu ( tr ( " Global Settings " ) )
2010-11-13 23:34:53 +01:00
{
2011-07-26 00:28:22 +02:00
creditsImgData = Resources : : GetImageData ( " credits_button.png " ) ;
creditsImgOverData = Resources : : GetImageData ( " credits_button_over.png " ) ;
2010-11-13 23:34:53 +01:00
}
GlobalSettings : : ~ GlobalSettings ( )
{
2011-07-26 00:28:22 +02:00
Settings . Save ( ) ;
2010-11-13 23:34:53 +01:00
2011-07-26 00:28:22 +02:00
delete creditsImgData ;
delete creditsImgOverData ;
2010-11-13 23:34:53 +01:00
}
2011-11-12 19:14:09 +01:00
int GlobalSettings : : Execute ( )
2011-06-03 22:31:09 +02:00
{
2011-07-26 00:28:22 +02:00
GlobalSettings * Menu = new GlobalSettings ( ) ;
mainWindow - > Append ( Menu ) ;
2011-06-03 22:31:09 +02:00
2011-07-26 00:28:22 +02:00
Menu - > ShowMenu ( ) ;
2011-06-03 22:31:09 +02:00
2011-07-26 00:28:22 +02:00
int returnMenu = MENU_NONE ;
2011-06-03 22:31:09 +02:00
2011-07-26 00:28:22 +02:00
while ( ( returnMenu = Menu - > MainLoop ( ) ) = = MENU_NONE ) ;
2011-06-03 22:31:09 +02:00
2011-07-26 00:28:22 +02:00
delete Menu ;
2011-06-03 22:31:09 +02:00
2011-07-26 00:28:22 +02:00
return returnMenu ;
2011-06-03 22:31:09 +02:00
}
2010-11-13 23:34:53 +01:00
void GlobalSettings : : SetupMainButtons ( )
{
2011-07-26 00:28:22 +02:00
int pos = 0 ;
2010-11-13 23:34:53 +01:00
2011-07-26 00:28:22 +02:00
SetMainButton ( pos + + , tr ( " GUI Settings " ) , MainButtonImgData , MainButtonImgOverData ) ;
SetMainButton ( pos + + , tr ( " Loader Settings " ) , MainButtonImgData , MainButtonImgOverData ) ;
SetMainButton ( pos + + , tr ( " Hard Drive Settings " ) , MainButtonImgData , MainButtonImgOverData ) ;
SetMainButton ( pos + + , tr ( " Features " ) , MainButtonImgData , MainButtonImgOverData ) ;
2012-05-06 12:59:58 +02:00
SetMainButton ( pos + + , tr ( " Banner Animation Settings " ) , MainButtonImgData , MainButtonImgOverData ) ;
2011-07-26 00:28:22 +02:00
SetMainButton ( pos + + , tr ( " Sound " ) , MainButtonImgData , MainButtonImgOverData ) ;
2012-05-06 12:59:58 +02:00
SetMainButton ( pos + + , tr ( " Parental Control " ) , MainButtonImgData , MainButtonImgOverData ) ;
SetMainButton ( pos + + , tr ( " Custom Paths " ) , MainButtonImgData , MainButtonImgOverData ) ;
2011-07-26 00:28:22 +02:00
SetMainButton ( pos + + , tr ( " Theme Menu " ) , MainButtonImgData , MainButtonImgOverData ) ;
SetMainButton ( pos + + , tr ( " Theme Downloader " ) , MainButtonImgData , MainButtonImgOverData ) ;
SetMainButton ( pos + + , tr ( " Update " ) , MainButtonImgData , MainButtonImgOverData ) ;
SetMainButton ( pos + + , tr ( " Default Settings " ) , MainButtonImgData , MainButtonImgOverData ) ;
SetMainButton ( pos + + , tr ( " Credits " ) , creditsImgData , creditsImgOverData ) ;
2010-11-13 23:34:53 +01:00
}
void GlobalSettings : : CreateSettingsMenu ( int menuNr )
{
2011-07-26 00:28:22 +02:00
if ( CurrentMenu )
return ;
2010-11-13 23:34:53 +01:00
2011-07-26 00:28:22 +02:00
int Idx = 0 ;
2010-11-13 23:34:53 +01:00
2011-07-26 00:28:22 +02:00
//! GUI Settings
if ( menuNr = = Idx + + )
{
if ( ! Settings . godmode & & ( Settings . ParentalBlocks & BLOCK_GUI_SETTINGS ) )
{
WindowPrompt ( tr ( " Permission denied. " ) , tr ( " Console must be unlocked for this option. " ) , tr ( " OK " ) ) ;
return ;
}
2011-01-20 16:00:55 +01:00
2011-07-26 00:28:22 +02:00
HideMenu ( ) ;
ResumeGui ( ) ;
CurrentMenu = new GuiSettingsMenu ( ) ;
Append ( CurrentMenu ) ;
}
//! Loader Settings
else if ( menuNr = = Idx + + )
{
if ( ! Settings . godmode & & ( Settings . ParentalBlocks & BLOCK_LOADER_SETTINGS ) )
{
WindowPrompt ( tr ( " Permission denied. " ) , tr ( " Console must be unlocked for this option. " ) , tr ( " OK " ) ) ;
return ;
}
2011-01-20 16:00:55 +01:00
2011-07-26 00:28:22 +02:00
HideMenu ( ) ;
ResumeGui ( ) ;
CurrentMenu = new LoaderSettings ( ) ;
Append ( CurrentMenu ) ;
}
//! Hard Drive Settings
else if ( menuNr = = Idx + + )
{
if ( ! Settings . godmode & & ( Settings . ParentalBlocks & BLOCK_HARD_DRIVE_SETTINGS ) )
{
WindowPrompt ( tr ( " Permission denied. " ) , tr ( " Console must be unlocked for this option. " ) , tr ( " OK " ) ) ;
return ;
}
2011-01-20 16:00:55 +01:00
2011-07-26 00:28:22 +02:00
HideMenu ( ) ;
ResumeGui ( ) ;
CurrentMenu = new HardDriveSM ( ) ;
Append ( CurrentMenu ) ;
}
//! Feature
else if ( menuNr = = Idx + + )
{
if ( ! Settings . godmode & & ( Settings . ParentalBlocks & BLOCK_FEATURE_SETTINGS ) )
{
WindowPrompt ( tr ( " Permission denied. " ) , tr ( " Console must be unlocked for this option. " ) , tr ( " OK " ) ) ;
return ;
}
2011-06-18 09:00:42 +02:00
2011-07-26 00:28:22 +02:00
HideMenu ( ) ;
ResumeGui ( ) ;
CurrentMenu = new FeatureSettingsMenu ( ) ;
Append ( CurrentMenu ) ;
}
2012-05-06 12:59:58 +02:00
//! Banner Animation Settings
2011-07-26 00:28:22 +02:00
else if ( menuNr = = Idx + + )
{
2012-05-06 12:59:58 +02:00
if ( ! Settings . godmode & & ( Settings . ParentalBlocks & BLOCK_BANNER_SETTINGS ) )
2011-07-26 00:28:22 +02:00
{
WindowPrompt ( tr ( " Permission denied. " ) , tr ( " Console must be unlocked for this option. " ) , tr ( " OK " ) ) ;
return ;
}
2011-01-20 16:00:55 +01:00
2011-07-26 00:28:22 +02:00
HideMenu ( ) ;
ResumeGui ( ) ;
2012-05-06 12:59:58 +02:00
CurrentMenu = new BannerSettingsMenu ( ) ;
2011-07-26 00:28:22 +02:00
Append ( CurrentMenu ) ;
}
//! Sound
else if ( menuNr = = Idx + + )
{
if ( ! Settings . godmode & & ( Settings . ParentalBlocks & BLOCK_SOUND_SETTINGS ) )
{
WindowPrompt ( tr ( " Permission denied. " ) , tr ( " Console must be unlocked for this option. " ) , tr ( " OK " ) ) ;
return ;
}
2010-11-13 23:34:53 +01:00
2011-07-26 00:28:22 +02:00
HideMenu ( ) ;
ResumeGui ( ) ;
CurrentMenu = new SoundSettingsMenu ( ) ;
Append ( CurrentMenu ) ;
}
2012-05-06 12:59:58 +02:00
//! Parental Control
2011-07-26 00:28:22 +02:00
else if ( menuNr = = Idx + + )
{
2012-05-06 12:59:58 +02:00
if ( ! Settings . godmode & & ( Settings . ParentalBlocks & BLOCK_PARENTAL_SETTINGS ) )
2011-07-26 00:28:22 +02:00
{
WindowPrompt ( tr ( " Permission denied. " ) , tr ( " Console must be unlocked for this option. " ) , tr ( " OK " ) ) ;
return ;
}
2011-02-05 15:46:06 +01:00
2012-05-06 12:59:58 +02:00
HideMenu ( ) ;
ResumeGui ( ) ;
CurrentMenu = new ParentalControlSM ( ) ;
Append ( CurrentMenu ) ;
2011-07-26 00:28:22 +02:00
}
2012-05-06 12:59:58 +02:00
//! Custom Paths
2011-07-26 00:28:22 +02:00
else if ( menuNr = = Idx + + )
{
2012-05-06 12:59:58 +02:00
if ( ! Settings . godmode & & ( Settings . ParentalBlocks & BLOCK_CUSTOMPATH_SETTINGS ) )
2011-07-26 00:28:22 +02:00
{
WindowPrompt ( tr ( " Permission denied. " ) , tr ( " Console must be unlocked for this option. " ) , tr ( " OK " ) ) ;
return ;
}
2011-02-05 15:46:06 +01:00
2012-05-06 12:59:58 +02:00
HideMenu ( ) ;
ResumeGui ( ) ;
CurrentMenu = new CustomPathsSM ( ) ;
Append ( CurrentMenu ) ;
2011-07-26 00:28:22 +02:00
}
2012-05-06 12:59:58 +02:00
//! Theme Menu
2011-07-26 00:28:22 +02:00
else if ( menuNr = = Idx + + )
{
2012-05-06 12:59:58 +02:00
if ( ! Settings . godmode & & ( Settings . ParentalBlocks & BLOCK_THEME_MENU ) )
2011-07-26 00:28:22 +02:00
{
WindowPrompt ( tr ( " Permission denied. " ) , tr ( " Console must be unlocked for this option. " ) , tr ( " OK " ) ) ;
return ;
}
2011-06-22 19:57:37 +02:00
2012-05-06 12:59:58 +02:00
returnMenu = MENU_THEMEMENU ;
}
//! Theme Downloader
else if ( menuNr = = Idx + + )
{
if ( ! Settings . godmode & & ( Settings . ParentalBlocks & BLOCK_THEME_DOWNLOADER ) )
{
WindowPrompt ( tr ( " Permission denied. " ) , tr ( " Console must be unlocked for this option. " ) , tr ( " OK " ) ) ;
return ;
}
2015-07-13 16:26:30 +02:00
WindowPrompt ( tr ( " Warning: " ) , tr ( " Sorry, the theme downloader menu is not working anymore because http://wii.spiffy360.com now requires user registration. " ) , tr ( " OK " ) ) ;
return ;
// returnMenu = MENU_THEMEDOWNLOADER;
2011-07-26 00:28:22 +02:00
}
//! Update
else if ( menuNr = = Idx + + )
{
if ( ! Settings . godmode & & ( Settings . ParentalBlocks & BLOCK_UPDATES ) )
{
WindowPrompt ( tr ( " Permission denied. " ) , tr ( " Console must be unlocked for this option. " ) , tr ( " OK " ) ) ;
return ;
}
2011-01-20 16:00:55 +01:00
2011-07-26 00:28:22 +02:00
HideMenu ( ) ;
Remove ( backBtn ) ;
ResumeGui ( ) ;
int ret = UpdateApp ( ) ;
if ( ret < 0 )
WindowPrompt ( tr ( " Update failed " ) , 0 , tr ( " OK " ) ) ;
Append ( backBtn ) ;
ShowMenu ( ) ;
}
//! Default Settings
else if ( menuNr = = Idx + + )
{
if ( ! Settings . godmode & & ( Settings . ParentalBlocks & BLOCK_RESET_SETTINGS ) )
{
WindowPrompt ( tr ( " Permission denied. " ) , tr ( " Console must be unlocked for this option. " ) , tr ( " OK " ) ) ;
return ;
}
2011-01-20 16:00:55 +01:00
2011-07-26 00:28:22 +02:00
int choice = WindowPrompt ( tr ( " Are you sure you want to reset? " ) , 0 , tr ( " Yes " ) , tr ( " Cancel " ) ) ;
if ( choice = = 1 )
{
HaltGui ( ) ;
gettextCleanUp ( ) ;
Settings . Reset ( ) ;
returnMenu = MENU_SETTINGS ;
ResumeGui ( ) ;
}
}
//! Credits
else if ( menuNr = = Idx + + )
{
HideMenu ( ) ;
Remove ( backBtn ) ;
ResumeGui ( ) ;
WindowCredits ( ) ;
Append ( backBtn ) ;
ShowMenu ( ) ;
}
2010-11-13 23:34:53 +01:00
}
void GlobalSettings : : DeleteSettingsMenu ( )
{
2011-06-24 21:11:36 +02:00
delete CurrentMenu ;
2011-07-26 00:28:22 +02:00
CurrentMenu = NULL ;
2010-11-13 23:34:53 +01:00
}