1 /* ============================================================
2 *
3 * This file is a part of digiKam project
4 * https://www.digikam.org
5 *
6 * Date : 2006-02-16
7 * Description : a dialog to display ICC profile information.
8 *
9 * Copyright (C) 2006-2021 by Gilles Caulier <caulier dot gilles at gmail dot com>
10 *
11 * This program is free software; you can redistribute it
12 * and/or modify it under the terms of the GNU General
13 * Public License as published by the Free Software Foundation;
14 * either version 2, or (at your option)
15 * any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * ============================================================ */
23
24 #include "iccprofileinfodlg.h"
25
26 // Qt includes
27
28 #include <QDialogButtonBox>
29 #include <QVBoxLayout>
30 #include <QPushButton>
31
32 // KDE includes
33
34 #include <klocalizedstring.h>
35
36 // Local includes
37
38 #include "iccprofilewidget.h"
39 #include "dxmlguiwindow.h"
40
41 namespace Digikam
42 {
43
ICCProfileInfoDlg(QWidget * const parent,const QString & profilePath,const IccProfile & profile)44 ICCProfileInfoDlg::ICCProfileInfoDlg(QWidget* const parent, const QString& profilePath, const IccProfile& profile)
45 : QDialog(parent)
46 {
47 setModal(true);
48 setWindowTitle(i18n("Color Profile Info - %1", profilePath));
49
50 QDialogButtonBox* const buttons = new QDialogButtonBox(QDialogButtonBox::Help | QDialogButtonBox::Ok, this);
51 buttons->button(QDialogButtonBox::Ok)->setDefault(true);
52
53 ICCProfileWidget* const profileWidget = new ICCProfileWidget(this, 340, 256);
54
55 if (profile.isNull())
56 {
57 profileWidget->loadFromURL(QUrl::fromLocalFile(profilePath));
58 }
59 else
60 {
61 profileWidget->loadProfile(profilePath, profile);
62 }
63
64 QVBoxLayout* const vbx = new QVBoxLayout(this);
65 vbx->addWidget(profileWidget);
66 vbx->addWidget(buttons);
67 setLayout(vbx);
68
69 connect(buttons->button(QDialogButtonBox::Ok), SIGNAL(clicked()),
70 this, SLOT(accept()));
71
72 connect(buttons->button(QDialogButtonBox::Help), SIGNAL(clicked()),
73 this, SLOT(slotHelp()));
74 }
75
~ICCProfileInfoDlg()76 ICCProfileInfoDlg::~ICCProfileInfoDlg()
77 {
78 }
79
slotHelp()80 void ICCProfileInfoDlg::slotHelp()
81 {
82 DXmlGuiWindow::openHandbook();
83 }
84
85 } // namespace Digikam
86