⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xhc_gui.c

📁 MTK手机QQ游戏开发指南,有详细说明,只收GPRS流量费
💻 C
字号:
#ifdef __XHC_APPLICATION__
#include "XHC_custom.h"
#include "XHC_include.h"
#include "SettingProfile.h"

S8 *XHC_suffix = "P807";
void XHC_gui_show_text(U8* text, U8* guiBuffer)
{
	ShowCategory74Screen(STR_ID_XHC_NOTIFY,  0,	STR_GLOBAL_OK,	IMG_GLOBAL_OK,
			STR_GLOBAL_BACK, IMG_GLOBAL_BACK,
            (PU8)text, XHC_ucs2_strlen((S8*)text) * 2, guiBuffer);
}

void XHC_gui_popup(S8 *string, U16 imageID)
{
    U8 *guiBuffer;
    TurnOnBacklight(TRUE);

    EntryNewScreen((SCR_ID_XHC_POPUP), ExitDisplayPopup, NULL, NULL);
    guiBuffer = GetCurrGuiBuffer((SCR_ID_XHC_POPUP));

#ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
    force_no_small_screen();
#endif

    if (imageID)
    {
        ShowCategory65Screen((U8*)string, imageID, NULL);
    }
    else
    {
        ShowCategory65Screen((U8*)string, IMG_GLOBAL_ACTIVATED, NULL);
    }

    SetGroupKeyHandler(PopupTimerFlagEnable, (PU16) PresentAllKeys, TOTAL_KEYS, KEY_EVENT_DOWN);
    SetGroupKeyHandler(PopupCloseByPressAnyKey, (PU16) PresentAllKeys, TOTAL_KEYS, KEY_EVENT_UP);

    StartTimer(POPUP_TIMER, 3000, PopupTimerOver);
}


void XHC_gui_ExitDisplayPopupConfirm(void)
{
#if defined(__MMI_MAINLCD_176X220__) || defined(__MMI_MAINLCD_240X320__)        /* 041205 Calvin modified */
    leave_full_screen();
#endif 
#ifdef __MMI_WGUI_CSK_ENABLE__    
    ResetCenterSoftkey();
#endif
    stopRequestedTone(WARNING_TONE);
}

void XHC_gui_confirm(S8* message)
{
    U8 *guiBuffer;

    EntryNewScreen(SCR_ID_XHC, XHC_gui_ExitDisplayPopupConfirm, NULL, NULL);
    guiBuffer = GetCurrGuiBuffer((SCR_ID_XHC));


    ShowCategory165Screen(STR_GLOBAL_YES, IMG_GLOBAL_YES, STR_GLOBAL_NO, IMG_GLOBAL_NO,
        (U16*)message, IMG_GLOBAL_QUESTION, guiBuffer);
    playRequestedTone(WARNING_TONE);
}

#define XHC_HTTP_DEBUG
#define XHC_HTTP_DEBUG_FE

#ifdef XHC_HTTP_DEBUG

#define XHC_HTTP_DEBUG_DATA_LEN    (2048)

S8 XHC_http_debug_url[256];
S8 XHC_http_debug_url_asc[128];
S8 XHC_http_debug_send_data[XHC_HTTP_DEBUG_DATA_LEN];
S8 XHC_http_debug_tmp_data[XHC_HTTP_DEBUG_DATA_LEN];
S8 XHC_http_debug_rsp_data[(XHC_HTTP_DEBUG_DATA_LEN * 2)];
S8 XHC_http_debug_reply_file[64];// = (S8*)L"D:\\http_debug";
S32 XHC_http_debug_request_id = -1;
S8 XHC_http_debug_type[16];

#if (defined(XHC_MTK_VERNO_08A) )//08A或08A以后的版本
U32 XHC_input_type_numeric = IMM_INPUT_TYPE_NUMERIC;
U32 XHC_input_type_english = IMM_INPUT_TYPE_ENGLISH_SENTENCE;
U32 XHC_input_type_full = IMM_INPUT_TYPE_SENTENCE;
#else//08A以前的版本
U32 XHC_input_type_numeric = INPUT_TYPE_NUMERIC;
U32 XHC_input_type_english = INPUT_TYPE_USE_ONLY_ENGLISH_MODES;
U32 XHC_input_type_full = INPUT_TYPE_ALPHANUMERIC_SENTENCECASE;
#endif

void XHC_entry_http_debug(void);
void XHC_exit_http_debug(void);
void XHC_http_debug_start(void);
S32 XHC_http_debug_download_finish(void* para, void* result);
void XHC_http_debug_show_rsp(void);
void XHC_http_debug_exit_rsp(void);

void XHC_gui_inline_full_screen_edit_common_function(void)
{
    ChangeLeftSoftkey(STR_GLOBAL_OPTIONS, IMG_GLOBAL_OPTIONS);

    SetLeftSoftkeyFunction(EntryScrForInputMethodAndDone, KEY_EVENT_UP);
}

