Merge pull request #31 from F4FXL/NewXLX

Some more XLX improvement
This commit is contained in:
Jonathan Naylor 2019-04-21 16:14:13 +01:00 committed by GitHub
commit cb5a7b601c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 14 deletions

View file

@ -760,7 +760,7 @@ m_y(DEFAULT_WINDOW_Y)
m_config->Read(m_name + KEY_XLX_ENABLED, &m_xlxEnabled, DEFAULT_XLX_ENABLED);
m_config->Read(m_name + KEY_XLX_HOSTS_FILE_URL, &m_xlxHostsFileUrl, DEFAULT_XLX_HOSTS_FILE_URL);
if(m_xlxEnabled && m_xlxHostsFileUrl.IsEmpty())//To avoid support nightmare, fill the url with the default one when xlx is enabled and the url is left empty
if(m_xlxEnabled && m_xlxHostsFileUrl.Trim().IsEmpty())//To avoid support nightmare, fill the url with the default one when xlx is enabled and the url is left empty
m_xlxHostsFileUrl = DEFAULT_XLX_HOSTS_FILE_URL;
m_config->Read(m_name + KEY_STARNET_BAND1, &m_starNet1Band, DEFAULT_STARNET_BAND);
@ -1434,7 +1434,7 @@ m_y(DEFAULT_WINDOW_Y)
} else if (key.IsSameAs(KEY_XLX_ENABLED)) {
val.ToLong(&temp1);
m_xlxEnabled = temp1 == 1L;
} else if (key.IsSameAs(KEY_XLX_HOSTS_FILE_URL) && !val.IsEmpty()) { //always load default url if the value in the config file is empty
} else if (key.IsSameAs(KEY_XLX_HOSTS_FILE_URL) && !val.Trim().IsEmpty()) { //always load default url if the value in the config file is empty
m_xlxHostsFileUrl = val;
} else if (key.IsSameAs(KEY_STARNET_BAND1)) {
m_starNet1Band = val;

View file

@ -66,8 +66,8 @@ wxString CXLXHostsFileDownloader::Download(const wxString & xlxHostsFileURL)
return wxEmptyString;
}
wxInputStream* in = NULL;
if((in = http.GetInputStream(path)) && in->IsOk()) {
wxInputStream* in = http.GetInputStream(path);
if(in != NULL && in->IsOk()) {
wxFile file;
wxString xlxHostsFileName = wxFileName::CreateTempFileName(_T("XLX_Hosts_"), &file);
wxLogMessage(_T("Created temporary file %s"), xlxHostsFileName);

View file

@ -20,6 +20,8 @@
#include "XLXSet.h"
#include "Defs.h"
#include <wx/url.h>
// TODO F4FXL try to figure out why below symbols are not found under ubuntu
//#include <wx/url.h>
@ -79,13 +81,19 @@ bool CXLXSet::Validate()
if (n == wxNOT_FOUND)
return false;
#if defined(__WINDOWS__)
// TODO F4FXL try to figure out why below symbols are not found under ubuntu
/*wxString value = m_xlxHostsFileUrl->GetValue();
wxString value = m_xlxHostsFileUrl->GetValue();
wxURL url(value);
if (url.GetError() != wxURL_NOERR)
return false;*/
if (url.GetError() == wxURL_NOERR)
return true;
wxMessageDialog dialog(this, _("The XLX host file URL is not valid"), m_title + _(" Error"), wxICON_ERROR);
dialog.ShowModal();
return false;
#else
return true;
#endif
}
@ -102,13 +110,16 @@ wxString CXLXSet::getXLXHostsFileUrl() const
{
wxString value = m_xlxHostsFileUrl->GetValue();
#if defined(__WINDOWS__)
// TODO F4FXL try to figure out why below symbols are not found under ubuntu
//wxURL url(value);
//if (url.GetError() == wxURL_NOERR)
// return value;
wxURL url(value);
if (url.GetError() == wxURL_NOERR)
return value;
return wxEmptyString;
#else
return value;
#endif
}
void CXLXSet::onEnabled(wxCommandEvent &event)

View file

@ -171,8 +171,10 @@ int CIRCDDBGatewayApp::OnExit()
wxLogInfo(APPLICATION_NAME + wxT(" is exiting"));
//m_thread->kill();
wxGetApp().GetTopWindow()->Close();
m_thread->kill();
wxWindow * topWin = wxGetApp().GetTopWindow();
if (topWin != NULL)
topWin->Close();
delete m_config;