Subversion Repositories Scribus

Rev

Rev 1828 | Rev 2984 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 paul 1
#include "cmsprefs.h"
2
#include "cmsprefs.moc"
3
 
1065 cbradney 4
CMSPrefs::CMSPrefs( QWidget* parent, CMSData *Vor, ProfilesL *InputProfiles, ProfilesL *PrinterProfiles, ProfilesL *MonitorProfiles)
795 fschmid 5
        : QWidget( parent, "CMS" )
3 paul 6
{
795 fschmid 7
        prefs = Vor;
8
        changed = false;
9
        cmsPrefsLayout = new QVBoxLayout( this );
10
        cmsPrefsLayout->setAlignment( Qt::AlignTop );
11
        cmsPrefsLayout->setSpacing( 5 );
1878 cbradney 12
        cmsPrefsLayout->setMargin( 0 );
3 paul 13
 
795 fschmid 14
        checkBox1 = new QCheckBox( tr( "&Activate Color Management" ), this, "CheckBox1" );
15
        checkBox1->setChecked(Vor->CMSinUse);
16
        cmsPrefsLayout->addWidget( checkBox1 );
3 paul 17
 
795 fschmid 18
        sysProfiles = new QGroupBox( tr( "System Profiles" ), this, "SysProfiles" );
19
        if (!checkBox1->isChecked())
20
                sysProfiles->setEnabled( false );
21
        sysProfiles->setColumnLayout(0, Qt::Vertical );
22
        sysProfiles->layout()->setSpacing( 0 );
23
        sysProfiles->layout()->setMargin( 0 );
24
        sysProfilesLayout = new QGridLayout( sysProfiles->layout() );
25
        sysProfilesLayout->setAlignment( Qt::AlignTop );
26
        sysProfilesLayout->setSpacing( 5 );
27
        sysProfilesLayout->setMargin( 10 );
3 paul 28
 
161 Franz 29
        ProfilesL::Iterator it;
3 paul 30
 
795 fschmid 31
        inputP = new QComboBox( true, sysProfiles, "InputP" );
32
        inputP->setMinimumSize( QSize( 190, 22 ) );
33
        inputP->setEditable(false);
161 Franz 34
        for (it = InputProfiles->begin(); it != InputProfiles->end(); ++it)
35
        {
795 fschmid 36
                inputP->insertItem(it.key());
341 Franz 37
                if (it.key() == Vor->DefaultInputProfile)
795 fschmid 38
                        inputP->setCurrentItem(inputP->count()-1);
161 Franz 39
        }
795 fschmid 40
        text1 = new QLabel( inputP, tr( "&Pictures:" ), sysProfiles, "Text1" );
41
        sysProfilesLayout->addWidget( text1, 0, 0 );
42
        sysProfilesLayout->addWidget( inputP, 0, 1 );
3 paul 43
 
795 fschmid 44
        inputP2 = new QComboBox( true, sysProfiles, "InputP2" );
45
        inputP2->setMinimumSize( QSize( 190, 22 ) );
46
        inputP2->setEditable(false);
161 Franz 47
        for (it = InputProfiles->begin(); it != InputProfiles->end(); ++it)
48
        {
795 fschmid 49
                inputP2->insertItem(it.key());
341 Franz 50
                if (it.key() == Vor->DefaultInputProfile2)
795 fschmid 51
                        inputP2->setCurrentItem(inputP2->count()-1);
161 Franz 52
        }
795 fschmid 53
        text4 = new QLabel( inputP2, tr( "&Solid Colors:" ), sysProfiles, "Text4" );
54
        sysProfilesLayout->addWidget( text4, 1, 0 );
55
        sysProfilesLayout->addWidget( inputP2, 1, 1 );
3 paul 56
 
795 fschmid 57
        monitorP = new QComboBox( true, sysProfiles, "MonitorP" );
58
        monitorP->setMinimumSize( QSize( 190, 22 ) );
59
        monitorP->setEditable(false);
161 Franz 60
        for (it = MonitorProfiles->begin(); it != MonitorProfiles->end(); ++it)
61
        {
795 fschmid 62
                monitorP->insertItem(it.key());
341 Franz 63
                if (it.key() == Vor->DefaultMonitorProfile)
795 fschmid 64
                        monitorP->setCurrentItem(monitorP->count()-1);
161 Franz 65
        }
795 fschmid 66
        text2 = new QLabel( monitorP, tr( "&Monitor:" ), sysProfiles, "Text2" );
67
        sysProfilesLayout->addWidget( text2, 2, 0 );
68
        sysProfilesLayout->addWidget( monitorP, 2, 1 );
3 paul 69
 
795 fschmid 70
        printerP = new QComboBox( true, sysProfiles, "PrinterP" );
71
        printerP->setMinimumSize( QSize( 190, 22 ) );
72
        printerP->setEditable(false);
161 Franz 73
        for (it = PrinterProfiles->begin(); it != PrinterProfiles->end(); ++it)
74
        {
795 fschmid 75
                printerP->insertItem(it.key());
341 Franz 76
                if (it.key() == Vor->DefaultPrinterProfile)
795 fschmid 77
                        printerP->setCurrentItem(printerP->count()-1);
161 Franz 78
        }
795 fschmid 79
        text3 = new QLabel( printerP, tr( "P&rinter:" ), sysProfiles, "Text3" );
80
        sysProfilesLayout->addWidget( text3, 3, 0 );
81
        sysProfilesLayout->addWidget( printerP, 3, 1 );
82
        cmsPrefsLayout->addWidget( sysProfiles );
3 paul 83
 
795 fschmid 84
        render = new QGroupBox( tr( "Rendering Intents" ), this, "Render" );
85
        if (!checkBox1->isChecked())
86
                render->setEnabled( false );
87
        render->setColumnLayout(0, Qt::Vertical );
88
        render->layout()->setSpacing( 0 );
89
        render->layout()->setMargin( 0 );
90
        renderLayout = new QGridLayout( render->layout() );
91
        renderLayout->setAlignment( Qt::AlignTop );
92
        renderLayout->setSpacing( 5 );
93
        renderLayout->setMargin( 10 );
3 paul 94
 
795 fschmid 95
        monitorI = new QComboBox( true, render, "MonitorI" );
223 Franz 96
        QString tmp_mp[] = { tr("Perceptual"), tr("Relative Colorimetric"),
97
                                                tr("Saturation"), tr("Absolute Colorimetric")};
167 Franz 98
        size_t array = sizeof(tmp_mp) / sizeof(*tmp_mp);
223 Franz 99
        /* PFJ - 29.02.04 - Changed from uint to int and var name */
100
        for (uint prop = 0; prop < array; ++prop)
795 fschmid 101
                monitorI->insertItem(tmp_mp[prop]);
102
        monitorI->setMinimumSize( QSize( 190, 22 ) );
103
        monitorI->setEditable(false);
104
        monitorI->setCurrentItem(Vor->DefaultIntentMonitor);
105
        text21 = new QLabel( monitorI, tr( "M&onitor:" ), render, "Text21" );
106
        renderLayout->addWidget( text21, 0, 0 );
107
        renderLayout->addWidget( monitorI, 0, 1 );
3 paul 108
 
795 fschmid 109
        printerI = new QComboBox( true, render, "PrinterI" );
232 Franz 110
        for (uint prop = 0; prop < array; ++prop)
795 fschmid 111
                printerI->insertItem(tmp_mp[prop]);
112
        printerI->setMinimumSize( QSize( 190, 22 ) );
113
        printerI->setEditable(false);
114
        printerI->setCurrentItem(Vor->DefaultIntentPrinter);
115
        text22 = new QLabel( printerI, tr( "Pr&inter:" ), render, "Text22" );
116
        renderLayout->addWidget( text22, 1, 0 );
117
        renderLayout->addWidget( printerI, 1, 1 );
3 paul 118
 
795 fschmid 119
        cmsPrefsLayout->addWidget( render );
3 paul 120
 
795 fschmid 121
        simulate = new QCheckBox( tr( "Sim&ulate Printer on the Screen" ), this, "Simulate" );
122
        simulate->setChecked(Vor->SoftProofOn);
123
        cmsPrefsLayout->addWidget( simulate );
3 paul 124
 
795 fschmid 125
        gamutC = new QCheckBox( tr( "Mark Colors out of &Gamut" ), this, "Gamut" );
126
        gamutC->setChecked(Vor->GamutCheck);
127
        cmsPrefsLayout->addWidget( gamutC );
3 paul 128
 
795 fschmid 129
        blackP = new QCheckBox( tr( "Use &Blackpoint Compensation" ), this, "Black" );
146 Franz 130
#ifdef cmsFLAGS_BLACKPOINTCOMPENSATION
795 fschmid 131
        blackP->setChecked(Vor->BlackPoint);
146 Franz 132
#else
795 fschmid 133
        blackP->setChecked(false);
134
        blackP->hide();
146 Franz 135
#endif
795 fschmid 136
        cmsPrefsLayout->addWidget( blackP );
117 Franz 137
 
795 fschmid 138
        if (!checkBox1->isChecked())
161 Franz 139
        {
795 fschmid 140
                simulate->setEnabled( false );
141
                gamutC->setEnabled( false );
142
                blackP->setEnabled( false );
161 Franz 143
        }
3 paul 144
 
795 fschmid 145
        QToolTip::add( inputP, tr( "Default color profile for imported images" ) );
146
        QToolTip::add( inputP2, tr( "Default color profile for solid colors on the page" ) );
147
        QToolTip::add( monitorP, tr( "Color profile that you have generated or received from the manufacturer.\nThis profile should be specific to your monitor and not a generic profile (i.e. sRGB)." ) );
148
        QToolTip::add( printerP, tr( "Color profile for your printer model from the manufacturer.\nThis profile should be specific to your printer and not a generic profile (i.e. sRGB)." ) );
149
        QToolTip::add( monitorI, tr( "Default rendering intent for your monitor. Unless you know why to change it,\nRelative Colorimetric or Perceptual should be chosen." ) );
150
        QToolTip::add( printerI, tr( "Default rendering intent for your printer. Unless you know why to change it,\nRelative Colorimetric or Perceptual should be chosen." ) );
151
        QToolTip::add( simulate, tr( "Enable 'soft proofing' of how your document colors will print,\nbased on the chosen printer profile." ) );
152
        QToolTip::add( gamutC, tr( "Method of showing colors on the screen which may not print properly.\nThis requires very accurate profiles and serves only as a warning." ) );
153
        QToolTip::add( blackP, tr( "Black Point Compensation is a method of improving contrast in photos.\nIt is recommended that you enable this if you have photos in your document." ) );
3 paul 154
 
341 Franz 155
        // signals and slots connections
795 fschmid 156
        connect( checkBox1, SIGNAL( clicked() ), this, SLOT( slotCMSon() ) );
157
        connect( simulate, SIGNAL( clicked() ), this, SLOT( slotSimula() ) );
3 paul 158
}
159
 
