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 Qt5 mode.");
208#elif defined(FC_QT6X_MODE)
209 mode =
R__(
"built in Qt6x mode.");
211 mode =
R__(
"built in Qt6 mode.");
222 version_label =
new QLabel(QString::fromUtf8(
verbuf));
223 version_label->setAlignment(Qt::AlignHCenter);
224 version_label->setParent(central);
225 version_label->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
226 main_layout->addWidget(version_label);
229 mplist_table->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
231 headers << QString::fromUtf8(
_(
"Name")) << QString::fromUtf8(
_(
"Version"));
232 headers << QString::fromUtf8(
_(
"Installed")) << QString::fromUtf8(
Q_(
"?modpack:Type"));
233 headers << QString::fromUtf8(
_(
"Subtype")) << QString::fromUtf8(
_(
"License"));
234 headers << QString::fromUtf8(
_(
"URL")) <<
"typeint";
237 mplist_table->setEditTriggers(QAbstractItemView::NoEditTriggers);
238 mplist_table->setSelectionBehavior(QAbstractItemView::SelectRows);
239 mplist_table->setSelectionMode(QAbstractItemView::SingleSelection);
254 URLedit =
new QLineEdit(central);
265 main_layout->addLayout(
hl);
270 bar =
new QProgressBar(central);
271 main_layout->addWidget(
bar);
273 msg_dspl =
new QLabel(QString::fromUtf8(
_(
"Select modpack to install")));
277 msg_dspl->setAlignment(Qt::AlignHCenter);
279 central->setLayout(main_layout);
306 bar->setMaximum(max);
324 if (
worker->isRunning()) {
383 const char *version,
const char *
license,
415 item->setToolTip(QString::fromUtf8(notes));
418 item->setToolTip(QString::fromUtf8(notes));
421 item->setToolTip(QString::fromUtf8(notes));
424 item->setToolTip(QString::fromUtf8(notes));
427 item->setToolTip(QString::fromUtf8(notes));
430 item->setToolTip(QString::fromUtf8(notes));
433 item->setToolTip(QString::fromUtf8(notes));
438 item->setToolTip(notes);
449 const char *version,
const char *
license,
496 ask.setText(
_(
"Modpack installation in progress.\nAre you sure you want to quit?"));
497 ask.setStandardButtons(QMessageBox::Cancel | QMessageBox::Ok);
498 ask.setDefaultButton(QMessageBox::Cancel);
499 ask.setIcon(QMessageBox::Warning);
500 ask.setWindowTitle(
_(
"Quit?"));
504 case QMessageBox::Cancel:
507 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)