mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-10 16:43:35 +02:00
2022-05-02 Fred Gleason <fredg@paravelsystems.com>
* Added an 'RDIconEngine::serviceIcon()' method. * Added icons to the list of services in the 'List Services' dialog in rdadmin(1). Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// Icon generator for Rivendell
|
||||
//
|
||||
// (C) Copyright 2021 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2021-2022 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
|
||||
@@ -119,6 +119,7 @@
|
||||
#include "../icons/download.xpm"
|
||||
|
||||
#include "../icons/host-16x16.xpm"
|
||||
#include "../icons/service-16x16.xpm"
|
||||
|
||||
#include "../icons/play.xpm"
|
||||
#include "../icons/rml5.xpm"
|
||||
@@ -279,6 +280,11 @@ RDIconEngine::RDIconEngine()
|
||||
d_list_icons.push_back(QPixmap(upload_xpm));
|
||||
d_list_icons.push_back(QPixmap(download_xpm));
|
||||
|
||||
//
|
||||
// Create Service Icon
|
||||
//
|
||||
d_service_icon=QPixmap(service_16x16_xpm);
|
||||
|
||||
//
|
||||
// Create Station Icon
|
||||
//
|
||||
@@ -325,6 +331,12 @@ QPixmap RDIconEngine::listIcon(RDIconEngine::IconType type) const
|
||||
}
|
||||
|
||||
|
||||
QPixmap RDIconEngine::serviceIcon() const
|
||||
{
|
||||
return d_service_icon;
|
||||
}
|
||||
|
||||
|
||||
QPixmap RDIconEngine::stationIcon() const
|
||||
{
|
||||
return d_station_icon;
|
||||
|
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// Icon generator for Rivendell
|
||||
//
|
||||
// (C) Copyright 2020-2021 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2020-2022 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
|
||||
@@ -41,6 +41,7 @@ class RDIconEngine
|
||||
QPixmap applicationIcon(Application app,int edge_size) const;
|
||||
QPixmap catchIcon(RDRecording::Type type);
|
||||
QPixmap listIcon(IconType type) const;
|
||||
QPixmap serviceIcon() const;
|
||||
QPixmap stationIcon() const;
|
||||
QPixmap nullIcon(int edge_size) const;
|
||||
QPixmap typeIcon(RDLogLine::Type type,
|
||||
@@ -52,6 +53,7 @@ class RDIconEngine
|
||||
QList<QPixmap> d_catch_icons;
|
||||
QList<QPixmap> d_list_icons;
|
||||
QPixmap d_station_icon;
|
||||
QPixmap d_service_icon;
|
||||
QMap<RDLogLine::Type,QPixmap> log_type_icons;
|
||||
QPixmap log_track_cart_icon;
|
||||
QMap<RDUser::Type,QPixmap> d_user_icons;
|
||||
|
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// Data model for Rivendell services
|
||||
//
|
||||
// (C) Copyright 2021 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2021-2022 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
|
||||
@@ -27,6 +27,19 @@ RDServiceListModel::RDServiceListModel(bool incl_none,QObject *parent)
|
||||
{
|
||||
d_include_none=incl_none;
|
||||
|
||||
//
|
||||
// Load Color Map
|
||||
//
|
||||
QString sql=QString("select ")+
|
||||
"`NAME`,"+ // 00
|
||||
"`COLOR` "+ // 01
|
||||
"from `GROUPS`";
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
while(q->next()) {
|
||||
d_group_color_map[q->value(0).toString()]=QColor(q->value(1).toString());
|
||||
}
|
||||
delete q;
|
||||
|
||||
//
|
||||
// Column Attributes
|
||||
//
|
||||
@@ -124,20 +137,22 @@ QVariant RDServiceListModel::data(const QModelIndex &index,int role) const
|
||||
return d_texts.at(row).at(col);
|
||||
|
||||
case Qt::DecorationRole:
|
||||
// Nothing to do!
|
||||
break;
|
||||
return d_icons.at(row).at(col);
|
||||
|
||||
case Qt::TextAlignmentRole:
|
||||
return d_alignments.at(col);
|
||||
|
||||
case Qt::FontRole:
|
||||
if(col==0) {
|
||||
if((col==0)||(col==3)) {
|
||||
return d_bold_font;
|
||||
}
|
||||
return d_font;
|
||||
|
||||
case Qt::TextColorRole:
|
||||
// Nothing to do!
|
||||
if(col==3) { // Track Group
|
||||
return d_group_color_map.value(d_texts.at(row).at(col).toString(),
|
||||
QVariant());
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::BackgroundRole:
|
||||
@@ -178,6 +193,7 @@ QModelIndex RDServiceListModel::addService(const QString &svcname)
|
||||
}
|
||||
list[0]=svcname;
|
||||
d_texts.insert(offset,list);
|
||||
d_icons.insert(offset,list);
|
||||
updateRowLine(offset);
|
||||
endInsertRows();
|
||||
|
||||
@@ -190,6 +206,7 @@ void RDServiceListModel::removeService(const QModelIndex &row)
|
||||
beginRemoveRows(QModelIndex(),row.row(),row.row());
|
||||
|
||||
d_texts.removeAt(row.row());
|
||||
d_icons.removeAt(row.row());
|
||||
|
||||
endRemoveRows();
|
||||
}
|
||||
@@ -243,16 +260,21 @@ void RDServiceListModel::updateModel()
|
||||
sql+="order by NAME ";
|
||||
beginResetModel();
|
||||
d_texts.clear();
|
||||
d_icons.clear();
|
||||
if(d_include_none) {
|
||||
d_texts.push_back(texts);
|
||||
d_icons.push_back(texts);
|
||||
d_texts.back().push_back(tr("[none]"));
|
||||
d_icons.back().push_back(QVariant());
|
||||
for(int i=1;i<columnCount();i++) {
|
||||
d_texts.back().push_back(QVariant());
|
||||
d_icons.back().push_back(QVariant());
|
||||
}
|
||||
}
|
||||
q=new RDSqlQuery(sql);
|
||||
while(q->next()) {
|
||||
d_texts.push_back(texts);
|
||||
d_icons.push_back(texts);
|
||||
updateRow(d_texts.size()-1,q);
|
||||
}
|
||||
delete q;
|
||||
@@ -277,35 +299,51 @@ void RDServiceListModel::updateRowLine(int line)
|
||||
void RDServiceListModel::updateRow(int row,RDSqlQuery *q)
|
||||
{
|
||||
QList<QVariant> texts;
|
||||
QList<QVariant> icons;
|
||||
|
||||
// Login Name
|
||||
// Service Name
|
||||
texts.push_back(q->value(0));
|
||||
|
||||
icons.push_back(rda->iconEngine()->serviceIcon());
|
||||
|
||||
// Description
|
||||
texts.push_back(q->value(1));
|
||||
icons.push_back(QVariant());
|
||||
|
||||
// Program Code
|
||||
texts.push_back(q->value(2));
|
||||
icons.push_back(QVariant());
|
||||
|
||||
// Track Group
|
||||
texts.push_back(q->value(3));
|
||||
if(q->value(3).toString().isEmpty()) {
|
||||
icons.push_back(QVariant());
|
||||
}
|
||||
else {
|
||||
icons.push_back(rda->iconEngine()->typeIcon(RDLogLine::Cart));
|
||||
}
|
||||
|
||||
// Log Shelf Life
|
||||
texts.push_back(q->value(4));
|
||||
icons.push_back(QVariant());
|
||||
|
||||
// ELR Shelf Life
|
||||
texts.push_back(q->value(5));
|
||||
icons.push_back(QVariant());
|
||||
|
||||
// Auto Refresh
|
||||
texts.push_back(q->value(6));
|
||||
icons.push_back(QVariant());
|
||||
|
||||
// Chain Log
|
||||
texts.push_back(q->value(7));
|
||||
icons.push_back(QVariant());
|
||||
|
||||
// Import Markers
|
||||
texts.push_back(q->value(8));
|
||||
icons.push_back(QVariant());
|
||||
|
||||
d_texts[row]=texts;
|
||||
d_icons[row]=icons;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// Data model for Rivendell services
|
||||
//
|
||||
// (C) Copyright 2021 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2021-2022 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
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <QAbstractTableModel>
|
||||
#include <QFont>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QPalette>
|
||||
|
||||
#include <rddb.h>
|
||||
@@ -72,6 +73,8 @@ class RDServiceListModel : public QAbstractTableModel
|
||||
QList<QVariant> d_headers;
|
||||
QList<QVariant> d_alignments;
|
||||
QList<QList<QVariant> > d_texts;
|
||||
QList<QList<QVariant> > d_icons;
|
||||
QMap<QString,QVariant> d_group_color_map;
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user