2020-12-15 Fred Gleason <fredg@paravelsystems.com>

* Added a right-click menu to the 'Edit Log' dialog in
	rdlogedit(1).

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2020-12-15 19:25:36 -05:00
parent 15b4517f55
commit 456e3d0b49
17 changed files with 281 additions and 68 deletions

View File

@ -20698,3 +20698,6 @@
logs owning service.
2020-12-15 Fred Gleason <fredg@paravelsystems.com>
* Modified rdcastmanager(1) to use the standard log model.
2020-12-15 Fred Gleason <fredg@paravelsystems.com>
* Added a right-click menu to the 'Edit Log' dialog in
rdlogedit(1).

View File

@ -1020,6 +1020,19 @@ QString RDLogModel::xml() const
}
void RDLogModel::setTransition(int line,RDLogLine::TransType trans)
{
RDLogLine *ll=NULL;
if((ll=logLine(line))!=NULL) {
if(ll->transType()!=trans) {
ll->setTransType(trans);
emitDataChanged(line);
}
}
}
void RDLogModel::processNotification(RDNotification *notify)
{
RDLogLine *ll=NULL;

View File

@ -82,6 +82,7 @@ class RDLogModel : public QAbstractTableModel
QString xml() const;
public slots:
void setTransition(int line,RDLogLine::TransType trans);
void processNotification(RDNotification *notify);
void setStartTimeStyle(StartTimeStyle style);

View File

@ -41,7 +41,6 @@ all:
bin_PROGRAMS = rdlogedit
dist_rdlogedit_SOURCES = add_meta.cpp add_meta.h\
drop_tableview.cpp drop_tableview.h\
edit_chain.cpp edit_chain.h\
edit_event.cpp edit_event.h\
edit_log.cpp edit_log.h\
@ -52,12 +51,12 @@ dist_rdlogedit_SOURCES = add_meta.cpp add_meta.h\
list_reports.cpp list_reports.h\
log_listview.cpp log_listview.h\
logmodel.cpp logmodel.h\
logtableview.cpp logtableview.h\
rdlogedit.cpp rdlogedit.h globals.h\
render_dialog.cpp render_dialog.h\
voice_tracker.cpp voice_tracker.h
nodist_rdlogedit_SOURCES = moc_add_meta.cpp\
moc_drop_tableview.cpp\
moc_edit_chain.cpp\
moc_edit_event.cpp\
moc_edit_log.cpp\
@ -67,6 +66,7 @@ nodist_rdlogedit_SOURCES = moc_add_meta.cpp\
moc_list_reports.cpp\
moc_log_listview.cpp\
moc_logmodel.cpp\
moc_logtableview.cpp\
moc_rdlogedit.cpp\
moc_render_dialog.cpp\
moc_voice_tracker.cpp

View File

@ -1,55 +0,0 @@
// drop_tableview.cpp
//
// The Log TableView widget for RDLogEdit.
//
// (C) Copyright 2002-2020 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
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
//
#include <rdcartdrag.h>
#include "drop_tableview.h"
DropTableView::DropTableView(QWidget *parent)
: QTableView(parent)
{
setAcceptDrops(true);
}
void DropTableView::dragEnterEvent(QDragEnterEvent *e)
{
e->accept(RDCartDrag::canDecode(e));
}
void DropTableView::dragMoveEvent(QDragMoveEvent *e)
{
e->accept(RDCartDrag::canDecode(e));
}
void DropTableView::dropEvent(QDropEvent *e)
{
RDLogLine ll;
int line=-1;
int y_pos=e->pos().y();
if(RDCartDrag::decode(e,&ll)) {
line=rowAt(y_pos);
emit cartDropped(line,&ll);
}
}

View File

@ -264,7 +264,7 @@ EditLog::EditLog(QString logname,QString *filter,QString *group,
//
// Log Event View
//
edit_log_view=new DropTableView(this);
edit_log_view=new LogTableView(this);
edit_log_view->setSelectionBehavior(QAbstractItemView::SelectRows);
edit_log_view->setSelectionMode(QAbstractItemView::ContiguousSelection);
edit_log_view->setShowGrid(false);
@ -276,6 +276,9 @@ EditLog::EditLog(QString logname,QString *filter,QString *group,
edit_log_model->load(true);
edit_log_view->setModel(edit_log_model);
edit_log_view->resizeColumnsToContents();
connect(edit_log_model,
SIGNAL(dataChanged(const QModelIndex &,const QModelIndex &)),
this,SLOT(dataChangedData(const QModelIndex &,const QModelIndex &)));
connect(edit_log_view,SIGNAL(doubleClicked(const QModelIndex &)),
this,SLOT(doubleClickedData(const QModelIndex &)));
connect(edit_log_view,SIGNAL(clicked(const QModelIndex &)),
@ -595,6 +598,13 @@ int EditLog::exec()
}
void EditLog::dataChangedData(const QModelIndex &top_left,
const QModelIndex &bottom_right)
{
SetLogModified(true);
}
void EditLog::descriptionChangedData(const QString &)
{
SetLogModified(true);

View File

@ -31,9 +31,9 @@
#include <QStringList>
#include <QTableView>
#include "drop_tableview.h"
#include "list_reports.h"
#include "logmodel.h"
#include "logtableview.h"
#include "render_dialog.h"
#define RDLOGEDIT_EDITLOG_DEFAULT_WIDTH 950
@ -54,6 +54,8 @@ class EditLog : public RDDialog
int exec();
private slots:
void dataChangedData(const QModelIndex &top_left,
const QModelIndex &bottom_right);
void descriptionChangedData(const QString &);
void purgeDateChangedData(const QDate &date);
void purgeDateToggledData(bool state);
@ -168,7 +170,7 @@ class EditLog : public RDDialog
RDLogLock *edit_log_lock;
QPushButton *edit_renderas_button;
RenderDialog *edit_render_dialog;
DropTableView *edit_log_view;
LogTableView *edit_log_view;
LogModel *edit_log_model;
};

119
rdlogedit/logtableview.cpp Normal file
View File

@ -0,0 +1,119 @@
// logtableview.cpp
//
// TableView widget for RDLogEdit
//
// (C) Copyright 2002-2020 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
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
//
#include <rdcartdrag.h>
#include "logtableview.h"
#include "logmodel.h"
LogTableView::LogTableView(QWidget *parent)
: QTableView(parent)
{
d_mouse_row=-1;
setAcceptDrops(true);
//
// Mouse menu
//
d_mouse_menu=new QMenu(this);
d_play_action=d_mouse_menu->
addAction(tr("PLAY Transition"),this,SLOT(setPlayData()));
d_play_action->setCheckable(true);
d_segue_action=d_mouse_menu->
addAction(tr("SEGUE Transition"),this,SLOT(setSegueData()));
d_segue_action->setCheckable(true);
d_stop_action=d_mouse_menu->
addAction(tr("STOP Transition"),this,SLOT(setStopData()));
d_stop_action->setCheckable(true);
connect(d_mouse_menu,SIGNAL(aboutToShow()),
this,SLOT(aboutToShowMenuData()));
}
void LogTableView::dragEnterEvent(QDragEnterEvent *e)
{
e->accept(RDCartDrag::canDecode(e));
}
void LogTableView::dragMoveEvent(QDragMoveEvent *e)
{
e->accept(RDCartDrag::canDecode(e));
}
void LogTableView::dropEvent(QDropEvent *e)
{
RDLogLine ll;
int line=-1;
int y_pos=e->pos().y();
if(RDCartDrag::decode(e,&ll)) {
line=rowAt(y_pos);
emit cartDropped(line,&ll);
}
}
void LogTableView::mousePressEvent(QMouseEvent *e)
{
if(e->button()==Qt::RightButton) {
d_mouse_row=indexAt(e->pos()).row();
if((d_mouse_row>=0)&&(d_mouse_row<(model()->rowCount()-1))) {
d_mouse_menu->popup(e->globalPos());
}
else {
d_mouse_row=-1;
}
}
QTableView::mousePressEvent(e);
}
void LogTableView::aboutToShowMenuData()
{
RDLogLine *ll=((LogModel *)model())->logLine(d_mouse_row);
if(ll!=NULL) {
d_play_action->setChecked(ll->transType()==RDLogLine::Play);
d_segue_action->setChecked(ll->transType()==RDLogLine::Segue);
d_stop_action->setChecked(ll->transType()==RDLogLine::Stop);
}
}
void LogTableView::setPlayData()
{
((LogModel *)model())->setTransition(d_mouse_row,RDLogLine::Play);
}
void LogTableView::setSegueData()
{
((LogModel *)model())->setTransition(d_mouse_row,RDLogLine::Segue);
}
void LogTableView::setStopData()
{
((LogModel *)model())->setTransition(d_mouse_row,RDLogLine::Stop);
}

View File

@ -1,4 +1,4 @@
// drop_tableview.h
// logtableview.h
//
// The Log TableView widget for RDLogEdit.
//
@ -19,20 +19,21 @@
//
//
#ifndef DROP_TABLEVIEW_H
#define DROP_TABLEVIEW_H
#ifndef LOGTABLEVIEW_H
#define LOGTABLEVIEW_H
#include <QDropEvent>
#include <QDragEnterEvent>
#include <QMenu>
#include <QTableView>
#include <rdlog_line.h>
class DropTableView : public QTableView
class LogTableView : public QTableView
{
Q_OBJECT
public:
DropTableView(QWidget *parent);
LogTableView(QWidget *parent);
signals:
void cartDropped(int line,RDLogLine *ll);
@ -41,7 +42,21 @@ class DropTableView : public QTableView
void dragEnterEvent(QDragEnterEvent *e);
void dragMoveEvent(QDragMoveEvent *e);
void dropEvent(QDropEvent *e);
void mousePressEvent(QMouseEvent *e);
private slots:
void aboutToShowMenuData();
void setPlayData();
void setSegueData();
void setStopData();
private:
int d_mouse_row;
QMenu *d_mouse_menu;
QAction *d_play_action;
QAction *d_segue_action;
QAction *d_stop_action;
};
#endif // DROP_TABLEVIEW_H
#endif // LOGTABLEVIEW_H

View File

@ -25,7 +25,6 @@
#
SOURCES += add_meta.cpp
SOURCES += drop_tableview.cpp
SOURCES += edit_chain.cpp
SOURCES += edit_log.cpp
SOURCES += edit_logline.cpp
@ -34,12 +33,12 @@ SOURCES += edit_track.cpp
SOURCES += list_listviewitem.cpp
SOURCES += list_reports.cpp
SOURCES += logmodel.cpp
SOURCES += logtableview.cpp
SOURCES += rdlogedit.cpp
SOURCES += render_dialog.cpp
SOURCES += voice_tracker.cpp
HEADERS += add_meta.h
HEADERS += drop_tableview.h
HEADERS += edit_chain.h
HEADERS += edit_log.h
HEADERS += edit_logline.h
@ -49,6 +48,7 @@ HEADERS += globals.h
HEADERS += list_listviewitem.h
HEADERS += list_reports.h
HEADERS += logmodel.h
HEADERS += logtableview.h
HEADERS += rdlogedit.h
HEADERS += render_dialog.h
HEADERS += voice_tracker.h

View File

@ -763,6 +763,21 @@ vybrané služby!</translation>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LogTableView</name>
<message>
<source>PLAY Transition</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>SEGUE Transition</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>STOP Transition</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWidget</name>
<message>

View File

@ -763,6 +763,21 @@ Gruppe des ausgewählten Service!</translation>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LogTableView</name>
<message>
<source>PLAY Transition</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>SEGUE Transition</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>STOP Transition</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWidget</name>
<message>

View File

@ -767,6 +767,21 @@ desactivado para el servicio especificado!</translation>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LogTableView</name>
<message>
<source>PLAY Transition</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>SEGUE Transition</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>STOP Transition</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWidget</name>
<message>

View File

@ -363,6 +363,21 @@ group for the specified service!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LogTableView</name>
<message>
<source>PLAY Transition</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>SEGUE Transition</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>STOP Transition</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWidget</name>
<message>

View File

@ -777,6 +777,21 @@ som er skrudd av for denne tenesta!</translation>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LogTableView</name>
<message>
<source>PLAY Transition</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>SEGUE Transition</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>STOP Transition</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWidget</name>
<message>

View File

@ -777,6 +777,21 @@ som er skrudd av for denne tenesta!</translation>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LogTableView</name>
<message>
<source>PLAY Transition</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>SEGUE Transition</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>STOP Transition</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWidget</name>
<message>

View File

@ -769,6 +769,21 @@ Ação se Evento anterior estiver sendo executado</translation>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LogTableView</name>
<message>
<source>PLAY Transition</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>SEGUE Transition</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>STOP Transition</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWidget</name>
<message>