diff --git a/ChangeLog b/ChangeLog index d01c3fef..023d086a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 + * Added an 'RDIconEngine::serviceIcon()' method. + * Added icons to the list of services in the 'List Services' dialog + in rdadmin(1). diff --git a/icons/Makefile.am b/icons/Makefile.am index f0de276e..03ab3ff6 100644 --- a/icons/Makefile.am +++ b/icons/Makefile.am @@ -2,7 +2,7 @@ ## ## icons/automake.am for Rivendell ## -## (C) Copyright 2002-2006,2016-2017 Fred Gleason +## (C) Copyright 2002-2022 Fred Gleason ## ## 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\ diff --git a/icons/service-16x16.xpm b/icons/service-16x16.xpm new file mode 100644 index 00000000..c1148a6b --- /dev/null +++ b/icons/service-16x16.xpm @@ -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 ", +" "}; diff --git a/lib/rdiconengine.cpp b/lib/rdiconengine.cpp index 82c36dde..28f02a95 100644 --- a/lib/rdiconengine.cpp +++ b/lib/rdiconengine.cpp @@ -2,7 +2,7 @@ // // Icon generator for Rivendell // -// (C) Copyright 2021 Fred Gleason +// (C) Copyright 2021-2022 Fred Gleason // // 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; diff --git a/lib/rdiconengine.h b/lib/rdiconengine.h index 147fae5a..29fb468d 100644 --- a/lib/rdiconengine.h +++ b/lib/rdiconengine.h @@ -2,7 +2,7 @@ // // Icon generator for Rivendell // -// (C) Copyright 2020-2021 Fred Gleason +// (C) Copyright 2020-2022 Fred Gleason // // 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 d_catch_icons; QList d_list_icons; QPixmap d_station_icon; + QPixmap d_service_icon; QMap log_type_icons; QPixmap log_track_cart_icon; QMap d_user_icons; diff --git a/lib/rdservicelistmodel.cpp b/lib/rdservicelistmodel.cpp index a3802197..1ffac3a7 100644 --- a/lib/rdservicelistmodel.cpp +++ b/lib/rdservicelistmodel.cpp @@ -2,7 +2,7 @@ // // Data model for Rivendell services // -// (C) Copyright 2021 Fred Gleason +// (C) Copyright 2021-2022 Fred Gleason // // 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;inext()) { 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 texts; + QList 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; } diff --git a/lib/rdservicelistmodel.h b/lib/rdservicelistmodel.h index 8a6501f6..f3d17304 100644 --- a/lib/rdservicelistmodel.h +++ b/lib/rdservicelistmodel.h @@ -2,7 +2,7 @@ // // Data model for Rivendell services // -// (C) Copyright 2021 Fred Gleason +// (C) Copyright 2021-2022 Fred Gleason // // 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 #include #include +#include #include #include @@ -72,6 +73,8 @@ class RDServiceListModel : public QAbstractTableModel QList d_headers; QList d_alignments; QList > d_texts; + QList > d_icons; + QMap d_group_color_map; };