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 //! These are the currently known web-search providers
166 // websearch function
167 wxString
GenWebSearchUrl( const wxString
&filename
, WebSearch provider
);
169 void CreateSystray();
170 void RemoveSystray();
172 void StartGuiTimer() { gui_timer
->Start(100); }
173 void StopGuiTimer() { gui_timer
->Stop(); }
176 * This function ensures that _all_ list widgets are properly sorted.
180 void SetMessageBlink(bool state
) { m_BlinkMessages
= state
; }
181 void Create_Toolbar(bool orientation
);
183 void DoNetworkRearrange();
185 CIP2Country
* m_IP2Country
;
186 void IP2CountryDownloadFinished(uint32 result
);
187 void EnableIP2Country();
189 wxWindow
* m_activewnd
;
190 CTransferWnd
* m_transferwnd
;
191 CServerWnd
* m_serverwnd
;
192 CSharedFilesWnd
* m_sharedfileswnd
;
193 CSearchDlg
* m_searchwnd
;
195 CStatisticsDlg
* m_statisticswnd
;
196 CKadDlg
* m_kademliawnd
;
197 //! Pointer to the current preference dialog, if any.
198 PrefsUnifiedDlg
* m_prefsDialog
;
202 wxImageList m_imagelist
;
203 wxImageList m_tblist
;
206 void OnToolBarButton(wxCommandEvent
& ev
);
207 void OnAboutButton(wxCommandEvent
& ev
);
208 void OnPrefButton(wxCommandEvent
& ev
);
209 void OnImportButton(wxCommandEvent
& ev
);
210 void OnMinimize(wxIconizeEvent
& evt
);
211 void OnBnClickedFast(wxCommandEvent
& evt
);
212 void OnGUITimer(wxTimerEvent
& evt
);
213 void OnMainGUISizeChange(wxSizeEvent
& evt
);
214 void OnExit(wxCommandEvent
& evt
);
217 //! Specifies if the prefs-dialog was shown before minimizing.
219 wxToolBar
*m_wndToolbar
;
221 CMuleTrayIcon
*m_wndTaskbarNotifier
;
222 DialogType m_nActiveDialog
;
223 bool m_is_safe_state
;
224 bool m_BlinkMessages
;
225 int m_CurrentBlinkBitmap
;
226 uint32 m_last_iconizing
;
227 wxFileName m_skinFileName
;
228 std::vector
<wxString
> m_clientSkinNames
;
229 bool m_GeoIPavailable
;
231 WX_DECLARE_STRING_HASH_MAP(wxZipEntry
*, ZipCatalog
);
234 PageType m_logpages
[4];
235 PageType m_networkpages
[2];
237 bool LoadGUIPrefs(bool override_pos
, bool override_size
);
240 void UpdateTrayIcon(int percent
);
242 void Apply_Clients_Skin();
243 void Apply_Toolbar_Skin(wxToolBar
*wndToolbar
);
244 bool Check_and_Init_Skin();
245 void Add_Skin_Icon(const wxString
&iconName
, const wxBitmap
&stdIcon
, bool useSkins
);
246 void ToogleED2KLinksHandler();
247 void SetMessagesTool();
248 void OnKeyPressed(wxKeyEvent
& evt
);
250 DECLARE_EVENT_TABLE()
255 // File_checked_for_headers