File indexing completed on 2025-01-19 03:53:52

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2006-02-16
0007  * Description : a dialog to display ICC profile information.
0008  *
0009  * SPDX-FileCopyrightText: 2006-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #include "iccprofileinfodlg.h"
0016 
0017 // Qt includes
0018 
0019 #include <QDialogButtonBox>
0020 #include <QVBoxLayout>
0021 #include <QPushButton>
0022 
0023 // KDE includes
0024 
0025 #include <klocalizedstring.h>
0026 
0027 // Local includes
0028 
0029 #include "iccprofilewidget.h"
0030 #include "dxmlguiwindow.h"
0031 
0032 namespace Digikam
0033 {
0034 
0035 ICCProfileInfoDlg::ICCProfileInfoDlg(QWidget* const parent, const QString& profilePath, const IccProfile& profile)
0036     : QDialog(parent)
0037 {
0038     setModal(true);
0039     setWindowTitle(i18nc("@title:window", "Color Profile Info - %1", profilePath));
0040 
0041     QDialogButtonBox* const buttons       = new QDialogButtonBox(QDialogButtonBox::Help | QDialogButtonBox::Ok, this);
0042     buttons->button(QDialogButtonBox::Ok)->setDefault(true);
0043 
0044     ICCProfileWidget* const profileWidget = new ICCProfileWidget(this, 340, 256);
0045 
0046     if (profile.isNull())
0047     {
0048         profileWidget->loadFromURL(QUrl::fromLocalFile(profilePath));
0049     }
0050     else
0051     {
0052         profileWidget->loadProfile(profilePath, profile);
0053     }
0054 
0055     QVBoxLayout* const vbx                = new QVBoxLayout(this);
0056     vbx->addWidget(profileWidget);
0057     vbx->addWidget(buttons);
0058     setLayout(vbx);
0059 
0060     connect(buttons->button(QDialogButtonBox::Ok), SIGNAL(clicked()),
0061             this, SLOT(accept()));
0062 
0063     connect(buttons->button(QDialogButtonBox::Help), SIGNAL(clicked()),
0064             this, SLOT(slotHelp()));
0065 }
0066 
0067 ICCProfileInfoDlg::~ICCProfileInfoDlg()
0068 {
0069 }
0070 
0071 void ICCProfileInfoDlg::slotHelp()
0072 {
0073     openOnlineDocumentation(QLatin1String("color_management"));
0074 }
0075 
0076 } // namespace Digikam
0077 
0078 #include "moc_iccprofileinfodlg.cpp"