void XHC_http_debug_exit_rsp(void)
{
    if (XHC_http_debug_request_id >= 0)
    {
        XHC_net_http_free_request_id(XHC_http_debug_request_id);
        XHC_http_debug_request_id = -1;
    }
    GoBackHistory();
}

void XHC_http_debug_show_rsp(void)
{
    U8* guiBuffer = NULL;
    if (GetActiveScreenId() != SCR_ID_XHC2)
    {
        EntryNewScreen(SCR_ID_XHC2, NULL, XHC_http_debug_show_rsp,NULL);
        guiBuffer=GetCurrGuiBuffer(SCR_ID_XHC2);
    }

    XHC_gui_show_text((U8*)XHC_http_debug_rsp_data, guiBuffer);

    SetLeftSoftkeyFunction(XHC_http_debug_exit_rsp,XHC_KEY_EVENT_UP);
    SetRightSoftkeyFunction(XHC_http_debug_exit_rsp,XHC_KEY_EVENT_UP);
}

S32 XHC_http_debug_download_finish(void* para, void* result)
{
	FS_HANDLE fh = 0;
    S32 file_size = 0;
    U32 len = 0;
	U8 data ;
	S16 error;

    XHC_http_debug_request_id = -1;
    XHC_trace("XHC_http_debug_download_finish() para = %d, result = %d", para, result);
    memset(XHC_http_debug_rsp_data, 0, XHC_HTTP_DEBUG_DATA_LEN * 2);
    if ((S32)result < 0)
    {
        XHC_ucs2_sprintf(XHC_http_debug_rsp_data, "Download Fail! result = %d", (S32)result);
        XHC_http_debug_show_rsp();
        return XHC_OK;
    }
    if ( (fh = FS_Open((U16*)XHC_http_debug_reply_file, FS_READ_ONLY)) < 0)
    {
        XHC_ucs2_sprintf(XHC_http_debug_rsp_data, "Open File Fail!");
        XHC_http_debug_show_rsp();
        return XHC_FAIL;
    }
    FS_GetFileSize(fh, (U32*)&file_size);
    if (file_size <= 0 || file_size > XHC_HTTP_DEBUG_DATA_LEN)
    {
        FS_Close(fh);
        XHC_ucs2_sprintf(XHC_http_debug_rsp_data, "File Size Fail! size = %d", file_size);
        XHC_http_debug_show_rsp();
        return XHC_FAIL;
    }
    memset(XHC_http_debug_tmp_data, 0, XHC_HTTP_DEBUG_DATA_LEN);
    if (FS_Read(fh, XHC_http_debug_tmp_data, XHC_HTTP_DEBUG_DATA_LEN, (U32*)&len) < 0)
    {
        FS_Close(fh);
        XHC_ucs2_sprintf(XHC_http_debug_rsp_data, "Read File Fail!");
        XHC_http_debug_show_rsp();
        return XHC_FAIL;
    }
    mmi_chset_utf8_to_ucs2_string((U8*)XHC_http_debug_rsp_data, XHC_HTTP_DEBUG_DATA_LEN * 2,
        (U8*)XHC_http_debug_tmp_data);
    XHC_http_debug_show_rsp();
    return XHC_OK;
}
S8 *XHC_http_debug_host = "liveja.amigo.bjmcc.net";
void XHC_http_debug_start(void)
{
    S8* send_data = XHC_http_debug_tmp_data;
    S32 data_len = 0;
    S32 debug_type = -1;
    
    if (XHC_http_debug_request_id >= 0)
    {
        XHC_net_http_free_request_id(XHC_http_debug_request_id);
        XHC_http_debug_request_id = -1;
    }
    memset(XHC_http_debug_tmp_data, 0, XHC_HTTP_DEBUG_DATA_LEN);
#ifdef XHC_HTTP_DEBUG_FE
    if (XHC_ucs2_strlen(XHC_http_debug_type))
    {
        debug_type = XHC_atoi((U16*)XHC_http_debug_type);
    }
    if (debug_type >= 0 && debug_type < 0xFF)
    {
        send_data += 4;
    }
#endif
    mmi_chset_ucs2_to_utf8_string((U8*)send_data, XHC_HTTP_DEBUG_DATA_LEN - 4,
        (U8*)XHC_http_debug_send_data);
    data_len = strlen(send_data);
#ifdef XHC_HTTP_DEBUG_FE
    if (debug_type >= 0 && debug_type < 0xFF)
    {
        send_data = XHC_http_debug_tmp_data;
        data_len += 4;
        send_data[0] = (data_len & 0xFF0000);
        send_data[1] = (data_len & 0xFF00);
        send_data[2] = (data_len & 0xFF);
        send_data[3] = debug_type;
    }
#endif
    memset(XHC_http_debug_reply_file, 0, 64);
    XHC_ucs2_sprintf(XHC_http_debug_reply_file, "%c:\\http_debug.txt", MMI_PUBLIC_DRV);

    memset(XHC_http_debug_url_asc, 0, 128);
    XHC_ucs2_str_to_asc_str(XHC_http_debug_url_asc, XHC_http_debug_url);
    XHC_http_debug_request_id = XHC_net_http_post_buffer( XHC_http_debug_url_asc, NULL, XHC_http_debug_reply_file, 
        send_data, data_len, XHC_http_debug_download_finish, NULL);

    memset(XHC_http_debug_rsp_data, 0, XHC_HTTP_DEBUG_DATA_LEN);
    XHC_ucs2_strcat(XHC_http_debug_rsp_data, (S8*)L"Download......");
    XHC_http_debug_show_rsp();
}

