From e8899df9418beb13f0f78a495efc422ba17c28f1 Mon Sep 17 00:00:00 2001 From: yangjiaxuan <171295266@qq.com> Date: Mon, 5 Dec 2022 18:08:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83=E8=AE=BE=E7=BD=AE=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=EF=BC=8C=E7=AB=8B=E6=80=9D=E8=BE=B0=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=8B=BE=E9=80=89=E8=87=AA=E5=8A=A8=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scanner/graphicsscene.cpp | 2 ++ app/scanner/hg_settingdialog.cpp | 60 ++++++++++++++++++-------------- app/scanner/mainwindow.cpp | 6 +++- app/scanner/mainwindow.ui | 3 ++ 4 files changed, 43 insertions(+), 28 deletions(-) diff --git a/app/scanner/graphicsscene.cpp b/app/scanner/graphicsscene.cpp index 90710c93..b38d8939 100644 --- a/app/scanner/graphicsscene.cpp +++ b/app/scanner/graphicsscene.cpp @@ -154,6 +154,8 @@ void GraphicsScene::setItemFlag(int flag) void GraphicsScene::unDo() { + m_activeItem = nullptr; + QList items = this->items(); if (items.count() < 2) return; diff --git a/app/scanner/hg_settingdialog.cpp b/app/scanner/hg_settingdialog.cpp index ffae8a1a..947491b7 100644 --- a/app/scanner/hg_settingdialog.cpp +++ b/app/scanner/hg_settingdialog.cpp @@ -314,44 +314,51 @@ void hg_settingdialog::createUI() { case SANE_TYPE_BOOL: { - QCheckBox *checkBoxCreation = new QCheckBox(scrollArea); + QCheckBox *checkBoxCreation = new QCheckBox; + if (strcmp(opt->name, SANE_STD_OPT_NAME_CUSTOM_AREA) == 0) { - QLabel *title = new QLabel(scrollArea); - h = new QHBoxLayout(); - title->setText(QString::fromStdString(opt->title) + QString(" : ")); - h->addWidget(title); - h->addWidget(checkBoxCreation); + QWidget* widget_cbtn_pbtn = new QWidget; + widget_cbtn_pbtn->setMaximumWidth(150); - btn_cut_area_ = new QPushButton(this); + QLabel *label = new QLabel; + label->setText(QString::fromStdString(opt->title) + QString(" : ")); + + btn_cut_area_ = new QPushButton; btn_cut_area_->setText(tr("regional crop")); btn_cut_area_->setFixedWidth(120); - h->addWidget(btn_cut_area_); - custom_area_lable_ = title; - reinterpret_cast(widget->layout())->addRow(h); + QHBoxLayout *hLayout = new QHBoxLayout; + hLayout->addWidget(checkBoxCreation); + hLayout->addWidget(btn_cut_area_); + widget_cbtn_pbtn->setLayout(hLayout); + + custom_area_lable_ = label; + + reinterpret_cast(widget->layout())->addRow(label, widget_cbtn_pbtn); + connect(btn_cut_area_, SIGNAL(clicked(bool)), this, SLOT(slot_cutButtonClicked())); } else if (strcmp(opt->name, SANE_STD_OPT_NAME_IS_CUSTOM_GAMMA) == 0) { - QLabel *title = new QLabel(scrollArea); - h = new QHBoxLayout(); - title->setText(QString::fromStdString(opt->title) + QString(" : ")); - h->addWidget(title); - h->addWidget(checkBoxCreation); - - btn_gamma_ = new QPushButton(this); + QWidget* widget_cbtn_pbtn = new QWidget(scrollArea); + widget_cbtn_pbtn->setMaximumWidth(150); + btn_gamma_ = new QPushButton(widget_cbtn_pbtn); btn_gamma_->setText(tr("custom tone curve")); btn_gamma_->setFixedWidth(120); - h->addWidget(btn_gamma_); - reinterpret_cast(widget->layout())->addRow(h); + QHBoxLayout *hLayout = new QHBoxLayout; + hLayout->addWidget(checkBoxCreation); + hLayout->addWidget(btn_gamma_); + widget_cbtn_pbtn->setLayout(hLayout); + + reinterpret_cast(widget->layout())->addRow(opt->title + QString(" : "), widget_cbtn_pbtn); connect(btn_gamma_, SIGNAL(clicked(bool)), this, SLOT(slot_gammaButtonClicked())); } else reinterpret_cast(widget->layout())->addRow(opt->title + QString(" : "), checkBoxCreation); - checkBoxCreation->setToolTip(opt->desc); + checkBoxCreation->setToolTip(opt->desc); int id = i + 1; bool enable = *(bool*)&cur_val[0]; checkBoxCreation->setProperty("controls_id", id); @@ -364,7 +371,6 @@ void hg_settingdialog::createUI() m_list_widgets.append(checkBoxCreation); m_list_getOpt.append(QPair(id, opt)); - iniRead(md5(opt->title), id, checkBoxCreation); break; } @@ -397,7 +403,7 @@ void hg_settingdialog::createUI() case SANE_CONSTRAINT_RANGE: { QWidget* widget_slider_spin = new QWidget(scrollArea); - widget_slider_spin->setMinimumWidth(200); + //widget_slider_spin->setMinimumWidth(250); QSlider* sliderCreation = new QSlider(widget_slider_spin); sliderCreation->setOrientation(Qt::Horizontal); @@ -408,7 +414,7 @@ void hg_settingdialog::createUI() sliderCreation->setValue(m_list_defaultOptions.at(i).second.toInt()); QSpinBox* spinBox = new QSpinBox(widget_slider_spin); - spinBox->setMinimumWidth(150); + spinBox->setMinimumWidth(100); spinBox->setToolTip(opt->desc); spinBox->setRange(opt->constraint.range->min, opt->constraint.range->max); @@ -421,7 +427,7 @@ void hg_settingdialog::createUI() QHBoxLayout* hLayout = new QHBoxLayout; hLayout->addWidget(sliderCreation); hLayout->addWidget(spinBox); - hLayout->addStretch(); +// hLayout->addStretch(); widget_slider_spin->setLayout(hLayout); reinterpret_cast(widget->layout())->addRow(opt->title + QString(" : "), widget_slider_spin); @@ -475,7 +481,7 @@ void hg_settingdialog::createUI() case SANE_TYPE_FIXED: { QWidget* widget_slider_spin = new QWidget(scrollArea); - widget_slider_spin->setMinimumWidth(200); +// widget_slider_spin->setMinimumWidth(250); QSlider* sliderCreation = new QSlider(widget_slider_spin); sliderCreation->setOrientation(Qt::Horizontal); sliderCreation->setMinimumWidth(120); @@ -486,7 +492,7 @@ void hg_settingdialog::createUI() sliderCreation->setValue(SANE_UNFIX(m_list_defaultOptions.at(i).second.toDouble()) * 100); QDoubleSpinBox* spinBox = new QDoubleSpinBox(widget_slider_spin); - spinBox->setMinimumWidth(150); + spinBox->setMinimumWidth(100); spinBox->setToolTip(opt->desc); spinBox->setDecimals(2); spinBox->setSingleStep(0.01); @@ -499,7 +505,7 @@ void hg_settingdialog::createUI() QHBoxLayout* hLayout = new QHBoxLayout; hLayout->addWidget(sliderCreation); hLayout->addWidget(spinBox); - hLayout->addStretch(); +// hLayout->addStretch(); widget_slider_spin->setLayout(hLayout); reinterpret_cast(widget->layout())->addRow(opt->title + QString(" : "), widget_slider_spin); diff --git a/app/scanner/mainwindow.cpp b/app/scanner/mainwindow.cpp index 1f78b828..68480070 100644 --- a/app/scanner/mainwindow.cpp +++ b/app/scanner/mainwindow.cpp @@ -97,7 +97,6 @@ MainWindow::MainWindow(QWidget *parent) #elif defined(OEM_LISICHENG) this->setWindowIcon(QIcon(":images/image_rsc/logo/Lanxum_logo.ico")); this->setWindowTitle(tr("LanxumScan")); - auto_save_changes_ = true; #elif defined(OEM_CANGTIAN) this->setWindowIcon(QIcon(":images/image_rsc/logo/Cumtenn_logo.ico")); this->setWindowTitle(tr("CumtennScan")); @@ -318,6 +317,11 @@ MainWindow::MainWindow(QWidget *parent) m_dialogLog->updateStatus(!dev_que_.opened_scanner_name().empty() && 0 != m_scanType, m_isScanning); updateActionStatus(); ui->act_autoSave->setChecked(getCfgValue("save", "autoSave", false)); + +#if defined(OEM_LISICHENG) + ui->act_autoSave->setChecked(true); +#endif + auto_save_changes_ = ui->act_autoSave->isChecked(); ui->act_autoSave->setText(tr("auto save")); ui->act_autoSave->setToolTip(tr("when switching pictures, save the edited pictures directly without reminding")); diff --git a/app/scanner/mainwindow.ui b/app/scanner/mainwindow.ui index 2d8e7f22..87961b70 100644 --- a/app/scanner/mainwindow.ui +++ b/app/scanner/mainwindow.ui @@ -42,6 +42,9 @@ menu_file + + true +