| 1 | /*************************************************************************** |
| 2 | * This file is part of Robocut. * |
| 3 | * Copyright (C) 2010 Tim Hutt <[email protected]> * |
| 4 | * Copyright (C) 2010 Markus Schulz <[email protected]> * |
| 5 | * * |
| 6 | * This program is free software; you can redistribute it and/or modify * |
| 7 | * it under the terms of the GNU General Public License as published by * |
| 8 | * the Free Software Foundation; either version 3 of the License, or * |
| 9 | * (at your option) any later version. * |
| 10 | * * |
| 11 | * This program is distributed in the hope that it will be useful, * |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 14 | * GNU General Public License for more details. * |
| 15 | * * |
| 16 | * You should have received a copy of the GNU General Public License * |
| 17 | * along with this program; if not, write to the * |
| 18 | * Free Software Foundation, Inc., * |
| 19 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * |
| 20 | ***************************************************************************/ |
| 21 | |
| 22 | #include "CutDialog.h"cxx . . $ `<file>/CutDialog.h`/ |
| 23 | #include "ui_CutDialog.h"cxx . . $ `<file>/ui_CutDialog.h`/ |
| 24 | #include "ProgramOptions.h"cxx . . $ `<file>/ProgramOptions.h`/ |
| 25 | |
| 26 | CutDialogcxx . . $ CutDialog#::CutDialogcxx . . $ CutDialog#CutDialog(108f35f7aa7f3cf9).(QWidgetcxx . . $ QWidget# *parent) : |
| 27 | QDialogcxx . . $ QDialog#QDialog(872e7b0c281abd8d).(parent), |
| 28 | uicxx . . $ CutDialog#ui.(new Uicxx . . $ Ui/::CutDialogcxx . . $ Ui/CutDialog#) |
| 29 | { |
| 30 | uicxx . . $ CutDialog#ui.->setupUicxx . . $ Ui_CutDialog#setupUi(d194de0c0f68c28b).(this); |
| 31 | uicxx . . $ CutDialog#ui.->mediaCombocxx . . $ Ui_CutDialog#mediaCombo.->setCurrentIndexcxx . . $ QComboBox#setCurrentIndex(d4f767463ce0a6b3).(ProgramOptionscxx . . $ ProgramOptions#::Instancecxx . . $ ProgramOptions#Instance(63cd40b15f95c435).().getMediacxx . . $ ProgramOptions#getMedia(b126dc7c1de90089).()); |
| 32 | uicxx . . $ CutDialog#ui.->speedSlidercxx . . $ Ui_CutDialog#speedSlider.->setValuecxx . . $ QAbstractSlider#setValue(d4f767463ce0a6b3).(ProgramOptionscxx . . $ ProgramOptions#::Instancecxx . . $ ProgramOptions#Instance(63cd40b15f95c435).().getSpeedcxx . . $ ProgramOptions#getSpeed(b126dc7c1de90089).()); |
| 33 | uicxx . . $ CutDialog#ui.->pressureSlidercxx . . $ Ui_CutDialog#pressureSlider.->setValuecxx . . $ QAbstractSlider#setValue(d4f767463ce0a6b3).(ProgramOptionscxx . . $ ProgramOptions#::Instancecxx . . $ ProgramOptions#Instance(63cd40b15f95c435).().getPressurecxx . . $ ProgramOptions#getPressure(b126dc7c1de90089).()); |
| 34 | uicxx . . $ CutDialog#ui.->trackEnhancingCheckboxcxx . . $ Ui_CutDialog#trackEnhancingCheckbox.->setCheckedcxx . . $ QAbstractButton#setChecked(b45ddcbc8423892c).(ProgramOptionscxx . . $ ProgramOptions#::Instancecxx . . $ ProgramOptions#Instance(63cd40b15f95c435).().getTrackEnhancingcxx . . $ ProgramOptions#getTrackEnhancing(b126dc7c1de90089).()); |
| 35 | if(ProgramOptionscxx . . $ ProgramOptions#::Instancecxx . . $ ProgramOptions#Instance(63cd40b15f95c435).().getRegMarkcxx . . $ ProgramOptions#getRegMark(b126dc7c1de90089).()) |
| 36 | { |
| 37 | uicxx . . $ CutDialog#ui.->regMarksGroupcxx . . $ Ui_CutDialog#regMarksGroup.->setCheckedcxx . . $ QGroupBox#setChecked(b45ddcbc8423892c).(true); |
| 38 | uicxx . . $ CutDialog#ui.->regSearchCheckboxcxx . . $ Ui_CutDialog#regSearchCheckbox.->setCheckedcxx . . $ QAbstractButton#setChecked(b45ddcbc8423892c).(false); |
| 39 | } |
| 40 | if(ProgramOptionscxx . . $ ProgramOptions#::Instancecxx . . $ ProgramOptions#Instance(63cd40b15f95c435).().getRegMarkAutocxx . . $ ProgramOptions#getRegMarkAuto(b126dc7c1de90089).()) |
| 41 | { |
| 42 | uicxx . . $ CutDialog#ui.->regMarksGroupcxx . . $ Ui_CutDialog#regMarksGroup.->setCheckedcxx . . $ QGroupBox#setChecked(b45ddcbc8423892c).(true); |
| 43 | uicxx . . $ CutDialog#ui.->regSearchCheckboxcxx . . $ Ui_CutDialog#regSearchCheckbox.->setCheckedcxx . . $ QAbstractButton#setChecked(b45ddcbc8423892c).(true); |
| 44 | } |
| 45 | uicxx . . $ CutDialog#ui.->regWidthSpinnercxx . . $ Ui_CutDialog#regWidthSpinner.->setValuecxx . . $ QDoubleSpinBox#setValue(ba8836b59fb42830).(ProgramOptionscxx . . $ ProgramOptions#::Instancecxx . . $ ProgramOptions#Instance(63cd40b15f95c435).().getRegDimensionWidthMMcxx . . $ ProgramOptions#getRegDimensionWidthMM(31fa7155c10fdd13).()); |
| 46 | uicxx . . $ CutDialog#ui.->regHeightSpinnercxx . . $ Ui_CutDialog#regHeightSpinner.->setValuecxx . . $ QDoubleSpinBox#setValue(ba8836b59fb42830).(ProgramOptionscxx . . $ ProgramOptions#::Instancecxx . . $ ProgramOptions#Instance(63cd40b15f95c435).().getRegDimensionHeightMMcxx . . $ ProgramOptions#getRegDimensionHeightMM(31fa7155c10fdd13).()); |
| 47 | } |
| 48 | |
| 49 | CutDialogcxx . . $ CutDialog#::~cxx . . $ CutDialog#`~CutDialog`(49f6e7a06ebc5aa8).CutDialogcxx . . $ CutDialog#() |
| 50 | { |
| 51 | delete uicxx . . $ CutDialog#ui.; |
| 52 | } |
| 53 | |
| 54 | void CutDialogcxx . . $ CutDialog#::changeEventcxx . . $ CutDialog#changeEvent(c2473e2e70986fd7).(QEventcxx . . $ QEvent# *e) |
| 55 | { |
| 56 | QDialogcxx . . $ QDialog#::changeEventcxx . . $ QWidget#changeEvent(c2473e2e70986fd7).(e); |
| 57 | switch (e->typecxx . . $ QEvent#type(916a8de57f4d422b).()) { |
| 58 | case QEventcxx . . $ QEvent#::LanguageChangecxx . . $ QEvent#LanguageChange.: |
| 59 | uicxx . . $ CutDialog#ui.->retranslateUicxx . . $ Ui_CutDialog#retranslateUi(d194de0c0f68c28b).(this); |
| 60 | break; |
| 61 | default: |
| 62 | break; |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | int CutDialogcxx . . $ CutDialog#::mediacxx . . $ CutDialog#media(455f465bc33b4cdf).() const |
| 67 | { |
| 68 | int idx = uicxx . . $ CutDialog#ui.->mediaCombocxx . . $ Ui_CutDialog#mediaCombo.->currentIndexcxx . . $ QComboBox#currentIndex(455f465bc33b4cdf).(); |
| 69 | |
| 70 | // Media code for each entry. |
| 71 | int medias[] = { |
| 72 | 100, 101, 102, 106, 111, 112, 113, 120, 121, 122, 123, 124, 125, |
| 73 | 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138 |
| 74 | }; |
| 75 | |
| 76 | if (idx < 0 || idx >= 26) |
| 77 | idx = 0; |
| 78 | return medias[idx]; |
| 79 | } |
| 80 | int CutDialogcxx . . $ CutDialog#::speedcxx . . $ CutDialog#speed(455f465bc33b4cdf).() const |
| 81 | { |
| 82 | return uicxx . . $ CutDialog#ui.->speedSlidercxx . . $ Ui_CutDialog#speedSlider.->valuecxx . . $ QAbstractSlider#value(455f465bc33b4cdf).(); |
| 83 | } |
| 84 | int CutDialogcxx . . $ CutDialog#::pressurecxx . . $ CutDialog#pressure(455f465bc33b4cdf).() const |
| 85 | { |
| 86 | return uicxx . . $ CutDialog#ui.->pressureSlidercxx . . $ Ui_CutDialog#pressureSlider.->valuecxx . . $ QAbstractSlider#value(455f465bc33b4cdf).(); |
| 87 | } |
| 88 | bool CutDialogcxx . . $ CutDialog#::trackEnhancingcxx . . $ CutDialog#trackEnhancing(50ce9a9e25b4a850).() const |
| 89 | { |
| 90 | return uicxx . . $ CutDialog#ui.->trackEnhancingCheckboxcxx . . $ Ui_CutDialog#trackEnhancingCheckbox.->isCheckedcxx . . $ QAbstractButton#isChecked(50ce9a9e25b4a850).(); |
| 91 | } |
| 92 | |
| 93 | bool CutDialogcxx . . $ CutDialog#::regMarkcxx . . $ CutDialog#regMark(50ce9a9e25b4a850).() const |
| 94 | { |
| 95 | return uicxx . . $ CutDialog#ui.->regMarksGroupcxx . . $ Ui_CutDialog#regMarksGroup.->isCheckedcxx . . $ QGroupBox#isChecked(50ce9a9e25b4a850).(); |
| 96 | } |
| 97 | |
| 98 | bool CutDialogcxx . . $ CutDialog#::regSearchcxx . . $ CutDialog#regSearch(50ce9a9e25b4a850).() const |
| 99 | { |
| 100 | return uicxx . . $ CutDialog#ui.->regSearchCheckboxcxx . . $ Ui_CutDialog#regSearchCheckbox.->isCheckedcxx . . $ QAbstractButton#isChecked(50ce9a9e25b4a850).(); |
| 101 | } |
| 102 | |
| 103 | double CutDialogcxx . . $ CutDialog#::regWidthcxx . . $ CutDialog#regWidth(21b6c25e127938e2).() const |
| 104 | { |
| 105 | return uicxx . . $ CutDialog#ui.->regWidthSpinnercxx . . $ Ui_CutDialog#regWidthSpinner.->valuecxx . . $ QDoubleSpinBox#value(21b6c25e127938e2).(); |
| 106 | } |
| 107 | |
| 108 | double CutDialogcxx . . $ CutDialog#::regHeightcxx . . $ CutDialog#regHeight(21b6c25e127938e2).() const |
| 109 | { |
| 110 | return uicxx . . $ CutDialog#ui.->regHeightSpinnercxx . . $ Ui_CutDialog#regHeightSpinner.->valuecxx . . $ QDoubleSpinBox#value(21b6c25e127938e2).(); |
| 111 | } |
| 112 | |
| 113 | void CutDialogcxx . . $ CutDialog#::onMediaChangedcxx . . $ CutDialog#onMediaChanged(d4f767463ce0a6b3).(int idx) |
| 114 | { |
| 115 | |
| 116 | if (idx < 0 || idx >= 26) |
| 117 | idx = 0; |
| 118 | |
| 119 | // Pressure for each entry. |
| 120 | int pressures[] = { |
| 121 | 27, 27, 10, 14, 27, 2, 10, 30, 30, 30, 30, 1, 1, |
| 122 | 1, 30, 20, 27, 30, 30, 5, 25, 20, 20, 30, 30, 30 |
| 123 | }; |
| 124 | |
| 125 | // Default speed is max except for magnetic sheet. |
| 126 | int newspeed = idx == 17 ? 3 : 10; |
| 127 | int newpressure = pressures[idx]; |
| 128 | |
| 129 | uicxx . . $ CutDialog#ui.->speedSlidercxx . . $ Ui_CutDialog#speedSlider.->setValuecxx . . $ QAbstractSlider#setValue(d4f767463ce0a6b3).(newspeed); |
| 130 | uicxx . . $ CutDialog#ui.->pressureSlidercxx . . $ Ui_CutDialog#pressureSlider.->setValuecxx . . $ QAbstractSlider#setValue(d4f767463ce0a6b3).(newpressure); |
| 131 | } |