1// SPDX-FileCopyrightText: 2021 Nheko Contributors
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5import QtQuick 2.9
6import QtQuick.Controls 2.3
7import QtQuick.Layouts 1.2
8import im.nheko 1.0
9
10Popup {
11    property string errorString
12    property var image
13
14    modal: true
15    // only set the anchors on Qt 5.12 or higher
16    // see https://doc.qt.io/qt-5/qml-qtquick-controls2-popup.html#anchors.centerIn-prop
17    Component.onCompleted: {
18        if (anchors)
19            anchors.centerIn = parent;
20
21    }
22
23    RowLayout {
24        Image {
25            Layout.preferredWidth: 16
26            Layout.preferredHeight: 16
27            source: "image://colorimage/" + image + "?" + Nheko.colors.windowText
28        }
29
30        Label {
31            text: errorString
32            color: Nheko.colors.windowText
33        }
34
35    }
36
37    background: Rectangle {
38        color: Nheko.colors.window
39        border.color: Nheko.colors.windowText
40    }
41
42}
43