aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/ui')
-rw-r--r--launcher/ui/MainWindow.cpp9
-rw-r--r--launcher/ui/dialogs/AboutDialog.cpp2
-rw-r--r--launcher/ui/pages/global/LauncherPage.cpp2
-rw-r--r--launcher/ui/widgets/ProjectItem.cpp39
4 files changed, 42 insertions, 10 deletions
diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp
index 0fab0202..97152a48 100644
--- a/launcher/ui/MainWindow.cpp
+++ b/launcher/ui/MainWindow.cpp
@@ -643,6 +643,7 @@ public:
actionRenameInstance->setObjectName(QStringLiteral("actionRenameInstance"));
actionRenameInstance.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Rename"));
actionRenameInstance.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Rename the selected instance."));
+ actionRenameInstance->setIcon(APPLICATION->getThemedIcon("rename"));
all_actions.append(&actionRenameInstance);
// the rename label is inside the rename tool button
@@ -675,6 +676,7 @@ public:
actionKillInstance.setTextId(QT_TRANSLATE_NOOP("MainWindow", "&Kill"));
actionKillInstance.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Kill the running instance"));
actionKillInstance->setShortcut(QKeySequence(tr("Ctrl+K")));
+ actionKillInstance->setIcon(APPLICATION->getThemedIcon("status-bad"));
all_actions.append(&actionKillInstance);
actionEditInstance = TranslatedAction(MainWindow);
@@ -682,6 +684,7 @@ public:
actionEditInstance.setTextId(QT_TRANSLATE_NOOP("MainWindow", "&Edit..."));
actionEditInstance.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Change the instance settings, mods and versions."));
actionEditInstance->setShortcut(QKeySequence(tr("Ctrl+I")));
+ actionEditInstance->setIcon(APPLICATION->getThemedIcon("settings-configure"));
all_actions.append(&actionEditInstance);
actionChangeInstGroup = TranslatedAction(MainWindow);
@@ -689,12 +692,14 @@ public:
actionChangeInstGroup.setTextId(QT_TRANSLATE_NOOP("MainWindow", "&Change Group..."));
actionChangeInstGroup.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Change the selected instance's group."));
actionChangeInstGroup->setShortcut(QKeySequence(tr("Ctrl+G")));
+ actionChangeInstGroup->setIcon(APPLICATION->getThemedIcon("tag"));
all_actions.append(&actionChangeInstGroup);
actionViewSelectedInstFolder = TranslatedAction(MainWindow);
actionViewSelectedInstFolder->setObjectName(QStringLiteral("actionViewSelectedInstFolder"));
actionViewSelectedInstFolder.setTextId(QT_TRANSLATE_NOOP("MainWindow", "&Folder"));
actionViewSelectedInstFolder.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Open the selected instance's root folder in a file browser."));
+ actionViewSelectedInstFolder->setIcon(APPLICATION->getThemedIcon("viewfolder"));
all_actions.append(&actionViewSelectedInstFolder);
actionExportInstance = TranslatedAction(MainWindow);
@@ -702,6 +707,7 @@ public:
actionExportInstance.setTextId(QT_TRANSLATE_NOOP("MainWindow", "E&xport..."));
actionExportInstance.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Export the selected instance as a zip file."));
actionExportInstance->setShortcut(QKeySequence(tr("Ctrl+E")));
+ actionExportInstance->setIcon(APPLICATION->getThemedIcon("export"));
all_actions.append(&actionExportInstance);
actionDeleteInstance = TranslatedAction(MainWindow);
@@ -710,14 +716,15 @@ public:
actionDeleteInstance.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Delete the selected instance."));
actionDeleteInstance->setShortcuts({QKeySequence(tr("Backspace")), QKeySequence::Delete});
actionDeleteInstance->setAutoRepeat(false);
+ actionDeleteInstance->setIcon(APPLICATION->getThemedIcon("delete"));
all_actions.append(&actionDeleteInstance);
actionCopyInstance = TranslatedAction(MainWindow);
actionCopyInstance->setObjectName(QStringLiteral("actionCopyInstance"));
- actionCopyInstance->setIcon(APPLICATION->getThemedIcon("copy"));
actionCopyInstance.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Cop&y..."));
actionCopyInstance.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Copy the selected instance."));
actionCopyInstance->setShortcut(QKeySequence(tr("Ctrl+D")));
+ actionCopyInstance->setIcon(APPLICATION->getThemedIcon("copy"));
all_actions.append(&actionCopyInstance);
setInstanceActionsEnabled(false);
diff --git a/launcher/ui/dialogs/AboutDialog.cpp b/launcher/ui/dialogs/AboutDialog.cpp
index 2970d47d..cecda1df 100644
--- a/launcher/ui/dialogs/AboutDialog.cpp
+++ b/launcher/ui/dialogs/AboutDialog.cpp
@@ -172,7 +172,7 @@ AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AboutDia
QString urlText("<html><head/><body><p><a href=\"%1\">%1</a></p></body></html>");
ui->urlLabel->setText(urlText.arg(BuildConfig.LAUNCHER_GIT));
- QString copyText("© 2021-2022 %1");
+ QString copyText("© 2022 %1");
ui->copyLabel->setText(copyText.arg(BuildConfig.LAUNCHER_COPYRIGHT));
connect(ui->closeButton, SIGNAL(clicked()), SLOT(close()));
diff --git a/launcher/ui/pages/global/LauncherPage.cpp b/launcher/ui/pages/global/LauncherPage.cpp
index 1e5df5b2..b8431e8c 100644
--- a/launcher/ui/pages/global/LauncherPage.cpp
+++ b/launcher/ui/pages/global/LauncherPage.cpp
@@ -147,7 +147,7 @@ void LauncherPage::on_instDirBrowseBtn_clicked()
{
QMessageBox warning;
warning.setText(tr("You're trying to specify an instance folder "
- "which was granted temporaily via Flatpak.\n"
+ "which was granted temporarily via Flatpak.\n"
"This is known to cause problems. "
"After a restart the launcher might break, "
"because it will no longer have access to that directory.\n\n"
diff --git a/launcher/ui/widgets/ProjectItem.cpp b/launcher/ui/widgets/ProjectItem.cpp
index 01be88d9..d1ff9dbc 100644
--- a/launcher/ui/widgets/ProjectItem.cpp
+++ b/launcher/ui/widgets/ProjectItem.cpp
@@ -51,6 +51,8 @@ void ProjectItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& o
auto remaining_width = rect.width() - icon_width - 2 * icon_x_margin;
rect.setRect(rect.x() + icon_width + 2 * icon_x_margin, rect.y(), remaining_width, rect.height());
+ int title_height = 0;
+
{ // Title painting
auto title = index.data(UserDataTypes::TITLE).toString();
@@ -66,8 +68,10 @@ void ProjectItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& o
font.setPointSize(font.pointSize() + 2);
painter->setFont(font);
+ title_height = QFontMetrics(font).height();
+
// On the top, aligned to the left after the icon
- painter->drawText(rect.x(), rect.y() + QFontMetrics(font).height(), title);
+ painter->drawText(rect.x(), rect.y() + title_height, title);
painter->restore();
}
@@ -82,17 +86,38 @@ void ProjectItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& o
// Get first line unconditionally
description = cut_text.first().second;
+ auto num_lines = 1;
+
// Get second line, elided if needed
if (cut_text.size() > 1) {
- if (cut_text.size() > 2)
- description += opt.fontMetrics.elidedText(cut_text.at(1).second, opt.textElideMode, cut_text.at(1).first);
- else
- description += cut_text.at(1).second;
+ // 2.5x so because there should be some margin left from the 2x so things don't get too squishy.
+ if (rect.height() - title_height <= 2.5 * opt.fontMetrics.height()) {
+ // If there's not enough space, show only a single line, elided.
+ description = opt.fontMetrics.elidedText(description, opt.textElideMode, cut_text.at(0).first);
+ } else {
+ if (cut_text.size() > 2) {
+ description += opt.fontMetrics.elidedText(cut_text.at(1).second, opt.textElideMode, cut_text.at(1).first);
+ } else {
+ description += cut_text.at(1).second;
+ }
+ num_lines += 1;
+ }
}
+ int description_x = rect.x();
+
+
+ // Have the y-value be set based on the number of lines in the description, to centralize the
+ // description text with the space between the base and the title.
+ int description_y = rect.y() + title_height + (rect.height() - title_height) / 2;
+ if (num_lines == 1)
+ description_y -= opt.fontMetrics.height() / 2;
+ else
+ description_y -= opt.fontMetrics.height();
+
// On the bottom, aligned to the left after the icon, and featuring at most two lines of text (with some margin space to spare)
- painter->drawText(rect.x(), rect.y() + rect.height() - 2.2 * opt.fontMetrics.height(), remaining_width,
- 2 * opt.fontMetrics.height(), Qt::TextWordWrap, description);
+ painter->drawText(description_x, description_y, remaining_width,
+ cut_text.size() * opt.fontMetrics.height(), Qt::TextWordWrap, description);
}
painter->restore();