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 bool SafeState() { return m_is_safe_state
; }
158 void LaunchUrl(const wxString
&url
);
160 void CreateSystray();
161 void RemoveSystray();
163 void StartGuiTimer() { gui_timer
->Start(100); }
164 void StopGuiTimer() { gui_timer
->Stop(); }
167 * This function ensures that _all_ list widgets are properly sorted.
171 void SetMessageBlink(bool state
) { m_BlinkMessages
= state
; }
172 void Create_Toolbar(bool orientation
);
174 void DoNetworkRearrange();
176 CIP2Country
* m_IP2Country
;
177 void IP2CountryDownloadFinished(uint32 result
);
178 void EnableIP2Country();
180 wxWindow
* m_activewnd
;
181 CTransferWnd
* m_transferwnd
;
182 CServerWnd
* m_serverwnd
;
183 CSharedFilesWnd
* m_sharedfileswnd
;
184 CSearchDlg
* m_searchwnd
;
186 CStatisticsDlg
* m_statisticswnd
;
187 CKadDlg
* m_kademliawnd
;
188 //! Pointer to the current preference dialog, if any.
189 PrefsUnifiedDlg
* m_prefsDialog
;
193 wxImageList m_imagelist
;
194 wxImageList m_tblist
;
197 void OnToolBarButton(wxCommandEvent
& ev
);
198 void OnAboutButton(wxCommandEvent
& ev
);
199 void OnPrefButton(wxCommandEvent
& ev
);
200 void OnImportButton(wxCommandEvent
& ev
);
201 void OnMinimize(wxIconizeEvent
& evt
);
202 void OnBnClickedFast(wxCommandEvent
& evt
);
203 void OnGUITimer(wxTimerEvent
& evt
);
204 void OnMainGUISizeChange(wxSizeEvent
& evt
);
205 void OnExit(wxCommandEvent
& evt
);
208 //! Specifies if the prefs-dialog was shown before minimizing.
210 wxToolBar
*m_wndToolbar
;
212 CMuleTrayIcon
*m_wndTaskbarNotifier
;
213 DialogType m_nActiveDialog
;
214 bool m_is_safe_state
;
215 bool m_BlinkMessages
;
216 int m_CurrentBlinkBitmap
;
217 uint32 m_last_iconizing
;
218 wxFileName m_skinFileName
;
219 std::vector
<wxString
> m_clientSkinNames
;
220 bool m_GeoIPavailable
;
222 WX_DECLARE_STRING_HASH_MAP(wxZipEntry
*, ZipCatalog
);
225 PageType m_logpages
[4];
226 PageType m_networkpages
[2];
228 bool LoadGUIPrefs(bool override_pos
, bool override_size
);
231 void UpdateTrayIcon(int percent
);
233 void Apply_Clients_Skin();
234 void Apply_Toolbar_Skin(wxToolBar
*wndToolbar
);
235 bool Check_and_Init_Skin();
236 void Add_Skin_Icon(const wxString
&iconName
, const wxBitmap
&stdIcon
, bool useSkins
);
237 void ToogleED2KLinksHandler();
238 void SetMessagesTool();
239 void OnKeyPressed(wxKeyEvent
& evt
);
241 DECLARE_EVENT_TABLE()
246 // File_checked_for_headers