first draft of event processing GUI, still plenty of work to do to wire it up
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Sat, 31 May 2014 02:00:05 +0000 (02:00 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Sat, 31 May 2014 02:00:05 +0000 (02:00 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@1620 01035d8c-6547-0410-b346-abe4f91aad63

fdmdv2/src/dlg_options.cpp
fdmdv2/src/dlg_options.h
fdmdv2/src/fdmdv2_main.cpp
fdmdv2/src/fdmdv2_main.h

index 2fc010f7f50dea0a9778d06f14740ac7b5be9fb8..32ae43c4e46c4d6c0892f0a84ab4f4972187a719 100644 (file)
@@ -33,14 +33,14 @@ OptionsDlg::OptionsDlg(wxWindow* parent, wxWindowID id, const wxString& title, c
     bSizer30 = new wxBoxSizer(wxVERTICAL);
 
     //------------------------------
-    // Call Sign Text Box
+    // Txt Msg Text Box
     //------------------------------
 
     wxStaticBoxSizer* sbSizer_callSign;
-    sbSizer_callSign = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("Call Sign")), wxVERTICAL);
+    sbSizer_callSign = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("Txt Msg")), wxVERTICAL);
 
     m_txtCtrlCallSign = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
-    m_txtCtrlCallSign->SetToolTip(_("Call Sign of your station"));
+    m_txtCtrlCallSign->SetToolTip(_("Txt Msg you can send along with Voice"));
     sbSizer_callSign->Add(m_txtCtrlCallSign, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3);
 
     bSizer30->Add(sbSizer_callSign,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
@@ -58,21 +58,49 @@ OptionsDlg::OptionsDlg(wxWindow* parent, wxWindowID id, const wxString& title, c
     bSizer30->Add(sbSizer_testFrames,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
 
     //------------------------------
-    // Web Integration
+    // Event processing
     //------------------------------
 
-    wxStaticBoxSizer* sbSizer_web;
-    sbSizer_web = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("Web Integration")), wxVERTICAL);
+    wxStaticBoxSizer* sbSizer_events;
+    sbSizer_events = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("Event Processing")), wxVERTICAL);
 
