Allow using things that were deprecated in gtk+-3.22.
[freeciv.git] / tools / mpgui_qt_worker.cpp
blobc80ed06faf24535ba7472277339e7dcd4a96f8e0
1 /**********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 ***********************************************************************/
14 #ifdef HAVE_CONFIG_H
15 #include <fc_config.h>
16 #endif
18 // Qt
19 #include <QApplication>
20 #include <QHBoxLayout>
21 #include <QHeaderView>
22 #include <QLabel>
23 #include <QMainWindow>
24 #include <QPushButton>
25 #include <QTableWidget>
26 #include <QVBoxLayout>
28 // utility
29 #include "fcintl.h"
30 #include "log.h"
31 #include "registry.h"
33 // modinst
34 #include "download.h"
35 #include "mpgui_qt.h"
37 #include "mpgui_qt_worker.h"
39 /**************************************************************************
40 Run download thread
41 **************************************************************************/
42 void mpqt_worker::run()
44 const char *errmsg;
46 errmsg = download_modpack(URL.toUtf8().data(),
47 fcmp, msg_callback, pb_callback);
49 if (errmsg != nullptr) {
50 msg_callback(errmsg);
51 } else {
52 msg_callback(_("Ready"));
55 gui->refresh_list_versions_thr();
58 /**************************************************************************
59 Start thread to download and install given modpack.
60 **************************************************************************/
61 void mpqt_worker::download(QString URL_in, class mpgui *gui_in,
62 struct fcmp_params *fcmp_in,
63 dl_msg_callback msg_callback_in,
64 dl_pb_callback pb_callback_in)
66 URL = URL_in;
67 gui = gui_in;
68 fcmp = fcmp_in;
69 msg_callback = msg_callback_in;
70 pb_callback = pb_callback_in;
72 start();