Changeset View
Changeset View
Standalone View
Standalone View
libkookascan/scanparams.cpp
Show First 20 Lines • Show All 151 Lines • ▼ Show 20 Line(s) | 132 | { | |||
---|---|---|---|---|---|
152 | 152 | | |||
153 | ++mNextRow; | 153 | ++mNextRow; | ||
154 | } | 154 | } | ||
155 | 155 | | |||
156 | bool ScanParamsPage::lastRow() | 156 | bool ScanParamsPage::lastRow() | ||
157 | { | 157 | { | ||
158 | addGroup(nullptr); // hide last if present | 158 | addGroup(nullptr); // hide last if present | ||
159 | 159 | | |||
160 | mLayout->addWidget(new QLabel(QString::null, this), mNextRow, 0, 1, -1, Qt::AlignTop); | 160 | mLayout->addWidget(new QLabel(QString(), this), mNextRow, 0, 1, -1, Qt::AlignTop); | ||
161 | mLayout->setRowStretch(mNextRow, 9); | 161 | mLayout->setRowStretch(mNextRow, 9); | ||
162 | 162 | | |||
163 | return (mNextRow > 0); | 163 | return (mNextRow > 0); | ||
164 | } | 164 | } | ||
165 | 165 | | |||
166 | void ScanParamsPage::addGroup(QWidget *wid) | 166 | void ScanParamsPage::addGroup(QWidget *wid) | ||
167 | { | 167 | { | ||
168 | if (mPendingGroup != nullptr) { | 168 | if (mPendingGroup != nullptr) { | ||
▲ Show 20 Lines • Show All 95 Lines • ▼ Show 20 Line(s) | 216 | #endif | |||
264 | 264 | | |||
265 | pb = new QPushButton(QIcon::fromTheme("scan"), i18n("Star&t Scan"), this); | 265 | pb = new QPushButton(QIcon::fromTheme("scan"), i18n("Star&t Scan"), this); | ||
266 | pb->setToolTip(i18n("Start a scan and save the scanned image")); | 266 | pb->setToolTip(i18n("Start a scan and save the scanned image")); | ||
267 | pb->setMinimumWidth(100); | 267 | pb->setMinimumWidth(100); | ||
268 | connect(pb, &QPushButton::clicked, this, &ScanParams::slotStartScan); | 268 | connect(pb, &QPushButton::clicked, this, &ScanParams::slotStartScan); | ||
269 | lay->addWidget(pb, 5, 1, Qt::AlignRight); | 269 | lay->addWidget(pb, 5, 1, Qt::AlignRight); | ||
270 | 270 | | |||
271 | /* Initialise the progress dialog */ | 271 | /* Initialise the progress dialog */ | ||
272 | mProgressDialog = new QProgressDialog(QString::null, i18n("Stop"), 0, 100, nullptr); | 272 | mProgressDialog = new QProgressDialog(QString(), i18n("Stop"), 0, 100, nullptr); | ||
273 | mProgressDialog->setModal(true); | 273 | mProgressDialog->setModal(true); | ||
274 | mProgressDialog->setAutoClose(true); | 274 | mProgressDialog->setAutoClose(true); | ||
275 | mProgressDialog->setAutoReset(true); | 275 | mProgressDialog->setAutoReset(true); | ||
276 | mProgressDialog->setWindowTitle(i18n("Scanning")); | 276 | mProgressDialog->setWindowTitle(i18n("Scanning")); | ||
277 | mProgressDialog->setMinimumDuration(100); | 277 | mProgressDialog->setMinimumDuration(100); | ||
278 | // The next is necessary with Qt5, as otherwise the progress dialogue | 278 | // The next is necessary with Qt5, as otherwise the progress dialogue | ||
279 | // appears to show itself after the default 'minimumDuration' (= 4 seconds), | 279 | // appears to show itself after the default 'minimumDuration' (= 4 seconds), | ||
280 | // even despite the previous and no 'value' being set. | 280 | // even despite the previous and no 'value' being set. | ||
281 | mProgressDialog->reset(); | 281 | mProgressDialog->reset(); | ||
282 | setScanDestination(QString::null); // reset destination display | 282 | setScanDestination(QString()); // reset destination display | ||
283 | 283 | | |||
284 | connect(mProgressDialog, &QProgressDialog::canceled, mSaneDevice, &KScanDevice::slotStopScanning); | 284 | connect(mProgressDialog, &QProgressDialog::canceled, mSaneDevice, &KScanDevice::slotStopScanning); | ||
285 | connect(mSaneDevice, &KScanDevice::sigScanProgress, this, &ScanParams::slotScanProgress); | 285 | connect(mSaneDevice, &KScanDevice::sigScanProgress, this, &ScanParams::slotScanProgress); | ||
286 | 286 | | |||
287 | return (true); | 287 | return (true); | ||
288 | } | 288 | } | ||
289 | 289 | | |||
290 | KLed *ScanParams::operationLED() const | 290 | KLed *ScanParams::operationLED() const | ||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | 330 | if (mVirtualFile != nullptr) { | |||
357 | vbgGroup->addButton(rb2, 1); | 357 | vbgGroup->addButton(rb2, 1); | ||
358 | connect(vbgGroup, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), this, &ScanParams::slotVirtScanModeSelect); | 358 | connect(vbgGroup, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), this, &ScanParams::slotVirtScanModeSelect); | ||
359 | 359 | | |||
360 | l = new QLabel(i18n("Reading mode:"), frame); | 360 | l = new QLabel(i18n("Reading mode:"), frame); | ||
361 | frame->addRow(l, vbg, nullptr, Qt::AlignTop); | 361 | frame->addRow(l, vbg, nullptr, Qt::AlignTop); | ||
362 | 362 | | |||
363 | // Separator line after these. Using a KScanGroup with a null text, | 363 | // Separator line after these. Using a KScanGroup with a null text, | ||
364 | // so that it looks the same as any real group separators following. | 364 | // so that it looks the same as any real group separators following. | ||
365 | frame->addGroup(new KScanGroup(frame, QString::null)); | 365 | frame->addGroup(new KScanGroup(frame, QString())); | ||
366 | } | 366 | } | ||
367 | 367 | | |||
368 | // Mode setting | 368 | // Mode setting | ||
369 | so = mSaneDevice->getGuiElement(SANE_NAME_SCAN_MODE, frame); | 369 | so = mSaneDevice->getGuiElement(SANE_NAME_SCAN_MODE, frame); | ||
370 | if (so != nullptr) { | 370 | if (so != nullptr) { | ||
371 | KScanCombo *cb = (KScanCombo *) so->widget(); | 371 | KScanCombo *cb = (KScanCombo *) so->widget(); | ||
372 | 372 | | |||
373 | // The option display strings are translated via the 'sane-backends' message | 373 | // The option display strings are translated via the 'sane-backends' message | ||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Line(s) | |||||
444 | // Scan size setting | 444 | // Scan size setting | ||
445 | mAreaSelect = new ScanSizeSelector(frame, mSaneDevice->getMaxScanSize()); | 445 | mAreaSelect = new ScanSizeSelector(frame, mSaneDevice->getMaxScanSize()); | ||
446 | connect(mAreaSelect, &ScanSizeSelector::sizeSelected, this, &ScanParams::slotScanSizeSelected); | 446 | connect(mAreaSelect, &ScanSizeSelector::sizeSelected, this, &ScanParams::slotScanSizeSelected); | ||
447 | l = new QLabel("Scan &area:", frame); // make sure it gets an accel | 447 | l = new QLabel("Scan &area:", frame); // make sure it gets an accel | ||
448 | l->setBuddy(mAreaSelect->focusProxy()); | 448 | l->setBuddy(mAreaSelect->focusProxy()); | ||
449 | frame->addRow(l, mAreaSelect, nullptr, Qt::AlignTop); | 449 | frame->addRow(l, mAreaSelect, nullptr, Qt::AlignTop); | ||
450 | 450 | | |||
451 | // Insert another beautification line | 451 | // Insert another beautification line | ||
452 | frame->addGroup(new KScanGroup(frame, QString::null)); | 452 | frame->addGroup(new KScanGroup(frame, QString())); | ||
453 | 453 | | |||
454 | // Source selection | 454 | // Source selection | ||
455 | mSourceSelect = mSaneDevice->getGuiElement(SANE_NAME_SCAN_SOURCE, frame); | 455 | mSourceSelect = mSaneDevice->getGuiElement(SANE_NAME_SCAN_SOURCE, frame); | ||
456 | if (mSourceSelect != nullptr) { | 456 | if (mSourceSelect != nullptr) { | ||
457 | connect(mSourceSelect, &KScanOption::guiChange, this, &ScanParams::slotOptionChanged); | 457 | connect(mSourceSelect, &KScanOption::guiChange, this, &ScanParams::slotOptionChanged); | ||
458 | 458 | | |||
459 | l = mSourceSelect->getLabel(frame, true); | 459 | l = mSourceSelect->getLabel(frame, true); | ||
460 | w = mSourceSelect->widget(); | 460 | w = mSourceSelect->widget(); | ||
▲ Show 20 Lines • Show All 214 Lines • ▼ Show 20 Line(s) | 674 | if (d.exec() != QDialog::Accepted) { | |||
675 | return; | 675 | return; | ||
676 | } | 676 | } | ||
677 | 677 | | |||
678 | QString sel_source = d.getText(); | 678 | QString sel_source = d.getText(); | ||
679 | adf = d.getAdfBehave(); | 679 | adf = d.getAdfBehave(); | ||
680 | //qDebug() << "new source" << sel_source << "ADF" << adf; | 680 | //qDebug() << "new source" << sel_source << "ADF" << adf; | ||
681 | 681 | | |||
682 | /* set the selected Document source, the behavior is stored in a membervar */ | 682 | /* set the selected Document source, the behavior is stored in a membervar */ | ||
683 | mSourceSelect->set(sel_source.toLatin1()); // TODO: FIX in ScanSourceDialog, then here | 683 | mSourceSelect->set(sel_source.toLatin1()); // TODO: FIX in ScanSourceDialog, then here | ||
684 | mSourceSelect->apply(); | 684 | mSourceSelect->apply(); | ||
685 | mSourceSelect->reload(); | 685 | mSourceSelect->reload(); | ||
686 | mSourceSelect->redrawWidget(); | 686 | mSourceSelect->redrawWidget(); | ||
687 | #endif | 687 | #endif | ||
688 | } | 688 | } | ||
689 | 689 | | |||
690 | /* Slot which is called if the user switches in the gui between | 690 | /* Slot which is called if the user switches in the gui between | ||
691 | * the SANE-Debug-Mode and the qt image reading | 691 | * the SANE-Debug-Mode and the qt image reading | ||
Show All 15 Lines | 694 | { | |||
707 | 707 | | |||
708 | mAreaSelect->setEnabled(enable); | 708 | mAreaSelect->setEnabled(enable); | ||
709 | } | 709 | } | ||
710 | 710 | | |||
711 | KScanDevice::Status ScanParams::prepareScan(QString *vfp) | 711 | KScanDevice::Status ScanParams::prepareScan(QString *vfp) | ||
712 | { | 712 | { | ||
713 | //qDebug() << "scan mode=" << mScanMode; | 713 | //qDebug() << "scan mode=" << mScanMode; | ||
714 | 714 | | |||
715 | setScanDestination(QString::null); // reset progress display | 715 | setScanDestination(QString()); // reset progress display | ||
716 | 716 | | |||
717 | // Check compatibility of scan settings | 717 | // Check compatibility of scan settings | ||
718 | int format; | 718 | int format; | ||
719 | int depth; | 719 | int depth; | ||
720 | mSaneDevice->getCurrentFormat(&format, &depth); | 720 | mSaneDevice->getCurrentFormat(&format, &depth); | ||
721 | if (depth == 1 && format != SANE_FRAME_GRAY) { // 1-bit scan depth in colour? | 721 | if (depth == 1 && format != SANE_FRAME_GRAY) { // 1-bit scan depth in colour? | ||
722 | KMessageBox::sorry(this, i18n("1-bit depth scan cannot be done in color")); | 722 | KMessageBox::sorry(this, i18n("1-bit depth scan cannot be done in color")); | ||
723 | return (KScanDevice::ParamError); | 723 | return (KScanDevice::ParamError); | ||
724 | } else if (depth == 16) { | 724 | } else if (depth == 16) { | ||
725 | KMessageBox::sorry(this, i18n("16-bit depth scans are not supported")); | 725 | KMessageBox::sorry(this, i18n("16-bit depth scans are not supported")); | ||
726 | return (KScanDevice::ParamError); | 726 | return (KScanDevice::ParamError); | ||
727 | } | 727 | } | ||
728 | 728 | | |||
729 | QString virtfile; | 729 | QString virtfile; | ||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Line(s) | 781 | { | |||
798 | //qDebug() << "scan mode=" << mScanMode << "virtfile" << virtfile; | 798 | //qDebug() << "scan mode=" << mScanMode << "virtfile" << virtfile; | ||
799 | 799 | | |||
800 | KScanOption *greyPreview = mSaneDevice->getExistingGuiElement(SANE_NAME_GRAY_PREVIEW); | 800 | KScanOption *greyPreview = mSaneDevice->getExistingGuiElement(SANE_NAME_GRAY_PREVIEW); | ||
801 | int gp = 0; | 801 | int gp = 0; | ||
802 | if (greyPreview != nullptr) { | 802 | if (greyPreview != nullptr) { | ||
803 | greyPreview->get(&gp); | 803 | greyPreview->get(&gp); | ||
804 | } | 804 | } | ||
805 | 805 | | |||
806 | setMaximalScanSize(); // always preview at maximal size | 806 | setMaximalScanSize(); // always preview at maximal size | ||
807 | mAreaSelect->selectCustomSize(QRect()); // reset selector to reflect that | 807 | mAreaSelect->selectCustomSize(QRect()); // reset selector to reflect that | ||
808 | 808 | | |||
809 | stat = mSaneDevice->acquirePreview(gp); | 809 | stat = mSaneDevice->acquirePreview(gp); | ||
810 | if (stat != KScanDevice::Ok) { | 810 | if (stat != KScanDevice::Ok) { | ||
811 | //qDebug() << "Error, preview status " << stat; | 811 | //qDebug() << "Error, preview status " << stat; | ||
812 | } | 812 | } | ||
813 | } | 813 | } | ||
814 | 814 | | |||
815 | /* Slot called to start scanning */ | 815 | /* Slot called to start scanning */ | ||
816 | void ScanParams::slotStartScan() | 816 | void ScanParams::slotStartScan() | ||
817 | { | 817 | { | ||
818 | QString virtfile; | 818 | QString virtfile; | ||
819 | KScanDevice::Status stat = prepareScan(&virtfile); | 819 | KScanDevice::Status stat = prepareScan(&virtfile); | ||
820 | if (stat != KScanDevice::Ok) { | 820 | if (stat != KScanDevice::Ok) { | ||
821 | return; | 821 | return; | ||
822 | } | 822 | } | ||
823 | 823 | | |||
824 | //qDebug() << "scan mode=" << mScanMode << "virtfile" << virtfile; | 824 | //qDebug() << "scan mode=" << mScanMode << "virtfile" << virtfile; | ||
825 | 825 | | |||
826 | if (mScanMode != ScanParams::VirtualScannerMode) { // acquire via SANE | 826 | if (mScanMode != ScanParams::VirtualScannerMode) { // acquire via SANE | ||
827 | #if 0 | 827 | #if 0 | ||
828 | // TODO: port/update | 828 | // TODO: port/update | ||
829 | if (adf == ADF_OFF) { | 829 | if (adf == ADF_OFF) { | ||
830 | #endif | 830 | #endif | ||
831 | //qDebug() << "Start to acquire image"; | 831 | //qDebug() << "Start to acquire image"; | ||
832 | stat = mSaneDevice->acquireScan(); | 832 | stat = mSaneDevice->acquireScan(); | ||
833 | #if 0 | 833 | #if 0 | ||
834 | } else { | 834 | } else { | ||
Show All 34 Lines | 864 | { | |||
869 | 869 | | |||
870 | //qDebug() << "set" << so->getName() << "=" << gt->toString(); | 870 | //qDebug() << "set" << so->getName() << "=" << gt->toString(); | ||
871 | so->set(gt); | 871 | so->set(gt); | ||
872 | return (so->apply()); | 872 | return (so->apply()); | ||
873 | } | 873 | } | ||
874 | 874 | | |||
875 | void ScanParams::slotEditCustGamma() | 875 | void ScanParams::slotEditCustGamma() | ||
876 | { | 876 | { | ||
877 | KGammaTable gt; // start with default values | 877 | KGammaTable gt; // start with default values | ||
878 | 878 | | |||
879 | // Get the current gamma table from either the combined gamma table | 879 | // Get the current gamma table from either the combined gamma table | ||
880 | // option, or any one of the colour channel gamma tables. | 880 | // option, or any one of the colour channel gamma tables. | ||
881 | if (!getGammaTableFrom(SANE_NAME_GAMMA_VECTOR, >)) { | 881 | if (!getGammaTableFrom(SANE_NAME_GAMMA_VECTOR, >)) { | ||
882 | if (!getGammaTableFrom(SANE_NAME_GAMMA_VECTOR_R, >)) { | 882 | if (!getGammaTableFrom(SANE_NAME_GAMMA_VECTOR_R, >)) { | ||
883 | if (!getGammaTableFrom(SANE_NAME_GAMMA_VECTOR_G, >)) { | 883 | if (!getGammaTableFrom(SANE_NAME_GAMMA_VECTOR_G, >)) { | ||
884 | if (!getGammaTableFrom(SANE_NAME_GAMMA_VECTOR_B, >)) { | 884 | if (!getGammaTableFrom(SANE_NAME_GAMMA_VECTOR_B, >)) { | ||
885 | // Should not happen... but if it does, no problem | 885 | // Should not happen... but if it does, no problem | ||
Show All 21 Lines | |||||
907 | { | 907 | { | ||
908 | if (gt == nullptr) { | 908 | if (gt == nullptr) { | ||
909 | return; | 909 | return; | ||
910 | } | 910 | } | ||
911 | 911 | | |||
912 | bool reload = false; | 912 | bool reload = false; | ||
913 | 913 | | |||
914 | KScanOption *so = mSaneDevice->getOption(SANE_NAME_CUSTOM_GAMMA); | 914 | KScanOption *so = mSaneDevice->getOption(SANE_NAME_CUSTOM_GAMMA); | ||
915 | if (so != nullptr) { // do we have a gamma switch? | 915 | if (so != nullptr) { // do we have a gamma switch? | ||
916 | int cg = 0; | 916 | int cg = 0; | ||
917 | if (so->get(&cg) && !cg) { // yes, see if already on | 917 | if (so->get(&cg) && !cg) { // yes, see if already on | ||
918 | // if not, set it on now | 918 | // if not, set it on now | ||
919 | //qDebug() << "Setting gamma switch on"; | 919 | //qDebug() << "Setting gamma switch on"; | ||
920 | so->set(true); | 920 | so->set(true); | ||
921 | reload = so->apply(); | 921 | reload = so->apply(); | ||
922 | } | 922 | } | ||
923 | } | 923 | } | ||
924 | 924 | | |||
925 | //qDebug() << "Applying gamma table" << gt->toString(); | 925 | //qDebug() << "Applying gamma table" << gt->toString(); | ||
926 | reload |= setGammaTableTo(SANE_NAME_GAMMA_VECTOR, gt); | 926 | reload |= setGammaTableTo(SANE_NAME_GAMMA_VECTOR, gt); | ||
927 | reload |= setGammaTableTo(SANE_NAME_GAMMA_VECTOR_R, gt); | 927 | reload |= setGammaTableTo(SANE_NAME_GAMMA_VECTOR_R, gt); | ||
928 | reload |= setGammaTableTo(SANE_NAME_GAMMA_VECTOR_G, gt); | 928 | reload |= setGammaTableTo(SANE_NAME_GAMMA_VECTOR_G, gt); | ||
929 | reload |= setGammaTableTo(SANE_NAME_GAMMA_VECTOR_B, gt); | 929 | reload |= setGammaTableTo(SANE_NAME_GAMMA_VECTOR_B, gt); | ||
930 | 930 | | |||
931 | if (reload) { | 931 | if (reload) { | ||
932 | mSaneDevice->reloadAllOptions(); // reload is needed | 932 | mSaneDevice->reloadAllOptions(); // reload is needed | ||
933 | } | 933 | } | ||
934 | } | 934 | } | ||
935 | 935 | | |||
936 | // The user has changed an option. Apply that; as a result of doing so, | 936 | // The user has changed an option. Apply that; as a result of doing so, | ||
937 | // it may be necessary to reload every other scanner option apart from | 937 | // it may be necessary to reload every other scanner option apart from | ||
938 | // this one. | 938 | // this one. | ||
939 | 939 | | |||
940 | void ScanParams::slotOptionChanged(KScanOption *so) | 940 | void ScanParams::slotOptionChanged(KScanOption *so) | ||
▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Line(s) | 1005 | { | |||
1008 | KScanOption *tl_x = mSaneDevice->getOption(SANE_NAME_SCAN_TL_X); | 1008 | KScanOption *tl_x = mSaneDevice->getOption(SANE_NAME_SCAN_TL_X); | ||
1009 | KScanOption *tl_y = mSaneDevice->getOption(SANE_NAME_SCAN_TL_Y); | 1009 | KScanOption *tl_y = mSaneDevice->getOption(SANE_NAME_SCAN_TL_Y); | ||
1010 | KScanOption *br_x = mSaneDevice->getOption(SANE_NAME_SCAN_BR_X); | 1010 | KScanOption *br_x = mSaneDevice->getOption(SANE_NAME_SCAN_BR_X); | ||
1011 | KScanOption *br_y = mSaneDevice->getOption(SANE_NAME_SCAN_BR_Y); | 1011 | KScanOption *br_y = mSaneDevice->getOption(SANE_NAME_SCAN_BR_Y); | ||
1012 | 1012 | | |||
1013 | double min1, max1; | 1013 | double min1, max1; | ||
1014 | double min2, max2; | 1014 | double min2, max2; | ||
1015 | 1015 | | |||
1016 | if (!rect.isValid()) { // set full scan area | 1016 | if (!rect.isValid()) { // set full scan area | ||
1017 | tl_x->getRange(&min1, &max1); tl_x->set(min1); | 1017 | tl_x->getRange(&min1, &max1); tl_x->set(min1); | ||
1018 | br_x->getRange(&min1, &max1); br_x->set(max1); | 1018 | br_x->getRange(&min1, &max1); br_x->set(max1); | ||
1019 | tl_y->getRange(&min2, &max2); tl_y->set(min2); | 1019 | tl_y->getRange(&min2, &max2); tl_y->set(min2); | ||
1020 | br_y->getRange(&min2, &max2); br_y->set(max2); | 1020 | br_y->getRange(&min2, &max2); br_y->set(max2); | ||
1021 | 1021 | | |||
1022 | //qDebug() << "setting full area" << min1 << min2 << "-" << max1 << max2; | 1022 | //qDebug() << "setting full area" << min1 << min2 << "-" << max1 << max2; | ||
1023 | } else { | 1023 | } else { | ||
1024 | double tlx = rect.left(); | 1024 | double tlx = rect.left(); | ||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Line(s) | 1081 | { | |||
1093 | int y_res = 0; // get the Y resolution | 1093 | int y_res = 0; // get the Y resolution | ||
1094 | if (opt_y != nullptr && opt_y->isValid()) { | 1094 | if (opt_y != nullptr && opt_y->isValid()) { | ||
1095 | opt_y->get(&y_res); | 1095 | opt_y->get(&y_res); | ||
1096 | } | 1096 | } | ||
1097 | 1097 | | |||
1098 | //qDebug() << "X/Y resolution" << x_res << y_res; | 1098 | //qDebug() << "X/Y resolution" << x_res << y_res; | ||
1099 | 1099 | | |||
1100 | if (y_res == 0) { | 1100 | if (y_res == 0) { | ||
1101 | y_res = x_res; // use X res if Y unavailable | 1101 | y_res = x_res; // use X res if Y unavailable | ||
1102 | } | 1102 | } | ||
1103 | if (x_res == 0) { | 1103 | if (x_res == 0) { | ||
1104 | x_res = y_res; // unlikely, but orthogonal | 1104 | x_res = y_res; // unlikely, but orthogonal | ||
1105 | } | 1105 | } | ||
1106 | 1106 | | |||
1107 | if (x_res == 0 && y_res == 0) { | 1107 | if (x_res == 0 && y_res == 0) { | ||
1108 | //qDebug() << "resolution not available!"; | 1108 | //qDebug() << "resolution not available!"; | ||
1109 | } else { | 1109 | } else { | ||
1110 | emit scanResolutionChanged(x_res, y_res); | 1110 | emit scanResolutionChanged(x_res, y_res); | ||
1111 | } | 1111 | } | ||
1112 | } | 1112 | } | ||
1113 | 1113 | | |||
1114 | void ScanParams::slotNewScanMode() | 1114 | void ScanParams::slotNewScanMode() | ||
1115 | { | 1115 | { | ||
1116 | int format = SANE_FRAME_RGB; | 1116 | int format = SANE_FRAME_RGB; | ||
1117 | int depth = 8; | 1117 | int depth = 8; | ||
1118 | mSaneDevice->getCurrentFormat(&format, &depth); | 1118 | mSaneDevice->getCurrentFormat(&format, &depth); | ||
1119 | 1119 | | |||
1120 | int strips = (format == SANE_FRAME_GRAY ? 1 : 3); | 1120 | int strips = (format == SANE_FRAME_GRAY ? 1 : 3); | ||
1121 | 1121 | | |||
1122 | qDebug() << "format" << format << "depth" << depth << "-> strips " << strips; | 1122 | qDebug() << "format" << format << "depth" << depth << "-> strips " << strips; | ||
1123 | 1123 | | |||
1124 | if (strips == 1 && depth == 1) { // bitmap scan | 1124 | if (strips == 1 && depth == 1) { // bitmap scan | ||
1125 | emit scanModeChanged(0); // 8 pixels per byte | 1125 | emit scanModeChanged(0); // 8 pixels per byte | ||
1126 | } else { | 1126 | } else { | ||
1127 | // bytes per pixel | 1127 | // bytes per pixel | ||
1128 | emit scanModeChanged(strips * (depth == 16 ? 2 : 1)); | 1128 | emit scanModeChanged(strips * (depth == 16 ? 2 : 1)); | ||
1129 | } | 1129 | } | ||
1130 | } | 1130 | } | ||
1131 | 1131 | | |||
1132 | KScanDevice::Status ScanParams::performADFScan() | 1132 | KScanDevice::Status ScanParams::performADFScan() | ||
1133 | { | 1133 | { | ||
Show All 16 Lines |