Skip to content

Commit

Permalink
If provided by user, add config file to titlebar.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmiw committed Aug 8, 2024
1 parent e31b578 commit d134492
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,12 @@ bool MainApp::OnCmdLineParsed(wxCmdLineParser& parser)
fprintf(stderr, "Loading configuration from %s\n", (const char*)configPath.ToUTF8());
pConfig = new wxFileConfig(wxT("FreeDV"), wxT("CODEC2-Project"), configPath, configPath, wxCONFIG_USE_LOCAL_FILE);
wxConfigBase::Set(pConfig);

// On Linux/macOS, this replaces $HOME with "~" to shorten the title a bit.
wxFileName fn(configPath);
fn.ReplaceEnvVariable("HOME", "~");

customConfigFileName = fn.GetShortPath();
}
pConfig->SetRecordDefaults();

Expand Down Expand Up @@ -240,7 +246,7 @@ bool MainApp::OnInit()
// displayed. But it doesn't when built from command line. Why?

frame->m_auiNbookCtrl->ChangeSelection(0);
frame->Layout();
frame->Layout();
frame->Show();
g_parent =frame;

Expand Down Expand Up @@ -648,6 +654,12 @@ MainFrame::MainFrame(wxWindow *parent) : TopFrame(parent, wxID_ANY, _("FreeDV ")
pthread_setname_np(pthread_self(), "FreeDV GUI");
#endif // defined(__linux__)

// Add config file name to title bar if provided at the command line.
if (wxGetApp().customConfigFileName != "")
{
SetTitle(wxString::Format("%s (%s)", _("FreeDV ") + _(FREEDV_VERSION), wxGetApp().customConfigFileName));
}

m_reporterDialog = nullptr;
m_filterDialog = nullptr;

Expand Down
1 change: 1 addition & 0 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ class MainApp : public wxApp
bool CanAccessSerialPort(std::string portName);

FreeDVConfiguration appConfiguration;
wxString customConfigFileName;

// PTT -----------------------------------
unsigned int m_intHamlibRig;
Expand Down

0 comments on commit d134492

Please sign in to comment.