CDPBaseClockDigi Class

The Digital Clock is a type of clock that displays the time numerically. More...

Header: #include <CDPBaseClockDigi>
Inherits: StateChanger, CDPBaseControlVisible,

Public Types

enum ClockSource { OSClock, CDPClock, CDPRouting }
typedef StylingSvgMap
enum StylingType { NoFile, CSS, SVG }

Properties

Public Functions

CDPBaseClockDigi(QWidget *parent = 0)
virtual QString cdpClockRouting()
virtual ClockSource cdpClockSource()
virtual QString cssFile()
virtual QString iconDown()
virtual QString iconUp()
virtual bool isClockSignalSelected()
virtual bool isCssStyling()
virtual bool isSvgStyling()
virtual void setCdpClockRouting(const QString &routing)
virtual void setCdpClockSource(ClockSource source)
virtual void setCssFile(QString cssFile)
void setIQtCDPPointer(IQtCDP *pIQtCDP) override
virtual void setIconDown(QString icon)
virtual void setIconUp(QString icon)
virtual void setStylingType(StylingType type)
virtual void setSvgFile(QString svg)
virtual StylingType stylingType()
virtual QString svgFile()
int widgetStyle()

Public Slots

virtual void handleVisible(double visible)
virtual void hideWidget()
void setInCommand(bool cmd) override
void setSmoothPixmap(bool smooth) override
void setTimeOffsetSecs(double timeOffsetSec) override
void setWidgetFont(const QString &font) override
void setWidgetStyle(int style) override
void setWidgetTheme(const QString &theme) override
virtual void showWidget()

Protected Functions

QString addUrl(QString path)
virtual bool eventFilter(QObject *obj, QEvent *event)
QString generatedStyleSheet()
double globalTimeOffsetMs()
void loadSvg()
virtual void setClockTimer(int time)
virtual void setDateTimer(int date)
virtual void timerEvent(QTimerEvent *event)
void updateDateTime()
void updateDateTimeFromCdpClock()
void updateDateTimeFromCdpSignal()
void updateDateTimeFromOS()
void updateTextColorFromSvg()

Protected Slots

const QString &getCurrentDownIcon(bool isSvg)
const QString &getCurrentUpIcon(bool isSvg)

Detailed Description

The Digital Clock is a type of clock that displays the time numerically.

The clock can show time based on multiple clock sources. In the cdpClockSource property, the user can select to show time based on OS clock, CDP synch protocol or from the CDP object/property routed in cdpClockRouting.

