2020-08-04 Fred Gleason <fredg@paravelsystems.com>

* Added an 'RDLogIcons' class.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2020-08-04 13:15:26 -04:00
parent 0cebad1f25
commit f76642d44e
3 changed files with 101 additions and 0 deletions

View File

@ -20142,3 +20142,5 @@
2020-08-04 Fred Gleason <fredg@paravelsystems.com>
* Fixed a fencepost bug in the 'RDRenderer::renderToFile()' method
with the 'last_line' parameter.
2020-08-04 Fred Gleason <fredg@paravelsystems.com>
* Added an 'RDLogIcons' class.

57
lib/rdlog_icons.cpp Normal file
View File

@ -0,0 +1,57 @@
// rdlog_icons.cpp
//
// Icons for Rivendell log events.
//
// (C) Copyright 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
// 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 "rdlog_icons.h"
//
// Icons
//
#include "../icons/play.xpm"
#include "../icons/rml5.xpm"
#include "../icons/chain.xpm"
#include "../icons/track_cart.xpm"
#include "../icons/notemarker.xpm"
#include "../icons/music.xpm"
#include "../icons/mic16.xpm"
#include "../icons/traffic.xpm"
RDLogIcons::RDLogIcons()
{
//
// Create Icons
//
log_type_icons[RDLogLine::Cart]=QPixmap(play_xpm);
log_type_icons[RDLogLine::Macro]=QPixmap(rml5_xpm);
log_type_icons[RDLogLine::Marker]=QPixmap(notemarker_xpm);
log_type_icons[RDLogLine::Chain]=QPixmap(chain_xpm);
log_type_icons[RDLogLine::Track]=QPixmap(mic16_xpm);
log_type_icons[RDLogLine::MusicLink]=QPixmap(music_xpm);
log_type_icons[RDLogLine::TrafficLink]=QPixmap(traffic_xpm);
log_track_cart_icon=QPixmap(track_cart_xpm);
}
QPixmap RDLogIcons::typeIcon(RDLogLine::Type type,RDLogLine::Source src) const
{
if((type==RDLogLine::Cart)&&(src==RDLogLine::Tracker)) {
return log_track_cart_icon;
}
return log_type_icons.value(type);
}

42
lib/rdlog_icons.h Normal file
View File

@ -0,0 +1,42 @@
// rdlog_icons.h
//
// Icons for Rivendell log events.
//
// (C) Copyright 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
// 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 RDLOG_ICONS_H
#define RDLOG_ICONS_H
#include <QMap>
#include <QPixmap>
#include <rdlog_line.h>
class RDLogIcons
{
public:
RDLogIcons();
QPixmap typeIcon(RDLogLine::Type type,
RDLogLine::Source src=RDLogLine::Manual) const;
private:
QMap<RDLogLine::Type,QPixmap> log_type_icons;
QPixmap log_track_cart_icon;
};
#endif // RDLOG_ICONS