Rivendellaudio/lib/rdpanel_button.h
Fred Gleason 5e61a36076 2024-04-02 Fred Gleason <fredg@paravelsystems.com>
* Modified the Sound Panel classes to use native Qt JSON methods.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
2024-04-03 12:42:00 -04:00

142 lines
3.9 KiB
C++

// rdpanel_button.h
//
// Component class for sound panel widgets.
//
// (C) Copyright 2002-2024 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.
//
#ifndef RDPANEL_BUTTON_H
#define RDPANEL_BUTTON_H
#include <rdplay_deck.h>
#include <rdpushbutton.h>
//
// Widget Settings
//
#define PANEL_BUTTON_SIZE_X 88
#define PANEL_BUTTON_SIZE_Y 80
#define RDPANEL_BUTTON_MARGIN 5
class RDPanelButton : public RDPushButton
{
Q_OBJECT
public:
RDPanelButton(int row,int col,RDStation *station,bool flash,QWidget *parent);
void clear();
int row() const;
int column() const;
int dbId() const;
void setDbId(int id);
QString text() const;
void setText(const QString &text);
QString outputText() const;
void setOutputText(const QString &text);
bool state() const;
void setState(bool state);
QColor defaultColor() const;
void setDefaultColor(QColor color);
RDLogLine::StartSource startSource() const;
void setStartSource(RDLogLine::StartSource src);
void setColor(QColor color);
unsigned cart() const;
void setCart(unsigned cart);
QString cutName() const;
void setCutName(const QString &name);
int deck() const;
void setDeck(int deck);
QTime startTime() const;
void setStartTime(QTime time);
bool hookMode() const;
void setHookMode(bool state);
RDPlayDeck *playDeck() const;
void setPlayDeck(RDPlayDeck *deck);
int output() const;
void setOutput(int outnum);
int length(bool hookmode) const;
void setLength(bool hookmode, int msecs);
void setActiveLength(int msecs);
void reset();
bool pauseWhenFinished() const;
void setPauseWhenFinished(bool pause_when_finished);
int duckVolume() const;
void setDuckVolume(int lvel);
void setAllowDrags(bool state);
void resetCounter();
bool isEmpty() const;
bool isActive() const;
QJsonValue json() const;
void setVisible(bool state);
signals:
void cartDropped(int row,int col,unsigned cartnum,const QColor &color,
const QString &title);
public slots:
void tickClock();
void flashButton(bool state);
private slots:
void keyPressEvent(QKeyEvent *e);
void keyReleaseEvent(QKeyEvent *e);
void resizeEvent(QResizeEvent *e);
protected:
void mousePressEvent(QMouseEvent *e);
void mouseMoveEvent(QMouseEvent *e);
void mouseReleaseEvent(QMouseEvent *e);
void dragEnterEvent(QDragEnterEvent *e);
void dropEvent(QDropEvent *e);
private:
void WriteKeycap(int secs);
QString WrapText(QString text,int *lines);
QString GetNextLine(QString *str,const QFontMetrics &m,int len);
QColor button_default_color;
QWidget *button_parent;
QString button_text;
QString button_formatted_text;
QString button_output_text;
QColor button_color;
unsigned button_cart;
QString button_cutname;
int button_deck;
QTime button_start_time;
bool button_hook_mode;
QTime button_end_time;
int button_length[2];
int button_active_length;
int button_msecs;
RDStation *button_station;
RDPlayDeck *button_play_deck;
int button_output;
bool button_flash;
bool button_flashing;
bool button_flash_state;
bool button_state;
bool button_pause_when_finished;
int button_duck_volume;
RDLogLine::StartSource button_start_source;
int button_row;
int button_col;
int button_db_id;
int button_move_count;
bool button_allow_drags;
};
#endif // RDPANEL_BUTTON_H