mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-05-19 14:43:30 +02:00
2021-09-21 Fred Gleason <fredg@paravelsystems.com>
* Refactored 'RDMacroEvent' to avoid use of the STL. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
parent
bf1d015cb4
commit
df3ad659fd
@ -22453,3 +22453,5 @@
|
|||||||
2021-09-21 Fred Gleason <fredg@paravelsystems.com>
|
2021-09-21 Fred Gleason <fredg@paravelsystems.com>
|
||||||
* Fixed a regression in rdlibrary(1) that failed to update the
|
* Fixed a regression in rdlibrary(1) that failed to update the
|
||||||
length of macro carts after editing.
|
length of macro carts after editing.
|
||||||
|
2021-09-21 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
* Refactored 'RDMacroEvent' to avoid use of the STL.
|
||||||
|
@ -55,7 +55,7 @@ RDMacroEvent::RDMacroEvent(QHostAddress addr,RDRipc *ripc,QObject *parent)
|
|||||||
|
|
||||||
RDMacroEvent::~RDMacroEvent()
|
RDMacroEvent::~RDMacroEvent()
|
||||||
{
|
{
|
||||||
for(unsigned i=0;i<event_cmds.size();i++) {
|
for(int i=0;i<event_cmds.size();i++) {
|
||||||
delete event_cmds[i];
|
delete event_cmds[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -100,7 +100,8 @@ int RDMacroEvent::size() const
|
|||||||
unsigned RDMacroEvent::length() const
|
unsigned RDMacroEvent::length() const
|
||||||
{
|
{
|
||||||
unsigned length=0;
|
unsigned length=0;
|
||||||
for(unsigned i=0;i<event_cmds.size();i++) {
|
|
||||||
|
for(int i=0;i<event_cmds.size();i++) {
|
||||||
length+=event_cmds[i]->length();
|
length+=event_cmds[i]->length();
|
||||||
}
|
}
|
||||||
return length;
|
return length;
|
||||||
@ -127,6 +128,7 @@ bool RDMacroEvent::load(const QString &str)
|
|||||||
rmlstr="";
|
rmlstr="";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,7 +154,7 @@ QString RDMacroEvent::save()
|
|||||||
{
|
{
|
||||||
QString str="";
|
QString str="";
|
||||||
|
|
||||||
for(unsigned i=0;i<event_cmds.size();i++) {
|
for(int i=0;i<event_cmds.size();i++) {
|
||||||
str+=event_cmds[i]->toString();
|
str+=event_cmds[i]->toString();
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
@ -161,18 +163,13 @@ QString RDMacroEvent::save()
|
|||||||
|
|
||||||
void RDMacroEvent::insert(int line,const RDMacro *cmd)
|
void RDMacroEvent::insert(int line,const RDMacro *cmd)
|
||||||
{
|
{
|
||||||
std::vector<RDMacro *>::iterator it=event_cmds.begin()+line;
|
event_cmds.insert(line,new RDMacro(*cmd));
|
||||||
|
|
||||||
event_cmds.insert(it,1,new RDMacro(*cmd));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RDMacroEvent::remove(int line)
|
void RDMacroEvent::remove(int line)
|
||||||
{
|
{
|
||||||
std::vector<RDMacro *>::iterator it=event_cmds.begin()+line;
|
event_cmds.removeAt(line);
|
||||||
|
|
||||||
delete event_cmds[line];
|
|
||||||
event_cmds.erase(it,it+1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -314,7 +311,7 @@ void RDMacroEvent::ExecList(int line)
|
|||||||
event_whole_list=true;
|
event_whole_list=true;
|
||||||
emit started();
|
emit started();
|
||||||
}
|
}
|
||||||
for(unsigned i=line;i<event_cmds.size();i++) {
|
for(int i=line;i<event_cmds.size();i++) {
|
||||||
switch(event_cmds[i]->command()) {
|
switch(event_cmds[i]->command()) {
|
||||||
case RDMacro::SP: // Sleep
|
case RDMacro::SP: // Sleep
|
||||||
exec(i);
|
exec(i);
|
||||||
|
@ -21,12 +21,11 @@
|
|||||||
#ifndef RDMACRO_EVENT_H
|
#ifndef RDMACRO_EVENT_H
|
||||||
#define RDMACRO_EVENT_H
|
#define RDMACRO_EVENT_H
|
||||||
|
|
||||||
#include <vector>
|
#include <QDateTime>
|
||||||
|
#include <QHostAddress>
|
||||||
#include <qobject.h>
|
#include <QList>
|
||||||
#include <qtimer.h>
|
#include <QObject>
|
||||||
#include <qhostaddress.h>
|
#include <QTimer>
|
||||||
#include <qdatetime.h>
|
|
||||||
|
|
||||||
#include <rdmacro.h>
|
#include <rdmacro.h>
|
||||||
#include <rdripc.h>
|
#include <rdripc.h>
|
||||||
@ -71,7 +70,7 @@ class RDMacroEvent : public QObject
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void ExecList(int line);
|
void ExecList(int line);
|
||||||
std::vector<RDMacro *> event_cmds;
|
QList<RDMacro *> event_cmds;
|
||||||
RDRipc *event_ripc;
|
RDRipc *event_ripc;
|
||||||
QTimer *event_sleep_timer;
|
QTimer *event_sleep_timer;
|
||||||
bool event_whole_list;
|
bool event_whole_list;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user