aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/pages
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/ui/pages')
-rw-r--r--launcher/ui/pages/instance/InstanceSettingsPage.cpp6
-rw-r--r--launcher/ui/pages/instance/ManagedPackPage.cpp4
-rw-r--r--launcher/ui/pages/instance/ScreenshotsPage.cpp79
-rw-r--r--launcher/ui/pages/instance/VersionPage.cpp1
-rw-r--r--launcher/ui/pages/instance/VersionPage.ui10
-rw-r--r--launcher/ui/pages/modplatform/CustomPage.cpp (renamed from launcher/ui/pages/modplatform/VanillaPage.cpp)68
-rw-r--r--launcher/ui/pages/modplatform/CustomPage.h (renamed from launcher/ui/pages/modplatform/VanillaPage.h)12
-rw-r--r--launcher/ui/pages/modplatform/CustomPage.ui (renamed from launcher/ui/pages/modplatform/VanillaPage.ui)4
-rw-r--r--launcher/ui/pages/modplatform/legacy_ftb/Page.cpp4
9 files changed, 89 insertions, 99 deletions
diff --git a/launcher/ui/pages/instance/InstanceSettingsPage.cpp b/launcher/ui/pages/instance/InstanceSettingsPage.cpp
index 08977841..2a7c5b27 100644
--- a/launcher/ui/pages/instance/InstanceSettingsPage.cpp
+++ b/launcher/ui/pages/instance/InstanceSettingsPage.cpp
@@ -85,12 +85,12 @@ void InstanceSettingsPage::globalSettingsButtonClicked(bool)
case 0:
APPLICATION->ShowGlobalSettings(this, "java-settings");
return;
- case 1:
- APPLICATION->ShowGlobalSettings(this, "minecraft-settings");
- return;
case 2:
APPLICATION->ShowGlobalSettings(this, "custom-commands");
return;
+ default:
+ APPLICATION->ShowGlobalSettings(this, "minecraft-settings");
+ return;
}
}
diff --git a/launcher/ui/pages/instance/ManagedPackPage.cpp b/launcher/ui/pages/instance/ManagedPackPage.cpp
index e0a7314f..d89c5bfc 100644
--- a/launcher/ui/pages/instance/ManagedPackPage.cpp
+++ b/launcher/ui/pages/instance/ManagedPackPage.cpp
@@ -205,7 +205,7 @@ ModrinthManagedPackPage::ModrinthManagedPackPage(BaseInstance* inst, InstanceWin
{
Q_ASSERT(inst->isManagedPack());
connect(ui->versionsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(suggestVersion()));
- connect(ui->updateButton, &QPushButton::pressed, this, &ModrinthManagedPackPage::update);
+ connect(ui->updateButton, &QPushButton::clicked, this, &ModrinthManagedPackPage::update);
}
// MODRINTH
@@ -332,7 +332,7 @@ FlameManagedPackPage::FlameManagedPackPage(BaseInstance* inst, InstanceWindow* i
{
Q_ASSERT(inst->isManagedPack());
connect(ui->versionsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(suggestVersion()));
- connect(ui->updateButton, &QPushButton::pressed, this, &FlameManagedPackPage::update);
+ connect(ui->updateButton, &QPushButton::clicked, this, &FlameManagedPackPage::update);
}
void FlameManagedPackPage::parseManagedPack()
diff --git a/launcher/ui/pages/instance/ScreenshotsPage.cpp b/launcher/ui/pages/instance/ScreenshotsPage.cpp
index ca368d3b..bcce5f57 100644
--- a/launcher/ui/pages/instance/ScreenshotsPage.cpp
+++ b/launcher/ui/pages/instance/ScreenshotsPage.cpp
@@ -36,6 +36,7 @@
*/
#include "ScreenshotsPage.h"
+#include "BuildConfig.h"
#include "ui_ScreenshotsPage.h"
#include <QModelIndex>
@@ -96,37 +97,30 @@ public:
return;
if ((info.suffix().compare("png", Qt::CaseInsensitive) != 0))
return;
- int tries = 5;
- while (tries)
- {
- if (!m_cache->stale(m_path))
- return;
- QImage image(m_path);
- if (image.isNull())
- {
- QThread::msleep(500);
- tries--;
- continue;
- }
- QImage small;
- if (image.width() > image.height())
- small = image.scaledToWidth(512).scaledToWidth(256, Qt::SmoothTransformation);
- else
- small = image.scaledToHeight(512).scaledToHeight(256, Qt::SmoothTransformation);
- QPoint offset((256 - small.width()) / 2, (256 - small.height()) / 2);
- QImage square(QSize(256, 256), QImage::Format_ARGB32);
- square.fill(Qt::transparent);
-
- QPainter painter(&square);
- painter.drawImage(offset, small);
- painter.end();
-
- QIcon icon(QPixmap::fromImage(square));
- m_cache->add(m_path, icon);
- m_resultEmitter.emitResultsReady(m_path);
+ if (!m_cache->stale(m_path))
+ return;
+ QImage image(m_path);
+ if (image.isNull()) {
+ m_resultEmitter.emitResultsFailed(m_path);
+ qDebug() << "Error loading screenshot: " + m_path + ". Perhaps too large?";
return;
}
- m_resultEmitter.emitResultsFailed(m_path);
+ QImage small;
+ if (image.width() > image.height())
+ small = image.scaledToWidth(512).scaledToWidth(256, Qt::SmoothTransformation);
+ else
+ small = image.scaledToHeight(512).scaledToHeight(256, Qt::SmoothTransformation);
+ QPoint offset((256 - small.width()) / 2, (256 - small.height()) / 2);
+ QImage square(QSize(256, 256), QImage::Format_ARGB32);
+ square.fill(Qt::transparent);
+
+ QPainter painter(&square);
+ painter.drawImage(offset, small);
+ painter.end();
+
+ QIcon icon(QPixmap::fromImage(square));
+ m_cache->add(m_path, icon);
+ m_resultEmitter.emitResultsReady(m_path);
}
QString m_path;
SharedIconCachePtr m_cache;
@@ -145,9 +139,12 @@ public:
m_thumbnailCache = std::make_shared<SharedIconCache>();
m_thumbnailCache->add("placeholder", APPLICATION->getThemedIcon("screenshot-placeholder"));
connect(&watcher, SIGNAL(fileChanged(QString)), SLOT(fileChanged(QString)));
- // FIXME: the watched file set is not updated when files are removed
}
- virtual ~FilterModel() { m_thumbnailingPool.waitForDone(500); }
+ virtual ~FilterModel() {
+ m_thumbnailingPool.clear();
+ if (!m_thumbnailingPool.waitForDone(500))
+ qDebug() << "Thumbnail pool took longer than 500ms to finish";
+ }
virtual QVariant data(const QModelIndex &proxyIndex, int role = Qt::DisplayRole) const
{
auto model = sourceModel();
@@ -214,10 +211,12 @@ private slots:
void fileChanged(QString filepath)
{
m_thumbnailCache->setStale(filepath);
- thumbnailImage(filepath);
// reinsert the path...
watcher.removePath(filepath);
- watcher.addPath(filepath);
+ if (QFile::exists(filepath)) {
+ watcher.addPath(filepath);
+ thumbnailImage(filepath);
+ }
}
private:
@@ -380,16 +379,18 @@ void ScreenshotsPage::on_actionUpload_triggered()
if (selection.isEmpty())
return;
-
QString text;
+ QUrl baseUrl(BuildConfig.IMGUR_BASE_URL);
if (selection.size() > 1)
- text = tr("You are about to upload %1 screenshots.\n\n"
+ text = tr("You are about to upload %1 screenshots to %2.\n"
+ "You should double-check for personal information.\n\n"
"Are you sure?")
- .arg(selection.size());
+ .arg(QString::number(selection.size()), baseUrl.host());
else
- text =
- tr("You are about to upload the selected screenshot.\n\n"
- "Are you sure?");
+ text = tr("You are about to upload the selected screenshot to %1.\n"
+ "You should double-check for personal information.\n\n"
+ "Are you sure?")
+ .arg(baseUrl.host());
auto response = CustomMessageBox::selectable(this, "Confirm Upload", text, QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No,
QMessageBox::No)
diff --git a/launcher/ui/pages/instance/VersionPage.cpp b/launcher/ui/pages/instance/VersionPage.cpp
index 74b7ec7c..59107c53 100644
--- a/launcher/ui/pages/instance/VersionPage.cpp
+++ b/launcher/ui/pages/instance/VersionPage.cpp
@@ -287,7 +287,6 @@ void VersionPage::updateButtons(int row)
ui->actionAdd_Empty->setEnabled(controlsEnabled);
ui->actionImport_Components->setEnabled(controlsEnabled);
ui->actionReload->setEnabled(controlsEnabled);
- ui->actionInstall_mods->setEnabled(controlsEnabled);
ui->actionReplace_Minecraft_jar->setEnabled(controlsEnabled);
ui->actionAdd_to_Minecraft_jar->setEnabled(controlsEnabled);
ui->actionAdd_Agents->setEnabled(controlsEnabled);
diff --git a/launcher/ui/pages/instance/VersionPage.ui b/launcher/ui/pages/instance/VersionPage.ui
index 4777eafe..a73c42d6 100644
--- a/launcher/ui/pages/instance/VersionPage.ui
+++ b/launcher/ui/pages/instance/VersionPage.ui
@@ -102,7 +102,6 @@
<addaction name="actionInstall_Fabric"/>
<addaction name="actionInstall_Quilt"/>
<addaction name="actionInstall_LiteLoader"/>
- <addaction name="actionInstall_mods"/>
<addaction name="separator"/>
<addaction name="actionAdd_to_Minecraft_jar"/>
<addaction name="actionReplace_Minecraft_jar"/>
@@ -112,7 +111,6 @@
<addaction name="separator"/>
<addaction name="actionMinecraftFolder"/>
<addaction name="actionLibrariesFolder"/>
- <addaction name="separator"/>
<addaction name="actionReload"/>
<addaction name="actionDownload_All"/>
</widget>
@@ -204,14 +202,6 @@
<string>Install the LiteLoader package.</string>
</property>
</action>
- <action name="actionInstall_mods">
- <property name="text">
- <string>Install mods</string>
- </property>
- <property name="toolTip">
- <string>Install normal mods.</string>
- </property>
- </action>
<action name="actionAdd_to_Minecraft_jar">
<property name="text">
<string>Add to Minecraft.jar</string>
diff --git a/launcher/ui/pages/modplatform/VanillaPage.cpp b/launcher/ui/pages/modplatform/CustomPage.cpp
index 29fecb85..e164171a 100644
--- a/launcher/ui/pages/modplatform/VanillaPage.cpp
+++ b/launcher/ui/pages/modplatform/CustomPage.cpp
@@ -33,8 +33,8 @@
* limitations under the License.
*/
-#include "VanillaPage.h"
-#include "ui_VanillaPage.h"
+#include "CustomPage.h"
+#include "ui_CustomPage.h"
#include <QTabBar>
@@ -46,32 +46,32 @@
#include "minecraft/VanillaInstanceCreationTask.h"
#include "ui/dialogs/NewInstanceDialog.h"
-VanillaPage::VanillaPage(NewInstanceDialog *dialog, QWidget *parent)
- : QWidget(parent), dialog(dialog), ui(new Ui::VanillaPage)
+CustomPage::CustomPage(NewInstanceDialog *dialog, QWidget *parent)
+ : QWidget(parent), dialog(dialog), ui(new Ui::CustomPage)
{
ui->setupUi(this);
ui->tabWidget->tabBar()->hide();
- connect(ui->versionList, &VersionSelectWidget::selectedVersionChanged, this, &VanillaPage::setSelectedVersion);
+ connect(ui->versionList, &VersionSelectWidget::selectedVersionChanged, this, &CustomPage::setSelectedVersion);
filterChanged();
- connect(ui->alphaFilter, &QCheckBox::stateChanged, this, &VanillaPage::filterChanged);
- connect(ui->betaFilter, &QCheckBox::stateChanged, this, &VanillaPage::filterChanged);
- connect(ui->snapshotFilter, &QCheckBox::stateChanged, this, &VanillaPage::filterChanged);
- connect(ui->oldSnapshotFilter, &QCheckBox::stateChanged, this, &VanillaPage::filterChanged);
- connect(ui->releaseFilter, &QCheckBox::stateChanged, this, &VanillaPage::filterChanged);
- connect(ui->experimentsFilter, &QCheckBox::stateChanged, this, &VanillaPage::filterChanged);
- connect(ui->refreshBtn, &QPushButton::clicked, this, &VanillaPage::refresh);
-
- connect(ui->loaderVersionList, &VersionSelectWidget::selectedVersionChanged, this, &VanillaPage::setSelectedLoaderVersion);
- connect(ui->noneFilter, &QRadioButton::toggled, this, &VanillaPage::loaderFilterChanged);
- connect(ui->forgeFilter, &QRadioButton::toggled, this, &VanillaPage::loaderFilterChanged);
- connect(ui->fabricFilter, &QRadioButton::toggled, this, &VanillaPage::loaderFilterChanged);
- connect(ui->quiltFilter, &QRadioButton::toggled, this, &VanillaPage::loaderFilterChanged);
- connect(ui->liteLoaderFilter, &QRadioButton::toggled, this, &VanillaPage::loaderFilterChanged);
- connect(ui->loaderRefreshBtn, &QPushButton::clicked, this, &VanillaPage::loaderRefresh);
+ connect(ui->alphaFilter, &QCheckBox::stateChanged, this, &CustomPage::filterChanged);
+ connect(ui->betaFilter, &QCheckBox::stateChanged, this, &CustomPage::filterChanged);
+ connect(ui->snapshotFilter, &QCheckBox::stateChanged, this, &CustomPage::filterChanged);
+ connect(ui->oldSnapshotFilter, &QCheckBox::stateChanged, this, &CustomPage::filterChanged);
+ connect(ui->releaseFilter, &QCheckBox::stateChanged, this, &CustomPage::filterChanged);
+ connect(ui->experimentsFilter, &QCheckBox::stateChanged, this, &CustomPage::filterChanged);
+ connect(ui->refreshBtn, &QPushButton::clicked, this, &CustomPage::refresh);
+
+ connect(ui->loaderVersionList, &VersionSelectWidget::selectedVersionChanged, this, &CustomPage::setSelectedLoaderVersion);
+ connect(ui->noneFilter, &QRadioButton::toggled, this, &CustomPage::loaderFilterChanged);
+ connect(ui->forgeFilter, &QRadioButton::toggled, this, &CustomPage::loaderFilterChanged);
+ connect(ui->fabricFilter, &QRadioButton::toggled, this, &CustomPage::loaderFilterChanged);
+ connect(ui->quiltFilter, &QRadioButton::toggled, this, &CustomPage::loaderFilterChanged);
+ connect(ui->liteLoaderFilter, &QRadioButton::toggled, this, &CustomPage::loaderFilterChanged);
+ connect(ui->loaderRefreshBtn, &QPushButton::clicked, this, &CustomPage::loaderRefresh);
}
-void VanillaPage::openedImpl()
+void CustomPage::openedImpl()
{
if(!initialized)
{
@@ -85,19 +85,19 @@ void VanillaPage::openedImpl()
}
}
-void VanillaPage::refresh()
+void CustomPage::refresh()
{
ui->versionList->loadList();
}
-void VanillaPage::loaderRefresh()
+void CustomPage::loaderRefresh()
{
if(ui->noneFilter->isChecked())
return;
ui->loaderVersionList->loadList();
}
-void VanillaPage::filterChanged()
+void CustomPage::filterChanged()
{
QStringList out;
if(ui->alphaFilter->isChecked())
@@ -116,7 +116,7 @@ void VanillaPage::filterChanged()
ui->versionList->setFilter(BaseVersionList::TypeRole, new RegexpFilter(regexp, false));
}
-void VanillaPage::loaderFilterChanged()
+void CustomPage::loaderFilterChanged()
{
QString minecraftVersion;
if (m_selectedVersion)
@@ -172,37 +172,37 @@ void VanillaPage::loaderFilterChanged()
ui->loaderVersionList->setEmptyString(tr("No versions are currently available for Minecraft %1").arg(minecraftVersion));
}
-VanillaPage::~VanillaPage()
+CustomPage::~CustomPage()
{
delete ui;
}
-bool VanillaPage::shouldDisplay() const
+bool CustomPage::shouldDisplay() const
{
return true;
}
-void VanillaPage::retranslate()
+void CustomPage::retranslate()
{
ui->retranslateUi(this);
}
-BaseVersion::Ptr VanillaPage::selectedVersion() const
+BaseVersion::Ptr CustomPage::selectedVersion() const
{
return m_selectedVersion;
}
-BaseVersion::Ptr VanillaPage::selectedLoaderVersion() const
+BaseVersion::Ptr CustomPage::selectedLoaderVersion() const
{
return m_selectedLoaderVersion;
}
-QString VanillaPage::selectedLoader() const
+QString CustomPage::selectedLoader() const
{
return m_selectedLoader;
}
-void VanillaPage::suggestCurrent()
+void CustomPage::suggestCurrent()
{
if (!isOpened)
{
@@ -227,14 +227,14 @@ void VanillaPage::suggestCurrent()
dialog->setSuggestedIcon("default");
}
-void VanillaPage::setSelectedVersion(BaseVersion::Ptr version)
+void CustomPage::setSelectedVersion(BaseVersion::Ptr version)
{
m_selectedVersion = version;
suggestCurrent();
loaderFilterChanged();
}
-void VanillaPage::setSelectedLoaderVersion(BaseVersion::Ptr version)
+void CustomPage::setSelectedLoaderVersion(BaseVersion::Ptr version)
{
m_selectedLoaderVersion = version;
suggestCurrent();
diff --git a/launcher/ui/pages/modplatform/VanillaPage.h b/launcher/ui/pages/modplatform/CustomPage.h
index 39aba760..8b5a5011 100644
--- a/launcher/ui/pages/modplatform/VanillaPage.h
+++ b/launcher/ui/pages/modplatform/CustomPage.h
@@ -43,21 +43,21 @@
namespace Ui
{
-class VanillaPage;
+class CustomPage;
}
class NewInstanceDialog;
-class VanillaPage : public QWidget, public BasePage
+class CustomPage : public QWidget, public BasePage
{
Q_OBJECT
public:
- explicit VanillaPage(NewInstanceDialog *dialog, QWidget *parent = 0);
- virtual ~VanillaPage();
+ explicit CustomPage(NewInstanceDialog *dialog, QWidget *parent = 0);
+ virtual ~CustomPage();
virtual QString displayName() const override
{
- return tr("Vanilla");
+ return tr("Custom");
}
virtual QIcon icon() const override
{
@@ -96,7 +96,7 @@ private:
private:
bool initialized = false;
NewInstanceDialog *dialog = nullptr;
- Ui::VanillaPage *ui = nullptr;
+ Ui::CustomPage *ui = nullptr;
bool m_versionSetByUser = false;
BaseVersion::Ptr m_selectedVersion;
BaseVersion::Ptr m_selectedLoaderVersion;
diff --git a/launcher/ui/pages/modplatform/VanillaPage.ui b/launcher/ui/pages/modplatform/CustomPage.ui
index 43110927..0d89b595 100644
--- a/launcher/ui/pages/modplatform/VanillaPage.ui
+++ b/launcher/ui/pages/modplatform/CustomPage.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
- <class>VanillaPage</class>
- <widget class="QWidget" name="VanillaPage">
+ <class>CustomPage</class>
+ <widget class="QWidget" name="CustomPage">
<property name="geometry">
<rect>
<x>0</x>
diff --git a/launcher/ui/pages/modplatform/legacy_ftb/Page.cpp b/launcher/ui/pages/modplatform/legacy_ftb/Page.cpp
index 98ab8799..b3f6261f 100644
--- a/launcher/ui/pages/modplatform/legacy_ftb/Page.cpp
+++ b/launcher/ui/pages/modplatform/legacy_ftb/Page.cpp
@@ -116,8 +116,8 @@ Page::Page(NewInstanceDialog* dialog, QWidget *parent)
connect(ui->thirdPartyPackList->selectionModel(), &QItemSelectionModel::currentChanged, this, &Page::onThirdPartyPackSelectionChanged);
connect(ui->privatePackList->selectionModel(), &QItemSelectionModel::currentChanged, this, &Page::onPrivatePackSelectionChanged);
- connect(ui->addPackBtn, &QPushButton::pressed, this, &Page::onAddPackClicked);
- connect(ui->removePackBtn, &QPushButton::pressed, this, &Page::onRemovePackClicked);
+ connect(ui->addPackBtn, &QPushButton::clicked, this, &Page::onAddPackClicked);
+ connect(ui->removePackBtn, &QPushButton::clicked, this, &Page::onRemovePackClicked);
connect(ui->tabWidget, &QTabWidget::currentChanged, this, &Page::onTabChanged);