-    m_txt_webURL = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
-    m_txt_webURL->SetToolTip(_("Hit this URL on action below"));
-    sbSizer_web->Add(m_txt_webURL, 1, wxEXPAND, 5);
-    m_ckbox_webOnStart = new wxCheckBox(this, wxID_ANY, _("Start Button"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
-    sbSizer_web->Add(m_ckbox_webOnStart, 1, wxEXPAND, 5);
-    m_ckbox_webOnPTT = new wxCheckBox(this, wxID_ANY, _("PTT Button"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
-    sbSizer_web->Add(m_ckbox_webOnPTT, 1, wxEXPAND, 5);
+    // event processing enable
 
-    bSizer30->Add(sbSizer_web,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
+    m_ckbox_events = new wxCheckBox(this, wxID_ANY, _("Enable"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
+    sbSizer_events->Add(m_ckbox_events, 0, 0, 5);
+
+    // list of regexps
+
+    wxStaticBoxSizer* sbSizer_regexp = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("Regular Expressions to Process Events")), wxVERTICAL);
+    m_txt_events_regexp = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(400,100), wxTE_MULTILINE);
+    m_txt_events_regexp->SetToolTip(_("Enter regular expressions to process events"));
+    sbSizer_regexp->Add(m_txt_events_regexp, 1, wxEXPAND, 5);
+    sbSizer_events->Add(sbSizer_regexp, 1, wxEXPAND, 5);
+
+    // log of events and responses
+
+    wxStaticBoxSizer* sbSizer_event_log = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("Events and Responses")), wxVERTICAL);
+    wxBoxSizer* bSizer33 = new wxBoxSizer(wxHORIZONTAL);
+    m_txt_events_in = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(200,50), wxTE_MULTILINE | wxTE_READONLY);
+    bSizer33->Add(m_txt_events_in, 1, wxEXPAND, 5);
+    m_txt_events_out = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(200,50), wxTE_MULTILINE | wxTE_READONLY);
+    bSizer33->Add(m_txt_events_out, 1, wxEXPAND, 5);
+    sbSizer_event_log->Add(bSizer33, 1, wxEXPAND, 5);
+    sbSizer_events->Add(sbSizer_event_log, 1, wxEXPAND, 5);
+
+    // test event
+
+    wxStaticBoxSizer* sbSizer_event_test = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("Test your Regular Expression")), wxVERTICAL);
+    wxBoxSizer* bSizer34 = new wxBoxSizer(wxHORIZONTAL);
+    m_txt_event_test = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
+    m_txt_event_test->SetToolTip(_("Enter event text to test a regular expression"));
+    bSizer34->Add(m_txt_event_test, 1, wxEXPAND|wxALL, 5);
+    m_btn_event_test = new wxButton(this, wxID_ANY, _("Test"), wxDefaultPosition, wxDefaultSize, 0);
+    bSizer34->Add(m_btn_event_test, 0, wxEXPAND|wxALL, 5);
+    sbSizer_event_test->Add(bSizer34, 0, wxEXPAND, 5);
+    sbSizer_events->Add(sbSizer_event_test, 0, wxEXPAND, 5);
+
+    bSizer30->Add(sbSizer_events,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
 
     //------------------------------
     // Cancel - OK Buttons 
@@ -125,26 +153,23 @@ void OptionsDlg::ExchangeData(int inout, bool storePersistent)
         m_txtCtrlCallSign->SetValue(wxGetApp().m_callSign);
         m_ckboxTestFrame->SetValue(wxGetApp().m_testFrames);
 
-        m_ckbox_webOnStart->SetValue(wxGetApp().m_webOnStart);
-        m_ckbox_webOnPTT->SetValue(wxGetApp().m_webOnPTT);
-        m_txt_webURL->SetValue(wxGetApp().m_webURL);
+        m_ckbox_events->SetValue(wxGetApp().m_events);
+        m_txt_events_regexp->SetValue(wxGetApp().m_events_regexp);
     }
 
     if(inout == EXCHANGE_DATA_OUT)
     {
-        wxGetApp().m_callSign   = m_txtCtrlCallSign->GetValue();
-        wxGetApp().m_testFrames = m_ckboxTestFrame->GetValue();
-
-        wxGetApp().m_webOnStart = m_ckbox_webOnStart->GetValue();
-        wxGetApp().m_webOnPTT   = m_ckbox_webOnPTT->GetValue();
-        wxGetApp().m_webURL     = m_txt_webURL->GetValue();
+        wxGetApp().m_callSign      = m_txtCtrlCallSign->GetValue();
+        wxGetApp().m_testFrames     = m_ckboxTestFrame->GetValue();
 
+        wxGetApp().m_events        = m_ckbox_events->GetValue();
+        wxGetApp().m_events_regexp = m_txt_events_regexp->GetValue();
         if (storePersistent) {
             pConfig->Write(wxT("/Data/CallSign"), wxGetApp().m_callSign);
-            pConfig->Write(wxT("/Web/OnStart"), wxGetApp().m_webOnStart);
-            pConfig->Write(wxT("/Web/OnPTT"), wxGetApp().m_webOnPTT);
-            pConfig->Write(wxT("/Web/URL"), wxGetApp().m_webURL);
-             pConfig->Flush();
+            pConfig->Write(wxT("/Events/enable"), wxGetApp().m_events);
+            pConfig->Write(wxT("/Events/regexp"), wxGetApp().m_events_regexp);
+            pConfig->Flush();
         }
     }
     delete wxConfigBase::Set((wxConfigBase *) NULL);
