File indexing completed on 2024-12-22 04:13:17

0001 /*
0002  *  SPDX-FileCopyrightText: 2020 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #include "KisWarningWidget.h"
0008 
0009 #include "klocalizedstring.h"
0010 #include "kis_icon_utils.h"
0011 #include <QHBoxLayout>
0012 #include <QLabel>
0013 
0014 
0015 KisWarningWidget::KisWarningWidget(QWidget *parent)
0016     : QWidget(parent)
0017 {
0018     QHBoxLayout *hLayout = new QHBoxLayout(this);
0019 
0020     m_warningIcon = new QLabel(this);
0021     m_warningIcon->setPixmap(KisIconUtils::loadIcon("warning").pixmap(32, 32));
0022     m_warningIcon->setAlignment(Qt::AlignTop);
0023     hLayout->addWidget(m_warningIcon);
0024 
0025     m_warningText = new QLabel(this);
0026     m_warningText->setWordWrap(true);
0027     m_warningText->setOpenExternalLinks(true);
0028     hLayout->addWidget(m_warningText, 1);
0029 
0030     setLayout(hLayout);
0031 }
0032 
0033 void KisWarningWidget::setText(const QString &text)
0034 {
0035     m_warningText->setText(text);
0036 }
0037 
0038 QString KisWarningWidget::changeImageProfileWarningText()
0039 {
0040     return i18nc("warning message when changing image color space",
0041                  "<html><body>"
0042                  "<p><b>WARNING:</b> the image will look different after changing the color profile because it contains either:"
0043                  "<ul>"
0044                  "<li>more than one layer</li>"
0045                  "<li>one or more layers with transparent pixels</li>"
0046                  "<li>layers with blending modes other than \"Normal\"</li>"
0047                  "</ul></p>"
0048                  "<p>"
0049                  "<a href=\"https://docs.krita.org/en/general_concepts/colors/color_managed_workflow.html\">More information</a>"
0050                  "</p></body></html>");
0051 }