2 * Copyright (C) 2016 The Qt Company Ltd.
3 * Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #include "statusbarserver.h"
20 class StatusBarServer::Private
23 Private(StatusBarServer *parent);
24 QString texts[SupportedCount];
25 QString icons[SupportedCount];
28 StatusBarServer::Private::Private(StatusBarServer *parent)
30 icons[0] = QStringLiteral("qrc:/images/Status/HMI_Status_Wifi_NoBars-01.png");
31 icons[1] = QStringLiteral("qrc:/images/Status/HMI_Status_Bluetooth_Inactive-01.png");
32 icons[2] = QStringLiteral("qrc:/images/Status/HMI_Status_Signal_NoBars-01.png");
35 StatusBarServer::StatusBarServer(QObject *parent)
37 , d(new Private(this))
41 StatusBarServer::~StatusBarServer()
46 QList<int> StatusBarServer::getAvailablePlaceholders() const
49 for (int i = 0; i < SupportedCount; ++i) {
55 QString StatusBarServer::getStatusIcon(int placeholderIndex) const
58 if (-1 < placeholderIndex && placeholderIndex < SupportedCount)
59 ret = d->icons[placeholderIndex];
63 void StatusBarServer::setStatusIcon(int placeholderIndex, const QString &icon)
65 if (-1 < placeholderIndex && placeholderIndex < SupportedCount) {
66 if (d->icons[placeholderIndex] == icon) return;
67 d->icons[placeholderIndex] = icon;
68 emit statusIconChanged(placeholderIndex, icon);
72 QString StatusBarServer::getStatusText(int placeholderIndex) const
75 if (-1 < placeholderIndex && placeholderIndex < SupportedCount) {
76 ret = d->texts[placeholderIndex];
81 void StatusBarServer::setStatusText(int placeholderIndex, const QString &text)
83 if (-1 < placeholderIndex && placeholderIndex < SupportedCount) {
84 if (d->texts[placeholderIndex] == text) return;
85 d->texts[placeholderIndex] = text;
86 emit statusTextChanged(placeholderIndex, text);