source: svn/branches/kctv/zasc/app/DST_WinFactoryReset.cpp @ 76

Last change on this file since 76 was 2, checked in by phkim, 11 years ago

1.phkim

  1. revision copy newcon3sk r27
File size: 5.1 KB
Line 
1#include "DST_WinManager.h"
2#include "DST_DataStrings.h"
3#include "DST_OSDImage.h"
4#include "DST_EEPROM.h"
5#include "DST_ChannelTune.h"
6#include "DST_UserInterface.h"
7#include "DST_DB.h"
8
9
10#if 0
11____CMessageWin___()
12#endif
13
14
15class CFactoryResetWin : public CWindow
16{
17private:
18        DS_U8 winParentID;
19        DS_U8 msg;
20public:
21        CFactoryResetWin(SWinEventMsg event):CWindow(event)
22        {
23                rect.w = DST_GetImageWidth(newcon2_gui_banner_yesno_back);
24                rect.h = DST_GetImageHeight(newcon2_gui_banner_yesno_back);
25                rect.x = (DST_GetScreenWidth() - rect.w) / 2;
26                rect.y = (DST_GetScreenHeight()- rect.h) / 2;
27                RegisterAllKey();
28                SetTimeOut(0);
29
30                winParentID = event.data[1];
31                msg = event.data[2];
32                DST_Printf("winParentID : %d , msg : %d\n",winParentID,msg);
33                DST_EEPROM_SetNeedReset(1);
34                DST_DB_Sync();
35
36        }
37        ~CFactoryResetWin()
38        {
39                DST_Reset(__func__); // âÀÌ ´ÝÈ÷¸é¼­ ÀçºÎÆÃ
40        }
41        virtual void OnTimer(char)
42        {
43                Show();
44        }
45
46        virtual void OnMessage(SWinEventMsg event)
47        {
48                switch (event.cmd)
49                {
50                        case WM_POWER_OFF:
51                                Close();
52                                break;
53                }
54        }
55       
56        virtual void Show(void)
57        {
58                DrawImage(0, 0, newcon2_gui_banner_yesno_back);
59                setFontStyle(24,0xFFC8C8C8,ALIGN_MIDDLE,ALIGN_CENTER);
60
61                if (DST_DB_IsSync())
62                {
63                        KillTimer(1);
64                        SetTimeOut(1); // ½ÌÅ©°¡ ³¡³ª¸é ŸÀӾƿôÀ» 1ÃÊ·Î º¯°æ
65                        DrawTextUni(0, 0, rect.w, rect.h, pz_sysreset[OSD_Lang], &font);
66                }
67                else
68                {
69                        DrawTextUni(0, 0, rect.w, rect.h, pz_plz_wait[OSD_Lang], &font);
70                        SetTimer(1, 1000);
71                }
72                UpdateScreen();
73        }
74};
75
76
77class CFactoryResetAskWin : public CWindow
78{
79private:
80
81        DS_U16 g_nPos;
82        DS_U16 g_nTop;
83        DS_U16 select;
84        DS_U16 itemNum;
85        bool bExitKeyPressed;
86        bool bVolumeKeyPressed;
87        DS_U8 winParentID;
88        DS_U8 msg;
89public:
90        CFactoryResetAskWin(SWinEventMsg event):CWindow(event)
91        {
92                setSize();
93                bExitKeyPressed = false;
94                bVolumeKeyPressed = false;
95                g_nTop = 0;
96                g_nPos = 0;
97                select = 1;
98                itemNum = 2;
99
100                winParentID = event.data[1];
101                msg = event.data[2];
102                SetTimeOut(30);
103        }
104
105        virtual void OnMessage(SWinEventMsg event)
106        {
107                switch (event.cmd)
108                {
109                        case WM_POWER_OFF:
110                                Close();
111                                break;
112                }
113        }
114       
115        void setSize(void)
116        {
117                rect.w = DST_GetImageWidth(newcon2_gui_banner_yesno_back);
118                rect.h = DST_GetImageHeight(newcon2_gui_banner_yesno_back);
119                rect.x = (DST_GetScreenWidth() - rect.w)/2;
120                rect.y = (DST_GetScreenHeight() - rect.h)/2;
121        }
122
123        virtual void Focus(bool bVal)
124        {
125                RegisterKey(VK_CANCEL, bVal);
126                RegisterKey(VK_MENU, bVal);
127                RegisterKey(VK_OK, bVal);
128                RegisterKey(VK_RIGHT, bVal);
129                RegisterKey(VK_LEFT, bVal);
130                RegisterKey(VK_UP, bVal);
131                RegisterKey(VK_DN, bVal);
132                RegisterKey(VK_PREV, bVal);
133                RegisterKey(VK_PREV_MENU, true);
134        }
135       
136
137        virtual void Show(WinID id)
138        {
139                switch(id)
140                {
141                        case WIN_VOLUME:
142                        case WIN_VOLUME_MUTE:
143                                bVolumeKeyPressed = true;
144                                Close();
145                                break;
146                        default:
147                                break;
148                }
149        }
150               
151
152        virtual void Show(void)
153        {
154                Draw();
155                DoFocus(true);
156        }
157
158        DS_U16* GetString(int index)
159        {
160                switch(index)
161                {
162                        case 0: return pz_Yes[OSD_Lang];
163                        case 1: return pz_No[OSD_Lang];
164                        default: break;
165                }
166                return 0;
167        }
168       
169        void Draw(void)
170        {
171                DrawImage(0,0,newcon2_gui_banner_yesno_back,true);
172                setFontStyle(24,0xFFC8C8C8,ALIGN_MIDDLE,ALIGN_CENTER);
173                int center_pos =  DST_GetImageHeight(newcon2_gui_banner_yesno_back) / 2; 
174                int line_spacing = DST_GetFontHeight(font.GetSize()) * 125 / 100;
175
176                DrawTextUni(0,  center_pos-line_spacing/2-line_spacing, rect.w, line_spacing, pz_Sub_FactoryResetAsk_E1[OSD_Lang],  &font);
177                DrawTextUni(0,  center_pos-line_spacing/2, rect.w, line_spacing, pz_Sub_FactoryResetAsk_E2[OSD_Lang],  &font);
178               
179                DrawImage(65, 141, newcon2_gui_depth3_button_small_selected, true);
180                DrawImage(185, 141, newcon2_gui_depth3_button_small_selected, true);
181                if(select == 0)
182                        DrawImage(65, 141, newcon2_gui_depth3_button_small_cursor, true);
183                else
184                        DrawImage(185, 141, newcon2_gui_depth3_button_small_cursor, true);
185               
186                for(int i=0;i<itemNum;i++)
187                {
188#if DESIGN_TYPE == 1
189#else
190                        if(select==i)
191                                setFontStyle(24,0xFF000000,ALIGN_MIDDLE,ALIGN_CENTER);
192                        else
193                                setFontStyle(24,0xFFC8C8C8,ALIGN_MIDDLE,ALIGN_CENTER);
194#endif
195                        DrawTextUni(65+i*120, 141, DST_GetImageWidth(newcon2_gui_depth3_button_small_selected),  DST_GetImageHeight(newcon2_gui_depth3_button_small_selected), GetString(i),    &font);
196                }
197        }
198       
199        virtual void KeyInput(DS_U8 key, bool /*bRepeat*/)
200        {
201                switch (key)
202                {
203                        case VK_RIGHT:
204                        case VK_LEFT:
205                                if(key == VK_RIGHT)
206                                        ItemIncrease(itemNum, 2, &g_nTop, &select, &g_nPos);
207                                else
208                                        ItemDecrease(itemNum, 2, &g_nTop, &select, &g_nPos);
209                                Draw();
210                                break;
211                        case VK_OK: 
212                                if(select == 0)
213                                {
214//                                      DST_RemoveAllWindowExceptBasicWin();
215                                        DST_CreateWin(WIN_FACTORY_RESET, (WinID)winParentID, msg);
216                                }
217                                else
218                                {
219                                        DST_CreateWin((WinID)winParentID);
220                                }
221                                Close();
222                                break;
223                        case VK_MENU:
224                        case VK_CANCEL:
225                        case VK_PREV:
226                        case VK_PREV_MENU:
227                                DST_CreateWin((WinID)winParentID);
228                                Close();
229                                break;
230                        default:
231                                break;
232                }
233        }
234
235};
236
237void DST_CreateFactoryResetWin(SWinEventMsg event)
238{
239        DST_AddWin((WinID)(event.data[0]), new CFactoryResetWin(event));
240}
241
242void DST_CreateFactoryResetAskWin(SWinEventMsg event)
243{
244        DST_AddWin((WinID)(event.data[0]), new CFactoryResetAskWin(event));
245}
Note: See TracBrowser for help on using the repository browser.