2022-03-09 Fred Gleason <fredg@paravelsystems.com>

* Refactored the 'RDAddLog' dialog to allow for instance reuse.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2022-03-09 15:42:55 -05:00
parent 0c8acd502a
commit 3a41e13afd
25 changed files with 166 additions and 167 deletions

View File

@@ -2,7 +2,7 @@
//
// Data model for Rivendell logs
//
// (C) Copyright 2020-2021 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2020-2022 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
@@ -25,10 +25,9 @@
#include "rdlog_line.h"
#include "rdlogmodel.h"
RDLogModel::RDLogModel(const QString &logname,bool read_only,QObject *parent)
RDLogModel::RDLogModel(bool read_only,QObject *parent)
: QAbstractTableModel(parent)
{
d_log_name=logname;
d_read_only=read_only;
MakeModel();
@@ -247,13 +246,11 @@ QString RDLogModel::logName() const
void RDLogModel::setLogName(QString logname)
{
if(d_log_name.toLower()!=logname) {
clear();
printf("RDLogModel::setLogName(%s)\n",logname.toUtf8().constData());
RDLog *log=new RDLog(logname);
d_log_name=log->name(); // So we normalize the case
delete log;
}
clear();
printf("RDLogModel::setLogName(%s)\n",logname.toUtf8().constData());
RDLog *log=new RDLog(logname);
d_log_name=log->name(); // So we normalize the case
delete log;
}
@@ -356,6 +353,7 @@ int RDLogModel::append(const QString &logname,bool track_ptrs)
void RDLogModel::clear()
{
printf("RDLogModel::clear()\n");
if(d_log_lines.size()>0) {
beginResetModel();
for(int i=0;i<d_log_lines.size();i++) {