MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / updateLaunchButtons

Method updateLaunchButtons

launcher/ui/InstanceWindow.cpp:147–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145}
146
147void InstanceWindow::updateLaunchButtons()
148{
149 if(m_instance->isRunning())
150 {
151 m_launchOfflineButton->setEnabled(false);
152 m_launchDemoButton->setEnabled(false);
153 m_killButton->setText(tr("Kill"));
154 m_killButton->setObjectName("killButton");
155 m_killButton->setToolTip(tr("Kill the running instance"));
156 }
157 else if(!m_instance->canLaunch())
158 {
159 m_launchOfflineButton->setEnabled(false);
160 m_launchDemoButton->setEnabled(false);
161 m_killButton->setText(tr("Launch"));
162 m_killButton->setObjectName("launchButton");
163 m_killButton->setToolTip(tr("Launch the instance"));
164 m_killButton->setEnabled(false);
165 }
166 else
167 {
168 m_launchOfflineButton->setEnabled(true);
169
170 // Disable demo-mode if not available.
171 auto instance = dynamic_cast<MinecraftInstance*>(m_instance.get());
172 if (instance) {
173 m_launchDemoButton->setEnabled(instance->supportsDemo());
174 }
175
176 m_killButton->setText(tr("Launch"));
177 m_killButton->setObjectName("launchButton");
178 m_killButton->setToolTip(tr("Launch the instance"));
179 }
180 // NOTE: this is a hack to force the button to recalculate its style
181 m_killButton->setStyleSheet("/* */");
182 m_killButton->setStyleSheet(QString());
183}
184
185void InstanceWindow::on_btnLaunchMinecraftOffline_clicked()
186{

Callers

nothing calls this directly

Calls 7

QStringClass · 0.85
setEnabledMethod · 0.80
supportsDemoMethod · 0.80
isRunningMethod · 0.45
setTextMethod · 0.45
canLaunchMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected