From 439e17b149918df3fd11e0ee74f10d302a1e45cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 11 May 2014 23:48:01 +0200 Subject: Add back legacy mod edit, add checksums for all legacy jars --- gui/dialogs/ModEditDialogCommon.cpp | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 gui/dialogs/ModEditDialogCommon.cpp (limited to 'gui/dialogs/ModEditDialogCommon.cpp') diff --git a/gui/dialogs/ModEditDialogCommon.cpp b/gui/dialogs/ModEditDialogCommon.cpp new file mode 100644 index 00000000..35942374 --- /dev/null +++ b/gui/dialogs/ModEditDialogCommon.cpp @@ -0,0 +1,40 @@ +#include "ModEditDialogCommon.h" +#include "CustomMessageBox.h" +#include + +bool lastfirst(QModelIndexList &list, int &first, int &last) +{ + if (!list.size()) + return false; + first = last = list[0].row(); + for (auto item : list) + { + int row = item.row(); + if (row < first) + first = row; + if (row > last) + last = row; + } + return true; +} + +void showWebsiteForMod(QWidget *parentDlg, Mod &m) +{ + QString url = m.homeurl(); + if (url.size()) + { + // catch the cases where the protocol is missing + if (!url.startsWith("http")) + { + url = "http://" + url; + } + QDesktopServices::openUrl(url); + } + else + { + CustomMessageBox::selectable( + parentDlg, QObject::tr("How sad!"), + QObject::tr("The mod author didn't provide a website link for this mod."), + QMessageBox::Warning); + } +} \ No newline at end of file -- cgit v1.2.3