Skip to content

Commit

Permalink
refactor: use const in more places
Browse files Browse the repository at this point in the history
  • Loading branch information
midwan committed Jan 6, 2025
1 parent 1ce4f76 commit 8fd2ff4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 22 deletions.
19 changes: 9 additions & 10 deletions src/osdep/gui/EditCDDrive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class CDDriveActionListener : public gcn::ActionListener
public:
void action(const gcn::ActionEvent& actionEvent) override
{
auto source = actionEvent.getSource();
const auto source = actionEvent.getSource();
if (source == cmdCDDriveOK)
{
if (txtCDDrivePath->getText().empty())
Expand All @@ -64,7 +64,7 @@ class CDDriveActionListener : public gcn::ActionListener
}
else if (source == cboCDDriveController)
{
auto posn = controller[cboCDDriveController->getSelected()].type;
const auto posn = controller[cboCDDriveController->getSelected()].type;
current_cddlg.ci.controller_type = posn % HD_CONTROLLER_NEXT_UNIT;
current_cddlg.ci.controller_type_unit = posn / HD_CONTROLLER_NEXT_UNIT;
inithdcontroller(current_cddlg.ci.controller_type, current_cddlg.ci.controller_type_unit, UAEDEV_CD, current_cddlg.ci.rootdir[0] != 0);
Expand Down Expand Up @@ -139,16 +139,15 @@ static void InitEditCDDrive()
cboCDDriveUnit->setId("cboCDDriveUnit");
cboCDDriveUnit->addActionListener(cdDriveActionListener);

int posY = DISTANCE_BORDER;
int posX = DISTANCE_BORDER;
int pos_y = DISTANCE_BORDER;

wndEditCDDrive->add(lblCDDrivePath, DISTANCE_BORDER, posY);
wndEditCDDrive->add(txtCDDrivePath, lblCDDrivePath->getX() + lblCDDrivePath->getWidth() + 8, posY);
posY = txtCDDrivePath->getY() + txtCDDrivePath->getHeight() + DISTANCE_NEXT_Y;
wndEditCDDrive->add(lblCDDrivePath, DISTANCE_BORDER, pos_y);
wndEditCDDrive->add(txtCDDrivePath, lblCDDrivePath->getX() + lblCDDrivePath->getWidth() + 8, pos_y);
pos_y = txtCDDrivePath->getY() + txtCDDrivePath->getHeight() + DISTANCE_NEXT_Y;

wndEditCDDrive->add(lblCDDriveController, DISTANCE_BORDER, posY);
wndEditCDDrive->add(cboCDDriveController, lblCDDriveController->getX() + lblCDDriveController->getWidth() + 8, posY);
wndEditCDDrive->add(cboCDDriveUnit, cboCDDriveController->getX() + cboCDDriveController->getWidth() + DISTANCE_NEXT_X, posY);
wndEditCDDrive->add(lblCDDriveController, DISTANCE_BORDER, pos_y);
wndEditCDDrive->add(cboCDDriveController, lblCDDriveController->getX() + lblCDDriveController->getWidth() + 8, pos_y);
wndEditCDDrive->add(cboCDDriveUnit, cboCDDriveController->getX() + cboCDDriveController->getWidth() + DISTANCE_NEXT_X, pos_y);

wndEditCDDrive->add(cmdCDDriveOK);
wndEditCDDrive->add(cmdCDDriveCancel);
Expand Down
22 changes: 11 additions & 11 deletions src/osdep/gui/PanelHD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ class CDFileActionListener : public gcn::ActionListener
}
else
{
auto selected = cdfileList.getElementAt(idx);
const auto selected = cdfileList.getElementAt(idx);
// if selected starts with /dev/sr, it's a CD drive
if (selected.find("/dev/") == 0)
{
Expand Down Expand Up @@ -527,25 +527,25 @@ void InitPanelHD(const config_category& category)
cboCDFile->setId("cboCD");
cboCDFile->addActionListener(cdFileActionListener);

int posX = DISTANCE_BORDER + 2 + SMALL_BUTTON_WIDTH + 34;
int pos_x = DISTANCE_BORDER + 2 + SMALL_BUTTON_WIDTH + 34;
for (col = 0; col < COL_COUNT; ++col)
{
category.panel->add(lblList[col], posX, posY);
posX += COLUMN_SIZE[col];
category.panel->add(lblList[col], pos_x, posY);
pos_x += COLUMN_SIZE[col];
}
posY += lblList[0]->getHeight() + 2;

for (row = 0; row < MAX_HD_DEVICES; ++row)
{
posX = 1;
listEntry[row]->add(listCmdProps[row], posX, 2);
posX += listCmdProps[row]->getWidth() + 4;
listEntry[row]->add(listCmdDelete[row], posX, 2);
posX += listCmdDelete[row]->getWidth() + 8;
pos_x = 1;
listEntry[row]->add(listCmdProps[row], pos_x, 2);
pos_x += listCmdProps[row]->getWidth() + 4;
listEntry[row]->add(listCmdDelete[row], pos_x, 2);
pos_x += listCmdDelete[row]->getWidth() + 8;
for (col = 0; col < COL_COUNT; ++col)
{
listEntry[row]->add(listCells[row][col], posX, 2);
posX += COLUMN_SIZE[col];
listEntry[row]->add(listCells[row][col], pos_x, 2);
pos_x += COLUMN_SIZE[col];
}
category.panel->add(listEntry[row], DISTANCE_BORDER, posY);
posY += listEntry[row]->getHeight() + DISTANCE_NEXT_Y / 2;
Expand Down
2 changes: 1 addition & 1 deletion src/osdep/gui/PanelQuickstart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ class QSCDActionListener : public gcn::ActionListener
}
else
{
auto selected = cdfileList.getElementAt(idx);
const auto selected = cdfileList.getElementAt(idx);
// if selected starts with /dev/sr, it's a CD drive
if (selected.find("/dev/") == 0)
{
Expand Down

0 comments on commit 8fd2ff4

Please sign in to comment.