Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add position option to tool dialogs #1175

Merged
merged 3 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
398 changes: 238 additions & 160 deletions share/translations/seamly2d_cs_CZ.ts

Large diffs are not rendered by default.

486 changes: 277 additions & 209 deletions share/translations/seamly2d_de_DE.ts

Large diffs are not rendered by default.

398 changes: 238 additions & 160 deletions share/translations/seamly2d_el_GR.ts

Large diffs are not rendered by default.

398 changes: 238 additions & 160 deletions share/translations/seamly2d_en_CA.ts

Large diffs are not rendered by default.

330 changes: 204 additions & 126 deletions share/translations/seamly2d_en_GB.ts

Large diffs are not rendered by default.

398 changes: 238 additions & 160 deletions share/translations/seamly2d_en_IN.ts

Large diffs are not rendered by default.

398 changes: 238 additions & 160 deletions share/translations/seamly2d_en_US.ts

Large diffs are not rendered by default.

510 changes: 272 additions & 238 deletions share/translations/seamly2d_es_ES.ts

Large diffs are not rendered by default.

398 changes: 238 additions & 160 deletions share/translations/seamly2d_fi_FI.ts

Large diffs are not rendered by default.

398 changes: 238 additions & 160 deletions share/translations/seamly2d_fr_FR.ts

Large diffs are not rendered by default.

330 changes: 204 additions & 126 deletions share/translations/seamly2d_he_IL.ts

Large diffs are not rendered by default.

330 changes: 204 additions & 126 deletions share/translations/seamly2d_id_ID.ts

Large diffs are not rendered by default.

398 changes: 238 additions & 160 deletions share/translations/seamly2d_it_IT.ts

Large diffs are not rendered by default.

398 changes: 238 additions & 160 deletions share/translations/seamly2d_nl_NL.ts

Large diffs are not rendered by default.

398 changes: 238 additions & 160 deletions share/translations/seamly2d_pt_BR.ts

Large diffs are not rendered by default.

330 changes: 204 additions & 126 deletions share/translations/seamly2d_ro_RO.ts

Large diffs are not rendered by default.

398 changes: 238 additions & 160 deletions share/translations/seamly2d_ru_RU.ts

Large diffs are not rendered by default.

334 changes: 206 additions & 128 deletions share/translations/seamly2d_uk_UA.ts

Large diffs are not rendered by default.

330 changes: 204 additions & 126 deletions share/translations/seamly2d_zh_CN.ts

Large diffs are not rendered by default.

138 changes: 80 additions & 58 deletions src/app/seamly2d/dialogs/configpages/preferencesgraphicsviewpage.cpp
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
/***************************************************************************
** @file PreferencesGraphicsViewPage.cpp
** @author Douglas S Caskey
** @date 26 Oct, 2023
**
** @copyright
** Copyright (C) 2017 - 2023 Seamly, LLC
** https://github.com/fashionfreedom/seamly2d
**
** @brief
** Seamly2D is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Seamly2D is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Seamly2D. if not, see <http://www.gnu.org/licenses/>.
**************************************************************************/
//-----------------------------------------------------------------------------
// @file PreferencesGraphicsViewPage.cpp
// @author Douglas S Caskey
// @date 26 Oct, 2023
//
// @copyright
// Copyright (C) 2017 - 2022 Seamly, LLC
// https://github.com/fashionfreedom/seamly2d
//
// @brief
// Seamly2D is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Seamly2D is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
//-----------------------------------------------------------------------------

#include "preferencesgraphicsviewpage.h"
#include "ui_preferencesgraphicsviewpage.h"
Expand All @@ -31,16 +31,17 @@
#include "../vwidgets/vmaingraphicsview.h"

#include <Qt>
#include <QAbstractButton>
#include <QButtonGroup>
#include <QCheckBox>
#include <QDir>
#include <QDirIterator>
#include <QMessageBox>
#include <QTimer>
#include <QtDebug>
#include <QDoubleSpinBox>
#include <QCheckBox>
#include <QFontComboBox>
#include <QMessageBox>
#include <QPixmap>

#include <QTimer>
#include <QtDebug>

