r23830 by jghali - Code cleanup
scribus-commit
scribus-commit at lists.scribus.net
Mon May 25 23:49:01 UTC 2020
Author: jghali
Date: Mon May 25 23:49:01 2020
New Revision: 23830
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23830
Log:
Code cleanup
Modified:
trunk/Scribus/scribus/ui/printpreview.cpp
trunk/Scribus/scribus/ui/tabpdfoptions.cpp
Modified: trunk/Scribus/scribus/ui/printpreview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23830&path=/trunk/Scribus/scribus/ui/printpreview.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/printpreview.cpp (original)
+++ trunk/Scribus/scribus/ui/printpreview.cpp Mon May 25 23:49:01 2020
@@ -389,15 +389,14 @@
void PrintPreview::toggleCMYK()
{
+ if (!haveTiffSep)
+ return;
+
bool c = enableCMYK->isChecked();
- if (haveTiffSep)
- {
- inkTable->setEnabled(c);
- enableInkCover->setEnabled(c);
- if (enableInkCover->isChecked())
- coverThresholdValue->setEnabled(c);
- }
-
+ inkTable->setEnabled(c);
+ enableInkCover->setEnabled(c);
+ if (enableInkCover->isChecked())
+ coverThresholdValue->setEnabled(c);
redisplay();
}
@@ -417,33 +416,29 @@
void PrintPreview::doSpotTable(int row)
{
- if (haveTiffSep)
- {
- QMap<QString, QCheckBox*> ::Iterator sepit;
- for (sepit = flagsVisible.begin(); sepit != flagsVisible.end(); ++sepit)
- {
- sepit.value()->setChecked(false);
- }
- ((QCheckBox*)(inkTable->cellWidget(row, 0)))->setChecked(true);
- if (enableCMYK->isChecked())
- previewLabel->setPixmap(CreatePreview(m_currentPage, qRound(72 * scaleFactor)));
- previewLabel->resize(previewLabel->pixmap()->size());
- }
+ if (!haveTiffSep)
+ return;
+
+ for (auto sepIt = flagsVisible.begin(); sepIt != flagsVisible.end(); ++sepIt)
+ sepIt.value()->setChecked(false);
+ ((QCheckBox*)(inkTable->cellWidget(row, 0)))->setChecked(true);
+
+ if (enableCMYK->isChecked())
+ previewLabel->setPixmap(CreatePreview(m_currentPage, qRound(72 * scaleFactor)));
+ previewLabel->resize(previewLabel->pixmap()->size());
}
void PrintPreview::toggleAllfromHeader()
{
- if (haveTiffSep)
- {
- QMap<QString, QCheckBox*> ::Iterator sepit;
- for (sepit = flagsVisible.begin(); sepit != flagsVisible.end(); ++sepit)
- {
- sepit.value()->setChecked(true);
- }
- if (enableCMYK->isChecked())
- previewLabel->setPixmap(CreatePreview(m_currentPage, qRound(72 * scaleFactor)));
- previewLabel->resize(previewLabel->pixmap()->size());
- }
+ if (!haveTiffSep)
+ return;
+
+ for (auto sepIt = flagsVisible.begin(); sepIt != flagsVisible.end(); ++sepIt)
+ sepIt.value()->setChecked(true);
+
+ if (enableCMYK->isChecked())
+ previewLabel->setPixmap(CreatePreview(m_currentPage, qRound(72 * scaleFactor)));
+ previewLabel->resize(previewLabel->pixmap()->size());
}
void PrintPreview::scaleBox_valueChanged(int value)
@@ -701,7 +696,7 @@
QString allSeps ="[ /Cyan /Magenta /Yellow /Black ";
for (int sp = 0; sp < spots.count(); ++sp)
{
- allSeps += "("+spots[sp]+") ";
+ allSeps += "(" + spots[sp] + ") ";
}
allSeps += "]";
cmd += allSeps + " /SeparationOrder [ /Cyan /Magenta /Yellow /Black] >> setpagedevice";
@@ -753,7 +748,7 @@
if (fx.open(QIODevice::WriteOnly))
{
QTextStream tsx(&fx);
- tsx << QString("<< /SeparationColorNames "+allSeps+" /SeparationOrder [ "+currSeps+" ] >> setpagedevice");
+ tsx << QString("<< /SeparationColorNames " + allSeps + " /SeparationOrder [ " + currSeps + " ] >> setpagedevice");
fx.close();
}
args3.append("-f");
@@ -774,7 +769,7 @@
if (fx.open(QIODevice::WriteOnly))
{
QTextStream tsx(&fx);
- tsx << QString("<< /SeparationColorNames "+allSeps+" /SeparationOrder [ "+currSeps+" ] >> setpagedevice");
+ tsx << QString("<< /SeparationColorNames " + allSeps+" /SeparationOrder [ " + currSeps + " ] >> setpagedevice");
fx.close();
}
args3.append("-f");
@@ -852,7 +847,9 @@
QPixmap pixmap;
double b = doc->Pages->at(pageIndex)->width() * res / 72.0;
double h = doc->Pages->at(pageIndex)->height() * res / 72.0;
+
qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
+
if ((pageIndex != m_currentPage) || (enableCMYK->isChecked() != m_colorMode) || (m_scaleMode != scaleBox->currentIndex())
|| (antiAliasing->isChecked() != m_useAntialiasing) || (((showTransparency->isChecked() != m_showTransparency) || (enableGCR->isChecked() != m_useGCR))
&& (!enableCMYK->isChecked()))
@@ -895,16 +892,8 @@
if (doc->Pages->at(pageIndex)->orientation() == 1)
std::swap(w, h2);
image = QImage(w, h2, QImage::Format_ARGB32);
- QRgb clean = qRgba(0, 0, 0, 0);
- for (int yi = 0; yi < h2; ++yi)
- {
- QRgb *q = (QRgb*) image.scanLine(yi);
- for (int xi = 0; xi < w; ++xi)
- {
- *q = clean;
- q++;
- }
- }
+ image.fill(qRgba(0, 0, 0, 0));
+
CMSettings cms(doc, "", Intent_Perceptual);
cms.allowColorManagement(false);
if (flagsVisible["Cyan"]->isChecked())
Modified: trunk/Scribus/scribus/ui/tabpdfoptions.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23830&path=/trunk/Scribus/scribus/ui/tabpdfoptions.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/tabpdfoptions.cpp (original)
+++ trunk/Scribus/scribus/ui/tabpdfoptions.cpp Mon May 25 23:49:01 2020
@@ -493,13 +493,10 @@
if (Opts.UseRGB)
OutCombo->setCurrentIndex(0);
- else
- {
- if (Opts.isGrayscale)
- OutCombo->setCurrentIndex(2);
- else
- OutCombo->setCurrentIndex(1);
- }
+ else if (Opts.isGrayscale)
+ OutCombo->setCurrentIndex(2);
+ else
+ OutCombo->setCurrentIndex(1);
useSpot->setChecked(!Opts.UseSpotColors);
UseLPI->setChecked(Opts.UseLPI);
QMap<QString,LPIData>::Iterator itlp;
@@ -711,30 +708,27 @@
pdfOptions.UseProfiles = false;
pdfOptions.UseProfiles2 = false;
}
- else
- {
- if (OutCombo->currentIndex() == 2)
- {
- pdfOptions.isGrayscale = true;
- pdfOptions.UseRGB = false;
- pdfOptions.UseProfiles = false;
- pdfOptions.UseProfiles2 = false;
- }
- else
- {
- pdfOptions.isGrayscale = false;
- pdfOptions.UseRGB = false;
- if (/*CMSuse*/ ScCore->haveCMS())
- {
- pdfOptions.UseProfiles = EmbedProfs->isChecked();
- pdfOptions.UseProfiles2 = EmbedProfs2->isChecked();
- pdfOptions.Intent = IntendS->currentIndex();
- pdfOptions.Intent2 = IntendI->currentIndex();
- pdfOptions.EmbeddedI = NoEmbedded->isChecked();
- pdfOptions.SolidProf = SolidPr->currentText();
- pdfOptions.ImageProf = ImageP->currentText();
- pdfOptions.PrintProf = PrintProfC->currentText();
- }
+ else if (OutCombo->currentIndex() == 2)
+ {
+ pdfOptions.isGrayscale = true;
+ pdfOptions.UseRGB = false;
+ pdfOptions.UseProfiles = false;
+ pdfOptions.UseProfiles2 = false;
+ }
+ else
+ {
+ pdfOptions.isGrayscale = false;
+ pdfOptions.UseRGB = false;
+ if (/*CMSuse*/ ScCore->haveCMS())
+ {
+ pdfOptions.UseProfiles = EmbedProfs->isChecked();
+ pdfOptions.UseProfiles2 = EmbedProfs2->isChecked();
+ pdfOptions.Intent = IntendS->currentIndex();
+ pdfOptions.Intent2 = IntendI->currentIndex();
+ pdfOptions.EmbeddedI = NoEmbedded->isChecked();
+ pdfOptions.SolidProf = SolidPr->currentText();
+ pdfOptions.ImageProf = ImageP->currentText();
+ pdfOptions.PrintProf = PrintProfC->currentText();
}
}
}
More information about the scribus-commit
mailing list