80
originalIsLandscape = false;
87
goldenSpiralSectionBox = 0;
89
goldenTriangleBox = 0;
97
customRatioDInput = 0;
98
customRatioNInput = 0;
105
imageSelectionWidget = 0;
78
configGroupName("aspectratiocrop Tool"),
79
configHorOrientedAspectRatioEntry("Hor.Oriented Aspect Ratio"),
80
configHorOrientedAspectRatioOrientationEntry("Hor.Oriented Aspect Ratio Orientation"),
81
configHorOrientedCustomAspectRatioNumEntry("Hor.Oriented Custom Aspect Ratio Num"),
82
configHorOrientedCustomAspectRatioDenEntry("Hor.Oriented Custom Aspect Ratio Den"),
83
configHorOrientedCustomAspectRatioXposEntry("Hor.Oriented Custom Aspect Ratio Xpos"),
84
configHorOrientedCustomAspectRatioYposEntry("Hor.Oriented Custom Aspect Ratio Ypos"),
85
configHorOrientedCustomAspectRatioWidthEntry("Hor.Oriented Custom Aspect Ratio Width"),
86
configHorOrientedCustomAspectRatioHeightEntry("Hor.Oriented Custom Aspect Ratio Height"),
87
configVerOrientedAspectRatioEntry("Ver.Oriented Aspect Ratio"),
88
configVerOrientedAspectRatioOrientationEntry("Ver.Oriented Aspect Ratio Orientation"),
89
configVerOrientedCustomAspectRatioNumEntry("Ver.Oriented Custom Aspect Ratio Num"),
90
configVerOrientedCustomAspectRatioDenEntry("Ver.Oriented Custom Aspect Ratio Den"),
91
configVerOrientedCustomAspectRatioXposEntry("Ver.Oriented Custom Aspect Ratio Xpos"),
92
configVerOrientedCustomAspectRatioYposEntry("Ver.Oriented Custom Aspect Ratio Ypos"),
93
configVerOrientedCustomAspectRatioWidthEntry("Ver.Oriented Custom Aspect Ratio Width"),
94
configVerOrientedCustomAspectRatioHeightEntry("Ver.Oriented Custom Aspect Ratio Height"),
95
configPreciseAspectRatioCropEntry("Precise Aspect Ratio Crop"),
96
configAutoOrientationEntry("Auto Orientation"),
97
configGuideLinesTypeEntry("Guide Lines Type"),
98
configGoldenSectionEntry("Golden Section"),
99
configGoldenSpiralSectionEntry("Golden Spiral Section"),
100
configGoldenSpiralEntry("Golden Spiral"),
101
configGoldenTriangleEntry("Golden Triangle"),
102
configGoldenFlipHorizontalEntry("Golden Flip Horizontal"),
103
configGoldenFlipVerticalEntry("Golden Flip Vertical"),
104
configGuideColorEntry("Guide Color"),
105
configGuideWidthEntry("Guide Width"),
107
originalIsLandscape(false),
114
goldenSpiralSectionBox(0),
116
goldenTriangleBox(0),
124
customRatioDInput(0),
125
customRatioNInput(0),
132
imageSelectionWidget(0),
137
const QString configGroupName;
138
const QString configHorOrientedAspectRatioEntry;
139
const QString configHorOrientedAspectRatioOrientationEntry;
140
const QString configHorOrientedCustomAspectRatioNumEntry;
141
const QString configHorOrientedCustomAspectRatioDenEntry;
142
const QString configHorOrientedCustomAspectRatioXposEntry;
143
const QString configHorOrientedCustomAspectRatioYposEntry;
144
const QString configHorOrientedCustomAspectRatioWidthEntry;
145
const QString configHorOrientedCustomAspectRatioHeightEntry;
146
const QString configVerOrientedAspectRatioEntry;
147
const QString configVerOrientedAspectRatioOrientationEntry;
148
const QString configVerOrientedCustomAspectRatioNumEntry;
149
const QString configVerOrientedCustomAspectRatioDenEntry;
150
const QString configVerOrientedCustomAspectRatioXposEntry;
151
const QString configVerOrientedCustomAspectRatioYposEntry;
152
const QString configVerOrientedCustomAspectRatioWidthEntry;
153
const QString configVerOrientedCustomAspectRatioHeightEntry;
154
const QString configPreciseAspectRatioCropEntry;
155
const QString configAutoOrientationEntry;
156
const QString configGuideLinesTypeEntry;
157
const QString configGoldenSectionEntry;
158
const QString configGoldenSpiralSectionEntry;
159
const QString configGoldenSpiralEntry;
160
const QString configGoldenTriangleEntry;
161
const QString configGoldenFlipHorizontalEntry;
162
const QString configGoldenFlipVerticalEntry;
163
const QString configGuideColorEntry;
164
const QString configGuideWidthEntry;
110
166
bool originalIsLandscape;
499
555
d->expbox->readSettings();
501
557
// No guide lines per default.
502
d->guideLinesCB->setCurrentIndex(group.readEntry("Guide Lines Type",
503
(int)ImageSelectionWidget::GuideNone));
504
d->goldenSectionBox->setChecked(group.readEntry("Golden Section", true));
505
d->goldenSpiralSectionBox->setChecked(group.readEntry("Golden Spiral Section", false));
506
d->goldenSpiralBox->setChecked(group.readEntry("Golden Spiral", false));
507
d->goldenTriangleBox->setChecked(group.readEntry("Golden Triangle", false));
508
d->flipHorBox->setChecked(group.readEntry("Golden Flip Horizontal", false));
509
d->flipVerBox->setChecked(group.readEntry("Golden Flip Vertical", false));
510
d->guideColorBt->setColor(group.readEntry("Guide Color", defaultGuideColor));
511
d->guideSize->setValue(group.readEntry("Guide Width", d->guideSize->defaultValue()));
558
d->guideLinesCB->setCurrentIndex(group.readEntry(d->configGuideLinesTypeEntry,
559
(int)ImageSelectionWidget::GuideNone));
560
d->goldenSectionBox->setChecked(group.readEntry(d->configGoldenSectionEntry, true));
561
d->goldenSpiralSectionBox->setChecked(group.readEntry(d->configGoldenSpiralSectionEntry, false));
562
d->goldenSpiralBox->setChecked(group.readEntry(d->configGoldenSpiralEntry, false));
563
d->goldenTriangleBox->setChecked(group.readEntry(d->configGoldenTriangleEntry, false));
564
d->flipHorBox->setChecked(group.readEntry(d->configGoldenFlipHorizontalEntry, false));
565
d->flipVerBox->setChecked(group.readEntry(d->configGoldenFlipVerticalEntry, false));
566
d->guideColorBt->setColor(group.readEntry(d->configGuideColorEntry, defaultGuideColor));
567
d->guideSize->setValue(group.readEntry(d->configGuideWidthEntry, d->guideSize->defaultValue()));
512
569
d->imageSelectionWidget->slotGuideLines(d->guideLinesCB->currentIndex());
513
570
d->imageSelectionWidget->slotChangeGuideColor(d->guideColorBt->color());
515
d->preciseCrop->setChecked( group.readEntry("Precise Aspect Ratio Crop", false) );
572
d->preciseCrop->setChecked( group.readEntry(d->configPreciseAspectRatioCropEntry, false) );
516
573
d->imageSelectionWidget->setPreciseCrop( d->preciseCrop->isChecked() );
518
575
// Empty selection so it can be moved w/out size constraint
519
576
d->widthInput->setValue(0);
520
577
d->heightInput->setValue(0);
522
d->xInput->setValue(group.readEntry("Hor.Oriented Custom Aspect Ratio Xpos",
579
d->xInput->setValue(group.readEntry(d->configHorOrientedCustomAspectRatioXposEntry,
523
580
d->xInput->defaultValue()));
524
d->yInput->setValue(group.readEntry("Hor.Oriented Custom Aspect Ratio Ypos",
581
d->yInput->setValue(group.readEntry(d->configHorOrientedCustomAspectRatioYposEntry,
525
582
d->yInput->defaultValue()));
527
d->widthInput->setValue(group.readEntry("Hor.Oriented Custom Aspect Ratio Width",
584
d->widthInput->setValue(group.readEntry(d->configHorOrientedCustomAspectRatioWidthEntry,
528
585
d->widthInput->defaultValue()));
529
d->heightInput->setValue(group.readEntry("Hor.Oriented Custom Aspect Ratio Height",
586
d->heightInput->setValue(group.readEntry(d->configHorOrientedCustomAspectRatioHeightEntry,
530
587
d->heightInput->defaultValue()));
532
589
d->imageSelectionWidget->setSelectionOrientation(d->orientCB->currentIndex());
534
d->customRatioNInput->setValue(group.readEntry("Hor.Oriented Custom Aspect Ratio Num",
591
d->customRatioNInput->setValue(group.readEntry(d->configHorOrientedCustomAspectRatioNumEntry,
535
592
d->customRatioNInput->defaultValue()));
536
d->customRatioDInput->setValue(group.readEntry("Hor.Oriented Custom Aspect Ratio Den",
593
d->customRatioDInput->setValue(group.readEntry(d->configHorOrientedCustomAspectRatioDenEntry,
537
594
d->customRatioDInput->defaultValue()));
538
d->ratioCB->setCurrentIndex(group.readEntry("Hor.Oriented Aspect Ratio",
595
d->ratioCB->setCurrentIndex(group.readEntry(d->configHorOrientedAspectRatioEntry,
539
596
d->ratioCB->defaultIndex()));
541
598
if (d->originalIsLandscape)
543
d->orientCB->setCurrentIndex(group.readEntry("Hor.Oriented Aspect Ratio Orientation",
600
d->orientCB->setCurrentIndex(group.readEntry(d->configHorOrientedAspectRatioOrientationEntry,
544
601
(int)ImageSelectionWidget::Landscape));
545
602
d->orientCB->setDefaultIndex(ImageSelectionWidget::Landscape);
549
d->orientCB->setCurrentIndex(group.readEntry("Ver.Oriented Aspect Ratio Orientation",
606
d->orientCB->setCurrentIndex(group.readEntry(d->configVerOrientedAspectRatioOrientationEntry,
550
607
(int)ImageSelectionWidget::Portrait));
551
608
d->orientCB->setDefaultIndex(ImageSelectionWidget::Portrait);
555
d->autoOrientation->setChecked(group.readEntry("Auto Orientation", false));
612
d->autoOrientation->setChecked(group.readEntry(d->configAutoOrientationEntry, false));
556
613
slotAutoOrientChanged( d->autoOrientation->isChecked() );
557
614
applyRatioChanges(d->ratioCB->currentIndex());
571
628
void RatioCropTool::writeSettings()
573
630
KSharedConfig::Ptr config = KGlobal::config();
574
KConfigGroup group = config->group("aspectratiocrop Tool");
631
KConfigGroup group = config->group(d->configGroupName);
576
633
if (d->originalIsLandscape)
578
group.writeEntry("Hor.Oriented Aspect Ratio", d->ratioCB->currentIndex());
579
group.writeEntry("Hor.Oriented Aspect Ratio Orientation", d->orientCB->currentIndex());
580
group.writeEntry("Hor.Oriented Custom Aspect Ratio Num", d->customRatioNInput->value());
581
group.writeEntry("Hor.Oriented Custom Aspect Ratio Den", d->customRatioDInput->value());
635
group.writeEntry(d->configHorOrientedAspectRatioEntry, d->ratioCB->currentIndex());
636
group.writeEntry(d->configHorOrientedAspectRatioOrientationEntry, d->orientCB->currentIndex());
637
group.writeEntry(d->configHorOrientedCustomAspectRatioNumEntry, d->customRatioNInput->value());
638
group.writeEntry(d->configHorOrientedCustomAspectRatioDenEntry, d->customRatioDInput->value());
583
group.writeEntry("Hor.Oriented Custom Aspect Ratio Xpos", d->xInput->value());
584
group.writeEntry("Hor.Oriented Custom Aspect Ratio Ypos", d->yInput->value());
585
group.writeEntry("Hor.Oriented Custom Aspect Ratio Width", d->widthInput->value());
586
group.writeEntry("Hor.Oriented Custom Aspect Ratio Height", d->heightInput->value());
640
group.writeEntry(d->configHorOrientedCustomAspectRatioXposEntry, d->xInput->value());
641
group.writeEntry(d->configHorOrientedCustomAspectRatioYposEntry, d->yInput->value());
642
group.writeEntry(d->configHorOrientedCustomAspectRatioWidthEntry, d->widthInput->value());
643
group.writeEntry(d->configHorOrientedCustomAspectRatioHeightEntry, d->heightInput->value());
590
group.writeEntry("Ver.Oriented Aspect Ratio", d->ratioCB->currentIndex());
591
group.writeEntry("Ver.Oriented Aspect Ratio Orientation", d->orientCB->currentIndex());
592
group.writeEntry("Ver.Oriented Custom Aspect Ratio Num", d->customRatioNInput->value());
593
group.writeEntry("Ver.Oriented Custom Aspect Ratio Den", d->customRatioDInput->value());
647
group.writeEntry(d->configVerOrientedAspectRatioEntry, d->ratioCB->currentIndex());
648
group.writeEntry(d->configVerOrientedAspectRatioOrientationEntry, d->orientCB->currentIndex());
649
group.writeEntry(d->configVerOrientedCustomAspectRatioNumEntry, d->customRatioNInput->value());
650
group.writeEntry(d->configVerOrientedCustomAspectRatioDenEntry, d->customRatioDInput->value());
595
group.writeEntry("Ver.Oriented Custom Aspect Ratio Xpos", d->xInput->value());
596
group.writeEntry("Ver.Oriented Custom Aspect Ratio Ypos", d->yInput->value());
597
group.writeEntry("Ver.Oriented Custom Aspect Ratio Width", d->widthInput->value());
598
group.writeEntry("Ver.Oriented Custom Aspect Ratio Height", d->heightInput->value());
652
group.writeEntry(d->configVerOrientedCustomAspectRatioXposEntry, d->xInput->value());
653
group.writeEntry(d->configVerOrientedCustomAspectRatioYposEntry, d->yInput->value());
654
group.writeEntry(d->configVerOrientedCustomAspectRatioWidthEntry, d->widthInput->value());
655
group.writeEntry(d->configVerOrientedCustomAspectRatioHeightEntry, d->heightInput->value());
601
group.writeEntry("Precise Aspect Ratio Crop", d->preciseCrop->isChecked());
602
group.writeEntry("Auto Orientation", d->autoOrientation->isChecked());
603
group.writeEntry("Guide Lines Type", d->guideLinesCB->currentIndex());
604
group.writeEntry("Golden Section", d->goldenSectionBox->isChecked());
605
group.writeEntry("Golden Spiral Section", d->goldenSpiralSectionBox->isChecked());
606
group.writeEntry("Golden Spiral", d->goldenSpiralBox->isChecked());
607
group.writeEntry("Golden Triangle", d->goldenTriangleBox->isChecked());
608
group.writeEntry("Golden Flip Horizontal", d->flipHorBox->isChecked());
609
group.writeEntry("Golden Flip Vertical", d->flipVerBox->isChecked());
610
group.writeEntry("Guide Color", d->guideColorBt->color());
611
group.writeEntry("Guide Width", d->guideSize->value());
658
group.writeEntry(d->configPreciseAspectRatioCropEntry, d->preciseCrop->isChecked());
659
group.writeEntry(d->configAutoOrientationEntry, d->autoOrientation->isChecked());
660
group.writeEntry(d->configGuideLinesTypeEntry, d->guideLinesCB->currentIndex());
661
group.writeEntry(d->configGoldenSectionEntry, d->goldenSectionBox->isChecked());
662
group.writeEntry(d->configGoldenSpiralSectionEntry, d->goldenSpiralSectionBox->isChecked());
663
group.writeEntry(d->configGoldenSpiralEntry, d->goldenSpiralBox->isChecked());
664
group.writeEntry(d->configGoldenTriangleEntry, d->goldenTriangleBox->isChecked());
665
group.writeEntry(d->configGoldenFlipHorizontalEntry, d->flipHorBox->isChecked());
666
group.writeEntry(d->configGoldenFlipVerticalEntry, d->flipVerBox->isChecked());
667
group.writeEntry(d->configGuideColorEntry, d->guideColorBt->color());
668
group.writeEntry(d->configGuideWidthEntry, d->guideSize->value());