New option: Use Tool Groups.

This commit is contained in:
Roman Telezhynskyi 2023-09-04 13:56:08 +03:00
parent 812c0b84d7
commit f3538df445
6 changed files with 300 additions and 160 deletions

View File

@ -38,6 +38,7 @@
- Fix issue with passing incorrect number of dimension to Tape.
- New option: Pointer mode.
- Fix GUI freezing while nesting.
- New option: Use Tool Groups.
# Valentina 0.7.52 September 12, 2022
- Fix crash when default locale is ru.

View File

@ -151,6 +151,9 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
ui->comboBoxPointerMode->setCurrentIndex(index);
}
// Use tool groups
ui->checkBoxUseToolGroups->setChecked(settings->IsUseToolGroups());
// Native dialogs
ui->checkBoxDontUseNativeDialog->setChecked(settings->IsDontUseNativeDialog());
@ -234,6 +237,11 @@ auto PreferencesConfigurationPage::Apply() -> QStringList
settings->SetPointerMode(static_cast<VToolPointerMode>(ui->comboBoxPointerMode->currentData().toInt()));
if (settings->IsUseToolGroups() != ui->checkBoxUseToolGroups->isChecked())
{
settings->SetUseToolGroups(ui->checkBoxUseToolGroups->isChecked());
}
if (settings->IsDontUseNativeDialog() != ui->checkBoxDontUseNativeDialog->isChecked())
{
settings->SetDontUseNativeDialog(ui->checkBoxDontUseNativeDialog->isChecked());

View File

@ -33,9 +33,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-101</y>
<y>-134</y>
<width>624</width>
<height>937</height>
<height>966</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
@ -385,6 +385,13 @@
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkBoxUseToolGroups">
<property name="text">
<string>Use tool groups</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxDontUseNativeDialog">
<property name="text">

View File

@ -3041,6 +3041,11 @@ void MainWindow::ToolBarDrawTools()
{
SetupDrawToolsIcons();
VValentinaSettings *settings = VApplication::VApp()->ValentinaSettings();
ui->toolBarPointTools->clear();
if (settings->IsUseToolGroups())
{
// Point tools
{
auto *linePointToolMenu = new QMenu(this);
@ -3143,7 +3148,43 @@ void MainWindow::ToolBarDrawTools()
ui->toolBarPointTools->addWidget(tangentPointTool);
}
}
else
{
ui->toolBarPointTools->addAction(ui->actionEndLineTool);
ui->toolBarPointTools->addAction(ui->actionAlongLineTool);
ui->toolBarPointTools->addAction(ui->actionMidpointTool);
ui->toolBarPointTools->addAction(ui->actionNormalTool);
ui->toolBarPointTools->addAction(ui->actionBisectorTool);
ui->toolBarPointTools->addAction(ui->actionHeightTool);
ui->toolBarPointTools->addAction(ui->actionPointOfIntersectionTool);
ui->toolBarPointTools->addAction(ui->actionLineIntersectTool);
ui->toolBarPointTools->addAction(ui->actionShoulderPointTool);
ui->toolBarPointTools->addAction(ui->actionTriangleTool);
ui->toolBarPointTools->addAction(ui->actionLineIntersectAxisTool);
ui->toolBarPointTools->addAction(ui->actionCurveIntersectAxisTool);
ui->toolBarPointTools->addAction(ui->actionArcIntersectAxisTool);
ui->toolBarPointTools->addAction(ui->actionSplineCutPointTool);
ui->toolBarPointTools->addAction(ui->actionSplinePathCutPointTool);
ui->toolBarPointTools->addAction(ui->actionArcCutPointTool);
ui->toolBarPointTools->addAction(ui->actionIntersectionCurvesTool);
ui->toolBarPointTools->addAction(ui->actionPointOfIntersectionArcsTool);
ui->toolBarPointTools->addAction(ui->actionPointOfIntersectionCirclesTool);
ui->toolBarPointTools->addAction(ui->actionPointFromArcAndTangentTool);
ui->toolBarPointTools->addAction(ui->actionPointFromCircleAndTangentTool);
ui->toolBarPointTools->addAction(ui->actionPointOfContactTool);
}
ui->toolBarCurveTools->clear();
if (settings->IsUseToolGroups())
{
// Curve tools
{
auto *curveToolMenu = new QMenu(this);
@ -3161,7 +3202,21 @@ void MainWindow::ToolBarDrawTools()
ui->toolBarCurveTools->addWidget(curvePointTool);
}
}
else
{
ui->toolBarCurveTools->addAction(ui->actionSplineTool);
ui->toolBarCurveTools->addAction(ui->actionCubicBezierTool);
ui->toolBarCurveTools->addAction(ui->actionSplinePathTool);
ui->toolBarCurveTools->addAction(ui->actionCubicBezierPathTool);
ui->toolBarCurveTools->addAction(ui->actionArcTool);
ui->toolBarCurveTools->addAction(ui->actionArcWithLengthTool);
ui->toolBarCurveTools->addAction(ui->actionEllipticalArcTool);
}
ui->toolBarOperationTools->clear();
if (settings->IsUseToolGroups())
{
// Group tools
ui->toolBarOperationTools->addAction(ui->actionGroupTool);
@ -3177,6 +3232,18 @@ void MainWindow::ToolBarDrawTools()
ui->toolBarOperationTools->addWidget(symmetryTool);
}
{
auto *symmetryToolMenu = new QMenu(this);
symmetryToolMenu->addAction(ui->actionFlippingByAxisTool);
symmetryToolMenu->addAction(ui->actionFlippingByLineTool);
auto *symmetryTool = new VToolButtonPopup(this);
symmetryTool->setMenu(symmetryToolMenu);
symmetryTool->setDefaultAction(ui->actionFlippingByAxisTool);
ui->toolBarOperationTools->addWidget(symmetryTool);
}
{
auto *transformToolMenu = new QMenu(this);
transformToolMenu->addAction(ui->actionRotationTool);
@ -3191,7 +3258,27 @@ void MainWindow::ToolBarDrawTools()
ui->toolBarOperationTools->addAction(ui->actionTrueDartsTool);
ui->toolBarOperationTools->addAction(ui->actionExportDraw);
}
else
{
ui->toolBarOperationTools->addAction(ui->actionGroupTool);
ui->toolBarOperationTools->addAction(ui->actionFlippingByAxisTool);
ui->toolBarOperationTools->addAction(ui->actionFlippingByLineTool);
ui->toolBarOperationTools->addAction(ui->actionFlippingByAxisTool);
ui->toolBarOperationTools->addAction(ui->actionFlippingByLineTool);
ui->toolBarOperationTools->addAction(ui->actionRotationTool);
ui->toolBarOperationTools->addAction(ui->actionMoveTool);
ui->toolBarOperationTools->addAction(ui->actionTrueDartsTool);
ui->toolBarOperationTools->addAction(ui->actionExportDraw);
}
ui->toolBarDetailTools->clear();
if (settings->IsUseToolGroups())
{
// Detail tools
ui->toolBarDetailTools->addAction(ui->actionNewDetailTool);
{
@ -3221,6 +3308,21 @@ void MainWindow::ToolBarDrawTools()
}
ui->toolBarDetailTools->addAction(ui->actionDetailExportAs);
}
else
{
ui->toolBarDetailTools->addAction(ui->actionNewDetailTool);
ui->toolBarDetailTools->addAction(ui->actionUnionDetailsTool);
ui->toolBarDetailTools->addAction(ui->actionDuplicateDetailTool);
ui->toolBarDetailTools->addAction(ui->actionInternalPathTool);
ui->toolBarDetailTools->addAction(ui->actionPinTool);
ui->toolBarDetailTools->addAction(ui->actionInsertNodeTool);
ui->toolBarDetailTools->addAction(ui->actionPlaceLabelTool);
ui->toolBarDetailTools->addAction(ui->actionDetailExportAs);
}
}
//---------------------------------------------------------------------------------------------------------------------
@ -3497,6 +3599,9 @@ void MainWindow::SetupDrawToolsIcons()
{
const QString resource = QStringLiteral("toolicon");
// This check helps to find missed tools
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 59, "Not all tools were handled.");
ui->actionLineTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("line.png")));
ui->actionEndLineTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("segment.png")));
ui->actionAlongLineTool->setIcon(VTheme::GetIconResource(resource, QStringLiteral("along_line.png")));
@ -6480,6 +6585,7 @@ void MainWindow::Preferences()
&VToolOptionsPropertyBrowser::RefreshOptions);
connect(dlg.data(), &DialogPreferences::UpdateProperties, this, &MainWindow::ToolBarStyles);
connect(dlg.data(), &DialogPreferences::UpdateProperties, this, &MainWindow::ToolboxIconSize);
connect(dlg.data(), &DialogPreferences::UpdateProperties, this, &MainWindow::ToolBarDrawTools);
connect(dlg.data(), &DialogPreferences::UpdateProperties, this, [this]() { emit doc->FullUpdateFromFile(); });
connect(dlg.data(), &DialogPreferences::UpdateProperties, ui->view,
&VMainGraphicsView::ResetScrollingAnimation);