Q_LOGGING_CATEGORY(vGraphicsViewConfig, "vgraphicsviewconfig")
//---------------------------------------------------------------------------------------------------------------------
Expand All @@ -57,7 +58,7 @@ PreferencesGraphicsViewPage::PreferencesGraphicsViewPage (QWidget *parent)
, m_tertiarySupportColorChanged(false)
{
ui->setupUi(this);
// Appearance preferences
// Appearance preferences
// Toolbar
ui->toolBarStyle_CheckBox->setChecked(qApp->Seamly2DSettings()->getToolBarStyle());
ui->toolsToolbar_CheckBox->setChecked(qApp->Seamly2DSettings()->getShowToolsToolBar());
Expand All @@ -70,26 +71,34 @@ PreferencesGraphicsViewPage::PreferencesGraphicsViewPage (QWidget *parent)
ui->detailsToolbar_CheckBox->setChecked(qApp->Seamly2DSettings()->getShowDetailsToolBar());
ui->layoutToolbar_CheckBox->setChecked(qApp->Seamly2DSettings()->getShowLayoutToolBar());

ui->useSecondMonitor_CheckBox->setChecked(qApp->Seamly2DSettings()->useSecondMonitor());

int id = qApp->Seamly2DSettings()->getDialogPosition();
foreach (QAbstractButton *button, ui->position_ButtonGroup->buttons())
{
if (ui->position_ButtonGroup->id(button) == id)
{
button->setChecked(true);
break;
}
}
ui->xOffset_SpinBox->setValue(qApp->Seamly2DSettings()->getXOffset());
ui->yOffset_SpinBox->setValue(qApp->Seamly2DSettings()->getYOffset());
enableOffsets();

connect(ui->position_ButtonGroup, &QButtonGroup::idClicked, this, [this]()
{
enableOffsets();
});

// Antialiasing
ui->graphicsOutput_CheckBox->setChecked(qApp->Seamly2DSettings()->GetGraphicalOutput());

ui->primarySupportColor_ComboBox->setItems(VAbstractTool::supportColorsList());
ui->secondarySupportColor_ComboBox->setItems(VAbstractTool::supportColorsList());
ui->tertiarySupportColor_ComboBox->setItems(VAbstractTool::supportColorsList());

/*
QPixmap pixmap = VAbstractTool::createColorIcon(ui->primarySupportColor_ComboBox->getIconWidth(),
ui->primarySupportColor_ComboBox->getIconHeight(),
"magenta");
ui->primarySupportColor_ComboBox->addItem(QIcon(pixmap), tr("Magenta"), "magenta");
ui->primarySupportColor_ComboBox->model()->sort(0, Qt::AscendingOrder);
ui->secondarySupportColor_ComboBox->addItem(QIcon(pixmap), tr("Magenta"), "magenta");
ui->secondarySupportColor_ComboBox->model()->sort(0, Qt::AscendingOrder);
ui->tertiarySupportColor_ComboBox->addItem(QIcon(pixmap), tr("Magenta"), "magenta");
ui->tertiarySupportColor_ComboBox->model()->sort(0, Qt::AscendingOrder);
*/

// Color preferences
// Color preferences
// Zoom Rubberband colors
int index = ui->zrbPositiveColor_ComboBox->findText(qApp->Seamly2DSettings()->getZoomRBPositiveColor());
if (index != -1)
Expand Down Expand Up @@ -173,7 +182,7 @@ PreferencesGraphicsViewPage::PreferencesGraphicsViewPage (QWidget *parent)
m_tertiarySupportColorChanged = true;
});

// Navigation preferences
// Navigation preferences
// Show Scroll Bars
ui->showScrollBars_CheckBox->setChecked(qApp->Seamly2DSettings()->getShowScrollBars());

Expand All @@ -193,7 +202,7 @@ PreferencesGraphicsViewPage::PreferencesGraphicsViewPage (QWidget *parent)
// Export Quality
ui->quality_Slider->setValue(qApp->Seamly2DSettings()->getExportQuality());

// Behavior preferences
// Behavior preferences
// Constrain Angle Value & Modifier Key
ui->constrainValue_DoubleSpinBox->setValue(qApp->Seamly2DSettings()->getConstrainValue());
ui->constrainModKey_CheckBox->setChecked(qApp->Seamly2DSettings()->getConstrainModKey());
Expand All @@ -207,23 +216,10 @@ PreferencesGraphicsViewPage::PreferencesGraphicsViewPage (QWidget *parent)
// Always use current pen
ui->useCurrentPen_checkBox->setChecked(qApp->Seamly2DSettings()->useCurrentPen());

// Font preferences
// Font preferences
// Pattern piece labels font
//QFont labelFont = qApp->Seamly2DSettings()->getLabelFont();
//ui->labelFont_ComboBox->setCurrentFont(labelFont);
ui->labelFont_ComboBox->setCurrentFont(qApp->Seamly2DSettings()->getLabelFont());

/* labelFont.setPointSize(12);
ui->label_Label->setFont(labelFont);

connect(ui->labelFont_ComboBox,
static_cast<void(QFontComboBox::*)(const QFont &)>(&QFontComboBox::currentFontChanged),
this, [this](QFont labelFont)
{
labelFont.setPointSize(12);
ui->label_Label->setFont(labelFont);
});
*/
// Point name font
QFont nameFont = qApp->Seamly2DSettings()->getPointNameFont();
ui->pointNameFont_ComboBox->setCurrentFont(nameFont);
Expand Down Expand Up @@ -271,6 +267,27 @@ PreferencesGraphicsViewPage::~PreferencesGraphicsViewPage ()
delete ui;
}

// @brief enableOffsets() enable offset spinboxes.
//
// This method enables / disables the offset spinboxes based on the radio button checked.
//
// @Details
// - Enables spinboxes when the Offset radio button is checked.
// - Disables spinboxes when any other radio button is checked.
void PreferencesGraphicsViewPage::enableOffsets()
{
if (ui->offset_RadioButton->isChecked())
{
ui->xOffset_SpinBox->setEnabled(true);
ui->yOffset_SpinBox->setEnabled(true);
}
else
{
ui->xOffset_SpinBox->setEnabled(false);
ui->yOffset_SpinBox->setEnabled(false);
}
}

//---------------------------------------------------------------------------------------------------------------------
void PreferencesGraphicsViewPage::changeEvent(QEvent *event)
{
Expand All @@ -297,6 +314,11 @@ void PreferencesGraphicsViewPage::Apply()
settings->setShowDetailsToolBar(ui->detailsToolbar_CheckBox->isChecked());
settings->setShowLayoutToolBar(ui->layoutToolbar_CheckBox->isChecked());

settings->setUseSecondMonitor(ui->useSecondMonitor_CheckBox->isChecked());
settings->setDialogPosition(ui->position_ButtonGroup->checkedId());
settings->setXOffset(ui->xOffset_SpinBox->value());
settings->setYOffset(ui->yOffset_SpinBox->value());

// Appearance preferences
// Toolbar
// Scene antialiasing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class PreferencesGraphicsViewPage : public QWidget
void Apply();

protected:
void enableOffsets();
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;

private:
Expand Down
Loading
Loading