+
+
+ 0
+ 0
+
+
Optional Info
diff --git a/launcher/ui/dialogs/MSALoginDialog.cpp b/launcher/ui/dialogs/MSALoginDialog.cpp
index 74fff9fd3..7df423412 100644
--- a/launcher/ui/dialogs/MSALoginDialog.cpp
+++ b/launcher/ui/dialogs/MSALoginDialog.cpp
@@ -105,8 +105,16 @@ void MSALoginDialog::showVerificationUriAndCode(const QUrl& uri, const QString&
QString urlString = uri.toString();
QString linkString = QString("%2").arg(urlString, urlString);
- ui->label->setText(
- tr("Please open up %1 in a browser and put in the code %2 to proceed with login.
").arg(linkString, code));
+ if (urlString == "https://www.microsoft.com/link" && !code.isEmpty()) {
+ urlString += QString("?otc=%1").arg(code);
+ DesktopServices::openUrl(urlString);
+ ui->label->setText(tr("Please login in the opened browser. If no browser was opened, please open up %1 in "
+ "a browser and put in the code %2 to proceed with login.
")
+ .arg(linkString, code));
+ } else {
+ ui->label->setText(
+ tr("Please open up %1 in a browser and put in the code %2 to proceed with login.
").arg(linkString, code));
+ }
ui->actionButton->setVisible(true);
connect(ui->actionButton, &QPushButton::clicked, [=]() {
DesktopServices::openUrl(uri);
diff --git a/launcher/ui/dialogs/ModUpdateDialog.cpp b/launcher/ui/dialogs/ModUpdateDialog.cpp
index 1a70ea59a..cbaaf88b9 100644
--- a/launcher/ui/dialogs/ModUpdateDialog.cpp
+++ b/launcher/ui/dialogs/ModUpdateDialog.cpp
@@ -39,7 +39,8 @@ static std::optional mcLoaders(BaseInstance* inst)
ModUpdateDialog::ModUpdateDialog(QWidget* parent,
BaseInstance* instance,
const std::shared_ptr mods,
- QList& search_for)
+ QList& search_for,
+ bool includeDeps)
: ReviewMessageBox(parent, tr("Confirm mods to update"), "")
, m_parent(parent)
, m_mod_model(mods)
@@ -47,6 +48,7 @@ ModUpdateDialog::ModUpdateDialog(QWidget* parent,
, m_second_try_metadata(
new ConcurrentTask(nullptr, "Second Metadata Search", APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt()))
, m_instance(instance)
+ , m_include_deps(includeDeps)
{
ReviewMessageBox::setGeometry(0, 0, 800, 600);
@@ -186,7 +188,7 @@ void ModUpdateDialog::checkCandidates()
}
}
- { // dependencies
+ if (m_include_deps && !APPLICATION->settings()->get("ModDependenciesDisabled").toBool()) { // dependencies
auto depTask = makeShared(this, m_instance, m_mod_model.get(), selectedVers);
connect(depTask.get(), &Task::failed, this,
diff --git a/launcher/ui/dialogs/ModUpdateDialog.h b/launcher/ui/dialogs/ModUpdateDialog.h
index b79aa4943..de5ab46a5 100644
--- a/launcher/ui/dialogs/ModUpdateDialog.h
+++ b/launcher/ui/dialogs/ModUpdateDialog.h
@@ -16,10 +16,12 @@ class ConcurrentTask;
class ModUpdateDialog final : public ReviewMessageBox {
Q_OBJECT
public:
+ explicit ModUpdateDialog(QWidget* parent, BaseInstance* instance, std::shared_ptr mod_model, QList& search_for);
explicit ModUpdateDialog(QWidget* parent,
BaseInstance* instance,
- const std::shared_ptr mod_model,
- QList& search_for);
+ std::shared_ptr mod_model,
+ QList& search_for,
+ bool includeDeps);
void checkCandidates();
@@ -61,4 +63,5 @@ class ModUpdateDialog final : public ReviewMessageBox {
bool m_no_updates = false;
bool m_aborted = false;
+ bool m_include_deps = false;
};
diff --git a/launcher/ui/dialogs/ResourceDownloadDialog.cpp b/launcher/ui/dialogs/ResourceDownloadDialog.cpp
index dc7cfff06..1431ea92c 100644
--- a/launcher/ui/dialogs/ResourceDownloadDialog.cpp
+++ b/launcher/ui/dialogs/ResourceDownloadDialog.cpp
@@ -270,13 +270,15 @@ QList ModDownloadDialog::getPages()
GetModDependenciesTask::Ptr ModDownloadDialog::getModDependenciesTask()
{
- if (auto model = dynamic_cast(getBaseModel().get()); model) {
- QList> selectedVers;
- for (auto& selected : getTasks()) {
- selectedVers.append(std::make_shared(selected->getPack(), selected->getVersion()));
- }
+ if (!APPLICATION->settings()->get("ModDependenciesDisabled").toBool()) { // dependencies
+ if (auto model = dynamic_cast(getBaseModel().get()); model) {
+ QList> selectedVers;
+ for (auto& selected : getTasks()) {
+ selectedVers.append(std::make_shared(selected->getPack(), selected->getVersion()));
+ }
- return makeShared(this, m_instance, model, selectedVers);
+ return makeShared(this, m_instance, model, selectedVers);
+ }
}
return nullptr;
}
diff --git a/launcher/ui/dialogs/ResourceDownloadDialog.h b/launcher/ui/dialogs/ResourceDownloadDialog.h
index e9d2cfbe6..a6efca138 100644
--- a/launcher/ui/dialogs/ResourceDownloadDialog.h
+++ b/launcher/ui/dialogs/ResourceDownloadDialog.h
@@ -50,7 +50,7 @@ class ResourceDownloadDialog : public QDialog, public BasePageProvider {
public:
using DownloadTaskPtr = shared_qobject_ptr;
- ResourceDownloadDialog(QWidget* parent, const std::shared_ptr base_model);
+ ResourceDownloadDialog(QWidget* parent, std::shared_ptr base_model);
void initializeContainer();
void connectButtons();
diff --git a/launcher/ui/instanceview/AccessibleInstanceView_p.h b/launcher/ui/instanceview/AccessibleInstanceView_p.h
index e99f85069..1a3a62d9f 100644
--- a/launcher/ui/instanceview/AccessibleInstanceView_p.h
+++ b/launcher/ui/instanceview/AccessibleInstanceView_p.h
@@ -59,7 +59,7 @@ class AccessibleInstanceView : public QAccessibleTableInterface, public QAccessi
protected:
// maybe vector
- typedef QHash ChildCache;
+ using ChildCache = QHash;
mutable ChildCache childToId;
virtual ~AccessibleInstanceView();
diff --git a/launcher/ui/instanceview/InstanceView.cpp b/launcher/ui/instanceview/InstanceView.cpp
index 690dc917b..e665097f4 100644
--- a/launcher/ui/instanceview/InstanceView.cpp
+++ b/launcher/ui/instanceview/InstanceView.cpp
@@ -39,6 +39,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -277,12 +278,14 @@ void InstanceView::mousePressEvent(QMouseEvent* event)
m_pressedAlreadySelected = selectionModel()->isSelected(m_pressedIndex);
m_pressedPosition = geometryPos;
- VisualGroup::HitResults hitResult;
- m_pressedCategory = categoryAt(geometryPos, hitResult);
- if (m_pressedCategory && hitResult & VisualGroup::CheckboxHit) {
- setState(m_pressedCategory->collapsed ? ExpandingState : CollapsingState);
- event->accept();
- return;
+ if (event->button() == Qt::LeftButton) {
+ VisualGroup::HitResults hitResult;
+ m_pressedCategory = categoryAt(geometryPos, hitResult);
+ if (m_pressedCategory && hitResult & VisualGroup::CheckboxHit) {
+ setState(m_pressedCategory->collapsed ? ExpandingState : CollapsingState);
+ event->accept();
+ return;
+ }
}
if (index.isValid() && (index.flags() & Qt::ItemIsEnabled)) {
@@ -365,10 +368,7 @@ void InstanceView::mouseReleaseEvent(QMouseEvent* event)
VisualGroup::HitResults hitResult;
- bool click =
- (index == m_pressedIndex && index.isValid()) || (m_pressedCategory && m_pressedCategory == categoryAt(geometryPos, hitResult));
-
- if (click && m_pressedCategory) {
+ if (event->button() == Qt::LeftButton && m_pressedCategory != nullptr && m_pressedCategory == categoryAt(geometryPos, hitResult)) {
if (state() == ExpandingState) {
m_pressedCategory->collapsed = false;
emit groupStateChanged(m_pressedCategory->text, false);
@@ -396,7 +396,7 @@ void InstanceView::mouseReleaseEvent(QMouseEvent* event)
setState(NoState);
- if (click) {
+ if (index == m_pressedIndex && index.isValid()) {
if (event->button() == Qt::LeftButton) {
emit clicked(index);
}
@@ -478,6 +478,38 @@ void InstanceView::paintEvent([[maybe_unused]] QPaintEvent* event)
#endif
option.widget = this;
+ if (model()->rowCount() == 0) {
+ painter.save();
+ const QString line1 = tr("Welcome!");
+ const QString line2 = tr("Click \"Add Instance\" to get started.");
+ auto rect = this->viewport()->rect();
+ auto font = option.font;
+ font.setPointSize(37);
+ painter.setFont(font);
+ auto fm = painter.fontMetrics();
+
+ if (rect.height() <= (fm.height() * 5) || rect.width() <= fm.horizontalAdvance(line2)) {
+ auto s = rect.height() / (5. * fm.height());
+ auto sx = rect.width() * 1. / fm.horizontalAdvance(line2);
+ if (s >= sx)
+ s = sx;
+ auto ps = font.pointSize() * s;
+ if (ps <= 0)
+ ps = 1;
+ font.setPointSize(ps);
+ painter.setFont(font);
+ fm = painter.fontMetrics();
+ }
+
+ // text
+ rect.setTop(rect.top() + fm.height() * 1.5);
+ painter.drawText(rect, Qt::AlignHCenter, line1);
+ rect.setTop(rect.top() + fm.height());
+ painter.drawText(rect, Qt::AlignHCenter, line2);
+ painter.restore();
+ return;
+ }
+
int wpWidth = viewport()->width();
option.rect.setWidth(wpWidth);
for (int i = 0; i < m_groups.size(); ++i) {
diff --git a/launcher/ui/instanceview/InstanceView.h b/launcher/ui/instanceview/InstanceView.h
index 3d4d56208..30be411a8 100644
--- a/launcher/ui/instanceview/InstanceView.h
+++ b/launcher/ui/instanceview/InstanceView.h
@@ -65,7 +65,7 @@ class InstanceView : public QAbstractItemView {
/// get the model index at the specified visual point
virtual QModelIndex indexAt(const QPoint& point) const override;
QString groupNameAt(const QPoint& point);
- void setSelection(const QRect& rect, const QItemSelectionModel::SelectionFlags commands) override;
+ void setSelection(const QRect& rect, QItemSelectionModel::SelectionFlags commands) override;
virtual int horizontalOffset() const override;
virtual int verticalOffset() const override;
diff --git a/launcher/ui/pages/BasePage.h b/launcher/ui/pages/BasePage.h
index d35206a08..cb3a7633d 100644
--- a/launcher/ui/pages/BasePage.h
+++ b/launcher/ui/pages/BasePage.h
@@ -77,4 +77,4 @@ class BasePage {
bool isOpened = false;
};
-typedef std::shared_ptr BasePagePtr;
+using BasePagePtr = std::shared_ptr;
diff --git a/launcher/ui/pages/BasePageProvider.h b/launcher/ui/pages/BasePageProvider.h
index 4c3ecd6c1..422891e6b 100644
--- a/launcher/ui/pages/BasePageProvider.h
+++ b/launcher/ui/pages/BasePageProvider.h
@@ -26,7 +26,7 @@ class BasePageProvider {
};
class GenericPageProvider : public BasePageProvider {
- typedef std::function PageCreator;
+ using PageCreator = std::function;
public:
explicit GenericPageProvider(const QString& dialogTitle) : m_dialogTitle(dialogTitle) {}
diff --git a/launcher/ui/pages/global/APIPage.ui b/launcher/ui/pages/global/APIPage.ui
index 492741ba4..93591e440 100644
--- a/launcher/ui/pages/global/APIPage.ui
+++ b/launcher/ui/pages/global/APIPage.ui
@@ -209,6 +209,9 @@
<html><head/><body><p>Note: you only need to set this to access private data. Read the <a href="https://docs.modrinth.com/api-spec/#section/Authentication">documentation</a> for more information.</p></body></html>
+
+ true
+