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:
Fred Gleason 2022-05-02 14:48:57 -04:00
parent 8924459307
commit 64fbd52d2c
7 changed files with 135 additions and 11 deletions

View File

@ -23030,3 +23030,7 @@
widget to be positioned atop the log listing when the window width
was greater than 850 and the 'Extra Buttons/Counters' and 'Hour
Indicator' features were turned off.
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).

View File

@ -2,7 +2,7 @@
##
## icons/automake.am for Rivendell
##
## (C) Copyright 2002-2006,2016-2017 Fred Gleason <fredg@paravelsystems.com>
## (C) Copyright 2002-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
@ -485,6 +485,7 @@ EXTRA_DIST = admin.xpm\
rss.png\
rss.xcf\
rss.xpm\
service-16x16.xpm\
split.xpm\
switch.xpm\
switch2.xpm\

64
icons/service-16x16.xpm Normal file
View File

@ -0,0 +1,64 @@
/* XPM */
static const char * service_16x16_xpm[] = {
"16 16 45 1",
" c None",
". c #3D6CA7",
"+ c #6B6D68",
"@ c #696C68",
"# c #7B7C77",
"$ c #F9F9F9",
"% c #BFC1BF",
"& c #6C6E67",
"* c #7B7C76",
"= c #C3C6C3",
"- c #B4B6B4",
"; c #6F726A",
"> c #5D605B",
", c #626460",
"' c #5F615D",
") c #A4A5A3",
"! c #838682",
"~ c #D5D7D5",
"{ c #B0B3B0",
"] c #6F716D",
"^ c #D6D9D6",
"/ c #BEC2BE",
"( c #5D605C",
"_ c #A2A4A2",
": c #D5D8D5",
"< c #C2C6C1",
"[ c #828481",
"} c #ADAFAC",
"| c #D5D9D4",
"1 c #C4C9C4",
"2 c #919490",
"3 c #5F625E",
"4 c #CACCC9",
"5 c #9A9D99",
"6 c #929692",
"7 c #ABAFAA",
"8 c #5A5D58",
"9 c #616460",
"0 c #B7BAB7",
"a c #999D99",
"b c #5C5F5B",
"c c #71736F",
"d c #545752",
"e c #555852",
"f c #646763",
" ",
" ",
" . . +@ . . ",
" . .. #$%& .. . ",
" . .. *=-; .. . ",
" . . >> . . ",
" ,' ",
" )! ",
" ~{ ",
" ]^/( ",
" _:<[ ",
" }|12 ",
" 345678 ",
" 90 ab ",
" cd ef ",
" "};

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
};