From df3ad659fdf5cbafd3092bed586bb9ad153a2da3 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Tue, 21 Sep 2021 12:41:08 -0400 Subject: [PATCH] 2021-09-21 Fred Gleason * Refactored 'RDMacroEvent' to avoid use of the STL. Signed-off-by: Fred Gleason --- ChangeLog | 2 ++ lib/rdmacro_event.cpp | 19 ++++++++----------- lib/rdmacro_event.h | 13 ++++++------- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2492af3c..a3a922bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22453,3 +22453,5 @@ 2021-09-21 Fred Gleason * Fixed a regression in rdlibrary(1) that failed to update the length of macro carts after editing. +2021-09-21 Fred Gleason + * Refactored 'RDMacroEvent' to avoid use of the STL. diff --git a/lib/rdmacro_event.cpp b/lib/rdmacro_event.cpp index 1b81a9a0..af726110 100644 --- a/lib/rdmacro_event.cpp +++ b/lib/rdmacro_event.cpp @@ -55,7 +55,7 @@ RDMacroEvent::RDMacroEvent(QHostAddress addr,RDRipc *ripc,QObject *parent) RDMacroEvent::~RDMacroEvent() { - for(unsigned i=0;ilength(); } return length; @@ -127,6 +128,7 @@ bool RDMacroEvent::load(const QString &str) rmlstr=""; } } + return true; } @@ -152,7 +154,7 @@ QString RDMacroEvent::save() { QString str=""; - for(unsigned i=0;itoString(); } return str; @@ -161,18 +163,13 @@ QString RDMacroEvent::save() void RDMacroEvent::insert(int line,const RDMacro *cmd) { - std::vector::iterator it=event_cmds.begin()+line; - - event_cmds.insert(it,1,new RDMacro(*cmd)); + event_cmds.insert(line,new RDMacro(*cmd)); } void RDMacroEvent::remove(int line) { - std::vector::iterator it=event_cmds.begin()+line; - - delete event_cmds[line]; - event_cmds.erase(it,it+1); + event_cmds.removeAt(line); } @@ -314,7 +311,7 @@ void RDMacroEvent::ExecList(int line) event_whole_list=true; emit started(); } - for(unsigned i=line;icommand()) { case RDMacro::SP: // Sleep exec(i); diff --git a/lib/rdmacro_event.h b/lib/rdmacro_event.h index 11066dd7..94d4aa3d 100644 --- a/lib/rdmacro_event.h +++ b/lib/rdmacro_event.h @@ -21,12 +21,11 @@ #ifndef RDMACRO_EVENT_H #define RDMACRO_EVENT_H -#include - -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include @@ -71,7 +70,7 @@ class RDMacroEvent : public QObject private: void ExecList(int line); - std::vector event_cmds; + QList event_cmds; RDRipc *event_ripc; QTimer *event_sleep_timer; bool event_whole_list;