index 533f88ce5cf00c324d76c997d30c8788b524792c..cfa7eaea4a410e886ea2bed451bdd6a1b86d3ca4 100644 (file)
@@ -32,7 +32,7 @@ class OptionsDlg : public wxDialog
     public:
     OptionsDlg( wxWindow* parent,
                wxWindowID id = wxID_ANY, const wxString& title = _("Options"), 
-                const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(450,290), 
+                const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(600,530), 
                long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
         ~OptionsDlg();
 
@@ -45,12 +45,15 @@ class OptionsDlg : public wxDialog
         void    OnClose(wxCloseEvent& event);
         void    OnInitDialog(wxInitDialogEvent& event);
  
-        wxTextCtrl   *m_txtCtrlCallSign;
+        wxTextCtrl   *m_txtCtrlCallSign; // TODO: this should be renamed to tx_txtmsg, and rename all related incl persis strge
         wxCheckBox   *m_ckboxTestFrame;
 
-        wxCheckBox   *m_ckbox_webOnStart;
-        wxCheckBox   *m_ckbox_webOnPTT;
-        wxTextCtrl   *m_txt_webURL;
+        wxCheckBox   *m_ckbox_events;
+        wxTextCtrl   *m_txt_events_regexp;
+        wxTextCtrl   *m_txt_events_in;
+        wxTextCtrl   *m_txt_events_out;
+        wxTextCtrl   *m_txt_event_test;
+        wxButton     *m_btn_event_test;
 
         wxButton*     m_sdbSizer5OK;
         wxButton*     m_sdbSizer5Cancel;
index 906352f7e8c98810cf53903130597759137311d1..e85ba27666a4c785f9ea81b076f7ad383e682070 100644 (file)
@@ -370,9 +370,9 @@ MainFrame::MainFrame(wxWindow *parent) : TopFrame(parent)
     wxGetApp().m_SpkOutEQEnable = (float)pConfig->Read(wxT("/Filter/SpkOutEQEnable"), f);
 
     wxGetApp().m_callSign = pConfig->Read("/Data/CallSign", wxT(""));
-    wxGetApp().m_webOnStart = pConfig->Read("/Web/OnStart", f);
-    wxGetApp().m_webOnPTT = pConfig->Read("/Web/OnPTT", f);
-    wxGetApp().m_webURL = pConfig->Read("/Web/URL", wxT("http://qso.freedv.org/cgi-bin/"));
+    wxGetApp().m_events = pConfig->Read("/Events/enable", f);
+    wxGetApp().m_events_regexp = pConfig->Read("/Events/regexp", 
+                                               wxT("s|onstart,mycallsign=(.*),|curl http://qso.freedv.org/cgi-bin/onstart.cgi?callsign=$1|"));
 
     pConfig->SetPath(wxT("/"));
 
@@ -529,9 +529,8 @@ MainFrame::~MainFrame()
         pConfig->Write(wxT("/Audio/snrSlow"), wxGetApp().m_snrSlow);
 
         pConfig->Write(wxT("/Data/CallSign"), wxGetApp().m_callSign);
-        pConfig->Write(wxT("/Web/OnStart"), wxGetApp().m_webOnStart);
-        pConfig->Write(wxT("/Web/OnPTT"), wxGetApp().m_webOnPTT);
-        pConfig->Write(wxT("/Web/URL"), wxGetApp().m_webURL);
+        pConfig->Write(wxT("/Events/enable"), wxGetApp().m_events);
+        pConfig->Write(wxT("/Events/regexp"), wxGetApp().m_events_regexp);
  
         pConfig->Write(wxT("/Filter/MicInEQEnable"), wxGetApp().m_MicInEQEnable);
         pConfig->Write(wxT("/Filter/SpkOutEQEnable"), wxGetApp().m_SpkOutEQEnable);
index 1ed2d44d3135d61d585ccb8382e8d21e9dc1ee5e..0a513bff4b0123d766d9760aa4298f50fe62515e 100644 (file)
@@ -169,10 +169,11 @@ class MainApp : public wxApp
         unsigned int        m_recFileFromRadioSecs;
         wxString            m_playFileFromRadioPath;
 
+        // Options dialog
+
         wxString            m_callSign;
-        bool                m_webOnStart;
-        bool                m_webOnPTT;
-        wxString            m_webURL;
+        bool                m_events;
+        wxString            m_events_regexp;
 
         bool                m_snrSlow;