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"
19 #include "statusbar_adaptor.h"
21 class StatusBarServer::Private
24 Private(StatusBarServer *parent);
25 QString texts[SupportedCount];
26 QString icons[SupportedCount];
27 StatusbarAdaptor adaptor;
30 StatusBarServer::Private::Private(StatusBarServer *parent)
33 icons[0] = QStringLiteral("qrc:/images/Status/HMI_Status_Wifi_NoBars-01.png");
34 icons[1] = QStringLiteral("qrc:/images/Status/HMI_Status_Bluetooth_Inactive-01.png");
35 icons[2] = QStringLiteral("qrc:/images/Status/HMI_Status_Signal_NoBars-01.png");
38 StatusBarServer::StatusBarServer(QObject *parent)
40 , d(new Private(this))
44 StatusBarServer::~StatusBarServer()
49 QList<int> StatusBarServer::getAvailablePlaceholders() const
52 for (int i = 0; i < SupportedCount; ++i) {
58 QString StatusBarServer::getStatusIcon(int placeholderIndex) const
61 if (-1 < placeholderIndex && placeholderIndex < SupportedCount)
62 ret = d->icons[placeholderIndex];
66 void StatusBarServer::setStatusIcon(int placeholderIndex, const QString &icon)
68 if (-1 < placeholderIndex && placeholderIndex < SupportedCount) {
69 if (d->icons[placeholderIndex] == icon) return;
70 d->icons[placeholderIndex] = icon;
71 emit statusIconChanged(placeholderIndex, icon);
75 QString StatusBarServer::getStatusText(int placeholderIndex) const
78 if (-1 < placeholderIndex && placeholderIndex < SupportedCount) {
79 ret = d->texts[placeholderIndex];
84 void StatusBarServer::setStatusText(int placeholderIndex, const QString &text)
86 if (-1 < placeholderIndex && placeholderIndex < SupportedCount) {
87 if (d->texts[placeholderIndex] == text) return;
88 d->texts[placeholderIndex] = text;
89 emit statusTextChanged(placeholderIndex, text);