MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / setupResolutionDisplay

Method setupResolutionDisplay

tools/launcher/launcherwindow.cpp:104–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102LauncherWindow::~LauncherWindow() {}
103
104void 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
149void LauncherWindow::setResolutionSelection(int index)
150{

Callers

nothing calls this directly

Calls 5

getMethod · 0.45
clearMethod · 0.45
addItemMethod · 0.45
countMethod · 0.45
setTextMethod · 0.45

Tested by

no test coverage detected