mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-07-25 08:58:13 +02:00
2018-11-09 Fred Gleason <fredg@paravelsystems.com>
* Restored cart note bubbles in rdlibrary(1).
This commit is contained in:
parent
85a7704854
commit
25a76c014b
@ -17999,3 +17999,5 @@
|
||||
* Tweaked layout and appearance of the status bubble in rdmonitor(1).
|
||||
2018-11-09 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Removed superceded 'StatusTip' class from rdmonitor(1).
|
||||
2018-11-09 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Restored cart note bubbles in rdlibrary(1).
|
||||
|
@ -56,6 +56,7 @@ dist_rdlibrary_SOURCES = audio_cart.cpp audio_cart.h\
|
||||
lib_listview.cpp lib_listview.h\
|
||||
list_reports.cpp list_reports.h\
|
||||
macro_cart.cpp macro_cart.h\
|
||||
notebubble.cpp notebubble.h\
|
||||
rdlibrary.cpp rdlibrary.h\
|
||||
record_cut.cpp record_cut.h\
|
||||
validate_cut.cpp validate_cut.h
|
||||
@ -72,6 +73,7 @@ nodist_rdlibrary_SOURCES = moc_audio_cart.cpp\
|
||||
moc_lib_listview.cpp\
|
||||
moc_list_reports.cpp\
|
||||
moc_macro_cart.cpp\
|
||||
moc_notebubble.cpp\
|
||||
moc_rdlibrary.cpp\
|
||||
moc_record_cut.cpp
|
||||
|
||||
|
@ -1,44 +0,0 @@
|
||||
// cart_tip.cpp
|
||||
//
|
||||
// Custom ToolTip for RDLibrary's Cart List
|
||||
//
|
||||
// (C) Copyright 2009,2016 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 <rdcart.h>
|
||||
|
||||
#include <cart_tip.h>
|
||||
|
||||
CartTip::CartTip(QWidget *widget,QToolTipGroup *group)
|
||||
: QToolTip(widget,group)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void CartTip::setCartNumber(const QRect &item_rect,unsigned cartnum)
|
||||
{
|
||||
RDCart *cart=new RDCart(cartnum);
|
||||
tip_notes=cart->notes();
|
||||
delete cart;
|
||||
tip_item_rect=item_rect;
|
||||
tip_cart_number=cartnum;
|
||||
}
|
||||
|
||||
|
||||
void CartTip::maybeTip(const QPoint &pt)
|
||||
{
|
||||
tip(tip_item_rect,tip_notes);
|
||||
}
|
@ -30,6 +30,28 @@ LibListView::LibListView(QWidget *parent)
|
||||
: RDListView(parent)
|
||||
{
|
||||
list_move_count=-1;
|
||||
list_note_bubbles_enabled=false;
|
||||
|
||||
list_note_bubble=new NoteBubble(this);
|
||||
list_note_bubble->hide();
|
||||
}
|
||||
|
||||
|
||||
bool LibListView::noteBubblesEnabled() const
|
||||
{
|
||||
return list_note_bubbles_enabled;
|
||||
}
|
||||
|
||||
|
||||
void LibListView::enableNoteBubbles(bool state)
|
||||
{
|
||||
list_note_bubbles_enabled=state;
|
||||
}
|
||||
|
||||
|
||||
void LibListView::leaveEvent(QEvent *e)
|
||||
{
|
||||
list_note_bubble->hide();
|
||||
}
|
||||
|
||||
|
||||
@ -42,10 +64,39 @@ void LibListView::contentsMousePressEvent(QMouseEvent *e)
|
||||
|
||||
void LibListView::contentsMouseMoveEvent(QMouseEvent *e)
|
||||
{
|
||||
RDListViewItem *item=NULL;
|
||||
|
||||
Q3ListView::contentsMouseMoveEvent(e);
|
||||
|
||||
//
|
||||
// Note Bubbles
|
||||
//
|
||||
if(list_note_bubbles_enabled) {
|
||||
if((item=(RDListViewItem *)itemAt(contentsToViewport(e->pos())))!=NULL) {
|
||||
unsigned cartnum=item->text(1).left(6).toUInt();
|
||||
if(cartnum!=list_note_bubble->cartNumber()) {
|
||||
list_note_bubble->setCartNumber(cartnum);
|
||||
QRect box(contentsToViewport(e->pos()).x(),
|
||||
itemRect(item).y()+itemRect(item).height(),
|
||||
list_note_bubble->sizeHint().width(),
|
||||
list_note_bubble->sizeHint().height());
|
||||
if((box.x()+box.width())>width()) {
|
||||
box.moveLeft(width()-box.width()-20);
|
||||
}
|
||||
if((box.y()+box.height())>height()) {
|
||||
box.moveTop(height()-box.height()-20);
|
||||
}
|
||||
list_note_bubble->setGeometry(box);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Drag-n-Drop
|
||||
//
|
||||
list_move_count--;
|
||||
if(list_move_count==0) {
|
||||
RDListViewItem *item=(RDListViewItem *)selectedItem();
|
||||
item=(RDListViewItem *)selectedItem();
|
||||
|
||||
if(item==NULL) {
|
||||
return;
|
||||
|
@ -23,18 +23,27 @@
|
||||
|
||||
#include <rdlistview.h>
|
||||
|
||||
#include "notebubble.h"
|
||||
|
||||
class LibListView : public RDListView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LibListView(QWidget *parent);
|
||||
bool noteBubblesEnabled() const;
|
||||
|
||||
public slots:
|
||||
void enableNoteBubbles(bool state);
|
||||
|
||||
protected:
|
||||
void leaveEvent(QEvent *e);
|
||||
void contentsMousePressEvent(QMouseEvent *e);
|
||||
void contentsMouseMoveEvent(QMouseEvent *e);
|
||||
void contentsMouseReleaseEvent(QMouseEvent *e);
|
||||
|
||||
private:
|
||||
NoteBubble *list_note_bubble;
|
||||
bool list_note_bubbles_enabled;
|
||||
int list_move_count;
|
||||
};
|
||||
|
||||
|
68
rdlibrary/notebubble.cpp
Normal file
68
rdlibrary/notebubble.cpp
Normal file
@ -0,0 +1,68 @@
|
||||
// notebubble.cpp
|
||||
//
|
||||
// Bubble for displaying a cart note
|
||||
//
|
||||
// (C) Copyright 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
|
||||
// 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 <rd.h>
|
||||
#include <rddb.h>
|
||||
|
||||
#include "notebubble.h"
|
||||
|
||||
NoteBubble::NoteBubble(QWidget *parent)
|
||||
: QLabel(parent,(Qt::WindowFlags)(Qt::WStyle_Customize|
|
||||
Qt::WStyle_NoBorder|
|
||||
Qt::WStyle_StaysOnTop))
|
||||
{
|
||||
note_cart_number=0;
|
||||
|
||||
setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
|
||||
setWordWrap(true);
|
||||
setMargin(5);
|
||||
setStyleSheet(QString("background-color:")+RD_STATUS_BACKGROUND_COLOR);
|
||||
|
||||
note_show_timer=new QTimer(this);
|
||||
note_show_timer->setSingleShot(true);
|
||||
connect(note_show_timer,SIGNAL(timeout()),this,SLOT(show()));
|
||||
}
|
||||
|
||||
|
||||
unsigned NoteBubble::cartNumber() const
|
||||
{
|
||||
return note_cart_number;
|
||||
}
|
||||
|
||||
|
||||
bool NoteBubble::setCartNumber(unsigned cartnum)
|
||||
{
|
||||
bool ret=false;
|
||||
|
||||
note_show_timer->stop();
|
||||
hide();
|
||||
QString sql=QString("select NOTES from CART where ")+
|
||||
QString().sprintf("NUMBER=%u",cartnum);
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
if(q->first()&&(!q->value(0).toString().trimmed().isEmpty())) {
|
||||
setText(q->value(0).toString());
|
||||
note_show_timer->start(1000);
|
||||
ret=true;
|
||||
}
|
||||
delete q;
|
||||
note_cart_number=cartnum;
|
||||
|
||||
return ret;
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
// cart_tip.h
|
||||
// notebubble.h
|
||||
//
|
||||
// Custom ToolTip for RDLibrary's Cart List
|
||||
// Bubble for displaying a cart note
|
||||
//
|
||||
// (C) Copyright 2009,2016 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 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
|
||||
@ -18,24 +18,24 @@
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#ifndef CART_TIP_H
|
||||
#define CART_TIP_H
|
||||
#ifndef NOTEBUBBLE_H
|
||||
#define NOTEBUBBLE_H
|
||||
|
||||
#include <qtooltip.h>
|
||||
#include <qlabel.h>
|
||||
#include <qtimer.h>
|
||||
|
||||
class CartTip : public QToolTip
|
||||
class NoteBubble : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CartTip(QWidget *widget,QToolTipGroup *group=0);
|
||||
void setCartNumber(const QRect &item_rect,unsigned cartnum);
|
||||
|
||||
protected:
|
||||
void maybeTip(const QPoint &pt);
|
||||
NoteBubble(QWidget *parent=0);
|
||||
unsigned cartNumber() const;
|
||||
bool setCartNumber(unsigned cartnum);
|
||||
|
||||
private:
|
||||
unsigned tip_cart_number;
|
||||
QRect tip_item_rect;
|
||||
QString tip_notes;
|
||||
unsigned note_cart_number;
|
||||
QTimer *note_show_timer;
|
||||
};
|
||||
|
||||
#endif // CART_TIP_H
|
||||
|
||||
#endif // NOTEBUBBLE_H
|
@ -324,7 +324,7 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
lib_cart_list->setItemMargin(5);
|
||||
lib_cart_list->setSelectionMode(Q3ListView::Extended);
|
||||
lib_cart_list->setRootIsDecorated(true);
|
||||
// lib_cart_tip=new CartTip(lib_cart_list->viewport());
|
||||
lib_cart_list->enableNoteBubbles(true);
|
||||
connect(lib_cart_list,
|
||||
SIGNAL(doubleClicked(Q3ListViewItem *,const QPoint &,int)),
|
||||
this,
|
||||
@ -333,6 +333,8 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
this,SLOT(cartClickedData()));
|
||||
connect(lib_cart_list,SIGNAL(onItem(Q3ListViewItem *)),
|
||||
this,SLOT(cartOnItemData(Q3ListViewItem *)));
|
||||
connect(lib_shownotes_box,SIGNAL(toggled(bool)),
|
||||
lib_cart_list,SLOT(enableNoteBubbles(bool)));
|
||||
lib_cart_list->addColumn("");
|
||||
lib_cart_list->setColumnAlignment(Icon,Qt::AlignHCenter);
|
||||
lib_cart_list->addColumn(tr("Cart"));
|
||||
|
@ -44,7 +44,6 @@
|
||||
|
||||
#include <rdconfig.h>
|
||||
|
||||
//#include "cart_tip.h"
|
||||
#include "disk_gauge.h"
|
||||
#include "lib_listview.h"
|
||||
|
||||
@ -120,7 +119,6 @@ class MainWidget : public QWidget
|
||||
bool UnlockUser();
|
||||
void SendNotification(RDNotification::Action action,unsigned cartnum);
|
||||
LibListView *lib_cart_list;
|
||||
// CartTip *lib_cart_tip;
|
||||
QString lib_filter_text;
|
||||
QString lib_search_text;
|
||||
QPixmap *lib_playout_map;
|
||||
|
Loading…
x
Reference in New Issue
Block a user