void XHC_exit_http_debug(void)
{
    U16 inputBufferSize;
    S16 nHistory = 0;
    history h;

    CloseCategory57Screen();
    h.scrnID = SCR_ID_XHC1;
    h.entryFuncPtr = XHC_entry_http_debug;
    XHC_ucs2_strcpy((S8*) h.inputBuffer, (S8*) & nHistory);
    inputBufferSize = 0;//(U16) GetCategory57DataSize();
    GetCategory57History(h.guiBuffer);
    //GetCategory57Data((U8*) h.inputBuffer);
    AddNHistory(h, inputBufferSize);

}

void XHC_entry_http_debug(void)
{
   U8 *guiBuffer = NULL;
    U8 *inputBuffer = NULL;
    U16 inputBufferSize;
    S32 n_items = 0;
    U16 icons[10];

    EntryNewScreen(SCR_ID_XHC1, XHC_exit_http_debug, XHC_entry_http_debug, NULL);
    guiBuffer = GetCurrGuiBuffer(SCR_ID_XHC1);
    inputBuffer = GetCurrNInputBuffer(SCR_ID_XHC1, &inputBufferSize);

    InitializeCategory57Screen();


    memset(icons, 0, sizeof(icons));
    icons[n_items] = IMG_GLOBAL_L1 + n_items / 2;
    SetInlineItemCaption(&wgui_inline_items[n_items++], (PU8)L"URL:");
    if (XHC_ucs2_strlen(XHC_http_debug_url) == 0)
    {
        XHC_ucs2_strcat(XHC_http_debug_url, (S8*)L"http://liveja.amigo.bjmcc.net/transfer.vurl");
    }
    SetInlineItemActivation(&wgui_inline_items[n_items], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
    SetInlineItemTextEdit(
        &wgui_inline_items[n_items],
        (PU8)XHC_http_debug_url,
        128, XHC_input_type_full);
    EnableInlineItemBoundary(&wgui_inline_items[n_items]);
    n_items++;

#ifdef XHC_HTTP_DEBUG_FE
    icons[n_items] = IMG_GLOBAL_L1 + n_items / 2;
    SetInlineItemCaption(&wgui_inline_items[n_items++], (PU8)L"TYPE:");
    SetInlineItemActivation(&wgui_inline_items[n_items], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
    SetInlineItemTextEdit(
        &wgui_inline_items[n_items],
        (PU8)XHC_http_debug_type,
        8, XHC_input_type_numeric);
    n_items++;
#endif

    icons[n_items] = IMG_GLOBAL_L1 + n_items / 2;
    SetInlineItemCaption(&wgui_inline_items[n_items++], (PU8)L"DATA:");
    SetInlineItemActivation(&wgui_inline_items[n_items], KEY_LSK, KEY_EVENT_UP);
    SetInlineItemFullScreenEdit(
        &wgui_inline_items[n_items],
        STR_ID_XHC, 0,
        (PU8)XHC_http_debug_send_data,
        XHC_HTTP_DEBUG_DATA_LEN / 2, XHC_input_type_full);
    SetInlineFullScreenEditCustomFunction(&wgui_inline_items[n_items], XHC_gui_inline_full_screen_edit_common_function);
    n_items++;
    if (inputBuffer != NULL)
    {
        //SetCategory57Data(wgui_inline_items, n_items, inputBuffer);
    }

    ShowCategory57Screen(
        STR_ID_XHC, 0,
        IMG_GLOBAL_OK, 0,
        IMG_GLOBAL_BACK, 0,
        n_items, icons,
        wgui_inline_items,
        0, guiBuffer);
   	SetCategory57RightSoftkeyFunctions(XHC_http_debug_start, GoBackHistory);
   	SetCategory57LeftSoftkeyFunction(XHC_http_debug_start);

    DisableCategory57ScreenDone();
    
    return;    
}
#endif //XHC_HTTP_DEBUG

#endif  //__XHC_APPLICATION__


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -