Freeciv-3.2: /fast/freeciv/nightly/S3_2/tools/fcmp/mpgui_qt_worker.cpp Source File

Freeciv-3.2

Loading...
Searching...
No Matches
mpgui_qt_worker.cpp
Go to the documentation of this file.
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.
7
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***********************************************************************/
13
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
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>
27
28// utility
29#include "fcintl.h"
30#include "log.h"
31#include "registry.h"
32
33// modinst
34#include "download.h"
35#include "mpgui_qt.h"
36
37#include "mpgui_qt_worker.h"
38
39/**********************************************************************/
42 void mpqt_worker::run()
43{
44 const char *errmsg;
45 QByteArray url_bytes;
46
47 url_bytes = URL.toUtf8();
48 errmsg = download_modpack(url_bytes.data(),
49 fcmp, msg_callback, pb_callback);
50
51 if (errmsg != nullptr) {
52 msg_callback(errmsg);
53 } else {
54 msg_callback(_("Ready"));
55 }
56
57 gui->refresh_list_versions_thr();
58}
59
60/**********************************************************************/
63 void mpqt_worker::download(QString URL_in, class mpgui *gui_in,
64 struct fcmp_params *fcmp_in,
65 dl_msg_callback msg_callback_in,
66 dl_pb_callback pb_callback_in)
67{
68 URL = URL_in;
69 gui = gui_in;
70 fcmp = fcmp_in;
71 msg_callback = msg_callback_in;
72 pb_callback = pb_callback_in;
73
74 start();
75}
mpgui
Definition mpgui_qt.h:50
mpgui::refresh_list_versions_thr
void refresh_list_versions_thr()
Definition mpgui_qt.cpp:372
mpqt_worker::download
void download(QString URL_in, class mpgui *gui_in, struct fcmp_params *fcmp_in, dl_msg_callback msg_callback_in, dl_pb_callback pb_callback_in)
Definition mpgui_qt_worker.cpp:63
mpqt_worker::msg_callback
dl_msg_callback msg_callback
Definition mpgui_qt_worker.h:46
mpqt_worker::gui
class mpgui * gui
Definition mpgui_qt_worker.h:44
mpqt_worker::URL
QString URL
Definition mpgui_qt_worker.h:43
mpqt_worker::fcmp
struct fcmp_params * fcmp
Definition mpgui_qt_worker.h:45
mpqt_worker::pb_callback
dl_pb_callback pb_callback
Definition mpgui_qt_worker.h:47
mpqt_worker::run
void run()
Definition mpgui_qt_worker.cpp:42
incite_cost
char * incite_cost
Definition comments.c:74
download_modpack
const char * download_modpack(const char *URL, const struct fcmp_params *fcmp, dl_msg_callback mcb, dl_pb_callback pbcb)
Definition download.c:66
download.h
dl_msg_callback
void(* dl_msg_callback)(const char *msg)
Definition download.h:30
dl_pb_callback
void(* dl_pb_callback)(int downloaded, int max)
Definition download.h:31
fcintl.h
_
#define _(String)
Definition fcintl.h:67
log.h
mpgui_qt.h
mpgui_qt_worker.h
registry.h
fcmp_params
Definition modinst.h:17