mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 08:50:05 +00:00 
			
		
		
		
	Only display the "Map Display" columns for the number of maps configured in settings
This commit is contained in:
		
							parent
							
								
									ed8574d618
								
							
						
					
					
						commit
						1c5199dbfd
					
				
					 1 changed files with 23 additions and 0 deletions
				
			
		|  | @ -2,6 +2,7 @@ | |||
| #include "ui_layer_dialog.h" | ||||
| 
 | ||||
| #include <scwx/qt/model/layer_model.hpp> | ||||
| #include <scwx/qt/settings/general_settings.hpp> | ||||
| #include <scwx/util/logger.hpp> | ||||
| 
 | ||||
| #include <QPushButton> | ||||
|  | @ -33,6 +34,7 @@ public: | |||
|    ~LayerDialogImpl() = default; | ||||
| 
 | ||||
|    void ConnectSignals(); | ||||
|    void UpdateMapDisplayColumns(); | ||||
|    void UpdateMoveButtonsEnabled(); | ||||
| 
 | ||||
|    std::vector<int>              GetSelectedRows(); | ||||
|  | @ -73,6 +75,8 @@ LayerDialog::LayerDialog(QWidget* parent) : | |||
|    ui->moveDownButton->setEnabled(false); | ||||
|    ui->moveBottomButton->setEnabled(false); | ||||
| 
 | ||||
|    p->UpdateMapDisplayColumns(); | ||||
| 
 | ||||
|    p->ConnectSignals(); | ||||
| } | ||||
| 
 | ||||
|  | @ -81,6 +85,25 @@ LayerDialog::~LayerDialog() | |||
|    delete ui; | ||||
| } | ||||
| 
 | ||||
| void LayerDialogImpl::UpdateMapDisplayColumns() | ||||
| { | ||||
|    auto&        generalSettings = settings::GeneralSettings::Instance(); | ||||
|    std::int64_t gridWidth       = generalSettings.grid_width().GetValue(); | ||||
|    std::int64_t gridHeight      = generalSettings.grid_height().GetValue(); | ||||
|    int          mapCount        = static_cast<int>(gridWidth * gridHeight); | ||||
| 
 | ||||
|    int displayMap1Column = | ||||
|       static_cast<int>(model::LayerModel::Column::DisplayMap1); | ||||
| 
 | ||||
|    // For each 0-based map index, 1-3 (excluding 0, always displayed)
 | ||||
|    for (int mapIndex = 1; mapIndex < 4; ++mapIndex) | ||||
|    { | ||||
|       const int  column = displayMap1Column + mapIndex; | ||||
|       const bool hide   = mapIndex >= mapCount; | ||||
|       self_->ui->layerTreeView->setColumnHidden(column, hide); | ||||
|    } | ||||
| } | ||||
| 
 | ||||
| void LayerDialogImpl::ConnectSignals() | ||||
| { | ||||
|    QObject::connect( | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat