19#include <QApplication>
27#include <QProgressBar>
29#include <QTableWidget>
62#define ML_COL_SUBTYPE 4
71 const char *version,
const char *
license,
98 _(
"This modpack installer accepts the standard Qt command-line options\n"
99 "after '--'. See the Qt documentation.\n\n"));
121 central =
new QWidget;
129 main_window->setWindowTitle(QString::fromUtf8(
_(
"Freeciv modpack installer (Qt)")));
146 if (
worker->isRunning()) {
193#define URL_LABEL_TEXT N_("Modpack URL")
196 QPushButton *
install_button =
new QPushButton(QString::fromUtf8(
_(
"Install modpack")));
199 QLabel *version_label;
207 mode =
R__(
"built in Qt6 mode.");
209 mode =
R__(
"built in Qt5 mode.");
220 version_label =
new QLabel(QString::fromUtf8(
verbuf));
221 version_label->setAlignment(Qt::AlignHCenter);
222 version_label->setParent(central);
223 version_label->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
224 main_layout->addWidget(version_label);
227 mplist_table->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
229 headers << QString::fromUtf8(
_(
"Name")) << QString::fromUtf8(
_(
"Version"));
230 headers << QString::fromUtf8(
_(
"Installed")) << QString::fromUtf8(
Q_(
"?modpack:Type"));
231 headers << QString::fromUtf8(
_(
"Subtype")) << QString::fromUtf8(
_(
"License"));
232 headers << QString::fromUtf8(
_(
"URL")) <<
"typeint";
235 mplist_table->setEditTriggers(QAbstractItemView::NoEditTriggers);
236 mplist_table->setSelectionBehavior(QAbstractItemView::SelectRows);
237 mplist_table->setSelectionMode(QAbstractItemView::SingleSelection);
252 URLedit =
new QLineEdit(central);
263 main_layout->addLayout(
hl);
268 bar =
new QProgressBar(central);
269 main_layout->addWidget(
bar);
271 msg_dspl =
new QLabel(QString::fromUtf8(
_(
"Select modpack to install")));
275 msg_dspl->setAlignment(Qt::AlignHCenter);
277 central->setLayout(main_layout);
304 bar->setMaximum(max);
322 if (
worker->isRunning()) {
381 const char *version,
const char *
license,
413 item->setToolTip(QString::fromUtf8(
notes));
416 item->setToolTip(QString::fromUtf8(
notes));
419 item->setToolTip(QString::fromUtf8(
notes));
422 item->setToolTip(QString::fromUtf8(
notes));
425 item->setToolTip(QString::fromUtf8(
notes));
428 item->setToolTip(QString::fromUtf8(
notes));
431 item->setToolTip(QString::fromUtf8(
notes));
447 const char *version,
const char *
license,
494 ask.setText(
_(
"Modpack installation in progress.\nAre you sure you want to quit?"));
495 ask.setStandardButtons(QMessageBox::Cancel | QMessageBox::Ok);
496 ask.setDefaultButton(QMessageBox::Cancel);
497 ask.setIcon(QMessageBox::Warning);
498 ask.setWindowTitle(
_(
"Quit?"));
502 case QMessageBox::Cancel:
505 case QMessageBox::Ok:
mpgui_main(QApplication *qapp_in, QWidget *central_in)
void closeEvent(QCloseEvent *event)
void refresh_list_versions_thr()
void row_selected(int, int)
void display_msg(QString msg)
void row_download(const QModelIndex &)
void display_msg_thr_signal(QString msg)
void display_msg_thr(const char *msg)
void refresh_list_versions_thr_signal()
void progress_thr_signal(int downloaded, int max)
QTableWidget * mplist_table
void progress_thr(int downloaded, int max)
void setup_list(const char *name, const char *URL, const char *version, const char *license, enum modpack_type type, const char *subtype, const char *notes)
void refresh_list_versions()
void setup(QWidget *central, struct fcmp_params *fcmp)
void progress(int downloaded, int max)
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)
const char * download_modpack_list(const struct fcmp_params *fcmp, modpack_list_setup_cb cb, dl_msg_callback mcb)
bool is_option(const char *option_name, char *option)
void cmdline_option_values_free(void)
void fc_fprintf(FILE *stream, const char *format,...) fc__attribute((__format__(__printf__
static QApplication * qapp
#define log_verbose(message,...)
void load_install_info_lists(struct fcmp_params *fcmp)
#define DEFAULT_URL_START
int fcmp_parse_cmdline(int argc, char *argv[])
const char * mpdb_installed_version(const char *name, enum modpack_type type)
static void gui_download_modpack(const char *URL)
static void progress_callback_thr(int downloaded, int max)
int main(int argc, char **argv)
static void msg_callback_thr(const char *msg)
static void gui_download_modpack(QString URL)
static mpqt_worker * worker
static void setup_modpack_list(const char *name, const char *URL, const char *version, const char *license, enum modpack_type type, const char *subtype, const char *notes)
static void msg_callback(const char *msg)
const char * fileinfoname(const struct strvec *dirs, const char *filename)
const struct strvec * get_data_dirs(void)
int fc_snprintf(char *str, size_t n, const char *format,...)
const char * fc_git_revision(void)
const char * word_version(void)