Update Wiki URL
[amule.git] / src / amuleDlg.h
blob6d82d3643588c4d94ff7ca9e8687bc83fe585ade
1 //
2 // This file is part of the aMule Project.
3 //
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 )
6 //
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
9 // respective authors.
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
26 #ifndef AMULEDLG_H
27 #define AMULEDLG_H
30 #include <wx/archive.h>
31 #include <wx/filename.h>
32 #include <wx/frame.h> // Needed for wxFrame
33 #include <wx/imaglist.h>
34 #include <wx/timer.h>
35 #include <wx/wfstream.h>
36 #include <wx/zipstrm.h>
38 #include "Types.h" // Needed for uint32
39 #include "StatisticsDlg.h"
41 class wxTimerEvent;
42 class wxTextCtrl;
44 class CIP2Country;
45 class CTransferWnd;
46 class CServerWnd;
47 class CSharedFilesWnd;
48 class CSearchDlg;
49 class CChatWnd;
50 class CKadDlg;
51 class PrefsUnifiedDlg;
54 class CMuleTrayIcon;
56 struct PageType {
57 wxWindow* page;
58 wxString name;
61 #define MP_RESTORE 4001
62 #define MP_CONNECT 4002
63 #define MP_DISCONNECT 4003
64 #define MP_EXIT 4004
67 #define DEFAULT_SIZE_X 800
68 #define DEFAULT_SIZE_Y 600
71 enum ClientSkinEnum {
72 Client_Green_Smiley = 0,
73 Client_Red_Smiley,
74 Client_Yellow_Smiley,
75 Client_Grey_Smiley,
76 Client_White_Smiley,
77 Client_ExtendedProtocol_Smiley,
78 Client_SecIdent_Smiley,
79 Client_BadGuy_Smiley,
80 Client_CreditsGrey_Smiley,
81 Client_CreditsYellow_Smiley,
82 Client_Upload_Smiley,
83 Client_Friend_Smiley,
84 Client_eMule_Smiley,
85 Client_mlDonkey_Smiley,
86 Client_eDonkeyHybrid_Smiley,
87 Client_aMule_Smiley,
88 Client_lphant_Smiley,
89 Client_Shareaza_Smiley,
90 Client_xMule_Smiley,
91 Client_Unknown,
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,
99 // Add items here.
100 CLIENT_SKIN_SIZE
104 // CamuleDlg Dialogfeld
105 class CamuleDlg : public wxFrame
107 public:
108 CamuleDlg(
109 wxWindow *pParent = NULL,
110 const wxString &title = wxEmptyString,
111 wxPoint where = wxDefaultPosition,
112 wxSize dlg_size = wxSize(DEFAULT_SIZE_X,DEFAULT_SIZE_Y));
113 ~CamuleDlg();
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. */
127 enum DialogType {
128 DT_TRANSFER_WND,
129 DT_NETWORKS_WND,
130 DT_SEARCH_WND,
131 DT_SHARED_WND,
132 DT_CHAT_WND,
133 DT_STATS_WND,
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 );
152 void DlgShutDown();
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
163 enum WebSearch {
164 WS_FILEHASH
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.
178 void InitSort();
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;
194 CChatWnd* m_chatwnd;
195 CStatisticsDlg* m_statisticswnd;
196 CKadDlg* m_kademliawnd;
197 //! Pointer to the current preference dialog, if any.
198 PrefsUnifiedDlg* m_prefsDialog;
200 int m_srv_split_pos;
202 wxImageList m_imagelist;
203 wxImageList m_tblist;
205 protected:
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);
216 private:
217 //! Specifies if the prefs-dialog was shown before minimizing.
218 bool m_prefsVisible;
219 wxToolBar *m_wndToolbar;
220 wxTimer *gui_timer;
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);
232 ZipCatalog::iterator it;
233 wxZipEntry *entry;
234 ZipCatalog cat;
236 PageType m_logpages[4];
237 PageType m_networkpages[2];
239 bool LoadGUIPrefs(bool override_pos, bool override_size);
240 bool SaveGUIPrefs();
242 void UpdateTrayIcon(int percent);
244 void Apply_Clients_Skin();
245 void Apply_Toolbar_Skin(wxToolBar *wndToolbar);
246 bool Check_and_Init_Skin();
247 void Add_Skin_Icon(const wxString &iconName, const wxBitmap &stdIcon, bool useSkins);
248 void ToogleED2KLinksHandler();
249 void SetMessagesTool();
250 void OnKeyPressed(wxKeyEvent& evt);
252 DECLARE_EVENT_TABLE()
255 #endif
257 // File_checked_for_headers