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
47 class CSharedFilesWnd
;
52 class PrefsUnifiedDlg
;
62 #define MP_RESTORE 4001
63 #define MP_CONNECT 4002
64 #define MP_DISCONNECT 4003
68 #define DEFAULT_SIZE_X 800
69 #define DEFAULT_SIZE_Y 600
73 Client_Green_Smiley
= 0,
78 Client_ExtendedProtocol_Smiley
,
79 Client_SecIdent_Smiley
,
81 Client_CreditsGrey_Smiley
,
82 Client_CreditsYellow_Smiley
,
86 Client_mlDonkey_Smiley
,
87 Client_eDonkeyHybrid_Smiley
,
90 Client_Shareaza_Smiley
,
93 Client_InvalidRating_Smiley
,
94 Client_PoorRating_Smiley
,
95 Client_FairRating_Smiley
,
96 Client_GoodRating_Smiley
,
97 Client_ExcellentRating_Smiley
,
98 Client_CommentOnly_Smiley
,
99 Client_Encryption_Smiley
,
105 // CamuleDlg Dialogfeld
106 class CamuleDlg
: public wxFrame
110 wxWindow
*pParent
= NULL
,
111 const wxString
&title
= wxEmptyString
,
112 wxPoint where
= wxDefaultPosition
,
113 wxSize dlg_size
= wxSize(DEFAULT_SIZE_X
,DEFAULT_SIZE_Y
));
116 void AddLogLine(const wxString
& line
);
117 void AddServerMessageLine(wxString
& message
);
118 void ResetLog(int id
);
120 void ShowUserCount(const wxString
& info
= wxEmptyString
);
121 void ShowConnectionState(bool skinChanged
= false);
122 void ShowTransferRate();
124 bool StatisticsWindowActive()
125 { return (m_activewnd
== (wxWindow
*)m_statisticswnd
); }
127 /* Returns the active dialog. Needed to check what to redraw. */
135 DT_KAD_WND
// this one is still unused
137 DialogType
GetActiveDialog()
138 { return m_nActiveDialog
; }
139 void SetActiveDialog(DialogType type
, wxWindow
* dlg
);
142 * Helper function for deciding if a certian dlg is visible.
144 * @return True if the dialog is visible to the user, false otherwise.
146 bool IsDialogVisible( DialogType dlg
)
148 return m_nActiveDialog
== dlg
&& m_is_safe_state
/* && !IsIconized() */;
151 void ShowED2KLinksHandler( bool show
);
154 void OnClose(wxCloseEvent
& evt
);
155 void OnBnConnect(wxCommandEvent
& evt
);
157 void DoIconize(bool iconize
);
159 bool SafeState() { return m_is_safe_state
; }
161 void LaunchUrl(const wxString
&url
);
163 //! These are the currently known web-search providers
167 // websearch function
168 wxString
GenWebSearchUrl( const wxString
&filename
, WebSearch provider
);
170 void CreateSystray();
171 void RemoveSystray();
173 void StartGuiTimer() { gui_timer
->Start(100); }
174 void StopGuiTimer() { gui_timer
->Stop(); }
177 * This function ensures that _all_ list widgets are properly sorted.
181 void SetMessageBlink(bool state
) { m_BlinkMessages
= state
; }
182 void Create_Toolbar(bool orientation
);
184 void DoNetworkRearrange();
186 CIP2Country
* m_IP2Country
;
187 void IP2CountryDownloadFinished(uint32 result
);
188 void EnableIP2Country();
190 wxWindow
* m_activewnd
;
191 CTransferWnd
* m_transferwnd
;
192 CServerWnd
* m_serverwnd
;
193 CSharedFilesWnd
* m_sharedfileswnd
;
194 CSearchDlg
* m_searchwnd
;
196 CStatisticsDlg
* m_statisticswnd
;
197 CKadDlg
* m_kademliawnd
;
198 //! Pointer to the current preference dialog, if any.
199 PrefsUnifiedDlg
* m_prefsDialog
;
203 wxImageList m_imagelist
;
204 wxImageList m_tblist
;
207 void OnToolBarButton(wxCommandEvent
& ev
);
208 void OnAboutButton(wxCommandEvent
& ev
);
209 void OnPrefButton(wxCommandEvent
& ev
);
210 void OnImportButton(wxCommandEvent
& ev
);
211 void OnMinimize(wxIconizeEvent
& evt
);
212 void OnBnClickedFast(wxCommandEvent
& evt
);
213 void OnGUITimer(wxTimerEvent
& evt
);
214 void OnMainGUISizeChange(wxSizeEvent
& evt
);
215 void OnExit(wxCommandEvent
& evt
);
218 //! Specifies if the prefs-dialog was shown before minimizing.
220 wxToolBar
*m_wndToolbar
;
222 CMuleTrayIcon
*m_wndTaskbarNotifier
;
223 DialogType m_nActiveDialog
;
224 bool m_is_safe_state
;
225 bool m_BlinkMessages
;
226 int m_CurrentBlinkBitmap
;
227 uint32 m_last_iconizing
;
228 wxFileName m_skinFileName
;
229 std::vector
<wxString
> m_clientSkinNames
;
230 bool m_GeoIPavailable
;
232 WX_DECLARE_STRING_HASH_MAP(wxZipEntry
*, ZipCatalog
);
233 ZipCatalog::iterator it
;
237 PageType m_logpages
[4];
238 PageType m_networkpages
[2];
240 bool LoadGUIPrefs(bool override_pos
, bool override_size
);
243 void UpdateTrayIcon(int percent
);
245 void Apply_Clients_Skin();
246 void Apply_Toolbar_Skin(wxToolBar
*wndToolbar
);
247 bool Check_and_Init_Skin();
248 void Add_Skin_Icon(const wxString
&iconName
, const wxBitmap
&stdIcon
, bool useSkins
);
249 void ToogleED2KLinksHandler();
250 void SetMessagesTool();
251 void OnKeyPressed(wxKeyEvent
& evt
);
253 DECLARE_EVENT_TABLE()
258 // File_checked_for_headers