Skip to content

Commit

Permalink
Added missing header file (Linux)
Browse files Browse the repository at this point in the history
Signed-off-by: Eran Ifrah <eran@codelite.org>
  • Loading branch information
eranif committed Sep 17, 2024
1 parent 0959d83 commit d497e85
Showing 1 changed file with 29 additions and 28 deletions.
57 changes: 29 additions & 28 deletions Plugin/FileSystemWorkspace/FSConfigPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "macromanager.h"
#include "macros.h"

#include <wx/dirdlg.h>
#include <wx/msgdlg.h>
#include <wx/tokenzr.h>

Expand All @@ -33,7 +34,7 @@ FSConfigPage::FSConfigPage(wxWindow* parent, clFileSystemWorkspaceConfig::Ptr_t
{
m_config = config;
LexerConf::Ptr_t lexer = ColoursAndFontsManager::Get().GetLexer("text");
if(lexer) {
if (lexer) {
lexer->Apply(m_stcCCFlags);
lexer->Apply(m_stcEnv);
lexer->Apply(m_stcCommands);
Expand All @@ -48,7 +49,7 @@ FSConfigPage::FSConfigPage(wxWindow* parent, clFileSystemWorkspaceConfig::Ptr_t
m_stcCCFlags->SetText(m_config->GetCompileFlagsAsString());
m_textCtrlFileExt->ChangeValue(m_config->GetFileExtensions());

if(m_config->GetLastExecutables().empty()) {
if (m_config->GetLastExecutables().empty()) {
m_comboBoxExecutable->Append(m_config->GetExecutable());
} else {
m_comboBoxExecutable->Append(m_config->GetLastExecutables());
Expand All @@ -58,7 +59,7 @@ FSConfigPage::FSConfigPage(wxWindow* parent, clFileSystemWorkspaceConfig::Ptr_t
m_textCtrlArgs->ChangeValue(m_config->GetArgs());
m_stcEnv->SetText(m_config->GetEnvironment());
const auto& targets = m_config->GetBuildTargets();
for(const auto& vt : targets) {
for (const auto& vt : targets) {
wxDataViewItem item = m_dvListCtrlTargets->AppendItem(vt.first);
m_dvListCtrlTargets->SetItemText(item, vt.second, 1);
}
Expand All @@ -80,7 +81,7 @@ FSConfigPage::FSConfigPage(wxWindow* parent, clFileSystemWorkspaceConfig::Ptr_t
m_textCtrlDebugger->ChangeValue(config->GetDebuggerPath());
m_stcCommands->SetText(config->GetDebuggerCommands());

if(!m_enableRemotePage) {
if (!m_enableRemotePage) {
m_checkBoxEnableRemote->Disable();
m_checkBoxRemoteBuild->Disable();
m_textCtrlRemoteFolder->Disable();
Expand All @@ -101,7 +102,7 @@ void FSConfigPage::OnDelete(wxCommandEvent& event)
void FSConfigPage::OnDeleteUI(wxUpdateUIEvent& event)
{
wxDataViewItem item = m_dvListCtrlTargets->GetSelection();
if(item.IsOk()) {
if (item.IsOk()) {
wxString name = m_dvListCtrlTargets->GetItemText(item, 0);
event.Enable(name != "build" && name != "clean");

Expand All @@ -124,7 +125,7 @@ void FSConfigPage::OnEditTargetUI(wxUpdateUIEvent& event)
void FSConfigPage::OnNewTarget(wxCommandEvent& event)
{
BuildTargetDlg dlg(::wxGetTopLevelParent(this), "", "");
if(dlg.ShowModal() == wxID_OK) {
if (dlg.ShowModal() == wxID_OK) {
wxDataViewItem item = m_dvListCtrlTargets->AppendItem(dlg.GetTargetName());
m_dvListCtrlTargets->SetItemText(item, dlg.GetTargetCommand(), 1);
}
Expand All @@ -133,7 +134,7 @@ void FSConfigPage::OnNewTarget(wxCommandEvent& event)
void FSConfigPage::Save()
{
std::map<wxString, wxString> targets;
for(size_t i = 0; i < m_dvListCtrlTargets->GetItemCount(); ++i) {
for (size_t i = 0; i < m_dvListCtrlTargets->GetItemCount(); ++i) {
wxDataViewItem item = m_dvListCtrlTargets->RowToItem(i);
wxString name = m_dvListCtrlTargets->GetItemText(item, 0);
wxString command = m_dvListCtrlTargets->GetItemText(item, 1);
Expand All @@ -146,10 +147,10 @@ void FSConfigPage::Save()
m_config->SetExecutable(m_comboBoxExecutable->GetStringSelection());

wxArrayString last_executables = m_comboBoxExecutable->GetStrings();
if(last_executables.Index(m_comboBoxExecutable->GetValue()) == wxNOT_FOUND) {
if (last_executables.Index(m_comboBoxExecutable->GetValue()) == wxNOT_FOUND) {
last_executables.Insert(m_comboBoxExecutable->GetValue(), 0);
}
if(last_executables.size() > 10) {
if (last_executables.size() > 10) {
wxArrayString small_arr;
small_arr.insert(small_arr.end(), last_executables.begin(), last_executables.begin() + 9);
last_executables.swap(small_arr);
Expand Down Expand Up @@ -184,7 +185,7 @@ void FSConfigPage::DoTargetActivated()

BuildTargetDlg dlg(::wxGetTopLevelParent(this), m_dvListCtrlTargets->GetItemText(item, 0),
m_dvListCtrlTargets->GetItemText(item, 1));
if(dlg.ShowModal() == wxID_OK) {
if (dlg.ShowModal() == wxID_OK) {
m_dvListCtrlTargets->SetItemText(item, dlg.GetTargetName(), 0);
m_dvListCtrlTargets->SetItemText(item, dlg.GetTargetCommand(), 1);
}
Expand All @@ -204,7 +205,7 @@ void FSConfigPage::OnSSHBrowse(wxCommandEvent& event)
#if USE_SFTP
SFTPBrowserDlg dlg(GetParent(), _("Choose folder"), "", clSFTP::SFTP_BROWSE_FOLDERS);
dlg.Initialize(m_choiceSSHAccount->GetStringSelection(), m_textCtrlRemoteFolder->GetValue());
if(dlg.ShowModal() == wxID_OK) {
if (dlg.ShowModal() == wxID_OK) {
m_textCtrlRemoteFolder->ChangeValue(dlg.GetPath());
}
#endif
Expand All @@ -214,7 +215,7 @@ void FSConfigPage::OnSSHAccountChoice(wxCommandEvent& event)
{
#if USE_SFTP
wxString s = m_choiceSSHAccount->GetStringSelection();
if(s == OPEN_SSH_ACCOUNT_MANAGER) {
if (s == OPEN_SSH_ACCOUNT_MANAGER) {
SSHAccountManagerDlg dlg(GetParent());
dlg.ShowModal();
CallAfter(&FSConfigPage::DoUpdateSSHAcounts);
Expand All @@ -225,7 +226,7 @@ void FSConfigPage::OnSSHAccountChoice(wxCommandEvent& event)
void FSConfigPage::DoUpdateSSHAcounts()
{
#if USE_SFTP
if(!m_enableRemotePage) {
if (!m_enableRemotePage) {
m_choiceSSHAccount->Enable(false);
return;
}
Expand All @@ -237,15 +238,15 @@ void FSConfigPage::DoUpdateSSHAcounts()
const SSHAccountInfo::Vect_t& accounts = settings.GetAccounts();
const wxString& selectedAccount = m_config->GetRemoteAccount();
int sel = wxNOT_FOUND;
for(const auto& v : accounts) {
for (const auto& v : accounts) {
int where = m_choiceSSHAccount->Append(v.GetAccountName());
if(sel == wxNOT_FOUND && (v.GetAccountName() == selectedAccount)) {
if (sel == wxNOT_FOUND && (v.GetAccountName() == selectedAccount)) {
sel = where;
}
}
if(sel != wxNOT_FOUND) {
if (sel != wxNOT_FOUND) {
m_choiceSSHAccount->SetSelection(sel);
} else if(!m_choiceSSHAccount->IsEmpty()) {
} else if (!m_choiceSSHAccount->IsEmpty()) {
m_choiceSSHAccount->SetSelection(0);
}
m_choiceSSHAccount->Append(OPEN_SSH_ACCOUNT_MANAGER);
Expand All @@ -266,11 +267,11 @@ void FSConfigPage::OnEditExcludePaths(wxCommandEvent& event)

wxArrayString paths = StringUtils::BuildArgv(m_textCtrlExcludePaths->GetValue());
wxString value;
if(!paths.IsEmpty()) {
if (!paths.IsEmpty()) {
value = wxJoin(paths, '\n');
}
value = ::clGetStringFromUser(value, wxGetTopLevelParent(this));
if(!value.IsEmpty()) {
if (!value.IsEmpty()) {
wxArrayString lines = ::wxStringTokenize(value, "\n", wxTOKEN_STRTOK);
value = wxJoin(lines, ';');
m_textCtrlExcludePaths->ChangeValue(value);
Expand All @@ -279,17 +280,17 @@ void FSConfigPage::OnEditExcludePaths(wxCommandEvent& event)
void FSConfigPage::OnBrowseExec(wxCommandEvent& event)
{
wxString path;
if(m_useRemoteBrowsing) {
if (m_useRemoteBrowsing) {
auto p = ::clRemoteFileSelector(_("Select a directory"), m_sshAccount);
if(p.first != m_sshAccount) {
if (p.first != m_sshAccount) {
::wxMessageBox(_("Wrong account selected!"), "CodeLite", wxOK | wxICON_WARNING);
return;
}
path = p.second;
} else {
path = ::wxFileSelector();
}
if(path.empty()) {
if (path.empty()) {
return;
}
m_comboBoxExecutable->SetValue(path);
Expand All @@ -298,17 +299,17 @@ void FSConfigPage::OnBrowseExec(wxCommandEvent& event)
void FSConfigPage::OnBrowseWD(wxCommandEvent& event)
{
wxString path;
if(m_useRemoteBrowsing) {
if (m_useRemoteBrowsing) {
auto p = ::clRemoteFolderSelector(_("Select a directory"), m_sshAccount);
if(p.first != m_sshAccount) {
if (p.first != m_sshAccount) {
::wxMessageBox(_("Wrong account selected!"), "CodeLite", wxOK | wxICON_WARNING);
return;
}
path = p.second;
} else {
path = ::wxDirSelector();
}
if(path.empty()) {
if (path.empty()) {
return;
}
m_textCtrlWD->ChangeValue(path);
Expand All @@ -317,17 +318,17 @@ void FSConfigPage::OnBrowseWD(wxCommandEvent& event)
void FSConfigPage::OnBrowseForGDB(wxCommandEvent& event)
{
wxString path;
if(m_useRemoteBrowsing) {
if (m_useRemoteBrowsing) {
auto p = ::clRemoteFileSelector(_("Select debugger executable:"), m_sshAccount);
if(p.first != m_sshAccount) {
if (p.first != m_sshAccount) {
::wxMessageBox(_("Wrong account selected!"), "CodeLite", wxOK | wxICON_WARNING);
return;
}
path = p.second;
} else {
path = ::wxFileSelector();
}
if(path.empty()) {
if (path.empty()) {
return;
}
m_textCtrlDebugger->ChangeValue(path);
Expand Down

0 comments on commit d497e85

Please sign in to comment.