View File

@ -59,6 +59,9 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationLabelLanguage,
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationToolPointerMode,
(QLatin1String("configuration/toolPointerMode")))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationUseToolGroups,
(QLatin1String("configuration/useToolGroups")))
// NOLINTNEXTLINE
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingAutoRefreshPatternMessage,
(QLatin1String("configuration/autoRefreshPatternMessage")))
@ -1056,6 +1059,18 @@ void VValentinaSettings::SetPointerMode(VToolPointerMode mode)
setValue(*settingConfigurationToolPointerMode, static_cast<int>(mode));
}
//---------------------------------------------------------------------------------------------------------------------
auto VValentinaSettings::IsUseToolGroups() const -> bool
{
return value(*settingConfigurationUseToolGroups, true).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
void VValentinaSettings::SetUseToolGroups(bool value)
{
setValue(*settingConfigurationUseToolGroups, value);
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T>
auto VValentinaSettings::GetCachedValue(T &cache, const QString &setting, T defValue, T valueMin, T valueMax) const -> T

View File

@ -251,6 +251,9 @@ public:
auto GetPointerMode() const -> VToolPointerMode;
void SetPointerMode(VToolPointerMode mode);
auto IsUseToolGroups() const -> bool;
void SetUseToolGroups(bool value);
private:
Q_DISABLE_COPY_MOVE(VValentinaSettings) // NOLINT