Skip to content

Commit 3dd0ca4

Browse files
committed
change enum names
1 parent 4897ae2 commit 3dd0ca4

File tree

3 files changed

+28
-14
lines changed

3 files changed

+28
-14
lines changed

‎src/app/seamly2d/mainwindow.cpp‎

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3748,18 +3748,18 @@ void MainWindow::RestoreCurrentScene()
37483748
}
37493749

37503750
//-----------------------------------------------------------------------------
3751-
/// @brief incrementDraftBlock Switch draft block incrementally.
3751+
/// @brief incrementDraftBlock Change draft block incrementally.
37523752
///
3753-
/// This method switches the current draft block by incrementing the combobox box current item up or down.
3753+
/// This method changes the current draft block by selecting the previous or next combobox box item.
37543754
///
3755-
/// @param increment determines whether to increment up or down.
3755+
/// @param selection determines whether to select previous or next draft block.
37563756
///
37573757
/// @details
3758-
/// - an increment value of DraftBlock::MovePrev changes to the previous block;
3759-
/// - an increment value of DraftBlock::MovePrev changes to the next block.
3760-
/// - incrementimg wraps at the first or last item.
3758+
/// - an selection value of Selection::Prev selects the previous block;
3759+
/// - an selection value of Selection::Next selects the next block.
3760+
/// - selection wraps at the first or last item.
37613761
//-----------------------------------------------------------------------------
3762-
void MainWindow::changeDraftBlock(DraftBlock increment)
3762+
void MainWindow::changeDraftBlock(Selection selection)
37633763
{
37643764
int index = draftBlockComboBox->currentIndex();
37653765
const int count = draftBlockComboBox->count();
@@ -3769,17 +3769,31 @@ void MainWindow::changeDraftBlock(DraftBlock increment)
37693769
return;
37703770
}
37713771

3772-
if ((index == 0) && (increment == DraftBlock::MovePrev))
3772+
if ((index == 0) && (selection == Selection::Prev))
37733773
{
37743774
index = count - 1;
37753775
}
3776-
else if ((index == count - 1) && (increment == DraftBlock::MoveNext))
3776+
else if ((index == count - 1) && (selection == Selection::Next))
37773777
{
37783778
index = 0;
37793779
}
37803780
else
37813781
{
3782-
index = index + static_cast<int>(increment);
3782+
switch (static_cast<int>(selection))
3783+
{
3784+
case Selection::Prev:
3785+
{
3786+
index = index - 1;
3787+
break;
3788+
}
3789+
case Selection::Next:
3790+
{
3791+
index = index + 1;
3792+
break;
3793+
}
3794+
default:
3795+
break;
3796+
}
37833797
}
37843798

37853799
draftBlockComboBox->setCurrentIndex(index);
@@ -5762,12 +5776,12 @@ void MainWindow::createActions()
57625776
//Edit Menu
57635777
connect(ui->previousDraftBlock_Action, &QAction::triggered, this, [this]()
57645778
{
5765-
changeDraftBlock(DraftBlock::MovePrev);
5779+
changeDraftBlock(Selection::Prev);
57665780
});
57675781

57685782
connect(ui->nextDraftBlock_Action, &QAction::triggered, this, [this]()
57695783
{
5770-
changeDraftBlock(DraftBlock::MoveNext);
5784+
changeDraftBlock(Selection::Next);
57715785
});
57725786

57735787
connect(ui->labelTemplateEditor_Action, &QAction::triggered, this, [this]()

‎src/app/seamly2d/mainwindow.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ private slots:
239239

240240
void handleNewLayout(bool checked);
241241

242-
void changeDraftBlock(DraftBlock increment);
242+
void changeDraftBlock(Selection selection);
243243

244244
void showDraftMode(bool checked);
245245
void showPieceMode(bool checked);

‎src/libs/vmisc/def.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class QGraphicsItem;
6262

6363
#define HANDLE_SIZE 12
6464

65-
enum DraftBlock : signed char {MovePrev = -1, MoveNext = 1};
65+
enum class Selection : signed char {Prev = -1, Next = 1};
6666

6767
// Bit flags to identify parent dialog type for the Edit Formula dialog and which tabs to hide
6868
enum DialogSource : quint16

0 commit comments

Comments
 (0)