diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-10-08 01:36:11 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-10-08 01:38:26 +0200 |
commit | 05e2da51d8d25374140dce3c1646a2a1a0a2a553 (patch) | |
tree | 1487a17010e69ec2b29a2f2217c4bc65b273c886 /gui/ModEditDialogCommon.cpp | |
parent | a58912eaf7e98c1bc9e960fbf77b6293e57c28a1 (diff) | |
download | MultiMC-05e2da51d8d25374140dce3c1646a2a1a0a2a553.tar MultiMC-05e2da51d8d25374140dce3c1646a2a1a0a2a553.tar.gz MultiMC-05e2da51d8d25374140dce3c1646a2a1a0a2a553.tar.lz MultiMC-05e2da51d8d25374140dce3c1646a2a1a0a2a553.tar.xz MultiMC-05e2da51d8d25374140dce3c1646a2a1a0a2a553.zip |
Add mod website button thing feature widget. It is super effective.
Diffstat (limited to 'gui/ModEditDialogCommon.cpp')
-rw-r--r-- | gui/ModEditDialogCommon.cpp | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/gui/ModEditDialogCommon.cpp b/gui/ModEditDialogCommon.cpp index 5da0a039..692ac0c4 100644 --- a/gui/ModEditDialogCommon.cpp +++ b/gui/ModEditDialogCommon.cpp @@ -1,17 +1,40 @@ #include "ModEditDialogCommon.h" - -bool lastfirst (QModelIndexList & list, int & first, int & last) +#include <QDesktopServices> +#include <QMessageBox> +#include <QString> +#include <QUrl> +bool lastfirst(QModelIndexList &list, int &first, int &last) { - if(!list.size()) + if (!list.size()) return false; first = last = list[0].row(); - for(auto item: list) + for (auto item : list) { int row = item.row(); - if(row < first) + if (row < first) first = row; - if(row > last) + if (row > last) last = row; } return true; -}
\ No newline at end of file +} + +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 + { + QMessageBox::warning( + parentDlg, parentDlg->tr("How sad!"), + parentDlg->tr("The mod author didn't provide a website link for this mod.")); + } +} |