mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Loading external color profiles
This commit is contained in:
@ -546,6 +546,7 @@ void PDFViewerMainWindow::readSettings()
|
||||
}
|
||||
|
||||
m_settings->readSettings(settings, m_CMSManager->getDefaultSettings());
|
||||
m_CMSManager->setSettings(m_settings->getColorManagementSystemSettings());
|
||||
}
|
||||
|
||||
void PDFViewerMainWindow::readActionSettings()
|
||||
@ -981,6 +982,7 @@ void PDFViewerMainWindow::on_actionOptions_triggered()
|
||||
{
|
||||
m_settings->setSettings(dialog.getSettings());
|
||||
m_settings->setColorManagementSystemSettings(dialog.getCMSSettings());
|
||||
m_CMSManager->setSettings(m_settings->getColorManagementSystemSettings());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,6 +65,7 @@ void PDFViewerSettings::readSettings(QSettings& settings, const pdf::PDFCMSSetti
|
||||
m_colorManagementSystemSettings.deviceGray = settings.value("deviceGray", defaultCMSSettings.deviceGray).toString();
|
||||
m_colorManagementSystemSettings.deviceRGB = settings.value("deviceRGB", defaultCMSSettings.deviceRGB).toString();
|
||||
m_colorManagementSystemSettings.deviceCMYK = settings.value("deviceCMYK", defaultCMSSettings.deviceCMYK).toString();
|
||||
m_colorManagementSystemSettings.profileDirectory = settings.value("profileDirectory", defaultCMSSettings.profileDirectory).toString();
|
||||
settings.endGroup();
|
||||
|
||||
emit settingsChanged();
|
||||
@ -100,6 +101,7 @@ void PDFViewerSettings::writeSettings(QSettings& settings)
|
||||
settings.setValue("deviceGray", m_colorManagementSystemSettings.deviceGray);
|
||||
settings.setValue("deviceRGB", m_colorManagementSystemSettings.deviceRGB);
|
||||
settings.setValue("deviceCMYK", m_colorManagementSystemSettings.deviceCMYK);
|
||||
settings.setValue("profileDirectory", m_colorManagementSystemSettings.profileDirectory);
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <QAction>
|
||||
#include <QLineEdit>
|
||||
#include <QMessageBox>
|
||||
#include <QFileDialog>
|
||||
#include <QListWidgetItem>
|
||||
|
||||
namespace pdfviewer
|
||||
@ -72,9 +73,9 @@ PDFViewerSettingsDialog::PDFViewerSettingsDialog(const PDFViewerSettings::Settin
|
||||
ui->cmsAccuracyComboBox->addItem(tr("Medium"), int(pdf::PDFCMSSettings::Accuracy::Medium));
|
||||
ui->cmsAccuracyComboBox->addItem(tr("High"), int(pdf::PDFCMSSettings::Accuracy::High));
|
||||
|
||||
auto fillColorProfileList = [](QComboBox* comboBox, const pdf::PDFColorSpaceIdentifiers& identifiers)
|
||||
auto fillColorProfileList = [](QComboBox* comboBox, const pdf::PDFColorProfileIdentifiers& identifiers)
|
||||
{
|
||||
for (const pdf::PDFColorSpaceIdentifier& identifier : identifiers)
|
||||
for (const pdf::PDFColorProfileIdentifier& identifier : identifiers)
|
||||
{
|
||||
comboBox->addItem(identifier.name, identifier.id);
|
||||
}
|
||||
@ -105,6 +106,10 @@ PDFViewerSettingsDialog::PDFViewerSettingsDialog(const PDFViewerSettings::Settin
|
||||
{
|
||||
connect(spinBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &PDFViewerSettingsDialog::saveData);
|
||||
}
|
||||
for (QLineEdit* lineEdit : findChildren<QLineEdit*>())
|
||||
{
|
||||
connect(lineEdit, &QLineEdit::editingFinished, this, &PDFViewerSettingsDialog::saveData);
|
||||
}
|
||||
|
||||
for (QAction* action : actions)
|
||||
{
|
||||
@ -239,6 +244,9 @@ void PDFViewerSettingsDialog::loadData()
|
||||
ui->cmsDeviceRGBColorProfileComboBox->setCurrentIndex(ui->cmsDeviceRGBColorProfileComboBox->findData(m_cmsSettings.deviceRGB));
|
||||
ui->cmsDeviceCMYKColorProfileComboBox->setEnabled(true);
|
||||
ui->cmsDeviceCMYKColorProfileComboBox->setCurrentIndex(ui->cmsDeviceCMYKColorProfileComboBox->findData(m_cmsSettings.deviceCMYK));
|
||||
ui->cmsProfileDirectoryButton->setEnabled(true);
|
||||
ui->cmsProfileDirectoryEdit->setEnabled(true);
|
||||
ui->cmsProfileDirectoryEdit->setText(m_cmsSettings.profileDirectory);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -258,6 +266,9 @@ void PDFViewerSettingsDialog::loadData()
|
||||
ui->cmsDeviceRGBColorProfileComboBox->setCurrentIndex(-1);
|
||||
ui->cmsDeviceCMYKColorProfileComboBox->setEnabled(false);
|
||||
ui->cmsDeviceCMYKColorProfileComboBox->setCurrentIndex(-1);
|
||||
ui->cmsProfileDirectoryButton->setEnabled(false);
|
||||
ui->cmsProfileDirectoryEdit->setEnabled(false);
|
||||
ui->cmsProfileDirectoryEdit->setText(QString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -382,6 +393,10 @@ void PDFViewerSettingsDialog::saveData()
|
||||
{
|
||||
m_cmsSettings.deviceCMYK = ui->cmsDeviceCMYKColorProfileComboBox->currentData().toString();
|
||||
}
|
||||
else if (sender == ui->cmsProfileDirectoryEdit)
|
||||
{
|
||||
m_cmsSettings.profileDirectory = ui->cmsProfileDirectoryEdit->text();
|
||||
}
|
||||
|
||||
loadData();
|
||||
}
|
||||
@ -446,4 +461,14 @@ void PDFViewerSettingsDialog::accept()
|
||||
}
|
||||
}
|
||||
|
||||
void PDFViewerSettingsDialog::on_cmsProfileDirectoryButton_clicked()
|
||||
{
|
||||
QString directory = QFileDialog::getExistingDirectory(this, tr("Select color profile directory"));
|
||||
if (!directory.isEmpty())
|
||||
{
|
||||
m_cmsSettings.profileDirectory = directory;
|
||||
loadData();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace pdfviewer
|
||||
|
@ -69,6 +69,8 @@ public:
|
||||
private slots:
|
||||
void on_optionsPagesWidget_currentItemChanged(QListWidgetItem* current, QListWidgetItem* previous);
|
||||
|
||||
void on_cmsProfileDirectoryButton_clicked();
|
||||
|
||||
private:
|
||||
void loadData();
|
||||
void saveData();
|
||||
|
@ -585,35 +585,18 @@
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="cmsWidgetsLayout">
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="cmsTypeComboBox"/>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QCheckBox" name="cmsWhitePaperColorTransformedCheckBox">
|
||||
<property name="text">
|
||||
<string>Enable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="cmsWhitePaperColorTransformedLabel">
|
||||
<property name="text">
|
||||
<string>White paper color transformed</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<layout class="QGridLayout" name="cmsWidgetsLayout" columnstretch="1,1">
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="cmsDeviceRGBProfileLabel">
|
||||
<widget class="QLabel" name="cmsDeviceGrayColorProfileLabel">
|
||||
<property name="text">
|
||||
<string>Device RGB color profile</string>
|
||||
<string>Device gray color profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="cmsOutputProfileLabel">
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="cmsDeviceCMYKColorProfileLabel">
|
||||
<property name="text">
|
||||
<string>Output color profile</string>
|
||||
<string>Device CMYK color profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -625,36 +608,9 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="cmsDeviceGrayColorProfileLabel">
|
||||
<widget class="QLabel" name="cmsOutputProfileLabel">
|
||||
<property name="text">
|
||||
<string>Device gray color profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="cmsRenderingIntentComboBox"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="cmsRenderingIntentLabel">
|
||||
<property name="text">
|
||||
<string>Rendering intent</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="cmsAccuracyComboBox"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="cmsAccuracyLabel">
|
||||
<property name="text">
|
||||
<string>Accuracy</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="cmsLabel">
|
||||
<property name="text">
|
||||
<string>Color management system</string>
|
||||
<string>Output color profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -665,24 +621,89 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="cmsDeviceCMYKColorProfileLabel">
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="cmsRenderingIntentComboBox"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="cmsAccuracyComboBox"/>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QComboBox" name="cmsDeviceGrayColorProfileComboBox"/>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QComboBox" name="cmsOutputColorProfileComboBox"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="cmsWhitePaperColorTransformedLabel">
|
||||
<property name="text">
|
||||
<string>Device CMYK color profile</string>
|
||||
<string>White paper color transformed</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QComboBox" name="cmsDeviceRGBColorProfileComboBox"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="cmsRenderingIntentLabel">
|
||||
<property name="text">
|
||||
<string>Rendering intent</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="cmsDeviceRGBProfileLabel">
|
||||
<property name="text">
|
||||
<string>Device RGB color profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="cmsTypeComboBox"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="cmsAccuracyLabel">
|
||||
<property name="text">
|
||||
<string>Accuracy</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QCheckBox" name="cmsWhitePaperColorTransformedCheckBox">
|
||||
<property name="text">
|
||||
<string>Enable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QComboBox" name="cmsDeviceCMYKColorProfileComboBox"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="cmsLabel">
|
||||
<property name="text">
|
||||
<string>Color management system</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="cmsProfileDirectoryLabel">
|
||||
<property name="text">
|
||||
<string>Additional color profile directory</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="cmsOutputColorProfileComboBox"/>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QComboBox" name="cmsDeviceGrayColorProfileComboBox"/>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QComboBox" name="cmsDeviceRGBColorProfileComboBox"/>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QComboBox" name="cmsDeviceCMYKColorProfileComboBox"/>
|
||||
<layout class="QHBoxLayout" name="cmsProfileDirectoryLayout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="cmsProfileDirectoryEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="cmsProfileDirectoryButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
Reference in New Issue
Block a user