Freeciv21
Develop your civilization from humble roots to a global empire
mpgui_qt.h
Go to the documentation of this file.
1 /**************************************************************************
2  Copyright (c) 1996-2020 Freeciv21 and Freeciv contributors. This file is
3  __ __ part of Freeciv21. Freeciv21 is free software: you can
4 / \\..// \ redistribute it and/or modify it under the terms of the GNU
5  ( oo ) General Public License as published by the Free Software
6  \__/ Foundation, either version 3 of the License, or (at your
7  option) any later version. You should have received
8  a copy of the GNU General Public License along with Freeciv21. If not,
9  see https://www.gnu.org/licenses/.
10 **************************************************************************/
11 
12 #ifndef FC__MPGUI_QT_H
13 #define FC__MPGUI_QT_H
14 
15 #include <fc_config.h>
16 
17 // Qt
18 #include <QMainWindow>
19 #include <QObject>
20 
21 // tools
22 #include "modinst.h"
23 
24 class QLabel;
25 class QLineEdit;
26 class QProgressBar;
27 class QTableWidget;
28 
29 class mpgui_main : public QMainWindow {
30  Q_OBJECT
31 
32 public:
33  mpgui_main(QApplication *qapp_in, QWidget *central_in);
34 
35 private:
36  void popup_quit_dialog();
37  QApplication *qapp;
38  QWidget *central;
39 
40 protected:
41  void closeEvent(QCloseEvent *event) override;
42 };
43 
44 class mpgui : public QObject {
45  Q_OBJECT
46 
47 public:
48  void setup(QWidget *central, struct fcmp_params *fcmp);
49  void display_msg_thr(const QString &msg);
50  void progress_thr(int downloaded, int max);
51  void setup_list(const QString &name, const QUrl &url,
52  const QString &version, const QString &license,
53  enum modpack_type type, const QString &subtype,
54  const QString &notes);
56 
57 signals:
58  void display_msg_thr_signal(QString msg);
59  void progress_thr_signal(int downloaded, int max);
61 
62 public slots:
63  void display_msg(const QString &msg);
64  void progress(int downloaded, int max);
65  void refresh_list_versions();
66 
67 private slots:
68  void URL_given();
69  void row_selected(int, int);
70  void row_download(const QModelIndex &);
71 
72 private:
73  QLineEdit *URLedit;
74  QLabel *msg_dspl;
75  QProgressBar *bar;
76  QTableWidget *mplist_table;
77 };
78 
79 #endif // FC__MPGUI_QT_H
void popup_quit_dialog()
Open dialog to confirm that user wants to quit modpack installer.
Definition: mpgui_qt.cpp:439
QApplication * qapp
Definition: mpgui_qt.h:37
mpgui_main(QApplication *qapp_in, QWidget *central_in)
Main window constructor.
Definition: mpgui_qt.cpp:429
QWidget * central
Definition: mpgui_qt.h:38
void closeEvent(QCloseEvent *event) override
User clicked windows close button.
Definition: mpgui_qt.cpp:465
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
void row_selected(int, int)
User activated another table row.
Definition: mpgui_qt.cpp:407
QLineEdit * URLedit
Definition: mpgui_qt.h:73
void row_download(const QModelIndex &)
User activated another table row.
Definition: mpgui_qt.cpp:417
void display_msg_thr_signal(QString msg)
void refresh_list_versions_thr_signal()
void URL_given()
User entered URL.
Definition: mpgui_qt.cpp:300
void progress_thr_signal(int downloaded, int max)
QTableWidget * mplist_table
Definition: mpgui_qt.h:76
void progress_thr(int downloaded, int max)
Update progress bar from another thread.
Definition: mpgui_qt.cpp:274
QLabel * msg_dspl
Definition: mpgui_qt.h:74
void refresh_list_versions()
Refresh display of modpack list modpack versions.
Definition: mpgui_qt.cpp:305
void display_msg(const QString &msg)
Display status message.
Definition: mpgui_qt.cpp:246
QProgressBar * bar
Definition: mpgui_qt.h:75
void setup(QWidget *central, struct fcmp_params *fcmp)
Setup GUI object.
Definition: mpgui_qt.cpp:165
void progress(int downloaded, int max)
Update progress bar.
Definition: mpgui_qt.cpp:265
void setup_list(const QString &name, const QUrl &url, const QString &version, const QString &license, enum modpack_type type, const QString &subtype, const QString &notes)
Build main modpack list view.
Definition: mpgui_qt.cpp:339
void display_msg_thr(const QString &msg)
Display status message from another thread.
Definition: mpgui_qt.cpp:257
enum event_type event
Definition: events.cpp:68
const char * name
Definition: inputfile.cpp:118
struct fcmp_params fcmp
Definition: mpcli.cpp:35