Skip to content

Commit

Permalink
Set full screen and disable server scan in WebAssembly client
Browse files Browse the repository at this point in the history
  • Loading branch information
zekoz committed Feb 6, 2022
1 parent 5fc171e commit d48ea1e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions client/gui-qt/fc_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ extern "C" void real_science_report_dialog_update(void *);
*/
fc_client::fc_client() : QMainWindow(), current_file(QLatin1String(""))
{
#ifdef __EMSCRIPTEN__
setWindowFlags(Qt::FramelessWindowHint);
setWindowState(Qt::WindowFullScreen);
#endif
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
status_bar_queue.clear();
for (int i = 0; i <= PAGE_GAME; i++) {
Expand Down
10 changes: 10 additions & 0 deletions client/gui-qt/page_network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ void server_scan_error(struct server_scan *scan, const char *message)
*/
void page_network::destroy_server_scans()
{
#ifndef __EMSCRIPTEN__
if (meta_scan) {
server_scan_finish(meta_scan);
meta_scan = NULL;
Expand All @@ -305,13 +306,15 @@ void page_network::destroy_server_scans()
lan_scan_timer->disconnect();
FC_FREE(lan_scan_timer);
}
#endif
}

/**
Stop and restart the metaserver and lan server scans.
*/
void page_network::update_network_lists()
{
#ifndef __EMSCRIPTEN__
destroy_server_scans();

lan_scan_timer = new QTimer(this);
Expand All @@ -331,13 +334,15 @@ void page_network::update_network_lists()
&page_network::slot_meta_scan);
meta_scan_timer->start(800);
}
#endif
}

/**
This function updates the list of servers every so often.
*/
bool page_network::check_server_scan(server_scan *scan_data)
{
#ifndef __EMSCRIPTEN__
struct server_scan *scan = scan_data;
enum server_scan_status stat;

Expand All @@ -357,6 +362,9 @@ bool page_network::check_server_scan(server_scan *scan_data)
}

return !(stat == SCAN_STATUS_ERROR || stat == SCAN_STATUS_DONE);
#else
return true;
#endif
}

/**
Expand Down Expand Up @@ -502,6 +510,7 @@ void page_network::slot_selection_changed(const QItemSelection &selected,
ui.lan_widget->clearSelection();
}

#ifndef __EMSCRIPTEN__
srvrs = server_scan_get_list(meta_scan);
if (srvrs) {
pserver = server_list_get(srvrs, index.row());
Expand Down Expand Up @@ -535,4 +544,5 @@ void page_network::slot_selection_changed(const QItemSelection &selected,
ui.info_widget->setItem(k, col, item);
}
}
#endif
}

0 comments on commit d48ea1e

Please sign in to comment.