mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-04-07 01:13:50 +02:00
2020-02-18 Fred Gleason <fredg@paravelsystems.com>
* Removed the 'RDLabel' widget.
This commit is contained in:
parent
f54d414f6f
commit
919141c27c
@ -19649,3 +19649,5 @@
|
||||
2020-02-18 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Fixed a bug in rdairplay(1) that could cause random segfaults
|
||||
when updating the Label Widget.
|
||||
2020-02-18 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Removed the 'RDLabel' widget.
|
||||
|
@ -147,7 +147,6 @@ dist_librd_la_SOURCES = dbversion.h\
|
||||
rdinstancelock.cpp rdinstancelock.h\
|
||||
rd.h\
|
||||
rdkernelgpio.cpp rdkernelgpio.h\
|
||||
rdlabel.cpp rdlabel.h\
|
||||
rdlibrary_conf.cpp rdlibrary_conf.h\
|
||||
rdlineedit.cpp rdlineedit.h\
|
||||
rdlistselector.cpp rdlistselector.h\
|
||||
@ -293,7 +292,6 @@ nodist_librd_la_SOURCES = moc_rdadd_cart.cpp\
|
||||
moc_rdhotkeylist.cpp\
|
||||
moc_rdimport_audio.cpp\
|
||||
moc_rdkernelgpio.cpp\
|
||||
moc_rdlabel.cpp\
|
||||
moc_rdlineedit.cpp\
|
||||
moc_rdlist_groups.cpp\
|
||||
moc_rdlist_logs.cpp\
|
||||
|
@ -104,7 +104,6 @@ SOURCES += rdhash.cpp
|
||||
SOURCES += rdidvalidator.cpp
|
||||
SOURCES += rdimport_audio.cpp
|
||||
SOURCES += rdkernelgpio.cpp
|
||||
SOURCES += rdlabel.cpp
|
||||
SOURCES += rdlibrary_conf.cpp
|
||||
SOURCES += rdlineedit.cpp
|
||||
SOURCES += rdlist_logs.cpp
|
||||
@ -242,7 +241,6 @@ HEADERS += rdhash.h
|
||||
HEADERS += rdidvalidator.h
|
||||
HEADERS += rdimport_audio.h
|
||||
HEADERS += rdkernelgpio.h
|
||||
HEADERS += rdlabel.h
|
||||
HEADERS += rdlibrary_conf.h
|
||||
HEADERS += rdlineedit.h
|
||||
HEADERS += rdlist_groups.h
|
||||
|
139
lib/rdlabel.cpp
139
lib/rdlabel.cpp
@ -1,139 +0,0 @@
|
||||
// rdlabel.cpp
|
||||
//
|
||||
// Multiline button labelling that is smart about spaces and the like
|
||||
//
|
||||
// (C) Copyright 2002,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 Library 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 <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <qwidget.h>
|
||||
#include <qlabel.h>
|
||||
#include <qpainter.h>
|
||||
#include <qcolor.h>
|
||||
#include <qpalette.h>
|
||||
#include <qsize.h>
|
||||
#include <qrect.h>
|
||||
#include <qpixmap.h>
|
||||
|
||||
#include <rdlabel.h>
|
||||
|
||||
|
||||
RDLabel::RDLabel(QWidget *parent,Qt::WFlags f)
|
||||
: QLabel(parent,"",f)
|
||||
{
|
||||
label_wrap=false;
|
||||
}
|
||||
|
||||
|
||||
RDLabel::RDLabel(const QString &text,QWidget *parent=0,Qt::WFlags f)
|
||||
: QLabel(text,parent,"",f)
|
||||
{
|
||||
label_wrap=false;
|
||||
label_text=text;
|
||||
QLabel::setText(WrapText());
|
||||
}
|
||||
|
||||
|
||||
RDLabel::RDLabel(QWidget *buddy,const QString &text,QWidget *parent,Qt::WFlags f)
|
||||
: QLabel(buddy,text,parent,"",f)
|
||||
{
|
||||
label_wrap=false;
|
||||
label_text=text;
|
||||
QLabel::setText(WrapText());
|
||||
}
|
||||
|
||||
|
||||
QString RDLabel::text() const
|
||||
{
|
||||
return label_text;
|
||||
}
|
||||
|
||||
|
||||
void RDLabel::setFont(const QFont &font)
|
||||
{
|
||||
label_font=font;
|
||||
QLabel::setFont(font);
|
||||
QLabel::setText(WrapText());
|
||||
}
|
||||
|
||||
|
||||
bool RDLabel::wordWrapEnabled() const
|
||||
{
|
||||
return label_wrap;
|
||||
}
|
||||
|
||||
|
||||
void RDLabel::setWordWrapEnabled(bool state)
|
||||
{
|
||||
label_wrap=state;
|
||||
QLabel::setText(WrapText());
|
||||
}
|
||||
|
||||
|
||||
void RDLabel::setText(const QString &string)
|
||||
{
|
||||
label_text=string;
|
||||
QLabel::setText(WrapText());
|
||||
}
|
||||
|
||||
|
||||
QString RDLabel::WrapText()
|
||||
{
|
||||
QFontMetrics fm(label_font);
|
||||
QString str;
|
||||
QString residue=label_text;
|
||||
bool space_found=false;
|
||||
int l;
|
||||
|
||||
if(label_wrap&&!label_text.isEmpty()) {
|
||||
while(!residue.isEmpty()) {
|
||||
space_found=false;
|
||||
for(int i=residue.length();i>=0;i--) {
|
||||
if((i==((int)residue.length()))||(residue.at(i).isSpace())) {
|
||||
if(fm.boundingRect(residue.left(i)).width()<=width()) {
|
||||
space_found=true;
|
||||
if(!str.isEmpty()) {
|
||||
str+="\n";
|
||||
}
|
||||
str+=residue.left(i);
|
||||
if(i==(int)residue.length()) {
|
||||
return str;
|
||||
}
|
||||
residue=residue.right(residue.length()-i-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!space_found) {
|
||||
l=residue.length();
|
||||
for(int i=l;i>=0;i--) {
|
||||
if(fm.boundingRect(residue.left(i)).width()<=width()) {
|
||||
if(!str.isEmpty()) {
|
||||
str+="\n";
|
||||
}
|
||||
str+=residue.left(i);
|
||||
if(i==(int)residue.length()) {
|
||||
return str;
|
||||
}
|
||||
residue=residue.right(residue.length()-i-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return label_text;
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
// rdlabel.h
|
||||
//
|
||||
// An label widget with word wrap.
|
||||
//
|
||||
// (C) Copyright 2002,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 Library 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 RDLABEL_H
|
||||
#define RDLABEL_H
|
||||
|
||||
#include <qwidget.h>
|
||||
#include <qlabel.h>
|
||||
#include <q3rangecontrol.h>
|
||||
#include <qcolor.h>
|
||||
#include <qpalette.h>
|
||||
#include <qsize.h>
|
||||
#include <qpixmap.h>
|
||||
|
||||
class RDLabel : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RDLabel(QWidget *parent=0,Qt::WFlags f=0);
|
||||
RDLabel(const QString &text,QWidget *parent,Qt::WFlags f=0);
|
||||
RDLabel(QWidget *buddy,const QString &text,QWidget *parent,Qt::WFlags f=0);
|
||||
QString text() const;
|
||||
void setFont(const QFont &font);
|
||||
bool wordWrapEnabled() const;
|
||||
void setWordWrapEnabled(bool state);
|
||||
|
||||
public slots:
|
||||
void setText(const QString &string);
|
||||
|
||||
private:
|
||||
QString WrapText();
|
||||
QString label_text;
|
||||
QFont label_font;
|
||||
bool label_wrap;
|
||||
};
|
||||
|
||||
|
||||
#endif // RDLABEL_H
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// Cart slot label widget for RDCartSlot
|
||||
//
|
||||
// (C) Copyright 2012-2019 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2012-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
|
||||
@ -32,7 +32,6 @@
|
||||
|
||||
#include <rdairplay_conf.h>
|
||||
#include <rdcartdrag.h>
|
||||
#include <rdlabel.h>
|
||||
#include <rdlog_line.h>
|
||||
#include <rdlog_event.h>
|
||||
#include <rdplaymeter.h>
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// Display System Information for Rivendell
|
||||
//
|
||||
// (C) Copyright 2002-2019 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (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
|
||||
@ -20,9 +20,10 @@
|
||||
|
||||
#include <qpushbutton.h>
|
||||
|
||||
#include <rdlabel.h>
|
||||
#include <rd.h>
|
||||
#include <qlabel.h>
|
||||
|
||||
#include <dbversion.h>
|
||||
#include <rd.h>
|
||||
|
||||
#include "info_dialog.h"
|
||||
#include "license.h"
|
||||
@ -38,8 +39,6 @@
|
||||
InfoDialog::InfoDialog(QWidget *parent)
|
||||
: RDDialog(parent)
|
||||
{
|
||||
setModal(true);
|
||||
|
||||
//
|
||||
// Fix the Window Size
|
||||
//
|
||||
@ -113,7 +112,7 @@ InfoDialog::InfoDialog(QWidget *parent)
|
||||
//
|
||||
// Disclaimer
|
||||
//
|
||||
label=new RDLabel(this);
|
||||
label=new QLabel(this);
|
||||
label->setGeometry(10,104,sizeHint().width()-20,60);
|
||||
label->setFont(subLabelFont());
|
||||
label->setWordWrap(true);
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// On Air Playout Utility for Rivendell.
|
||||
//
|
||||
// (C) Copyright 2002-2019 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (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
|
||||
@ -186,11 +186,11 @@ LogLineBox::LogLineBox(RDAirPlayConf *conf,QWidget *parent)
|
||||
//
|
||||
// Marker Comment
|
||||
//
|
||||
line_comment_label=new RDLabel(this);
|
||||
line_comment_label=new QLabel(this);
|
||||
line_comment_label->setGeometry(5,18,sizeHint().width()-10,62);
|
||||
line_comment_label->setFont(line_font);
|
||||
line_comment_label->setAlignment(Qt::AlignTop|Qt::AlignLeft);
|
||||
line_comment_label->setWordWrapEnabled(true);
|
||||
line_comment_label->setWordWrap(true);
|
||||
line_comment_label->hide();
|
||||
|
||||
//
|
||||
|
@ -23,11 +23,11 @@
|
||||
|
||||
#include <q3progressbar.h>
|
||||
|
||||
#include <qlabel.h>
|
||||
#include <qpixmap.h>
|
||||
|
||||
#include <rdairplay_conf.h>
|
||||
#include <rdcartdrag.h>
|
||||
#include <rdlabel.h>
|
||||
#include <rdlog_line.h>
|
||||
#include <rdlog_event.h>
|
||||
#include <rdwidget.h>
|
||||
@ -96,7 +96,7 @@ class LogLineBox : public RDWidget
|
||||
QLabel *line_talktime_label;
|
||||
QLabel *line_up_label;
|
||||
QLabel *line_down_label;
|
||||
RDLabel *line_comment_label;
|
||||
QLabel *line_comment_label;
|
||||
Q3ProgressBar *line_position_bar;
|
||||
QTimer *line_countdown_timer;
|
||||
QTime line_end_time;
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// mySQL Administrative Login widget for RDDbConfig
|
||||
//
|
||||
// (C) Copyright 2002-2019 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (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
|
||||
@ -18,10 +18,9 @@
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#include <qlabel.h>
|
||||
#include <qpushbutton.h>
|
||||
|
||||
#include <rdlabel.h>
|
||||
|
||||
#include "mysql_login.h"
|
||||
|
||||
MySqlLogin::MySqlLogin(QString *username,QString *password, QWidget *parent)
|
||||
@ -35,7 +34,7 @@ MySqlLogin::MySqlLogin(QString *username,QString *password, QWidget *parent)
|
||||
//
|
||||
// Message Label
|
||||
//
|
||||
RDLabel *label=new RDLabel(tr("Enter your MySQL administrator username and password\nThe Hostname and Database are found in /etc/rd.conf"),this);
|
||||
QLabel *label=new QLabel(tr("Enter your MySQL administrator username and password\nThe Hostname and Database are found in /etc/rd.conf"),this);
|
||||
label->setFont(labelFont());
|
||||
label->setGeometry(10,10,sizeHint().width()-20,30);
|
||||
label->setAlignment(Qt::AlignCenter);
|
||||
|
Loading…
x
Reference in New Issue
Block a user