30 #include "ui_preferencesgraphicsviewpage.h"
31 #include "../../core/vapplication.h"
32 #include "../vpatterndb/pmsystems.h"
33 #include "../vmisc/logging.h"
34 #include "../vtools/tools/vabstracttool.h"
35 #include "../vwidgets/vmaingraphicsview.h"
39 #include <QDirIterator>
40 #include <QMessageBox>
43 #include <QDoubleSpinBox>
45 #include <QFontComboBox>
49 Q_LOGGING_CATEGORY(vGraphicsViewConfig,
"vgraphicsviewconfig")
54 , m_zrbPositiveColorChanged(false)
55 , m_zrbNegativeColorChanged(false)
56 , m_pointNameColorChanged(false)
57 , m_pointNameHoverColorChanged(false)
58 , m_orginAxisColorChanged(false)
59 , m_primarySupportColorChanged(false)
60 , m_secondarySupportColorChanged(false)
61 , m_tertiarySupportColorChanged(false)
66 ui->toolBarStyle_CheckBox->setChecked(
qApp->Seamly2DSettings()->getToolBarStyle());
67 ui->toolsToolbar_CheckBox->setChecked(
qApp->Seamly2DSettings()->getShowToolsToolBar());
68 ui->pointToolbar_CheckBox->setChecked(
qApp->Seamly2DSettings()->getShowPointToolBar());
69 ui->lineToolbar_CheckBox->setChecked(
qApp->Seamly2DSettings()->getShowLineToolBar());
70 ui->curveToolbar_CheckBox->setChecked(
qApp->Seamly2DSettings()->getShowCurveToolBar());
71 ui->arcToolbar_CheckBox->setChecked(
qApp->Seamly2DSettings()->getShowArcToolBar());
72 ui->operationToolbar_CheckBox->setChecked(
qApp->Seamly2DSettings()->getShowOpsToolBar());
73 ui->pieceToolbar_CheckBox->setChecked(
qApp->Seamly2DSettings()->getShowPieceToolBar());
74 ui->detailsToolbar_CheckBox->setChecked(
qApp->Seamly2DSettings()->getShowDetailsToolBar());
75 ui->layoutToolbar_CheckBox->setChecked(
qApp->Seamly2DSettings()->getShowLayoutToolBar());
78 ui->graphicsOutput_CheckBox->setChecked(
qApp->Seamly2DSettings()->GetGraphicalOutput());
98 int index = ui->zrbPositiveColor_ComboBox->findText(
qApp->Seamly2DSettings()->getZoomRBPositiveColor());
101 ui->zrbPositiveColor_ComboBox->setCurrentIndex(index);
103 connect(ui->zrbPositiveColor_ComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, [
this]()
105 m_zrbPositiveColorChanged = true;
108 index = ui->zrbNegativeColor_ComboBox->findText(
qApp->Seamly2DSettings()->getZoomRBNegativeColor());
111 ui->zrbNegativeColor_ComboBox->setCurrentIndex(index);
113 connect(ui->zrbNegativeColor_ComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, [
this]()
115 m_zrbNegativeColorChanged = true;
118 index = ui->pointNameColor_ComboBox->findText(
qApp->Seamly2DSettings()->getPointNameColor());
121 ui->pointNameColor_ComboBox->setCurrentIndex(index);
123 connect(ui->pointNameColor_ComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, [
this]()
125 m_pointNameColorChanged = true;
128 index = ui->pointNameHoverColor_ComboBox->findText(
qApp->Seamly2DSettings()->getPointNameHoverColor());
131 ui->pointNameHoverColor_ComboBox->setCurrentIndex(index);
133 connect(ui->pointNameHoverColor_ComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, [
this]()
135 m_pointNameHoverColorChanged = true;
139 index = ui->axisOrginColor_ComboBox->findText(
qApp->Seamly2DSettings()->getAxisOrginColor());
142 ui->axisOrginColor_ComboBox->setCurrentIndex(index);
144 connect(ui->axisOrginColor_ComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, [
this]()
146 m_orginAxisColorChanged = true;
150 index = ui->primarySupportColor_ComboBox->findText(
qApp->Seamly2DSettings()->getPrimarySupportColor());
153 ui->primarySupportColor_ComboBox->setCurrentIndex(index);
155 connect(ui->primarySupportColor_ComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, [
this]()
157 m_primarySupportColorChanged = true;
160 index = ui->secondarySupportColor_ComboBox->findText(
qApp->Seamly2DSettings()->getSecondarySupportColor());
163 ui->secondarySupportColor_ComboBox->setCurrentIndex(index);
165 connect(ui->secondarySupportColor_ComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, [
this]()
167 m_secondarySupportColorChanged = true;
170 index = ui->tertiarySupportColor_ComboBox->findText(
qApp->Seamly2DSettings()->getTertiarySupportColor());
173 ui->tertiarySupportColor_ComboBox->setCurrentIndex(index);
175 connect(ui->tertiarySupportColor_ComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, [
this]()
177 m_tertiarySupportColorChanged = true;
182 ui->showScrollBars_CheckBox->setChecked(
qApp->Seamly2DSettings()->getShowScrollBars());
185 ui->scrollBarWidth_SpinBox->setValue(
qApp->Seamly2DSettings()->getScrollBarWidth());
187 ui->scrollDuration_SpinBox->setValue(
qApp->Seamly2DSettings()->getScrollDuration());
188 ui->scrollUpdateInterval_SpinBox->setValue(
qApp->Seamly2DSettings()->getScrollUpdateInterval());
189 ui->scrollSpeedFactor_Slider->setValue(
qApp->Seamly2DSettings()->getScrollSpeedFactor());
192 ui->zoomModKey_CheckBox->setChecked(
qApp->Seamly2DSettings()->getZoomModKey());
195 ui->zoomSpeedFactor_Slider->setValue(
qApp->Seamly2DSettings()->getZoomSpeedFactor());
198 ui->quality_Slider->setValue(
qApp->Seamly2DSettings()->getExportQuality());
202 ui->constrainValue_DoubleSpinBox->setValue(
qApp->Seamly2DSettings()->getConstrainValue());
203 ui->constrainModKey_CheckBox->setChecked(
qApp->Seamly2DSettings()->getConstrainModKey());
206 ui->zoomDoubleClick_CheckBox->setChecked(
qApp->Seamly2DSettings()->isZoomDoubleClick());
209 ui->panActiveSpacePressed_CheckBox->setChecked(
qApp->Seamly2DSettings()->isPanActiveSpaceKey());
215 ui->labelFont_ComboBox->setCurrentFont(
qApp->Seamly2DSettings()->getLabelFont());
229 QFont nameFont =
qApp->Seamly2DSettings()->getPointNameFont();
230 ui->pointNameFont_ComboBox->setCurrentFont(nameFont);
231 nameFont.setPointSize(12);
232 ui->pointName_Label->setFont(nameFont);
234 connect(ui->pointNameFont_ComboBox,
235 static_cast<void(QFontComboBox::*)(
const QFont &)
>(&QFontComboBox::currentFontChanged),
236 this, [
this](QFont nameFont)
238 nameFont.setPointSize(12);
239 ui->pointName_Label->setFont(nameFont);
242 index = ui->pointNameFontSize_ComboBox->findText(QString().setNum(
qApp->Seamly2DSettings()->getPointNameSize()));
245 ui->pointNameFontSize_ComboBox->setCurrentIndex(index);
249 QFont guiFont =
qApp->Seamly2DSettings()->getGuiFont();
250 ui->guiFont_ComboBox->setCurrentFont(guiFont);
251 guiFont.setPointSize(12);
252 ui->gui_Label->setFont(guiFont);
254 connect(ui->guiFont_ComboBox,
255 static_cast<void(QFontComboBox::*)(
const QFont &)
>(&QFontComboBox::currentFontChanged),
256 this, [
this](QFont guiFont)
258 guiFont.setPointSize(12);
259 ui->gui_Label->setFont(guiFont);
262 index = ui->guiFontSize_ComboBox->findText(QString().setNum(
qApp->Seamly2DSettings()->getGuiFontSize()));
265 ui->guiFontSize_ComboBox->setCurrentIndex(index);
295 qApp->getSceneView()->setRenderHint(QPainter::Antialiasing,
ui->graphicsOutput_CheckBox->isChecked());
296 qApp->getSceneView()->setRenderHint(QPainter::SmoothPixmapTransform,
ui->graphicsOutput_CheckBox->isChecked());
378 settings->
setGuiFont(
ui->guiFont_ComboBox->currentFont());
bool m_primarySupportColorChanged
bool m_zrbNegativeColorChanged
bool m_zrbPositiveColorChanged
bool m_orginAxisColorChanged
bool m_pointNameColorChanged
bool m_secondarySupportColorChanged
Ui::PreferencesGraphicsViewPage * ui
virtual ~PreferencesGraphicsViewPage()
bool m_pointNameHoverColorChanged
bool m_tertiarySupportColorChanged
void setPointNameSize(int value)
void setScrollUpdateInterval(const int &interval)
void setShowCurveToolBar(const bool &value)
void setShowOpsToolBar(const bool &value)
void setGuiFont(const QFont &f)
void setZoomModKey(const bool &value)
void setPointNameColor(const QString &value)
void setZoomRBNegativeColor(const QString &value)
void setPanActiveSpaceKey(const bool &value)
void setToolBarStyle(const bool &value)
void setScrollSpeedFactor(const int &factor)
void setSecondarySupportColor(const QString &value)
void setScrollBarWidth(const int &width)
void setTertiarySupportColor(const QString &value)
void setAxisOrginColor(const QString &value)
void setShowToolsToolBar(const bool &value)
void setPointNameHoverColor(const QString &value)
void setScrollDuration(const int &duration)
void setShowLineToolBar(const bool &value)
void setLabelFont(const QFont &f)
void setZoomSpeedFactor(const int &factor)
void setPrimarySupportColor(const QString &value)
void setConstrainModKey(const bool &value)
void setShowPointToolBar(const bool &value)
void setShowDetailsToolBar(const bool &value)
void setShowScrollBars(const bool &value)
void setGuiFontSize(int value)
void setConstrainValue(const qreal &value)
void setShowPieceToolBar(const bool &value)
void setZoomRBPositiveColor(const QString &value)
void setExportQuality(const int &value)
void setShowLayoutToolBar(const bool &value)
void setPointNameFont(const QFont &f)
void setShowArcToolBar(const bool &value)
void setZoomDoubleClick(const bool &value)
void SetGraphicalOutput(const bool &value)