Freeciv21
Develop your civilization from humble roots to a global empire
mpgui_qt_worker.cpp
Go to the documentation of this file.
1 /*__ ___ ***************************************
2 / \ / \ Copyright (c) 1996-2020 Freeciv21 and Freeciv
3 \_ \ / __/ contributors. This file is part of Freeciv21.
4  _\ \ / /__ Freeciv21 is free software: you can redistribute it
5  \___ \____/ __/ and/or modify it under the terms of the GNU General
6  \_ _/ Public License as published by the Free Software
7  | @ @ \_ Foundation, either version 3 of the License,
8  | or (at your option) any later version.
9  _/ /\ You should have received a copy of the GNU
10  /o) (o/\ \_ General Public License along with Freeciv21.
11  \_____/ / If not, see https://www.gnu.org/licenses/.
12  \____/ ********************************************************/
13 
14 // Qt
15 #include <QApplication>
16 #include <QHeaderView>
17 #include <QLabel>
18 
19 // utility
20 #include "fcintl.h"
21 // modinst
22 #include "download.h"
23 #include "mpgui_qt.h"
24 
25 #include "mpgui_qt_worker.h"
26 
31 {
32  auto errmsg =
34 
35  if (errmsg != nullptr) {
36  m_msg_callback(errmsg);
37  } else {
38  m_msg_callback(_("Ready"));
39  }
40 
42 }
43 
47 void mpqt_worker::download(const QUrl &url, class mpgui *gui,
48  struct fcmp_params *fcmp,
50  const dl_pb_callback &pb_callback)
51 {
52  m_url = url;
53  m_gui = gui;
54  m_fcmp = fcmp;
56  m_pb_callback = pb_callback;
57 
58  start();
59 }
Definition: mpgui_qt.h:44
void refresh_list_versions_thr()
Refresh display of modpack list modpack versions from another thread.
Definition: mpgui_qt.cpp:331
dl_msg_callback m_msg_callback
fcmp_params * m_fcmp
dl_pb_callback m_pb_callback
void run() override
Run download thread.
void download(const QUrl &url, mpgui *gui, fcmp_params *fcmp, const dl_msg_callback &msg_callback, const dl_pb_callback &pb_callback)
Start thread to download and install given modpack.
const char * download_modpack(const QUrl &url, const struct fcmp_params *fcmp, const dl_msg_callback &mcb, const dl_pb_callback &pbcb, int recursion)
Download modpack from a given URL.
Definition: download.cpp:150
std::function< void(int downloaded, int max)> dl_pb_callback
Definition: download.h:34
nf_errmsg dl_msg_callback
Definition: download.h:33
#define _(String)
Definition: fcintl.h:50
static void msg_callback(const QString &msg)
Progress indications from downloader.
Definition: mpcli.cpp:42
struct fcmp_params fcmp
Definition: mpcli.cpp:35
static mpgui * gui
Definition: mpgui_qt.cpp:47