2 // This file is part of the aMule Project.
4 // Copyright (c) 2003-2011 aMule Team ( admin@amule.org / http://www.amule.org )
5 // Copyright (c) 2002-2011 Merkur ( devs@emule-project.net / http://www.emule-project.net )
7 // Any parts of this program derived from the xMule, lMule or eMule project,
8 // or contributed by third-party developers are copyrighted by their
11 // This program is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation; either version 2 of the License, or
14 // (at your option) any later version.
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
21 // You should have received a copy of the GNU General Public License
22 // along with this program; if not, write to the Free Software
23 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
30 #include <wx/archive.h>
31 #include <wx/filename.h>
32 #include <wx/frame.h> // Needed for wxFrame
33 #include <wx/imaglist.h>
35 #include <wx/wfstream.h>
36 #include <wx/zipstrm.h>
38 #include "Types.h" // Needed for uint32
39 #include "StatisticsDlg.h"
47 class CSharedFilesWnd
;
51 class PrefsUnifiedDlg
;
61 #define MP_RESTORE 4001
62 #define MP_CONNECT 4002
63 #define MP_DISCONNECT 4003
67 #define DEFAULT_SIZE_X 800
68 #define DEFAULT_SIZE_Y 600
72 Client_Green_Smiley
= 0,
77 Client_ExtendedProtocol_Smiley
,
78 Client_SecIdent_Smiley
,
80 Client_CreditsGrey_Smiley
,
81 Client_CreditsYellow_Smiley
,
85 Client_mlDonkey_Smiley
,
86 Client_eDonkeyHybrid_Smiley
,
89 Client_Shareaza_Smiley
,
92 Client_InvalidRating_Smiley
,
93 Client_PoorRating_Smiley
,
94 Client_FairRating_Smiley
,
95 Client_GoodRating_Smiley
,
96 Client_ExcellentRating_Smiley
,
97 Client_CommentOnly_Smiley
,
98 Client_Encryption_Smiley
,
104 // CamuleDlg Dialogfeld
105 class CamuleDlg
: public wxFrame
109 wxWindow
*pParent
= NULL
,
110 const wxString
&title
= wxEmptyString
,
111 wxPoint where
= wxDefaultPosition
,
112 wxSize dlg_size
= wxSize(DEFAULT_SIZE_X
,DEFAULT_SIZE_Y
));
115 void AddLogLine(const wxString
& line
);
116 void AddServerMessageLine(wxString
& message
);
117 void ResetLog(int id
);
119 void ShowUserCount(const wxString
& info
= wxEmptyString
);
120 void ShowConnectionState(bool skinChanged
= false);
121 void ShowTransferRate();
123 bool StatisticsWindowActive()
124 { return (m_activewnd
== static_cast<wxWindow
*>(m_statisticswnd
)); }
126 /* Returns the active dialog. Needed to check what to redraw. */
134 DT_KAD_WND
// this one is still unused
136 DialogType
GetActiveDialog()
137 { return m_nActiveDialog
; }
138 void SetActiveDialog(DialogType type
, wxWindow
* dlg
);
141 * Helper function for deciding if a certian dlg is visible.
143 * @return True if the dialog is visible to the user, false otherwise.
145 bool IsDialogVisible( DialogType dlg
)
147 return m_nActiveDialog
== dlg
&& m_is_safe_state
/* && !IsIconized() */;
150 void ShowED2KLinksHandler( bool show
);
153 void OnClose(wxCloseEvent
& evt
);
154 void OnBnConnect(wxCommandEvent
& evt
);
156 void DoIconize(bool iconize
);
158 bool SafeState() { return m_is_safe_state
; }
160 void LaunchUrl(const wxString
&url
);
162 void CreateSystray();
163 void RemoveSystray();
165 void StartGuiTimer() { gui_timer
->Start(100); }
166 void StopGuiTimer() { gui_timer
->Stop(); }
169 * This function ensures that _all_ list widgets are properly sorted.
173 void SetMessageBlink(bool state
) { m_BlinkMessages
= state
; }
174 void Create_Toolbar(bool orientation
);
176 void DoNetworkRearrange();
178 CIP2Country
* m_IP2Country
;
179 void IP2CountryDownloadFinished(uint32 result
);
180 void EnableIP2Country();
182 wxWindow
* m_activewnd
;
183 CTransferWnd
* m_transferwnd
;
184 CServerWnd
* m_serverwnd
;
185 CSharedFilesWnd
* m_sharedfileswnd
;
186 CSearchDlg
* m_searchwnd
;
188 CStatisticsDlg
* m_statisticswnd
;
189 CKadDlg
* m_kademliawnd
;
190 //! Pointer to the current preference dialog, if any.
191 PrefsUnifiedDlg
* m_prefsDialog
;
195 wxImageList m_imagelist
;
196 wxImageList m_tblist
;
199 void OnToolBarButton(wxCommandEvent
& ev
);
200 void OnAboutButton(wxCommandEvent
& ev
);
201 void OnPrefButton(wxCommandEvent
& ev
);
202 void OnImportButton(wxCommandEvent
& ev
);
203 void OnMinimize(wxIconizeEvent
& evt
);
204 void OnBnClickedFast(wxCommandEvent
& evt
);
205 void OnGUITimer(wxTimerEvent
& evt
);
206 void OnMainGUISizeChange(wxSizeEvent
& evt
);
207 void OnExit(wxCommandEvent
& evt
);
210 //! Specifies if the prefs-dialog was shown before minimizing.
212 wxToolBar
*m_wndToolbar
;
214 CMuleTrayIcon
*m_wndTaskbarNotifier
;
215 DialogType m_nActiveDialog
;
216 bool m_is_safe_state
;
217 bool m_BlinkMessages
;
218 int m_CurrentBlinkBitmap
;
219 uint32 m_last_iconizing
;
220 wxFileName m_skinFileName
;
221 std::vector
<wxString
> m_clientSkinNames
;
222 bool m_GeoIPavailable
;
224 WX_DECLARE_STRING_HASH_MAP(wxZipEntry
*, ZipCatalog
);
227 PageType m_logpages
[4];
228 PageType m_networkpages
[2];
230 bool LoadGUIPrefs(bool override_pos
, bool override_size
);
233 void UpdateTrayIcon(int percent
);
235 void Apply_Clients_Skin();
236 void Apply_Toolbar_Skin(wxToolBar
*wndToolbar
);
237 bool Check_and_Init_Skin();
238 void Add_Skin_Icon(const wxString
&iconName
, const wxBitmap
&stdIcon
, bool useSkins
);
239 void ToogleED2KLinksHandler();
240 void SetMessagesTool();
241 void OnKeyPressed(wxKeyEvent
& evt
);
243 DECLARE_EVENT_TABLE()
248 // File_checked_for_headers