+QString SystemTray::iconName(State state) const
+{
+ QString name;
+ switch (state) {
+ case State::Passive:
+ name = "inactive-quassel-tray";
+ break;
+ case State::Active:
+ name = "active-quassel-tray";
+ break;
+ case State::NeedsAttention:
+ name = "message-quassel-tray";
+ break;
+ }
+
+ if (_trayIconInverted) {
+ name += "-inverted";
+ }
+
+ return name;
+}
+
+QString SystemTray::currentIconName() const
+{
+ if (state() == State::NeedsAttention) {
+ if (_attentionBehavior == AttentionBehavior::ChangeColor) {
+ return iconName(State::NeedsAttention);
+ }
+ if (_attentionBehavior == AttentionBehavior::Blink && _blinkState) {
+ return iconName(State::NeedsAttention);
+ }
+ return iconName(State::Active);
+ }
+ else {
+ return iconName(state());
+ }
+}
+
+QString SystemTray::currentAttentionIconName() const
+{
+ if (state() == State::NeedsAttention && _attentionBehavior == AttentionBehavior::Blink && !_blinkState) {
+ return iconName(State::Active);
+ }
+ return iconName(State::NeedsAttention);
+}
+
+bool SystemTray::isAlerted() const
+{
+ return state() == State::NeedsAttention;
+}