From 8eb7c413e931fd2d1345de6c6b2795800d73907c Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 2 Oct 2017 19:51:15 +0300 Subject: [PATCH] Two new shortcut sequences: Ctrl+PgDown and Ctrl+PgUp to switch to next and previous pattern piece. ref #762. --HG-- branch : develop --- ChangeLog.txt | 1 + src/app/valentina/mainwindow.cpp | 51 ++++++++++++++++++++++++++++++++ src/app/valentina/mainwindow.h | 2 ++ src/app/valentina/mainwindow.ui | 27 ++++++++++++++++- 4 files changed, 80 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 03fb2d776..8d1922bc2 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -23,6 +23,7 @@ - [#761] New feature. Export final measurements. - [#758] Intersection Passmark - select which side is shown. - New math parser function "r2cm". Round to up to 1 decimal. +- Two new shortcut sequences: Ctrl+PgDown and Ctrl+PgUp to switch to next and previous pattern piece. # Version 0.5.1 - [#683] Tool Seam allowance's dialog is off screen on small resolutions. diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 797994915..7e4be9319 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -1938,6 +1938,9 @@ void MainWindow::ToolBarTools() zoomFitBestCurrentShortcuts.append(QKeySequence(Qt::ControlModifier + Qt::Key_M)); ui->actionZoomFitBestCurrent->setShortcuts(zoomFitBestCurrentShortcuts); connect(ui->actionZoomFitBestCurrent, &QAction::triggered, this, &MainWindow::ZoomFitBestCurrent); + + connect(ui->actionPreviousPatternPiece, &QAction::triggered, this, &MainWindow::PreviousPatternPiece); + connect(ui->actionNextPatternPiece, &QAction::triggered, this, &MainWindow::NextPatternPiece); } //--------------------------------------------------------------------------------------------------------------------- @@ -2846,6 +2849,8 @@ void MainWindow::Clear() ui->actionLoadMultisize->setEnabled(false); ui->actionUnloadMeasurements->setEnabled(false); ui->actionEditCurrent->setEnabled(false); + ui->actionPreviousPatternPiece->setEnabled(false); + ui->actionNextPatternPiece->setEnabled(false); SetEnableTool(false); qApp->setPatternUnit(Unit::Cm); qApp->setPatternType(MeasurementsType::Unknown); @@ -3039,6 +3044,50 @@ void MainWindow::GlobalChangePP(const QString &patternPiece) } } +//--------------------------------------------------------------------------------------------------------------------- +void MainWindow::PreviousPatternPiece() +{ + int index = comboBoxDraws->currentIndex(); + + if (index == -1 || comboBoxDraws->count() <= 1) + { + return; + } + + if (index == 0) + { + index = comboBoxDraws->count() - 1; + } + else + { + --index; + } + + comboBoxDraws->setCurrentIndex(index); +} + +//--------------------------------------------------------------------------------------------------------------------- +void MainWindow::NextPatternPiece() +{ + int index = comboBoxDraws->currentIndex(); + + if (index == -1 || comboBoxDraws->count() <= 1) + { + return; + } + + if (index == comboBoxDraws->count()-1) + { + index = 0; + } + else + { + ++index; + } + + comboBoxDraws->setCurrentIndex(index); +} + //--------------------------------------------------------------------------------------------------------------------- void MainWindow::SetEnabledGUI(bool enabled) { @@ -3095,6 +3144,8 @@ void MainWindow::SetEnableWidgets(bool enable) ui->actionLoadIndividual->setEnabled(enable && designStage); ui->actionLoadMultisize->setEnabled(enable && designStage); ui->actionUnloadMeasurements->setEnabled(enable && designStage); + ui->actionPreviousPatternPiece->setEnabled(enable && drawStage); + ui->actionNextPatternPiece->setEnabled(enable && drawStage); actionDockWidgetToolOptions->setEnabled(enable && designStage); actionDockWidgetGroups->setEnabled(enable && designStage); diff --git a/src/app/valentina/mainwindow.h b/src/app/valentina/mainwindow.h index 7f5aa5f39..5b6440347 100644 --- a/src/app/valentina/mainwindow.h +++ b/src/app/valentina/mainwindow.h @@ -113,6 +113,8 @@ private slots: void FullParseFile(); void SetEnabledGUI(bool enabled); void GlobalChangePP(const QString &patternPiece); + void PreviousPatternPiece(); + void NextPatternPiece(); void ToolBarStyles(); void ShowPaper(int index); void Preferences(); diff --git a/src/app/valentina/mainwindow.ui b/src/app/valentina/mainwindow.ui index 9da3d2538..a9e3ac0af 100644 --- a/src/app/valentina/mainwindow.ui +++ b/src/app/valentina/mainwindow.ui @@ -1690,6 +1690,9 @@ + + + @@ -2702,6 +2705,28 @@ Export Final Measurements to CSV + + + false + + + Next pattern piece + + + Ctrl+PgDown + + + + + false + + + Previous pattern piece + + + Ctrl+PgUp + + @@ -2712,8 +2737,8 @@ - +