2013-06-28 00:16:30 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Copyright (C) 2013 FIX94
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
****************************************************************************/
|
2013-06-27 19:14:11 +02:00
|
|
|
#include "menu.hpp"
|
|
|
|
#include "defines.h"
|
|
|
|
|
2013-08-18 18:22:54 +02:00
|
|
|
s16 m_coverbnrLblTitle;
|
|
|
|
s16 m_coverbnrBtnBack;
|
|
|
|
|
2013-06-27 19:14:11 +02:00
|
|
|
s16 m_coverbnrLblDlCover;
|
|
|
|
s16 m_coverbnrLblDeleteCover;
|
|
|
|
s16 m_coverbnrLblDlBanner;
|
|
|
|
s16 m_coverbnrLblDeleteBanner;
|
|
|
|
|
|
|
|
s16 m_coverbnrBtnDlCover;
|
|
|
|
s16 m_coverbnrBtnDeleteCover;
|
|
|
|
s16 m_coverbnrBtnDlBanner;
|
|
|
|
s16 m_coverbnrBtnDeleteBanner;
|
2013-08-11 23:44:29 +02:00
|
|
|
|
|
|
|
s16 m_coverbnrLblUser[4];
|
2013-06-27 19:14:11 +02:00
|
|
|
TexData m_coverbnrBg;
|
|
|
|
|
|
|
|
void CMenu::_hideCoverBanner(bool instant)
|
|
|
|
{
|
2013-08-18 18:22:54 +02:00
|
|
|
m_btnMgr.hide(m_coverbnrLblTitle, instant);
|
|
|
|
m_btnMgr.hide(m_coverbnrBtnBack, instant);
|
2013-06-27 19:14:11 +02:00
|
|
|
m_btnMgr.hide(m_coverbnrLblDlCover, instant);
|
|
|
|
m_btnMgr.hide(m_coverbnrLblDeleteCover, instant);
|
|
|
|
m_btnMgr.hide(m_coverbnrLblDlBanner, instant);
|
|
|
|
m_btnMgr.hide(m_coverbnrLblDeleteBanner, instant);
|
|
|
|
|
|
|
|
m_btnMgr.hide(m_coverbnrBtnDlCover, instant);
|
|
|
|
m_btnMgr.hide(m_coverbnrBtnDeleteCover, instant);
|
|
|
|
m_btnMgr.hide(m_coverbnrBtnDlBanner, instant);
|
|
|
|
m_btnMgr.hide(m_coverbnrBtnDeleteBanner, instant);
|
2013-08-11 23:44:29 +02:00
|
|
|
|
|
|
|
for(u8 i = 0; i < ARRAY_SIZE(m_coverbnrLblUser); ++i)
|
|
|
|
if(m_coverbnrLblUser[i] != -1)
|
|
|
|
m_btnMgr.hide(m_coverbnrLblUser[i], instant);
|
2013-06-27 19:14:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CMenu::_showCoverBanner(void)
|
|
|
|
{
|
|
|
|
_setBg(m_coverbnrBg, m_coverbnrBg);
|
2013-08-18 18:22:54 +02:00
|
|
|
m_btnMgr.show(m_coverbnrLblTitle);
|
|
|
|
m_btnMgr.show(m_coverbnrBtnBack);
|
|
|
|
|
2013-06-27 19:14:11 +02:00
|
|
|
m_btnMgr.show(m_coverbnrLblDlCover);
|
|
|
|
m_btnMgr.show(m_coverbnrLblDeleteCover);
|
|
|
|
m_btnMgr.show(m_coverbnrLblDlBanner);
|
|
|
|
m_btnMgr.show(m_coverbnrLblDeleteBanner);
|
|
|
|
|
|
|
|
m_btnMgr.show(m_coverbnrBtnDlCover);
|
|
|
|
m_btnMgr.show(m_coverbnrBtnDeleteCover);
|
|
|
|
m_btnMgr.show(m_coverbnrBtnDlBanner);
|
|
|
|
m_btnMgr.show(m_coverbnrBtnDeleteBanner);
|
2013-08-11 23:44:29 +02:00
|
|
|
|
|
|
|
for(u8 i = 0; i < ARRAY_SIZE(m_coverbnrLblUser); ++i)
|
|
|
|
if(m_coverbnrLblUser[i] != -1)
|
|
|
|
m_btnMgr.show(m_coverbnrLblUser[i]);
|
2013-06-27 19:14:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CMenu::_CoverBanner(void)
|
|
|
|
{
|
|
|
|
const char *id = CoverFlow.getId();
|
2013-08-18 18:22:54 +02:00
|
|
|
SetupInput();
|
2013-06-27 19:14:11 +02:00
|
|
|
_showCoverBanner();
|
|
|
|
while(!m_exit)
|
|
|
|
{
|
|
|
|
_mainLoopCommon();
|
2013-08-18 18:22:54 +02:00
|
|
|
if (BTN_HOME_PRESSED || BTN_B_PRESSED || (BTN_A_PRESSED && m_btnMgr.selected(m_coverbnrBtnBack)))
|
2013-06-27 19:14:11 +02:00
|
|
|
break;
|
2013-08-18 18:22:54 +02:00
|
|
|
else if (BTN_UP_PRESSED)
|
|
|
|
m_btnMgr.up();
|
|
|
|
else if (BTN_DOWN_PRESSED)
|
|
|
|
m_btnMgr.down();
|
2013-06-27 19:14:11 +02:00
|
|
|
else if(BTN_A_PRESSED)
|
|
|
|
{
|
|
|
|
if(m_btnMgr.selected(m_coverbnrBtnDlCover))
|
|
|
|
{
|
|
|
|
_hideCoverBanner();
|
|
|
|
_download(id);
|
|
|
|
_showCoverBanner();
|
|
|
|
}
|
|
|
|
else if(m_btnMgr.selected(m_coverbnrBtnDeleteCover))
|
|
|
|
{
|
|
|
|
_hideCoverBanner();
|
|
|
|
RemoveCover(id);
|
|
|
|
_showCoverBanner();
|
|
|
|
}
|
|
|
|
else if(m_btnMgr.selected(m_coverbnrBtnDlBanner))
|
|
|
|
{
|
|
|
|
_hideCoverBanner();
|
|
|
|
fsop_deleteFile(fmt("%s/%s.bnr", m_bnrCacheDir.c_str(), id));
|
|
|
|
fsop_deleteFile(fmt("%s/%s.bnr", m_customBnrDir.c_str(), id));
|
2013-08-22 20:55:08 +02:00
|
|
|
fsop_deleteFile(fmt("%s/%.3s.bnr", m_bnrCacheDir.c_str(), id));
|
|
|
|
fsop_deleteFile(fmt("%s/%.3s.bnr", m_customBnrDir.c_str(), id));
|
2013-06-27 19:14:11 +02:00
|
|
|
_downloadBnr(id);
|
|
|
|
_showCoverBanner();
|
|
|
|
}
|
|
|
|
else if(m_btnMgr.selected(m_coverbnrBtnDeleteBanner))
|
|
|
|
{
|
|
|
|
_hideCoverBanner();
|
|
|
|
fsop_deleteFile(fmt("%s/%s.bnr", m_bnrCacheDir.c_str(), id));
|
|
|
|
fsop_deleteFile(fmt("%s/%s.bnr", m_customBnrDir.c_str(), id));
|
2013-08-22 20:55:08 +02:00
|
|
|
fsop_deleteFile(fmt("%s/%.3s.bnr", m_bnrCacheDir.c_str(), id));
|
|
|
|
fsop_deleteFile(fmt("%s/%.3s.bnr", m_customBnrDir.c_str(), id));
|
2013-06-27 19:14:11 +02:00
|
|
|
_showCoverBanner();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_hideCoverBanner();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMenu::_initCoverBanner()
|
|
|
|
{
|
2013-08-18 18:22:54 +02:00
|
|
|
m_coverbnrBg = _texture("COVERBNR/BG", "texture", theme.bg, false);
|
2013-08-11 23:44:29 +02:00
|
|
|
_addUserLabels(m_coverbnrLblUser, ARRAY_SIZE(m_coverbnrLblUser), "COVERBNR");
|
2013-08-18 18:22:54 +02:00
|
|
|
m_coverbnrLblTitle = _addTitle("COVERBNR/TITLE", theme.titleFont, L"", 20, 30, 600, 60, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE);
|
|
|
|
m_coverbnrBtnBack = _addButton("COVERBNR/BACK_BTN", theme.btnFont, L"", 420, 400, 200, 56, theme.btnFontColor);
|
2013-08-11 23:44:29 +02:00
|
|
|
|
2013-06-27 19:14:11 +02:00
|
|
|
m_coverbnrLblDlCover = _addLabel("COVERBNR/DLCOVER", theme.lblFont, L"", 40, 130, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
|
|
|
m_coverbnrBtnDlCover = _addButton("COVERBNR/DLCOVER_BTN", theme.btnFont, L"", 370, 130, 230, 56, theme.btnFontColor);
|
|
|
|
m_coverbnrLblDeleteCover = _addLabel("COVERBNR/DELCOVER", theme.lblFont, L"", 40, 190, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
|
|
|
m_coverbnrBtnDeleteCover = _addButton("COVERBNR/DELCOVER_BTN", theme.btnFont, L"", 370, 190, 230, 56, theme.btnFontColor);
|
|
|
|
m_coverbnrLblDlBanner = _addLabel("COVERBNR/DLBNR", theme.lblFont, L"", 40, 250, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
|
|
|
m_coverbnrBtnDlBanner = _addButton("COVERBNR/DLBNR_BTN", theme.btnFont, L"", 370, 250, 230, 56, theme.btnFontColor);
|
|
|
|
m_coverbnrLblDeleteBanner = _addLabel("COVERBNR/DELBNR", theme.lblFont, L"", 40, 310, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
|
|
|
m_coverbnrBtnDeleteBanner = _addButton("COVERBNR/DELBNR_BTN", theme.btnFont, L"", 370, 310, 230, 56, theme.btnFontColor);
|
|
|
|
|
2013-08-18 18:22:54 +02:00
|
|
|
_setHideAnim(m_coverbnrLblTitle, "COVERBNR/TITLE", 0, -200, 0.f, 1.f);
|
|
|
|
_setHideAnim(m_coverbnrBtnBack, "COVERBNR/BACK_BTN", 0, 0, 1.f, -1.f);
|
2013-06-27 19:14:11 +02:00
|
|
|
_setHideAnim(m_coverbnrLblDlCover, "COVERBNR/DLCOVER", 100, 0, -2.f, 0.f);
|
|
|
|
_setHideAnim(m_coverbnrBtnDlCover, "COVERBNR/DLCOVER_BTN", 0, 0, 1.f, -1.f);
|
|
|
|
_setHideAnim(m_coverbnrLblDeleteCover, "COVERBNR/DELCOVER", 100, 0, -2.f, 0.f);
|
|
|
|
_setHideAnim(m_coverbnrBtnDeleteCover, "COVERBNR/DELCOVER_BTN", 0, 0, 1.f, -1.f);
|
|
|
|
_setHideAnim(m_coverbnrLblDlBanner, "COVERBNR/DLBNR", 100, 0, -2.f, 0.f);
|
|
|
|
_setHideAnim(m_coverbnrBtnDlBanner, "COVERBNR/DLBNR_BTN", 0, 0, 1.f, -1.f);
|
|
|
|
_setHideAnim(m_coverbnrLblDeleteBanner, "COVERBNR/DELBNR", 100, 0, -2.f, 0.f);
|
|
|
|
_setHideAnim(m_coverbnrBtnDeleteBanner, "COVERBNR/DELBNR_BTN", 0, 0, 1.f, -1.f);
|
|
|
|
_hideCoverBanner(true);
|
|
|
|
_textCoverBanner();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMenu::_textCoverBanner(void)
|
|
|
|
{
|
2013-08-18 18:22:54 +02:00
|
|
|
m_btnMgr.setText(m_coverbnrLblTitle, _t("cfgg40", L"Manage Cover and Banner"));
|
2013-06-27 19:14:11 +02:00
|
|
|
m_btnMgr.setText(m_coverbnrLblDlCover, _t("cfgbnr1", L"Download Cover"));
|
|
|
|
m_btnMgr.setText(m_coverbnrLblDeleteCover, _t("cfgbnr2", L"Delete Cover"));
|
|
|
|
m_btnMgr.setText(m_coverbnrLblDlBanner, _t("cfgbnr3", L"Download Custom Banner"));
|
|
|
|
m_btnMgr.setText(m_coverbnrLblDeleteBanner, _t("cfgbnr4", L"Delete Banner"));
|
|
|
|
|
|
|
|
m_btnMgr.setText(m_coverbnrBtnDlCover, _t("cfgbnr5", L"Download"));
|
|
|
|
m_btnMgr.setText(m_coverbnrBtnDeleteCover, _t("cfgbnr6", L"Delete"));
|
|
|
|
m_btnMgr.setText(m_coverbnrBtnDlBanner, _t("cfgbnr5", L"Download"));
|
|
|
|
m_btnMgr.setText(m_coverbnrBtnDeleteBanner, _t("cfgbnr6", L"Delete"));
|
2013-08-18 18:22:54 +02:00
|
|
|
m_btnMgr.setText(m_coverbnrBtnBack, _t("cfg10", L"Back"));
|
2013-06-27 19:14:11 +02:00
|
|
|
}
|