Skip to content

Commit

Permalink
this should fix #452
Browse files Browse the repository at this point in the history
  • Loading branch information
shinespeciall committed Jul 30, 2024
1 parent d3ab9b5 commit afa3560
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
37 changes: 27 additions & 10 deletions DockWidget/CameraControlDockWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,21 +237,15 @@ void CameraControlDockWidget::ClearListView()
}
}


/// <summary>
/// Be called the listview is clicked and a limitator is selected.
/// Update all those spinboxes values and max/min properties by using the Room size and the limitator properties.
/// </summary>
/// <param name="index">
/// Reference of the selected QModelIndex from the listview.
/// </param>
void CameraControlDockWidget::on_CameraLimitators_listView_clicked(const QModelIndex &index)
void CameraControlDockWidget::UpdateSpinboxesByListviewItemID(int item_id)
{
IsSavingData = false;
ui->ExistingLimitators_groupBox->setEnabled(false);
std::vector<struct LevelComponents::__CameraControlRecord *> currentCameraLimitators =
currentRoom->GetCameraControlRecords();
int linenum = index.row();
SelectedLimitator = linenum;
LevelComponents::__CameraControlRecord *currentLimitator = currentCameraLimitators[linenum];
LevelComponents::__CameraControlRecord *currentLimitator = currentCameraLimitators[item_id];
int currentLimitatorTypeid =
(currentLimitator->ChangeValueOffset == 0xFF ? -1 : currentLimitator->ChangeValueOffset);
ui->CameraLimitatorTypePicker_comboBox->setCurrentIndex(currentLimitatorTypeid + 1);
Expand Down Expand Up @@ -290,6 +284,21 @@ void CameraControlDockWidget::on_CameraLimitators_listView_clicked(const QModelI
ui->TriggerBlockPositionY_spinBox->setEnabled(false);
}
SetCurrentLimitator(); // only used to set maximums for all the spinboxes
}

/// <summary>
/// Be called the listview is clicked and a limitator is selected.
/// </summary>
/// <param name="index">
/// Reference of the selected QModelIndex from the listview.
/// </param>
void CameraControlDockWidget::on_CameraLimitators_listView_clicked(const QModelIndex &index)
{
IsSavingData = false;
ui->ExistingLimitators_groupBox->setEnabled(false);
int linenum = index.row();
SelectedLimitator = linenum;
UpdateSpinboxesByListviewItemID(linenum);
ui->ExistingLimitators_groupBox->setEnabled(true);
IsSavingData = true;
}
Expand Down Expand Up @@ -513,6 +522,14 @@ void CameraControlDockWidget::on_UseCameraLimitators_radioButton_clicked(bool ch

// Rerender graphicview in MainWindow
singleton->RenderScreenElementsLayersUpdate((unsigned int) -1, -1);

// Now we select the first item in the listview as default
IsSavingData = false;
ui->ExistingLimitators_groupBox->setEnabled(false);
SelectedLimitator = 0;
UpdateSpinboxesByListviewItemID(0);
ui->ExistingLimitators_groupBox->setEnabled(true);
IsSavingData = true;
}

singleton->SetUnsavedChanges(true);
Expand Down
1 change: 1 addition & 0 deletions DockWidget/CameraControlDockWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class CameraControlDockWidget : public QDockWidget
int CurrentRoomHeight = 0;
bool IsSavingData = false;
void SetCurrentLimitator();
void UpdateSpinboxesByListviewItemID(int item_id);
void SetListviewItemText(int row);
void PaintListView();
void ClearListView();
Expand Down

0 comments on commit afa3560

Please sign in to comment.