1828 fschmid 160
void CMSPrefs::restoreDefaults()
161
{
162
}
163
 
795 fschmid 164
void CMSPrefs::setValues()
3 paul 165
{
795 fschmid 166
        if ((prefs->DefaultInputProfile != inputP->currentText()) ||
167
                (prefs->DefaultInputProfile2 != inputP2->currentText()) ||
168
                (prefs->DefaultMonitorProfile != monitorP->currentText()) ||
169
                (prefs->DefaultPrinterProfile != printerP->currentText()) ||
170
                (prefs->DefaultIntentPrinter != printerI->currentItem()) ||
171
                (prefs->DefaultIntentMonitor != monitorI->currentItem()) ||
172
                (prefs->SoftProofOn != simulate->isChecked()) ||
173
                (prefs->GamutCheck != gamutC->isChecked()) ||
174
                (prefs->BlackPoint != blackP->isChecked()) ||
175
                (prefs->CMSinUse != checkBox1->isChecked()))
176
                        changed = true;
177
        prefs->DefaultInputProfile = inputP->currentText();
178
        prefs->DefaultInputProfile2 = inputP2->currentText();
179
        prefs->DefaultMonitorProfile = monitorP->currentText();
180
        prefs->DefaultPrinterProfile = printerP->currentText();
181
        prefs->DefaultIntentPrinter = printerI->currentItem();
182
        prefs->DefaultIntentMonitor = monitorI->currentItem();
183
        prefs->DefaultIntentMonitor2 = monitorI->currentItem();
184
        prefs->SoftProofOn = simulate->isChecked();
185
        prefs->GamutCheck = gamutC->isChecked();
186
        prefs->CMSinUse = checkBox1->isChecked();
187
        prefs->BlackPoint = blackP->isChecked();
3 paul 188
}
189
 
190
void CMSPrefs::slotSimula()
191
{
795 fschmid 192
        bool setter = simulate->isChecked() ? true : false;
193
        gamutC->setEnabled(setter);
3 paul 194
}
195
 
196
void CMSPrefs::slotCMSon()
197
{
795 fschmid 198
        bool setter = checkBox1->isChecked() ? true : false;
199
        sysProfiles->setEnabled(setter);
200
        render->setEnabled(setter);
201
        simulate->setEnabled(setter);
202
        blackP->setEnabled(setter);
161 Franz 203
        if (setter == true)
341 Franz 204
                slotSimula();
205
        else
795 fschmid 206
                gamutC->setEnabled(setter);
1307 fschmid 207
        emit cmsOn(setter);
3 paul 208
}
209