| 102 | LauncherWindow::~LauncherWindow() {} |
| 103 | |
| 104 | void LauncherWindow::setupResolutionDisplay() |
| 105 | { |
| 106 | auto &comboBox = *ui->resolutionBox; |
| 107 | const QSize current_size = {OpenApoc::Options::screenWidthOption.get(), |
| 108 | OpenApoc::Options::screenHeightOption.get()}; |
| 109 | bool is_custom = true; |
| 110 | |
| 111 | comboBox.clear(); |
| 112 | for (const auto &size : default_resolutions) |
| 113 | { |
| 114 | QString text; |
| 115 | if (size == QSize{0, 0}) |
| 116 | { |
| 117 | text = "Custom"; |
| 118 | } |
| 119 | else |
| 120 | { |
| 121 | text = QString::number(size.width()) + " x " + QString::number(size.height()); |
| 122 | } |
| 123 | comboBox.addItem(text, size); |
| 124 | if (current_size == size) |
| 125 | { |
| 126 | comboBox.setCurrentIndex(comboBox.count() - 1); |
| 127 | is_custom = false; |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | auto &widthBox = *ui->customResolutionX; |
| 132 | auto &heightBox = *ui->customResolutionY; |
| 133 | |
| 134 | widthBox.setText(QString::number(current_size.width())); |
| 135 | heightBox.setText(QString::number(current_size.height())); |
| 136 | |
| 137 | if (is_custom) |
| 138 | { |
| 139 | widthBox.setEnabled(true); |
| 140 | heightBox.setEnabled(true); |
| 141 | } |
| 142 | else |
| 143 | { |
| 144 | widthBox.setEnabled(false); |
| 145 | heightBox.setEnabled(false); |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | void LauncherWindow::setResolutionSelection(int index) |
| 150 | { |