From 99e1c13e80d12764f57a993661656d9ed7de27bb Mon Sep 17 00:00:00 2001 From: he3als <65787561+he3als@users.noreply.github.com> Date: Sat, 22 Oct 2022 15:50:06 +0100 Subject: fix: add flat_white to code --- launcher/ui/pages/global/LauncherPage.cpp | 13 ++++++++++--- launcher/ui/pages/global/LauncherPage.ui | 5 +++++ 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'launcher/ui/pages/global') diff --git a/launcher/ui/pages/global/LauncherPage.cpp b/launcher/ui/pages/global/LauncherPage.cpp index b8431e8c..536ab22e 100644 --- a/launcher/ui/pages/global/LauncherPage.cpp +++ b/launcher/ui/pages/global/LauncherPage.cpp @@ -310,9 +310,12 @@ void LauncherPage::applySettings() s->set("IconTheme", "flat"); break; case 7: - s->set("IconTheme", "multimc"); + s->set("IconTheme", "flat_white"); break; case 8: + s->set("IconTheme", "multimc"); + break; + case 9: s->set("IconTheme", "custom"); break; } @@ -408,14 +411,18 @@ void LauncherPage::loadSettings() { ui->themeComboBox->setCurrentIndex(6); } - else if (theme == "multimc") + else if (theme == "flat_white") { ui->themeComboBox->setCurrentIndex(7); } - else if (theme == "custom") + else if (theme == "multimc") { ui->themeComboBox->setCurrentIndex(8); } + else if (theme == "custom") + { + ui->themeComboBox->setCurrentIndex(9); + } { auto currentTheme = s->get("ApplicationTheme").toString(); diff --git a/launcher/ui/pages/global/LauncherPage.ui b/launcher/ui/pages/global/LauncherPage.ui index 0d14f147..76a25f2e 100644 --- a/launcher/ui/pages/global/LauncherPage.ui +++ b/launcher/ui/pages/global/LauncherPage.ui @@ -300,6 +300,11 @@ Flat + + + Flat (White) + + Legacy -- cgit From 29d362a6e08f28ac48e737510a17ae7b3b717850 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Sun, 30 Oct 2022 18:54:52 +0100 Subject: fix: do not trash instances in Flatpak Signed-off-by: Sefa Eyeoglu --- launcher/Application.cpp | 9 --------- launcher/Application.h | 2 -- launcher/DesktopServices.cpp | 19 ++++++++++++++----- launcher/DesktopServices.h | 2 ++ launcher/FileSystem.cpp | 4 ++++ launcher/ui/pages/global/LauncherPage.cpp | 3 ++- 6 files changed, 22 insertions(+), 17 deletions(-) (limited to 'launcher/ui/pages/global') diff --git a/launcher/Application.cpp b/launcher/Application.cpp index c6814abf..0c370b42 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -1136,15 +1136,6 @@ std::vector Application::getValidApplicationThemes() return ret; } -bool Application::isFlatpak() -{ - #ifdef Q_OS_LINUX - return QFile::exists("/.flatpak-info"); - #else - return false; - #endif -} - void Application::setApplicationTheme(const QString& name, bool initial) { auto systemPalette = qApp->palette(); diff --git a/launcher/Application.h b/launcher/Application.h index c453cc28..8fa0ab10 100644 --- a/launcher/Application.h +++ b/launcher/Application.h @@ -116,8 +116,6 @@ public: QIcon getThemedIcon(const QString& name); - bool isFlatpak(); - void setIconTheme(const QString& name); std::vector getValidApplicationThemes(); diff --git a/launcher/DesktopServices.cpp b/launcher/DesktopServices.cpp index c29cbe7d..302eaf96 100644 --- a/launcher/DesktopServices.cpp +++ b/launcher/DesktopServices.cpp @@ -119,7 +119,7 @@ bool openDirectory(const QString &path, bool ensureExists) return QDesktopServices::openUrl(QUrl::fromLocalFile(dir.absolutePath())); }; #if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) - if(!APPLICATION->isFlatpak()) + if(!isFlatpak()) { return IndirectOpen(f); } @@ -140,7 +140,7 @@ bool openFile(const QString &path) return QDesktopServices::openUrl(QUrl::fromLocalFile(path)); }; #if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) - if(!APPLICATION->isFlatpak()) + if(!isFlatpak()) { return IndirectOpen(f); } @@ -158,7 +158,7 @@ bool openFile(const QString &application, const QString &path, const QString &wo qDebug() << "Opening file" << path << "using" << application; #if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) // FIXME: the pid here is fake. So if something depends on it, it will likely misbehave - if(!APPLICATION->isFlatpak()) + if(!isFlatpak()) { return IndirectOpen([&]() { @@ -178,7 +178,7 @@ bool run(const QString &application, const QStringList &args, const QString &wor { qDebug() << "Running" << application << "with args" << args.join(' '); #if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) - if(!APPLICATION->isFlatpak()) + if(!isFlatpak()) { // FIXME: the pid here is fake. So if something depends on it, it will likely misbehave return IndirectOpen([&]() @@ -203,7 +203,7 @@ bool openUrl(const QUrl &url) return QDesktopServices::openUrl(url); }; #if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) - if(!APPLICATION->isFlatpak()) + if(!isFlatpak()) { return IndirectOpen(f); } @@ -216,4 +216,13 @@ bool openUrl(const QUrl &url) #endif } +bool isFlatpak() +{ +#ifdef Q_OS_LINUX + return QFile::exists("/.flatpak-info"); +#else + return false; +#endif +} + } diff --git a/launcher/DesktopServices.h b/launcher/DesktopServices.h index 1c081da4..21c9cae0 100644 --- a/launcher/DesktopServices.h +++ b/launcher/DesktopServices.h @@ -33,4 +33,6 @@ namespace DesktopServices * Open the URL, most likely in a browser. Maybe. */ bool openUrl(const QUrl &url); + + bool isFlatpak(); } diff --git a/launcher/FileSystem.cpp b/launcher/FileSystem.cpp index 76cfccb0..aaa75e6f 100644 --- a/launcher/FileSystem.cpp +++ b/launcher/FileSystem.cpp @@ -44,6 +44,7 @@ #include #include #include +#include "DesktopServices.h" #if defined Q_OS_WIN32 #include @@ -228,6 +229,9 @@ bool trash(QString path, QString *pathInTrash = nullptr) #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) return false; #else + // FIXME: Figure out trash in Flatpak. Qt seemingly doesn't use the Trash portal + if (DesktopServices::isFlatpak()) + return false; return QFile::moveToTrash(path, pathInTrash); #endif } diff --git a/launcher/ui/pages/global/LauncherPage.cpp b/launcher/ui/pages/global/LauncherPage.cpp index 536ab22e..4ae7509c 100644 --- a/launcher/ui/pages/global/LauncherPage.cpp +++ b/launcher/ui/pages/global/LauncherPage.cpp @@ -49,6 +49,7 @@ #include #include "Application.h" #include "BuildConfig.h" +#include "DesktopServices.h" #include "ui/themes/ITheme.h" #include @@ -143,7 +144,7 @@ void LauncherPage::on_instDirBrowseBtn_clicked() ui->instDirTextBox->setText(cooked_dir); } } - else if(APPLICATION->isFlatpak() && raw_dir.startsWith("/run/user")) + else if(DesktopServices::isFlatpak() && raw_dir.startsWith("/run/user")) { QMessageBox warning; warning.setText(tr("You're trying to specify an instance folder " -- cgit From dfdf739282792ca646bb284b3d83b2d2265a9d55 Mon Sep 17 00:00:00 2001 From: Chrono Date: Mon, 31 Oct 2022 19:44:55 -0400 Subject: remove one space Signed-off-by: Chrono --- launcher/ui/pages/global/APIPage.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'launcher/ui/pages/global') diff --git a/launcher/ui/pages/global/APIPage.ui b/launcher/ui/pages/global/APIPage.ui index 1ae788c7..d56a9ef6 100644 --- a/launcher/ui/pages/global/APIPage.ui +++ b/launcher/ui/pages/global/APIPage.ui @@ -179,7 +179,7 @@ - Enter a custom client ID for Microsoft Authentication here. + Enter a custom client ID for Microsoft Authentication here. Qt::RichText -- cgit From 0a0ce74105b1c01bb312175a823e715d6abb310c Mon Sep 17 00:00:00 2001 From: Santiago Cézar Date: Tue, 1 Nov 2022 19:06:27 -0300 Subject: add rory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Santiago Cézar Co-authored-by: Ashtaka <66513643+AshtakaOOf@users.noreply.github.com> --- launcher/Application.cpp | 1 + launcher/resources/backgrounds/backgrounds.qrc | 9 ++++--- launcher/resources/backgrounds/catbgrnd2.png | Bin 62973 -> 0 bytes launcher/resources/backgrounds/catmas.png | Bin 72818 -> 0 bytes launcher/resources/backgrounds/cattiversary.png | Bin 99736 -> 0 bytes launcher/resources/backgrounds/generic.jpg | Bin 0 -> 335269 bytes launcher/resources/backgrounds/kitteh-bday.png | Bin 0 -> 99736 bytes launcher/resources/backgrounds/kitteh-xmas.png | Bin 0 -> 72818 bytes launcher/resources/backgrounds/kitteh.png | Bin 0 -> 62973 bytes launcher/resources/backgrounds/rory-bday.png | Bin 0 -> 89472 bytes launcher/resources/backgrounds/rory-xmas.png | Bin 0 -> 90158 bytes launcher/resources/backgrounds/rory.png | Bin 0 -> 90624 bytes launcher/ui/MainWindow.cpp | 17 ++++++------ launcher/ui/pages/global/LauncherPage.cpp | 16 ++++++++++++ launcher/ui/pages/global/LauncherPage.ui | 33 ++++++++++++++++++++++++ 15 files changed, 65 insertions(+), 11 deletions(-) delete mode 100644 launcher/resources/backgrounds/catbgrnd2.png delete mode 100644 launcher/resources/backgrounds/catmas.png delete mode 100644 launcher/resources/backgrounds/cattiversary.png create mode 100644 launcher/resources/backgrounds/generic.jpg create mode 100644 launcher/resources/backgrounds/kitteh-bday.png create mode 100644 launcher/resources/backgrounds/kitteh-xmas.png create mode 100644 launcher/resources/backgrounds/kitteh.png create mode 100644 launcher/resources/backgrounds/rory-bday.png create mode 100644 launcher/resources/backgrounds/rory-xmas.png create mode 100644 launcher/resources/backgrounds/rory.png (limited to 'launcher/ui/pages/global') diff --git a/launcher/Application.cpp b/launcher/Application.cpp index 2da8ac56..5772d7ca 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -501,6 +501,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) // Theming m_settings->registerSetting("IconTheme", QString("pe_colored")); m_settings->registerSetting("ApplicationTheme", QString("system")); + m_settings->registerSetting("BackgroundCat", QString("kitteh")); // Remembered state m_settings->registerSetting("LastUsedGroupForNewInstance", QString()); diff --git a/launcher/resources/backgrounds/backgrounds.qrc b/launcher/resources/backgrounds/backgrounds.qrc index 52921512..db48af8b 100644 --- a/launcher/resources/backgrounds/backgrounds.qrc +++ b/launcher/resources/backgrounds/backgrounds.qrc @@ -1,8 +1,11 @@ - catbgrnd2.png - catmas.png - cattiversary.png + kitteh.png + kitteh-xmas.png + kitteh-bday.png + rory.png + rory-xmas.png + rory-bday.png diff --git a/launcher/resources/backgrounds/catbgrnd2.png b/launcher/resources/backgrounds/catbgrnd2.png deleted file mode 100644 index e9de7f27..00000000 Binary files a/launcher/resources/backgrounds/catbgrnd2.png and /dev/null differ diff --git a/launcher/resources/backgrounds/catmas.png b/launcher/resources/backgrounds/catmas.png deleted file mode 100644 index 8bdb1d5c..00000000 Binary files a/launcher/resources/backgrounds/catmas.png and /dev/null differ diff --git a/launcher/resources/backgrounds/cattiversary.png b/launcher/resources/backgrounds/cattiversary.png deleted file mode 100644 index 09a36566..00000000 Binary files a/launcher/resources/backgrounds/cattiversary.png and /dev/null differ diff --git a/launcher/resources/backgrounds/generic.jpg b/launcher/resources/backgrounds/generic.jpg new file mode 100644 index 00000000..c4832b0a Binary files /dev/null and b/launcher/resources/backgrounds/generic.jpg differ diff --git a/launcher/resources/backgrounds/kitteh-bday.png b/launcher/resources/backgrounds/kitteh-bday.png new file mode 100644 index 00000000..09a36566 Binary files /dev/null and b/launcher/resources/backgrounds/kitteh-bday.png differ diff --git a/launcher/resources/backgrounds/kitteh-xmas.png b/launcher/resources/backgrounds/kitteh-xmas.png new file mode 100644 index 00000000..8bdb1d5c Binary files /dev/null and b/launcher/resources/backgrounds/kitteh-xmas.png differ diff --git a/launcher/resources/backgrounds/kitteh.png b/launcher/resources/backgrounds/kitteh.png new file mode 100644 index 00000000..e9de7f27 Binary files /dev/null and b/launcher/resources/backgrounds/kitteh.png differ diff --git a/launcher/resources/backgrounds/rory-bday.png b/launcher/resources/backgrounds/rory-bday.png new file mode 100644 index 00000000..c1f576f0 Binary files /dev/null and b/launcher/resources/backgrounds/rory-bday.png differ diff --git a/launcher/resources/backgrounds/rory-xmas.png b/launcher/resources/backgrounds/rory-xmas.png new file mode 100644 index 00000000..6134c71a Binary files /dev/null and b/launcher/resources/backgrounds/rory-xmas.png differ diff --git a/launcher/resources/backgrounds/rory.png b/launcher/resources/backgrounds/rory.png new file mode 100644 index 00000000..9dc69354 Binary files /dev/null and b/launcher/resources/backgrounds/rory.png differ diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp index eda234df..2a6e8c1f 100644 --- a/launcher/ui/MainWindow.cpp +++ b/launcher/ui/MainWindow.cpp @@ -1560,15 +1560,15 @@ void MainWindow::setCatBackground(bool enabled) QDateTime now = QDateTime::currentDateTime(); QDateTime birthday(QDate(now.date().year(), 11, 30), QTime(0, 0)); QDateTime xmas(QDate(now.date().year(), 12, 25), QTime(0, 0)); - QString cat; + QString cat = APPLICATION->settings()->get("BackgroundCat").toString(); + + qDebug() << "The choosen cat is " << cat << "."; + if(non_stupid_abs(now.daysTo(xmas)) <= 4) { - cat = "catmas"; + cat += "-xmas"; } else if (non_stupid_abs(now.daysTo(birthday)) <= 12) { - cat = "cattiversary"; - } - else { - cat = "kitteh"; + cat += "-bday"; } view->setStyleSheet(QString(R"( InstanceView @@ -1576,10 +1576,11 @@ InstanceView background-image: url(:/backgrounds/%1); background-attachment: fixed; background-clip: padding; - background-position: top right; + background-position: bottom left; background-repeat: none; background-color:palette(base); -})").arg(cat)); +})") + .arg(cat)); } else { diff --git a/launcher/ui/pages/global/LauncherPage.cpp b/launcher/ui/pages/global/LauncherPage.cpp index 4ae7509c..44421d3b 100644 --- a/launcher/ui/pages/global/LauncherPage.cpp +++ b/launcher/ui/pages/global/LauncherPage.cpp @@ -334,6 +334,15 @@ void LauncherPage::applySettings() APPLICATION->setApplicationTheme(newAppTheme, false); } + switch (ui->themeBackgroundCat->currentIndex()) { + case 0: // original cat + s->set("BackgroundCat", "kitteh"); + break; + case 1: // rory the cat + s->set("BackgroundCat", "rory"); + break; + } + s->set("MenuBarInsteadOfToolBar", ui->preferMenuBarCheckBox->isChecked()); // Console settings @@ -425,6 +434,13 @@ void LauncherPage::loadSettings() ui->themeComboBox->setCurrentIndex(9); } + auto cat = s->get("BackgroundCat").toString(); + if (cat == "kitteh") { + ui->themeBackgroundCat->setCurrentIndex(0); + } else if (cat == "rory") { + ui->themeBackgroundCat->setCurrentIndex(1); + } + { auto currentTheme = s->get("ApplicationTheme").toString(); auto themes = APPLICATION->getValidApplicationThemes(); diff --git a/launcher/ui/pages/global/LauncherPage.ui b/launcher/ui/pages/global/LauncherPage.ui index 76a25f2e..3a4e7da4 100644 --- a/launcher/ui/pages/global/LauncherPage.ui +++ b/launcher/ui/pages/global/LauncherPage.ui @@ -340,6 +340,39 @@ + + + + Cat + + + themeBackgroundCat + + + + + + + + 0 + 0 + + + + Qt::StrongFocus + + + + Background Cat (from MultiMC) + + + + + Rory ID 11 (drawn by Ashtaka) + + + + -- cgit From 668342b4708fca830a0650a6902805de3ff1380a Mon Sep 17 00:00:00 2001 From: Santiago Cézar Date: Tue, 1 Nov 2022 19:31:37 -0300 Subject: add rory flat too (and holiday variants) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Santiago Cézar Co-authored-by: Ashtaka <66513643+AshtakaOOf@users.noreply.github.com> --- launcher/resources/backgrounds/generic.jpg | Bin 335269 -> 0 bytes launcher/resources/backgrounds/rory-bday.png | Bin 89472 -> 83235 bytes launcher/resources/backgrounds/rory-flat-bday.png | Bin 0 -> 57713 bytes launcher/resources/backgrounds/rory-flat-xmas.png | Bin 0 -> 59495 bytes launcher/resources/backgrounds/rory-flat.png | Bin 0 -> 52337 bytes launcher/resources/backgrounds/rory-xmas.png | Bin 90158 -> 85543 bytes launcher/resources/backgrounds/rory.png | Bin 90624 -> 76448 bytes launcher/ui/pages/global/LauncherPage.cpp | 5 +++++ launcher/ui/pages/global/LauncherPage.ui | 5 +++++ 9 files changed, 10 insertions(+) delete mode 100644 launcher/resources/backgrounds/generic.jpg create mode 100644 launcher/resources/backgrounds/rory-flat-bday.png create mode 100644 launcher/resources/backgrounds/rory-flat-xmas.png create mode 100644 launcher/resources/backgrounds/rory-flat.png (limited to 'launcher/ui/pages/global') diff --git a/launcher/resources/backgrounds/generic.jpg b/launcher/resources/backgrounds/generic.jpg deleted file mode 100644 index c4832b0a..00000000 Binary files a/launcher/resources/backgrounds/generic.jpg and /dev/null differ diff --git a/launcher/resources/backgrounds/rory-bday.png b/launcher/resources/backgrounds/rory-bday.png index c1f576f0..66b88094 100644 Binary files a/launcher/resources/backgrounds/rory-bday.png and b/launcher/resources/backgrounds/rory-bday.png differ diff --git a/launcher/resources/backgrounds/rory-flat-bday.png b/launcher/resources/backgrounds/rory-flat-bday.png new file mode 100644 index 00000000..8a6e366d Binary files /dev/null and b/launcher/resources/backgrounds/rory-flat-bday.png differ diff --git a/launcher/resources/backgrounds/rory-flat-xmas.png b/launcher/resources/backgrounds/rory-flat-xmas.png new file mode 100644 index 00000000..96c3ae38 Binary files /dev/null and b/launcher/resources/backgrounds/rory-flat-xmas.png differ diff --git a/launcher/resources/backgrounds/rory-flat.png b/launcher/resources/backgrounds/rory-flat.png new file mode 100644 index 00000000..ccec0662 Binary files /dev/null and b/launcher/resources/backgrounds/rory-flat.png differ diff --git a/launcher/resources/backgrounds/rory-xmas.png b/launcher/resources/backgrounds/rory-xmas.png index 6134c71a..107feb78 100644 Binary files a/launcher/resources/backgrounds/rory-xmas.png and b/launcher/resources/backgrounds/rory-xmas.png differ diff --git a/launcher/resources/backgrounds/rory.png b/launcher/resources/backgrounds/rory.png index 9dc69354..577f4dce 100644 Binary files a/launcher/resources/backgrounds/rory.png and b/launcher/resources/backgrounds/rory.png differ diff --git a/launcher/ui/pages/global/LauncherPage.cpp b/launcher/ui/pages/global/LauncherPage.cpp index 44421d3b..822c69b0 100644 --- a/launcher/ui/pages/global/LauncherPage.cpp +++ b/launcher/ui/pages/global/LauncherPage.cpp @@ -341,6 +341,9 @@ void LauncherPage::applySettings() case 1: // rory the cat s->set("BackgroundCat", "rory"); break; + case 2: // rory the cat flat edition + s->set("BackgroundCat", "rory-flat"); + break; } s->set("MenuBarInsteadOfToolBar", ui->preferMenuBarCheckBox->isChecked()); @@ -439,6 +442,8 @@ void LauncherPage::loadSettings() ui->themeBackgroundCat->setCurrentIndex(0); } else if (cat == "rory") { ui->themeBackgroundCat->setCurrentIndex(1); + } else if (cat == "rory-flat") { + ui->themeBackgroundCat->setCurrentIndex(2); } { diff --git a/launcher/ui/pages/global/LauncherPage.ui b/launcher/ui/pages/global/LauncherPage.ui index 3a4e7da4..0b36652c 100644 --- a/launcher/ui/pages/global/LauncherPage.ui +++ b/launcher/ui/pages/global/LauncherPage.ui @@ -371,6 +371,11 @@ Rory ID 11 (drawn by Ashtaka) + + + Rory ID 11 (flat edition, drawn by Ashtaka) + + -- cgit From 48d34741f3255976cc2e208ef4bf858ae0beb782 Mon Sep 17 00:00:00 2001 From: Santiago Cézar Date: Tue, 1 Nov 2022 22:53:45 -0300 Subject: keyboard navigation is important MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Santiago Cézar --- launcher/ui/pages/global/LauncherPage.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'launcher/ui/pages/global') diff --git a/launcher/ui/pages/global/LauncherPage.ui b/launcher/ui/pages/global/LauncherPage.ui index 0b36652c..6de644ee 100644 --- a/launcher/ui/pages/global/LauncherPage.ui +++ b/launcher/ui/pages/global/LauncherPage.ui @@ -343,7 +343,7 @@ - Cat + C&at themeBackgroundCat -- cgit