diff --git a/Tox_GUI.sln b/Tox_GUI.sln new file mode 100644 index 00000000..51ef00c6 --- /dev/null +++ b/Tox_GUI.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tox_GUI", "Tox_GUI\Tox_GUI.vcxproj", "{0A768946-CC65-422E-8F77-47A82452F980}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0A768946-CC65-422E-8F77-47A82452F980}.Debug|Win32.ActiveCfg = Debug|Win32 + {0A768946-CC65-422E-8F77-47A82452F980}.Debug|Win32.Build.0 = Debug|Win32 + {0A768946-CC65-422E-8F77-47A82452F980}.Release|Win32.ActiveCfg = Release|Win32 + {0A768946-CC65-422E-8F77-47A82452F980}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Tox_GUI.v11.suo b/Tox_GUI.v11.suo new file mode 100644 index 00000000..be722f47 Binary files /dev/null and b/Tox_GUI.v11.suo differ diff --git a/Tox_GUI/Tox_GUI.vcxproj b/Tox_GUI/Tox_GUI.vcxproj new file mode 100644 index 00000000..5941230a --- /dev/null +++ b/Tox_GUI/Tox_GUI.vcxproj @@ -0,0 +1,94 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {0A768946-CC65-422E-8F77-47A82452F980} + Win32Proj + Tox_GUI + + + + Application + true + v110 + Unicode + + + Application + false + v110 + true + Unicode + + + + + + + + + + + + + true + H:\PC\Libraries\wxWidgets-2.9.4\include;H:\PC\Libraries\wxWidgets-2.9.4\include\msvc\wx;$(IncludePath) + H:\PC\Libraries\wxWidgets-2.9.4\lib;H:\PC\Libraries\wxWidgets-2.9.4\lib\vc_lib;$(LibraryPath) + H:\PC\Libraries\wxWidgets-2.9.4\src;$(SourcePath) + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + + + Windows + true + wxmsw29ud_core.lib;wxbase29ud.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;wxregexud.lib;wxexpatd.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;wsock32.lib;wininet.lib;%(AdditionalDependencies) + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + + + Windows + true + true + true + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tox_GUI/Tox_GUI.vcxproj.filters b/Tox_GUI/Tox_GUI.vcxproj.filters new file mode 100644 index 00000000..ac77112e --- /dev/null +++ b/Tox_GUI/Tox_GUI.vcxproj.filters @@ -0,0 +1,28 @@ + + + + + {0ed343d6-25f7-4c1f-bc25-dbfc0daf81a6} + + + {7095580a-1c7e-48ef-921c-e0ec00efec1c} + + + + + home + + + core + + + + + + home + + + core + + + \ No newline at end of file diff --git a/Tox_GUI/Tox_GUI.vcxproj.user b/Tox_GUI/Tox_GUI.vcxproj.user new file mode 100644 index 00000000..a375ae35 --- /dev/null +++ b/Tox_GUI/Tox_GUI.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Tox_GUI/gui/Main.cpp b/Tox_GUI/gui/Main.cpp new file mode 100644 index 00000000..42feecfa --- /dev/null +++ b/Tox_GUI/gui/Main.cpp @@ -0,0 +1,33 @@ +#include +#include "home\Home.h" + +class Tox : public wxApp +{ + public: + virtual bool OnInit(); +}; + + + +bool Tox::OnInit() +{ + Home *home = new Home(wxT("Tox")); + home->Show(true); + + return true; +} + +int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE prevInstance, LPWSTR lpCmdLine, int nShowCmd) +{ + char *buf; + + buf = new char[wcslen(lpCmdLine) + 1]; + + wcstombs(buf, lpCmdLine, wcslen(lpCmdLine) +1); + + wxApp::SetInstance( new Tox()); + + wxEntry(hInstance, prevInstance, buf, nShowCmd); + + wxEntryCleanup(); +} \ No newline at end of file diff --git a/Tox_GUI/gui/home/Home.cpp b/Tox_GUI/gui/home/Home.cpp new file mode 100644 index 00000000..f30f8af3 --- /dev/null +++ b/Tox_GUI/gui/home/Home.cpp @@ -0,0 +1,28 @@ +#include +#include "Home.h" + +Home::Home(const wxString& title) + : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(750, 450)) +{ + wxPanel * panel = new wxPanel(this, -1); + + wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL); + + netlogList = new wxListBox(panel, ID_LISTBOX, + wxPoint(-1, -1), wxSize(-1, -1)); + + hbox->Add(netlogList, 3, wxEXPAND | wxALL, 20); + + panel->SetSizer(hbox); + + Centre(); + + netlogList->Append("Testing..."); +} + +void Home::AddNew(wxCommandEvent& event) +{ + wxString str = wxGetTextFromUser(wxT("Add new item")); + if (str.Len() > 0) + netlogList->Append(str); +} \ No newline at end of file diff --git a/Tox_GUI/gui/home/Home.h b/Tox_GUI/gui/home/Home.h new file mode 100644 index 00000000..a3832136 --- /dev/null +++ b/Tox_GUI/gui/home/Home.h @@ -0,0 +1,13 @@ +#include + +class Home : public wxFrame +{ +public: + Home(const wxString& title); + + void AddNew(wxCommandEvent& event); + + wxListBox *netlogList; +}; + +const int ID_LISTBOX = 1; \ No newline at end of file diff --git a/core/DHT.c b/core/DHT.c index 1b82b860..c6ea6a22 100644 --- a/core/DHT.c +++ b/core/DHT.c @@ -16,10 +16,10 @@ int ping(IP_Port ip_port) char data[37]; data[0] = 00; memcpy(data + 5, self_client_id, 32); - ADDR addr = {.family = AF_INET, .ip = ip_port.ip, .port = ip_port.port}; +//ADDR addr = {.family = AF_INET, .ip = ip_port.ip, .port = ip_port.port}; - return sendto(sock, data, sizeof(data) - 1, 0, (struct sockaddr *)&addr, addrlen); - //sendto(int socket_descriptor, char *buffer, int buffer_length, int flags, struct sockaddr *destination_address, int address_length); +//return sendto(sock, data, sizeof(data) - 1, 0, (struct sockaddr *)&addr, addrlen); + //sendto(int socket_descriptor, char *buffer, int buffer_length, int flags, struct sockaddr *destination_address, int address_length); } @@ -36,7 +36,7 @@ void addfriend(char * client_id) -char delfriend(char * client_id); +char delfriend(char * client_id) { @@ -60,8 +60,7 @@ IP_Port getfriendip(char * client_id) void DHT_recvpacket(char * packet, uint32_t length) { - - + } @@ -83,4 +82,5 @@ void bootstrap(IP_Port ip_port) -} \ No newline at end of file +} + diff --git a/core/DHT.h b/core/DHT.h index f1d2e5ae..f0ccd184 100644 --- a/core/DHT.h +++ b/core/DHT.h @@ -4,13 +4,10 @@ #include #include -#ifdef WIN32 +#ifdef WIN32 //Put win32 includes here - -//Put win32 includes here -#include #include - +#include #else //Linux includes @@ -116,4 +113,6 @@ uint16_t num_friends; //TODO: make this more efficient looping up to 128 times is a bit... Pinged pings[128]; -Pinged send_nodes[64]; \ No newline at end of file +Pinged send_nodes[64]; + +