2018-02-01 Fred Gleason <fredg@paravelsystems.com>

* Converted rdclilogedit(1) to use RDApplication.
This commit is contained in:
Fred Gleason
2018-01-31 14:44:08 -05:00
parent 4de82a23eb
commit 941f846060
5 changed files with 66 additions and 93 deletions

View File

@@ -2,7 +2,7 @@
//
// A command-line log editor for Rivendell
//
// (C) Copyright 2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2016-2018 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
@@ -20,6 +20,7 @@
#include <stdlib.h>
#include <rdapplication.h>
#include <rdweb.h>
#include "rdclilogedit.h"
@@ -46,7 +47,7 @@ void MainObject::DispatchCommand(QString cmd)
// No loaded log needed for these
//
if(verb=="deletelog") {
if(edit_user->deleteLog()) {
if(rda->user()->deleteLog()) {
if(cmds.size()==2) {
Deletelog(cmds[1]);
}
@@ -123,7 +124,7 @@ void MainObject::DispatchCommand(QString cmd)
//
if((processed)||(edit_log_event!=NULL)) {
if(verb=="addcart") {
if(edit_user->addtoLog()) {
if(rda->user()->addtoLog()) {
if(cmds.size()==3) {
line=cmds[1].toInt(&ok);
if(ok&&(line>=0)) {
@@ -150,7 +151,7 @@ void MainObject::DispatchCommand(QString cmd)
}
if(verb=="addchain") {
if(edit_user->addtoLog()) {
if(rda->user()->addtoLog()) {
if(cmds.size()==3) {
line=cmds[1].toInt(&ok);
if(ok&&(line>=0)) {
@@ -171,7 +172,7 @@ void MainObject::DispatchCommand(QString cmd)
}
if(verb=="addmarker") {
if(edit_user->addtoLog()) {
if(rda->user()->addtoLog()) {
if(cmds.size()==2) {
line=cmds[1].toInt(&ok);
if(ok&&(line>=0)) {
@@ -192,7 +193,7 @@ void MainObject::DispatchCommand(QString cmd)
}
if(verb=="addtrack") {
if(edit_user->addtoLog()) {
if(rda->user()->addtoLog()) {
if(cmds.size()==2) {
line=cmds[1].toInt(&ok);
if(ok&&(line>=0)) {
@@ -223,7 +224,7 @@ void MainObject::DispatchCommand(QString cmd)
}
if(verb=="remove") {
if(edit_user->removefromLog()) {
if(rda->user()->removefromLog()) {
if(cmds.size()==2) {
line=cmds[1].toInt(&ok);
if(ok&&(line>=0)&&(line<edit_log_event->size())) {
@@ -244,7 +245,7 @@ void MainObject::DispatchCommand(QString cmd)
}
if(verb=="save") {
if(edit_user->arrangeLog()) {
if(rda->user()->arrangeLog()) {
Save();
}
else {
@@ -254,7 +255,7 @@ void MainObject::DispatchCommand(QString cmd)
}
if(verb=="saveas") {
if(edit_user->arrangeLog()) {
if(rda->user()->arrangeLog()) {
if(cmds.size()==2) {
if(cmds[1].length()>64) {
fprintf(stderr,"saveas: log name too long\n");
@@ -273,7 +274,7 @@ void MainObject::DispatchCommand(QString cmd)
}
if(verb=="setautorefresh") {
if(edit_user->arrangeLog()) {
if(rda->user()->arrangeLog()) {
if(cmds.size()==2) {
QString arg=cmds[1].lower();
if((arg=="yes")||(arg=="true")||(arg=="y")) {
@@ -300,7 +301,7 @@ void MainObject::DispatchCommand(QString cmd)
}
if(verb=="setcart") {
if(edit_user->arrangeLog()) {
if(rda->user()->arrangeLog()) {
if(cmds.size()==3) {
line=cmds[1].toInt(&ok);
if(ok&&(line>=0)&&(line<edit_log_event->size())) {
@@ -328,7 +329,7 @@ void MainObject::DispatchCommand(QString cmd)
}
if(verb=="setcomment") {
if(edit_user->arrangeLog()) {
if(rda->user()->arrangeLog()) {
if(cmds.size()>=3) {
line=cmds[1].toInt(&ok);
if(ok&&(line>=0)&&(line<edit_log_event->size())) {
@@ -352,7 +353,7 @@ void MainObject::DispatchCommand(QString cmd)
}
if(verb=="setdesc") {
if(edit_user->arrangeLog()) {
if(rda->user()->arrangeLog()) {
if(cmds.size()>=2) {
cmds.erase(cmds.begin());
Setdesc(cmds.join(" "));
@@ -369,7 +370,7 @@ void MainObject::DispatchCommand(QString cmd)
}
if(verb=="setenddate") {
if(edit_user->arrangeLog()) {
if(rda->user()->arrangeLog()) {
if(cmds.size()==1) {
Setenddate(QDate());
}
@@ -396,7 +397,7 @@ void MainObject::DispatchCommand(QString cmd)
}
if(verb=="setlabel") {
if(edit_user->arrangeLog()) {
if(rda->user()->arrangeLog()) {
if(cmds.size()==3) {
line=cmds[1].toInt(&ok);
if(ok&&(line>=0)&&(line<edit_log_event->size())) {
@@ -418,7 +419,7 @@ void MainObject::DispatchCommand(QString cmd)
}
if(verb=="setpurgedate") {
if(edit_user->arrangeLog()) {
if(rda->user()->arrangeLog()) {
if(cmds.size()==1) {
Setpurgedate(QDate());
}
@@ -445,7 +446,7 @@ void MainObject::DispatchCommand(QString cmd)
}
if(verb=="setservice") {
if(edit_user->arrangeLog()) {
if(rda->user()->arrangeLog()) {
if(cmds.size()==2) {
Setservice(cmds[1]);
}
@@ -461,7 +462,7 @@ void MainObject::DispatchCommand(QString cmd)
}
if(verb=="setstartdate") {
if(edit_user->arrangeLog()) {
if(rda->user()->arrangeLog()) {
if(cmds.size()==1) {
Setstartdate(QDate());
}
@@ -488,7 +489,7 @@ void MainObject::DispatchCommand(QString cmd)
}
if(verb=="settime") {
if(edit_user->arrangeLog()) {
if(rda->user()->arrangeLog()) {
if(cmds.size()>=3) {
line=cmds[1].toInt(&ok);
if(ok&&(line>=0)&&(line<edit_log_event->size())) {
@@ -540,7 +541,7 @@ void MainObject::DispatchCommand(QString cmd)
}
if(verb=="settrans") {
if(edit_user->arrangeLog()) {
if(rda->user()->arrangeLog()) {
if(cmds.size()==3) {
line=cmds[1].toInt(&ok);
if(ok&&(line>=0)&&(line<edit_log_event->size())) {