Rivendellaudio/rdlogmanager/clock_listview.cpp
Fred Gleason 8637def359 2020-04-18 Fred Gleason <fredg@paravelsystems.com>
* Removed the 'EVENTS.PROPERTIES' field from the database.
	* Incremented the database version to 316.
	* Removed the 'RDEventLine::properties()' and
	'RDEventLine::setProperties()' methods.
	* Added 'RDEventLine::propertiesText()' methods.
	* Added a 'Trans' column to the event list in the 'Edit Clock'
	dialog in rdlogmanager(1).
	* Added a 'Trans' column to the event list in the 'List Events'
	dialog in rdlogmanager(1).

Signed-off-by: Fred Gleason <fredg@paraelsystems.com>
2020-04-18 10:09:20 -04:00

81 lines
2.0 KiB
C++

// clock_listview.cpp
//
// The Clock Carts ListView widget for RDLogManager.
//
// (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 <q3dragobject.h>
#include <q3header.h>
#include <QMouseEvent>
#include <rdcart.h>
#include "clock_listview.h"
#include "edit_note.h"
ClockListView::ClockListView(QWidget *parent)
: RDListView(parent)
{
clock_parent=parent;
//
// Right Button Menu
//
clock_menu=new Q3PopupMenu(this);
connect(clock_menu,SIGNAL(aboutToShow()),this,SLOT(aboutToShowData()));
clock_menu->
insertItem(tr("Edit Event"),this,SLOT(editEventData()),0,0);
}
void ClockListView::aboutToShowData()
{
clock_menu->setItemEnabled(0,(clock_menu_item!=NULL)&&
(!clock_menu_item->text(5).isEmpty()));
}
void ClockListView::editEventData()
{
emit editLine(clock_menu_item->text(5).toInt());
}
void ClockListView::contentsMousePressEvent(QMouseEvent *e)
{
Q3ListView::contentsMousePressEvent(e);
clock_menu_item=(RDListViewItem *)selectedItem();
switch(e->button()) {
case Qt::RightButton:
clock_menu->setGeometry(clock_parent->geometry().x()+
geometry().x()+e->pos().x()+2,
clock_parent->geometry().y()+
geometry().y()+e->pos().y()+
header()->geometry().height()+2-
contentsY(),
clock_menu->sizeHint().width(),
clock_menu->sizeHint().height());
clock_menu->exec();
break;
default:
e->ignore();
break;
}
}