The value routed in via cdpClockRouting is assumed to be a double value containing time since epoch (number of seconds that have passed since 1970-01-01 00:00:00.000, Coordinated Universal Time (UTC).

When clicked, the clock opens a global dialog for setting a local time offset. The time offset will affect other widgets that implements and uses the time offset part of the interface. The Event List and Analog Clock are examples of other widgets that implements the time offset.

Note: that CDPBaseMainWindow includes a property to enable external control of the time offset property as described in the above. The property is named timeOffsetRouting and works in both directions.

Styling by SVG

Use the svgFile property to style the widget using a svg file. Styling by svg enables switching between different themes in runtime (as long as the files are placed at identical locations within theme directories).

The CDPBaseClockDigi supports reading both background image and text color from svg similar to that of CDPBaseLineEdit described here.

Note: The svg doesn't have to include background image though it is supported, but when present, the widget will generate raster images as described here.

Member Type Documentation

enum CDPBaseClockDigi::ClockSource

This enum type specifies what clock source to use for updating time:

ConstantValueDescription
CDPBaseClockDigi::OSClock0Time from the OS.
CDPBaseClockDigi::CDPClock1Time from cdp synch protocol.
CDPBaseClockDigi::CDPRouting2Time from a CDP signal specified by routing.

typedef CDPBaseClockDigi::StylingSvgMap

enum CDPBaseClockDigi::StylingType

This enum type specifies what styling type to use:

ConstantValueDescription
CDPBaseClockDigi::NoFile0No styling file.
CDPBaseClockDigi::CSS1Style by css file.
CDPBaseClockDigi::SVG2Style by SVG file.

Property Documentation

cdpClockRouting : QString

This property holds the routing to the cdp signal that are to control the clock.

The routed value is assumed to be a double value containing time since epoch (number of seconds that have passed since 1970-01-01 00:00:00.000, Coordinated Universal Time (UTC).

Note: routing has to be selected as clock source to enable editing this property.

Access functions:

virtual QString cdpClockRouting()
virtual void setCdpClockRouting(const QString &routing)

See also cdpClockSource.

cdpClockSource : ClockSource

This property holds the clock source to use when showing time on the clock.

The clock can be set from the operating system, cdp time or a cdp signal (for instance to get time from a gps device).

Access functions:

virtual ClockSource cdpClockSource()
virtual void setCdpClockSource(ClockSource source)

cdpVisibleRouting : const QString

This property holds the full path of the signal/parameter to control visible property.

Note: values not equal to 1 are considered false.

See also visible.

cssFile : QString

This property holds the path to the css file (if styling type is set to CSS).

Access functions:

virtual QString cssFile()
virtual void setCssFile(QString cssFile)

See also stylingType and svgFile.

iconDown : QString

This property holds the path to pixmap for down icon.

Access functions:

virtual QString iconDown()
virtual void setIconDown(QString icon)

iconUp : QString

This property holds the path to pixmap for up icon.

Access functions:

virtual QString iconUp()
virtual void setIconUp(QString icon)

stylingType : StylingType

This property holds the styling method to use when styling the widget.

Access functions:

virtual StylingType stylingType()
virtual void setStylingType(StylingType type)

See also cssFile and svgFile.

svgFile : QString

This property holds the path to the svg file that styles the widget.

The path can be either to a resource or a file on disk.

Note: resources can be overridden by files on disk with identical names.

Access functions:

virtual QString svgFile()
virtual void setSvgFile(QString svg)

See also stylingType and cssFile.

visible : const bool

This property holds whether to show or hide the widget.

Member Function Documentation

CDPBaseClockDigi::CDPBaseClockDigi(QWidget *parent = 0)

Default constructs an instance of CDPBaseClockDigi.

[protected] QString CDPBaseClockDigi::addUrl(QString path)

[virtual protected] bool CDPBaseClockDigi::eventFilter(QObject *obj, QEvent *event)

[protected] QString CDPBaseClockDigi::generatedStyleSheet()

[protected slot] const QString &CDPBaseClockDigi::getCurrentDownIcon(bool isSvg)

[protected slot] const QString &CDPBaseClockDigi::getCurrentUpIcon(bool isSvg)

[protected] double CDPBaseClockDigi::globalTimeOffsetMs()

[virtual slot] void CDPBaseClockDigi::handleVisible(double visible)

[virtual slot] void CDPBaseClockDigi::hideWidget()

[virtual] bool CDPBaseClockDigi::isClockSignalSelected()

[virtual] bool CDPBaseClockDigi::isCssStyling()

[virtual] bool CDPBaseClockDigi::isSvgStyling()

[protected] void CDPBaseClockDigi::loadSvg()

[virtual protected] void CDPBaseClockDigi::setClockTimer(int time)

[virtual protected] void CDPBaseClockDigi::setDateTimer(int date)

void CDPBaseClockDigi::setIQtCDPPointer(IQtCDP *pIQtCDP)

[slot] void CDPBaseClockDigi::setInCommand(bool cmd)

[slot] void CDPBaseClockDigi::setSmoothPixmap(bool smooth)

[slot] void CDPBaseClockDigi::setTimeOffsetSecs(double timeOffsetSec)

[slot] void CDPBaseClockDigi::setWidgetFont(const QString &font)

[slot] void CDPBaseClockDigi::setWidgetStyle(int style)

See also widgetStyle().

[slot] void CDPBaseClockDigi::setWidgetTheme(const QString &theme)

[virtual slot] void CDPBaseClockDigi::showWidget()

[virtual protected] void CDPBaseClockDigi::timerEvent(QTimerEvent *event)

[protected] void CDPBaseClockDigi::updateDateTime()

[protected] void CDPBaseClockDigi::updateDateTimeFromCdpClock()

[protected] void CDPBaseClockDigi::updateDateTimeFromCdpSignal()

[protected] void CDPBaseClockDigi::updateDateTimeFromOS()

[protected] void CDPBaseClockDigi::updateTextColorFromSvg()

int CDPBaseClockDigi::widgetStyle()

See also setWidgetStyle().