From 20b9f2b42a3b58b6081af271774fbcc34025dccb Mon Sep 17 00:00:00 2001 From: Petr Mrázek Date: Sun, 25 Jul 2021 19:11:59 +0200 Subject: NOISSUE Flatten gui and logic libraries into MultiMC --- application/CMakeLists.txt | 417 ----- application/ColorCache.cpp | 35 - application/ColorCache.h | 119 -- application/ColumnResizer.cpp | 199 -- application/ColumnResizer.h | 41 - application/GuiUtil.cpp | 131 -- application/GuiUtil.h | 11 - application/HoeDown.h | 76 - application/InstancePageProvider.h | 76 - application/InstanceProxyModel.cpp | 34 - application/InstanceProxyModel.h | 16 - application/InstanceWindow.cpp | 236 --- application/InstanceWindow.h | 73 - application/JavaCommon.cpp | 104 -- application/JavaCommon.h | 48 - application/KonamiCode.cpp | 44 - application/KonamiCode.h | 17 - application/LaunchController.cpp | 353 ---- application/LaunchController.h | 68 - application/MainWindow.cpp | 1952 -------------------- application/MainWindow.h | 226 --- application/MultiMC.cpp | 1448 --------------- application/MultiMC.h | 235 --- application/UpdateController.cpp | 449 ----- application/UpdateController.h | 44 - application/VersionProxyModel.cpp | 447 ----- application/VersionProxyModel.h | 67 - application/dialogs/AboutDialog.cpp | 138 -- application/dialogs/AboutDialog.h | 47 - application/dialogs/AboutDialog.ui | 312 ---- application/dialogs/CopyInstanceDialog.cpp | 144 -- application/dialogs/CopyInstanceDialog.h | 58 - application/dialogs/CopyInstanceDialog.ui | 182 -- application/dialogs/CustomMessageBox.cpp | 35 - application/dialogs/CustomMessageBox.h | 26 - application/dialogs/EditAccountDialog.cpp | 61 - application/dialogs/EditAccountDialog.h | 56 - application/dialogs/EditAccountDialog.ui | 94 - application/dialogs/ExportInstanceDialog.cpp | 482 ----- application/dialogs/ExportInstanceDialog.h | 54 - application/dialogs/ExportInstanceDialog.ui | 83 - application/dialogs/IconPickerDialog.cpp | 163 -- application/dialogs/IconPickerDialog.h | 49 - application/dialogs/IconPickerDialog.ui | 67 - application/dialogs/LoginDialog.cpp | 110 -- application/dialogs/LoginDialog.h | 58 - application/dialogs/LoginDialog.ui | 87 - application/dialogs/NewComponentDialog.cpp | 106 -- application/dialogs/NewComponentDialog.h | 48 - application/dialogs/NewComponentDialog.ui | 101 - application/dialogs/NewInstanceDialog.cpp | 255 --- application/dialogs/NewInstanceDialog.h | 80 - application/dialogs/NewInstanceDialog.ui | 87 - application/dialogs/NotificationDialog.cpp | 86 - application/dialogs/NotificationDialog.h | 44 - application/dialogs/NotificationDialog.ui | 85 - application/dialogs/ProfileSelectDialog.cpp | 116 -- application/dialogs/ProfileSelectDialog.h | 90 - application/dialogs/ProfileSelectDialog.ui | 62 - application/dialogs/ProgressDialog.cpp | 196 -- application/dialogs/ProgressDialog.h | 71 - application/dialogs/ProgressDialog.ui | 66 - application/dialogs/SkinUploadDialog.cpp | 114 -- application/dialogs/SkinUploadDialog.h | 29 - application/dialogs/SkinUploadDialog.ui | 85 - application/dialogs/UpdateDialog.cpp | 182 -- application/dialogs/UpdateDialog.h | 67 - application/dialogs/UpdateDialog.ui | 91 - application/dialogs/VersionSelectDialog.cpp | 141 -- application/dialogs/VersionSelectDialog.h | 78 - application/groupview/AccessibleGroupView.cpp | 778 -------- application/groupview/AccessibleGroupView.h | 6 - application/groupview/AccessibleGroupView_p.h | 118 -- application/groupview/GroupView.cpp | 1020 ---------- application/groupview/GroupView.h | 157 -- application/groupview/GroupedProxyModel.cpp | 48 - application/groupview/GroupedProxyModel.h | 30 - application/groupview/InstanceDelegate.cpp | 428 ----- application/groupview/InstanceDelegate.h | 39 - application/groupview/VisualGroup.cpp | 317 ---- application/groupview/VisualGroup.h | 106 -- application/install_prereqs.cmake.in | 27 - application/main.cpp | 61 - application/package/linux/MultiMC | 93 - application/package/linux/multimc.desktop | 11 - application/package/rpm/MultiMC5.spec | 47 - application/package/rpm/README.md | 12 - application/package/ubuntu/README.md | 14 - application/package/ubuntu/multimc/DEBIAN/control | 12 - application/package/ubuntu/multimc/DEBIAN/postrm | 3 - .../package/ubuntu/multimc/opt/multimc/icon.svg | 353 ---- .../package/ubuntu/multimc/opt/multimc/run.sh | 33 - .../multimc/usr/share/applications/multimc.desktop | 16 - .../usr/share/metainfo/multimc.metainfo.xml | 54 - application/pagedialog/PageDialog.cpp | 61 - application/pagedialog/PageDialog.h | 35 - application/pages/BasePage.h | 58 - application/pages/BasePageContainer.h | 10 - application/pages/BasePageProvider.h | 68 - application/pages/global/AccountListPage.cpp | 217 --- application/pages/global/AccountListPage.h | 84 - application/pages/global/AccountListPage.ui | 98 - application/pages/global/CustomCommandsPage.cpp | 51 - application/pages/global/CustomCommandsPage.h | 55 - application/pages/global/ExternalToolsPage.cpp | 233 --- application/pages/global/ExternalToolsPage.h | 74 - application/pages/global/ExternalToolsPage.ui | 194 -- application/pages/global/JavaPage.cpp | 153 -- application/pages/global/JavaPage.h | 72 - application/pages/global/JavaPage.ui | 260 --- application/pages/global/LanguagePage.cpp | 51 - application/pages/global/LanguagePage.h | 60 - application/pages/global/MinecraftPage.cpp | 90 - application/pages/global/MinecraftPage.h | 70 - application/pages/global/MinecraftPage.ui | 189 -- application/pages/global/MultiMCPage.cpp | 467 ----- application/pages/global/MultiMCPage.h | 103 -- application/pages/global/MultiMCPage.ui | 584 ------ application/pages/global/PasteEEPage.cpp | 81 - application/pages/global/PasteEEPage.h | 62 - application/pages/global/PasteEEPage.ui | 128 -- application/pages/global/ProxyPage.cpp | 101 - application/pages/global/ProxyPage.h | 66 - application/pages/global/ProxyPage.ui | 203 -- application/pages/instance/GameOptionsPage.cpp | 37 - application/pages/instance/GameOptionsPage.h | 63 - application/pages/instance/GameOptionsPage.ui | 88 - .../pages/instance/InstanceSettingsPage.cpp | 338 ---- application/pages/instance/InstanceSettingsPage.h | 76 - application/pages/instance/InstanceSettingsPage.ui | 548 ------ application/pages/instance/LegacyUpgradePage.cpp | 50 - application/pages/instance/LegacyUpgradePage.h | 64 - application/pages/instance/LegacyUpgradePage.ui | 47 - application/pages/instance/LogPage.cpp | 312 ---- application/pages/instance/LogPage.h | 86 - application/pages/instance/LogPage.ui | 182 -- application/pages/instance/ModFolderPage.cpp | 363 ---- application/pages/instance/ModFolderPage.h | 119 -- application/pages/instance/ModFolderPage.ui | 164 -- application/pages/instance/NotesPage.cpp | 21 - application/pages/instance/NotesPage.h | 60 - application/pages/instance/NotesPage.ui | 49 - application/pages/instance/OtherLogsPage.cpp | 313 ---- application/pages/instance/OtherLogsPage.h | 81 - application/pages/instance/OtherLogsPage.ui | 150 -- application/pages/instance/ResourcePackPage.h | 23 - application/pages/instance/ScreenshotsPage.cpp | 422 ----- application/pages/instance/ScreenshotsPage.h | 89 - application/pages/instance/ScreenshotsPage.ui | 87 - application/pages/instance/ServersPage.cpp | 768 -------- application/pages/instance/ServersPage.h | 94 - application/pages/instance/ServersPage.ui | 194 -- application/pages/instance/TexturePackPage.h | 22 - application/pages/instance/VersionPage.cpp | 642 ------- application/pages/instance/VersionPage.h | 104 -- application/pages/instance/VersionPage.ui | 285 --- application/pages/instance/WorldListPage.cpp | 408 ---- application/pages/instance/WorldListPage.h | 99 - application/pages/instance/WorldListPage.ui | 161 -- application/pages/modplatform/ImportPage.cpp | 130 -- application/pages/modplatform/ImportPage.h | 70 - application/pages/modplatform/ImportPage.ui | 52 - application/pages/modplatform/VanillaPage.cpp | 104 -- application/pages/modplatform/VanillaPage.h | 75 - application/pages/modplatform/VanillaPage.ui | 169 -- .../modplatform/atlauncher/AtlFilterModel.cpp | 81 - .../pages/modplatform/atlauncher/AtlFilterModel.h | 34 - .../pages/modplatform/atlauncher/AtlListModel.cpp | 194 -- .../pages/modplatform/atlauncher/AtlListModel.h | 52 - .../atlauncher/AtlOptionalModDialog.cpp | 209 --- .../modplatform/atlauncher/AtlOptionalModDialog.h | 66 - .../modplatform/atlauncher/AtlOptionalModDialog.ui | 65 - .../pages/modplatform/atlauncher/AtlPage.cpp | 175 -- application/pages/modplatform/atlauncher/AtlPage.h | 87 - .../pages/modplatform/atlauncher/AtlPage.ui | 97 - application/pages/modplatform/flame/FlameModel.cpp | 259 --- application/pages/modplatform/flame/FlameModel.h | 76 - application/pages/modplatform/flame/FlamePage.cpp | 185 -- application/pages/modplatform/flame/FlamePage.h | 80 - application/pages/modplatform/flame/FlamePage.ui | 90 - .../pages/modplatform/ftb/FtbFilterModel.cpp | 64 - application/pages/modplatform/ftb/FtbFilterModel.h | 33 - application/pages/modplatform/ftb/FtbListModel.cpp | 304 --- application/pages/modplatform/ftb/FtbListModel.h | 69 - application/pages/modplatform/ftb/FtbPage.cpp | 145 -- application/pages/modplatform/ftb/FtbPage.h | 80 - application/pages/modplatform/ftb/FtbPage.ui | 84 - .../pages/modplatform/legacy_ftb/ListModel.cpp | 260 --- .../pages/modplatform/legacy_ftb/ListModel.h | 78 - application/pages/modplatform/legacy_ftb/Page.cpp | 369 ---- application/pages/modplatform/legacy_ftb/Page.h | 119 -- application/pages/modplatform/legacy_ftb/Page.ui | 135 -- .../pages/modplatform/technic/TechnicData.h | 42 - .../pages/modplatform/technic/TechnicModel.cpp | 238 --- .../pages/modplatform/technic/TechnicModel.h | 70 - .../pages/modplatform/technic/TechnicPage.cpp | 198 -- .../pages/modplatform/technic/TechnicPage.h | 78 - .../pages/modplatform/technic/TechnicPage.ui | 95 - application/resources/MultiMC.icns | Bin 782703 -> 0 bytes application/resources/MultiMC.ico | Bin 55224 -> 0 bytes application/resources/MultiMC.manifest | 31 - application/resources/OSX/OSX.qrc | 38 - application/resources/OSX/index.theme | 11 - application/resources/OSX/scalable/about.svg | 20 - application/resources/OSX/scalable/accounts.svg | 16 - application/resources/OSX/scalable/bug.svg | 25 - application/resources/OSX/scalable/centralmods.svg | 16 - application/resources/OSX/scalable/checkupdate.svg | 22 - application/resources/OSX/scalable/copy.svg | 18 - application/resources/OSX/scalable/coremods.svg | 21 - .../resources/OSX/scalable/externaltools.svg | 14 - application/resources/OSX/scalable/help.svg | 51 - .../resources/OSX/scalable/instance-settings.svg | 25 - application/resources/OSX/scalable/jarmods.svg | 30 - application/resources/OSX/scalable/java.svg | 33 - application/resources/OSX/scalable/language.svg | 40 - application/resources/OSX/scalable/loadermods.svg | 14 - application/resources/OSX/scalable/log.svg | 19 - application/resources/OSX/scalable/minecraft.svg | 12 - application/resources/OSX/scalable/multimc.svg | 18 - application/resources/OSX/scalable/new.svg | 19 - application/resources/OSX/scalable/news.svg | 16 - application/resources/OSX/scalable/notes.svg | 21 - application/resources/OSX/scalable/patreon.svg | 15 - application/resources/OSX/scalable/proxy.svg | 16 - application/resources/OSX/scalable/quickmods.svg | 18 - application/resources/OSX/scalable/refresh.svg | 16 - .../resources/OSX/scalable/resourcepacks.svg | 17 - application/resources/OSX/scalable/screenshots.svg | 19 - application/resources/OSX/scalable/settings.svg | 25 - application/resources/OSX/scalable/status-bad.svg | 11 - application/resources/OSX/scalable/status-good.svg | 19 - .../resources/OSX/scalable/status-yellow.svg | 16 - application/resources/OSX/scalable/viewfolder.svg | 16 - application/resources/OSX/scalable/worlds.svg | 58 - application/resources/assets/underconstruction.png | Bin 14490 -> 0 bytes application/resources/backgrounds/backgrounds.qrc | 7 - application/resources/backgrounds/catbgrnd2.png | Bin 62973 -> 0 bytes application/resources/backgrounds/catmas.png | Bin 72818 -> 0 bytes application/resources/documents/documents.qrc | 7 - application/resources/flat/flat.qrc | 45 - application/resources/flat/index.theme | 11 - application/resources/flat/scalable/about.svg | 3 - application/resources/flat/scalable/accounts.svg | 3 - application/resources/flat/scalable/bug.svg | 3 - application/resources/flat/scalable/cat.svg | 3 - .../resources/flat/scalable/centralmods.svg | 3 - .../resources/flat/scalable/checkupdate.svg | 3 - application/resources/flat/scalable/copy.svg | 3 - application/resources/flat/scalable/coremods.svg | 3 - application/resources/flat/scalable/discord.svg | 4 - .../resources/flat/scalable/externaltools.svg | 3 - application/resources/flat/scalable/help.svg | 17 - .../resources/flat/scalable/instance-settings.svg | 3 - application/resources/flat/scalable/jarmods.svg | 3 - application/resources/flat/scalable/java.svg | 3 - application/resources/flat/scalable/language.svg | 103 -- application/resources/flat/scalable/loadermods.svg | 3 - application/resources/flat/scalable/log.svg | 3 - application/resources/flat/scalable/minecraft.svg | 3 - application/resources/flat/scalable/multimc.svg | 3 - application/resources/flat/scalable/new.svg | 3 - application/resources/flat/scalable/news.svg | 3 - application/resources/flat/scalable/notes.svg | 3 - application/resources/flat/scalable/packages.svg | 3 - application/resources/flat/scalable/patreon.svg | 3 - application/resources/flat/scalable/proxy.svg | 3 - application/resources/flat/scalable/quickmods.svg | 3 - .../resources/flat/scalable/reddit-alien.svg | 3 - application/resources/flat/scalable/refresh.svg | 3 - .../resources/flat/scalable/resourcepacks.svg | 3 - .../flat/scalable/screenshot-placeholder.svg | 3 - .../resources/flat/scalable/screenshots.svg | 3 - application/resources/flat/scalable/settings.svg | 3 - application/resources/flat/scalable/star.svg | 3 - application/resources/flat/scalable/status-bad.svg | 3 - .../resources/flat/scalable/status-good.svg | 3 - .../resources/flat/scalable/status-running.svg | 3 - .../resources/flat/scalable/status-yellow.svg | 3 - application/resources/flat/scalable/viewfolder.svg | 3 - application/resources/flat/scalable/worlds.svg | 3 - application/resources/iOS/iOS.qrc | 38 - application/resources/iOS/index.theme | 11 - application/resources/iOS/scalable/about.svg | 16 - application/resources/iOS/scalable/accounts.svg | 14 - application/resources/iOS/scalable/bug.svg | 22 - application/resources/iOS/scalable/centralmods.svg | 13 - application/resources/iOS/scalable/checkupdate.svg | 16 - application/resources/iOS/scalable/copy.svg | 13 - application/resources/iOS/scalable/coremods.svg | 18 - .../resources/iOS/scalable/externaltools.svg | 13 - application/resources/iOS/scalable/help.svg | 38 - .../resources/iOS/scalable/instance-settings.svg | 19 - application/resources/iOS/scalable/jarmods.svg | 31 - application/resources/iOS/scalable/java.svg | 33 - application/resources/iOS/scalable/language.svg | 32 - application/resources/iOS/scalable/loadermods.svg | 14 - application/resources/iOS/scalable/log.svg | 13 - application/resources/iOS/scalable/minecraft.svg | 8 - application/resources/iOS/scalable/multimc.svg | 13 - application/resources/iOS/scalable/new.svg | 13 - application/resources/iOS/scalable/news.svg | 14 - application/resources/iOS/scalable/notes.svg | 15 - application/resources/iOS/scalable/patreon.svg | 12 - application/resources/iOS/scalable/proxy.svg | 11 - application/resources/iOS/scalable/quickmods.svg | 14 - application/resources/iOS/scalable/refresh.svg | 13 - .../resources/iOS/scalable/resourcepacks.svg | 15 - application/resources/iOS/scalable/screenshots.svg | 14 - application/resources/iOS/scalable/settings.svg | 19 - application/resources/iOS/scalable/status-bad.svg | 10 - application/resources/iOS/scalable/status-good.svg | 18 - .../resources/iOS/scalable/status-yellow.svg | 56 - application/resources/iOS/scalable/viewfolder.svg | 12 - application/resources/iOS/scalable/worlds.svg | 44 - application/resources/multimc.rc | 29 - .../multimc/128x128/instances/chicken.png | Bin 6369 -> 0 bytes .../multimc/128x128/instances/creeper.png | Bin 9046 -> 0 bytes .../multimc/128x128/instances/enderpearl.png | Bin 21425 -> 0 bytes .../resources/multimc/128x128/instances/flame.png | Bin 3375 -> 0 bytes .../multimc/128x128/instances/ftb_glow.png | Bin 12708 -> 0 bytes .../multimc/128x128/instances/ftb_logo.png | Bin 7883 -> 0 bytes .../resources/multimc/128x128/instances/gear.png | Bin 18321 -> 0 bytes .../multimc/128x128/instances/herobrine.png | Bin 4937 -> 0 bytes .../multimc/128x128/instances/infinity.png | Bin 15151 -> 0 bytes .../multimc/128x128/instances/magitech.png | Bin 23097 -> 0 bytes .../resources/multimc/128x128/instances/meat.png | Bin 10583 -> 0 bytes .../multimc/128x128/instances/netherstar.png | Bin 14062 -> 0 bytes .../multimc/128x128/instances/skeleton.png | Bin 3673 -> 0 bytes .../multimc/128x128/instances/squarecreeper.png | Bin 9136 -> 0 bytes .../resources/multimc/128x128/instances/steve.png | Bin 4312 -> 0 bytes .../resources/multimc/128x128/unknown_server.png | Bin 11085 -> 0 bytes application/resources/multimc/16x16/about.png | Bin 1270 -> 0 bytes application/resources/multimc/16x16/bug.png | Bin 734 -> 0 bytes application/resources/multimc/16x16/cat.png | Bin 736 -> 0 bytes .../resources/multimc/16x16/centralmods.png | Bin 1145 -> 0 bytes .../resources/multimc/16x16/checkupdate.png | Bin 1212 -> 0 bytes application/resources/multimc/16x16/copy.png | Bin 957 -> 0 bytes application/resources/multimc/16x16/coremods.png | Bin 702 -> 0 bytes application/resources/multimc/16x16/help.png | Bin 1297 -> 0 bytes .../resources/multimc/16x16/instance-settings.png | Bin 1410 -> 0 bytes application/resources/multimc/16x16/jarmods.png | Bin 693 -> 0 bytes application/resources/multimc/16x16/loadermods.png | Bin 731 -> 0 bytes application/resources/multimc/16x16/log.png | Bin 630 -> 0 bytes application/resources/multimc/16x16/minecraft.png | Bin 782 -> 0 bytes application/resources/multimc/16x16/new.png | Bin 1175 -> 0 bytes application/resources/multimc/16x16/news.png | Bin 727 -> 0 bytes application/resources/multimc/16x16/noaccount.png | Bin 334 -> 0 bytes application/resources/multimc/16x16/patreon.png | Bin 840 -> 0 bytes application/resources/multimc/16x16/refresh.png | Bin 931 -> 0 bytes .../resources/multimc/16x16/resourcepacks.png | Bin 1207 -> 0 bytes .../resources/multimc/16x16/screenshots.png | Bin 976 -> 0 bytes application/resources/multimc/16x16/settings.png | Bin 1410 -> 0 bytes application/resources/multimc/16x16/star.png | Bin 729 -> 0 bytes application/resources/multimc/16x16/status-bad.png | Bin 643 -> 0 bytes .../resources/multimc/16x16/status-good.png | Bin 714 -> 0 bytes .../resources/multimc/16x16/status-running.png | Bin 675 -> 0 bytes .../resources/multimc/16x16/status-yellow.png | Bin 590 -> 0 bytes application/resources/multimc/16x16/viewfolder.png | Bin 852 -> 0 bytes application/resources/multimc/16x16/worlds.png | Bin 870 -> 0 bytes application/resources/multimc/22x22/about.png | Bin 1693 -> 0 bytes application/resources/multimc/22x22/bug.png | Bin 1180 -> 0 bytes application/resources/multimc/22x22/cat.png | Bin 1034 -> 0 bytes .../resources/multimc/22x22/centralmods.png | Bin 1561 -> 0 bytes .../resources/multimc/22x22/checkupdate.png | Bin 1635 -> 0 bytes application/resources/multimc/22x22/copy.png | Bin 1004 -> 0 bytes application/resources/multimc/22x22/help.png | Bin 1735 -> 0 bytes .../resources/multimc/22x22/instance-settings.png | Bin 1964 -> 0 bytes application/resources/multimc/22x22/new.png | Bin 1440 -> 0 bytes application/resources/multimc/22x22/news.png | Bin 1173 -> 0 bytes application/resources/multimc/22x22/patreon.png | Bin 939 -> 0 bytes application/resources/multimc/22x22/refresh.png | Bin 1283 -> 0 bytes .../resources/multimc/22x22/screenshots.png | Bin 1320 -> 0 bytes application/resources/multimc/22x22/settings.png | Bin 1964 -> 0 bytes application/resources/multimc/22x22/status-bad.png | Bin 968 -> 0 bytes .../resources/multimc/22x22/status-good.png | Bin 994 -> 0 bytes .../resources/multimc/22x22/status-running.png | Bin 957 -> 0 bytes .../resources/multimc/22x22/status-yellow.png | Bin 803 -> 0 bytes application/resources/multimc/22x22/viewfolder.png | Bin 1006 -> 0 bytes application/resources/multimc/22x22/worlds.png | Bin 1397 -> 0 bytes application/resources/multimc/24x24/cat.png | Bin 1252 -> 0 bytes application/resources/multimc/24x24/coremods.png | Bin 1281 -> 0 bytes application/resources/multimc/24x24/jarmods.png | Bin 1170 -> 0 bytes application/resources/multimc/24x24/loadermods.png | Bin 1240 -> 0 bytes application/resources/multimc/24x24/log.png | Bin 1117 -> 0 bytes application/resources/multimc/24x24/minecraft.png | Bin 1500 -> 0 bytes application/resources/multimc/24x24/noaccount.png | Bin 344 -> 0 bytes application/resources/multimc/24x24/patreon.png | Bin 977 -> 0 bytes .../resources/multimc/24x24/resourcepacks.png | Bin 2000 -> 0 bytes application/resources/multimc/24x24/star.png | Bin 1217 -> 0 bytes application/resources/multimc/24x24/status-bad.png | Bin 1102 -> 0 bytes .../resources/multimc/24x24/status-good.png | Bin 1066 -> 0 bytes .../resources/multimc/24x24/status-running.png | Bin 1059 -> 0 bytes .../resources/multimc/24x24/status-yellow.png | Bin 872 -> 0 bytes .../resources/multimc/256x256/minecraft.png | Bin 49869 -> 0 bytes application/resources/multimc/32x32/about.png | Bin 2658 -> 0 bytes application/resources/multimc/32x32/bug.png | Bin 1772 -> 0 bytes application/resources/multimc/32x32/cat.png | Bin 1678 -> 0 bytes .../resources/multimc/32x32/centralmods.png | Bin 2119 -> 0 bytes .../resources/multimc/32x32/checkupdate.png | Bin 2480 -> 0 bytes application/resources/multimc/32x32/copy.png | Bin 1401 -> 0 bytes application/resources/multimc/32x32/coremods.png | Bin 1758 -> 0 bytes application/resources/multimc/32x32/help.png | Bin 2720 -> 0 bytes .../resources/multimc/32x32/instance-settings.png | Bin 2983 -> 0 bytes .../resources/multimc/32x32/instances/brick.png | Bin 2388 -> 0 bytes .../resources/multimc/32x32/instances/chicken.png | Bin 1181 -> 0 bytes .../resources/multimc/32x32/instances/creeper.png | Bin 1524 -> 0 bytes .../resources/multimc/32x32/instances/diamond.png | Bin 2444 -> 0 bytes .../resources/multimc/32x32/instances/dirt.png | Bin 482 -> 0 bytes .../multimc/32x32/instances/enderpearl.png | Bin 2120 -> 0 bytes .../resources/multimc/32x32/instances/flame.png | Bin 849 -> 0 bytes .../resources/multimc/32x32/instances/ftb_glow.png | Bin 1747 -> 0 bytes .../resources/multimc/32x32/instances/ftb_logo.png | Bin 1607 -> 0 bytes .../resources/multimc/32x32/instances/gear.png | Bin 2414 -> 0 bytes .../resources/multimc/32x32/instances/gold.png | Bin 2366 -> 0 bytes .../resources/multimc/32x32/instances/grass.png | Bin 618 -> 0 bytes .../multimc/32x32/instances/herobrine.png | Bin 1034 -> 0 bytes .../resources/multimc/32x32/instances/infinity.png | Bin 1714 -> 0 bytes .../resources/multimc/32x32/instances/iron.png | Bin 1772 -> 0 bytes .../resources/multimc/32x32/instances/magitech.png | Bin 2646 -> 0 bytes .../resources/multimc/32x32/instances/meat.png | Bin 1514 -> 0 bytes .../multimc/32x32/instances/netherstar.png | Bin 1942 -> 0 bytes .../resources/multimc/32x32/instances/planks.png | Bin 2299 -> 0 bytes .../resources/multimc/32x32/instances/skeleton.png | Bin 696 -> 0 bytes .../multimc/32x32/instances/squarecreeper.png | Bin 1623 -> 0 bytes .../resources/multimc/32x32/instances/steve.png | Bin 969 -> 0 bytes .../resources/multimc/32x32/instances/stone.png | Bin 1866 -> 0 bytes .../resources/multimc/32x32/instances/tnt.png | Bin 378 -> 0 bytes application/resources/multimc/32x32/jarmods.png | Bin 1566 -> 0 bytes application/resources/multimc/32x32/loadermods.png | Bin 1708 -> 0 bytes application/resources/multimc/32x32/log.png | Bin 1460 -> 0 bytes application/resources/multimc/32x32/minecraft.png | Bin 2495 -> 0 bytes application/resources/multimc/32x32/new.png | Bin 1769 -> 0 bytes application/resources/multimc/32x32/news.png | Bin 1752 -> 0 bytes application/resources/multimc/32x32/noaccount.png | Bin 363 -> 0 bytes application/resources/multimc/32x32/patreon.png | Bin 1086 -> 0 bytes application/resources/multimc/32x32/refresh.png | Bin 2182 -> 0 bytes .../resources/multimc/32x32/resourcepacks.png | Bin 2818 -> 0 bytes .../resources/multimc/32x32/screenshots.png | Bin 1892 -> 0 bytes application/resources/multimc/32x32/settings.png | Bin 2983 -> 0 bytes application/resources/multimc/32x32/star.png | Bin 1698 -> 0 bytes application/resources/multimc/32x32/status-bad.png | Bin 1422 -> 0 bytes .../resources/multimc/32x32/status-good.png | Bin 1400 -> 0 bytes .../resources/multimc/32x32/status-running.png | Bin 1425 -> 0 bytes .../resources/multimc/32x32/status-yellow.png | Bin 1158 -> 0 bytes application/resources/multimc/32x32/viewfolder.png | Bin 1518 -> 0 bytes application/resources/multimc/32x32/worlds.png | Bin 2336 -> 0 bytes application/resources/multimc/48x48/about.png | Bin 3995 -> 0 bytes application/resources/multimc/48x48/bug.png | Bin 3124 -> 0 bytes application/resources/multimc/48x48/cat.png | Bin 2733 -> 0 bytes .../resources/multimc/48x48/centralmods.png | Bin 3201 -> 0 bytes .../resources/multimc/48x48/checkupdate.png | Bin 4196 -> 0 bytes application/resources/multimc/48x48/copy.png | Bin 1952 -> 0 bytes application/resources/multimc/48x48/help.png | Bin 4170 -> 0 bytes .../resources/multimc/48x48/instance-settings.png | Bin 4797 -> 0 bytes application/resources/multimc/48x48/log.png | Bin 2825 -> 0 bytes application/resources/multimc/48x48/minecraft.png | Bin 5077 -> 0 bytes application/resources/multimc/48x48/new.png | Bin 2870 -> 0 bytes application/resources/multimc/48x48/news.png | Bin 3333 -> 0 bytes application/resources/multimc/48x48/noaccount.png | Bin 387 -> 0 bytes application/resources/multimc/48x48/patreon.png | Bin 1390 -> 0 bytes application/resources/multimc/48x48/refresh.png | Bin 3743 -> 0 bytes .../resources/multimc/48x48/screenshots.png | Bin 3010 -> 0 bytes application/resources/multimc/48x48/settings.png | Bin 4797 -> 0 bytes application/resources/multimc/48x48/star.png | Bin 3227 -> 0 bytes application/resources/multimc/48x48/status-bad.png | Bin 2389 -> 0 bytes .../resources/multimc/48x48/status-good.png | Bin 2248 -> 0 bytes .../resources/multimc/48x48/status-running.png | Bin 2288 -> 0 bytes .../resources/multimc/48x48/status-yellow.png | Bin 1773 -> 0 bytes application/resources/multimc/48x48/viewfolder.png | Bin 1945 -> 0 bytes application/resources/multimc/48x48/worlds.png | Bin 4043 -> 0 bytes .../resources/multimc/50x50/instances/enderman.png | Bin 2429 -> 0 bytes application/resources/multimc/64x64/about.png | Bin 5513 -> 0 bytes application/resources/multimc/64x64/bug.png | Bin 4263 -> 0 bytes application/resources/multimc/64x64/cat.png | Bin 4033 -> 0 bytes .../resources/multimc/64x64/centralmods.png | Bin 4408 -> 0 bytes .../resources/multimc/64x64/checkupdate.png | Bin 5858 -> 0 bytes application/resources/multimc/64x64/copy.png | Bin 2884 -> 0 bytes application/resources/multimc/64x64/coremods.png | Bin 5036 -> 0 bytes application/resources/multimc/64x64/help.png | Bin 5402 -> 0 bytes .../resources/multimc/64x64/instance-settings.png | Bin 7125 -> 0 bytes application/resources/multimc/64x64/jarmods.png | Bin 4003 -> 0 bytes application/resources/multimc/64x64/loadermods.png | Bin 4406 -> 0 bytes application/resources/multimc/64x64/log.png | Bin 3686 -> 0 bytes application/resources/multimc/64x64/new.png | Bin 3949 -> 0 bytes application/resources/multimc/64x64/news.png | Bin 4968 -> 0 bytes application/resources/multimc/64x64/patreon.png | Bin 1667 -> 0 bytes application/resources/multimc/64x64/refresh.png | Bin 5745 -> 0 bytes .../resources/multimc/64x64/resourcepacks.png | Bin 6805 -> 0 bytes .../resources/multimc/64x64/screenshots.png | Bin 4518 -> 0 bytes application/resources/multimc/64x64/settings.png | Bin 7125 -> 0 bytes application/resources/multimc/64x64/star.png | Bin 4554 -> 0 bytes application/resources/multimc/64x64/status-bad.png | Bin 2827 -> 0 bytes .../resources/multimc/64x64/status-good.png | Bin 2954 -> 0 bytes .../resources/multimc/64x64/status-running.png | Bin 3178 -> 0 bytes .../resources/multimc/64x64/status-yellow.png | Bin 2358 -> 0 bytes application/resources/multimc/64x64/viewfolder.png | Bin 2134 -> 0 bytes application/resources/multimc/64x64/worlds.png | Bin 7303 -> 0 bytes application/resources/multimc/8x8/noaccount.png | Bin 284 -> 0 bytes application/resources/multimc/index.theme | 58 - application/resources/multimc/multimc.qrc | 320 ---- .../multimc/scalable/atlauncher-placeholder.png | Bin 13542 -> 0 bytes .../resources/multimc/scalable/atlauncher.svg | 15 - application/resources/multimc/scalable/bug.svg | 387 ---- .../resources/multimc/scalable/centralmods.svg | 346 ---- .../resources/multimc/scalable/checkupdate.svg | 167 -- .../resources/multimc/scalable/custom-commands.svg | 338 ---- application/resources/multimc/scalable/discord.svg | 108 -- .../resources/multimc/scalable/instances/bee.svg | 159 -- .../resources/multimc/scalable/instances/fox.svg | 290 --- application/resources/multimc/scalable/java.svg | 773 -------- .../resources/multimc/scalable/language.svg | 109 -- application/resources/multimc/scalable/logo.svg | 353 ---- application/resources/multimc/scalable/multimc.svg | 353 ---- application/resources/multimc/scalable/new.svg | 127 -- application/resources/multimc/scalable/news.svg | 296 --- application/resources/multimc/scalable/proxy.svg | 260 --- .../resources/multimc/scalable/reddit-alien.svg | 189 -- .../multimc/scalable/screenshot-placeholder.svg | 86 - .../resources/multimc/scalable/screenshots.svg | 1231 ------------ .../resources/multimc/scalable/status-bad.svg | 142 -- .../resources/multimc/scalable/status-good.svg | 201 -- .../resources/multimc/scalable/status-running.svg | 187 -- .../resources/multimc/scalable/status-yellow.svg | 155 -- application/resources/multimc/scalable/technic.svg | 13 - .../resources/multimc/scalable/viewfolder.svg | 122 -- application/resources/pe_blue/index.theme | 11 - application/resources/pe_blue/pe_blue.qrc | 38 - application/resources/pe_blue/scalable/about.svg | 16 - .../resources/pe_blue/scalable/accounts.svg | 46 - application/resources/pe_blue/scalable/bug.svg | 47 - .../resources/pe_blue/scalable/centralmods.svg | 43 - .../resources/pe_blue/scalable/checkupdate.svg | 43 - application/resources/pe_blue/scalable/copy.svg | 41 - .../resources/pe_blue/scalable/coremods.svg | 41 - .../resources/pe_blue/scalable/externaltools.svg | 41 - application/resources/pe_blue/scalable/help.svg | 40 - .../pe_blue/scalable/instance-settings.svg | 46 - application/resources/pe_blue/scalable/jarmods.svg | 22 - application/resources/pe_blue/scalable/java.svg | 47 - .../resources/pe_blue/scalable/language.svg | 46 - .../resources/pe_blue/scalable/loadermods.svg | 42 - application/resources/pe_blue/scalable/log.svg | 41 - .../resources/pe_blue/scalable/minecraft.svg | 44 - application/resources/pe_blue/scalable/multimc.svg | 61 - application/resources/pe_blue/scalable/new.svg | 44 - application/resources/pe_blue/scalable/news.svg | 13 - application/resources/pe_blue/scalable/notes.svg | 46 - application/resources/pe_blue/scalable/patreon.svg | 41 - application/resources/pe_blue/scalable/proxy.svg | 45 - .../resources/pe_blue/scalable/quickmods.svg | 43 - application/resources/pe_blue/scalable/refresh.svg | 41 - .../resources/pe_blue/scalable/resourcepacks.svg | 13 - .../resources/pe_blue/scalable/screenshots.svg | 44 - .../resources/pe_blue/scalable/settings.svg | 46 - .../resources/pe_blue/scalable/status-bad.svg | 10 - .../resources/pe_blue/scalable/status-good.svg | 15 - .../resources/pe_blue/scalable/status-yellow.svg | 16 - .../resources/pe_blue/scalable/viewfolder.svg | 42 - application/resources/pe_blue/scalable/worlds.svg | 63 - application/resources/pe_colored/index.theme | 11 - application/resources/pe_colored/pe_colored.qrc | 38 - .../resources/pe_colored/scalable/about.svg | 19 - .../resources/pe_colored/scalable/accounts.svg | 20 - application/resources/pe_colored/scalable/bug.svg | 17 - .../resources/pe_colored/scalable/centralmods.svg | 18 - .../resources/pe_colored/scalable/checkupdate.svg | 13 - application/resources/pe_colored/scalable/copy.svg | 16 - .../resources/pe_colored/scalable/coremods.svg | 16 - .../pe_colored/scalable/externaltools.svg | 13 - application/resources/pe_colored/scalable/help.svg | 46 - .../pe_colored/scalable/instance-settings.svg | 18 - .../resources/pe_colored/scalable/jarmods.svg | 22 - application/resources/pe_colored/scalable/java.svg | 49 - .../resources/pe_colored/scalable/language.svg | 44 - .../resources/pe_colored/scalable/loadermods.svg | 15 - application/resources/pe_colored/scalable/log.svg | 16 - .../resources/pe_colored/scalable/minecraft.svg | 14 - .../resources/pe_colored/scalable/multimc.svg | 32 - application/resources/pe_colored/scalable/new.svg | 16 - application/resources/pe_colored/scalable/news.svg | 13 - .../resources/pe_colored/scalable/notes.svg | 21 - .../resources/pe_colored/scalable/patreon.svg | 12 - .../resources/pe_colored/scalable/proxy.svg | 15 - .../resources/pe_colored/scalable/quickmods.svg | 14 - .../resources/pe_colored/scalable/refresh.svg | 11 - .../pe_colored/scalable/resourcepacks.svg | 15 - .../resources/pe_colored/scalable/screenshots.svg | 16 - .../resources/pe_colored/scalable/settings.svg | 18 - .../resources/pe_colored/scalable/status-bad.svg | 10 - .../resources/pe_colored/scalable/status-good.svg | 15 - .../pe_colored/scalable/status-yellow.svg | 16 - .../resources/pe_colored/scalable/viewfolder.svg | 17 - .../resources/pe_colored/scalable/worlds.svg | 50 - application/resources/pe_dark/index.theme | 11 - application/resources/pe_dark/pe_dark.qrc | 38 - application/resources/pe_dark/scalable/about.svg | 15 - .../resources/pe_dark/scalable/accounts.svg | 46 - application/resources/pe_dark/scalable/bug.svg | 47 - .../resources/pe_dark/scalable/centralmods.svg | 40 - .../resources/pe_dark/scalable/checkupdate.svg | 12 - application/resources/pe_dark/scalable/copy.svg | 40 - .../resources/pe_dark/scalable/coremods.svg | 41 - .../resources/pe_dark/scalable/externaltools.svg | 41 - application/resources/pe_dark/scalable/help.svg | 34 - .../pe_dark/scalable/instance-settings.svg | 43 - application/resources/pe_dark/scalable/jarmods.svg | 41 - application/resources/pe_dark/scalable/java.svg | 48 - .../resources/pe_dark/scalable/language.svg | 45 - .../resources/pe_dark/scalable/loadermods.svg | 42 - application/resources/pe_dark/scalable/log.svg | 41 - .../resources/pe_dark/scalable/minecraft.svg | 44 - application/resources/pe_dark/scalable/multimc.svg | 61 - application/resources/pe_dark/scalable/new.svg | 41 - application/resources/pe_dark/scalable/news.svg | 13 - application/resources/pe_dark/scalable/notes.svg | 46 - application/resources/pe_dark/scalable/patreon.svg | 41 - application/resources/pe_dark/scalable/proxy.svg | 43 - .../resources/pe_dark/scalable/quickmods.svg | 43 - application/resources/pe_dark/scalable/refresh.svg | 11 - .../resources/pe_dark/scalable/resourcepacks.svg | 13 - .../resources/pe_dark/scalable/screenshots.svg | 44 - .../resources/pe_dark/scalable/settings.svg | 43 - .../resources/pe_dark/scalable/status-bad.svg | 10 - .../resources/pe_dark/scalable/status-good.svg | 12 - .../resources/pe_dark/scalable/status-yellow.svg | 16 - .../resources/pe_dark/scalable/viewfolder.svg | 39 - application/resources/pe_dark/scalable/worlds.svg | 63 - application/resources/pe_light/index.theme | 11 - application/resources/pe_light/pe_light.qrc | 39 - application/resources/pe_light/scalable/about.svg | 15 - .../resources/pe_light/scalable/accounts.svg | 46 - application/resources/pe_light/scalable/bug.svg | 47 - .../resources/pe_light/scalable/centralmods.svg | 41 - .../resources/pe_light/scalable/checkupdate.svg | 13 - application/resources/pe_light/scalable/copy.svg | 40 - .../resources/pe_light/scalable/coremods.svg | 41 - .../resources/pe_light/scalable/externaltools.svg | 41 - application/resources/pe_light/scalable/help.svg | 36 - .../pe_light/scalable/instance-settings.svg | 43 - .../resources/pe_light/scalable/jarmods.svg | 41 - application/resources/pe_light/scalable/java.svg | 49 - .../resources/pe_light/scalable/language.svg | 80 - .../resources/pe_light/scalable/loadermods.svg | 42 - application/resources/pe_light/scalable/log.svg | 41 - .../resources/pe_light/scalable/minecraft.svg | 44 - .../resources/pe_light/scalable/multimc.svg | 61 - application/resources/pe_light/scalable/new.svg | 41 - application/resources/pe_light/scalable/news.svg | 12 - application/resources/pe_light/scalable/notes.svg | 46 - .../resources/pe_light/scalable/patreon.svg | 40 - application/resources/pe_light/scalable/proxy.svg | 45 - .../resources/pe_light/scalable/quickmods.svg | 43 - .../resources/pe_light/scalable/refresh.svg | 11 - .../resources/pe_light/scalable/resourcepacks.svg | 13 - .../resources/pe_light/scalable/screenshots.svg | 44 - .../resources/pe_light/scalable/settings.svg | 43 - .../resources/pe_light/scalable/status-bad.svg | 10 - .../resources/pe_light/scalable/status-good.svg | 12 - .../resources/pe_light/scalable/status-yellow.svg | 16 - .../resources/pe_light/scalable/viewfolder.svg | 40 - application/resources/pe_light/scalable/worlds.svg | 64 - application/resources/sources/clucker.svg | 404 ---- application/resources/sources/creeper.svg | 775 -------- application/resources/sources/enderpearl.svg | 271 --- application/resources/sources/flame.svg | 51 - application/resources/sources/ftb-glow.svg | 606 ------ application/resources/sources/ftb-logo.svg | 257 --- application/resources/sources/gear.svg | 434 ----- application/resources/sources/herobrine.svg | 583 ------ application/resources/sources/magitech.svg | 886 --------- application/resources/sources/meat.svg | 371 ---- application/resources/sources/multimc-discord.svg | 265 --- application/resources/sources/netherstar.svg | 342 ---- application/resources/sources/pskeleton.svg | 581 ------ application/resources/sources/skeleton.svg | 610 ------ application/resources/sources/squarecreeper.svg | 828 --------- application/resources/sources/steve.svg | 534 ------ application/setupwizard/AnalyticsWizardPage.cpp | 63 - application/setupwizard/AnalyticsWizardPage.h | 25 - application/setupwizard/BaseWizardPage.h | 33 - application/setupwizard/JavaWizardPage.cpp | 96 - application/setupwizard/JavaWizardPage.h | 29 - application/setupwizard/LanguageWizardPage.cpp | 48 - application/setupwizard/LanguageWizardPage.h | 26 - application/setupwizard/SetupWizard.cpp | 88 - application/setupwizard/SetupWizard.h | 45 - application/themes/BrightTheme.cpp | 56 - application/themes/BrightTheme.h | 19 - application/themes/CustomTheme.cpp | 244 --- application/themes/CustomTheme.h | 31 - application/themes/DarkTheme.cpp | 55 - application/themes/DarkTheme.h | 18 - application/themes/FusionTheme.cpp | 6 - application/themes/FusionTheme.h | 11 - application/themes/ITheme.cpp | 47 - application/themes/ITheme.h | 27 - application/themes/SystemTheme.cpp | 83 - application/themes/SystemTheme.h | 24 - application/widgets/Common.cpp | 27 - application/widgets/Common.h | 6 - application/widgets/CustomCommands.cpp | 49 - application/widgets/CustomCommands.h | 43 - application/widgets/CustomCommands.ui | 107 -- application/widgets/DropLabel.cpp | 41 - application/widgets/DropLabel.h | 20 - application/widgets/FocusLineEdit.cpp | 25 - application/widgets/FocusLineEdit.h | 17 - application/widgets/IconLabel.cpp | 43 - application/widgets/IconLabel.h | 26 - application/widgets/InstanceCardWidget.ui | 58 - application/widgets/JavaSettingsWidget.cpp | 428 ----- application/widgets/JavaSettingsWidget.h | 102 - application/widgets/LabeledToolButton.cpp | 115 -- application/widgets/LabeledToolButton.h | 40 - application/widgets/LanguageSelectionWidget.cpp | 66 - application/widgets/LanguageSelectionWidget.h | 41 - application/widgets/LineSeparator.cpp | 37 - application/widgets/LineSeparator.h | 18 - application/widgets/LogView.cpp | 144 -- application/widgets/LogView.h | 36 - application/widgets/MCModInfoFrame.cpp | 167 -- application/widgets/MCModInfoFrame.h | 52 - application/widgets/MCModInfoFrame.ui | 92 - application/widgets/ModListView.cpp | 66 - application/widgets/ModListView.h | 25 - application/widgets/PageContainer.cpp | 239 --- application/widgets/PageContainer.h | 89 - application/widgets/PageContainer_p.h | 123 -- application/widgets/ProgressWidget.cpp | 73 - application/widgets/ProgressWidget.h | 32 - application/widgets/ServerStatus.cpp | 179 -- application/widgets/ServerStatus.h | 40 - application/widgets/VersionListView.cpp | 163 -- application/widgets/VersionListView.h | 56 - application/widgets/VersionSelectWidget.cpp | 202 -- application/widgets/VersionSelectWidget.h | 81 - application/widgets/WideBar.cpp | 116 -- application/widgets/WideBar.h | 26 - 739 files changed, 55895 deletions(-) delete mode 100644 application/CMakeLists.txt delete mode 100644 application/ColorCache.cpp delete mode 100644 application/ColorCache.h delete mode 100644 application/ColumnResizer.cpp delete mode 100644 application/ColumnResizer.h delete mode 100644 application/GuiUtil.cpp delete mode 100644 application/GuiUtil.h delete mode 100644 application/HoeDown.h delete mode 100644 application/InstancePageProvider.h delete mode 100644 application/InstanceProxyModel.cpp delete mode 100644 application/InstanceProxyModel.h delete mode 100644 application/InstanceWindow.cpp delete mode 100644 application/InstanceWindow.h delete mode 100644 application/JavaCommon.cpp delete mode 100644 application/JavaCommon.h delete mode 100644 application/KonamiCode.cpp delete mode 100644 application/KonamiCode.h delete mode 100644 application/LaunchController.cpp delete mode 100644 application/LaunchController.h delete mode 100644 application/MainWindow.cpp delete mode 100644 application/MainWindow.h delete mode 100644 application/MultiMC.cpp delete mode 100644 application/MultiMC.h delete mode 100644 application/UpdateController.cpp delete mode 100644 application/UpdateController.h delete mode 100644 application/VersionProxyModel.cpp delete mode 100644 application/VersionProxyModel.h delete mode 100644 application/dialogs/AboutDialog.cpp delete mode 100644 application/dialogs/AboutDialog.h delete mode 100644 application/dialogs/AboutDialog.ui delete mode 100644 application/dialogs/CopyInstanceDialog.cpp delete mode 100644 application/dialogs/CopyInstanceDialog.h delete mode 100644 application/dialogs/CopyInstanceDialog.ui delete mode 100644 application/dialogs/CustomMessageBox.cpp delete mode 100644 application/dialogs/CustomMessageBox.h delete mode 100644 application/dialogs/EditAccountDialog.cpp delete mode 100644 application/dialogs/EditAccountDialog.h delete mode 100644 application/dialogs/EditAccountDialog.ui delete mode 100644 application/dialogs/ExportInstanceDialog.cpp delete mode 100644 application/dialogs/ExportInstanceDialog.h delete mode 100644 application/dialogs/ExportInstanceDialog.ui delete mode 100644 application/dialogs/IconPickerDialog.cpp delete mode 100644 application/dialogs/IconPickerDialog.h delete mode 100644 application/dialogs/IconPickerDialog.ui delete mode 100644 application/dialogs/LoginDialog.cpp delete mode 100644 application/dialogs/LoginDialog.h delete mode 100644 application/dialogs/LoginDialog.ui delete mode 100644 application/dialogs/NewComponentDialog.cpp delete mode 100644 application/dialogs/NewComponentDialog.h delete mode 100644 application/dialogs/NewComponentDialog.ui delete mode 100644 application/dialogs/NewInstanceDialog.cpp delete mode 100644 application/dialogs/NewInstanceDialog.h delete mode 100644 application/dialogs/NewInstanceDialog.ui delete mode 100644 application/dialogs/NotificationDialog.cpp delete mode 100644 application/dialogs/NotificationDialog.h delete mode 100644 application/dialogs/NotificationDialog.ui delete mode 100644 application/dialogs/ProfileSelectDialog.cpp delete mode 100644 application/dialogs/ProfileSelectDialog.h delete mode 100644 application/dialogs/ProfileSelectDialog.ui delete mode 100644 application/dialogs/ProgressDialog.cpp delete mode 100644 application/dialogs/ProgressDialog.h delete mode 100644 application/dialogs/ProgressDialog.ui delete mode 100644 application/dialogs/SkinUploadDialog.cpp delete mode 100644 application/dialogs/SkinUploadDialog.h delete mode 100644 application/dialogs/SkinUploadDialog.ui delete mode 100644 application/dialogs/UpdateDialog.cpp delete mode 100644 application/dialogs/UpdateDialog.h delete mode 100644 application/dialogs/UpdateDialog.ui delete mode 100644 application/dialogs/VersionSelectDialog.cpp delete mode 100644 application/dialogs/VersionSelectDialog.h delete mode 100644 application/groupview/AccessibleGroupView.cpp delete mode 100644 application/groupview/AccessibleGroupView.h delete mode 100644 application/groupview/AccessibleGroupView_p.h delete mode 100644 application/groupview/GroupView.cpp delete mode 100644 application/groupview/GroupView.h delete mode 100644 application/groupview/GroupedProxyModel.cpp delete mode 100644 application/groupview/GroupedProxyModel.h delete mode 100644 application/groupview/InstanceDelegate.cpp delete mode 100644 application/groupview/InstanceDelegate.h delete mode 100644 application/groupview/VisualGroup.cpp delete mode 100644 application/groupview/VisualGroup.h delete mode 100644 application/install_prereqs.cmake.in delete mode 100644 application/main.cpp delete mode 100755 application/package/linux/MultiMC delete mode 100755 application/package/linux/multimc.desktop delete mode 100644 application/package/rpm/MultiMC5.spec delete mode 100644 application/package/rpm/README.md delete mode 100644 application/package/ubuntu/README.md delete mode 100644 application/package/ubuntu/multimc/DEBIAN/control delete mode 100755 application/package/ubuntu/multimc/DEBIAN/postrm delete mode 100644 application/package/ubuntu/multimc/opt/multimc/icon.svg delete mode 100755 application/package/ubuntu/multimc/opt/multimc/run.sh delete mode 100755 application/package/ubuntu/multimc/usr/share/applications/multimc.desktop delete mode 100644 application/package/ubuntu/multimc/usr/share/metainfo/multimc.metainfo.xml delete mode 100644 application/pagedialog/PageDialog.cpp delete mode 100644 application/pagedialog/PageDialog.h delete mode 100644 application/pages/BasePage.h delete mode 100644 application/pages/BasePageContainer.h delete mode 100644 application/pages/BasePageProvider.h delete mode 100644 application/pages/global/AccountListPage.cpp delete mode 100644 application/pages/global/AccountListPage.h delete mode 100644 application/pages/global/AccountListPage.ui delete mode 100644 application/pages/global/CustomCommandsPage.cpp delete mode 100644 application/pages/global/CustomCommandsPage.h delete mode 100644 application/pages/global/ExternalToolsPage.cpp delete mode 100644 application/pages/global/ExternalToolsPage.h delete mode 100644 application/pages/global/ExternalToolsPage.ui delete mode 100644 application/pages/global/JavaPage.cpp delete mode 100644 application/pages/global/JavaPage.h delete mode 100644 application/pages/global/JavaPage.ui delete mode 100644 application/pages/global/LanguagePage.cpp delete mode 100644 application/pages/global/LanguagePage.h delete mode 100644 application/pages/global/MinecraftPage.cpp delete mode 100644 application/pages/global/MinecraftPage.h delete mode 100644 application/pages/global/MinecraftPage.ui delete mode 100644 application/pages/global/MultiMCPage.cpp delete mode 100644 application/pages/global/MultiMCPage.h delete mode 100644 application/pages/global/MultiMCPage.ui delete mode 100644 application/pages/global/PasteEEPage.cpp delete mode 100644 application/pages/global/PasteEEPage.h delete mode 100644 application/pages/global/PasteEEPage.ui delete mode 100644 application/pages/global/ProxyPage.cpp delete mode 100644 application/pages/global/ProxyPage.h delete mode 100644 application/pages/global/ProxyPage.ui delete mode 100644 application/pages/instance/GameOptionsPage.cpp delete mode 100644 application/pages/instance/GameOptionsPage.h delete mode 100644 application/pages/instance/GameOptionsPage.ui delete mode 100644 application/pages/instance/InstanceSettingsPage.cpp delete mode 100644 application/pages/instance/InstanceSettingsPage.h delete mode 100644 application/pages/instance/InstanceSettingsPage.ui delete mode 100644 application/pages/instance/LegacyUpgradePage.cpp delete mode 100644 application/pages/instance/LegacyUpgradePage.h delete mode 100644 application/pages/instance/LegacyUpgradePage.ui delete mode 100644 application/pages/instance/LogPage.cpp delete mode 100644 application/pages/instance/LogPage.h delete mode 100644 application/pages/instance/LogPage.ui delete mode 100644 application/pages/instance/ModFolderPage.cpp delete mode 100644 application/pages/instance/ModFolderPage.h delete mode 100644 application/pages/instance/ModFolderPage.ui delete mode 100644 application/pages/instance/NotesPage.cpp delete mode 100644 application/pages/instance/NotesPage.h delete mode 100644 application/pages/instance/NotesPage.ui delete mode 100644 application/pages/instance/OtherLogsPage.cpp delete mode 100644 application/pages/instance/OtherLogsPage.h delete mode 100644 application/pages/instance/OtherLogsPage.ui delete mode 100644 application/pages/instance/ResourcePackPage.h delete mode 100644 application/pages/instance/ScreenshotsPage.cpp delete mode 100644 application/pages/instance/ScreenshotsPage.h delete mode 100644 application/pages/instance/ScreenshotsPage.ui delete mode 100644 application/pages/instance/ServersPage.cpp delete mode 100644 application/pages/instance/ServersPage.h delete mode 100644 application/pages/instance/ServersPage.ui delete mode 100644 application/pages/instance/TexturePackPage.h delete mode 100644 application/pages/instance/VersionPage.cpp delete mode 100644 application/pages/instance/VersionPage.h delete mode 100644 application/pages/instance/VersionPage.ui delete mode 100644 application/pages/instance/WorldListPage.cpp delete mode 100644 application/pages/instance/WorldListPage.h delete mode 100644 application/pages/instance/WorldListPage.ui delete mode 100644 application/pages/modplatform/ImportPage.cpp delete mode 100644 application/pages/modplatform/ImportPage.h delete mode 100644 application/pages/modplatform/ImportPage.ui delete mode 100644 application/pages/modplatform/VanillaPage.cpp delete mode 100644 application/pages/modplatform/VanillaPage.h delete mode 100644 application/pages/modplatform/VanillaPage.ui delete mode 100644 application/pages/modplatform/atlauncher/AtlFilterModel.cpp delete mode 100644 application/pages/modplatform/atlauncher/AtlFilterModel.h delete mode 100644 application/pages/modplatform/atlauncher/AtlListModel.cpp delete mode 100644 application/pages/modplatform/atlauncher/AtlListModel.h delete mode 100644 application/pages/modplatform/atlauncher/AtlOptionalModDialog.cpp delete mode 100644 application/pages/modplatform/atlauncher/AtlOptionalModDialog.h delete mode 100644 application/pages/modplatform/atlauncher/AtlOptionalModDialog.ui delete mode 100644 application/pages/modplatform/atlauncher/AtlPage.cpp delete mode 100644 application/pages/modplatform/atlauncher/AtlPage.h delete mode 100644 application/pages/modplatform/atlauncher/AtlPage.ui delete mode 100644 application/pages/modplatform/flame/FlameModel.cpp delete mode 100644 application/pages/modplatform/flame/FlameModel.h delete mode 100644 application/pages/modplatform/flame/FlamePage.cpp delete mode 100644 application/pages/modplatform/flame/FlamePage.h delete mode 100644 application/pages/modplatform/flame/FlamePage.ui delete mode 100644 application/pages/modplatform/ftb/FtbFilterModel.cpp delete mode 100644 application/pages/modplatform/ftb/FtbFilterModel.h delete mode 100644 application/pages/modplatform/ftb/FtbListModel.cpp delete mode 100644 application/pages/modplatform/ftb/FtbListModel.h delete mode 100644 application/pages/modplatform/ftb/FtbPage.cpp delete mode 100644 application/pages/modplatform/ftb/FtbPage.h delete mode 100644 application/pages/modplatform/ftb/FtbPage.ui delete mode 100644 application/pages/modplatform/legacy_ftb/ListModel.cpp delete mode 100644 application/pages/modplatform/legacy_ftb/ListModel.h delete mode 100644 application/pages/modplatform/legacy_ftb/Page.cpp delete mode 100644 application/pages/modplatform/legacy_ftb/Page.h delete mode 100644 application/pages/modplatform/legacy_ftb/Page.ui delete mode 100644 application/pages/modplatform/technic/TechnicData.h delete mode 100644 application/pages/modplatform/technic/TechnicModel.cpp delete mode 100644 application/pages/modplatform/technic/TechnicModel.h delete mode 100644 application/pages/modplatform/technic/TechnicPage.cpp delete mode 100644 application/pages/modplatform/technic/TechnicPage.h delete mode 100644 application/pages/modplatform/technic/TechnicPage.ui delete mode 100644 application/resources/MultiMC.icns delete mode 100644 application/resources/MultiMC.ico delete mode 100644 application/resources/MultiMC.manifest delete mode 100644 application/resources/OSX/OSX.qrc delete mode 100644 application/resources/OSX/index.theme delete mode 100644 application/resources/OSX/scalable/about.svg delete mode 100644 application/resources/OSX/scalable/accounts.svg delete mode 100644 application/resources/OSX/scalable/bug.svg delete mode 100644 application/resources/OSX/scalable/centralmods.svg delete mode 100644 application/resources/OSX/scalable/checkupdate.svg delete mode 100644 application/resources/OSX/scalable/copy.svg delete mode 100644 application/resources/OSX/scalable/coremods.svg delete mode 100644 application/resources/OSX/scalable/externaltools.svg delete mode 100644 application/resources/OSX/scalable/help.svg delete mode 100644 application/resources/OSX/scalable/instance-settings.svg delete mode 100644 application/resources/OSX/scalable/jarmods.svg delete mode 100644 application/resources/OSX/scalable/java.svg delete mode 100644 application/resources/OSX/scalable/language.svg delete mode 100644 application/resources/OSX/scalable/loadermods.svg delete mode 100644 application/resources/OSX/scalable/log.svg delete mode 100644 application/resources/OSX/scalable/minecraft.svg delete mode 100644 application/resources/OSX/scalable/multimc.svg delete mode 100644 application/resources/OSX/scalable/new.svg delete mode 100644 application/resources/OSX/scalable/news.svg delete mode 100644 application/resources/OSX/scalable/notes.svg delete mode 100644 application/resources/OSX/scalable/patreon.svg delete mode 100644 application/resources/OSX/scalable/proxy.svg delete mode 100644 application/resources/OSX/scalable/quickmods.svg delete mode 100644 application/resources/OSX/scalable/refresh.svg delete mode 100644 application/resources/OSX/scalable/resourcepacks.svg delete mode 100644 application/resources/OSX/scalable/screenshots.svg delete mode 100644 application/resources/OSX/scalable/settings.svg delete mode 100644 application/resources/OSX/scalable/status-bad.svg delete mode 100644 application/resources/OSX/scalable/status-good.svg delete mode 100644 application/resources/OSX/scalable/status-yellow.svg delete mode 100644 application/resources/OSX/scalable/viewfolder.svg delete mode 100644 application/resources/OSX/scalable/worlds.svg delete mode 100644 application/resources/assets/underconstruction.png delete mode 100644 application/resources/backgrounds/backgrounds.qrc delete mode 100644 application/resources/backgrounds/catbgrnd2.png delete mode 100644 application/resources/backgrounds/catmas.png delete mode 100644 application/resources/documents/documents.qrc delete mode 100644 application/resources/flat/flat.qrc delete mode 100644 application/resources/flat/index.theme delete mode 100644 application/resources/flat/scalable/about.svg delete mode 100644 application/resources/flat/scalable/accounts.svg delete mode 100644 application/resources/flat/scalable/bug.svg delete mode 100644 application/resources/flat/scalable/cat.svg delete mode 100644 application/resources/flat/scalable/centralmods.svg delete mode 100644 application/resources/flat/scalable/checkupdate.svg delete mode 100644 application/resources/flat/scalable/copy.svg delete mode 100644 application/resources/flat/scalable/coremods.svg delete mode 100644 application/resources/flat/scalable/discord.svg delete mode 100644 application/resources/flat/scalable/externaltools.svg delete mode 100644 application/resources/flat/scalable/help.svg delete mode 100644 application/resources/flat/scalable/instance-settings.svg delete mode 100644 application/resources/flat/scalable/jarmods.svg delete mode 100644 application/resources/flat/scalable/java.svg delete mode 100644 application/resources/flat/scalable/language.svg delete mode 100644 application/resources/flat/scalable/loadermods.svg delete mode 100644 application/resources/flat/scalable/log.svg delete mode 100644 application/resources/flat/scalable/minecraft.svg delete mode 100644 application/resources/flat/scalable/multimc.svg delete mode 100644 application/resources/flat/scalable/new.svg delete mode 100644 application/resources/flat/scalable/news.svg delete mode 100644 application/resources/flat/scalable/notes.svg delete mode 100644 application/resources/flat/scalable/packages.svg delete mode 100644 application/resources/flat/scalable/patreon.svg delete mode 100644 application/resources/flat/scalable/proxy.svg delete mode 100644 application/resources/flat/scalable/quickmods.svg delete mode 100644 application/resources/flat/scalable/reddit-alien.svg delete mode 100644 application/resources/flat/scalable/refresh.svg delete mode 100644 application/resources/flat/scalable/resourcepacks.svg delete mode 100644 application/resources/flat/scalable/screenshot-placeholder.svg delete mode 100644 application/resources/flat/scalable/screenshots.svg delete mode 100644 application/resources/flat/scalable/settings.svg delete mode 100644 application/resources/flat/scalable/star.svg delete mode 100644 application/resources/flat/scalable/status-bad.svg delete mode 100644 application/resources/flat/scalable/status-good.svg delete mode 100644 application/resources/flat/scalable/status-running.svg delete mode 100644 application/resources/flat/scalable/status-yellow.svg delete mode 100644 application/resources/flat/scalable/viewfolder.svg delete mode 100644 application/resources/flat/scalable/worlds.svg delete mode 100644 application/resources/iOS/iOS.qrc delete mode 100644 application/resources/iOS/index.theme delete mode 100644 application/resources/iOS/scalable/about.svg delete mode 100644 application/resources/iOS/scalable/accounts.svg delete mode 100644 application/resources/iOS/scalable/bug.svg delete mode 100644 application/resources/iOS/scalable/centralmods.svg delete mode 100644 application/resources/iOS/scalable/checkupdate.svg delete mode 100644 application/resources/iOS/scalable/copy.svg delete mode 100644 application/resources/iOS/scalable/coremods.svg delete mode 100644 application/resources/iOS/scalable/externaltools.svg delete mode 100644 application/resources/iOS/scalable/help.svg delete mode 100644 application/resources/iOS/scalable/instance-settings.svg delete mode 100644 application/resources/iOS/scalable/jarmods.svg delete mode 100644 application/resources/iOS/scalable/java.svg delete mode 100644 application/resources/iOS/scalable/language.svg delete mode 100644 application/resources/iOS/scalable/loadermods.svg delete mode 100644 application/resources/iOS/scalable/log.svg delete mode 100644 application/resources/iOS/scalable/minecraft.svg delete mode 100644 application/resources/iOS/scalable/multimc.svg delete mode 100644 application/resources/iOS/scalable/new.svg delete mode 100644 application/resources/iOS/scalable/news.svg delete mode 100644 application/resources/iOS/scalable/notes.svg delete mode 100644 application/resources/iOS/scalable/patreon.svg delete mode 100644 application/resources/iOS/scalable/proxy.svg delete mode 100644 application/resources/iOS/scalable/quickmods.svg delete mode 100644 application/resources/iOS/scalable/refresh.svg delete mode 100644 application/resources/iOS/scalable/resourcepacks.svg delete mode 100644 application/resources/iOS/scalable/screenshots.svg delete mode 100644 application/resources/iOS/scalable/settings.svg delete mode 100644 application/resources/iOS/scalable/status-bad.svg delete mode 100644 application/resources/iOS/scalable/status-good.svg delete mode 100644 application/resources/iOS/scalable/status-yellow.svg delete mode 100644 application/resources/iOS/scalable/viewfolder.svg delete mode 100644 application/resources/iOS/scalable/worlds.svg delete mode 100644 application/resources/multimc.rc delete mode 100644 application/resources/multimc/128x128/instances/chicken.png delete mode 100644 application/resources/multimc/128x128/instances/creeper.png delete mode 100644 application/resources/multimc/128x128/instances/enderpearl.png delete mode 100644 application/resources/multimc/128x128/instances/flame.png delete mode 100644 application/resources/multimc/128x128/instances/ftb_glow.png delete mode 100644 application/resources/multimc/128x128/instances/ftb_logo.png delete mode 100644 application/resources/multimc/128x128/instances/gear.png delete mode 100644 application/resources/multimc/128x128/instances/herobrine.png delete mode 100644 application/resources/multimc/128x128/instances/infinity.png delete mode 100644 application/resources/multimc/128x128/instances/magitech.png delete mode 100644 application/resources/multimc/128x128/instances/meat.png delete mode 100644 application/resources/multimc/128x128/instances/netherstar.png delete mode 100644 application/resources/multimc/128x128/instances/skeleton.png delete mode 100644 application/resources/multimc/128x128/instances/squarecreeper.png delete mode 100644 application/resources/multimc/128x128/instances/steve.png delete mode 100644 application/resources/multimc/128x128/unknown_server.png delete mode 100644 application/resources/multimc/16x16/about.png delete mode 100644 application/resources/multimc/16x16/bug.png delete mode 100644 application/resources/multimc/16x16/cat.png delete mode 100644 application/resources/multimc/16x16/centralmods.png delete mode 100644 application/resources/multimc/16x16/checkupdate.png delete mode 100644 application/resources/multimc/16x16/copy.png delete mode 100644 application/resources/multimc/16x16/coremods.png delete mode 100644 application/resources/multimc/16x16/help.png delete mode 100644 application/resources/multimc/16x16/instance-settings.png delete mode 100644 application/resources/multimc/16x16/jarmods.png delete mode 100644 application/resources/multimc/16x16/loadermods.png delete mode 100644 application/resources/multimc/16x16/log.png delete mode 100644 application/resources/multimc/16x16/minecraft.png delete mode 100644 application/resources/multimc/16x16/new.png delete mode 100644 application/resources/multimc/16x16/news.png delete mode 100644 application/resources/multimc/16x16/noaccount.png delete mode 100644 application/resources/multimc/16x16/patreon.png delete mode 100644 application/resources/multimc/16x16/refresh.png delete mode 100644 application/resources/multimc/16x16/resourcepacks.png delete mode 100644 application/resources/multimc/16x16/screenshots.png delete mode 100644 application/resources/multimc/16x16/settings.png delete mode 100644 application/resources/multimc/16x16/star.png delete mode 100644 application/resources/multimc/16x16/status-bad.png delete mode 100644 application/resources/multimc/16x16/status-good.png delete mode 100644 application/resources/multimc/16x16/status-running.png delete mode 100644 application/resources/multimc/16x16/status-yellow.png delete mode 100644 application/resources/multimc/16x16/viewfolder.png delete mode 100644 application/resources/multimc/16x16/worlds.png delete mode 100644 application/resources/multimc/22x22/about.png delete mode 100644 application/resources/multimc/22x22/bug.png delete mode 100644 application/resources/multimc/22x22/cat.png delete mode 100644 application/resources/multimc/22x22/centralmods.png delete mode 100644 application/resources/multimc/22x22/checkupdate.png delete mode 100644 application/resources/multimc/22x22/copy.png delete mode 100644 application/resources/multimc/22x22/help.png delete mode 100644 application/resources/multimc/22x22/instance-settings.png delete mode 100644 application/resources/multimc/22x22/new.png delete mode 100644 application/resources/multimc/22x22/news.png delete mode 100644 application/resources/multimc/22x22/patreon.png delete mode 100644 application/resources/multimc/22x22/refresh.png delete mode 100644 application/resources/multimc/22x22/screenshots.png delete mode 100644 application/resources/multimc/22x22/settings.png delete mode 100644 application/resources/multimc/22x22/status-bad.png delete mode 100644 application/resources/multimc/22x22/status-good.png delete mode 100644 application/resources/multimc/22x22/status-running.png delete mode 100644 application/resources/multimc/22x22/status-yellow.png delete mode 100644 application/resources/multimc/22x22/viewfolder.png delete mode 100644 application/resources/multimc/22x22/worlds.png delete mode 100644 application/resources/multimc/24x24/cat.png delete mode 100644 application/resources/multimc/24x24/coremods.png delete mode 100644 application/resources/multimc/24x24/jarmods.png delete mode 100644 application/resources/multimc/24x24/loadermods.png delete mode 100644 application/resources/multimc/24x24/log.png delete mode 100644 application/resources/multimc/24x24/minecraft.png delete mode 100644 application/resources/multimc/24x24/noaccount.png delete mode 100644 application/resources/multimc/24x24/patreon.png delete mode 100644 application/resources/multimc/24x24/resourcepacks.png delete mode 100644 application/resources/multimc/24x24/star.png delete mode 100644 application/resources/multimc/24x24/status-bad.png delete mode 100644 application/resources/multimc/24x24/status-good.png delete mode 100644 application/resources/multimc/24x24/status-running.png delete mode 100644 application/resources/multimc/24x24/status-yellow.png delete mode 100644 application/resources/multimc/256x256/minecraft.png delete mode 100644 application/resources/multimc/32x32/about.png delete mode 100644 application/resources/multimc/32x32/bug.png delete mode 100644 application/resources/multimc/32x32/cat.png delete mode 100644 application/resources/multimc/32x32/centralmods.png delete mode 100644 application/resources/multimc/32x32/checkupdate.png delete mode 100644 application/resources/multimc/32x32/copy.png delete mode 100644 application/resources/multimc/32x32/coremods.png delete mode 100644 application/resources/multimc/32x32/help.png delete mode 100644 application/resources/multimc/32x32/instance-settings.png delete mode 100644 application/resources/multimc/32x32/instances/brick.png delete mode 100644 application/resources/multimc/32x32/instances/chicken.png delete mode 100644 application/resources/multimc/32x32/instances/creeper.png delete mode 100644 application/resources/multimc/32x32/instances/diamond.png delete mode 100644 application/resources/multimc/32x32/instances/dirt.png delete mode 100644 application/resources/multimc/32x32/instances/enderpearl.png delete mode 100644 application/resources/multimc/32x32/instances/flame.png delete mode 100644 application/resources/multimc/32x32/instances/ftb_glow.png delete mode 100644 application/resources/multimc/32x32/instances/ftb_logo.png delete mode 100644 application/resources/multimc/32x32/instances/gear.png delete mode 100644 application/resources/multimc/32x32/instances/gold.png delete mode 100644 application/resources/multimc/32x32/instances/grass.png delete mode 100644 application/resources/multimc/32x32/instances/herobrine.png delete mode 100644 application/resources/multimc/32x32/instances/infinity.png delete mode 100644 application/resources/multimc/32x32/instances/iron.png delete mode 100644 application/resources/multimc/32x32/instances/magitech.png delete mode 100644 application/resources/multimc/32x32/instances/meat.png delete mode 100644 application/resources/multimc/32x32/instances/netherstar.png delete mode 100644 application/resources/multimc/32x32/instances/planks.png delete mode 100644 application/resources/multimc/32x32/instances/skeleton.png delete mode 100644 application/resources/multimc/32x32/instances/squarecreeper.png delete mode 100644 application/resources/multimc/32x32/instances/steve.png delete mode 100644 application/resources/multimc/32x32/instances/stone.png delete mode 100644 application/resources/multimc/32x32/instances/tnt.png delete mode 100644 application/resources/multimc/32x32/jarmods.png delete mode 100644 application/resources/multimc/32x32/loadermods.png delete mode 100644 application/resources/multimc/32x32/log.png delete mode 100644 application/resources/multimc/32x32/minecraft.png delete mode 100644 application/resources/multimc/32x32/new.png delete mode 100644 application/resources/multimc/32x32/news.png delete mode 100644 application/resources/multimc/32x32/noaccount.png delete mode 100644 application/resources/multimc/32x32/patreon.png delete mode 100644 application/resources/multimc/32x32/refresh.png delete mode 100644 application/resources/multimc/32x32/resourcepacks.png delete mode 100644 application/resources/multimc/32x32/screenshots.png delete mode 100644 application/resources/multimc/32x32/settings.png delete mode 100644 application/resources/multimc/32x32/star.png delete mode 100644 application/resources/multimc/32x32/status-bad.png delete mode 100644 application/resources/multimc/32x32/status-good.png delete mode 100644 application/resources/multimc/32x32/status-running.png delete mode 100644 application/resources/multimc/32x32/status-yellow.png delete mode 100644 application/resources/multimc/32x32/viewfolder.png delete mode 100644 application/resources/multimc/32x32/worlds.png delete mode 100644 application/resources/multimc/48x48/about.png delete mode 100644 application/resources/multimc/48x48/bug.png delete mode 100644 application/resources/multimc/48x48/cat.png delete mode 100644 application/resources/multimc/48x48/centralmods.png delete mode 100644 application/resources/multimc/48x48/checkupdate.png delete mode 100644 application/resources/multimc/48x48/copy.png delete mode 100644 application/resources/multimc/48x48/help.png delete mode 100644 application/resources/multimc/48x48/instance-settings.png delete mode 100644 application/resources/multimc/48x48/log.png delete mode 100644 application/resources/multimc/48x48/minecraft.png delete mode 100644 application/resources/multimc/48x48/new.png delete mode 100644 application/resources/multimc/48x48/news.png delete mode 100644 application/resources/multimc/48x48/noaccount.png delete mode 100644 application/resources/multimc/48x48/patreon.png delete mode 100644 application/resources/multimc/48x48/refresh.png delete mode 100644 application/resources/multimc/48x48/screenshots.png delete mode 100644 application/resources/multimc/48x48/settings.png delete mode 100644 application/resources/multimc/48x48/star.png delete mode 100644 application/resources/multimc/48x48/status-bad.png delete mode 100644 application/resources/multimc/48x48/status-good.png delete mode 100644 application/resources/multimc/48x48/status-running.png delete mode 100644 application/resources/multimc/48x48/status-yellow.png delete mode 100644 application/resources/multimc/48x48/viewfolder.png delete mode 100644 application/resources/multimc/48x48/worlds.png delete mode 100644 application/resources/multimc/50x50/instances/enderman.png delete mode 100644 application/resources/multimc/64x64/about.png delete mode 100644 application/resources/multimc/64x64/bug.png delete mode 100644 application/resources/multimc/64x64/cat.png delete mode 100644 application/resources/multimc/64x64/centralmods.png delete mode 100644 application/resources/multimc/64x64/checkupdate.png delete mode 100644 application/resources/multimc/64x64/copy.png delete mode 100644 application/resources/multimc/64x64/coremods.png delete mode 100644 application/resources/multimc/64x64/help.png delete mode 100644 application/resources/multimc/64x64/instance-settings.png delete mode 100644 application/resources/multimc/64x64/jarmods.png delete mode 100644 application/resources/multimc/64x64/loadermods.png delete mode 100644 application/resources/multimc/64x64/log.png delete mode 100644 application/resources/multimc/64x64/new.png delete mode 100644 application/resources/multimc/64x64/news.png delete mode 100644 application/resources/multimc/64x64/patreon.png delete mode 100644 application/resources/multimc/64x64/refresh.png delete mode 100644 application/resources/multimc/64x64/resourcepacks.png delete mode 100644 application/resources/multimc/64x64/screenshots.png delete mode 100644 application/resources/multimc/64x64/settings.png delete mode 100644 application/resources/multimc/64x64/star.png delete mode 100644 application/resources/multimc/64x64/status-bad.png delete mode 100644 application/resources/multimc/64x64/status-good.png delete mode 100644 application/resources/multimc/64x64/status-running.png delete mode 100644 application/resources/multimc/64x64/status-yellow.png delete mode 100644 application/resources/multimc/64x64/viewfolder.png delete mode 100644 application/resources/multimc/64x64/worlds.png delete mode 100644 application/resources/multimc/8x8/noaccount.png delete mode 100644 application/resources/multimc/index.theme delete mode 100644 application/resources/multimc/multimc.qrc delete mode 100644 application/resources/multimc/scalable/atlauncher-placeholder.png delete mode 100644 application/resources/multimc/scalable/atlauncher.svg delete mode 100644 application/resources/multimc/scalable/bug.svg delete mode 100644 application/resources/multimc/scalable/centralmods.svg delete mode 100644 application/resources/multimc/scalable/checkupdate.svg delete mode 100644 application/resources/multimc/scalable/custom-commands.svg delete mode 100644 application/resources/multimc/scalable/discord.svg delete mode 100644 application/resources/multimc/scalable/instances/bee.svg delete mode 100644 application/resources/multimc/scalable/instances/fox.svg delete mode 100644 application/resources/multimc/scalable/java.svg delete mode 100644 application/resources/multimc/scalable/language.svg delete mode 100644 application/resources/multimc/scalable/logo.svg delete mode 100644 application/resources/multimc/scalable/multimc.svg delete mode 100644 application/resources/multimc/scalable/new.svg delete mode 100644 application/resources/multimc/scalable/news.svg delete mode 100644 application/resources/multimc/scalable/proxy.svg delete mode 100644 application/resources/multimc/scalable/reddit-alien.svg delete mode 100644 application/resources/multimc/scalable/screenshot-placeholder.svg delete mode 100644 application/resources/multimc/scalable/screenshots.svg delete mode 100644 application/resources/multimc/scalable/status-bad.svg delete mode 100644 application/resources/multimc/scalable/status-good.svg delete mode 100644 application/resources/multimc/scalable/status-running.svg delete mode 100644 application/resources/multimc/scalable/status-yellow.svg delete mode 100644 application/resources/multimc/scalable/technic.svg delete mode 100644 application/resources/multimc/scalable/viewfolder.svg delete mode 100644 application/resources/pe_blue/index.theme delete mode 100644 application/resources/pe_blue/pe_blue.qrc delete mode 100644 application/resources/pe_blue/scalable/about.svg delete mode 100644 application/resources/pe_blue/scalable/accounts.svg delete mode 100644 application/resources/pe_blue/scalable/bug.svg delete mode 100644 application/resources/pe_blue/scalable/centralmods.svg delete mode 100644 application/resources/pe_blue/scalable/checkupdate.svg delete mode 100644 application/resources/pe_blue/scalable/copy.svg delete mode 100644 application/resources/pe_blue/scalable/coremods.svg delete mode 100644 application/resources/pe_blue/scalable/externaltools.svg delete mode 100644 application/resources/pe_blue/scalable/help.svg delete mode 100644 application/resources/pe_blue/scalable/instance-settings.svg delete mode 100644 application/resources/pe_blue/scalable/jarmods.svg delete mode 100644 application/resources/pe_blue/scalable/java.svg delete mode 100644 application/resources/pe_blue/scalable/language.svg delete mode 100644 application/resources/pe_blue/scalable/loadermods.svg delete mode 100644 application/resources/pe_blue/scalable/log.svg delete mode 100644 application/resources/pe_blue/scalable/minecraft.svg delete mode 100644 application/resources/pe_blue/scalable/multimc.svg delete mode 100644 application/resources/pe_blue/scalable/new.svg delete mode 100644 application/resources/pe_blue/scalable/news.svg delete mode 100644 application/resources/pe_blue/scalable/notes.svg delete mode 100644 application/resources/pe_blue/scalable/patreon.svg delete mode 100644 application/resources/pe_blue/scalable/proxy.svg delete mode 100644 application/resources/pe_blue/scalable/quickmods.svg delete mode 100644 application/resources/pe_blue/scalable/refresh.svg delete mode 100644 application/resources/pe_blue/scalable/resourcepacks.svg delete mode 100644 application/resources/pe_blue/scalable/screenshots.svg delete mode 100644 application/resources/pe_blue/scalable/settings.svg delete mode 100644 application/resources/pe_blue/scalable/status-bad.svg delete mode 100644 application/resources/pe_blue/scalable/status-good.svg delete mode 100644 application/resources/pe_blue/scalable/status-yellow.svg delete mode 100644 application/resources/pe_blue/scalable/viewfolder.svg delete mode 100644 application/resources/pe_blue/scalable/worlds.svg delete mode 100644 application/resources/pe_colored/index.theme delete mode 100644 application/resources/pe_colored/pe_colored.qrc delete mode 100644 application/resources/pe_colored/scalable/about.svg delete mode 100644 application/resources/pe_colored/scalable/accounts.svg delete mode 100644 application/resources/pe_colored/scalable/bug.svg delete mode 100644 application/resources/pe_colored/scalable/centralmods.svg delete mode 100644 application/resources/pe_colored/scalable/checkupdate.svg delete mode 100644 application/resources/pe_colored/scalable/copy.svg delete mode 100644 application/resources/pe_colored/scalable/coremods.svg delete mode 100644 application/resources/pe_colored/scalable/externaltools.svg delete mode 100644 application/resources/pe_colored/scalable/help.svg delete mode 100644 application/resources/pe_colored/scalable/instance-settings.svg delete mode 100644 application/resources/pe_colored/scalable/jarmods.svg delete mode 100644 application/resources/pe_colored/scalable/java.svg delete mode 100644 application/resources/pe_colored/scalable/language.svg delete mode 100644 application/resources/pe_colored/scalable/loadermods.svg delete mode 100644 application/resources/pe_colored/scalable/log.svg delete mode 100644 application/resources/pe_colored/scalable/minecraft.svg delete mode 100644 application/resources/pe_colored/scalable/multimc.svg delete mode 100644 application/resources/pe_colored/scalable/new.svg delete mode 100644 application/resources/pe_colored/scalable/news.svg delete mode 100644 application/resources/pe_colored/scalable/notes.svg delete mode 100644 application/resources/pe_colored/scalable/patreon.svg delete mode 100644 application/resources/pe_colored/scalable/proxy.svg delete mode 100644 application/resources/pe_colored/scalable/quickmods.svg delete mode 100644 application/resources/pe_colored/scalable/refresh.svg delete mode 100644 application/resources/pe_colored/scalable/resourcepacks.svg delete mode 100644 application/resources/pe_colored/scalable/screenshots.svg delete mode 100644 application/resources/pe_colored/scalable/settings.svg delete mode 100644 application/resources/pe_colored/scalable/status-bad.svg delete mode 100644 application/resources/pe_colored/scalable/status-good.svg delete mode 100644 application/resources/pe_colored/scalable/status-yellow.svg delete mode 100644 application/resources/pe_colored/scalable/viewfolder.svg delete mode 100644 application/resources/pe_colored/scalable/worlds.svg delete mode 100644 application/resources/pe_dark/index.theme delete mode 100644 application/resources/pe_dark/pe_dark.qrc delete mode 100644 application/resources/pe_dark/scalable/about.svg delete mode 100644 application/resources/pe_dark/scalable/accounts.svg delete mode 100644 application/resources/pe_dark/scalable/bug.svg delete mode 100644 application/resources/pe_dark/scalable/centralmods.svg delete mode 100644 application/resources/pe_dark/scalable/checkupdate.svg delete mode 100644 application/resources/pe_dark/scalable/copy.svg delete mode 100644 application/resources/pe_dark/scalable/coremods.svg delete mode 100644 application/resources/pe_dark/scalable/externaltools.svg delete mode 100644 application/resources/pe_dark/scalable/help.svg delete mode 100644 application/resources/pe_dark/scalable/instance-settings.svg delete mode 100644 application/resources/pe_dark/scalable/jarmods.svg delete mode 100644 application/resources/pe_dark/scalable/java.svg delete mode 100644 application/resources/pe_dark/scalable/language.svg delete mode 100644 application/resources/pe_dark/scalable/loadermods.svg delete mode 100644 application/resources/pe_dark/scalable/log.svg delete mode 100644 application/resources/pe_dark/scalable/minecraft.svg delete mode 100644 application/resources/pe_dark/scalable/multimc.svg delete mode 100644 application/resources/pe_dark/scalable/new.svg delete mode 100644 application/resources/pe_dark/scalable/news.svg delete mode 100644 application/resources/pe_dark/scalable/notes.svg delete mode 100644 application/resources/pe_dark/scalable/patreon.svg delete mode 100644 application/resources/pe_dark/scalable/proxy.svg delete mode 100644 application/resources/pe_dark/scalable/quickmods.svg delete mode 100644 application/resources/pe_dark/scalable/refresh.svg delete mode 100644 application/resources/pe_dark/scalable/resourcepacks.svg delete mode 100644 application/resources/pe_dark/scalable/screenshots.svg delete mode 100644 application/resources/pe_dark/scalable/settings.svg delete mode 100644 application/resources/pe_dark/scalable/status-bad.svg delete mode 100644 application/resources/pe_dark/scalable/status-good.svg delete mode 100644 application/resources/pe_dark/scalable/status-yellow.svg delete mode 100644 application/resources/pe_dark/scalable/viewfolder.svg delete mode 100644 application/resources/pe_dark/scalable/worlds.svg delete mode 100644 application/resources/pe_light/index.theme delete mode 100644 application/resources/pe_light/pe_light.qrc delete mode 100644 application/resources/pe_light/scalable/about.svg delete mode 100644 application/resources/pe_light/scalable/accounts.svg delete mode 100644 application/resources/pe_light/scalable/bug.svg delete mode 100644 application/resources/pe_light/scalable/centralmods.svg delete mode 100644 application/resources/pe_light/scalable/checkupdate.svg delete mode 100644 application/resources/pe_light/scalable/copy.svg delete mode 100644 application/resources/pe_light/scalable/coremods.svg delete mode 100644 application/resources/pe_light/scalable/externaltools.svg delete mode 100644 application/resources/pe_light/scalable/help.svg delete mode 100644 application/resources/pe_light/scalable/instance-settings.svg delete mode 100644 application/resources/pe_light/scalable/jarmods.svg delete mode 100644 application/resources/pe_light/scalable/java.svg delete mode 100644 application/resources/pe_light/scalable/language.svg delete mode 100644 application/resources/pe_light/scalable/loadermods.svg delete mode 100644 application/resources/pe_light/scalable/log.svg delete mode 100644 application/resources/pe_light/scalable/minecraft.svg delete mode 100644 application/resources/pe_light/scalable/multimc.svg delete mode 100644 application/resources/pe_light/scalable/new.svg delete mode 100644 application/resources/pe_light/scalable/news.svg delete mode 100644 application/resources/pe_light/scalable/notes.svg delete mode 100644 application/resources/pe_light/scalable/patreon.svg delete mode 100644 application/resources/pe_light/scalable/proxy.svg delete mode 100644 application/resources/pe_light/scalable/quickmods.svg delete mode 100644 application/resources/pe_light/scalable/refresh.svg delete mode 100644 application/resources/pe_light/scalable/resourcepacks.svg delete mode 100644 application/resources/pe_light/scalable/screenshots.svg delete mode 100644 application/resources/pe_light/scalable/settings.svg delete mode 100644 application/resources/pe_light/scalable/status-bad.svg delete mode 100644 application/resources/pe_light/scalable/status-good.svg delete mode 100644 application/resources/pe_light/scalable/status-yellow.svg delete mode 100644 application/resources/pe_light/scalable/viewfolder.svg delete mode 100644 application/resources/pe_light/scalable/worlds.svg delete mode 100644 application/resources/sources/clucker.svg delete mode 100644 application/resources/sources/creeper.svg delete mode 100644 application/resources/sources/enderpearl.svg delete mode 100644 application/resources/sources/flame.svg delete mode 100644 application/resources/sources/ftb-glow.svg delete mode 100644 application/resources/sources/ftb-logo.svg delete mode 100644 application/resources/sources/gear.svg delete mode 100644 application/resources/sources/herobrine.svg delete mode 100644 application/resources/sources/magitech.svg delete mode 100644 application/resources/sources/meat.svg delete mode 100644 application/resources/sources/multimc-discord.svg delete mode 100644 application/resources/sources/netherstar.svg delete mode 100644 application/resources/sources/pskeleton.svg delete mode 100644 application/resources/sources/skeleton.svg delete mode 100644 application/resources/sources/squarecreeper.svg delete mode 100644 application/resources/sources/steve.svg delete mode 100644 application/setupwizard/AnalyticsWizardPage.cpp delete mode 100644 application/setupwizard/AnalyticsWizardPage.h delete mode 100644 application/setupwizard/BaseWizardPage.h delete mode 100644 application/setupwizard/JavaWizardPage.cpp delete mode 100644 application/setupwizard/JavaWizardPage.h delete mode 100644 application/setupwizard/LanguageWizardPage.cpp delete mode 100644 application/setupwizard/LanguageWizardPage.h delete mode 100644 application/setupwizard/SetupWizard.cpp delete mode 100644 application/setupwizard/SetupWizard.h delete mode 100644 application/themes/BrightTheme.cpp delete mode 100644 application/themes/BrightTheme.h delete mode 100644 application/themes/CustomTheme.cpp delete mode 100644 application/themes/CustomTheme.h delete mode 100644 application/themes/DarkTheme.cpp delete mode 100644 application/themes/DarkTheme.h delete mode 100644 application/themes/FusionTheme.cpp delete mode 100644 application/themes/FusionTheme.h delete mode 100644 application/themes/ITheme.cpp delete mode 100644 application/themes/ITheme.h delete mode 100644 application/themes/SystemTheme.cpp delete mode 100644 application/themes/SystemTheme.h delete mode 100644 application/widgets/Common.cpp delete mode 100644 application/widgets/Common.h delete mode 100644 application/widgets/CustomCommands.cpp delete mode 100644 application/widgets/CustomCommands.h delete mode 100644 application/widgets/CustomCommands.ui delete mode 100644 application/widgets/DropLabel.cpp delete mode 100644 application/widgets/DropLabel.h delete mode 100644 application/widgets/FocusLineEdit.cpp delete mode 100644 application/widgets/FocusLineEdit.h delete mode 100644 application/widgets/IconLabel.cpp delete mode 100644 application/widgets/IconLabel.h delete mode 100644 application/widgets/InstanceCardWidget.ui delete mode 100644 application/widgets/JavaSettingsWidget.cpp delete mode 100644 application/widgets/JavaSettingsWidget.h delete mode 100644 application/widgets/LabeledToolButton.cpp delete mode 100644 application/widgets/LabeledToolButton.h delete mode 100644 application/widgets/LanguageSelectionWidget.cpp delete mode 100644 application/widgets/LanguageSelectionWidget.h delete mode 100644 application/widgets/LineSeparator.cpp delete mode 100644 application/widgets/LineSeparator.h delete mode 100644 application/widgets/LogView.cpp delete mode 100644 application/widgets/LogView.h delete mode 100644 application/widgets/MCModInfoFrame.cpp delete mode 100644 application/widgets/MCModInfoFrame.h delete mode 100644 application/widgets/MCModInfoFrame.ui delete mode 100644 application/widgets/ModListView.cpp delete mode 100644 application/widgets/ModListView.h delete mode 100644 application/widgets/PageContainer.cpp delete mode 100644 application/widgets/PageContainer.h delete mode 100644 application/widgets/PageContainer_p.h delete mode 100644 application/widgets/ProgressWidget.cpp delete mode 100644 application/widgets/ProgressWidget.h delete mode 100644 application/widgets/ServerStatus.cpp delete mode 100644 application/widgets/ServerStatus.h delete mode 100644 application/widgets/VersionListView.cpp delete mode 100644 application/widgets/VersionListView.h delete mode 100644 application/widgets/VersionSelectWidget.cpp delete mode 100644 application/widgets/VersionSelectWidget.h delete mode 100644 application/widgets/WideBar.cpp delete mode 100644 application/widgets/WideBar.h (limited to 'application') diff --git a/application/CMakeLists.txt b/application/CMakeLists.txt deleted file mode 100644 index ab2b9960..00000000 --- a/application/CMakeLists.txt +++ /dev/null @@ -1,417 +0,0 @@ -project(application) - -################################ FILES ################################ - -######## Sources and headers ######## -SET(MULTIMC_SOURCES - # Application base - main.cpp - MultiMC.h - MultiMC.cpp - UpdateController.cpp - UpdateController.h - - # GUI - general utilities - GuiUtil.h - GuiUtil.cpp - ColumnResizer.h - ColumnResizer.cpp - InstanceProxyModel.h - InstanceProxyModel.cpp - VersionProxyModel.h - VersionProxyModel.cpp - ColorCache.h - ColorCache.cpp - HoeDown.h - - # Super secret! - KonamiCode.h - KonamiCode.cpp - - # GUI - windows - MainWindow.h - MainWindow.cpp - InstanceWindow.h - InstanceWindow.cpp - - # GUI - setup wizard - setupwizard/SetupWizard.h - setupwizard/SetupWizard.cpp - setupwizard/AnalyticsWizardPage.cpp - setupwizard/AnalyticsWizardPage.h - setupwizard/BaseWizardPage.h - setupwizard/JavaWizardPage.cpp - setupwizard/JavaWizardPage.h - setupwizard/LanguageWizardPage.cpp - setupwizard/LanguageWizardPage.h - - # GUI - themes - themes/FusionTheme.cpp - themes/FusionTheme.h - themes/BrightTheme.cpp - themes/BrightTheme.h - themes/CustomTheme.cpp - themes/CustomTheme.h - themes/DarkTheme.cpp - themes/DarkTheme.h - themes/ITheme.cpp - themes/ITheme.h - themes/SystemTheme.cpp - themes/SystemTheme.h - - # Processes - LaunchController.h - LaunchController.cpp - - # page provider for instances - InstancePageProvider.h - - # Common java checking UI - JavaCommon.h - JavaCommon.cpp - - # GUI - paged dialog base - pages/BasePage.h - pages/BasePageContainer.h - pages/BasePageProvider.h - - # GUI - instance pages - pages/instance/GameOptionsPage.cpp - pages/instance/GameOptionsPage.h - pages/instance/VersionPage.cpp - pages/instance/VersionPage.h - pages/instance/TexturePackPage.h - pages/instance/ResourcePackPage.h - pages/instance/ModFolderPage.cpp - pages/instance/ModFolderPage.h - pages/instance/NotesPage.cpp - pages/instance/NotesPage.h - pages/instance/LogPage.cpp - pages/instance/LogPage.h - pages/instance/InstanceSettingsPage.cpp - pages/instance/InstanceSettingsPage.h - pages/instance/ScreenshotsPage.cpp - pages/instance/ScreenshotsPage.h - pages/instance/OtherLogsPage.cpp - pages/instance/OtherLogsPage.h - pages/instance/ServersPage.cpp - pages/instance/ServersPage.h - pages/instance/LegacyUpgradePage.cpp - pages/instance/LegacyUpgradePage.h - pages/instance/WorldListPage.cpp - pages/instance/WorldListPage.h - - # GUI - global settings pages - pages/global/AccountListPage.cpp - pages/global/AccountListPage.h - pages/global/CustomCommandsPage.cpp - pages/global/CustomCommandsPage.h - pages/global/ExternalToolsPage.cpp - pages/global/ExternalToolsPage.h - pages/global/JavaPage.cpp - pages/global/JavaPage.h - pages/global/LanguagePage.cpp - pages/global/LanguagePage.h - pages/global/MinecraftPage.cpp - pages/global/MinecraftPage.h - pages/global/MultiMCPage.cpp - pages/global/MultiMCPage.h - pages/global/ProxyPage.cpp - pages/global/ProxyPage.h - pages/global/PasteEEPage.cpp - pages/global/PasteEEPage.h - - # GUI - platform pages - pages/modplatform/VanillaPage.cpp - pages/modplatform/VanillaPage.h - - pages/modplatform/atlauncher/AtlFilterModel.cpp - pages/modplatform/atlauncher/AtlFilterModel.h - pages/modplatform/atlauncher/AtlListModel.cpp - pages/modplatform/atlauncher/AtlListModel.h - pages/modplatform/atlauncher/AtlOptionalModDialog.cpp - pages/modplatform/atlauncher/AtlOptionalModDialog.h - pages/modplatform/atlauncher/AtlPage.cpp - pages/modplatform/atlauncher/AtlPage.h - - pages/modplatform/ftb/FtbFilterModel.cpp - pages/modplatform/ftb/FtbFilterModel.h - pages/modplatform/ftb/FtbListModel.cpp - pages/modplatform/ftb/FtbListModel.h - pages/modplatform/ftb/FtbPage.cpp - pages/modplatform/ftb/FtbPage.h - - pages/modplatform/legacy_ftb/Page.cpp - pages/modplatform/legacy_ftb/Page.h - pages/modplatform/legacy_ftb/ListModel.h - pages/modplatform/legacy_ftb/ListModel.cpp - - pages/modplatform/flame/FlameModel.cpp - pages/modplatform/flame/FlameModel.h - pages/modplatform/flame/FlamePage.cpp - pages/modplatform/flame/FlamePage.h - - pages/modplatform/technic/TechnicModel.cpp - pages/modplatform/technic/TechnicModel.h - pages/modplatform/technic/TechnicPage.cpp - pages/modplatform/technic/TechnicPage.h - - pages/modplatform/ImportPage.cpp - pages/modplatform/ImportPage.h - - # GUI - dialogs - dialogs/AboutDialog.cpp - dialogs/AboutDialog.h - dialogs/ProfileSelectDialog.cpp - dialogs/ProfileSelectDialog.h - dialogs/CopyInstanceDialog.cpp - dialogs/CopyInstanceDialog.h - dialogs/CustomMessageBox.cpp - dialogs/CustomMessageBox.h - dialogs/EditAccountDialog.cpp - dialogs/EditAccountDialog.h - dialogs/ExportInstanceDialog.cpp - dialogs/ExportInstanceDialog.h - dialogs/IconPickerDialog.cpp - dialogs/IconPickerDialog.h - dialogs/LoginDialog.cpp - dialogs/LoginDialog.h - dialogs/NewComponentDialog.cpp - dialogs/NewComponentDialog.h - dialogs/NewInstanceDialog.cpp - dialogs/NewInstanceDialog.h - dialogs/NotificationDialog.cpp - dialogs/NotificationDialog.h - pagedialog/PageDialog.cpp - pagedialog/PageDialog.h - dialogs/ProgressDialog.cpp - dialogs/ProgressDialog.h - dialogs/UpdateDialog.cpp - dialogs/UpdateDialog.h - dialogs/VersionSelectDialog.cpp - dialogs/VersionSelectDialog.h - dialogs/SkinUploadDialog.cpp - dialogs/SkinUploadDialog.h - - - # GUI - widgets - widgets/Common.cpp - widgets/Common.h - widgets/CustomCommands.cpp - widgets/CustomCommands.h - widgets/DropLabel.cpp - widgets/DropLabel.h - widgets/FocusLineEdit.cpp - widgets/FocusLineEdit.h - widgets/IconLabel.cpp - widgets/IconLabel.h - widgets/JavaSettingsWidget.cpp - widgets/JavaSettingsWidget.h - widgets/LabeledToolButton.cpp - widgets/LabeledToolButton.h - widgets/LanguageSelectionWidget.cpp - widgets/LanguageSelectionWidget.h - widgets/LineSeparator.cpp - widgets/LineSeparator.h - widgets/LogView.cpp - widgets/LogView.h - widgets/MCModInfoFrame.cpp - widgets/MCModInfoFrame.h - widgets/ModListView.cpp - widgets/ModListView.h - widgets/PageContainer.cpp - widgets/PageContainer.h - widgets/PageContainer_p.h - widgets/ServerStatus.cpp - widgets/ServerStatus.h - widgets/VersionListView.cpp - widgets/VersionListView.h - widgets/VersionSelectWidget.cpp - widgets/VersionSelectWidget.h - widgets/ProgressWidget.h - widgets/ProgressWidget.cpp - widgets/WideBar.h - widgets/WideBar.cpp - - # GUI - instance group view - groupview/GroupedProxyModel.cpp - groupview/GroupedProxyModel.h - groupview/AccessibleGroupView.cpp - groupview/AccessibleGroupView.h - groupview/AccessibleGroupView_p.h - groupview/GroupView.cpp - groupview/GroupView.h - groupview/InstanceDelegate.cpp - groupview/InstanceDelegate.h - groupview/VisualGroup.cpp - groupview/VisualGroup.h - ) - -######## UIs ######## -SET(MULTIMC_UIS - # Instance pages - pages/instance/GameOptionsPage.ui - pages/instance/VersionPage.ui - pages/instance/ModFolderPage.ui - pages/instance/LogPage.ui - pages/instance/InstanceSettingsPage.ui - pages/instance/NotesPage.ui - pages/instance/ScreenshotsPage.ui - pages/instance/OtherLogsPage.ui - pages/instance/LegacyUpgradePage.ui - pages/instance/ServersPage.ui - pages/instance/WorldListPage.ui - - # Global settings pages - pages/global/AccountListPage.ui - pages/global/ExternalToolsPage.ui - pages/global/JavaPage.ui - pages/global/MinecraftPage.ui - pages/global/MultiMCPage.ui - pages/global/ProxyPage.ui - pages/global/PasteEEPage.ui - - # Platform pages - pages/modplatform/VanillaPage.ui - pages/modplatform/atlauncher/AtlPage.ui - pages/modplatform/ftb/FtbPage.ui - pages/modplatform/legacy_ftb/Page.ui - pages/modplatform/flame/FlamePage.ui - pages/modplatform/technic/TechnicPage.ui - pages/modplatform/ImportPage.ui - - # Platform Dialogs - pages/modplatform/atlauncher/AtlOptionalModDialog.ui - - # Dialogs - dialogs/CopyInstanceDialog.ui - dialogs/NewComponentDialog.ui - dialogs/NewInstanceDialog.ui - dialogs/AboutDialog.ui - dialogs/ProgressDialog.ui - dialogs/IconPickerDialog.ui - dialogs/ProfileSelectDialog.ui - dialogs/EditAccountDialog.ui - dialogs/ExportInstanceDialog.ui - dialogs/LoginDialog.ui - dialogs/UpdateDialog.ui - dialogs/NotificationDialog.ui - dialogs/SkinUploadDialog.ui - - # Widgets/other - widgets/CustomCommands.ui - widgets/MCModInfoFrame.ui -) - -set(MULTIMC_QRCS - resources/backgrounds/backgrounds.qrc - resources/multimc/multimc.qrc - resources/pe_dark/pe_dark.qrc - resources/pe_light/pe_light.qrc - resources/pe_colored/pe_colored.qrc - resources/pe_blue/pe_blue.qrc - resources/OSX/OSX.qrc - resources/iOS/iOS.qrc - resources/flat/flat.qrc - resources/documents/documents.qrc -) - -######## Windows resource files ######## -if(WIN32) - set(MULTIMC_RCS resources/multimc.rc) -endif() - -# Qt 5 stuff -qt5_wrap_ui(MULTIMC_UI ${MULTIMC_UIS}) -qt5_add_resources(MULTIMC_RESOURCES ${MULTIMC_QRCS}) - -# Add executable -add_executable(MultiMC MACOSX_BUNDLE WIN32 ${MULTIMC_SOURCES} ${MULTIMC_UI} ${MULTIMC_RESOURCES} ${MULTIMC_RCS}) -target_link_libraries(MultiMC MultiMC_gui ${QUAZIP_LIBRARIES} hoedown MultiMC_rainbow LocalPeer ganalytics) -if(DEFINED MultiMC_APP_BINARY_NAME) - set_target_properties(MultiMC PROPERTIES OUTPUT_NAME "${MultiMC_APP_BINARY_NAME}") -endif() -if(DEFINED MultiMC_BINARY_RPATH) - SET_TARGET_PROPERTIES(MultiMC PROPERTIES INSTALL_RPATH "${MultiMC_BINARY_RPATH}") -endif() -if(DEFINED MultiMC_APP_BINARY_DEFS) - target_compile_definitions(MultiMC PRIVATE ${MultiMC_APP_BINARY_DEFS}) -endif() - -install(TARGETS MultiMC - BUNDLE DESTINATION ${BUNDLE_DEST_DIR} COMPONENT Runtime - LIBRARY DESTINATION ${LIBRARY_DEST_DIR} COMPONENT Runtime - RUNTIME DESTINATION ${BINARY_DEST_DIR} COMPONENT Runtime -) - -#### The MultiMC bundle mess! #### -# Bundle utilities are used to complete the portable packages - they add all the libraries that would otherwise be missing on the target system. -# NOTE: it seems that this absolutely has to be here, and nowhere else. -if(INSTALL_BUNDLE STREQUAL "full") - # Add qt.conf - this makes Qt stop looking for things outside the bundle - install( - CODE "file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${RESOURCES_DEST_DIR}/qt.conf\" \" \")" - COMPONENT Runtime - ) - # Bundle plugins - if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") - # Image formats - install( - DIRECTORY "${QT_PLUGINS_DIR}/imageformats" - DESTINATION ${PLUGIN_DEST_DIR} - COMPONENT Runtime - REGEX "tga|tiff|mng|webp" EXCLUDE - ) - # Icon engines - install( - DIRECTORY "${QT_PLUGINS_DIR}/iconengines" - DESTINATION ${PLUGIN_DEST_DIR} - COMPONENT Runtime - REGEX "fontawesome" EXCLUDE - ) - # Platform plugins - install( - DIRECTORY "${QT_PLUGINS_DIR}/platforms" - DESTINATION ${PLUGIN_DEST_DIR} - COMPONENT Runtime - REGEX "minimal|linuxfb|offscreen" EXCLUDE - ) - else() - # Image formats - install( - DIRECTORY "${QT_PLUGINS_DIR}/imageformats" - DESTINATION ${PLUGIN_DEST_DIR} - COMPONENT Runtime - REGEX "tga|tiff|mng|webp" EXCLUDE - REGEX "d\\." EXCLUDE - REGEX "_debug\\." EXCLUDE - REGEX "\\.dSYM" EXCLUDE - ) - # Icon engines - install( - DIRECTORY "${QT_PLUGINS_DIR}/iconengines" - DESTINATION ${PLUGIN_DEST_DIR} - COMPONENT Runtime - REGEX "fontawesome" EXCLUDE - REGEX "d\\." EXCLUDE - REGEX "_debug\\." EXCLUDE - REGEX "\\.dSYM" EXCLUDE - ) - # Platform plugins - install( - DIRECTORY "${QT_PLUGINS_DIR}/platforms" - DESTINATION ${PLUGIN_DEST_DIR} - COMPONENT Runtime - REGEX "minimal|linuxfb|offscreen" EXCLUDE - REGEX "d\\." EXCLUDE - REGEX "_debug\\." EXCLUDE - REGEX "\\.dSYM" EXCLUDE - ) - endif() - configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/install_prereqs.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/install_prereqs.cmake" - @ONLY - ) - install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/install_prereqs.cmake" COMPONENT Runtime) -endif() diff --git a/application/ColorCache.cpp b/application/ColorCache.cpp deleted file mode 100644 index ef268dd2..00000000 --- a/application/ColorCache.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include "ColorCache.h" - - -/** - * Blend the color with the front color, adapting to the back color - */ -QColor ColorCache::blend(QColor color) -{ - if (Rainbow::luma(m_front) > Rainbow::luma(m_back)) - { - // for dark color schemes, produce a fitting color first - color = Rainbow::tint(m_front, color, 0.5); - } - // adapt contrast - return Rainbow::mix(m_front, color, m_bias); -} - -/** - * Blend the color with the back color - */ -QColor ColorCache::blendBackground(QColor color) -{ - // adapt contrast - return Rainbow::mix(m_back, color, m_bias); -} - -void ColorCache::recolorAll() -{ - auto iter = m_colors.begin(); - while(iter != m_colors.end()) - { - iter->front = blend(iter->original); - iter->back = blendBackground(iter->original); - } -} diff --git a/application/ColorCache.h b/application/ColorCache.h deleted file mode 100644 index 6ae633b9..00000000 --- a/application/ColorCache.h +++ /dev/null @@ -1,119 +0,0 @@ -#pragma once -#include -#include -#include -#include - -class ColorCache -{ -public: - ColorCache(QColor front, QColor back, qreal bias) - { - m_front = front; - m_back = back; - m_bias = bias; - }; - - void addColor(int key, QColor color) - { - m_colors[key] = {color, blend(color), blendBackground(color)}; - } - - void setForeground(QColor front) - { - if(m_front != front) - { - m_front = front; - recolorAll(); - } - } - - void setBackground(QColor back) - { - if(m_back != back) - { - m_back = back; - recolorAll(); - } - } - - QColor getFront(int key) - { - auto iter = m_colors.find(key); - if(iter == m_colors.end()) - { - return QColor(); - } - return (*iter).front; - } - - QColor getBack(int key) - { - auto iter = m_colors.find(key); - if(iter == m_colors.end()) - { - return QColor(); - } - return (*iter).back; - } - - /** - * Blend the color with the front color, adapting to the back color - */ - QColor blend(QColor color); - - /** - * Blend the color with the back color - */ - QColor blendBackground(QColor color); - -protected: - void recolorAll(); - -protected: - struct ColorEntry - { - QColor original; - QColor front; - QColor back; - }; - -protected: - qreal m_bias; - QColor m_front; - QColor m_back; - QMap m_colors; -}; - -class LogColorCache : public ColorCache -{ -public: - LogColorCache(QColor front, QColor back) - : ColorCache(front, back, 1.0) - { - addColor((int)MessageLevel::MultiMC, QColor("purple")); - addColor((int)MessageLevel::Debug, QColor("green")); - addColor((int)MessageLevel::Warning, QColor("orange")); - addColor((int)MessageLevel::Error, QColor("red")); - addColor((int)MessageLevel::Fatal, QColor("red")); - addColor((int)MessageLevel::Message, front); - } - - QColor getFront(MessageLevel::Enum level) - { - if(!m_colors.contains((int) level)) - { - return ColorCache::getFront((int)MessageLevel::Message); - } - return ColorCache::getFront((int)level); - } - - QColor getBack(MessageLevel::Enum level) - { - if(level == MessageLevel::Fatal) - { - return QColor(Qt::black); - } - return QColor(Qt::transparent); - } -}; diff --git a/application/ColumnResizer.cpp b/application/ColumnResizer.cpp deleted file mode 100644 index fe415067..00000000 --- a/application/ColumnResizer.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/* -* Copyright 2011 Aurélien Gâteau -* License: BSD-3-Clause -*/ -#include - -#include -#include -#include -#include -#include -#include - -class FormLayoutWidgetItem : public QWidgetItem -{ -public: - FormLayoutWidgetItem(QWidget* widget, QFormLayout* formLayout, QFormLayout::ItemRole itemRole) - : QWidgetItem(widget) - , m_width(-1) - , m_formLayout(formLayout) - , m_itemRole(itemRole) - {} - - QSize sizeHint() const - { - QSize size = QWidgetItem::sizeHint(); - if (m_width != -1) { - size.setWidth(m_width); - } - return size; - } - - QSize minimumSize() const - { - QSize size = QWidgetItem::minimumSize(); - if (m_width != -1) { - size.setWidth(m_width); - } - return size; - } - - QSize maximumSize() const - { - QSize size = QWidgetItem::maximumSize(); - if (m_width != -1) { - size.setWidth(m_width); - } - return size; - } - - void setWidth(int width) - { - if (width != m_width) { - m_width = width; - invalidate(); - } - } - - void setGeometry(const QRect& _rect) - { - QRect rect = _rect; - int width = widget()->sizeHint().width(); - if (m_itemRole == QFormLayout::LabelRole && m_formLayout->labelAlignment() & Qt::AlignRight) { - rect.setLeft(rect.right() - width); - } - QWidgetItem::setGeometry(rect); - } - - QFormLayout* formLayout() const - { - return m_formLayout; - } - -private: - int m_width; - QFormLayout* m_formLayout; - QFormLayout::ItemRole m_itemRole; -}; - -typedef QPair GridColumnInfo; - -class ColumnResizerPrivate -{ -public: - ColumnResizerPrivate(ColumnResizer* q_ptr) - : q(q_ptr) - , m_updateTimer(new QTimer(q)) - { - m_updateTimer->setSingleShot(true); - m_updateTimer->setInterval(0); - QObject::connect(m_updateTimer, SIGNAL(timeout()), q, SLOT(updateWidth())); - } - - void scheduleWidthUpdate() - { - m_updateTimer->start(); - } - - ColumnResizer* q; - QTimer* m_updateTimer; - QList m_widgets; - QList m_wrWidgetItemList; - QList m_gridColumnInfoList; -}; - -ColumnResizer::ColumnResizer(QObject* parent) -: QObject(parent) -, d(new ColumnResizerPrivate(this)) -{} - -ColumnResizer::~ColumnResizer() -{ - delete d; -} - -void ColumnResizer::addWidget(QWidget* widget) -{ - d->m_widgets.append(widget); - widget->installEventFilter(this); - d->scheduleWidthUpdate(); -} - -void ColumnResizer::updateWidth() -{ - int width = 0; - Q_FOREACH(QWidget* widget, d->m_widgets) { - width = qMax(widget->sizeHint().width(), width); - } - Q_FOREACH(FormLayoutWidgetItem* item, d->m_wrWidgetItemList) { - item->setWidth(width); - item->formLayout()->update(); - } - Q_FOREACH(GridColumnInfo info, d->m_gridColumnInfoList) { - info.first->setColumnMinimumWidth(info.second, width); - } -} - -bool ColumnResizer::eventFilter(QObject*, QEvent* event) -{ - if (event->type() == QEvent::Resize) { - d->scheduleWidthUpdate(); - } - return false; -} - -void ColumnResizer::addWidgetsFromLayout(QLayout* layout, int column) -{ - Q_ASSERT(column >= 0); - QGridLayout* gridLayout = qobject_cast(layout); - QFormLayout* formLayout = qobject_cast(layout); - if (gridLayout) { - addWidgetsFromGridLayout(gridLayout, column); - } else if (formLayout) { - if (column > QFormLayout::SpanningRole) { - qCritical() << "column should not be more than" << QFormLayout::SpanningRole << "for QFormLayout"; - return; - } - QFormLayout::ItemRole role = static_cast(column); - addWidgetsFromFormLayout(formLayout, role); - } else { - qCritical() << "Don't know how to handle layout" << layout; - } -} - -void ColumnResizer::addWidgetsFromGridLayout(QGridLayout* layout, int column) -{ - for (int row = 0; row < layout->rowCount(); ++row) { - QLayoutItem* item = layout->itemAtPosition(row, column); - if (!item) { - continue; - } - QWidget* widget = item->widget(); - if (!widget) { - continue; - } - addWidget(widget); - } - d->m_gridColumnInfoList << GridColumnInfo(layout, column); -} - -void ColumnResizer::addWidgetsFromFormLayout(QFormLayout* layout, QFormLayout::ItemRole role) -{ - for (int row = 0; row < layout->rowCount(); ++row) { - QLayoutItem* item = layout->itemAt(row, role); - if (!item) { - continue; - } - QWidget* widget = item->widget(); - if (!widget) { - continue; - } - layout->removeItem(item); - delete item; - FormLayoutWidgetItem* newItem = new FormLayoutWidgetItem(widget, layout, role); - layout->setItem(row, role, newItem); - addWidget(widget); - d->m_wrWidgetItemList << newItem; - } -} diff --git a/application/ColumnResizer.h b/application/ColumnResizer.h deleted file mode 100644 index 8c920f01..00000000 --- a/application/ColumnResizer.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -* Copyright 2011 Aurélien Gâteau -* License: BSD-3-Clause -*/ -#ifndef COLUMNRESIZER_H -#define COLUMNRESIZER_H - -#include - -#include -#include - -class QEvent; -class QGridLayout; -class QLayout; -class QWidget; - -class ColumnResizerPrivate; -class ColumnResizer : public QObject -{ - Q_OBJECT -public: - ColumnResizer(QObject* parent = 0); - ~ColumnResizer(); - - void addWidget(QWidget* widget); - void addWidgetsFromLayout(QLayout*, int column); - void addWidgetsFromGridLayout(QGridLayout*, int column); - void addWidgetsFromFormLayout(QFormLayout*, QFormLayout::ItemRole role); - -private Q_SLOTS: - void updateWidth(); - -protected: - bool eventFilter(QObject*, QEvent* event); - -private: - ColumnResizerPrivate* const d; -}; - -#endif /* COLUMNRESIZER_H */ diff --git a/application/GuiUtil.cpp b/application/GuiUtil.cpp deleted file mode 100644 index 302206f5..00000000 --- a/application/GuiUtil.cpp +++ /dev/null @@ -1,131 +0,0 @@ -#include "GuiUtil.h" - -#include -#include -#include - -#include "dialogs/ProgressDialog.h" -#include "net/PasteUpload.h" -#include "dialogs/CustomMessageBox.h" - -#include "MultiMC.h" -#include -#include -#include - -QString GuiUtil::uploadPaste(const QString &text, QWidget *parentWidget) -{ - ProgressDialog dialog(parentWidget); - auto APIKeySetting = MMC->settings()->get("PasteEEAPIKey").toString(); - if(APIKeySetting == "multimc") - { - APIKeySetting = BuildConfig.PASTE_EE_KEY; - } - std::unique_ptr paste(new PasteUpload(parentWidget, text, APIKeySetting)); - - if (!paste->validateText()) - { - CustomMessageBox::selectable( - parentWidget, QObject::tr("Upload failed"), - QObject::tr("The log file is too big. You'll have to upload it manually."), - QMessageBox::Warning)->exec(); - return QString(); - } - - dialog.execWithTask(paste.get()); - if (!paste->wasSuccessful()) - { - CustomMessageBox::selectable(parentWidget, QObject::tr("Upload failed"), - paste->failReason(), QMessageBox::Critical)->exec(); - return QString(); - } - else - { - const QString link = paste->pasteLink(); - setClipboardText(link); - CustomMessageBox::selectable( - parentWidget, QObject::tr("Upload finished"), - QObject::tr("The link to the uploaded log has been placed in your clipboard.").arg(link), - QMessageBox::Information)->exec(); - return link; - } -} - -void GuiUtil::setClipboardText(const QString &text) -{ - QApplication::clipboard()->setText(text); -} - -static QStringList BrowseForFileInternal(QString context, QString caption, QString filter, QString defaultPath, QWidget *parentWidget, bool single) -{ - static QMap savedPaths; - - QFileDialog w(parentWidget, caption); - QSet locations; - auto f = [&](QStandardPaths::StandardLocation l) - { - QString location = QStandardPaths::writableLocation(l); - QFileInfo finfo(location); - if (!finfo.exists()) - return; - locations.insert(location); - }; - f(QStandardPaths::DesktopLocation); - f(QStandardPaths::DocumentsLocation); - f(QStandardPaths::DownloadLocation); - f(QStandardPaths::HomeLocation); - QList urls; - for (auto location : locations) - { - urls.append(QUrl::fromLocalFile(location)); - } - urls.append(QUrl::fromLocalFile(defaultPath)); - - w.setFileMode(single ? QFileDialog::ExistingFile : QFileDialog::ExistingFiles); - w.setAcceptMode(QFileDialog::AcceptOpen); - w.setNameFilter(filter); - - QString pathToOpen; - if(savedPaths.contains(context)) - { - pathToOpen = savedPaths[context]; - } - else - { - pathToOpen = defaultPath; - } - if(!pathToOpen.isEmpty()) - { - QFileInfo finfo(pathToOpen); - if(finfo.exists() && finfo.isDir()) - { - w.setDirectory(finfo.absoluteFilePath()); - } - } - - w.setSidebarUrls(urls); - - if (w.exec()) - { - savedPaths[context] = w.directory().absolutePath(); - return w.selectedFiles(); - } - savedPaths[context] = w.directory().absolutePath(); - return {}; -} - -QString GuiUtil::BrowseForFile(QString context, QString caption, QString filter, QString defaultPath, QWidget *parentWidget) -{ - auto resultList = BrowseForFileInternal(context, caption, filter, defaultPath, parentWidget, true); - if(resultList.size()) - { - return resultList[0]; - } - return QString(); -} - - -QStringList GuiUtil::BrowseForFiles(QString context, QString caption, QString filter, QString defaultPath, QWidget *parentWidget) -{ - return BrowseForFileInternal(context, caption, filter, defaultPath, parentWidget, false); -} diff --git a/application/GuiUtil.h b/application/GuiUtil.h deleted file mode 100644 index 5e109383..00000000 --- a/application/GuiUtil.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once - -#include - -namespace GuiUtil -{ -QString uploadPaste(const QString &text, QWidget *parentWidget); -void setClipboardText(const QString &text); -QStringList BrowseForFiles(QString context, QString caption, QString filter, QString defaultPath, QWidget *parentWidget); -QString BrowseForFile(QString context, QString caption, QString filter, QString defaultPath, QWidget *parentWidget); -} diff --git a/application/HoeDown.h b/application/HoeDown.h deleted file mode 100644 index b9e06ffb..00000000 --- a/application/HoeDown.h +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once -#include -#include -#include -#include - -/** - * hoedown wrapper, because dealing with resource lifetime in C is stupid - */ -class HoeDown -{ -public: - class buffer - { - public: - buffer(size_t unit = 4096) - { - buf = hoedown_buffer_new(unit); - } - ~buffer() - { - hoedown_buffer_free(buf); - } - const char * cstr() - { - return hoedown_buffer_cstr(buf); - } - void put(QByteArray input) - { - hoedown_buffer_put(buf, (uint8_t *) input.data(), input.size()); - } - const uint8_t * data() const - { - return buf->data; - } - size_t size() const - { - return buf->size; - } - hoedown_buffer * buf; - } ib, ob; - HoeDown() - { - renderer = hoedown_html_renderer_new((hoedown_html_flags) 0,0); - document = hoedown_document_new(renderer, (hoedown_extensions) 0, 8); - } - ~HoeDown() - { - hoedown_document_free(document); - hoedown_html_renderer_free(renderer); - } - QString process(QByteArray input) - { - ib.put(input); - hoedown_document_render(document, ob.buf, ib.data(), ib.size()); - return ob.cstr(); - } -private: - hoedown_document * document; - hoedown_renderer * renderer; -}; diff --git a/application/InstancePageProvider.h b/application/InstancePageProvider.h deleted file mode 100644 index 3cb723c4..00000000 --- a/application/InstancePageProvider.h +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once -#include "minecraft/MinecraftInstance.h" -#include "minecraft/legacy/LegacyInstance.h" -#include -#include "pages/BasePage.h" -#include "pages/BasePageProvider.h" -#include "pages/instance/LogPage.h" -#include "pages/instance/VersionPage.h" -#include "pages/instance/ModFolderPage.h" -#include "pages/instance/ResourcePackPage.h" -#include "pages/instance/TexturePackPage.h" -#include "pages/instance/NotesPage.h" -#include "pages/instance/ScreenshotsPage.h" -#include "pages/instance/InstanceSettingsPage.h" -#include "pages/instance/OtherLogsPage.h" -#include "pages/instance/LegacyUpgradePage.h" -#include "pages/instance/WorldListPage.h" -#include "pages/instance/ServersPage.h" -#include "pages/instance/GameOptionsPage.h" - -#include "Env.h" - -class InstancePageProvider : public QObject, public BasePageProvider -{ - Q_OBJECT -public: - explicit InstancePageProvider(InstancePtr parent) - { - inst = parent; - } - - virtual ~InstancePageProvider() {}; - virtual QList getPages() override - { - QList values; - values.append(new LogPage(inst)); - std::shared_ptr onesix = std::dynamic_pointer_cast(inst); - if(onesix) - { - values.append(new VersionPage(onesix.get())); - auto modsPage = new ModFolderPage(onesix.get(), onesix->loaderModList(), "mods", "loadermods", tr("Loader mods"), "Loader-mods"); - modsPage->setFilter("%1 (*.zip *.jar *.litemod)"); - values.append(modsPage); - values.append(new CoreModFolderPage(onesix.get(), onesix->coreModList(), "coremods", "coremods", tr("Core mods"), "Core-mods")); - values.append(new ResourcePackPage(onesix.get())); - values.append(new TexturePackPage(onesix.get())); - values.append(new NotesPage(onesix.get())); - values.append(new WorldListPage(onesix.get(), onesix->worldList())); - values.append(new ServersPage(onesix)); - // values.append(new GameOptionsPage(onesix.get())); - values.append(new ScreenshotsPage(FS::PathCombine(onesix->gameRoot(), "screenshots"))); - values.append(new InstanceSettingsPage(onesix.get())); - } - std::shared_ptr legacy = std::dynamic_pointer_cast(inst); - if(legacy) - { - values.append(new LegacyUpgradePage(legacy)); - values.append(new NotesPage(legacy.get())); - values.append(new WorldListPage(legacy.get(), legacy->worldList())); - values.append(new ScreenshotsPage(FS::PathCombine(legacy->gameRoot(), "screenshots"))); - } - auto logMatcher = inst->getLogFileMatcher(); - if(logMatcher) - { - values.append(new OtherLogsPage(inst->getLogFileRoot(), logMatcher)); - } - return values; - } - - virtual QString dialogTitle() override - { - return tr("Edit Instance (%1)").arg(inst->name()); - } -protected: - InstancePtr inst; -}; diff --git a/application/InstanceProxyModel.cpp b/application/InstanceProxyModel.cpp deleted file mode 100644 index 5317f60c..00000000 --- a/application/InstanceProxyModel.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include "InstanceProxyModel.h" -#include "MultiMC.h" -#include -#include - -InstanceProxyModel::InstanceProxyModel(QObject *parent) : GroupedProxyModel(parent) -{ -} - -QVariant InstanceProxyModel::data(const QModelIndex & index, int role) const -{ - QVariant data = QSortFilterProxyModel::data(index, role); - if(role == Qt::DecorationRole) - { - return QVariant(MMC->icons()->getIcon(data.toString())); - } - return data; -} - -bool InstanceProxyModel::subSortLessThan(const QModelIndex &left, - const QModelIndex &right) const -{ - BaseInstance *pdataLeft = static_cast(left.internalPointer()); - BaseInstance *pdataRight = static_cast(right.internalPointer()); - QString sortMode = MMC->settings()->get("InstSortMode").toString(); - if (sortMode == "LastLaunch") - { - return pdataLeft->lastLaunch() > pdataRight->lastLaunch(); - } - else - { - return QString::localeAwareCompare(pdataLeft->name(), pdataRight->name()) < 0; - } -} diff --git a/application/InstanceProxyModel.h b/application/InstanceProxyModel.h deleted file mode 100644 index fab6f834..00000000 --- a/application/InstanceProxyModel.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once - -#include "groupview/GroupedProxyModel.h" - -/** - * A proxy model that is responsible for sorting instances into groups - */ -class InstanceProxyModel : public GroupedProxyModel -{ -public: - explicit InstanceProxyModel(QObject *parent = 0); - QVariant data(const QModelIndex & index, int role) const override; - -protected: - virtual bool subSortLessThan(const QModelIndex &left, const QModelIndex &right) const override; -}; diff --git a/application/InstanceWindow.cpp b/application/InstanceWindow.cpp deleted file mode 100644 index 015ffe1c..00000000 --- a/application/InstanceWindow.cpp +++ /dev/null @@ -1,236 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "InstanceWindow.h" -#include "MultiMC.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include "widgets/PageContainer.h" -#include "InstancePageProvider.h" - -#include "icons/IconList.h" - -InstanceWindow::InstanceWindow(InstancePtr instance, QWidget *parent) - : QMainWindow(parent), m_instance(instance) -{ - setAttribute(Qt::WA_DeleteOnClose); - - auto icon = MMC->icons()->getIcon(m_instance->iconKey()); - QString windowTitle = tr("Console window for ") + m_instance->name(); - - // Set window properties - { - setWindowIcon(icon); - setWindowTitle(windowTitle); - } - - // Add page container - { - auto provider = std::make_shared(m_instance); - m_container = new PageContainer(provider.get(), "console", this); - m_container->setParentContainer(this); - setCentralWidget(m_container); - setContentsMargins(0, 0, 0, 0); - } - - // Add custom buttons to the page container layout. - { - auto horizontalLayout = new QHBoxLayout(); - horizontalLayout->setObjectName(QStringLiteral("horizontalLayout")); - horizontalLayout->setContentsMargins(6, -1, 6, -1); - - auto btnHelp = new QPushButton(); - btnHelp->setText(tr("Help")); - horizontalLayout->addWidget(btnHelp); - connect(btnHelp, SIGNAL(clicked(bool)), m_container, SLOT(help())); - - auto spacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - horizontalLayout->addSpacerItem(spacer); - - m_killButton = new QPushButton(); - horizontalLayout->addWidget(m_killButton); - connect(m_killButton, SIGNAL(clicked(bool)), SLOT(on_btnKillMinecraft_clicked())); - - m_launchOfflineButton = new QPushButton(); - horizontalLayout->addWidget(m_launchOfflineButton); - m_launchOfflineButton->setText(tr("Launch Offline")); - updateLaunchButtons(); - connect(m_launchOfflineButton, SIGNAL(clicked(bool)), SLOT(on_btnLaunchMinecraftOffline_clicked())); - - m_closeButton = new QPushButton(); - m_closeButton->setText(tr("Close")); - horizontalLayout->addWidget(m_closeButton); - connect(m_closeButton, SIGNAL(clicked(bool)), SLOT(on_closeButton_clicked())); - - m_container->addButtons(horizontalLayout); - } - - // restore window state - { - auto base64State = MMC->settings()->get("ConsoleWindowState").toByteArray(); - restoreState(QByteArray::fromBase64(base64State)); - auto base64Geometry = MMC->settings()->get("ConsoleWindowGeometry").toByteArray(); - restoreGeometry(QByteArray::fromBase64(base64Geometry)); - } - - // set up instance and launch process recognition - { - auto launchTask = m_instance->getLaunchTask(); - on_InstanceLaunchTask_changed(launchTask); - connect(m_instance.get(), &BaseInstance::launchTaskChanged, this, &InstanceWindow::on_InstanceLaunchTask_changed); - connect(m_instance.get(), &BaseInstance::runningStatusChanged, this, &InstanceWindow::on_RunningState_changed); - } - - // set up instance destruction detection - { - connect(m_instance.get(), &BaseInstance::statusChanged, this, &InstanceWindow::on_instanceStatusChanged); - } - show(); -} - -void InstanceWindow::on_instanceStatusChanged(BaseInstance::Status, BaseInstance::Status newStatus) -{ - if(newStatus == BaseInstance::Status::Gone) - { - m_doNotSave = true; - close(); - } -} - -void InstanceWindow::updateLaunchButtons() -{ - if(m_instance->isRunning()) - { - m_launchOfflineButton->setEnabled(false); - m_killButton->setText(tr("Kill")); - m_killButton->setObjectName("killButton"); - m_killButton->setToolTip(tr("Kill the running instance")); - } - else if(!m_instance->canLaunch()) - { - m_launchOfflineButton->setEnabled(false); - m_killButton->setText(tr("Launch")); - m_killButton->setObjectName("launchButton"); - m_killButton->setToolTip(tr("Launch the instance")); - m_killButton->setEnabled(false); - } - else - { - m_launchOfflineButton->setEnabled(true); - m_killButton->setText(tr("Launch")); - m_killButton->setObjectName("launchButton"); - m_killButton->setToolTip(tr("Launch the instance")); - } - // NOTE: this is a hack to force the button to recalculate its style - m_killButton->setStyleSheet("/* */"); - m_killButton->setStyleSheet(QString()); -} - -void InstanceWindow::on_btnLaunchMinecraftOffline_clicked() -{ - MMC->launch(m_instance, false, nullptr); -} - -void InstanceWindow::on_InstanceLaunchTask_changed(shared_qobject_ptr proc) -{ - m_proc = proc; -} - -void InstanceWindow::on_RunningState_changed(bool running) -{ - updateLaunchButtons(); - m_container->refreshContainer(); - if(running) { - selectPage("log"); - } -} - -void InstanceWindow::on_closeButton_clicked() -{ - close(); -} - -void InstanceWindow::closeEvent(QCloseEvent *event) -{ - bool proceed = true; - if(!m_doNotSave) - { - proceed &= m_container->prepareToClose(); - } - - if(!proceed) - { - return; - } - - MMC->settings()->set("ConsoleWindowState", saveState().toBase64()); - MMC->settings()->set("ConsoleWindowGeometry", saveGeometry().toBase64()); - emit isClosing(); - event->accept(); -} - -bool InstanceWindow::saveAll() -{ - return m_container->saveAll(); -} - -void InstanceWindow::on_btnKillMinecraft_clicked() -{ - if(m_instance->isRunning()) - { - MMC->kill(m_instance); - } - else - { - MMC->launch(m_instance, true, nullptr); - } -} - -QString InstanceWindow::instanceId() -{ - return m_instance->id(); -} - -bool InstanceWindow::selectPage(QString pageId) -{ - return m_container->selectPage(pageId); -} - -void InstanceWindow::refreshContainer() -{ - m_container->refreshContainer(); -} - -InstanceWindow::~InstanceWindow() -{ -} - -bool InstanceWindow::requestClose() -{ - if(m_container->prepareToClose()) - { - close(); - return true; - } - return false; -} diff --git a/application/InstanceWindow.h b/application/InstanceWindow.h deleted file mode 100644 index cd7d2494..00000000 --- a/application/InstanceWindow.h +++ /dev/null @@ -1,73 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include "LaunchController.h" -#include -#include -#include "launch/LaunchTask.h" -#include "pages/BasePageContainer.h" - -class QPushButton; -class PageContainer; -class InstanceWindow : public QMainWindow, public BasePageContainer -{ - Q_OBJECT - -public: - explicit InstanceWindow(InstancePtr proc, QWidget *parent = 0); - virtual ~InstanceWindow(); - - bool selectPage(QString pageId) override; - void refreshContainer() override; - - QString instanceId(); - - // save all settings and changes (prepare for launch) - bool saveAll(); - - // request closing the window (from a page) - bool requestClose() override; - -signals: - void isClosing(); - -private -slots: - void on_closeButton_clicked(); - void on_btnKillMinecraft_clicked(); - void on_btnLaunchMinecraftOffline_clicked(); - - void on_InstanceLaunchTask_changed(shared_qobject_ptr proc); - void on_RunningState_changed(bool running); - void on_instanceStatusChanged(BaseInstance::Status, BaseInstance::Status newStatus); - -protected: - void closeEvent(QCloseEvent *) override; - -private: - void updateLaunchButtons(); - -private: - shared_qobject_ptr m_proc; - InstancePtr m_instance; - bool m_doNotSave = false; - PageContainer *m_container = nullptr; - QPushButton *m_closeButton = nullptr; - QPushButton *m_killButton = nullptr; - QPushButton *m_launchOfflineButton = nullptr; -}; diff --git a/application/JavaCommon.cpp b/application/JavaCommon.cpp deleted file mode 100644 index 92a058f0..00000000 --- a/application/JavaCommon.cpp +++ /dev/null @@ -1,104 +0,0 @@ -#include "JavaCommon.h" -#include "dialogs/CustomMessageBox.h" -#include - -bool JavaCommon::checkJVMArgs(QString jvmargs, QWidget *parent) -{ - if (jvmargs.contains("-XX:PermSize=") || jvmargs.contains(QRegExp("-Xm[sx]")) - || jvmargs.contains("-XX-MaxHeapSize") || jvmargs.contains("-XX:InitialHeapSize")) - { - auto warnStr = QObject::tr( - "You tried to manually set a JVM memory option (using \"-XX:PermSize\", \"-XX-MaxHeapSize\", \"-XX:InitialHeapSize\", \"-Xmx\" or \"-Xms\").\n" - "There are dedicated boxes for these in the settings (Java tab, in the Memory group at the top).\n" - "This message will be displayed until you remove them from the JVM arguments."); - CustomMessageBox::selectable( - parent, QObject::tr("JVM arguments warning"), - warnStr, - QMessageBox::Warning)->exec(); - return false; - } - return true; -} - -void JavaCommon::javaWasOk(QWidget *parent, JavaCheckResult result) -{ - QString text; - text += QObject::tr("Java test succeeded!
Platform reported: %1
Java version " - "reported: %2
Java vendor " - "reported: %3
").arg(result.realPlatform, result.javaVersion.toString(), result.javaVendor); - if (result.errorLog.size()) - { - auto htmlError = result.errorLog; - htmlError.replace('\n', "
"); - text += QObject::tr("
Warnings:
%1").arg(htmlError); - } - CustomMessageBox::selectable(parent, QObject::tr("Java test success"), text, QMessageBox::Information)->show(); -} - -void JavaCommon::javaArgsWereBad(QWidget *parent, JavaCheckResult result) -{ - auto htmlError = result.errorLog; - QString text; - htmlError.replace('\n', "
"); - text += QObject::tr("The specified java binary didn't work with the arguments you provided:
"); - text += QString("%1").arg(htmlError); - CustomMessageBox::selectable(parent, QObject::tr("Java test failure"), text, QMessageBox::Warning)->show(); -} - -void JavaCommon::javaBinaryWasBad(QWidget *parent, JavaCheckResult result) -{ - QString text; - text += QObject::tr( - "The specified java binary didn't work.
You should use the auto-detect feature, " - "or set the path to the java executable.
"); - CustomMessageBox::selectable(parent, QObject::tr("Java test failure"), text, QMessageBox::Warning)->show(); -} - -void JavaCommon::TestCheck::run() -{ - if (!JavaCommon::checkJVMArgs(m_args, m_parent)) - { - emit finished(); - return; - } - checker.reset(new JavaChecker()); - connect(checker.get(), SIGNAL(checkFinished(JavaCheckResult)), this, - SLOT(checkFinished(JavaCheckResult))); - checker->m_path = m_path; - checker->performCheck(); -} - -void JavaCommon::TestCheck::checkFinished(JavaCheckResult result) -{ - if (result.validity != JavaCheckResult::Validity::Valid) - { - javaBinaryWasBad(m_parent, result); - emit finished(); - return; - } - checker.reset(new JavaChecker()); - connect(checker.get(), SIGNAL(checkFinished(JavaCheckResult)), this, - SLOT(checkFinishedWithArgs(JavaCheckResult))); - checker->m_path = m_path; - checker->m_args = m_args; - checker->m_minMem = m_minMem; - checker->m_maxMem = m_maxMem; - if (result.javaVersion.requiresPermGen()) - { - checker->m_permGen = m_permGen; - } - checker->performCheck(); -} - -void JavaCommon::TestCheck::checkFinishedWithArgs(JavaCheckResult result) -{ - if (result.validity == JavaCheckResult::Validity::Valid) - { - javaWasOk(m_parent, result); - emit finished(); - return; - } - javaArgsWereBad(m_parent, result); - emit finished(); -} - diff --git a/application/JavaCommon.h b/application/JavaCommon.h deleted file mode 100644 index ca98145c..00000000 --- a/application/JavaCommon.h +++ /dev/null @@ -1,48 +0,0 @@ -#pragma once -#include - -class QWidget; - -/** - * Common UI bits for the java pages to use. - */ -namespace JavaCommon -{ - bool checkJVMArgs(QString args, QWidget *parent); - - // Show a dialog saying that the Java binary was not usable - void javaBinaryWasBad(QWidget *parent, JavaCheckResult result); - // Show a dialog saying that the Java binary was not usable because of bad options - void javaArgsWereBad(QWidget *parent, JavaCheckResult result); - // Show a dialog saying that the Java binary was usable - void javaWasOk(QWidget *parent, JavaCheckResult result); - - class TestCheck : public QObject - { - Q_OBJECT - public: - TestCheck(QWidget *parent, QString path, QString args, int minMem, int maxMem, int permGen) - :m_parent(parent), m_path(path), m_args(args), m_minMem(minMem), m_maxMem(maxMem), m_permGen(permGen) - { - } - virtual ~TestCheck() {}; - - void run(); - - signals: - void finished(); - - private slots: - void checkFinished(JavaCheckResult result); - void checkFinishedWithArgs(JavaCheckResult result); - - private: - std::shared_ptr checker; - QWidget *m_parent = nullptr; - QString m_path; - QString m_args; - int m_minMem = 0; - int m_maxMem = 0; - int m_permGen = 64; - }; -} diff --git a/application/KonamiCode.cpp b/application/KonamiCode.cpp deleted file mode 100644 index 46a2a0b2..00000000 --- a/application/KonamiCode.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "KonamiCode.h" - -#include -#include - -namespace { -const std::array konamiCode = -{ - { - Qt::Key_Up, Qt::Key_Up, - Qt::Key_Down, Qt::Key_Down, - Qt::Key_Left, Qt::Key_Right, - Qt::Key_Left, Qt::Key_Right, - Qt::Key_B, Qt::Key_A - } -}; -} - -KonamiCode::KonamiCode(QObject* parent) : QObject(parent) -{ -} - - -void KonamiCode::input(QEvent* event) -{ - if( event->type() == QEvent::KeyPress ) - { - QKeyEvent *keyEvent = static_cast( event ); - auto key = Qt::Key(keyEvent->key()); - if(key == konamiCode[m_progress]) - { - m_progress ++; - } - else - { - m_progress = 0; - } - if(m_progress == static_cast(konamiCode.size())) - { - m_progress = 0; - emit triggered(); - } - } -} diff --git a/application/KonamiCode.h b/application/KonamiCode.h deleted file mode 100644 index 3d320ae7..00000000 --- a/application/KonamiCode.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include - -class KonamiCode : public QObject -{ - Q_OBJECT -public: - KonamiCode(QObject *parent = 0); - void input(QEvent *event); - -signals: - void triggered(); - -private: - int m_progress = 0; -}; diff --git a/application/LaunchController.cpp b/application/LaunchController.cpp deleted file mode 100644 index ee764082..00000000 --- a/application/LaunchController.cpp +++ /dev/null @@ -1,353 +0,0 @@ -#include "LaunchController.h" -#include "MainWindow.h" -#include -#include "MultiMC.h" -#include "dialogs/CustomMessageBox.h" -#include "dialogs/ProfileSelectDialog.h" -#include "dialogs/ProgressDialog.h" -#include "dialogs/EditAccountDialog.h" -#include "InstanceWindow.h" -#include "BuildConfig.h" -#include "JavaCommon.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -LaunchController::LaunchController(QObject *parent) : Task(parent) -{ -} - -void LaunchController::executeTask() -{ - if (!m_instance) - { - emitFailed(tr("No instance specified!")); - return; - } - - login(); -} - -// FIXME: minecraft specific -void LaunchController::login() -{ - JavaCommon::checkJVMArgs(m_instance->settings()->get("JvmArgs").toString(), m_parentWidget); - - // Find an account to use. - std::shared_ptr accounts = MMC->accounts(); - MojangAccountPtr account = accounts->activeAccount(); - if (accounts->count() <= 0) - { - // Tell the user they need to log in at least one account in order to play. - auto reply = CustomMessageBox::selectable( - m_parentWidget, tr("No Accounts"), - tr("In order to play Minecraft, you must have at least one Mojang or Minecraft " - "account logged in to MultiMC." - "Would you like to open the account manager to add an account now?"), - QMessageBox::Information, QMessageBox::Yes | QMessageBox::No)->exec(); - - if (reply == QMessageBox::Yes) - { - // Open the account manager. - MMC->ShowGlobalSettings(m_parentWidget, "accounts"); - } - } - else if (account.get() == nullptr) - { - // If no default account is set, ask the user which one to use. - ProfileSelectDialog selectDialog(tr("Which profile would you like to use?"), - ProfileSelectDialog::GlobalDefaultCheckbox, m_parentWidget); - - selectDialog.exec(); - - // Launch the instance with the selected account. - account = selectDialog.selectedAccount(); - - // If the user said to use the account as default, do that. - if (selectDialog.useAsGlobalDefault() && account.get() != nullptr) - accounts->setActiveAccount(account->username()); - } - - // if no account is selected, we bail - if (!account.get()) - { - emitFailed(tr("No account selected for launch.")); - return; - } - - // we try empty password first :) - QString password; - // we loop until the user succeeds in logging in or gives up - bool tryagain = true; - // the failure. the default failure. - const QString needLoginAgain = tr("Your account is currently not logged in. Please enter your password to log in again.

This could be caused by a password change."); - QString failReason = needLoginAgain; - - while (tryagain) - { - m_session = std::make_shared(); - m_session->wants_online = m_online; - auto task = account->login(m_session, password); - if (task) - { - // We'll need to validate the access token to make sure the account - // is still logged in. - ProgressDialog progDialog(m_parentWidget); - if (m_online) - { - progDialog.setSkipButton(true, tr("Play Offline")); - } - progDialog.execWithTask(task.get()); - if (!task->wasSuccessful()) - { - auto failReasonNew = task->failReason(); - if(failReasonNew == "Invalid token.") - { - account->invalidateClientToken(); - failReason = needLoginAgain; - } - else failReason = failReasonNew; - } - } - switch (m_session->status) - { - case AuthSession::Undetermined: - { - qCritical() << "Received undetermined session status during login. Bye."; - tryagain = false; - emitFailed(tr("Received undetermined session status during login.")); - break; - } - case AuthSession::RequiresPassword: - { - EditAccountDialog passDialog(failReason, m_parentWidget, EditAccountDialog::PasswordField); - auto username = m_session->username; - auto chopN = [](QString toChop, int N) -> QString - { - if(toChop.size() > N) - { - auto left = toChop.left(N); - left += QString("\u25CF").repeated(toChop.size() - N); - return left; - } - return toChop; - }; - - if(username.contains('@')) - { - auto parts = username.split('@'); - auto mailbox = chopN(parts[0],3); - QString domain = chopN(parts[1], 3); - username = mailbox + '@' + domain; - } - passDialog.setUsername(username); - if (passDialog.exec() == QDialog::Accepted) - { - password = passDialog.password(); - } - else - { - tryagain = false; - } - break; - } - case AuthSession::PlayableOffline: - { - // we ask the user for a player name - bool ok = false; - QString usedname = m_session->player_name; - QString name = QInputDialog::getText(m_parentWidget, tr("Player name"), - tr("Choose your offline mode player name."), - QLineEdit::Normal, m_session->player_name, &ok); - if (!ok) - { - tryagain = false; - break; - } - if (name.length()) - { - usedname = name; - } - m_session->MakeOffline(usedname); - // offline flavored game from here :3 - } - case AuthSession::PlayableOnline: - { - launchInstance(); - tryagain = false; - return; - } - } - } - emitFailed(tr("Failed to launch.")); -} - -void LaunchController::launchInstance() -{ - Q_ASSERT_X(m_instance != NULL, "launchInstance", "instance is NULL"); - Q_ASSERT_X(m_session.get() != nullptr, "launchInstance", "session is NULL"); - - if(!m_instance->reloadSettings()) - { - QMessageBox::critical(m_parentWidget, tr("Error!"), tr("Couldn't load the instance profile.")); - emitFailed(tr("Couldn't load the instance profile.")); - return; - } - - m_launcher = m_instance->createLaunchTask(m_session, m_serverToJoin); - if (!m_launcher) - { - emitFailed(tr("Couldn't instantiate a launcher.")); - return; - } - - auto console = qobject_cast(m_parentWidget); - auto showConsole = m_instance->settings()->get("ShowConsole").toBool(); - if(!console && showConsole) - { - MMC->showInstanceWindow(m_instance); - } - connect(m_launcher.get(), &LaunchTask::readyForLaunch, this, &LaunchController::readyForLaunch); - connect(m_launcher.get(), &LaunchTask::succeeded, this, &LaunchController::onSucceeded); - connect(m_launcher.get(), &LaunchTask::failed, this, &LaunchController::onFailed); - connect(m_launcher.get(), &LaunchTask::requestProgress, this, &LaunchController::onProgressRequested); - - // Prepend Online and Auth Status - QString online_mode; - if(m_session->wants_online) { - online_mode = "online"; - - // Prepend Server Status - QStringList servers = {"authserver.mojang.com", "session.minecraft.net", "textures.minecraft.net", "api.mojang.com"}; - QString resolved_servers = ""; - QHostInfo host_info; - - for(QString server : servers) { - host_info = QHostInfo::fromName(server); - resolved_servers = resolved_servers + server + " resolves to:\n ["; - if(!host_info.addresses().isEmpty()) { - for(QHostAddress address : host_info.addresses()) { - resolved_servers = resolved_servers + address.toString(); - if(!host_info.addresses().endsWith(address)) { - resolved_servers = resolved_servers + ", "; - } - } - } else { - resolved_servers = resolved_servers + "N/A"; - } - resolved_servers = resolved_servers + "]\n\n"; - } - m_launcher->prependStep(new TextPrint(m_launcher.get(), resolved_servers, MessageLevel::MultiMC)); - } else { - online_mode = "offline"; - } - - QString auth_server_status; - if(m_session->auth_server_online) { - auth_server_status = "online"; - } else { - auth_server_status = "offline"; - } - - m_launcher->prependStep(new TextPrint(m_launcher.get(), "Launched instance in " + online_mode + " mode\nAuthentication server is " + auth_server_status + "\n", MessageLevel::MultiMC)); - - // Prepend Version - m_launcher->prependStep(new TextPrint(m_launcher.get(), "MultiMC version: " + BuildConfig.printableVersionString() + "\n\n", MessageLevel::MultiMC)); - m_launcher->start(); -} - -void LaunchController::readyForLaunch() -{ - if (!m_profiler) - { - m_launcher->proceed(); - return; - } - - QString error; - if (!m_profiler->check(&error)) - { - m_launcher->abort(); - QMessageBox::critical(m_parentWidget, tr("Error!"), tr("Couldn't start profiler: %1").arg(error)); - emitFailed("Profiler startup failed!"); - return; - } - BaseProfiler *profilerInstance = m_profiler->createProfiler(m_launcher->instance(), this); - - connect(profilerInstance, &BaseProfiler::readyToLaunch, [this](const QString & message) - { - QMessageBox msg; - msg.setText(tr("The game launch is delayed until you press the " - "button. This is the right time to setup the profiler, as the " - "profiler server is running now.\n\n%1").arg(message)); - msg.setWindowTitle(tr("Waiting.")); - msg.setIcon(QMessageBox::Information); - msg.addButton(tr("Launch"), QMessageBox::AcceptRole); - msg.setModal(true); - msg.exec(); - m_launcher->proceed(); - }); - connect(profilerInstance, &BaseProfiler::abortLaunch, [this](const QString & message) - { - QMessageBox msg; - msg.setText(tr("Couldn't start the profiler: %1").arg(message)); - msg.setWindowTitle(tr("Error")); - msg.setIcon(QMessageBox::Critical); - msg.addButton(QMessageBox::Ok); - msg.setModal(true); - msg.exec(); - m_launcher->abort(); - emitFailed("Profiler startup failed!"); - }); - profilerInstance->beginProfiling(m_launcher); -} - -void LaunchController::onSucceeded() -{ - emitSucceeded(); -} - -void LaunchController::onFailed(QString reason) -{ - if(m_instance->settings()->get("ShowConsoleOnError").toBool()) - { - MMC->showInstanceWindow(m_instance, "console"); - } - emitFailed(reason); -} - -void LaunchController::onProgressRequested(Task* task) -{ - ProgressDialog progDialog(m_parentWidget); - progDialog.setSkipButton(true, tr("Abort")); - m_launcher->proceed(); - progDialog.execWithTask(task); -} - -bool LaunchController::abort() -{ - if(!m_launcher) - { - return true; - } - if(!m_launcher->canAbort()) - { - return false; - } - auto response = CustomMessageBox::selectable( - m_parentWidget, tr("Kill Minecraft?"), - tr("This can cause the instance to get corrupted and should only be used if Minecraft " - "is frozen for some reason"), - QMessageBox::Question, QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes)->exec(); - if (response == QMessageBox::Yes) - { - return m_launcher->abort(); - } - return false; -} diff --git a/application/LaunchController.h b/application/LaunchController.h deleted file mode 100644 index 5f177e00..00000000 --- a/application/LaunchController.h +++ /dev/null @@ -1,68 +0,0 @@ -#pragma once -#include -#include -#include - -#include "minecraft/launch/MinecraftServerTarget.h" - -class InstanceWindow; -class LaunchController: public Task -{ - Q_OBJECT -public: - void executeTask() override; - - LaunchController(QObject * parent = nullptr); - virtual ~LaunchController(){}; - - void setInstance(InstancePtr instance) - { - m_instance = instance; - } - InstancePtr instance() - { - return m_instance; - } - void setOnline(bool online) - { - m_online = online; - } - void setProfiler(BaseProfilerFactory *profiler) - { - m_profiler = profiler; - } - void setParentWidget(QWidget * widget) - { - m_parentWidget = widget; - } - void setServerToJoin(MinecraftServerTargetPtr serverToJoin) - { - m_serverToJoin = std::move(serverToJoin); - } - QString id() - { - return m_instance->id(); - } - bool abort() override; - -private: - void login(); - void launchInstance(); - -private slots: - void readyForLaunch(); - - void onSucceeded(); - void onFailed(QString reason); - void onProgressRequested(Task *task); - -private: - BaseProfilerFactory *m_profiler = nullptr; - bool m_online = true; - InstancePtr m_instance; - QWidget * m_parentWidget = nullptr; - InstanceWindow *m_console = nullptr; - AuthSessionPtr m_session; - shared_qobject_ptr m_launcher; - MinecraftServerTargetPtr m_serverToJoin; -}; diff --git a/application/MainWindow.cpp b/application/MainWindow.cpp deleted file mode 100644 index 9225193e..00000000 --- a/application/MainWindow.cpp +++ /dev/null @@ -1,1952 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Authors: Andrew Okin - * Peterix - * Orochimarufan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "MultiMC.h" -#include "BuildConfig.h" - -#include "MainWindow.h" - -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "InstanceWindow.h" -#include "InstancePageProvider.h" -#include "InstanceProxyModel.h" -#include "JavaCommon.h" -#include "LaunchController.h" -#include "groupview/GroupView.h" -#include "groupview/InstanceDelegate.h" -#include "widgets/LabeledToolButton.h" -#include "widgets/ServerStatus.h" -#include "dialogs/NewInstanceDialog.h" -#include "dialogs/ProgressDialog.h" -#include "dialogs/AboutDialog.h" -#include "dialogs/VersionSelectDialog.h" -#include "dialogs/CustomMessageBox.h" -#include "dialogs/IconPickerDialog.h" -#include "dialogs/CopyInstanceDialog.h" -#include "dialogs/UpdateDialog.h" -#include "dialogs/EditAccountDialog.h" -#include "dialogs/NotificationDialog.h" -#include "dialogs/ExportInstanceDialog.h" -#include -#include "UpdateController.h" -#include "KonamiCode.h" -#include - -// WHY: to hold the pre-translation strings together with the T pointer, so it can be retranslated without a lot of ugly code -template -class Translated -{ -public: - Translated(){} - Translated(QWidget *parent) - { - m_contained = new T(parent); - } - void setTooltipId(const char * tooltip) - { - m_tooltip = tooltip; - } - void setTextId(const char * text) - { - m_text = text; - } - operator T*() - { - return m_contained; - } - T * operator->() - { - return m_contained; - } - void retranslate() - { - if(m_text) - { - m_contained->setText(QApplication::translate("MainWindow", m_text)); - } - if(m_tooltip) - { - m_contained->setToolTip(QApplication::translate("MainWindow", m_tooltip)); - } - } -private: - T * m_contained = nullptr; - const char * m_text = nullptr; - const char * m_tooltip = nullptr; -}; -using TranslatedAction = Translated; -using TranslatedToolButton = Translated; - -class TranslatedToolbar -{ -public: - TranslatedToolbar(){} - TranslatedToolbar(QWidget *parent) - { - m_contained = new QToolBar(parent); - } - void setWindowTitleId(const char * title) - { - m_title = title; - } - operator QToolBar*() - { - return m_contained; - } - QToolBar * operator->() - { - return m_contained; - } - void retranslate() - { - if(m_title) - { - m_contained->setWindowTitle(QApplication::translate("MainWindow", m_title)); - } - } -private: - QToolBar * m_contained = nullptr; - const char * m_title = nullptr; -}; - -class MainWindow::Ui -{ -public: - TranslatedAction actionAddInstance; - //TranslatedAction actionRefresh; - TranslatedAction actionCheckUpdate; - TranslatedAction actionSettings; - TranslatedAction actionPatreon; - TranslatedAction actionMoreNews; - TranslatedAction actionManageAccounts; - TranslatedAction actionLaunchInstance; - TranslatedAction actionRenameInstance; - TranslatedAction actionChangeInstGroup; - TranslatedAction actionChangeInstIcon; - TranslatedAction actionEditInstNotes; - TranslatedAction actionEditInstance; - TranslatedAction actionWorlds; - TranslatedAction actionViewSelectedInstFolder; - TranslatedAction actionViewSelectedMCFolder; - TranslatedAction actionDeleteInstance; - TranslatedAction actionConfig_Folder; - TranslatedAction actionCAT; - TranslatedAction actionCopyInstance; - TranslatedAction actionLaunchInstanceOffline; - TranslatedAction actionScreenshots; - TranslatedAction actionExportInstance; - QVector all_actions; - - LabeledToolButton *renameButton = nullptr; - LabeledToolButton *changeIconButton = nullptr; - - QMenu * foldersMenu = nullptr; - TranslatedToolButton foldersMenuButton; - TranslatedAction actionViewInstanceFolder; - TranslatedAction actionViewCentralModsFolder; - - QMenu * helpMenu = nullptr; - TranslatedToolButton helpMenuButton; - TranslatedAction actionReportBug; - TranslatedAction actionDISCORD; - TranslatedAction actionREDDIT; - TranslatedAction actionAbout; - - QVector all_toolbuttons; - - QWidget *centralWidget = nullptr; - QHBoxLayout *horizontalLayout = nullptr; - QStatusBar *statusBar = nullptr; - - TranslatedToolbar mainToolBar; - TranslatedToolbar instanceToolBar; - TranslatedToolbar newsToolBar; - QVector all_toolbars; - bool m_kill = false; - - void updateLaunchAction() - { - if(m_kill) - { - actionLaunchInstance.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Kill")); - actionLaunchInstance.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Kill the running instance")); - } - else - { - actionLaunchInstance.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Launch")); - actionLaunchInstance.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Launch the selected instance.")); - } - actionLaunchInstance.retranslate(); - } - void setLaunchAction(bool kill) - { - m_kill = kill; - updateLaunchAction(); - } - - void createMainToolbar(QMainWindow *MainWindow) - { - mainToolBar = TranslatedToolbar(MainWindow); - mainToolBar->setObjectName(QStringLiteral("mainToolBar")); - mainToolBar->setMovable(false); - mainToolBar->setAllowedAreas(Qt::TopToolBarArea); - mainToolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - mainToolBar->setFloatable(false); - mainToolBar.setWindowTitleId(QT_TRANSLATE_NOOP("MainWindow", "Main Toolbar")); - - actionAddInstance = TranslatedAction(MainWindow); - actionAddInstance->setObjectName(QStringLiteral("actionAddInstance")); - actionAddInstance->setIcon(MMC->getThemedIcon("new")); - actionAddInstance.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Add Instance")); - actionAddInstance.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Add a new instance.")); - all_actions.append(&actionAddInstance); - mainToolBar->addAction(actionAddInstance); - - mainToolBar->addSeparator(); - - foldersMenu = new QMenu(MainWindow); - foldersMenu->setToolTipsVisible(true); - - actionViewInstanceFolder = TranslatedAction(MainWindow); - actionViewInstanceFolder->setObjectName(QStringLiteral("actionViewInstanceFolder")); - actionViewInstanceFolder->setIcon(MMC->getThemedIcon("viewfolder")); - actionViewInstanceFolder.setTextId(QT_TRANSLATE_NOOP("MainWindow", "View Instance Folder")); - actionViewInstanceFolder.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Open the instance folder in a file browser.")); - all_actions.append(&actionViewInstanceFolder); - foldersMenu->addAction(actionViewInstanceFolder); - - actionViewCentralModsFolder = TranslatedAction(MainWindow); - actionViewCentralModsFolder->setObjectName(QStringLiteral("actionViewCentralModsFolder")); - actionViewCentralModsFolder->setIcon(MMC->getThemedIcon("centralmods")); - actionViewCentralModsFolder.setTextId(QT_TRANSLATE_NOOP("MainWindow", "View Central Mods Folder")); - actionViewCentralModsFolder.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Open the central mods folder in a file browser.")); - all_actions.append(&actionViewCentralModsFolder); - foldersMenu->addAction(actionViewCentralModsFolder); - - foldersMenuButton = TranslatedToolButton(MainWindow); - foldersMenuButton.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Folders")); - foldersMenuButton.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Open one of the folders shared between instances.")); - foldersMenuButton->setMenu(foldersMenu); - foldersMenuButton->setPopupMode(QToolButton::InstantPopup); - foldersMenuButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - foldersMenuButton->setIcon(MMC->getThemedIcon("viewfolder")); - foldersMenuButton->setFocusPolicy(Qt::NoFocus); - all_toolbuttons.append(&foldersMenuButton); - QWidgetAction* foldersButtonAction = new QWidgetAction(MainWindow); - foldersButtonAction->setDefaultWidget(foldersMenuButton); - mainToolBar->addAction(foldersButtonAction); - - actionSettings = TranslatedAction(MainWindow); - actionSettings->setObjectName(QStringLiteral("actionSettings")); - actionSettings->setIcon(MMC->getThemedIcon("settings")); - actionSettings->setMenuRole(QAction::PreferencesRole); - actionSettings.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Settings")); - actionSettings.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Change settings.")); - all_actions.append(&actionSettings); - mainToolBar->addAction(actionSettings); - - helpMenu = new QMenu(MainWindow); - helpMenu->setToolTipsVisible(true); - - if (!BuildConfig.BUG_TRACKER_URL.isEmpty()) { - actionReportBug = TranslatedAction(MainWindow); - actionReportBug->setObjectName(QStringLiteral("actionReportBug")); - actionReportBug->setIcon(MMC->getThemedIcon("bug")); - actionReportBug.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Report a Bug")); - actionReportBug.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Open the bug tracker to report a bug with MultiMC.")); - all_actions.append(&actionReportBug); - helpMenu->addAction(actionReportBug); - } - - if (!BuildConfig.DISCORD_URL.isEmpty()) { - actionDISCORD = TranslatedAction(MainWindow); - actionDISCORD->setObjectName(QStringLiteral("actionDISCORD")); - actionDISCORD->setIcon(MMC->getThemedIcon("discord")); - actionDISCORD.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Discord")); - actionDISCORD.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Open MultiMC discord voice chat.")); - all_actions.append(&actionDISCORD); - helpMenu->addAction(actionDISCORD); - } - - if (!BuildConfig.SUBREDDIT_URL.isEmpty()) { - actionREDDIT = TranslatedAction(MainWindow); - actionREDDIT->setObjectName(QStringLiteral("actionREDDIT")); - actionREDDIT->setIcon(MMC->getThemedIcon("reddit-alien")); - actionREDDIT.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Reddit")); - actionREDDIT.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Open MultiMC subreddit.")); - all_actions.append(&actionREDDIT); - helpMenu->addAction(actionREDDIT); - } - - actionAbout = TranslatedAction(MainWindow); - actionAbout->setObjectName(QStringLiteral("actionAbout")); - actionAbout->setIcon(MMC->getThemedIcon("about")); - actionAbout->setMenuRole(QAction::AboutRole); - actionAbout.setTextId(QT_TRANSLATE_NOOP("MainWindow", "About MultiMC")); - actionAbout.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "View information about MultiMC.")); - all_actions.append(&actionAbout); - helpMenu->addAction(actionAbout); - - helpMenuButton = TranslatedToolButton(MainWindow); - helpMenuButton.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Help")); - helpMenuButton.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Get help with MultiMC or Minecraft.")); - helpMenuButton->setMenu(helpMenu); - helpMenuButton->setPopupMode(QToolButton::InstantPopup); - helpMenuButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - helpMenuButton->setIcon(MMC->getThemedIcon("help")); - helpMenuButton->setFocusPolicy(Qt::NoFocus); - all_toolbuttons.append(&helpMenuButton); - QWidgetAction* helpButtonAction = new QWidgetAction(MainWindow); - helpButtonAction->setDefaultWidget(helpMenuButton); - mainToolBar->addAction(helpButtonAction); - - if(BuildConfig.UPDATER_ENABLED) - { - actionCheckUpdate = TranslatedAction(MainWindow); - actionCheckUpdate->setObjectName(QStringLiteral("actionCheckUpdate")); - actionCheckUpdate->setIcon(MMC->getThemedIcon("checkupdate")); - actionCheckUpdate.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Update")); - actionCheckUpdate.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Check for new updates for MultiMC.")); - all_actions.append(&actionCheckUpdate); - mainToolBar->addAction(actionCheckUpdate); - } - - mainToolBar->addSeparator(); - - actionPatreon = TranslatedAction(MainWindow); - actionPatreon->setObjectName(QStringLiteral("actionPatreon")); - actionPatreon->setIcon(MMC->getThemedIcon("patreon")); - actionPatreon.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Support MultiMC")); - actionPatreon.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Open the MultiMC Patreon page.")); - all_actions.append(&actionPatreon); - mainToolBar->addAction(actionPatreon); - - actionCAT = TranslatedAction(MainWindow); - actionCAT->setObjectName(QStringLiteral("actionCAT")); - actionCAT->setCheckable(true); - actionCAT->setIcon(MMC->getThemedIcon("cat")); - actionCAT.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Meow")); - actionCAT.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "It's a fluffy kitty :3")); - actionCAT->setPriority(QAction::LowPriority); - all_actions.append(&actionCAT); - mainToolBar->addAction(actionCAT); - - // profile menu and its actions - actionManageAccounts = TranslatedAction(MainWindow); - actionManageAccounts->setObjectName(QStringLiteral("actionManageAccounts")); - actionManageAccounts.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Manage Accounts")); - // FIXME: no tooltip! - actionManageAccounts->setCheckable(false); - actionManageAccounts->setIcon(MMC->getThemedIcon("accounts")); - all_actions.append(&actionManageAccounts); - - all_toolbars.append(&mainToolBar); - MainWindow->addToolBar(Qt::TopToolBarArea, mainToolBar); - } - - void createStatusBar(QMainWindow *MainWindow) - { - statusBar = new QStatusBar(MainWindow); - statusBar->setObjectName(QStringLiteral("statusBar")); - MainWindow->setStatusBar(statusBar); - } - - void createNewsToolbar(QMainWindow *MainWindow) - { - newsToolBar = TranslatedToolbar(MainWindow); - newsToolBar->setObjectName(QStringLiteral("newsToolBar")); - newsToolBar->setMovable(false); - newsToolBar->setAllowedAreas(Qt::BottomToolBarArea); - newsToolBar->setIconSize(QSize(16, 16)); - newsToolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - newsToolBar->setFloatable(false); - newsToolBar->setWindowTitle(QT_TRANSLATE_NOOP("MainWindow", "News Toolbar")); - - actionMoreNews = TranslatedAction(MainWindow); - actionMoreNews->setObjectName(QStringLiteral("actionMoreNews")); - actionMoreNews->setIcon(MMC->getThemedIcon("news")); - actionMoreNews.setTextId(QT_TRANSLATE_NOOP("MainWindow", "More news...")); - actionMoreNews.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Open the MultiMC development blog to read more news about MultiMC.")); - all_actions.append(&actionMoreNews); - newsToolBar->addAction(actionMoreNews); - - all_toolbars.append(&newsToolBar); - MainWindow->addToolBar(Qt::BottomToolBarArea, newsToolBar); - } - - void createInstanceToolbar(QMainWindow *MainWindow) - { - instanceToolBar = TranslatedToolbar(MainWindow); - instanceToolBar->setObjectName(QStringLiteral("instanceToolBar")); - // disabled until we have an instance selected - instanceToolBar->setEnabled(false); - instanceToolBar->setAllowedAreas(Qt::LeftToolBarArea | Qt::RightToolBarArea); - instanceToolBar->setToolButtonStyle(Qt::ToolButtonTextOnly); - instanceToolBar->setFloatable(false); - instanceToolBar->setWindowTitle(QT_TRANSLATE_NOOP("MainWindow", "Instance Toolbar")); - - // NOTE: not added to toolbar, but used for instance context menu (right click) - actionChangeInstIcon = TranslatedAction(MainWindow); - actionChangeInstIcon->setObjectName(QStringLiteral("actionChangeInstIcon")); - actionChangeInstIcon->setIcon(QIcon(":/icons/instances/infinity")); - actionChangeInstIcon->setIconVisibleInMenu(true); - actionChangeInstIcon.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Change Icon")); - actionChangeInstIcon.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Change the selected instance's icon.")); - all_actions.append(&actionChangeInstIcon); - - changeIconButton = new LabeledToolButton(MainWindow); - changeIconButton->setObjectName(QStringLiteral("changeIconButton")); - changeIconButton->setIcon(MMC->getThemedIcon("news")); - changeIconButton->setToolTip(actionChangeInstIcon->toolTip()); - changeIconButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - instanceToolBar->addWidget(changeIconButton); - - // NOTE: not added to toolbar, but used for instance context menu (right click) - actionRenameInstance = TranslatedAction(MainWindow); - actionRenameInstance->setObjectName(QStringLiteral("actionRenameInstance")); - actionRenameInstance.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Rename")); - actionRenameInstance.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Rename the selected instance.")); - all_actions.append(&actionRenameInstance); - - // the rename label is inside the rename tool button - renameButton = new LabeledToolButton(MainWindow); - renameButton->setObjectName(QStringLiteral("renameButton")); - renameButton->setToolTip(actionRenameInstance->toolTip()); - renameButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - instanceToolBar->addWidget(renameButton); - - instanceToolBar->addSeparator(); - - actionLaunchInstance = TranslatedAction(MainWindow); - actionLaunchInstance->setObjectName(QStringLiteral("actionLaunchInstance")); - all_actions.append(&actionLaunchInstance); - instanceToolBar->addAction(actionLaunchInstance); - - actionLaunchInstanceOffline = TranslatedAction(MainWindow); - actionLaunchInstanceOffline->setObjectName(QStringLiteral("actionLaunchInstanceOffline")); - actionLaunchInstanceOffline.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Launch Offline")); - actionLaunchInstanceOffline.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Launch the selected instance in offline mode.")); - all_actions.append(&actionLaunchInstanceOffline); - instanceToolBar->addAction(actionLaunchInstanceOffline); - - instanceToolBar->addSeparator(); - - actionEditInstance = TranslatedAction(MainWindow); - actionEditInstance->setObjectName(QStringLiteral("actionEditInstance")); - actionEditInstance.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Edit Instance")); - actionEditInstance.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Change the instance settings, mods and versions.")); - all_actions.append(&actionEditInstance); - instanceToolBar->addAction(actionEditInstance); - - actionEditInstNotes = TranslatedAction(MainWindow); - actionEditInstNotes->setObjectName(QStringLiteral("actionEditInstNotes")); - actionEditInstNotes.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Edit Notes")); - actionEditInstNotes.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Edit the notes for the selected instance.")); - all_actions.append(&actionEditInstNotes); - instanceToolBar->addAction(actionEditInstNotes); - - actionWorlds = TranslatedAction(MainWindow); - actionWorlds->setObjectName(QStringLiteral("actionWorlds")); - actionWorlds.setTextId(QT_TRANSLATE_NOOP("MainWindow", "View Worlds")); - actionWorlds.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "View the worlds of this instance.")); - all_actions.append(&actionWorlds); - instanceToolBar->addAction(actionWorlds); - - actionScreenshots = TranslatedAction(MainWindow); - actionScreenshots->setObjectName(QStringLiteral("actionScreenshots")); - actionScreenshots.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Manage Screenshots")); - actionScreenshots.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "View and upload screenshots for this instance.")); - all_actions.append(&actionScreenshots); - instanceToolBar->addAction(actionScreenshots); - - actionChangeInstGroup = TranslatedAction(MainWindow); - actionChangeInstGroup->setObjectName(QStringLiteral("actionChangeInstGroup")); - actionChangeInstGroup.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Change Group")); - actionChangeInstGroup.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Change the selected instance's group.")); - all_actions.append(&actionChangeInstGroup); - instanceToolBar->addAction(actionChangeInstGroup); - - instanceToolBar->addSeparator(); - - actionViewSelectedMCFolder = TranslatedAction(MainWindow); - actionViewSelectedMCFolder->setObjectName(QStringLiteral("actionViewSelectedMCFolder")); - actionViewSelectedMCFolder.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Minecraft Folder")); - actionViewSelectedMCFolder.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Open the selected instance's minecraft folder in a file browser.")); - all_actions.append(&actionViewSelectedMCFolder); - instanceToolBar->addAction(actionViewSelectedMCFolder); - - actionConfig_Folder = TranslatedAction(MainWindow); - actionConfig_Folder->setObjectName(QStringLiteral("actionConfig_Folder")); - actionConfig_Folder.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Config Folder")); - actionConfig_Folder.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Open the instance's config folder.")); - all_actions.append(&actionConfig_Folder); - instanceToolBar->addAction(actionConfig_Folder); - - actionViewSelectedInstFolder = TranslatedAction(MainWindow); - actionViewSelectedInstFolder->setObjectName(QStringLiteral("actionViewSelectedInstFolder")); - actionViewSelectedInstFolder.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Instance Folder")); - actionViewSelectedInstFolder.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Open the selected instance's root folder in a file browser.")); - all_actions.append(&actionViewSelectedInstFolder); - instanceToolBar->addAction(actionViewSelectedInstFolder); - - instanceToolBar->addSeparator(); - - actionExportInstance = TranslatedAction(MainWindow); - actionExportInstance->setObjectName(QStringLiteral("actionExportInstance")); - actionExportInstance.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Export Instance")); - // FIXME: missing tooltip - all_actions.append(&actionExportInstance); - instanceToolBar->addAction(actionExportInstance); - - actionDeleteInstance = TranslatedAction(MainWindow); - actionDeleteInstance->setObjectName(QStringLiteral("actionDeleteInstance")); - actionDeleteInstance.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Delete")); - actionDeleteInstance.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Delete the selected instance.")); - all_actions.append(&actionDeleteInstance); - instanceToolBar->addAction(actionDeleteInstance); - - actionCopyInstance = TranslatedAction(MainWindow); - actionCopyInstance->setObjectName(QStringLiteral("actionCopyInstance")); - actionCopyInstance->setIcon(MMC->getThemedIcon("copy")); - actionCopyInstance.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Copy Instance")); - actionCopyInstance.setTooltipId(QT_TRANSLATE_NOOP("MainWindow", "Copy the selected instance.")); - all_actions.append(&actionCopyInstance); - instanceToolBar->addAction(actionCopyInstance); - - all_toolbars.append(&instanceToolBar); - MainWindow->addToolBar(Qt::RightToolBarArea, instanceToolBar); - } - - void setupUi(QMainWindow *MainWindow) - { - if (MainWindow->objectName().isEmpty()) - { - MainWindow->setObjectName(QStringLiteral("MainWindow")); - } - MainWindow->resize(800, 600); - MainWindow->setWindowIcon(MMC->getThemedIcon("logo")); - MainWindow->setWindowTitle("MultiMC 5"); -#ifndef QT_NO_ACCESSIBILITY - MainWindow->setAccessibleName("MultiMC"); -#endif - - createMainToolbar(MainWindow); - - centralWidget = new QWidget(MainWindow); - centralWidget->setObjectName(QStringLiteral("centralWidget")); - horizontalLayout = new QHBoxLayout(centralWidget); - horizontalLayout->setSpacing(0); - horizontalLayout->setObjectName(QStringLiteral("horizontalLayout")); - horizontalLayout->setSizeConstraint(QLayout::SetDefaultConstraint); - horizontalLayout->setContentsMargins(0, 0, 0, 0); - MainWindow->setCentralWidget(centralWidget); - - createStatusBar(MainWindow); - createNewsToolbar(MainWindow); - createInstanceToolbar(MainWindow); - - retranslateUi(MainWindow); - - QMetaObject::connectSlotsByName(MainWindow); - } // setupUi - - void retranslateUi(QMainWindow *MainWindow) - { - QString winTitle = tr("MultiMC 5 - Version %1").arg(BuildConfig.printableVersionString()); - if (!BuildConfig.BUILD_PLATFORM.isEmpty()) - { - winTitle += tr(" on %1", "on platform, as in operating system").arg(BuildConfig.BUILD_PLATFORM); - } - MainWindow->setWindowTitle(winTitle); - // all the actions - for(auto * item: all_actions) - { - item->retranslate(); - } - for(auto * item: all_toolbars) - { - item->retranslate(); - } - for(auto * item: all_toolbuttons) - { - item->retranslate(); - } - // submenu buttons - foldersMenuButton->setText(tr("Folders")); - helpMenuButton->setText(tr("Help")); - } // retranslateUi -}; - -MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new MainWindow::Ui) -{ - ui->setupUi(this); - - // OSX magic. - setUnifiedTitleAndToolBarOnMac(true); - - // Global shortcuts - { - // FIXME: This is kinda weird. and bad. We need some kind of managed shutdown. - auto q = new QShortcut(QKeySequence::Quit, this); - connect(q, SIGNAL(activated()), qApp, SLOT(quit())); - } - - // Konami Code - { - secretEventFilter = new KonamiCode(this); - connect(secretEventFilter, &KonamiCode::triggered, this, &MainWindow::konamiTriggered); - } - - // Add the news label to the news toolbar. - { - m_newsChecker.reset(new NewsChecker(BuildConfig.NEWS_RSS_URL)); - newsLabel = new QToolButton(); - newsLabel->setIcon(MMC->getThemedIcon("news")); - newsLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - newsLabel->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - newsLabel->setFocusPolicy(Qt::NoFocus); - ui->newsToolBar->insertWidget(ui->actionMoreNews, newsLabel); - QObject::connect(newsLabel, &QAbstractButton::clicked, this, &MainWindow::newsButtonClicked); - QObject::connect(m_newsChecker.get(), &NewsChecker::newsLoaded, this, &MainWindow::updateNewsLabel); - updateNewsLabel(); - } - - // Create the instance list widget - { - view = new GroupView(ui->centralWidget); - - view->setSelectionMode(QAbstractItemView::SingleSelection); - // FIXME: leaks ListViewDelegate - view->setItemDelegate(new ListViewDelegate(this)); - view->setFrameShape(QFrame::NoFrame); - // do not show ugly blue border on the mac - view->setAttribute(Qt::WA_MacShowFocusRect, false); - - view->installEventFilter(this); - view->setContextMenuPolicy(Qt::CustomContextMenu); - connect(view, &QWidget::customContextMenuRequested, this, &MainWindow::showInstanceContextMenu); - connect(view, &GroupView::droppedURLs, this, &MainWindow::droppedURLs, Qt::QueuedConnection); - - proxymodel = new InstanceProxyModel(this); - proxymodel->setSourceModel(MMC->instances().get()); - proxymodel->sort(0); - connect(proxymodel, &InstanceProxyModel::dataChanged, this, &MainWindow::instanceDataChanged); - - view->setModel(proxymodel); - view->setSourceOfGroupCollapseStatus([](const QString & groupName)->bool { - return MMC->instances()->isGroupCollapsed(groupName); - }); - connect(view, &GroupView::groupStateChanged, MMC->instances().get(), &InstanceList::on_GroupStateChanged); - ui->horizontalLayout->addWidget(view); - } - // The cat background - { - bool cat_enable = MMC->settings()->get("TheCat").toBool(); - ui->actionCAT->setChecked(cat_enable); - // NOTE: calling the operator like that is an ugly hack to appease ancient gcc... - connect(ui->actionCAT.operator->(), SIGNAL(toggled(bool)), SLOT(onCatToggled(bool))); - setCatBackground(cat_enable); - } - // start instance when double-clicked - connect(view, &GroupView::activated, this, &MainWindow::instanceActivated); - - // track the selection -- update the instance toolbar - connect(view->selectionModel(), &QItemSelectionModel::currentChanged, this, &MainWindow::instanceChanged); - - // track icon changes and update the toolbar! - connect(MMC->icons().get(), &IconList::iconUpdated, this, &MainWindow::iconUpdated); - - // model reset -> selection is invalid. All the instance pointers are wrong. - connect(MMC->instances().get(), &InstanceList::dataIsInvalid, this, &MainWindow::selectionBad); - - // handle newly added instances - connect(MMC->instances().get(), &InstanceList::instanceSelectRequest, this, &MainWindow::instanceSelectRequest); - - // When the global settings page closes, we want to know about it and update our state - connect(MMC, &MultiMC::globalSettingsClosed, this, &MainWindow::globalSettingsClosed); - - m_statusLeft = new QLabel(tr("No instance selected"), this); - m_statusCenter = new QLabel(tr("Total playtime: 0s."), this); - m_statusRight = new ServerStatus(this); - statusBar()->addPermanentWidget(m_statusLeft, 1); - statusBar()->addPermanentWidget(m_statusCenter, 1); - statusBar()->addPermanentWidget(m_statusRight, 0); - - // Add "manage accounts" button, right align - QWidget *spacer = new QWidget(); - spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - ui->mainToolBar->addWidget(spacer); - - accountMenu = new QMenu(this); - - repopulateAccountsMenu(); - - accountMenuButton = new QToolButton(this); - accountMenuButton->setMenu(accountMenu); - accountMenuButton->setPopupMode(QToolButton::InstantPopup); - accountMenuButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - accountMenuButton->setIcon(MMC->getThemedIcon("noaccount")); - - QWidgetAction *accountMenuButtonAction = new QWidgetAction(this); - accountMenuButtonAction->setDefaultWidget(accountMenuButton); - - ui->mainToolBar->addAction(accountMenuButtonAction); - - // Update the menu when the active account changes. - // Shouldn't have to use lambdas here like this, but if I don't, the compiler throws a fit. - // Template hell sucks... - connect(MMC->accounts().get(), &MojangAccountList::activeAccountChanged, [this] - { - activeAccountChanged(); - }); - connect(MMC->accounts().get(), &MojangAccountList::listChanged, [this] - { - repopulateAccountsMenu(); - }); - - // Show initial account - activeAccountChanged(); - - auto accounts = MMC->accounts(); - - QList skin_dls; - for (int i = 0; i < accounts->count(); i++) - { - auto account = accounts->at(i); - if (!account) - { - qWarning() << "Null account at index" << i; - continue; - } - for (auto profile : account->profiles()) - { - auto meta = Env::getInstance().metacache()->resolveEntry("skins", profile.id + ".png"); - auto action = Net::Download::makeCached(QUrl(BuildConfig.SKINS_BASE + profile.id + ".png"), meta); - skin_dls.append(action); - meta->setStale(true); - } - } - if (!skin_dls.isEmpty()) - { - auto job = new NetJob("Startup player skins download"); - connect(job, &NetJob::succeeded, this, &MainWindow::skinJobFinished); - connect(job, &NetJob::failed, this, &MainWindow::skinJobFinished); - for (auto action : skin_dls) - { - job->addNetAction(action); - } - skin_download_job.reset(job); - job->start(); - } - - // load the news - { - m_newsChecker->reloadNews(); - updateNewsLabel(); - } - - - if(BuildConfig.UPDATER_ENABLED) - { - bool updatesAllowed = MMC->updatesAreAllowed(); - updatesAllowedChanged(updatesAllowed); - - // NOTE: calling the operator like that is an ugly hack to appease ancient gcc... - connect(ui->actionCheckUpdate.operator->(), &QAction::triggered, this, &MainWindow::checkForUpdates); - - // set up the updater object. - auto updater = MMC->updateChecker(); - connect(updater.get(), &UpdateChecker::updateAvailable, this, &MainWindow::updateAvailable); - connect(updater.get(), &UpdateChecker::noUpdateFound, this, &MainWindow::updateNotAvailable); - // if automatic update checks are allowed, start one. - if (MMC->settings()->get("AutoUpdate").toBool() && updatesAllowed) - { - updater->checkForUpdate(MMC->settings()->get("UpdateChannel").toString(), false); - } - } - - { - auto checker = new NotificationChecker(); - checker->setNotificationsUrl(QUrl(BuildConfig.NOTIFICATION_URL)); - checker->setApplicationChannel(BuildConfig.VERSION_CHANNEL); - checker->setApplicationPlatform(BuildConfig.BUILD_PLATFORM); - checker->setApplicationFullVersion(BuildConfig.FULL_VERSION_STR); - m_notificationChecker.reset(checker); - connect(m_notificationChecker.get(), &NotificationChecker::notificationCheckFinished, this, &MainWindow::notificationsChanged); - checker->checkForNotifications(); - } - - setSelectedInstanceById(MMC->settings()->get("SelectedInstance").toString()); - - // removing this looks stupid - view->setFocus(); - - retranslateUi(); -} - -void MainWindow::retranslateUi() -{ - accountMenuButton->setText(tr("Profiles")); - - if (m_selectedInstance) { - m_statusLeft->setText(m_selectedInstance->getStatusbarDescription()); - } else { - m_statusLeft->setText(tr("No instance selected")); - } - - ui->retranslateUi(this); -} - -MainWindow::~MainWindow() -{ -} - -QMenu * MainWindow::createPopupMenu() -{ - QMenu* filteredMenu = QMainWindow::createPopupMenu(); - filteredMenu->removeAction( ui->mainToolBar->toggleViewAction() ); - return filteredMenu; -} - -void MainWindow::konamiTriggered() -{ - // ENV.enableFeature("NewModsPage"); - qDebug() << "Super Secret Mode ACTIVATED!"; -} - -void MainWindow::skinJobFinished() -{ - activeAccountChanged(); - skin_download_job.reset(); -} - -void MainWindow::showInstanceContextMenu(const QPoint &pos) -{ - QList actions; - - QAction *actionSep = new QAction("", this); - actionSep->setSeparator(true); - - bool onInstance = view->indexAt(pos).isValid(); - if (onInstance) - { - actions = ui->instanceToolBar->actions(); - - // replace the change icon widget with an actual action - actions.replace(0, ui->actionChangeInstIcon); - - // replace the rename widget with an actual action - actions.replace(1, ui->actionRenameInstance); - - // add header - actions.prepend(actionSep); - QAction *actionVoid = new QAction(m_selectedInstance->name(), this); - actionVoid->setEnabled(false); - actions.prepend(actionVoid); - } - else - { - auto group = view->groupNameAt(pos); - - QAction *actionVoid = new QAction("MultiMC", this); - actionVoid->setEnabled(false); - - QAction *actionCreateInstance = new QAction(tr("Create instance"), this); - actionCreateInstance->setToolTip(ui->actionAddInstance->toolTip()); - if(!group.isNull()) - { - QVariantMap data; - data["group"] = group; - actionCreateInstance->setData(data); - } - - connect(actionCreateInstance, SIGNAL(triggered(bool)), SLOT(on_actionAddInstance_triggered())); - - actions.prepend(actionSep); - actions.prepend(actionVoid); - actions.append(actionCreateInstance); - if(!group.isNull()) - { - QAction *actionDeleteGroup = new QAction(tr("Delete group '%1'").arg(group), this); - QVariantMap data; - data["group"] = group; - actionDeleteGroup->setData(data); - connect(actionDeleteGroup, SIGNAL(triggered(bool)), SLOT(deleteGroup())); - actions.append(actionDeleteGroup); - } - } - QMenu myMenu; - myMenu.addActions(actions); - /* - if (onInstance) - myMenu.setEnabled(m_selectedInstance->canLaunch()); - */ - myMenu.exec(view->mapToGlobal(pos)); -} - -void MainWindow::updateToolsMenu() -{ - QToolButton *launchButton = dynamic_cast(ui->instanceToolBar->widgetForAction(ui->actionLaunchInstance)); - QToolButton *launchOfflineButton = dynamic_cast(ui->instanceToolBar->widgetForAction(ui->actionLaunchInstanceOffline)); - - if(!m_selectedInstance || m_selectedInstance->isRunning()) - { - ui->actionLaunchInstance->setMenu(nullptr); - ui->actionLaunchInstanceOffline->setMenu(nullptr); - launchButton->setPopupMode(QToolButton::InstantPopup); - launchOfflineButton->setPopupMode(QToolButton::InstantPopup); - return; - } - - QMenu *launchMenu = ui->actionLaunchInstance->menu(); - QMenu *launchOfflineMenu = ui->actionLaunchInstanceOffline->menu(); - launchButton->setPopupMode(QToolButton::MenuButtonPopup); - launchOfflineButton->setPopupMode(QToolButton::MenuButtonPopup); - if (launchMenu) - { - launchMenu->clear(); - } - else - { - launchMenu = new QMenu(this); - } - if (launchOfflineMenu) { - launchOfflineMenu->clear(); - } - else - { - launchOfflineMenu = new QMenu(this); - } - - QAction *normalLaunch = launchMenu->addAction(tr("Launch")); - QAction *normalLaunchOffline = launchOfflineMenu->addAction(tr("Launch Offline")); - connect(normalLaunch, &QAction::triggered, [this]() - { - MMC->launch(m_selectedInstance, true); - }); - connect(normalLaunchOffline, &QAction::triggered, [this]() - { - MMC->launch(m_selectedInstance, false); - }); - QString profilersTitle = tr("Profilers"); - launchMenu->addSeparator()->setText(profilersTitle); - launchOfflineMenu->addSeparator()->setText(profilersTitle); - for (auto profiler : MMC->profilers().values()) - { - QAction *profilerAction = launchMenu->addAction(profiler->name()); - QAction *profilerOfflineAction = launchOfflineMenu->addAction(profiler->name()); - QString error; - if (!profiler->check(&error)) - { - profilerAction->setDisabled(true); - profilerOfflineAction->setDisabled(true); - QString profilerToolTip = tr("Profiler not setup correctly. Go into settings, \"External Tools\"."); - profilerAction->setToolTip(profilerToolTip); - profilerOfflineAction->setToolTip(profilerToolTip); - } - else - { - connect(profilerAction, &QAction::triggered, [this, profiler]() - { - MMC->launch(m_selectedInstance, true, profiler.get()); - }); - connect(profilerOfflineAction, &QAction::triggered, [this, profiler]() - { - MMC->launch(m_selectedInstance, false, profiler.get()); - }); - } - } - ui->actionLaunchInstance->setMenu(launchMenu); - ui->actionLaunchInstanceOffline->setMenu(launchOfflineMenu); -} - -QString profileInUseFilter(const QString & profile, bool used) -{ - if(used) - { - return profile + QObject::tr(" (in use)"); - } - else - { - return profile; - } -} - -void MainWindow::repopulateAccountsMenu() -{ - accountMenu->clear(); - - std::shared_ptr accounts = MMC->accounts(); - MojangAccountPtr active_account = accounts->activeAccount(); - - QString active_username = ""; - if (active_account != nullptr) - { - active_username = active_account->username(); - const AccountProfile *profile = active_account->currentProfile(); - // this can be called before accountMenuButton exists - if (profile != nullptr && accountMenuButton) - { - auto profileLabel = profileInUseFilter(profile->name, active_account->isInUse()); - accountMenuButton->setText(profileLabel); - } - } - - if (accounts->count() <= 0) - { - QAction *action = new QAction(tr("No accounts added!"), this); - action->setEnabled(false); - accountMenu->addAction(action); - } - else - { - // TODO: Nicer way to iterate? - for (int i = 0; i < accounts->count(); i++) - { - MojangAccountPtr account = accounts->at(i); - for (auto profile : account->profiles()) - { - auto profileLabel = profileInUseFilter(profile.name, account->isInUse()); - QAction *action = new QAction(profileLabel, this); - action->setData(account->username()); - action->setCheckable(true); - if (active_username == account->username()) - { - action->setChecked(true); - } - - action->setIcon(SkinUtils::getFaceFromCache(profile.id)); - accountMenu->addAction(action); - connect(action, SIGNAL(triggered(bool)), SLOT(changeActiveAccount())); - } - } - } - - accountMenu->addSeparator(); - - QAction *action = new QAction(tr("No Default Account"), this); - action->setCheckable(true); - action->setIcon(MMC->getThemedIcon("noaccount")); - action->setData(""); - if (active_username.isEmpty()) - { - action->setChecked(true); - } - - accountMenu->addAction(action); - connect(action, SIGNAL(triggered(bool)), SLOT(changeActiveAccount())); - - accountMenu->addSeparator(); - accountMenu->addAction(ui->actionManageAccounts); -} - -void MainWindow::updatesAllowedChanged(bool allowed) -{ - if(!BuildConfig.UPDATER_ENABLED) - { - return; - } - ui->actionCheckUpdate->setEnabled(allowed); -} - -/* - * Assumes the sender is a QAction - */ -void MainWindow::changeActiveAccount() -{ - QAction *sAction = (QAction *)sender(); - // Profile's associated Mojang username - // Will need to change when profiles are properly implemented - if (sAction->data().type() != QVariant::Type::String) - return; - - QVariant data = sAction->data(); - QString id = ""; - if (!data.isNull()) - { - id = data.toString(); - } - - MMC->accounts()->setActiveAccount(id); - - activeAccountChanged(); -} - -void MainWindow::activeAccountChanged() -{ - repopulateAccountsMenu(); - - MojangAccountPtr account = MMC->accounts()->activeAccount(); - - if (account != nullptr && account->username() != "") - { - const AccountProfile *profile = account->currentProfile(); - if (profile != nullptr) - { - auto profileLabel = profileInUseFilter(profile->name, account->isInUse()); - accountMenuButton->setIcon(SkinUtils::getFaceFromCache(profile->id)); - accountMenuButton->setText(profileLabel); - return; - } - } - - // Set the icon to the "no account" icon. - accountMenuButton->setIcon(MMC->getThemedIcon("noaccount")); - accountMenuButton->setText(tr("Profiles")); -} - -bool MainWindow::eventFilter(QObject *obj, QEvent *ev) -{ - if (obj == view) - { - if (ev->type() == QEvent::KeyPress) - { - secretEventFilter->input(ev); - QKeyEvent *keyEvent = static_cast(ev); - switch (keyEvent->key()) - { - /* - case Qt::Key_Enter: - case Qt::Key_Return: - activateInstance(m_selectedInstance); - return true; - */ - case Qt::Key_Delete: - on_actionDeleteInstance_triggered(); - return true; - case Qt::Key_F5: - refreshInstances(); - return true; - case Qt::Key_F2: - on_actionRenameInstance_triggered(); - return true; - default: - break; - } - } - } - return QMainWindow::eventFilter(obj, ev); -} - -void MainWindow::updateNewsLabel() -{ - if (m_newsChecker->isLoadingNews()) - { - newsLabel->setText(tr("Loading news...")); - newsLabel->setEnabled(false); - } - else - { - QList entries = m_newsChecker->getNewsEntries(); - if (entries.length() > 0) - { - newsLabel->setText(entries[0]->title); - newsLabel->setEnabled(true); - } - else - { - newsLabel->setText(tr("No news available.")); - newsLabel->setEnabled(false); - } - } -} - -void MainWindow::updateAvailable(GoUpdate::Status status) -{ - if(!MMC->updatesAreAllowed()) - { - updateNotAvailable(); - return; - } - UpdateDialog dlg(true, this); - UpdateAction action = (UpdateAction)dlg.exec(); - switch (action) - { - case UPDATE_LATER: - qDebug() << "Update will be installed later."; - break; - case UPDATE_NOW: - downloadUpdates(status); - break; - } -} - -void MainWindow::updateNotAvailable() -{ - UpdateDialog dlg(false, this); - dlg.exec(); -} - -QList stringToIntList(const QString &string) -{ - QStringList split = string.split(',', QString::SkipEmptyParts); - QList out; - for (int i = 0; i < split.size(); ++i) - { - out.append(split.at(i).toInt()); - } - return out; -} -QString intListToString(const QList &list) -{ - QStringList slist; - for (int i = 0; i < list.size(); ++i) - { - slist.append(QString::number(list.at(i))); - } - return slist.join(','); -} -void MainWindow::notificationsChanged() -{ - QList entries = m_notificationChecker->notificationEntries(); - QList shownNotifications = stringToIntList(MMC->settings()->get("ShownNotifications").toString()); - for (auto it = entries.begin(); it != entries.end(); ++it) - { - NotificationChecker::NotificationEntry entry = *it; - if (!shownNotifications.contains(entry.id)) - { - NotificationDialog dialog(entry, this); - if (dialog.exec() == NotificationDialog::DontShowAgain) - { - shownNotifications.append(entry.id); - } - } - } - MMC->settings()->set("ShownNotifications", intListToString(shownNotifications)); -} - -void MainWindow::downloadUpdates(GoUpdate::Status status) -{ - if(!MMC->updatesAreAllowed()) - { - return; - } - qDebug() << "Downloading updates."; - ProgressDialog updateDlg(this); - status.rootPath = MMC->root(); - - auto dlPath = FS::PathCombine(MMC->root(), "update", "XXXXXX"); - if (!FS::ensureFilePathExists(dlPath)) - { - CustomMessageBox::selectable(this, tr("Error"), tr("Couldn't create folder for update downloads:\n%1").arg(dlPath), QMessageBox::Warning)->show(); - } - GoUpdate::DownloadTask updateTask(status, dlPath, &updateDlg); - // If the task succeeds, install the updates. - if (updateDlg.execWithTask(&updateTask)) - { - /** - * NOTE: This disables launching instances until the update either succeeds (and this process exits) - * or the update fails (and the control leaves this scope). - */ - MMC->updateIsRunning(true); - UpdateController update(this, MMC->root(), updateTask.updateFilesDir(), updateTask.operations()); - update.installUpdates(); - MMC->updateIsRunning(false); - } - else - { - CustomMessageBox::selectable(this, tr("Error"), updateTask.failReason(), QMessageBox::Warning)->show(); - } -} - -void MainWindow::onCatToggled(bool state) -{ - setCatBackground(state); - MMC->settings()->set("TheCat", state); -} - -namespace { -template -T non_stupid_abs(T in) -{ - if (in < 0) - return -in; - return in; -} -} - -void MainWindow::setCatBackground(bool enabled) -{ - if (enabled) - { - QDateTime now = QDateTime::currentDateTime(); - QDateTime xmas(QDate(now.date().year(), 12, 25), QTime(0, 0)); - QString cat = (non_stupid_abs(now.daysTo(xmas)) <= 4) ? "catmas" : "kitteh"; - view->setStyleSheet(QString(R"( -GroupView -{ - background-image: url(:/backgrounds/%1); - background-attachment: fixed; - background-clip: padding; - background-position: top right; - background-repeat: none; - background-color:palette(base); -})").arg(cat)); - } - else - { - view->setStyleSheet(QString()); - } -} - -void MainWindow::runModalTask(Task *task) -{ - connect(task, &Task::failed, [this](QString reason) - { - CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show(); - }); - connect(task, &Task::succeeded, [this, task]() - { - QStringList warnings = task->warnings(); - if(warnings.count()) - { - CustomMessageBox::selectable(this, tr("Warnings"), warnings.join('\n'), QMessageBox::Warning)->show(); - } - }); - ProgressDialog loadDialog(this); - loadDialog.setSkipButton(true, tr("Abort")); - loadDialog.execWithTask(task); -} - -void MainWindow::instanceFromInstanceTask(InstanceTask *rawTask) -{ - unique_qobject_ptr task(MMC->instances()->wrapInstanceTask(rawTask)); - runModalTask(task.get()); -} - -void MainWindow::on_actionCopyInstance_triggered() -{ - if (!m_selectedInstance) - return; - - CopyInstanceDialog copyInstDlg(m_selectedInstance, this); - if (!copyInstDlg.exec()) - return; - - auto copyTask = new InstanceCopyTask(m_selectedInstance, copyInstDlg.shouldCopySaves(), copyInstDlg.shouldKeepPlaytime()); - copyTask->setName(copyInstDlg.instName()); - copyTask->setGroup(copyInstDlg.instGroup()); - copyTask->setIcon(copyInstDlg.iconKey()); - unique_qobject_ptr task(MMC->instances()->wrapInstanceTask(copyTask)); - runModalTask(task.get()); -} - -void MainWindow::finalizeInstance(InstancePtr inst) -{ - view->updateGeometries(); - setSelectedInstanceById(inst->id()); - if (MMC->accounts()->anyAccountIsValid()) - { - ProgressDialog loadDialog(this); - auto update = inst->createUpdateTask(Net::Mode::Online); - connect(update.get(), &Task::failed, [this](QString reason) - { - QString error = QString("Instance load failed: %1").arg(reason); - CustomMessageBox::selectable(this, tr("Error"), error, QMessageBox::Warning)->show(); - }); - if(update) - { - loadDialog.setSkipButton(true, tr("Abort")); - loadDialog.execWithTask(update.get()); - } - } - else - { - CustomMessageBox::selectable(this, tr("Error"), tr("MultiMC cannot download Minecraft or update instances unless you have at least " - "one account added.\nPlease add your Mojang or Minecraft account."), - QMessageBox::Warning) - ->show(); - } -} - -void MainWindow::addInstance(QString url) -{ - QString groupName; - do - { - QObject* obj = sender(); - if(!obj) - break; - QAction *action = qobject_cast(obj); - if(!action) - break; - auto map = action->data().toMap(); - if(!map.contains("group")) - break; - groupName = map["group"].toString(); - } while(0); - - if(groupName.isEmpty()) - { - groupName = MMC->settings()->get("LastUsedGroupForNewInstance").toString(); - } - - NewInstanceDialog newInstDlg(groupName, url, this); - if (!newInstDlg.exec()) - return; - - MMC->settings()->set("LastUsedGroupForNewInstance", newInstDlg.instGroup()); - - InstanceTask * creationTask = newInstDlg.extractTask(); - if(creationTask) - { - instanceFromInstanceTask(creationTask); - } -} - -void MainWindow::on_actionAddInstance_triggered() -{ - addInstance(); -} - -void MainWindow::droppedURLs(QList urls) -{ - for(auto & url:urls) - { - if(url.isLocalFile()) - { - addInstance(url.toLocalFile()); - } - else - { - addInstance(url.toString()); - } - // Only process one dropped file... - break; - } -} - -void MainWindow::on_actionREDDIT_triggered() -{ - DesktopServices::openUrl(QUrl(BuildConfig.SUBREDDIT_URL)); -} - -void MainWindow::on_actionDISCORD_triggered() -{ - DesktopServices::openUrl(QUrl(BuildConfig.DISCORD_URL)); -} - -void MainWindow::on_actionChangeInstIcon_triggered() -{ - if (!m_selectedInstance) - return; - - IconPickerDialog dlg(this); - dlg.execWithSelection(m_selectedInstance->iconKey()); - if (dlg.result() == QDialog::Accepted) - { - m_selectedInstance->setIconKey(dlg.selectedIconKey); - auto icon = MMC->icons()->getIcon(dlg.selectedIconKey); - ui->actionChangeInstIcon->setIcon(icon); - ui->changeIconButton->setIcon(icon); - } -} - -void MainWindow::iconUpdated(QString icon) -{ - if (icon == m_currentInstIcon) - { - auto icon = MMC->icons()->getIcon(m_currentInstIcon); - ui->actionChangeInstIcon->setIcon(icon); - ui->changeIconButton->setIcon(icon); - } -} - -void MainWindow::updateInstanceToolIcon(QString new_icon) -{ - m_currentInstIcon = new_icon; - auto icon = MMC->icons()->getIcon(m_currentInstIcon); - ui->actionChangeInstIcon->setIcon(icon); - ui->changeIconButton->setIcon(icon); -} - -void MainWindow::setSelectedInstanceById(const QString &id) -{ - if (id.isNull()) - return; - const QModelIndex index = MMC->instances()->getInstanceIndexById(id); - if (index.isValid()) - { - QModelIndex selectionIndex = proxymodel->mapFromSource(index); - view->selectionModel()->setCurrentIndex(selectionIndex, QItemSelectionModel::ClearAndSelect); - updateStatusCenter(); - } -} - -void MainWindow::on_actionChangeInstGroup_triggered() -{ - if (!m_selectedInstance) - return; - - bool ok = false; - InstanceId instId = m_selectedInstance->id(); - QString name(MMC->instances()->getInstanceGroup(instId)); - auto groups = MMC->instances()->getGroups(); - groups.insert(0, ""); - groups.sort(Qt::CaseInsensitive); - int foo = groups.indexOf(name); - - name = QInputDialog::getItem(this, tr("Group name"), tr("Enter a new group name."), groups, foo, true, &ok); - name = name.simplified(); - if (ok) - { - MMC->instances()->setInstanceGroup(instId, name); - } -} - -void MainWindow::deleteGroup() -{ - QObject* obj = sender(); - if(!obj) - return; - QAction *action = qobject_cast(obj); - if(!action) - return; - auto map = action->data().toMap(); - if(!map.contains("group")) - return; - QString groupName = map["group"].toString(); - if(!groupName.isEmpty()) - { - auto reply = QMessageBox::question(this, tr("Delete group"), tr("Are you sure you want to delete the group %1") - .arg(groupName), QMessageBox::Yes | QMessageBox::No); - if(reply == QMessageBox::Yes) - { - MMC->instances()->deleteGroup(groupName); - } - } -} - -void MainWindow::on_actionViewInstanceFolder_triggered() -{ - QString str = MMC->settings()->get("InstanceDir").toString(); - DesktopServices::openDirectory(str); -} - -void MainWindow::refreshInstances() -{ - MMC->instances()->loadList(); -} - -void MainWindow::on_actionViewCentralModsFolder_triggered() -{ - DesktopServices::openDirectory(MMC->settings()->get("CentralModsDir").toString(), true); -} - -void MainWindow::on_actionConfig_Folder_triggered() -{ - if (m_selectedInstance) - { - QString str = m_selectedInstance->instanceConfigFolder(); - DesktopServices::openDirectory(QDir(str).absolutePath()); - } -} - -void MainWindow::checkForUpdates() -{ - if(BuildConfig.UPDATER_ENABLED) - { - auto updater = MMC->updateChecker(); - updater->checkForUpdate(MMC->settings()->get("UpdateChannel").toString(), true); - } - else - { - qWarning() << "Updater not set up. Cannot check for updates."; - } -} - -void MainWindow::on_actionSettings_triggered() -{ - MMC->ShowGlobalSettings(this, "global-settings"); -} - -void MainWindow::globalSettingsClosed() -{ - // FIXME: quick HACK to make this work. improve, optimize. - MMC->instances()->loadList(); - proxymodel->invalidate(); - proxymodel->sort(0); - updateToolsMenu(); - update(); -} - -void MainWindow::on_actionInstanceSettings_triggered() -{ - MMC->showInstanceWindow(m_selectedInstance, "settings"); -} - -void MainWindow::on_actionEditInstNotes_triggered() -{ - MMC->showInstanceWindow(m_selectedInstance, "notes"); -} - -void MainWindow::on_actionWorlds_triggered() -{ - MMC->showInstanceWindow(m_selectedInstance, "worlds"); -} - -void MainWindow::on_actionEditInstance_triggered() -{ - MMC->showInstanceWindow(m_selectedInstance); -} - -void MainWindow::on_actionScreenshots_triggered() -{ - MMC->showInstanceWindow(m_selectedInstance, "screenshots"); -} - -void MainWindow::on_actionManageAccounts_triggered() -{ - MMC->ShowGlobalSettings(this, "accounts"); -} - -void MainWindow::on_actionReportBug_triggered() -{ - DesktopServices::openUrl(QUrl(BuildConfig.BUG_TRACKER_URL)); -} - -void MainWindow::on_actionPatreon_triggered() -{ - DesktopServices::openUrl(QUrl("https://www.patreon.com/multimc")); -} - -void MainWindow::on_actionMoreNews_triggered() -{ - DesktopServices::openUrl(QUrl("https://multimc.org/posts.html")); -} - -void MainWindow::newsButtonClicked() -{ - QList entries = m_newsChecker->getNewsEntries(); - if (entries.count() > 0) - { - DesktopServices::openUrl(QUrl(entries[0]->link)); - } - else - { - DesktopServices::openUrl(QUrl("https://multimc.org/posts.html")); - } -} - -void MainWindow::on_actionAbout_triggered() -{ - AboutDialog dialog(this); - dialog.exec(); -} - -void MainWindow::on_actionDeleteInstance_triggered() -{ - if (!m_selectedInstance) - { - return; - } - auto id = m_selectedInstance->id(); - auto response = CustomMessageBox::selectable( - this, - tr("CAREFUL!"), - tr("About to delete: %1\nThis is permanent and will completely delete the instance.\n\nAre you sure?").arg(m_selectedInstance->name()), - QMessageBox::Warning, - QMessageBox::Yes | QMessageBox::No, - QMessageBox::No - )->exec(); - if (response == QMessageBox::Yes) - { - MMC->instances()->deleteInstance(id); - } -} - -void MainWindow::on_actionExportInstance_triggered() -{ - if (m_selectedInstance) - { - ExportInstanceDialog dlg(m_selectedInstance, this); - dlg.exec(); - } -} - -void MainWindow::on_actionRenameInstance_triggered() -{ - if (m_selectedInstance) - { - view->edit(view->currentIndex()); - } -} - -void MainWindow::on_actionViewSelectedInstFolder_triggered() -{ - if (m_selectedInstance) - { - QString str = m_selectedInstance->instanceRoot(); - DesktopServices::openDirectory(QDir(str).absolutePath()); - } -} - -void MainWindow::on_actionViewSelectedMCFolder_triggered() -{ - if (m_selectedInstance) - { - QString str = m_selectedInstance->gameRoot(); - if (!FS::ensureFilePathExists(str)) - { - // TODO: report error - return; - } - DesktopServices::openDirectory(QDir(str).absolutePath()); - } -} - - -void MainWindow::closeEvent(QCloseEvent *event) -{ - // Save the window state and geometry. - MMC->settings()->set("MainWindowState", saveState().toBase64()); - MMC->settings()->set("MainWindowGeometry", saveGeometry().toBase64()); - event->accept(); - emit isClosing(); -} - -void MainWindow::changeEvent(QEvent* event) -{ - if (event->type() == QEvent::LanguageChange) - { - retranslateUi(); - } - QMainWindow::changeEvent(event); -} - -void MainWindow::instanceActivated(QModelIndex index) -{ - if (!index.isValid()) - return; - QString id = index.data(InstanceList::InstanceIDRole).toString(); - InstancePtr inst = MMC->instances()->getInstanceById(id); - if (!inst) - return; - - activateInstance(inst); -} - -void MainWindow::on_actionLaunchInstance_triggered() -{ - if (!m_selectedInstance) - { - return; - } - if(m_selectedInstance->isRunning()) - { - MMC->kill(m_selectedInstance); - } - else - { - MMC->launch(m_selectedInstance); - } -} - -void MainWindow::activateInstance(InstancePtr instance) -{ - MMC->launch(instance); -} - -void MainWindow::on_actionLaunchInstanceOffline_triggered() -{ - if (m_selectedInstance) - { - MMC->launch(m_selectedInstance, false); - } -} - -void MainWindow::taskEnd() -{ - QObject *sender = QObject::sender(); - if (sender == m_versionLoadTask) - m_versionLoadTask = NULL; - - sender->deleteLater(); -} - -void MainWindow::startTask(Task *task) -{ - connect(task, SIGNAL(succeeded()), SLOT(taskEnd())); - connect(task, SIGNAL(failed(QString)), SLOT(taskEnd())); - task->start(); -} - -void MainWindow::instanceChanged(const QModelIndex ¤t, const QModelIndex &previous) -{ - if (!current.isValid()) - { - MMC->settings()->set("SelectedInstance", QString()); - selectionBad(); - return; - } - QString id = current.data(InstanceList::InstanceIDRole).toString(); - m_selectedInstance = MMC->instances()->getInstanceById(id); - if (m_selectedInstance) - { - ui->instanceToolBar->setEnabled(true); - if(m_selectedInstance->isRunning()) - { - ui->actionLaunchInstance->setEnabled(true); - ui->setLaunchAction(true); - } - else - { - ui->actionLaunchInstance->setEnabled(m_selectedInstance->canLaunch()); - ui->setLaunchAction(false); - } - ui->actionLaunchInstanceOffline->setEnabled(m_selectedInstance->canLaunch()); - ui->actionExportInstance->setEnabled(m_selectedInstance->canExport()); - ui->renameButton->setText(m_selectedInstance->name()); - m_statusLeft->setText(m_selectedInstance->getStatusbarDescription()); - updateStatusCenter(); - updateInstanceToolIcon(m_selectedInstance->iconKey()); - - updateToolsMenu(); - - MMC->settings()->set("SelectedInstance", m_selectedInstance->id()); - } - else - { - ui->instanceToolBar->setEnabled(false); - MMC->settings()->set("SelectedInstance", QString()); - selectionBad(); - return; - } -} - -void MainWindow::instanceSelectRequest(QString id) -{ - setSelectedInstanceById(id); -} - -void MainWindow::instanceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) -{ - auto current = view->selectionModel()->currentIndex(); - QItemSelection test(topLeft, bottomRight); - if (test.contains(current)) - { - instanceChanged(current, current); - } -} - -void MainWindow::selectionBad() -{ - // start by reseting everything... - m_selectedInstance = nullptr; - - statusBar()->clearMessage(); - ui->instanceToolBar->setEnabled(false); - ui->renameButton->setText(tr("Rename Instance")); - updateInstanceToolIcon("infinity"); - - // ...and then see if we can enable the previously selected instance - setSelectedInstanceById(MMC->settings()->get("SelectedInstance").toString()); -} - -void MainWindow::checkInstancePathForProblems() -{ - QString instanceFolder = MMC->settings()->get("InstanceDir").toString(); - if (FS::checkProblemticPathJava(QDir(instanceFolder))) - { - QMessageBox warning(this); - warning.setText(tr("Your instance folder contains \'!\' and this is known to cause Java problems!")); - warning.setInformativeText(tr("You have now two options:
" - " - change the instance folder in the settings
" - " - move this installation of MultiMC5 to a different folder")); - warning.setDefaultButton(QMessageBox::Ok); - warning.exec(); - } - auto tempFolderText = tr("This is a problem:
" - " - MultiMC will likely be deleted without warning by the operating system
" - " - close MultiMC now and extract it to a real location, not a temporary folder"); - QString pathfoldername = QDir(instanceFolder).absolutePath(); - if (pathfoldername.contains("Rar$", Qt::CaseInsensitive)) - { - QMessageBox warning(this); - warning.setText(tr("Your instance folder contains \'Rar$\' - that means you haven't extracted the MultiMC zip!")); - warning.setInformativeText(tempFolderText); - warning.setDefaultButton(QMessageBox::Ok); - warning.exec(); - } - else if (pathfoldername.startsWith(QDir::tempPath()) || pathfoldername.contains("/TempState/")) - { - QMessageBox warning(this); - warning.setText(tr("Your instance folder is in a temporary folder: \'%1\'!").arg(QDir::tempPath())); - warning.setInformativeText(tempFolderText); - warning.setDefaultButton(QMessageBox::Ok); - warning.exec(); - } -} - -void MainWindow::updateStatusCenter() -{ - int timeplayed = MMC->instances()->getTotalPlayTime(); - int minutesTotal = timeplayed / 60; - int seconds = timeplayed % 60; - int minutes = minutesTotal % 60; - int hours = minutesTotal / 60; - if(hours != 0) - m_statusCenter->setText(tr("Total playtime: %1h %2m %3s").arg(hours).arg(minutes).arg(seconds)); - else if(minutes != 0) - m_statusCenter->setText(tr("Total playtime: %1m %2s").arg(minutes).arg(seconds)); - else if(seconds != 0) - m_statusCenter->setText(tr("Total playtime: %1s").arg(seconds)); -} diff --git a/application/MainWindow.h b/application/MainWindow.h deleted file mode 100644 index c992ab94..00000000 --- a/application/MainWindow.h +++ /dev/null @@ -1,226 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include -#include -#include - -#include "BaseInstance.h" -#include "minecraft/auth/MojangAccount.h" -#include "net/NetJob.h" -#include "updater/GoUpdate.h" - -class LaunchController; -class NewsChecker; -class NotificationChecker; -class QToolButton; -class InstanceProxyModel; -class LabeledToolButton; -class QLabel; -class MinecraftLauncher; -class BaseProfilerFactory; -class GroupView; -class ServerStatus; -class KonamiCode; -class InstanceTask; - -class MainWindow : public QMainWindow -{ - Q_OBJECT - - class Ui; - -public: - explicit MainWindow(QWidget *parent = 0); - ~MainWindow(); - - bool eventFilter(QObject *obj, QEvent *ev) override; - void closeEvent(QCloseEvent *event) override; - void changeEvent(QEvent * event) override; - - void checkInstancePathForProblems(); - - void updatesAllowedChanged(bool allowed); - - void droppedURLs(QList urls); -signals: - void isClosing(); - -protected: - QMenu * createPopupMenu() override; - -private slots: - void onCatToggled(bool); - - void on_actionAbout_triggered(); - - void on_actionAddInstance_triggered(); - - void on_actionREDDIT_triggered(); - - void on_actionDISCORD_triggered(); - - void on_actionCopyInstance_triggered(); - - void on_actionChangeInstGroup_triggered(); - - void on_actionChangeInstIcon_triggered(); - void on_changeIconButton_clicked(bool) - { - on_actionChangeInstIcon_triggered(); - } - - void on_actionViewInstanceFolder_triggered(); - - void on_actionConfig_Folder_triggered(); - - void on_actionViewSelectedInstFolder_triggered(); - - void on_actionViewSelectedMCFolder_triggered(); - - void refreshInstances(); - - void on_actionViewCentralModsFolder_triggered(); - - void checkForUpdates(); - - void on_actionSettings_triggered(); - - void on_actionInstanceSettings_triggered(); - - void on_actionManageAccounts_triggered(); - - void on_actionReportBug_triggered(); - - void on_actionPatreon_triggered(); - - void on_actionMoreNews_triggered(); - - void newsButtonClicked(); - - void on_actionLaunchInstance_triggered(); - - void on_actionLaunchInstanceOffline_triggered(); - - void on_actionDeleteInstance_triggered(); - - void deleteGroup(); - - void on_actionExportInstance_triggered(); - - void on_actionRenameInstance_triggered(); - void on_renameButton_clicked(bool) - { - on_actionRenameInstance_triggered(); - } - - void on_actionEditInstance_triggered(); - - void on_actionEditInstNotes_triggered(); - - void on_actionWorlds_triggered(); - - void on_actionScreenshots_triggered(); - - void taskEnd(); - - /** - * called when an icon is changed in the icon model. - */ - void iconUpdated(QString); - - void showInstanceContextMenu(const QPoint &); - - void updateToolsMenu(); - - void skinJobFinished(); - - void instanceActivated(QModelIndex); - - void instanceChanged(const QModelIndex ¤t, const QModelIndex &previous); - - void instanceSelectRequest(QString id); - - void instanceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); - - void selectionBad(); - - void startTask(Task *task); - - void updateAvailable(GoUpdate::Status status); - - void updateNotAvailable(); - - void notificationsChanged(); - - void activeAccountChanged(); - - void changeActiveAccount(); - - void repopulateAccountsMenu(); - - void updateNewsLabel(); - - /*! - * Runs the DownloadTask and installs updates. - */ - void downloadUpdates(GoUpdate::Status status); - - void konamiTriggered(); - - void globalSettingsClosed(); - -private: - void retranslateUi(); - - void addInstance(QString url = QString()); - void activateInstance(InstancePtr instance); - void setCatBackground(bool enabled); - void updateInstanceToolIcon(QString new_icon); - void setSelectedInstanceById(const QString &id); - void updateStatusCenter(); - - void runModalTask(Task *task); - void instanceFromInstanceTask(InstanceTask *task); - void finalizeInstance(InstancePtr inst); - -private: - std::unique_ptr ui; - - // these are managed by Qt's memory management model! - GroupView *view = nullptr; - InstanceProxyModel *proxymodel = nullptr; - QToolButton *newsLabel = nullptr; - QLabel *m_statusLeft = nullptr; - QLabel *m_statusCenter = nullptr; - ServerStatus *m_statusRight = nullptr; - QMenu *accountMenu = nullptr; - QToolButton *accountMenuButton = nullptr; - KonamiCode * secretEventFilter = nullptr; - - unique_qobject_ptr skin_download_job; - unique_qobject_ptr m_newsChecker; - unique_qobject_ptr m_notificationChecker; - - InstancePtr m_selectedInstance; - QString m_currentInstIcon; - - // managed by the application object - Task *m_versionLoadTask = nullptr; -}; diff --git a/application/MultiMC.cpp b/application/MultiMC.cpp deleted file mode 100644 index 932c7a76..00000000 --- a/application/MultiMC.cpp +++ /dev/null @@ -1,1448 +0,0 @@ -#include "MultiMC.h" -#include "BuildConfig.h" -#include "MainWindow.h" -#include "InstanceWindow.h" - -#include "groupview/AccessibleGroupView.h" -#include - -#include "pages/BasePageProvider.h" -#include "pages/global/MultiMCPage.h" -#include "pages/global/MinecraftPage.h" -#include "pages/global/JavaPage.h" -#include "pages/global/LanguagePage.h" -#include "pages/global/ProxyPage.h" -#include "pages/global/ExternalToolsPage.h" -#include "pages/global/AccountListPage.h" -#include "pages/global/PasteEEPage.h" -#include "pages/global/CustomCommandsPage.h" - -#include "themes/ITheme.h" -#include "themes/SystemTheme.h" -#include "themes/DarkTheme.h" -#include "themes/BrightTheme.h" -#include "themes/CustomTheme.h" - -#include "setupwizard/SetupWizard.h" -#include "setupwizard/LanguageWizardPage.h" -#include "setupwizard/JavaWizardPage.h" -#include "setupwizard/AnalyticsWizardPage.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "dialogs/CustomMessageBox.h" -#include "InstanceList.h" - -#include -#include "icons/IconList.h" -#include "net/HttpMetaCache.h" -#include "Env.h" - -#include "java/JavaUtils.h" - -#include "updater/UpdateChecker.h" - -#include "tools/JProfiler.h" -#include "tools/JVisualVM.h" -#include "tools/MCEditTool.h" - -#include -#include "settings/INISettingsObject.h" -#include "settings/Setting.h" - -#include "translations/TranslationsModel.h" - -#include -#include -#include -#include - -#include -#include - -#include "pagedialog/PageDialog.h" - - -#if defined Q_OS_WIN32 -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#include -#endif - -#define STRINGIFY(x) #x -#define TOSTRING(x) STRINGIFY(x) - -static const QLatin1String liveCheckFile("live.check"); - -using namespace Commandline; - -#define MACOS_HINT "If you are on macOS Sierra, you might have to move MultiMC.app to your /Applications or ~/Applications folder. "\ - "This usually fixes the problem and you can move the application elsewhere afterwards.\n"\ - "\n" - -static void appDebugOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) -{ - const char *levels = "DWCFIS"; - const QString format("%1 %2 %3\n"); - - qint64 msecstotal = MMC->timeSinceStart(); - qint64 seconds = msecstotal / 1000; - qint64 msecs = msecstotal % 1000; - QString foo; - char buf[1025] = {0}; - ::snprintf(buf, 1024, "%5lld.%03lld", seconds, msecs); - - QString out = format.arg(buf).arg(levels[type]).arg(msg); - - MMC->logFile->write(out.toUtf8()); - MMC->logFile->flush(); - QTextStream(stderr) << out.toLocal8Bit(); - fflush(stderr); -} - -MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv) -{ -#if defined Q_OS_WIN32 - // attach the parent console - if(AttachConsole(ATTACH_PARENT_PROCESS)) - { - // if attach succeeds, reopen and sync all the i/o - if(freopen("CON", "w", stdout)) - { - std::cout.sync_with_stdio(); - } - if(freopen("CON", "w", stderr)) - { - std::cerr.sync_with_stdio(); - } - if(freopen("CON", "r", stdin)) - { - std::cin.sync_with_stdio(); - } - auto out = GetStdHandle (STD_OUTPUT_HANDLE); - DWORD written; - const char * endline = "\n"; - WriteConsole(out, endline, strlen(endline), &written, NULL); - consoleAttached = true; - } -#endif - setOrganizationName("MultiMC"); - setOrganizationDomain("multimc.org"); - setApplicationName("MultiMC5"); - setApplicationDisplayName("MultiMC 5"); - setApplicationVersion(BuildConfig.printableVersionString()); - - startTime = QDateTime::currentDateTime(); - -#ifdef Q_OS_LINUX - { - QFile osrelease("/proc/sys/kernel/osrelease"); - if (osrelease.open(QFile::ReadOnly | QFile::Text)) { - QTextStream in(&osrelease); - auto contents = in.readAll(); - if( - contents.contains("WSL", Qt::CaseInsensitive) || - contents.contains("Microsoft", Qt::CaseInsensitive) - ) { - showFatalErrorMessage( - "Unsupported system detected!", - "Linux-on-Windows distributions are not supported.\n\n" - "Please use the Windows MultiMC binary when playing on Windows." - ); - return; - } - } - } -#endif - - // Don't quit on hiding the last window - this->setQuitOnLastWindowClosed(false); - - // Commandline parsing - QHash args; - { - Parser parser(FlagStyle::GNU, ArgumentStyle::SpaceAndEquals); - - // --help - parser.addSwitch("help"); - parser.addShortOpt("help", 'h'); - parser.addDocumentation("help", "Display this help and exit."); - // --version - parser.addSwitch("version"); - parser.addShortOpt("version", 'V'); - parser.addDocumentation("version", "Display program version and exit."); - // --dir - parser.addOption("dir"); - parser.addShortOpt("dir", 'd'); - parser.addDocumentation("dir", "Use the supplied folder as MultiMC root instead of " - "the binary location (use '.' for current)"); - // --launch - parser.addOption("launch"); - parser.addShortOpt("launch", 'l'); - parser.addDocumentation("launch", "Launch the specified instance (by instance ID)"); - // --server - parser.addOption("server"); - parser.addShortOpt("server", 's'); - parser.addDocumentation("server", "Join the specified server on launch " - "(only valid in combination with --launch)"); - // --alive - parser.addSwitch("alive"); - parser.addDocumentation("alive", "Write a small '" + liveCheckFile + "' file after MultiMC starts"); - // --import - parser.addOption("import"); - parser.addShortOpt("import", 'I'); - parser.addDocumentation("import", "Import instance from specified zip (local path or URL)"); - - // parse the arguments - try - { - args = parser.parse(arguments()); - } - catch (const ParsingError &e) - { - std::cerr << "CommandLineError: " << e.what() << std::endl; - if(argc > 0) - std::cerr << "Try '" << argv[0] << " -h' to get help on MultiMC's command line parameters." - << std::endl; - m_status = MultiMC::Failed; - return; - } - - // display help and exit - if (args["help"].toBool()) - { - std::cout << qPrintable(parser.compileHelp(arguments()[0])); - m_status = MultiMC::Succeeded; - return; - } - - // display version and exit - if (args["version"].toBool()) - { - std::cout << "Version " << BuildConfig.printableVersionString().toStdString() << std::endl; - std::cout << "Git " << BuildConfig.GIT_COMMIT.toStdString() << std::endl; - m_status = MultiMC::Succeeded; - return; - } - } - m_instanceIdToLaunch = args["launch"].toString(); - m_serverToJoin = args["server"].toString(); - m_liveCheck = args["alive"].toBool(); - m_zipToImport = args["import"].toUrl(); - - QString origcwdPath = QDir::currentPath(); - QString binPath = applicationDirPath(); - QString adjustedBy; - QString dataPath; - // change folder - QString dirParam = args["dir"].toString(); - if (!dirParam.isEmpty()) - { - // the dir param. it makes multimc data path point to whatever the user specified - // on command line - adjustedBy += "Command line " + dirParam; - dataPath = dirParam; - } - else - { -#ifdef MULTIMC_LINUX_DATADIR - QString xdgDataHome = QFile::decodeName(qgetenv("XDG_DATA_HOME")); - if (xdgDataHome.isEmpty()) - xdgDataHome = QDir::homePath() + QLatin1String("/.local/share"); - dataPath = xdgDataHome + "/multimc"; - adjustedBy += "XDG standard " + dataPath; -#elif defined(Q_OS_MAC) - QDir foo(FS::PathCombine(applicationDirPath(), "../../Data")); - dataPath = foo.absolutePath(); - adjustedBy += "Fallback to special Mac location " + dataPath; -#else - dataPath = applicationDirPath(); - adjustedBy += "Fallback to binary path " + dataPath; -#endif - } - - if (!FS::ensureFolderPathExists(dataPath)) - { - showFatalErrorMessage( - "MultiMC data folder could not be created.", - "MultiMC data folder could not be created.\n" - "\n" -#if defined(Q_OS_MAC) - MACOS_HINT -#endif - "Make sure you have the right permissions to the MultiMC data folder and any folder needed to access it.\n" - "\n" - "MultiMC cannot continue until you fix this problem." - ); - return; - } - if (!QDir::setCurrent(dataPath)) - { - showFatalErrorMessage( - "MultiMC data folder could not be opened.", - "MultiMC data folder could not be opened.\n" - "\n" -#if defined(Q_OS_MAC) - MACOS_HINT -#endif - "Make sure you have the right permissions to the MultiMC data folder.\n" - "\n" - "MultiMC cannot continue until you fix this problem." - ); - return; - } - - if(m_instanceIdToLaunch.isEmpty() && !m_serverToJoin.isEmpty()) - { - std::cerr << "--server can only be used in combination with --launch!" << std::endl; - m_status = MultiMC::Failed; - return; - } - -#if defined(Q_OS_MAC) - // move user data to new location if on macOS and it still exists in Contents/MacOS - QDir fi(applicationDirPath()); - QString originalData = fi.absolutePath(); - // if the config file exists in Contents/MacOS, then user data is still there and needs to moved - if (QFileInfo::exists(FS::PathCombine(originalData, "multimc.cfg"))) - { - if (!QFileInfo::exists(FS::PathCombine(originalData, "dontmovemacdata"))) - { - QMessageBox::StandardButton askMoveDialogue; - askMoveDialogue = QMessageBox::question(nullptr, "MultiMC 5", "Would you like to move application data to a new data location? It will improve MultiMC's performance, but if you switch to older versions it will look like instances have disappeared. If you select no, you can migrate later in settings. You should select yes unless you're commonly switching between different versions of MultiMC (eg. develop and stable).", QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); - if (askMoveDialogue == QMessageBox::Yes) - { - qDebug() << "On macOS and found config file in old location, moving user data..."; - QDir dir; - QStringList dataFiles { - "*.log", // MultiMC-@.log - "accounts.json", - "accounts", - "assets", - "cache", - "icons", - "instances", - "libraries", - "meta", - "metacache", - "mods", - "multimc.cfg", - "themes", - "translations" - }; - QDirIterator files(originalData, dataFiles); - while (files.hasNext()) { - QString filePath(files.next()); - QString fileName(files.fileName()); - if (!dir.rename(filePath, FS::PathCombine(dataPath, fileName))) - { - qWarning() << "Failed to move " << fileName; - } - } - } - else - { - dataPath = originalData; - QDir::setCurrent(dataPath); - QFile file(originalData + "/dontmovemacdata"); - file.open(QIODevice::WriteOnly); - } - } - else - { - dataPath = originalData; - QDir::setCurrent(dataPath); - } - } -#endif - - /* - * Establish the mechanism for communication with an already running MultiMC that uses the same data path. - * If there is one, tell it what the user actually wanted to do and exit. - * We want to initialize this before logging to avoid messing with the log of a potential already running copy. - */ - auto appID = ApplicationId::fromPathAndVersion(QDir::currentPath(), BuildConfig.printableVersionString()); - { - // FIXME: you can run the same binaries with multiple data dirs and they won't clash. This could cause issues for updates. - m_peerInstance = new LocalPeer(this, appID); - connect(m_peerInstance, &LocalPeer::messageReceived, this, &MultiMC::messageReceived); - if(m_peerInstance->isClient()) - { - int timeout = 2000; - - if(m_instanceIdToLaunch.isEmpty()) - { - m_peerInstance->sendMessage("activate", timeout); - - if(!m_zipToImport.isEmpty()) - { - m_peerInstance->sendMessage("import " + m_zipToImport.toString(), timeout); - } - } - else - { - if(!m_serverToJoin.isEmpty()) - { - m_peerInstance->sendMessage( - "launch-with-server " + m_instanceIdToLaunch + " " + m_serverToJoin, timeout); - } - else - { - m_peerInstance->sendMessage("launch " + m_instanceIdToLaunch, timeout); - } - } - m_status = MultiMC::Succeeded; - return; - } - } - - // init the logger - { - static const QString logBase = "MultiMC-%0.log"; - auto moveFile = [](const QString &oldName, const QString &newName) - { - QFile::remove(newName); - QFile::copy(oldName, newName); - QFile::remove(oldName); - }; - - moveFile(logBase.arg(3), logBase.arg(4)); - moveFile(logBase.arg(2), logBase.arg(3)); - moveFile(logBase.arg(1), logBase.arg(2)); - moveFile(logBase.arg(0), logBase.arg(1)); - - logFile = std::unique_ptr(new QFile(logBase.arg(0))); - if(!logFile->open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) - { - showFatalErrorMessage( - "MultiMC data folder is not writable!", - "MultiMC couldn't create a log file - the MultiMC data folder is not writable.\n" - "\n" - #if defined(Q_OS_MAC) - MACOS_HINT - #endif - "Make sure you have write permissions to the MultiMC data folder.\n" - "\n" - "MultiMC cannot continue until you fix this problem." - ); - return; - } - qInstallMessageHandler(appDebugOutput); - qDebug() << "<> Log initialized."; - } - - // Set up paths - { - // Root path is used for updates. -#ifdef Q_OS_LINUX - QDir foo(FS::PathCombine(binPath, "..")); - m_rootPath = foo.absolutePath(); -#elif defined(Q_OS_WIN32) - m_rootPath = binPath; -#elif defined(Q_OS_MAC) - QDir foo(FS::PathCombine(binPath, "../..")); - m_rootPath = foo.absolutePath(); - // on macOS, touch the root to force Finder to reload the .app metadata (and fix any icon change issues) - FS::updateTimestamp(m_rootPath); -#endif - -#ifdef MULTIMC_JARS_LOCATION - ENV.setJarsPath( TOSTRING(MULTIMC_JARS_LOCATION) ); -#endif - - qDebug() << "MultiMC 5, (c) 2013-2021 MultiMC Contributors"; - qDebug() << "Version : " << BuildConfig.printableVersionString(); - qDebug() << "Git commit : " << BuildConfig.GIT_COMMIT; - qDebug() << "Git refspec : " << BuildConfig.GIT_REFSPEC; - if (adjustedBy.size()) - { - qDebug() << "Work dir before adjustment : " << origcwdPath; - qDebug() << "Work dir after adjustment : " << QDir::currentPath(); - qDebug() << "Adjusted by : " << adjustedBy; - } - else - { - qDebug() << "Work dir : " << QDir::currentPath(); - } - qDebug() << "Binary path : " << binPath; - qDebug() << "Application root path : " << m_rootPath; - if(!m_instanceIdToLaunch.isEmpty()) - { - qDebug() << "ID of instance to launch : " << m_instanceIdToLaunch; - } - if(!m_serverToJoin.isEmpty()) - { - qDebug() << "Address of server to join :" << m_serverToJoin; - } - qDebug() << "<> Paths set."; - } - - do // once - { - if(m_liveCheck) - { - QFile check(liveCheckFile); - if(!check.open(QIODevice::WriteOnly | QIODevice::Truncate)) - { - qWarning() << "Could not open" << liveCheckFile << "for writing!"; - break; - } - auto payload = appID.toString().toUtf8(); - if(check.write(payload) != payload.size()) - { - qWarning() << "Could not write into" << liveCheckFile << "!"; - check.remove(); - break; - } - check.close(); - } - } while(false); - - // Initialize application settings - { - m_settings.reset(new INISettingsObject("multimc.cfg", this)); - // Updates - m_settings->registerSetting("UpdateChannel", BuildConfig.VERSION_CHANNEL); - m_settings->registerSetting("AutoUpdate", true); - - // Theming - m_settings->registerSetting("IconTheme", QString("multimc")); - m_settings->registerSetting("ApplicationTheme", QString("system")); - - // Notifications - m_settings->registerSetting("ShownNotifications", QString()); - - // Remembered state - m_settings->registerSetting("LastUsedGroupForNewInstance", QString()); - - QString defaultMonospace; - int defaultSize = 11; -#ifdef Q_OS_WIN32 - defaultMonospace = "Courier"; - defaultSize = 10; -#elif defined(Q_OS_MAC) - defaultMonospace = "Menlo"; -#else - defaultMonospace = "Monospace"; -#endif - - // resolve the font so the default actually matches - QFont consoleFont; - consoleFont.setFamily(defaultMonospace); - consoleFont.setStyleHint(QFont::Monospace); - consoleFont.setFixedPitch(true); - QFontInfo consoleFontInfo(consoleFont); - QString resolvedDefaultMonospace = consoleFontInfo.family(); - QFont resolvedFont(resolvedDefaultMonospace); - qDebug() << "Detected default console font:" << resolvedDefaultMonospace - << ", substitutions:" << resolvedFont.substitutions().join(','); - - m_settings->registerSetting("ConsoleFont", resolvedDefaultMonospace); - m_settings->registerSetting("ConsoleFontSize", defaultSize); - m_settings->registerSetting("ConsoleMaxLines", 100000); - m_settings->registerSetting("ConsoleOverflowStop", true); - - // Folders - m_settings->registerSetting("InstanceDir", "instances"); - m_settings->registerSetting({"CentralModsDir", "ModsDir"}, "mods"); - m_settings->registerSetting("IconsDir", "icons"); - - // Editors - m_settings->registerSetting("JsonEditor", QString()); - - // Language - m_settings->registerSetting("Language", QString()); - - // Console - m_settings->registerSetting("ShowConsole", false); - m_settings->registerSetting("AutoCloseConsole", false); - m_settings->registerSetting("ShowConsoleOnError", true); - m_settings->registerSetting("LogPrePostOutput", true); - - // Window Size - m_settings->registerSetting({"LaunchMaximized", "MCWindowMaximize"}, false); - m_settings->registerSetting({"MinecraftWinWidth", "MCWindowWidth"}, 854); - m_settings->registerSetting({"MinecraftWinHeight", "MCWindowHeight"}, 480); - - // Proxy Settings - m_settings->registerSetting("ProxyType", "None"); - m_settings->registerSetting({"ProxyAddr", "ProxyHostName"}, "127.0.0.1"); - m_settings->registerSetting("ProxyPort", 8080); - m_settings->registerSetting({"ProxyUser", "ProxyUsername"}, ""); - m_settings->registerSetting({"ProxyPass", "ProxyPassword"}, ""); - - // Memory - m_settings->registerSetting({"MinMemAlloc", "MinMemoryAlloc"}, 512); - m_settings->registerSetting({"MaxMemAlloc", "MaxMemoryAlloc"}, 1024); - m_settings->registerSetting("PermGen", 128); - - // Java Settings - m_settings->registerSetting("JavaPath", ""); - m_settings->registerSetting("JavaTimestamp", 0); - m_settings->registerSetting("JavaArchitecture", ""); - m_settings->registerSetting("JavaVersion", ""); - m_settings->registerSetting("JavaVendor", ""); - m_settings->registerSetting("LastHostname", ""); - m_settings->registerSetting("JvmArgs", ""); - - // Native library workarounds - m_settings->registerSetting("UseNativeOpenAL", false); - m_settings->registerSetting("UseNativeGLFW", false); - - // Game time - m_settings->registerSetting("ShowGameTime", true); - m_settings->registerSetting("RecordGameTime", true); - - // Minecraft launch method - m_settings->registerSetting("MCLaunchMethod", "LauncherPart"); - - // Wrapper command for launch - m_settings->registerSetting("WrapperCommand", ""); - - // Custom Commands - m_settings->registerSetting({"PreLaunchCommand", "PreLaunchCmd"}, ""); - m_settings->registerSetting({"PostExitCommand", "PostExitCmd"}, ""); - - // The cat - m_settings->registerSetting("TheCat", false); - - m_settings->registerSetting("InstSortMode", "Name"); - m_settings->registerSetting("SelectedInstance", QString()); - - // Window state and geometry - m_settings->registerSetting("MainWindowState", ""); - m_settings->registerSetting("MainWindowGeometry", ""); - - m_settings->registerSetting("ConsoleWindowState", ""); - m_settings->registerSetting("ConsoleWindowGeometry", ""); - - m_settings->registerSetting("SettingsGeometry", ""); - - m_settings->registerSetting("PagedGeometry", ""); - - m_settings->registerSetting("NewInstanceGeometry", ""); - - m_settings->registerSetting("UpdateDialogGeometry", ""); - - // paste.ee API key - m_settings->registerSetting("PasteEEAPIKey", "multimc"); - - if(!BuildConfig.ANALYTICS_ID.isEmpty()) - { - // Analytics - m_settings->registerSetting("Analytics", true); - m_settings->registerSetting("AnalyticsSeen", 0); - m_settings->registerSetting("AnalyticsClientID", QString()); - } - - // Init page provider - { - m_globalSettingsProvider = std::make_shared(tr("Settings")); - m_globalSettingsProvider->addPage(); - m_globalSettingsProvider->addPage(); - m_globalSettingsProvider->addPage(); - m_globalSettingsProvider->addPage(); - m_globalSettingsProvider->addPage(); - m_globalSettingsProvider->addPage(); - m_globalSettingsProvider->addPage(); - m_globalSettingsProvider->addPage(); - m_globalSettingsProvider->addPage(); - } - qDebug() << "<> Settings loaded."; - } - -#ifndef QT_NO_ACCESSIBILITY - QAccessible::installFactory(groupViewAccessibleFactory); -#endif /* !QT_NO_ACCESSIBILITY */ - - // load translations - { - m_translations.reset(new TranslationsModel("translations")); - auto bcp47Name = m_settings->get("Language").toString(); - m_translations->selectLanguage(bcp47Name); - qDebug() << "Your language is" << bcp47Name; - qDebug() << "<> Translations loaded."; - } - - // initialize the updater - if(BuildConfig.UPDATER_ENABLED) - { - m_updateChecker.reset(new UpdateChecker(BuildConfig.CHANLIST_URL, BuildConfig.VERSION_CHANNEL, BuildConfig.VERSION_BUILD)); - qDebug() << "<> Updater started."; - } - - // Instance icons - { - auto setting = MMC->settings()->getSetting("IconsDir"); - QStringList instFolders = - { - ":/icons/multimc/32x32/instances/", - ":/icons/multimc/50x50/instances/", - ":/icons/multimc/128x128/instances/", - ":/icons/multimc/scalable/instances/" - }; - m_icons.reset(new IconList(instFolders, setting->get().toString())); - connect(setting.get(), &Setting::SettingChanged,[&](const Setting &, QVariant value) - { - m_icons->directoryChanged(value.toString()); - }); - ENV.registerIconList(m_icons); - qDebug() << "<> Instance icons intialized."; - } - - // Icon themes - { - // TODO: icon themes and instance icons do not mesh well together. Rearrange and fix discrepancies! - // set icon theme search path! - auto searchPaths = QIcon::themeSearchPaths(); - searchPaths.append("iconthemes"); - QIcon::setThemeSearchPaths(searchPaths); - qDebug() << "<> Icon themes initialized."; - } - - // Initialize widget themes - { - auto insertTheme = [this](ITheme * theme) - { - m_themes.insert(std::make_pair(theme->id(), std::unique_ptr(theme))); - }; - auto darkTheme = new DarkTheme(); - insertTheme(new SystemTheme()); - insertTheme(darkTheme); - insertTheme(new BrightTheme()); - insertTheme(new CustomTheme(darkTheme, "custom")); - qDebug() << "<> Widget themes initialized."; - } - - // initialize and load all instances - { - auto InstDirSetting = m_settings->getSetting("InstanceDir"); - // instance path: check for problems with '!' in instance path and warn the user in the log - // and remember that we have to show him a dialog when the gui starts (if it does so) - QString instDir = InstDirSetting->get().toString(); - qDebug() << "Instance path : " << instDir; - if (FS::checkProblemticPathJava(QDir(instDir))) - { - qWarning() << "Your instance path contains \'!\' and this is known to cause java problems!"; - } - m_instances.reset(new InstanceList(m_settings, instDir, this)); - connect(InstDirSetting.get(), &Setting::SettingChanged, m_instances.get(), &InstanceList::on_InstFolderChanged); - qDebug() << "Loading Instances..."; - m_instances->loadList(); - qDebug() << "<> Instances loaded."; - } - - // and accounts - { - m_accounts.reset(new MojangAccountList(this)); - qDebug() << "Loading accounts..."; - m_accounts->setListFilePath("accounts.json", true); - m_accounts->loadList(); - qDebug() << "<> Accounts loaded."; - } - - // init the http meta cache - { - ENV.initHttpMetaCache(); - qDebug() << "<> Cache initialized."; - } - - // init proxy settings - { - QString proxyTypeStr = settings()->get("ProxyType").toString(); - QString addr = settings()->get("ProxyAddr").toString(); - int port = settings()->get("ProxyPort").value(); - QString user = settings()->get("ProxyUser").toString(); - QString pass = settings()->get("ProxyPass").toString(); - ENV.updateProxySettings(proxyTypeStr, addr, port, user, pass); - qDebug() << "<> Proxy settings done."; - } - - // now we have network, download translation updates - m_translations->downloadIndex(); - - //FIXME: what to do with these? - m_profilers.insert("jprofiler", std::shared_ptr(new JProfilerFactory())); - m_profilers.insert("jvisualvm", std::shared_ptr(new JVisualVMFactory())); - for (auto profiler : m_profilers.values()) - { - profiler->registerSettings(m_settings); - } - - // Create the MCEdit thing... why is this here? - { - m_mcedit.reset(new MCEditTool(m_settings)); - } - - connect(this, &MultiMC::aboutToQuit, [this](){ - if(m_instances) - { - // save any remaining instance state - m_instances->saveNow(); - } - if(logFile) - { - logFile->flush(); - logFile->close(); - } - }); - - { - setIconTheme(settings()->get("IconTheme").toString()); - qDebug() << "<> Icon theme set."; - setApplicationTheme(settings()->get("ApplicationTheme").toString(), true); - qDebug() << "<> Application theme set."; - } - - // Initialize analytics - [this]() - { - const int analyticsVersion = 2; - if(BuildConfig.ANALYTICS_ID.isEmpty()) - { - return; - } - - auto analyticsSetting = m_settings->getSetting("Analytics"); - connect(analyticsSetting.get(), &Setting::SettingChanged, this, &MultiMC::analyticsSettingChanged); - QString clientID = m_settings->get("AnalyticsClientID").toString(); - if(clientID.isEmpty()) - { - clientID = QUuid::createUuid().toString(); - clientID.remove(QLatin1Char('{')); - clientID.remove(QLatin1Char('}')); - m_settings->set("AnalyticsClientID", clientID); - } - m_analytics = new GAnalytics(BuildConfig.ANALYTICS_ID, clientID, analyticsVersion, this); - m_analytics->setLogLevel(GAnalytics::Debug); - m_analytics->setAnonymizeIPs(true); - m_analytics->setNetworkAccessManager(&ENV.qnam()); - - if(m_settings->get("AnalyticsSeen").toInt() < m_analytics->version()) - { - qDebug() << "Analytics info not seen by user yet (or old version)."; - return; - } - if(!m_settings->get("Analytics").toBool()) - { - qDebug() << "Analytics disabled by user."; - return; - } - - m_analytics->enable(); - qDebug() << "<> Initialized analytics with tid" << BuildConfig.ANALYTICS_ID; - }(); - - if(createSetupWizard()) - { - return; - } - performMainStartupAction(); -} - -bool MultiMC::createSetupWizard() -{ - bool javaRequired = [&]() - { - QString currentHostName = QHostInfo::localHostName(); - QString oldHostName = settings()->get("LastHostname").toString(); - if (currentHostName != oldHostName) - { - settings()->set("LastHostname", currentHostName); - return true; - } - QString currentJavaPath = settings()->get("JavaPath").toString(); - QString actualPath = FS::ResolveExecutable(currentJavaPath); - if (actualPath.isNull()) - { - return true; - } - return false; - }(); - bool analyticsRequired = [&]() - { - if(BuildConfig.ANALYTICS_ID.isEmpty()) - { - return false; - } - if (!settings()->get("Analytics").toBool()) - { - return false; - } - if (settings()->get("AnalyticsSeen").toInt() < analytics()->version()) - { - return true; - } - return false; - }(); - bool languageRequired = [&]() - { - if (settings()->get("Language").toString().isEmpty()) - return true; - return false; - }(); - bool wizardRequired = javaRequired || analyticsRequired || languageRequired; - - if(wizardRequired) - { - m_setupWizard = new SetupWizard(nullptr); - if (languageRequired) - { - m_setupWizard->addPage(new LanguageWizardPage(m_setupWizard)); - } - if (javaRequired) - { - m_setupWizard->addPage(new JavaWizardPage(m_setupWizard)); - } - if(analyticsRequired) - { - m_setupWizard->addPage(new AnalyticsWizardPage(m_setupWizard)); - } - connect(m_setupWizard, &QDialog::finished, this, &MultiMC::setupWizardFinished); - m_setupWizard->show(); - return true; - } - return false; -} - -void MultiMC::setupWizardFinished(int status) -{ - qDebug() << "Wizard result =" << status; - performMainStartupAction(); -} - -void MultiMC::performMainStartupAction() -{ - m_status = MultiMC::Initialized; - if(!m_instanceIdToLaunch.isEmpty()) - { - auto inst = instances()->getInstanceById(m_instanceIdToLaunch); - if(inst) - { - MinecraftServerTargetPtr serverToJoin = nullptr; - - if(!m_serverToJoin.isEmpty()) - { - serverToJoin.reset(new MinecraftServerTarget(MinecraftServerTarget::parse(m_serverToJoin))); - qDebug() << "<> Instance" << m_instanceIdToLaunch << "launching with server" << m_serverToJoin; - } - else - { - qDebug() << "<> Instance" << m_instanceIdToLaunch << "launching"; - } - - launch(inst, true, nullptr, serverToJoin); - return; - } - } - if(!m_mainWindow) - { - // normal main window - showMainWindow(false); - qDebug() << "<> Main window shown."; - } - if(!m_zipToImport.isEmpty()) - { - qDebug() << "<> Importing instance from zip:" << m_zipToImport; - m_mainWindow->droppedURLs({ m_zipToImport }); - } -} - -void MultiMC::showFatalErrorMessage(const QString& title, const QString& content) -{ - m_status = MultiMC::Failed; - auto dialog = CustomMessageBox::selectable(nullptr, title, content, QMessageBox::Critical); - dialog->exec(); -} - -MultiMC::~MultiMC() -{ - // kill the other globals. - Env::dispose(); - - // Shut down logger by setting the logger function to nothing - qInstallMessageHandler(nullptr); - -#if defined Q_OS_WIN32 - // Detach from Windows console - if(consoleAttached) - { - fclose(stdout); - fclose(stdin); - fclose(stderr); - FreeConsole(); - } -#endif -} - -void MultiMC::messageReceived(const QString& message) -{ - if(status() != Initialized) - { - qDebug() << "Received message" << message << "while still initializing. It will be ignored."; - return; - } - - QString command = message.section(' ', 0, 0); - - if(command == "activate") - { - showMainWindow(); - } - else if(command == "import") - { - QString arg = message.section(' ', 1); - if(arg.isEmpty()) - { - qWarning() << "Received" << command << "message without a zip path/URL."; - return; - } - m_mainWindow->droppedURLs({ QUrl(arg) }); - } - else if(command == "launch") - { - QString arg = message.section(' ', 1); - if(arg.isEmpty()) - { - qWarning() << "Received" << command << "message without an instance ID."; - return; - } - auto inst = instances()->getInstanceById(arg); - if(inst) - { - launch(inst, true, nullptr); - } - } - else if(command == "launch-with-server") - { - QString instanceID = message.section(' ', 1, 1); - QString serverToJoin = message.section(' ', 2, 2); - if(instanceID.isEmpty()) - { - qWarning() << "Received" << command << "message without an instance ID."; - return; - } - if(serverToJoin.isEmpty()) - { - qWarning() << "Received" << command << "message without a server to join."; - return; - } - auto inst = instances()->getInstanceById(instanceID); - if(inst) - { - launch( - inst, - true, - nullptr, - std::make_shared(MinecraftServerTarget::parse(serverToJoin)) - ); - } - } - else - { - qWarning() << "Received invalid message" << message; - } -} - -void MultiMC::analyticsSettingChanged(const Setting&, QVariant value) -{ - if(!m_analytics) - return; - bool enabled = value.toBool(); - if(enabled) - { - qDebug() << "Analytics enabled by user."; - } - else - { - qDebug() << "Analytics disabled by user."; - } - m_analytics->enable(enabled); -} - -std::shared_ptr MultiMC::translations() -{ - return m_translations; -} - -std::shared_ptr MultiMC::javalist() -{ - if (!m_javalist) - { - m_javalist.reset(new JavaInstallList()); - } - return m_javalist; -} - -std::vector MultiMC::getValidApplicationThemes() -{ - std::vector ret; - auto iter = m_themes.cbegin(); - while (iter != m_themes.cend()) - { - ret.push_back((*iter).second.get()); - iter++; - } - return ret; -} - -void MultiMC::setApplicationTheme(const QString& name, bool initial) -{ - auto systemPalette = qApp->palette(); - auto themeIter = m_themes.find(name); - if(themeIter != m_themes.end()) - { - auto & theme = (*themeIter).second; - theme->apply(initial); - } - else - { - qWarning() << "Tried to set invalid theme:" << name; - } -} - -void MultiMC::setIconTheme(const QString& name) -{ - XdgIcon::setThemeName(name); -} - -QIcon MultiMC::getThemedIcon(const QString& name) -{ - return XdgIcon::fromTheme(name); -} - -bool MultiMC::openJsonEditor(const QString &filename) -{ - const QString file = QDir::current().absoluteFilePath(filename); - if (m_settings->get("JsonEditor").toString().isEmpty()) - { - return DesktopServices::openUrl(QUrl::fromLocalFile(file)); - } - else - { - //return DesktopServices::openFile(m_settings->get("JsonEditor").toString(), file); - return DesktopServices::run(m_settings->get("JsonEditor").toString(), {file}); - } -} - -bool MultiMC::launch( - InstancePtr instance, - bool online, - BaseProfilerFactory *profiler, - MinecraftServerTargetPtr serverToJoin -) { - if(m_updateRunning) - { - qDebug() << "Cannot launch instances while an update is running. Please try again when updates are completed."; - } - else if(instance->canLaunch()) - { - auto & extras = m_instanceExtras[instance->id()]; - auto & window = extras.window; - if(window) - { - if(!window->saveAll()) - { - return false; - } - } - auto & controller = extras.controller; - controller.reset(new LaunchController()); - controller->setInstance(instance); - controller->setOnline(online); - controller->setProfiler(profiler); - controller->setServerToJoin(serverToJoin); - if(window) - { - controller->setParentWidget(window); - } - else if(m_mainWindow) - { - controller->setParentWidget(m_mainWindow); - } - connect(controller.get(), &LaunchController::succeeded, this, &MultiMC::controllerSucceeded); - connect(controller.get(), &LaunchController::failed, this, &MultiMC::controllerFailed); - addRunningInstance(); - controller->start(); - return true; - } - else if (instance->isRunning()) - { - showInstanceWindow(instance, "console"); - return true; - } - else if (instance->canEdit()) - { - showInstanceWindow(instance); - return true; - } - return false; -} - -bool MultiMC::kill(InstancePtr instance) -{ - if (!instance->isRunning()) - { - qWarning() << "Attempted to kill instance" << instance->id() << ", which isn't running."; - return false; - } - auto & extras = m_instanceExtras[instance->id()]; - // NOTE: copy of the shared pointer keeps it alive - auto controller = extras.controller; - if(controller) - { - return controller->abort(); - } - return true; -} - -void MultiMC::addRunningInstance() -{ - m_runningInstances ++; - if(m_runningInstances == 1) - { - emit updateAllowedChanged(false); - } -} - -void MultiMC::subRunningInstance() -{ - if(m_runningInstances == 0) - { - qCritical() << "Something went really wrong and we now have less than 0 running instances... WTF"; - return; - } - m_runningInstances --; - if(m_runningInstances == 0) - { - emit updateAllowedChanged(true); - } -} - -bool MultiMC::shouldExitNow() const -{ - return m_runningInstances == 0 && m_openWindows == 0; -} - -bool MultiMC::updatesAreAllowed() -{ - return m_runningInstances == 0; -} - -void MultiMC::updateIsRunning(bool running) -{ - m_updateRunning = running; -} - - -void MultiMC::controllerSucceeded() -{ - auto controller = qobject_cast(QObject::sender()); - if(!controller) - return; - auto id = controller->id(); - auto & extras = m_instanceExtras[id]; - - // on success, do... - if (controller->instance()->settings()->get("AutoCloseConsole").toBool()) - { - if(extras.window) - { - extras.window->close(); - } - } - extras.controller.reset(); - subRunningInstance(); - - // quit when there are no more windows. - if(shouldExitNow()) - { - m_status = Status::Succeeded; - exit(0); - } -} - -void MultiMC::controllerFailed(const QString& error) -{ - Q_UNUSED(error); - auto controller = qobject_cast(QObject::sender()); - if(!controller) - return; - auto id = controller->id(); - auto & extras = m_instanceExtras[id]; - - // on failure, do... nothing - extras.controller.reset(); - subRunningInstance(); - - // quit when there are no more windows. - if(shouldExitNow()) - { - m_status = Status::Failed; - exit(1); - } -} - -void MultiMC::ShowGlobalSettings(class QWidget* parent, QString open_page) -{ - if(!m_globalSettingsProvider) { - return; - } - emit globalSettingsAboutToOpen(); - { - SettingsObject::Lock lock(MMC->settings()); - PageDialog dlg(m_globalSettingsProvider.get(), open_page, parent); - dlg.exec(); - } - emit globalSettingsClosed(); -} - -MainWindow* MultiMC::showMainWindow(bool minimized) -{ - if(m_mainWindow) - { - m_mainWindow->setWindowState(m_mainWindow->windowState() & ~Qt::WindowMinimized); - m_mainWindow->raise(); - m_mainWindow->activateWindow(); - } - else - { - m_mainWindow = new MainWindow(); - m_mainWindow->restoreState(QByteArray::fromBase64(MMC->settings()->get("MainWindowState").toByteArray())); - m_mainWindow->restoreGeometry(QByteArray::fromBase64(MMC->settings()->get("MainWindowGeometry").toByteArray())); - if(minimized) - { - m_mainWindow->showMinimized(); - } - else - { - m_mainWindow->show(); - } - - m_mainWindow->checkInstancePathForProblems(); - connect(this, &MultiMC::updateAllowedChanged, m_mainWindow, &MainWindow::updatesAllowedChanged); - connect(m_mainWindow, &MainWindow::isClosing, this, &MultiMC::on_windowClose); - m_openWindows++; - } - // FIXME: move this somewhere else... - if(m_analytics) - { - auto windowSize = m_mainWindow->size(); - auto sizeString = QString("%1x%2").arg(windowSize.width()).arg(windowSize.height()); - qDebug() << "Viewport size" << sizeString; - m_analytics->setViewportSize(sizeString); - /* - * cm1 = java min heap [MB] - * cm2 = java max heap [MB] - * cm3 = system RAM [MB] - * - * cd1 = java version - * cd2 = java architecture - * cd3 = system architecture - * cd4 = CPU architecture - */ - QVariantMap customValues; - int min = m_settings->get("MinMemAlloc").toInt(); - int max = m_settings->get("MaxMemAlloc").toInt(); - if(min < max) - { - customValues["cm1"] = min; - customValues["cm2"] = max; - } - else - { - customValues["cm1"] = max; - customValues["cm2"] = min; - } - - constexpr uint64_t Mega = 1024ull * 1024ull; - int ramSize = int(Sys::getSystemRam() / Mega); - qDebug() << "RAM size is" << ramSize << "MB"; - customValues["cm3"] = ramSize; - - customValues["cd1"] = m_settings->get("JavaVersion"); - customValues["cd2"] = m_settings->get("JavaArchitecture"); - customValues["cd3"] = Sys::isSystem64bit() ? "64":"32"; - customValues["cd4"] = Sys::isCPU64bit() ? "64":"32"; - auto kernelInfo = Sys::getKernelInfo(); - customValues["cd5"] = kernelInfo.kernelName; - customValues["cd6"] = kernelInfo.kernelVersion; - auto distInfo = Sys::getDistributionInfo(); - if(!distInfo.distributionName.isEmpty()) - { - customValues["cd7"] = distInfo.distributionName; - } - if(!distInfo.distributionVersion.isEmpty()) - { - customValues["cd8"] = distInfo.distributionVersion; - } - m_analytics->sendScreenView("Main Window", customValues); - } - return m_mainWindow; -} - -InstanceWindow *MultiMC::showInstanceWindow(InstancePtr instance, QString page) -{ - if(!instance) - return nullptr; - auto id = instance->id(); - auto & extras = m_instanceExtras[id]; - auto & window = extras.window; - - if(window) - { - window->raise(); - window->activateWindow(); - } - else - { - window = new InstanceWindow(instance); - m_openWindows ++; - connect(window, &InstanceWindow::isClosing, this, &MultiMC::on_windowClose); - } - if(!page.isEmpty()) - { - window->selectPage(page); - } - if(extras.controller) - { - extras.controller->setParentWidget(window); - } - return window; -} - -void MultiMC::on_windowClose() -{ - m_openWindows--; - auto instWindow = qobject_cast(QObject::sender()); - if(instWindow) - { - auto & extras = m_instanceExtras[instWindow->instanceId()]; - extras.window = nullptr; - if(extras.controller) - { - extras.controller->setParentWidget(m_mainWindow); - } - } - auto mainWindow = qobject_cast(QObject::sender()); - if(mainWindow) - { - m_mainWindow = nullptr; - } - // quit when there are no more windows. - if(shouldExitNow()) - { - exit(0); - } -} diff --git a/application/MultiMC.h b/application/MultiMC.h deleted file mode 100644 index af2b41c1..00000000 --- a/application/MultiMC.h +++ /dev/null @@ -1,235 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "minecraft/launch/MinecraftServerTarget.h" - -class LaunchController; -class LocalPeer; -class InstanceWindow; -class MainWindow; -class SetupWizard; -class FolderInstanceProvider; -class GenericPageProvider; -class QFile; -class HttpMetaCache; -class SettingsObject; -class InstanceList; -class MojangAccountList; -class IconList; -class QNetworkAccessManager; -class JavaInstallList; -class UpdateChecker; -class BaseProfilerFactory; -class BaseDetachedToolFactory; -class TranslationsModel; -class ITheme; -class MCEditTool; -class GAnalytics; - -#if defined(MMC) -#undef MMC -#endif -#define MMC (static_cast(QCoreApplication::instance())) - -class MultiMC : public QApplication -{ - // friends for the purpose of limiting access to deprecated stuff - Q_OBJECT -public: - enum Status - { - StartingUp, - Failed, - Succeeded, - Initialized - }; - -public: - MultiMC(int &argc, char **argv); - virtual ~MultiMC(); - - GAnalytics *analytics() const - { - return m_analytics; - } - - std::shared_ptr settings() const - { - return m_settings; - } - - qint64 timeSinceStart() const - { - return startTime.msecsTo(QDateTime::currentDateTime()); - } - - QIcon getThemedIcon(const QString& name); - - void setIconTheme(const QString& name); - - std::vector getValidApplicationThemes(); - - void setApplicationTheme(const QString& name, bool initial); - - // DownloadUpdateTask - std::shared_ptr updateChecker() - { - return m_updateChecker; - } - - std::shared_ptr translations(); - - std::shared_ptr javalist(); - - std::shared_ptr instances() const - { - return m_instances; - } - - FolderInstanceProvider * folderProvider() const - { - return m_instanceFolder; - } - - std::shared_ptr icons() const - { - return m_icons; - } - - MCEditTool *mcedit() const - { - return m_mcedit.get(); - } - - std::shared_ptr accounts() const - { - return m_accounts; - } - - Status status() const - { - return m_status; - } - - const QMap> &profilers() const - { - return m_profilers; - } - - /// this is the root of the 'installation'. Used for automatic updates - const QString &root() - { - return m_rootPath; - } - - /*! - * Opens a json file using either a system default editor, or, if not empty, the editor - * specified in the settings - */ - bool openJsonEditor(const QString &filename); - - InstanceWindow *showInstanceWindow(InstancePtr instance, QString page = QString()); - MainWindow *showMainWindow(bool minimized = false); - - void updateIsRunning(bool running); - bool updatesAreAllowed(); - - void ShowGlobalSettings(class QWidget * parent, QString open_page = QString()); - -signals: - void updateAllowedChanged(bool status); - void globalSettingsAboutToOpen(); - void globalSettingsClosed(); - -public slots: - bool launch( - InstancePtr instance, - bool online = true, - BaseProfilerFactory *profiler = nullptr, - MinecraftServerTargetPtr serverToJoin = nullptr - ); - bool kill(InstancePtr instance); - -private slots: - void on_windowClose(); - void messageReceived(const QString & message); - void controllerSucceeded(); - void controllerFailed(const QString & error); - void analyticsSettingChanged(const Setting &setting, QVariant value); - void setupWizardFinished(int status); - -private: - bool createSetupWizard(); - void performMainStartupAction(); - - // sets the fatal error message and m_status to Failed. - void showFatalErrorMessage(const QString & title, const QString & content); - -private: - void addRunningInstance(); - void subRunningInstance(); - bool shouldExitNow() const; - -private: - QDateTime startTime; - - std::shared_ptr m_settings; - std::shared_ptr m_instances; - FolderInstanceProvider * m_instanceFolder = nullptr; - std::shared_ptr m_icons; - std::shared_ptr m_updateChecker; - std::shared_ptr m_accounts; - std::shared_ptr m_javalist; - std::shared_ptr m_translations; - std::shared_ptr m_globalSettingsProvider; - std::map> m_themes; - std::unique_ptr m_mcedit; - - QMap> m_profilers; - - QString m_rootPath; - Status m_status = MultiMC::StartingUp; - -#if defined Q_OS_WIN32 - // used on Windows to attach the standard IO streams - bool consoleAttached = false; -#endif - - // FIXME: attach to instances instead. - struct InstanceXtras - { - InstanceWindow * window = nullptr; - shared_qobject_ptr controller; - }; - std::map m_instanceExtras; - - // main state variables - size_t m_openWindows = 0; - size_t m_runningInstances = 0; - bool m_updateRunning = false; - - // main window, if any - MainWindow * m_mainWindow = nullptr; - - // peer MultiMC instance connector - used to implement single instance MultiMC and signalling - LocalPeer * m_peerInstance = nullptr; - - GAnalytics * m_analytics = nullptr; - SetupWizard * m_setupWizard = nullptr; -public: - QString m_instanceIdToLaunch; - QString m_serverToJoin; - bool m_liveCheck = false; - QUrl m_zipToImport; - std::unique_ptr logFile; -}; diff --git a/application/UpdateController.cpp b/application/UpdateController.cpp deleted file mode 100644 index 0309ad93..00000000 --- a/application/UpdateController.cpp +++ /dev/null @@ -1,449 +0,0 @@ -#include -#include -#include -#include -#include "UpdateController.h" -#include -#include -#include -#include - -// from -#ifndef S_IRUSR -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ -#define S_IRUSR __S_IREAD /* Read by owner. */ -#define S_IWUSR __S_IWRITE /* Write by owner. */ -#define S_IXUSR __S_IEXEC /* Execute by owner. */ - -#define S_IRGRP (S_IRUSR >> 3) /* Read by group. */ -#define S_IWGRP (S_IWUSR >> 3) /* Write by group. */ -#define S_IXGRP (S_IXUSR >> 3) /* Execute by group. */ - -#define S_IROTH (S_IRGRP >> 3) /* Read by others. */ -#define S_IWOTH (S_IWGRP >> 3) /* Write by others. */ -#define S_IXOTH (S_IXGRP >> 3) /* Execute by others. */ -#endif -static QFile::Permissions unixModeToPermissions(const int mode) -{ - QFile::Permissions perms; - - if (mode & S_IRUSR) - { - perms |= QFile::ReadUser; - } - if (mode & S_IWUSR) - { - perms |= QFile::WriteUser; - } - if (mode & S_IXUSR) - { - perms |= QFile::ExeUser; - } - - if (mode & S_IRGRP) - { - perms |= QFile::ReadGroup; - } - if (mode & S_IWGRP) - { - perms |= QFile::WriteGroup; - } - if (mode & S_IXGRP) - { - perms |= QFile::ExeGroup; - } - - if (mode & S_IROTH) - { - perms |= QFile::ReadOther; - } - if (mode & S_IWOTH) - { - perms |= QFile::WriteOther; - } - if (mode & S_IXOTH) - { - perms |= QFile::ExeOther; - } - return perms; -} - -static const QLatin1String liveCheckFile("live.check"); - -UpdateController::UpdateController(QWidget * parent, const QString& root, const QString updateFilesDir, GoUpdate::OperationList operations) -{ - m_parent = parent; - m_root = root; - m_updateFilesDir = updateFilesDir; - m_operations = operations; -} - - -void UpdateController::installUpdates() -{ - qint64 pid = -1; - QStringList args; - bool started = false; - - qDebug() << "Installing updates."; -#ifdef Q_OS_WIN - QString finishCmd = QApplication::applicationFilePath(); -#elif defined Q_OS_LINUX - QString finishCmd = FS::PathCombine(m_root, "MultiMC"); -#elif defined Q_OS_MAC - QString finishCmd = QApplication::applicationFilePath(); -#else -#error Unsupported operating system. -#endif - - QString backupPath = FS::PathCombine(m_root, "update", "backup"); - QDir origin(m_root); - - // clean up the backup folder. it should be empty before we start - if(!FS::deletePath(backupPath)) - { - qWarning() << "couldn't remove previous backup folder" << backupPath; - } - // and it should exist. - if(!FS::ensureFolderPathExists(backupPath)) - { - qWarning() << "couldn't create folder" << backupPath; - return; - } - - bool useXPHack = false; - QString exePath; - QString exeOrigin; - QString exeBackup; - - // perform the update operations - for(auto op: m_operations) - { - switch(op.type) - { - // replace = move original out to backup, if it exists, move the new file in its place - case GoUpdate::Operation::OP_REPLACE: - { -#ifdef Q_OS_WIN32 - // hack for people renaming the .exe because ... reasons :) - if(op.destination == "MultiMC.exe") - { - op.destination = QFileInfo(QApplication::applicationFilePath()).fileName(); - } -#endif - QFileInfo destination (FS::PathCombine(m_root, op.destination)); -#ifdef Q_OS_WIN32 - if(QSysInfo::windowsVersion() < QSysInfo::WV_VISTA) - { - if(destination.fileName() == "MultiMC.exe") - { - QDir rootDir(m_root); - exeOrigin = rootDir.relativeFilePath(op.source); - exePath = rootDir.relativeFilePath(op.destination); - exeBackup = rootDir.relativeFilePath(FS::PathCombine(backupPath, destination.fileName())); - useXPHack = true; - continue; - } - } -#endif - if(destination.exists()) - { - QString backupName = op.destination; - backupName.replace('/', '_'); - QString backupFilePath = FS::PathCombine(backupPath, backupName); - if(!QFile::rename(destination.absoluteFilePath(), backupFilePath)) - { - qWarning() << "Couldn't move:" << destination.absoluteFilePath() << "to" << backupFilePath; - m_failedOperationType = Replace; - m_failedFile = op.destination; - fail(); - return; - } - BackupEntry be; - be.original = destination.absoluteFilePath(); - be.backup = backupFilePath; - be.update = op.source; - m_replace_backups.append(be); - } - // make sure the folder we are putting this into exists - if(!FS::ensureFilePathExists(destination.absoluteFilePath())) - { - qWarning() << "REPLACE: Couldn't create folder:" << destination.absoluteFilePath(); - m_failedOperationType = Replace; - m_failedFile = op.destination; - fail(); - return; - } - // now move the new file in - if(!QFile::rename(op.source, destination.absoluteFilePath())) - { - qWarning() << "REPLACE: Couldn't move:" << op.source << "to" << destination.absoluteFilePath(); - m_failedOperationType = Replace; - m_failedFile = op.destination; - fail(); - return; - } - QFile::setPermissions(destination.absoluteFilePath(), unixModeToPermissions(op.destinationMode)); - } - break; - // delete = move original to backup - case GoUpdate::Operation::OP_DELETE: - { - QString destFilePath = FS::PathCombine(m_root, op.destination); - if(QFile::exists(destFilePath)) - { - QString backupName = op.destination; - backupName.replace('/', '_'); - QString trashFilePath = FS::PathCombine(backupPath, backupName); - - if(!QFile::rename(destFilePath, trashFilePath)) - { - qWarning() << "DELETE: Couldn't move:" << op.destination << "to" << trashFilePath; - m_failedFile = op.destination; - m_failedOperationType = Delete; - fail(); - return; - } - BackupEntry be; - be.original = destFilePath; - be.backup = trashFilePath; - m_delete_backups.append(be); - } - } - break; - } - } - - // try to start the new binary - args = qApp->arguments(); - args.removeFirst(); - - // on old Windows, do insane things... no error checking here, this is just to have something. - if(useXPHack) - { - QString script; - auto nativePath = QDir::toNativeSeparators(exePath); - auto nativeOriginPath = QDir::toNativeSeparators(exeOrigin); - auto nativeBackupPath = QDir::toNativeSeparators(exeBackup); - - // so we write this vbscript thing... - QTextStream out(&script); - out << "WScript.Sleep 1000\n"; - out << "Set fso=CreateObject(\"Scripting.FileSystemObject\")\n"; - out << "Set shell=CreateObject(\"WScript.Shell\")\n"; - out << "fso.MoveFile \"" << nativePath << "\", \"" << nativeBackupPath << "\"\n"; - out << "fso.MoveFile \"" << nativeOriginPath << "\", \"" << nativePath << "\"\n"; - out << "shell.Run \"" << nativePath << "\"\n"; - - QString scriptPath = FS::PathCombine(m_root, "update", "update.vbs"); - - // we save it - QFile scriptFile(scriptPath); - scriptFile.open(QIODevice::WriteOnly); - scriptFile.write(script.toLocal8Bit().replace("\n", "\r\n")); - scriptFile.close(); - - // we run it - started = QProcess::startDetached("wscript", {scriptPath}, m_root); - - // and we quit. conscious thought. - qApp->quit(); - return; - } - bool doLiveCheck = true; - bool startFailed = false; - - // remove live check file, if any - if(QFile::exists(liveCheckFile)) - { - if(!QFile::remove(liveCheckFile)) - { - qWarning() << "Couldn't remove the" << liveCheckFile << "file! We will proceed without :("; - doLiveCheck = false; - } - } - - if(doLiveCheck) - { - if(!args.contains("--alive")) - { - args.append("--alive"); - } - } - - // FIXME: reparse args and construct a safe variant from scratch. This is a workaround for GH-1874: - QStringList realargs; - int skip = 0; - for(auto & arg: args) - { - if(skip) - { - skip--; - continue; - } - if(arg == "-l") - { - skip = 1; - continue; - } - realargs.append(arg); - } - - // start the updated application - started = QProcess::startDetached(finishCmd, realargs, QDir::currentPath(), &pid); - // much dumber check - just find out if the call - if(!started || pid == -1) - { - qWarning() << "Couldn't start new process properly!"; - startFailed = true; - } - if(!startFailed && doLiveCheck) - { - int attempts = 0; - while(attempts < 10) - { - attempts++; - QString key; - std::this_thread::sleep_for(std::chrono::milliseconds(250)); - if(!QFile::exists(liveCheckFile)) - { - qWarning() << "Couldn't find the" << liveCheckFile << "file!"; - startFailed = true; - continue; - } - try - { - key = QString::fromUtf8(FS::read(liveCheckFile)); - auto id = ApplicationId::fromRawString(key); - LocalPeer peer(nullptr, id); - if(peer.isClient()) - { - startFailed = false; - qDebug() << "Found process started with key " << key; - break; - } - else - { - startFailed = true; - qDebug() << "Process started with key " << key << "apparently died or is not reponding..."; - break; - } - } - catch (const Exception &e) - { - qWarning() << "Couldn't read the" << liveCheckFile << "file!"; - startFailed = true; - continue; - } - } - } - if(startFailed) - { - m_failedOperationType = Start; - fail(); - return; - } - else - { - origin.rmdir(m_updateFilesDir); - qApp->quit(); - return; - } -} - -void UpdateController::fail() -{ - qWarning() << "Update failed!"; - - QString msg; - bool doRollback = false; - QString failTitle = QObject::tr("Update failed!"); - QString rollFailTitle = QObject::tr("Rollback failed!"); - switch (m_failedOperationType) - { - case Replace: - { - msg = QObject::tr("Couldn't replace file %1. Changes will be reverted.\n" - "See the MultiMC log file for details.").arg(m_failedFile); - doRollback = true; - QMessageBox::critical(m_parent, failTitle, msg); - break; - } - case Delete: - { - msg = QObject::tr("Couldn't remove file %1. Changes will be reverted.\n" - "See the MultiMC log file for details.").arg(m_failedFile); - doRollback = true; - QMessageBox::critical(m_parent, failTitle, msg); - break; - } - case Start: - { - msg = QObject::tr("The new version didn't start or is too old and doesn't respond to startup checks.\n" - "\n" - "Roll back to previous version?"); - auto result = QMessageBox::critical( - m_parent, - failTitle, - msg, - QMessageBox::Yes | QMessageBox::No, - QMessageBox::Yes - ); - doRollback = (result == QMessageBox::Yes); - break; - } - case Nothing: - default: - return; - } - if(doRollback) - { - auto rollbackOK = rollback(); - if(!rollbackOK) - { - msg = QObject::tr("The rollback failed too.\n" - "You will have to repair MultiMC manually.\n" - "Please let us know why and how this happened.").arg(m_failedFile); - QMessageBox::critical(m_parent, rollFailTitle, msg); - qApp->quit(); - } - } - else - { - qApp->quit(); - } -} - -bool UpdateController::rollback() -{ - bool revertOK = true; - // if the above failed, roll back changes - for(auto backup:m_replace_backups) - { - qWarning() << "restoring" << backup.original << "from" << backup.backup; - if(!QFile::rename(backup.original, backup.update)) - { - revertOK = false; - qWarning() << "moving new" << backup.original << "back to" << backup.update << "failed!"; - continue; - } - - if(!QFile::rename(backup.backup, backup.original)) - { - revertOK = false; - qWarning() << "restoring" << backup.original << "failed!"; - } - } - for(auto backup:m_delete_backups) - { - qWarning() << "restoring" << backup.original << "from" << backup.backup; - if(!QFile::rename(backup.backup, backup.original)) - { - revertOK = false; - qWarning() << "restoring" << backup.original << "failed!"; - } - } - return revertOK; -} diff --git a/application/UpdateController.h b/application/UpdateController.h deleted file mode 100644 index 715554e5..00000000 --- a/application/UpdateController.h +++ /dev/null @@ -1,44 +0,0 @@ -#pragma once - -#include -#include -#include - -class QWidget; - -class UpdateController -{ -public: - UpdateController(QWidget * parent, const QString &root, const QString updateFilesDir, GoUpdate::OperationList operations); - void installUpdates(); - -private: - void fail(); - bool rollback(); - -private: - QString m_root; - QString m_updateFilesDir; - GoUpdate::OperationList m_operations; - QWidget * m_parent; - - struct BackupEntry - { - // path where we got the new file from - QString update; - // path of what is being actually updated - QString original; - // path where the backup of the updated file was placed - QString backup; - }; - QList m_replace_backups; - QList m_delete_backups; - enum Failure - { - Replace, - Delete, - Start, - Nothing - } m_failedOperationType = Nothing; - QString m_failedFile; -}; diff --git a/application/VersionProxyModel.cpp b/application/VersionProxyModel.cpp deleted file mode 100644 index 5587136f..00000000 --- a/application/VersionProxyModel.cpp +++ /dev/null @@ -1,447 +0,0 @@ -#include "VersionProxyModel.h" -#include "MultiMC.h" -#include -#include -#include -#include - -class VersionFilterModel : public QSortFilterProxyModel -{ - Q_OBJECT -public: - VersionFilterModel(VersionProxyModel *parent) : QSortFilterProxyModel(parent) - { - m_parent = parent; - setSortRole(BaseVersionList::SortRole); - sort(0, Qt::DescendingOrder); - } - - bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const - { - const auto &filters = m_parent->filters(); - for (auto it = filters.begin(); it != filters.end(); ++it) - { - auto idx = sourceModel()->index(source_row, 0, source_parent); - auto data = sourceModel()->data(idx, it.key()); - auto match = data.toString(); - if(!it.value()->accepts(match)) - { - return false; - } - } - return true; - } - - void filterChanged() - { - invalidateFilter(); - } -private: - VersionProxyModel *m_parent; -}; - -VersionProxyModel::VersionProxyModel(QObject *parent) : QAbstractProxyModel(parent) -{ - filterModel = new VersionFilterModel(this); - connect(filterModel, &QAbstractItemModel::dataChanged, this, &VersionProxyModel::sourceDataChanged); - connect(filterModel, &QAbstractItemModel::rowsAboutToBeInserted, this, &VersionProxyModel::sourceRowsAboutToBeInserted); - connect(filterModel, &QAbstractItemModel::rowsInserted, this, &VersionProxyModel::sourceRowsInserted); - connect(filterModel, &QAbstractItemModel::rowsAboutToBeRemoved, this, &VersionProxyModel::sourceRowsAboutToBeRemoved); - connect(filterModel, &QAbstractItemModel::rowsRemoved, this, &VersionProxyModel::sourceRowsRemoved); - // FIXME: implement when needed - /* - connect(replacing, &QAbstractItemModel::rowsAboutToBeMoved, this, &VersionProxyModel::sourceRowsAboutToBeMoved); - connect(replacing, &QAbstractItemModel::rowsMoved, this, &VersionProxyModel::sourceRowsMoved); - connect(replacing, &QAbstractItemModel::layoutAboutToBeChanged, this, &VersionProxyModel::sourceLayoutAboutToBeChanged); - connect(replacing, &QAbstractItemModel::layoutChanged, this, &VersionProxyModel::sourceLayoutChanged); - */ - connect(filterModel, &QAbstractItemModel::modelAboutToBeReset, this, &VersionProxyModel::sourceAboutToBeReset); - connect(filterModel, &QAbstractItemModel::modelReset, this, &VersionProxyModel::sourceReset); - - QAbstractProxyModel::setSourceModel(filterModel); -} - -QVariant VersionProxyModel::headerData(int section, Qt::Orientation orientation, int role) const -{ - if(section < 0 || section >= m_columns.size()) - return QVariant(); - if(orientation != Qt::Horizontal) - return QVariant(); - auto column = m_columns[section]; - if(role == Qt::DisplayRole) - { - switch(column) - { - case Name: - return tr("Version"); - case ParentVersion: - return tr("Minecraft"); //FIXME: this should come from metadata - case Branch: - return tr("Branch"); - case Type: - return tr("Type"); - case Architecture: - return tr("Architecture"); - case Path: - return tr("Path"); - case Time: - return tr("Released"); - } - } - else if(role == Qt::ToolTipRole) - { - switch(column) - { - case Name: - return tr("The name of the version."); - case ParentVersion: - return tr("Minecraft version"); //FIXME: this should come from metadata - case Branch: - return tr("The version's branch"); - case Type: - return tr("The version's type"); - case Architecture: - return tr("CPU Architecture"); - case Path: - return tr("Filesystem path to this version"); - case Time: - return tr("Release date of this version"); - } - } - return QVariant(); -} - -QVariant VersionProxyModel::data(const QModelIndex &index, int role) const -{ - if(!index.isValid()) - { - return QVariant(); - } - auto column = m_columns[index.column()]; - auto parentIndex = mapToSource(index); - switch(role) - { - case Qt::DisplayRole: - { - switch(column) - { - case Name: - { - QString version = sourceModel()->data(parentIndex, BaseVersionList::VersionRole).toString(); - if(version == m_currentVersion) - { - return tr("%1 (installed)").arg(version); - } - return version; - } - case ParentVersion: - return sourceModel()->data(parentIndex, BaseVersionList::ParentVersionRole); - case Branch: - return sourceModel()->data(parentIndex, BaseVersionList::BranchRole); - case Type: - return sourceModel()->data(parentIndex, BaseVersionList::TypeRole); - case Architecture: - return sourceModel()->data(parentIndex, BaseVersionList::ArchitectureRole); - case Path: - return sourceModel()->data(parentIndex, BaseVersionList::PathRole); - case Time: - return sourceModel()->data(parentIndex, Meta::VersionList::TimeRole).toDate(); - default: - return QVariant(); - } - } - case Qt::ToolTipRole: - { - switch(column) - { - case Name: - { - if(hasRecommended) - { - auto value = sourceModel()->data(parentIndex, BaseVersionList::RecommendedRole); - if(value.toBool()) - { - return tr("Recommended"); - } - else if(hasLatest) - { - auto value = sourceModel()->data(parentIndex, BaseVersionList::LatestRole); - if(value.toBool()) - { - return tr("Latest"); - } - } - else if(index.row() == 0) - { - return tr("Latest"); - } - } - } - default: - { - return sourceModel()->data(parentIndex, BaseVersionList::VersionIdRole); - } - } - } - case Qt::DecorationRole: - { - switch(column) - { - case Name: - { - if(hasRecommended) - { - auto value = sourceModel()->data(parentIndex, BaseVersionList::RecommendedRole); - if(value.toBool()) - { - return MMC->getThemedIcon("star"); - } - else if(hasLatest) - { - auto value = sourceModel()->data(parentIndex, BaseVersionList::LatestRole); - if(value.toBool()) - { - return MMC->getThemedIcon("bug"); - } - } - else if(index.row() == 0) - { - return MMC->getThemedIcon("bug"); - } - auto pixmap = QPixmapCache::find("placeholder"); - if(!pixmap) - { - QPixmap px(16,16); - px.fill(Qt::transparent); - QPixmapCache::insert("placeholder", px); - return px; - } - return *pixmap; - } - } - default: - { - return QVariant(); - } - } - } - default: - { - if(roles.contains((BaseVersionList::ModelRoles)role)) - { - return sourceModel()->data(parentIndex, role); - } - return QVariant(); - } - } -} - -QModelIndex VersionProxyModel::parent(const QModelIndex &child) const -{ - return QModelIndex(); -} - -QModelIndex VersionProxyModel::mapFromSource(const QModelIndex &sourceIndex) const -{ - if(sourceIndex.isValid()) - { - return index(sourceIndex.row(), 0); - } - return QModelIndex(); -} - -QModelIndex VersionProxyModel::mapToSource(const QModelIndex &proxyIndex) const -{ - if(proxyIndex.isValid()) - { - return sourceModel()->index(proxyIndex.row(), 0); - } - return QModelIndex(); -} - -QModelIndex VersionProxyModel::index(int row, int column, const QModelIndex &parent) const -{ - // no trees here... shoo - if(parent.isValid()) - { - return QModelIndex(); - } - if(row < 0 || row >= sourceModel()->rowCount()) - return QModelIndex(); - if(column < 0 || column >= columnCount()) - return QModelIndex(); - return QAbstractItemModel::createIndex(row, column); -} - -int VersionProxyModel::columnCount(const QModelIndex &parent) const -{ - return m_columns.size(); -} - -int VersionProxyModel::rowCount(const QModelIndex &parent) const -{ - if(sourceModel()) - { - return sourceModel()->rowCount(); - } - return 0; -} - -void VersionProxyModel::sourceDataChanged(const QModelIndex &source_top_left, - const QModelIndex &source_bottom_right) -{ - if(source_top_left.parent() != source_bottom_right.parent()) - return; - - // whole row is getting changed - auto topLeft = createIndex(source_top_left.row(), 0); - auto bottomRight = createIndex(source_bottom_right.row(), columnCount() - 1); - emit dataChanged(topLeft, bottomRight); -} - -void VersionProxyModel::setSourceModel(QAbstractItemModel *replacingRaw) -{ - auto replacing = dynamic_cast(replacingRaw); - beginResetModel(); - - m_columns.clear(); - if(!replacing) - { - roles.clear(); - filterModel->setSourceModel(replacing); - return; - } - - roles = replacing->providesRoles(); - if(roles.contains(BaseVersionList::VersionRole)) - { - m_columns.push_back(Name); - } - /* - if(roles.contains(BaseVersionList::ParentVersionRole)) - { - m_columns.push_back(ParentVersion); - } - */ - if(roles.contains(BaseVersionList::ArchitectureRole)) - { - m_columns.push_back(Architecture); - } - if(roles.contains(BaseVersionList::PathRole)) - { - m_columns.push_back(Path); - } - if(roles.contains(Meta::VersionList::TimeRole)) - { - m_columns.push_back(Time); - } - if(roles.contains(BaseVersionList::BranchRole)) - { - m_columns.push_back(Branch); - } - if(roles.contains(BaseVersionList::TypeRole)) - { - m_columns.push_back(Type); - } - if(roles.contains(BaseVersionList::RecommendedRole)) - { - hasRecommended = true; - } - if(roles.contains(BaseVersionList::LatestRole)) - { - hasLatest = true; - } - filterModel->setSourceModel(replacing); - - endResetModel(); -} - -QModelIndex VersionProxyModel::getRecommended() const -{ - if(!roles.contains(BaseVersionList::RecommendedRole)) - { - return index(0, 0); - } - int recommended = 0; - for (int i = 0; i < rowCount(); i++) - { - auto value = sourceModel()->data(mapToSource(index(i, 0)), BaseVersionList::RecommendedRole); - if (value.toBool()) - { - recommended = i; - } - } - return index(recommended, 0); -} - -QModelIndex VersionProxyModel::getVersion(const QString& version) const -{ - int found = -1; - for (int i = 0; i < rowCount(); i++) - { - auto value = sourceModel()->data(mapToSource(index(i, 0)), BaseVersionList::VersionRole); - if (value.toString() == version) - { - found = i; - } - } - if(found == -1) - { - return QModelIndex(); - } - return index(found, 0); -} - -void VersionProxyModel::clearFilters() -{ - m_filters.clear(); - filterModel->filterChanged(); -} - -void VersionProxyModel::setFilter(const BaseVersionList::ModelRoles column, Filter * f) -{ - m_filters[column].reset(f); - filterModel->filterChanged(); -} - -const VersionProxyModel::FilterMap &VersionProxyModel::filters() const -{ - return m_filters; -} - -void VersionProxyModel::sourceAboutToBeReset() -{ - beginResetModel(); -} - -void VersionProxyModel::sourceReset() -{ - endResetModel(); -} - -void VersionProxyModel::sourceRowsAboutToBeInserted(const QModelIndex& parent, int first, int last) -{ - beginInsertRows(parent, first, last); -} - -void VersionProxyModel::sourceRowsInserted(const QModelIndex& parent, int first, int last) -{ - endInsertRows(); -} - -void VersionProxyModel::sourceRowsAboutToBeRemoved(const QModelIndex& parent, int first, int last) -{ - beginRemoveRows(parent, first, last); -} - -void VersionProxyModel::sourceRowsRemoved(const QModelIndex& parent, int first, int last) -{ - endRemoveRows(); -} - -void VersionProxyModel::setCurrentVersion(const QString &version) -{ - m_currentVersion = version; -} - -#include "VersionProxyModel.moc" diff --git a/application/VersionProxyModel.h b/application/VersionProxyModel.h deleted file mode 100644 index 8991c31b..00000000 --- a/application/VersionProxyModel.h +++ /dev/null @@ -1,67 +0,0 @@ -#pragma once -#include -#include "BaseVersionList.h" - -#include - -class VersionFilterModel; - -class VersionProxyModel: public QAbstractProxyModel -{ - Q_OBJECT -public: - - enum Column - { - Name, - ParentVersion, - Branch, - Type, - Architecture, - Path, - Time - }; - typedef QHash> FilterMap; - -public: - VersionProxyModel ( QObject* parent = 0 ); - virtual ~VersionProxyModel() {}; - - virtual int columnCount(const QModelIndex &parent = QModelIndex()) const override; - virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override; - virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const override; - virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const override; - virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; - virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; - virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; - virtual QModelIndex parent(const QModelIndex &child) const override; - virtual void setSourceModel(QAbstractItemModel *sourceModel) override; - - const FilterMap &filters() const; - void setFilter(const BaseVersionList::ModelRoles column, Filter * filter); - void clearFilters(); - QModelIndex getRecommended() const; - QModelIndex getVersion(const QString & version) const; - void setCurrentVersion(const QString &version); -private slots: - - void sourceDataChanged(const QModelIndex &source_top_left,const QModelIndex &source_bottom_right); - - void sourceAboutToBeReset(); - void sourceReset(); - - void sourceRowsAboutToBeInserted(const QModelIndex &parent, int first, int last); - void sourceRowsInserted(const QModelIndex &parent, int first, int last); - - void sourceRowsAboutToBeRemoved(const QModelIndex &parent, int first, int last); - void sourceRowsRemoved(const QModelIndex &parent, int first, int last); - -private: - QList m_columns; - FilterMap m_filters; - BaseVersionList::RoleList roles; - VersionFilterModel * filterModel; - bool hasRecommended = false; - bool hasLatest = false; - QString m_currentVersion; -}; diff --git a/application/dialogs/AboutDialog.cpp b/application/dialogs/AboutDialog.cpp deleted file mode 100644 index c97c471e..00000000 --- a/application/dialogs/AboutDialog.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "AboutDialog.h" -#include "ui_AboutDialog.h" -#include -#include "MultiMC.h" -#include "BuildConfig.h" - -#include - -#include "HoeDown.h" - -namespace { -// Credits -// This is a hack, but I can't think of a better way to do this easily without screwing with QTextDocument... -QString getCreditsHtml(QStringList patrons) -{ - QString patronsHeading = QObject::tr("Patrons", "About Credits"); - QString output; - QTextStream stream(&output); - stream << "
\n"; - // TODO: possibly retrieve from git history at build time? - stream << "

" << QObject::tr("MultiMC Developers", "About Credits") << "

\n"; - stream << "

Andrew Okin <forkk@forkk.net>

\n"; - stream << "

Petr Mrázek <peterix@gmail.com>

\n"; - stream << "

Sky Welch <multimc@bunnies.io>

\n"; - stream << "

Jan (02JanDal) <02jandal@gmail.com>

\n"; - stream << "

RoboSky <@RoboSky_>

\n"; - stream << "
\n"; - - stream << "

" << QObject::tr("With thanks to", "About Credits") << "

\n"; - stream << "

Orochimarufan <orochimarufan.x3@gmail.com>

\n"; - stream << "

TakSuyu <taksuyu@gmail.com>

\n"; - stream << "

Kilobyte <stiepen22@gmx.de>

\n"; - stream << "

Rootbear75 <@rootbear75>

\n"; - stream << "

Zeker Zhayard <@Zeker_Zhayard>

\n"; - stream << "
\n"; - - if(!patrons.isEmpty()) { - stream << "

" << QObject::tr("Patrons", "About Credits") << "

\n"; - for (QString patron : patrons) - { - stream << "

" << patron << "

\n"; - } - } - stream << "
\n"; - return output; -} - -QString getLicenseHtml() -{ - HoeDown hoedown; - QFile dataFile(":/documents/COPYING.md"); - dataFile.open(QIODevice::ReadOnly); - QString output = hoedown.process(dataFile.readAll()); - return output; -} - -} - -AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AboutDialog) -{ - ui->setupUi(this); - - QString chtml = getCreditsHtml(QStringList()); - ui->creditsText->setHtml(chtml); - - QString lhtml = getLicenseHtml(); - ui->licenseText->setHtml(lhtml); - - ui->urlLabel->setOpenExternalLinks(true); - - ui->icon->setPixmap(MMC->getThemedIcon("logo").pixmap(64)); - ui->title->setText("MultiMC 5"); - - ui->versionLabel->setText(tr("Version") +": " + BuildConfig.printableVersionString()); - ui->platformLabel->setText(tr("Platform") +": " + BuildConfig.BUILD_PLATFORM); - - if (BuildConfig.VERSION_BUILD >= 0) - ui->buildNumLabel->setText(tr("Build Number") +": " + QString::number(BuildConfig.VERSION_BUILD)); - else - ui->buildNumLabel->setVisible(false); - - if (!BuildConfig.VERSION_CHANNEL.isEmpty()) - ui->channelLabel->setText(tr("Channel") +": " + BuildConfig.VERSION_CHANNEL); - else - ui->channelLabel->setVisible(false); - - ui->redistributionText->setHtml(tr( -"

We keep MultiMC open source because we think it's important to be able to see the source code for a project like this, and we do so using the Apache license.

\n" -"

Part of the reason for using the Apache license is we don't want people using the "MultiMC" name when redistributing the project. " -"This means people must take the time to go through the source code and remove all references to "MultiMC", including but not limited to the project " -"icon and the title of windows, (no MultiMC-fork in the title).

\n" -"

The Apache license covers reasonable use for the name - a mention of the project's origins in the About dialog and the license is acceptable. " -"However, it should be abundantly clear that the project is a fork without implying that you have our blessing.

" - )); - - connect(ui->closeButton, SIGNAL(clicked()), SLOT(close())); - - connect(ui->aboutQt, &QPushButton::clicked, &QApplication::aboutQt); - - loadPatronList(); -} - -AboutDialog::~AboutDialog() -{ - delete ui; -} - -void AboutDialog::loadPatronList() -{ - netJob.reset(new NetJob("Patreon Patron List")); - netJob->addNetAction(Net::Download::makeByteArray(QUrl("https://files.multimc.org/patrons.txt"), &dataSink)); - connect(netJob.get(), &NetJob::succeeded, this, &AboutDialog::patronListLoaded); - netJob->start(); -} - -void AboutDialog::patronListLoaded() -{ - QString patronListStr(dataSink); - dataSink.clear(); - QString html = getCreditsHtml(patronListStr.split("\n", QString::SkipEmptyParts)); - ui->creditsText->setHtml(html); -} - diff --git a/application/dialogs/AboutDialog.h b/application/dialogs/AboutDialog.h deleted file mode 100644 index c7621c37..00000000 --- a/application/dialogs/AboutDialog.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -namespace Ui -{ -class AboutDialog; -} - -class AboutDialog : public QDialog -{ - Q_OBJECT - -public: - explicit AboutDialog(QWidget *parent = 0); - ~AboutDialog(); - -public -slots: - /// Starts loading a list of Patreon patrons. - void loadPatronList(); - - /// Slot for when the patron list loads successfully. - void patronListLoaded(); - -private: - Ui::AboutDialog *ui; - - NetJobPtr netJob; - QByteArray dataSink; -}; diff --git a/application/dialogs/AboutDialog.ui b/application/dialogs/AboutDialog.ui deleted file mode 100644 index c6de9ebb..00000000 --- a/application/dialogs/AboutDialog.ui +++ /dev/null @@ -1,312 +0,0 @@ - - - AboutDialog - - - - 0 - 0 - 783 - 843 - - - - - 450 - 400 - - - - About MultiMC - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 64 - 64 - - - - - 64 - 64 - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - 15 - - - - MultiMC 5 - - - Qt::AlignCenter - - - - - - - 0 - - - - About - - - - - - Version: - - - Qt::AlignCenter - - - - - - - Platform: - - - Qt::AlignCenter - - - - - - - Build Number: - - - Qt::AlignCenter - - - - - - - Channel: - - - Qt::AlignCenter - - - - - - - true - - - <html><head/><body><p>MultiMC is a custom launcher that makes managing Minecraft easier by allowing you to have multiple instances of Minecraft at once.</p></body></html> - - - Qt::AlignCenter - - - true - - - - - - - - 8 - true - - - - © 2012-2021 MultiMC Contributors - - - Qt::AlignCenter - - - - - - - - 10 - - - - <html><head/><body><p><a href="https://github.com/MultiMC/MultiMC5">https://github.com/MultiMC/MultiMC5</a></p></body></html> - - - Qt::AlignCenter - - - - - - - Qt::Vertical - - - - 20 - 212 - - - - - - - - - Credits - - - - - - true - - - Qt::TextBrowserInteraction - - - - - - - - License - - - - - - - 0 - 0 - - - - - DejaVu Sans Mono - - - - true - - - Qt::TextBrowserInteraction - - - - - - - - Forking/Redistribution - - - - - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - - - - - - false - - - About Qt - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Close - - - - - - - - - tabWidget - creditsText - licenseText - redistributionText - aboutQt - closeButton - - - - diff --git a/application/dialogs/CopyInstanceDialog.cpp b/application/dialogs/CopyInstanceDialog.cpp deleted file mode 100644 index 5fe90334..00000000 --- a/application/dialogs/CopyInstanceDialog.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include - -#include "MultiMC.h" -#include "CopyInstanceDialog.h" -#include "ui_CopyInstanceDialog.h" - -#include "dialogs/IconPickerDialog.h" - -#include "BaseVersion.h" -#include "icons/IconList.h" -#include "tasks/Task.h" -#include "BaseInstance.h" -#include "InstanceList.h" - -CopyInstanceDialog::CopyInstanceDialog(InstancePtr original, QWidget *parent) - :QDialog(parent), ui(new Ui::CopyInstanceDialog), m_original(original) -{ - ui->setupUi(this); - resize(minimumSizeHint()); - layout()->setSizeConstraint(QLayout::SetFixedSize); - - InstIconKey = original->iconKey(); - ui->iconButton->setIcon(MMC->icons()->getIcon(InstIconKey)); - ui->instNameTextBox->setText(original->name()); - ui->instNameTextBox->setFocus(); - auto groups = MMC->instances()->getGroups().toSet(); - auto groupList = QStringList(groups.toList()); - groupList.sort(Qt::CaseInsensitive); - groupList.removeOne(""); - groupList.push_front(""); - ui->groupBox->addItems(groupList); - int index = groupList.indexOf(MMC->instances()->getInstanceGroup(m_original->id())); - if(index == -1) - { - index = 0; - } - ui->groupBox->setCurrentIndex(index); - ui->groupBox->lineEdit()->setPlaceholderText(tr("No group")); - ui->copySavesCheckbox->setChecked(m_copySaves); - ui->keepPlaytimeCheckbox->setChecked(m_keepPlaytime); -} - -CopyInstanceDialog::~CopyInstanceDialog() -{ - delete ui; -} - -void CopyInstanceDialog::updateDialogState() -{ - auto allowOK = !instName().isEmpty(); - auto OkButton = ui->buttonBox->button(QDialogButtonBox::Ok); - if(OkButton->isEnabled() != allowOK) - { - OkButton->setEnabled(allowOK); - } -} - -QString CopyInstanceDialog::instName() const -{ - auto result = ui->instNameTextBox->text().trimmed(); - if(result.size()) - { - return result; - } - return QString(); -} - -QString CopyInstanceDialog::iconKey() const -{ - return InstIconKey; -} - -QString CopyInstanceDialog::instGroup() const -{ - return ui->groupBox->currentText(); -} - -void CopyInstanceDialog::on_iconButton_clicked() -{ - IconPickerDialog dlg(this); - dlg.execWithSelection(InstIconKey); - - if (dlg.result() == QDialog::Accepted) - { - InstIconKey = dlg.selectedIconKey; - ui->iconButton->setIcon(MMC->icons()->getIcon(InstIconKey)); - } -} - -void CopyInstanceDialog::on_instNameTextBox_textChanged(const QString &arg1) -{ - updateDialogState(); -} - -bool CopyInstanceDialog::shouldCopySaves() const -{ - return m_copySaves; -} - -void CopyInstanceDialog::on_copySavesCheckbox_stateChanged(int state) -{ - if(state == Qt::Unchecked) - { - m_copySaves = false; - } - else if(state == Qt::Checked) - { - m_copySaves = true; - } -} - -bool CopyInstanceDialog::shouldKeepPlaytime() const -{ - return m_keepPlaytime; -} - - -void CopyInstanceDialog::on_keepPlaytimeCheckbox_stateChanged(int state) -{ - if(state == Qt::Unchecked) - { - m_keepPlaytime = false; - } - else if(state == Qt::Checked) - { - m_keepPlaytime = true; - } -} diff --git a/application/dialogs/CopyInstanceDialog.h b/application/dialogs/CopyInstanceDialog.h deleted file mode 100644 index bf3cd920..00000000 --- a/application/dialogs/CopyInstanceDialog.h +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include "BaseVersion.h" -#include - -class BaseInstance; - -namespace Ui -{ -class CopyInstanceDialog; -} - -class CopyInstanceDialog : public QDialog -{ - Q_OBJECT - -public: - explicit CopyInstanceDialog(InstancePtr original, QWidget *parent = 0); - ~CopyInstanceDialog(); - - void updateDialogState(); - - QString instName() const; - QString instGroup() const; - QString iconKey() const; - bool shouldCopySaves() const; - bool shouldKeepPlaytime() const; - -private -slots: - void on_iconButton_clicked(); - void on_instNameTextBox_textChanged(const QString &arg1); - void on_copySavesCheckbox_stateChanged(int state); - void on_keepPlaytimeCheckbox_stateChanged(int state); - -private: - Ui::CopyInstanceDialog *ui; - QString InstIconKey; - InstancePtr m_original; - bool m_copySaves = true; - bool m_keepPlaytime = true; -}; diff --git a/application/dialogs/CopyInstanceDialog.ui b/application/dialogs/CopyInstanceDialog.ui deleted file mode 100644 index fa675455..00000000 --- a/application/dialogs/CopyInstanceDialog.ui +++ /dev/null @@ -1,182 +0,0 @@ - - - CopyInstanceDialog - - - Qt::ApplicationModal - - - - 0 - 0 - 345 - 323 - - - - Copy Instance - - - - :/icons/toolbar/copy:/icons/toolbar/copy - - - true - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - :/icons/instances/infinity:/icons/instances/infinity - - - - 80 - 80 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Name - - - - - - - Qt::Horizontal - - - - - - - - - &Group - - - groupBox - - - - - - - - 0 - 0 - - - - true - - - - - - - - - Copy saves - - - - - - - Keep play time - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - iconButton - instNameTextBox - groupBox - copySavesCheckbox - keepPlaytimeCheckbox - - - - - - - buttonBox - accepted() - CopyInstanceDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - CopyInstanceDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/application/dialogs/CustomMessageBox.cpp b/application/dialogs/CustomMessageBox.cpp deleted file mode 100644 index 19029f68..00000000 --- a/application/dialogs/CustomMessageBox.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "CustomMessageBox.h" - -namespace CustomMessageBox -{ -QMessageBox *selectable(QWidget *parent, const QString &title, const QString &text, - QMessageBox::Icon icon, QMessageBox::StandardButtons buttons, - QMessageBox::StandardButton defaultButton) -{ - QMessageBox *messageBox = new QMessageBox(parent); - messageBox->setWindowTitle(title); - messageBox->setText(text); - messageBox->setStandardButtons(buttons); - messageBox->setDefaultButton(defaultButton); - messageBox->setTextInteractionFlags(Qt::TextSelectableByMouse); - messageBox->setIcon(icon); - messageBox->setTextInteractionFlags(Qt::TextBrowserInteraction); - - return messageBox; -} -} diff --git a/application/dialogs/CustomMessageBox.h b/application/dialogs/CustomMessageBox.h deleted file mode 100644 index 712c6518..00000000 --- a/application/dialogs/CustomMessageBox.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -namespace CustomMessageBox -{ -QMessageBox *selectable(QWidget *parent, const QString &title, const QString &text, - QMessageBox::Icon icon = QMessageBox::NoIcon, - QMessageBox::StandardButtons buttons = QMessageBox::Ok, - QMessageBox::StandardButton defaultButton = QMessageBox::NoButton); -} diff --git a/application/dialogs/EditAccountDialog.cpp b/application/dialogs/EditAccountDialog.cpp deleted file mode 100644 index 002c064b..00000000 --- a/application/dialogs/EditAccountDialog.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "EditAccountDialog.h" -#include "ui_EditAccountDialog.h" -#include -#include - -EditAccountDialog::EditAccountDialog(const QString &text, QWidget *parent, int flags) - : QDialog(parent), ui(new Ui::EditAccountDialog) -{ - ui->setupUi(this); - - ui->label->setText(text); - ui->label->setVisible(!text.isEmpty()); - - ui->userTextBox->setEnabled(flags & UsernameField); - ui->passTextBox->setEnabled(flags & PasswordField); -} - -EditAccountDialog::~EditAccountDialog() -{ - delete ui; -} - -void EditAccountDialog::on_label_linkActivated(const QString &link) -{ - DesktopServices::openUrl(QUrl(link)); -} - -void EditAccountDialog::setUsername(const QString & user) const -{ - ui->userTextBox->setText(user); -} - -QString EditAccountDialog::username() const -{ - return ui->userTextBox->text(); -} - -void EditAccountDialog::setPassword(const QString & pass) const -{ - ui->passTextBox->setText(pass); -} - -QString EditAccountDialog::password() const -{ - return ui->passTextBox->text(); -} diff --git a/application/dialogs/EditAccountDialog.h b/application/dialogs/EditAccountDialog.h deleted file mode 100644 index 6b5eb4aa..00000000 --- a/application/dialogs/EditAccountDialog.h +++ /dev/null @@ -1,56 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -namespace Ui -{ -class EditAccountDialog; -} - -class EditAccountDialog : public QDialog -{ - Q_OBJECT - -public: - explicit EditAccountDialog(const QString &text = "", QWidget *parent = 0, - int flags = UsernameField | PasswordField); - ~EditAccountDialog(); - - void setUsername(const QString & user) const; - void setPassword(const QString & pass) const; - - QString username() const; - QString password() const; - - enum Flags - { - NoFlags = 0, - - //! Specifies that the dialog should have a username field. - UsernameField, - - //! Specifies that the dialog should have a password field. - PasswordField, - }; - -private slots: - void on_label_linkActivated(const QString &link); - -private: - Ui::EditAccountDialog *ui; -}; diff --git a/application/dialogs/EditAccountDialog.ui b/application/dialogs/EditAccountDialog.ui deleted file mode 100644 index e87509bc..00000000 --- a/application/dialogs/EditAccountDialog.ui +++ /dev/null @@ -1,94 +0,0 @@ - - - EditAccountDialog - - - - 0 - 0 - 400 - 148 - - - - Login - - - - - - Message label placeholder. - - - Qt::RichText - - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Email - - - - - - - QLineEdit::Password - - - Password - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - EditAccountDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - EditAccountDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/application/dialogs/ExportInstanceDialog.cpp b/application/dialogs/ExportInstanceDialog.cpp deleted file mode 100644 index a42779d4..00000000 --- a/application/dialogs/ExportInstanceDialog.cpp +++ /dev/null @@ -1,482 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "ExportInstanceDialog.h" -#include "ui_ExportInstanceDialog.h" -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include "MMCStrings.h" -#include "SeparatorPrefixTree.h" -#include "MultiMC.h" -#include -#include - -class PackIgnoreProxy : public QSortFilterProxyModel -{ - Q_OBJECT - -public: - PackIgnoreProxy(InstancePtr instance, QObject *parent) : QSortFilterProxyModel(parent) - { - m_instance = instance; - } - // NOTE: Sadly, we have to do sorting ourselves. - bool lessThan(const QModelIndex &left, const QModelIndex &right) const - { - QFileSystemModel *fsm = qobject_cast(sourceModel()); - if (!fsm) - { - return QSortFilterProxyModel::lessThan(left, right); - } - bool asc = sortOrder() == Qt::AscendingOrder ? true : false; - - QFileInfo leftFileInfo = fsm->fileInfo(left); - QFileInfo rightFileInfo = fsm->fileInfo(right); - - if (!leftFileInfo.isDir() && rightFileInfo.isDir()) - { - return !asc; - } - if (leftFileInfo.isDir() && !rightFileInfo.isDir()) - { - return asc; - } - - // sort and proxy model breaks the original model... - if (sortColumn() == 0) - { - return Strings::naturalCompare(leftFileInfo.fileName(), rightFileInfo.fileName(), - Qt::CaseInsensitive) < 0; - } - if (sortColumn() == 1) - { - auto leftSize = leftFileInfo.size(); - auto rightSize = rightFileInfo.size(); - if ((leftSize == rightSize) || (leftFileInfo.isDir() && rightFileInfo.isDir())) - { - return Strings::naturalCompare(leftFileInfo.fileName(), - rightFileInfo.fileName(), - Qt::CaseInsensitive) < 0 - ? asc - : !asc; - } - return leftSize < rightSize; - } - return QSortFilterProxyModel::lessThan(left, right); - } - - virtual Qt::ItemFlags flags(const QModelIndex &index) const - { - if (!index.isValid()) - return Qt::NoItemFlags; - - auto sourceIndex = mapToSource(index); - Qt::ItemFlags flags = sourceIndex.flags(); - if (index.column() == 0) - { - flags |= Qt::ItemIsUserCheckable; - if (sourceIndex.model()->hasChildren(sourceIndex)) - { - flags |= Qt::ItemIsTristate; - } - } - - return flags; - } - - virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const - { - QModelIndex sourceIndex = mapToSource(index); - - if (index.column() == 0 && role == Qt::CheckStateRole) - { - QFileSystemModel *fsm = qobject_cast(sourceModel()); - auto blockedPath = relPath(fsm->filePath(sourceIndex)); - auto cover = blocked.cover(blockedPath); - if (!cover.isNull()) - { - return QVariant(Qt::Unchecked); - } - else if (blocked.exists(blockedPath)) - { - return QVariant(Qt::PartiallyChecked); - } - else - { - return QVariant(Qt::Checked); - } - } - - return sourceIndex.data(role); - } - - virtual bool setData(const QModelIndex &index, const QVariant &value, - int role = Qt::EditRole) - { - if (index.column() == 0 && role == Qt::CheckStateRole) - { - Qt::CheckState state = static_cast(value.toInt()); - return setFilterState(index, state); - } - - QModelIndex sourceIndex = mapToSource(index); - return QSortFilterProxyModel::sourceModel()->setData(sourceIndex, value, role); - } - - QString relPath(const QString &path) const - { - QString prefix = QDir().absoluteFilePath(m_instance->instanceRoot()); - prefix += '/'; - if (!path.startsWith(prefix)) - { - return QString(); - } - return path.mid(prefix.size()); - } - - bool setFilterState(QModelIndex index, Qt::CheckState state) - { - QFileSystemModel *fsm = qobject_cast(sourceModel()); - - if (!fsm) - { - return false; - } - - QModelIndex sourceIndex = mapToSource(index); - auto blockedPath = relPath(fsm->filePath(sourceIndex)); - bool changed = false; - if (state == Qt::Unchecked) - { - // blocking a path - auto &node = blocked.insert(blockedPath); - // get rid of all blocked nodes below - node.clear(); - changed = true; - } - else if (state == Qt::Checked || state == Qt::PartiallyChecked) - { - if (!blocked.remove(blockedPath)) - { - auto cover = blocked.cover(blockedPath); - qDebug() << "Blocked by cover" << cover; - // uncover - blocked.remove(cover); - // block all contents, except for any cover - QModelIndex rootIndex = - fsm->index(FS::PathCombine(m_instance->instanceRoot(), cover)); - QModelIndex doing = rootIndex; - int row = 0; - QStack todo; - while (1) - { - auto node = doing.child(row, 0); - if (!node.isValid()) - { - if (!todo.size()) - { - break; - } - else - { - doing = todo.pop(); - row = 0; - continue; - } - } - auto relpath = relPath(fsm->filePath(node)); - if (blockedPath.startsWith(relpath)) // cover found? - { - // continue processing cover later - todo.push(node); - } - else - { - // or just block this one. - blocked.insert(relpath); - } - row++; - } - } - changed = true; - } - if (changed) - { - // update the thing - emit dataChanged(index, index, {Qt::CheckStateRole}); - // update everything above index - QModelIndex up = index.parent(); - while (1) - { - if (!up.isValid()) - break; - emit dataChanged(up, up, {Qt::CheckStateRole}); - up = up.parent(); - } - // and everything below the index - QModelIndex doing = index; - int row = 0; - QStack todo; - while (1) - { - auto node = doing.child(row, 0); - if (!node.isValid()) - { - if (!todo.size()) - { - break; - } - else - { - doing = todo.pop(); - row = 0; - continue; - } - } - emit dataChanged(node, node, {Qt::CheckStateRole}); - todo.push(node); - row++; - } - // siblings and unrelated nodes are ignored - } - return true; - } - - bool shouldExpand(QModelIndex index) - { - QModelIndex sourceIndex = mapToSource(index); - QFileSystemModel *fsm = qobject_cast(sourceModel()); - if (!fsm) - { - return false; - } - auto blockedPath = relPath(fsm->filePath(sourceIndex)); - auto found = blocked.find(blockedPath); - if(found) - { - return !found->leaf(); - } - return false; - } - - void setBlockedPaths(QStringList paths) - { - beginResetModel(); - blocked.clear(); - blocked.insert(paths); - endResetModel(); - } - - const SeparatorPrefixTree<'/'> & blockedPaths() const - { - return blocked; - } - -protected: - bool filterAcceptsColumn(int source_column, const QModelIndex &source_parent) const - { - Q_UNUSED(source_parent) - - // adjust the columns you want to filter out here - // return false for those that will be hidden - if (source_column == 2 || source_column == 3) - return false; - - return true; - } - -private: - InstancePtr m_instance; - SeparatorPrefixTree<'/'> blocked; -}; - -ExportInstanceDialog::ExportInstanceDialog(InstancePtr instance, QWidget *parent) - : QDialog(parent), ui(new Ui::ExportInstanceDialog), m_instance(instance) -{ - ui->setupUi(this); - auto model = new QFileSystemModel(this); - proxyModel = new PackIgnoreProxy(m_instance, this); - loadPackIgnore(); - proxyModel->setSourceModel(model); - auto root = instance->instanceRoot(); - ui->treeView->setModel(proxyModel); - ui->treeView->setRootIndex(proxyModel->mapFromSource(model->index(root))); - ui->treeView->sortByColumn(0, Qt::AscendingOrder); - - connect(proxyModel, SIGNAL(rowsInserted(QModelIndex,int,int)), SLOT(rowsInserted(QModelIndex,int,int))); - - model->setFilter(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs | QDir::Hidden); - model->setRootPath(root); - auto headerView = ui->treeView->header(); - headerView->setSectionResizeMode(QHeaderView::ResizeToContents); - headerView->setSectionResizeMode(0, QHeaderView::Stretch); -} - -ExportInstanceDialog::~ExportInstanceDialog() -{ - delete ui; -} - -/// Save icon to instance's folder is needed -void SaveIcon(InstancePtr m_instance) -{ - auto iconKey = m_instance->iconKey(); - auto iconList = MMC->icons(); - auto mmcIcon = iconList->icon(iconKey); - if(!mmcIcon || mmcIcon->isBuiltIn()) { - return; - } - auto path = mmcIcon->getFilePath(); - if(!path.isNull()) { - QFileInfo inInfo (path); - FS::copy(path, FS::PathCombine(m_instance->instanceRoot(), inInfo.fileName())) (); - return; - } - auto & image = mmcIcon->m_images[mmcIcon->type()]; - auto & icon = image.icon; - auto sizes = icon.availableSizes(); - if(sizes.size() == 0) - { - return; - } - auto areaOf = [](QSize size) - { - return size.width() * size.height(); - }; - QSize largest = sizes[0]; - // find variant with largest area - for(auto size: sizes) - { - if(areaOf(largest) < areaOf(size)) - { - largest = size; - } - } - auto pixmap = icon.pixmap(largest); - pixmap.save(FS::PathCombine(m_instance->instanceRoot(), iconKey + ".png")); -} - -bool ExportInstanceDialog::doExport() -{ - auto name = FS::RemoveInvalidFilenameChars(m_instance->name()); - - const QString output = QFileDialog::getSaveFileName( - this, tr("Export %1").arg(m_instance->name()), - FS::PathCombine(QDir::homePath(), name + ".zip"), "Zip (*.zip)", nullptr, QFileDialog::DontConfirmOverwrite); - if (output.isEmpty()) - { - return false; - } - if (QFile::exists(output)) - { - int ret = - QMessageBox::question(this, tr("Overwrite?"), - tr("This file already exists. Do you want to overwrite it?"), - QMessageBox::No, QMessageBox::Yes); - if (ret == QMessageBox::No) - { - return false; - } - } - - SaveIcon(m_instance); - - auto & blocked = proxyModel->blockedPaths(); - using std::placeholders::_1; - if (!JlCompress::compressDir(output, m_instance->instanceRoot(), name, std::bind(&SeparatorPrefixTree<'/'>::covers, blocked, _1))) - { - QMessageBox::warning(this, tr("Error"), tr("Unable to export instance")); - return false; - } - return true; -} - -void ExportInstanceDialog::done(int result) -{ - savePackIgnore(); - if (result == QDialog::Accepted) - { - if (doExport()) - { - QDialog::done(QDialog::Accepted); - return; - } - else - { - return; - } - } - QDialog::done(result); -} - -void ExportInstanceDialog::rowsInserted(QModelIndex parent, int top, int bottom) -{ - //WARNING: possible off-by-one? - for(int i = top; i < bottom; i++) - { - auto node = parent.child(i, 0); - if(proxyModel->shouldExpand(node)) - { - auto expNode = node.parent(); - if(!expNode.isValid()) - { - continue; - } - ui->treeView->expand(node); - } - } -} - -QString ExportInstanceDialog::ignoreFileName() -{ - return FS::PathCombine(m_instance->instanceRoot(), ".packignore"); -} - -void ExportInstanceDialog::loadPackIgnore() -{ - auto filename = ignoreFileName(); - QFile ignoreFile(filename); - if(!ignoreFile.open(QIODevice::ReadOnly)) - { - return; - } - auto data = ignoreFile.readAll(); - auto string = QString::fromUtf8(data); - proxyModel->setBlockedPaths(string.split('\n', QString::SkipEmptyParts)); -} - -void ExportInstanceDialog::savePackIgnore() -{ - auto data = proxyModel->blockedPaths().toStringList().join('\n').toUtf8(); - auto filename = ignoreFileName(); - try - { - FS::write(filename, data); - } - catch (const Exception &e) - { - qWarning() << e.cause(); - } -} - -#include "ExportInstanceDialog.moc" diff --git a/application/dialogs/ExportInstanceDialog.h b/application/dialogs/ExportInstanceDialog.h deleted file mode 100644 index dea02d1b..00000000 --- a/application/dialogs/ExportInstanceDialog.h +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include - -class BaseInstance; -class PackIgnoreProxy; -typedef std::shared_ptr InstancePtr; - -namespace Ui -{ -class ExportInstanceDialog; -} - -class ExportInstanceDialog : public QDialog -{ - Q_OBJECT - -public: - explicit ExportInstanceDialog(InstancePtr instance, QWidget *parent = 0); - ~ExportInstanceDialog(); - - virtual void done(int result); - -private: - bool doExport(); - void loadPackIgnore(); - void savePackIgnore(); - QString ignoreFileName(); - -private: - Ui::ExportInstanceDialog *ui; - InstancePtr m_instance; - PackIgnoreProxy * proxyModel; - -private slots: - void rowsInserted(QModelIndex parent, int top, int bottom); -}; diff --git a/application/dialogs/ExportInstanceDialog.ui b/application/dialogs/ExportInstanceDialog.ui deleted file mode 100644 index bcd4e84a..00000000 --- a/application/dialogs/ExportInstanceDialog.ui +++ /dev/null @@ -1,83 +0,0 @@ - - - ExportInstanceDialog - - - - 0 - 0 - 720 - 625 - - - - Export Instance - - - - - - true - - - QAbstractItemView::ExtendedSelection - - - true - - - false - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - treeView - - - - - buttonBox - accepted() - ExportInstanceDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - ExportInstanceDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/application/dialogs/IconPickerDialog.cpp b/application/dialogs/IconPickerDialog.cpp deleted file mode 100644 index 90436554..00000000 --- a/application/dialogs/IconPickerDialog.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include -#include - -#include "MultiMC.h" - -#include "IconPickerDialog.h" -#include "ui_IconPickerDialog.h" - -#include "groupview/InstanceDelegate.h" - -#include "icons/IconList.h" -#include "icons/IconUtils.h" -#include - -IconPickerDialog::IconPickerDialog(QWidget *parent) - : QDialog(parent), ui(new Ui::IconPickerDialog) -{ - ui->setupUi(this); - setWindowModality(Qt::WindowModal); - - auto contentsWidget = ui->iconView; - contentsWidget->setViewMode(QListView::IconMode); - contentsWidget->setFlow(QListView::LeftToRight); - contentsWidget->setIconSize(QSize(48, 48)); - contentsWidget->setMovement(QListView::Static); - contentsWidget->setResizeMode(QListView::Adjust); - contentsWidget->setSelectionMode(QAbstractItemView::SingleSelection); - contentsWidget->setSpacing(5); - contentsWidget->setWordWrap(false); - contentsWidget->setWrapping(true); - contentsWidget->setUniformItemSizes(true); - contentsWidget->setTextElideMode(Qt::ElideRight); - contentsWidget->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); - contentsWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); - contentsWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - contentsWidget->setItemDelegate(new ListViewDelegate()); - - // contentsWidget->setAcceptDrops(true); - contentsWidget->setDropIndicatorShown(true); - contentsWidget->viewport()->setAcceptDrops(true); - contentsWidget->setDragDropMode(QAbstractItemView::DropOnly); - contentsWidget->setDefaultDropAction(Qt::CopyAction); - - contentsWidget->installEventFilter(this); - - contentsWidget->setModel(MMC->icons().get()); - - // NOTE: ResetRole forces the button to be on the left, while the OK/Cancel ones are on the right. We win. - auto buttonAdd = ui->buttonBox->addButton(tr("Add Icon"), QDialogButtonBox::ResetRole); - auto buttonRemove = ui->buttonBox->addButton(tr("Remove Icon"), QDialogButtonBox::ResetRole); - - connect(buttonAdd, SIGNAL(clicked(bool)), SLOT(addNewIcon())); - connect(buttonRemove, SIGNAL(clicked(bool)), SLOT(removeSelectedIcon())); - - connect(contentsWidget, SIGNAL(doubleClicked(QModelIndex)), SLOT(activated(QModelIndex))); - - connect(contentsWidget->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), SLOT(selectionChanged(QItemSelection, QItemSelection))); - - auto buttonFolder = ui->buttonBox->addButton(tr("Open Folder"), QDialogButtonBox::ResetRole); - connect(buttonFolder, &QPushButton::clicked, this, &IconPickerDialog::openFolder); -} - -bool IconPickerDialog::eventFilter(QObject *obj, QEvent *evt) -{ - if (obj != ui->iconView) - return QDialog::eventFilter(obj, evt); - if (evt->type() != QEvent::KeyPress) - { - return QDialog::eventFilter(obj, evt); - } - QKeyEvent *keyEvent = static_cast(evt); - switch (keyEvent->key()) - { - case Qt::Key_Delete: - removeSelectedIcon(); - return true; - case Qt::Key_Plus: - addNewIcon(); - return true; - default: - break; - } - return QDialog::eventFilter(obj, evt); -} - -void IconPickerDialog::addNewIcon() -{ - //: The title of the select icons open file dialog - QString selectIcons = tr("Select Icons"); - //: The type of icon files - auto filter = IconUtils::getIconFilter(); - QStringList fileNames = QFileDialog::getOpenFileNames(this, selectIcons, QString(), tr("Icons %1").arg(filter)); - MMC->icons()->installIcons(fileNames); -} - -void IconPickerDialog::removeSelectedIcon() -{ - MMC->icons()->deleteIcon(selectedIconKey); -} - -void IconPickerDialog::activated(QModelIndex index) -{ - selectedIconKey = index.data(Qt::UserRole).toString(); - accept(); -} - -void IconPickerDialog::selectionChanged(QItemSelection selected, QItemSelection deselected) -{ - if (selected.empty()) - return; - - QString key = selected.first().indexes().first().data(Qt::UserRole).toString(); - if (!key.isEmpty()) - selectedIconKey = key; -} - -int IconPickerDialog::execWithSelection(QString selection) -{ - auto list = MMC->icons(); - auto contentsWidget = ui->iconView; - selectedIconKey = selection; - - int index_nr = list->getIconIndex(selection); - auto model_index = list->index(index_nr); - contentsWidget->selectionModel()->select( - model_index, QItemSelectionModel::Current | QItemSelectionModel::Select); - - QMetaObject::invokeMethod(this, "delayed_scroll", Qt::QueuedConnection, - Q_ARG(QModelIndex, model_index)); - return QDialog::exec(); -} - -void IconPickerDialog::delayed_scroll(QModelIndex model_index) -{ - auto contentsWidget = ui->iconView; - contentsWidget->scrollTo(model_index); -} - -IconPickerDialog::~IconPickerDialog() -{ - delete ui; -} - -void IconPickerDialog::openFolder() -{ - DesktopServices::openDirectory(MMC->icons()->getDirectory(), true); -} diff --git a/application/dialogs/IconPickerDialog.h b/application/dialogs/IconPickerDialog.h deleted file mode 100644 index 9af6a678..00000000 --- a/application/dialogs/IconPickerDialog.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once -#include -#include - -namespace Ui -{ -class IconPickerDialog; -} - -class IconPickerDialog : public QDialog -{ - Q_OBJECT - -public: - explicit IconPickerDialog(QWidget *parent = 0); - ~IconPickerDialog(); - int execWithSelection(QString selection); - QString selectedIconKey; - -protected: - virtual bool eventFilter(QObject *, QEvent *); - -private: - Ui::IconPickerDialog *ui; - -private -slots: - void selectionChanged(QItemSelection, QItemSelection); - void activated(QModelIndex); - void delayed_scroll(QModelIndex); - void addNewIcon(); - void removeSelectedIcon(); - void openFolder(); -}; diff --git a/application/dialogs/IconPickerDialog.ui b/application/dialogs/IconPickerDialog.ui deleted file mode 100644 index c548edfb..00000000 --- a/application/dialogs/IconPickerDialog.ui +++ /dev/null @@ -1,67 +0,0 @@ - - - IconPickerDialog - - - - 0 - 0 - 676 - 555 - - - - Pick icon - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - IconPickerDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - IconPickerDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/application/dialogs/LoginDialog.cpp b/application/dialogs/LoginDialog.cpp deleted file mode 100644 index 32f8a48f..00000000 --- a/application/dialogs/LoginDialog.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "LoginDialog.h" -#include "ui_LoginDialog.h" - -#include "minecraft/auth/YggdrasilTask.h" - -#include - -LoginDialog::LoginDialog(QWidget *parent) : QDialog(parent), ui(new Ui::LoginDialog) -{ - ui->setupUi(this); - ui->progressBar->setVisible(false); - ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); - - connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); - connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); -} - -LoginDialog::~LoginDialog() -{ - delete ui; -} - -// Stage 1: User interaction -void LoginDialog::accept() -{ - setUserInputsEnabled(false); - ui->progressBar->setVisible(true); - - // Setup the login task and start it - m_account = MojangAccount::createFromUsername(ui->userTextBox->text()); - m_loginTask = m_account->login(nullptr, ui->passTextBox->text()); - connect(m_loginTask.get(), &Task::failed, this, &LoginDialog::onTaskFailed); - connect(m_loginTask.get(), &Task::succeeded, this, - &LoginDialog::onTaskSucceeded); - connect(m_loginTask.get(), &Task::status, this, &LoginDialog::onTaskStatus); - connect(m_loginTask.get(), &Task::progress, this, &LoginDialog::onTaskProgress); - m_loginTask->start(); -} - -void LoginDialog::setUserInputsEnabled(bool enable) -{ - ui->userTextBox->setEnabled(enable); - ui->passTextBox->setEnabled(enable); - ui->buttonBox->setEnabled(enable); -} - -// Enable the OK button only when both textboxes contain something. -void LoginDialog::on_userTextBox_textEdited(const QString &newText) -{ - ui->buttonBox->button(QDialogButtonBox::Ok) - ->setEnabled(!newText.isEmpty() && !ui->passTextBox->text().isEmpty()); -} -void LoginDialog::on_passTextBox_textEdited(const QString &newText) -{ - ui->buttonBox->button(QDialogButtonBox::Ok) - ->setEnabled(!newText.isEmpty() && !ui->userTextBox->text().isEmpty()); -} - -void LoginDialog::onTaskFailed(const QString &reason) -{ - // Set message - ui->label->setText("" + reason + ""); - - // Re-enable user-interaction - setUserInputsEnabled(true); - ui->progressBar->setVisible(false); -} - -void LoginDialog::onTaskSucceeded() -{ - QDialog::accept(); -} - -void LoginDialog::onTaskStatus(const QString &status) -{ - ui->label->setText(status); -} - -void LoginDialog::onTaskProgress(qint64 current, qint64 total) -{ - ui->progressBar->setMaximum(total); - ui->progressBar->setValue(current); -} - -// Public interface -MojangAccountPtr LoginDialog::newAccount(QWidget *parent, QString msg) -{ - LoginDialog dlg(parent); - dlg.ui->label->setText(msg); - if (dlg.exec() == QDialog::Accepted) - { - return dlg.m_account; - } - return 0; -} diff --git a/application/dialogs/LoginDialog.h b/application/dialogs/LoginDialog.h deleted file mode 100644 index 16bdddfb..00000000 --- a/application/dialogs/LoginDialog.h +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#include "minecraft/auth/MojangAccount.h" - -namespace Ui -{ -class LoginDialog; -} - -class LoginDialog : public QDialog -{ - Q_OBJECT - -public: - ~LoginDialog(); - - static MojangAccountPtr newAccount(QWidget *parent, QString message); - -private: - explicit LoginDialog(QWidget *parent = 0); - - void setUserInputsEnabled(bool enable); - -protected -slots: - void accept(); - - void onTaskFailed(const QString &reason); - void onTaskSucceeded(); - void onTaskStatus(const QString &status); - void onTaskProgress(qint64 current, qint64 total); - - void on_userTextBox_textEdited(const QString &newText); - void on_passTextBox_textEdited(const QString &newText); - -private: - Ui::LoginDialog *ui; - MojangAccountPtr m_account; - std::shared_ptr m_loginTask; -}; diff --git a/application/dialogs/LoginDialog.ui b/application/dialogs/LoginDialog.ui deleted file mode 100644 index dbdb3b93..00000000 --- a/application/dialogs/LoginDialog.ui +++ /dev/null @@ -1,87 +0,0 @@ - - - LoginDialog - - - - 0 - 0 - 421 - 238 - - - - - 0 - 0 - - - - Add Account - - - - - - NOTICE: MultiMC does not currently support Microsoft accounts. This means that accounts created from December 2020 onwards cannot be used. - - - true - - - - - - - Message label placeholder. - - - Qt::RichText - - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - Email - - - - - - - QLineEdit::Password - - - Password - - - - - - - 24 - - - false - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - diff --git a/application/dialogs/NewComponentDialog.cpp b/application/dialogs/NewComponentDialog.cpp deleted file mode 100644 index f4d6274f..00000000 --- a/application/dialogs/NewComponentDialog.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "MultiMC.h" -#include "NewComponentDialog.h" -#include "ui_NewComponentDialog.h" - -#include -#include -#include -#include - -#include "VersionSelectDialog.h" -#include "ProgressDialog.h" -#include "IconPickerDialog.h" - -#include -#include -#include -#include - -#include -#include - -NewComponentDialog::NewComponentDialog(const QString & initialName, const QString & initialUid, QWidget *parent) - : QDialog(parent), ui(new Ui::NewComponentDialog) -{ - ui->setupUi(this); - resize(minimumSizeHint()); - - ui->nameTextBox->setText(initialName); - ui->uidTextBox->setText(initialUid); - - connect(ui->nameTextBox, &QLineEdit::textChanged, this, &NewComponentDialog::updateDialogState); - connect(ui->uidTextBox, &QLineEdit::textChanged, this, &NewComponentDialog::updateDialogState); - - auto groups = MMC->instances()->getGroups().toSet(); - ui->nameTextBox->setFocus(); - - originalPlaceholderText = ui->uidTextBox->placeholderText(); - updateDialogState(); -} - -NewComponentDialog::~NewComponentDialog() -{ - delete ui; -} - -void NewComponentDialog::updateDialogState() -{ - auto protoUid = ui->nameTextBox->text().toLower(); - protoUid.remove(QRegularExpression("[^a-z]")); - if(protoUid.isEmpty()) - { - ui->uidTextBox->setPlaceholderText(originalPlaceholderText); - } - else - { - QString suggestedUid = "org.multimc.custom." + protoUid; - ui->uidTextBox->setPlaceholderText(suggestedUid); - } - bool allowOK = !name().isEmpty() && !uid().isEmpty() && !uidBlacklist.contains(uid()); - ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(allowOK); -} - -QString NewComponentDialog::name() const -{ - auto result = ui->nameTextBox->text(); - if(result.size()) - { - return result.trimmed(); - } - return QString(); -} - -QString NewComponentDialog::uid() const -{ - auto result = ui->uidTextBox->text(); - if(result.size()) - { - return result.trimmed(); - } - result = ui->uidTextBox->placeholderText(); - if(result.size() && result != originalPlaceholderText) - { - return result.trimmed(); - } - return QString(); -} - -void NewComponentDialog::setBlacklist(QStringList badUids) -{ - uidBlacklist = badUids; -} diff --git a/application/dialogs/NewComponentDialog.h b/application/dialogs/NewComponentDialog.h deleted file mode 100644 index 8c790beb..00000000 --- a/application/dialogs/NewComponentDialog.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include -#include - -namespace Ui -{ -class NewComponentDialog; -} - -class NewComponentDialog : public QDialog -{ - Q_OBJECT - -public: - explicit NewComponentDialog(const QString & initialName = QString(), const QString & initialUid = QString(), QWidget *parent = 0); - virtual ~NewComponentDialog(); - void setBlacklist(QStringList badUids); - - QString name() const; - QString uid() const; - -private slots: - void updateDialogState(); - -private: - Ui::NewComponentDialog *ui; - - QString originalPlaceholderText; - QStringList uidBlacklist; -}; diff --git a/application/dialogs/NewComponentDialog.ui b/application/dialogs/NewComponentDialog.ui deleted file mode 100644 index 03b0d222..00000000 --- a/application/dialogs/NewComponentDialog.ui +++ /dev/null @@ -1,101 +0,0 @@ - - - NewComponentDialog - - - Qt::ApplicationModal - - - - 0 - 0 - 345 - 146 - - - - Add Empty Component - - - - :/icons/toolbar/copy:/icons/toolbar/copy - - - true - - - - - - Name - - - - - - - uid - - - - - - - Qt::Horizontal - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - nameTextBox - uidTextBox - - - - - - - buttonBox - accepted() - NewComponentDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - NewComponentDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/application/dialogs/NewInstanceDialog.cpp b/application/dialogs/NewInstanceDialog.cpp deleted file mode 100644 index 86963149..00000000 --- a/application/dialogs/NewInstanceDialog.cpp +++ /dev/null @@ -1,255 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "MultiMC.h" -#include "NewInstanceDialog.h" -#include "ui_NewInstanceDialog.h" - -#include -#include -#include -#include - -#include "VersionSelectDialog.h" -#include "ProgressDialog.h" -#include "IconPickerDialog.h" - -#include -#include -#include -#include -#include - -#include "widgets/PageContainer.h" -#include -#include -#include -#include -#include -#include -#include - - - -NewInstanceDialog::NewInstanceDialog(const QString & initialGroup, const QString & url, QWidget *parent) - : QDialog(parent), ui(new Ui::NewInstanceDialog) -{ - ui->setupUi(this); - - setWindowIcon(MMC->getThemedIcon("new")); - - InstIconKey = "default"; - ui->iconButton->setIcon(MMC->icons()->getIcon(InstIconKey)); - - auto groups = MMC->instances()->getGroups().toSet(); - auto groupList = QStringList(groups.toList()); - groupList.sort(Qt::CaseInsensitive); - groupList.removeOne(""); - groupList.push_front(initialGroup); - groupList.push_front(""); - ui->groupBox->addItems(groupList); - int index = groupList.indexOf(initialGroup); - if(index == -1) - { - index = 0; - } - ui->groupBox->setCurrentIndex(index); - ui->groupBox->lineEdit()->setPlaceholderText(tr("No group")); - - - // NOTE: m_buttons must be initialized before PageContainer, because it indirectly accesses m_buttons through setSuggestedPack! Do not move this below. - m_buttons = new QDialogButtonBox(QDialogButtonBox::Help | QDialogButtonBox::Ok | QDialogButtonBox::Cancel); - - m_container = new PageContainer(this); - m_container->setSizePolicy(QSizePolicy::Policy::Preferred, QSizePolicy::Policy::Expanding); - m_container->layout()->setContentsMargins(0, 0, 0, 0); - ui->verticalLayout->insertWidget(2, m_container); - - m_container->addButtons(m_buttons); - - // Bonk Qt over its stupid head and make sure it understands which button is the default one... - // See: https://stackoverflow.com/questions/24556831/qbuttonbox-set-default-button - auto OkButton = m_buttons->button(QDialogButtonBox::Ok); - OkButton->setDefault(true); - OkButton->setAutoDefault(true); - connect(OkButton, &QPushButton::clicked, this, &NewInstanceDialog::accept); - - auto CancelButton = m_buttons->button(QDialogButtonBox::Cancel); - CancelButton->setDefault(false); - CancelButton->setAutoDefault(false); - connect(CancelButton, &QPushButton::clicked, this, &NewInstanceDialog::reject); - - auto HelpButton = m_buttons->button(QDialogButtonBox::Help); - HelpButton->setDefault(false); - HelpButton->setAutoDefault(false); - connect(HelpButton, &QPushButton::clicked, m_container, &PageContainer::help); - - if(!url.isEmpty()) - { - QUrl actualUrl(url); - m_container->selectPage("import"); - importPage->setUrl(url); - } - - updateDialogState(); - - restoreGeometry(QByteArray::fromBase64(MMC->settings()->get("NewInstanceGeometry").toByteArray())); -} - -void NewInstanceDialog::reject() -{ - MMC->settings()->set("NewInstanceGeometry", saveGeometry().toBase64()); - QDialog::reject(); -} - -void NewInstanceDialog::accept() -{ - MMC->settings()->set("NewInstanceGeometry", saveGeometry().toBase64()); - importIconNow(); - QDialog::accept(); -} - -QList NewInstanceDialog::getPages() -{ - importPage = new ImportPage(this); - flamePage = new FlamePage(this); - auto technicPage = new TechnicPage(this); - return - { - new VanillaPage(this), - importPage, - new AtlPage(this), - flamePage, - new FtbPage(this), - new LegacyFTB::Page(this), - technicPage - }; -} - -QString NewInstanceDialog::dialogTitle() -{ - return tr("New Instance"); -} - -NewInstanceDialog::~NewInstanceDialog() -{ - delete ui; -} - -void NewInstanceDialog::setSuggestedPack(const QString& name, InstanceTask* task) -{ - creationTask.reset(task); - ui->instNameTextBox->setPlaceholderText(name); - - if(!task) - { - ui->iconButton->setIcon(MMC->icons()->getIcon("default")); - importIcon = false; - } - - auto allowOK = task && !instName().isEmpty(); - m_buttons->button(QDialogButtonBox::Ok)->setEnabled(allowOK); -} - -void NewInstanceDialog::setSuggestedIconFromFile(const QString &path, const QString &name) -{ - importIcon = true; - importIconPath = path; - importIconName = name; - - //Hmm, for some reason they can be to small - ui->iconButton->setIcon(QIcon(path)); -} - -void NewInstanceDialog::setSuggestedIcon(const QString &key) -{ - auto icon = MMC->icons()->getIcon(key); - importIcon = false; - - ui->iconButton->setIcon(icon); -} - -InstanceTask * NewInstanceDialog::extractTask() -{ - InstanceTask * extracted = creationTask.get(); - creationTask.release(); - extracted->setName(instName()); - extracted->setGroup(instGroup()); - extracted->setIcon(iconKey()); - return extracted; -} - -void NewInstanceDialog::updateDialogState() -{ - auto allowOK = creationTask && !instName().isEmpty(); - auto OkButton = m_buttons->button(QDialogButtonBox::Ok); - if(OkButton->isEnabled() != allowOK) - { - OkButton->setEnabled(allowOK); - } -} - -QString NewInstanceDialog::instName() const -{ - auto result = ui->instNameTextBox->text().trimmed(); - if(result.size()) - { - return result; - } - result = ui->instNameTextBox->placeholderText().trimmed(); - if(result.size()) - { - return result; - } - return QString(); -} - -QString NewInstanceDialog::instGroup() const -{ - return ui->groupBox->currentText(); -} -QString NewInstanceDialog::iconKey() const -{ - return InstIconKey; -} - -void NewInstanceDialog::on_iconButton_clicked() -{ - importIconNow(); //so the user can switch back - IconPickerDialog dlg(this); - dlg.execWithSelection(InstIconKey); - - if (dlg.result() == QDialog::Accepted) - { - InstIconKey = dlg.selectedIconKey; - ui->iconButton->setIcon(MMC->icons()->getIcon(InstIconKey)); - importIcon = false; - } -} - -void NewInstanceDialog::on_instNameTextBox_textChanged(const QString &arg1) -{ - updateDialogState(); -} - -void NewInstanceDialog::importIconNow() -{ - if(importIcon) { - MMC->icons()->installIcon(importIconPath, importIconName); - InstIconKey = importIconName; - importIcon = false; - } - MMC->settings()->set("NewInstanceGeometry", saveGeometry().toBase64()); -} diff --git a/application/dialogs/NewInstanceDialog.h b/application/dialogs/NewInstanceDialog.h deleted file mode 100644 index 53abf8cf..00000000 --- a/application/dialogs/NewInstanceDialog.h +++ /dev/null @@ -1,80 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include "BaseVersion.h" -#include "pages/BasePageProvider.h" -#include "InstanceTask.h" - -namespace Ui -{ -class NewInstanceDialog; -} - -class PageContainer; -class QDialogButtonBox; -class ImportPage; -class FlamePage; - -class NewInstanceDialog : public QDialog, public BasePageProvider -{ - Q_OBJECT - -public: - explicit NewInstanceDialog(const QString & initialGroup, const QString & url = QString(), QWidget *parent = 0); - ~NewInstanceDialog(); - - void updateDialogState(); - - void setSuggestedPack(const QString & name = QString(), InstanceTask * task = nullptr); - void setSuggestedIconFromFile(const QString &path, const QString &name); - void setSuggestedIcon(const QString &key); - - InstanceTask * extractTask(); - - QString dialogTitle() override; - QList getPages() override; - - QString instName() const; - QString instGroup() const; - QString iconKey() const; - -public slots: - void accept() override; - void reject() override; - -private slots: - void on_iconButton_clicked(); - void on_instNameTextBox_textChanged(const QString &arg1); - -private: - Ui::NewInstanceDialog *ui = nullptr; - PageContainer * m_container = nullptr; - QDialogButtonBox * m_buttons = nullptr; - - QString InstIconKey; - ImportPage *importPage = nullptr; - FlamePage *flamePage = nullptr; - std::unique_ptr creationTask; - - bool importIcon = false; - QString importIconPath; - QString importIconName; - - void importIconNow(); -}; diff --git a/application/dialogs/NewInstanceDialog.ui b/application/dialogs/NewInstanceDialog.ui deleted file mode 100644 index 7fb19ff5..00000000 --- a/application/dialogs/NewInstanceDialog.ui +++ /dev/null @@ -1,87 +0,0 @@ - - - NewInstanceDialog - - - Qt::ApplicationModal - - - - 0 - 0 - 730 - 127 - - - - New Instance - - - - :/icons/toolbar/new:/icons/toolbar/new - - - true - - - - - - - - true - - - - - - - &Group: - - - groupBox - - - - - - - - - - &Name: - - - instNameTextBox - - - - - - - - 80 - 80 - - - - - - - - - - Qt::Horizontal - - - - - - - iconButton - instNameTextBox - groupBox - - - - diff --git a/application/dialogs/NotificationDialog.cpp b/application/dialogs/NotificationDialog.cpp deleted file mode 100644 index f2a35ae2..00000000 --- a/application/dialogs/NotificationDialog.cpp +++ /dev/null @@ -1,86 +0,0 @@ -#include "NotificationDialog.h" -#include "ui_NotificationDialog.h" - -#include -#include - -NotificationDialog::NotificationDialog(const NotificationChecker::NotificationEntry &entry, QWidget *parent) : - QDialog(parent, Qt::MSWindowsFixedSizeDialogHint | Qt::WindowTitleHint | Qt::CustomizeWindowHint), - ui(new Ui::NotificationDialog) -{ - ui->setupUi(this); - - QStyle::StandardPixmap icon; - switch (entry.type) - { - case NotificationChecker::NotificationEntry::Critical: - icon = QStyle::SP_MessageBoxCritical; - break; - case NotificationChecker::NotificationEntry::Warning: - icon = QStyle::SP_MessageBoxWarning; - break; - default: - case NotificationChecker::NotificationEntry::Information: - icon = QStyle::SP_MessageBoxInformation; - break; - } - ui->iconLabel->setPixmap(style()->standardPixmap(icon, 0, this)); - ui->messageLabel->setText(entry.message); - - m_dontShowAgainText = tr("Don't show again"); - m_closeText = tr("Close"); - - ui->dontShowAgainBtn->setText(m_dontShowAgainText + QString(" (%1)").arg(m_dontShowAgainTime)); - ui->closeBtn->setText(m_closeText + QString(" (%1)").arg(m_closeTime)); - - startTimer(1000); -} - -NotificationDialog::~NotificationDialog() -{ - delete ui; -} - -void NotificationDialog::timerEvent(QTimerEvent *event) -{ - if (m_dontShowAgainTime > 0) - { - m_dontShowAgainTime--; - if (m_dontShowAgainTime == 0) - { - ui->dontShowAgainBtn->setText(m_dontShowAgainText); - ui->dontShowAgainBtn->setEnabled(true); - } - else - { - ui->dontShowAgainBtn->setText(m_dontShowAgainText + QString(" (%1)").arg(m_dontShowAgainTime)); - } - } - if (m_closeTime > 0) - { - m_closeTime--; - if (m_closeTime == 0) - { - ui->closeBtn->setText(m_closeText); - ui->closeBtn->setEnabled(true); - } - else - { - ui->closeBtn->setText(m_closeText + QString(" (%1)").arg(m_closeTime)); - } - } - - if (m_closeTime == 0 && m_dontShowAgainTime == 0) - { - killTimer(event->timerId()); - } -} - -void NotificationDialog::on_dontShowAgainBtn_clicked() -{ - done(DontShowAgain); -} -void NotificationDialog::on_closeBtn_clicked() -{ - done(Normal); -} diff --git a/application/dialogs/NotificationDialog.h b/application/dialogs/NotificationDialog.h deleted file mode 100644 index e1cbb9fa..00000000 --- a/application/dialogs/NotificationDialog.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef NOTIFICATIONDIALOG_H -#define NOTIFICATIONDIALOG_H - -#include - -#include "notifications/NotificationChecker.h" - -namespace Ui { -class NotificationDialog; -} - -class NotificationDialog : public QDialog -{ - Q_OBJECT - -public: - explicit NotificationDialog(const NotificationChecker::NotificationEntry &entry, QWidget *parent = 0); - ~NotificationDialog(); - - enum ExitCode - { - Normal, - DontShowAgain - }; - -protected: - void timerEvent(QTimerEvent *event); - -private: - Ui::NotificationDialog *ui; - - int m_dontShowAgainTime = 10; - int m_closeTime = 5; - - QString m_dontShowAgainText; - QString m_closeText; - -private -slots: - void on_dontShowAgainBtn_clicked(); - void on_closeBtn_clicked(); -}; - -#endif // NOTIFICATIONDIALOG_H diff --git a/application/dialogs/NotificationDialog.ui b/application/dialogs/NotificationDialog.ui deleted file mode 100644 index 3e6c22bc..00000000 --- a/application/dialogs/NotificationDialog.ui +++ /dev/null @@ -1,85 +0,0 @@ - - - NotificationDialog - - - - 0 - 0 - 320 - 240 - - - - Notification - - - - - - - - TextLabel - - - - - - - TextLabel - - - true - - - true - - - Qt::TextBrowserInteraction - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - false - - - Don't show again - - - - - - - false - - - Close - - - - - - - - - - diff --git a/application/dialogs/ProfileSelectDialog.cpp b/application/dialogs/ProfileSelectDialog.cpp deleted file mode 100644 index ae34709f..00000000 --- a/application/dialogs/ProfileSelectDialog.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "ProfileSelectDialog.h" -#include -#include "ui_ProfileSelectDialog.h" - -#include - -#include - -#include - -#include - -ProfileSelectDialog::ProfileSelectDialog(const QString &message, int flags, QWidget *parent) - : QDialog(parent), ui(new Ui::ProfileSelectDialog) -{ - ui->setupUi(this); - - m_accounts = MMC->accounts(); - auto view = ui->listView; - //view->setModel(m_accounts.get()); - //view->hideColumn(MojangAccountList::ActiveColumn); - view->setColumnCount(1); - view->setRootIsDecorated(false); - if(QTreeWidgetItem* header = view->headerItem()) - { - header->setText(0, tr("Name")); - } - else - { - view->setHeaderLabel(tr("Name")); - } - QList items; - for (int i = 0; i < m_accounts->count(); i++) - { - MojangAccountPtr account = m_accounts->at(i); - for (auto profile : account->profiles()) - { - auto profileLabel = profile.name; - if(account->isInUse()) - { - profileLabel += tr(" (in use)"); - } - auto item = new QTreeWidgetItem(view); - item->setText(0, profileLabel); - item->setIcon(0, SkinUtils::getFaceFromCache(profile.id)); - item->setData(0, MojangAccountList::PointerRole, QVariant::fromValue(account)); - items.append(item); - } - } - view->addTopLevelItems(items); - - // Set the message label. - ui->msgLabel->setVisible(!message.isEmpty()); - ui->msgLabel->setText(message); - - // Flags... - ui->globalDefaultCheck->setVisible(flags & GlobalDefaultCheckbox); - ui->instDefaultCheck->setVisible(flags & InstanceDefaultCheckbox); - qDebug() << flags; - - // Select the first entry in the list. - ui->listView->setCurrentIndex(ui->listView->model()->index(0, 0)); - - connect(ui->listView, SIGNAL(doubleClicked(QModelIndex)), SLOT(on_buttonBox_accepted())); -} - -ProfileSelectDialog::~ProfileSelectDialog() -{ - delete ui; -} - -MojangAccountPtr ProfileSelectDialog::selectedAccount() const -{ - return m_selected; -} - -bool ProfileSelectDialog::useAsGlobalDefault() const -{ - return ui->globalDefaultCheck->isChecked(); -} - -bool ProfileSelectDialog::useAsInstDefaullt() const -{ - return ui->instDefaultCheck->isChecked(); -} - -void ProfileSelectDialog::on_buttonBox_accepted() -{ - QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes(); - if (selection.size() > 0) - { - QModelIndex selected = selection.first(); - m_selected = selected.data(MojangAccountList::PointerRole).value(); - } - close(); -} - -void ProfileSelectDialog::on_buttonBox_rejected() -{ - close(); -} diff --git a/application/dialogs/ProfileSelectDialog.h b/application/dialogs/ProfileSelectDialog.h deleted file mode 100644 index 9f95830c..00000000 --- a/application/dialogs/ProfileSelectDialog.h +++ /dev/null @@ -1,90 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include - -#include "minecraft/auth/MojangAccountList.h" - -namespace Ui -{ -class ProfileSelectDialog; -} - -class ProfileSelectDialog : public QDialog -{ - Q_OBJECT -public: - enum Flags - { - NoFlags = 0, - - /*! - * Shows a check box on the dialog that allows the user to specify that the account - * they've selected should be used as the global default for all instances. - */ - GlobalDefaultCheckbox, - - /*! - * Shows a check box on the dialog that allows the user to specify that the account - * they've selected should be used as the default for the instance they are currently launching. - * This is not currently implemented. - */ - InstanceDefaultCheckbox, - }; - - /*! - * Constructs a new account select dialog with the given parent and message. - * The message will be shown at the top of the dialog. It is an empty string by default. - */ - explicit ProfileSelectDialog(const QString& message="", int flags=0, QWidget *parent = 0); - ~ProfileSelectDialog(); - - /*! - * Gets a pointer to the account that the user selected. - * This is null if the user clicked cancel or hasn't clicked OK yet. - */ - MojangAccountPtr selectedAccount() const; - - /*! - * Returns true if the user checked the "use as global default" checkbox. - * If the checkbox wasn't shown, this function returns false. - */ - bool useAsGlobalDefault() const; - - /*! - * Returns true if the user checked the "use as instance default" checkbox. - * If the checkbox wasn't shown, this function returns false. - */ - bool useAsInstDefaullt() const; - -public -slots: - void on_buttonBox_accepted(); - - void on_buttonBox_rejected(); - -protected: - std::shared_ptr m_accounts; - - //! The account that was selected when the user clicked OK. - MojangAccountPtr m_selected; - -private: - Ui::ProfileSelectDialog *ui; -}; diff --git a/application/dialogs/ProfileSelectDialog.ui b/application/dialogs/ProfileSelectDialog.ui deleted file mode 100644 index e779b51b..00000000 --- a/application/dialogs/ProfileSelectDialog.ui +++ /dev/null @@ -1,62 +0,0 @@ - - - ProfileSelectDialog - - - - 0 - 0 - 465 - 300 - - - - Select an Account - - - - - - Select a profile. - - - - - - - - 1 - - - - - - - - - - Use as default? - - - - - - - Use as default for this instance only? - - - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - diff --git a/application/dialogs/ProgressDialog.cpp b/application/dialogs/ProgressDialog.cpp deleted file mode 100644 index 4b092859..00000000 --- a/application/dialogs/ProgressDialog.cpp +++ /dev/null @@ -1,196 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "ProgressDialog.h" -#include "ui_ProgressDialog.h" - -#include -#include - -#include "tasks/Task.h" - -ProgressDialog::ProgressDialog(QWidget *parent) : QDialog(parent), ui(new Ui::ProgressDialog) -{ - ui->setupUi(this); - this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint); - setSkipButton(false); - changeProgress(0, 100); -} - -void ProgressDialog::setSkipButton(bool present, QString label) -{ - ui->skipButton->setAutoDefault(false); - ui->skipButton->setDefault(false); - ui->skipButton->setFocusPolicy(Qt::ClickFocus); - ui->skipButton->setEnabled(present); - ui->skipButton->setVisible(present); - ui->skipButton->setText(label); - updateSize(); -} - -void ProgressDialog::on_skipButton_clicked(bool checked) -{ - Q_UNUSED(checked); - task->abort(); -} - -ProgressDialog::~ProgressDialog() -{ - delete ui; -} - -void ProgressDialog::updateSize() -{ - QSize qSize = QSize(480, minimumSizeHint().height()); - resize(qSize); - setFixedSize(qSize); -} - -int ProgressDialog::execWithTask(Task *task) -{ - this->task = task; - QDialog::DialogCode result; - - if(!task) - { - qDebug() << "Programmer error: progress dialog created with null task."; - return Accepted; - } - - if(handleImmediateResult(result)) - { - return result; - } - - // Connect signals. - connect(task, SIGNAL(started()), SLOT(onTaskStarted())); - connect(task, SIGNAL(failed(QString)), SLOT(onTaskFailed(QString))); - connect(task, SIGNAL(succeeded()), SLOT(onTaskSucceeded())); - connect(task, SIGNAL(status(QString)), SLOT(changeStatus(const QString &))); - connect(task, SIGNAL(progress(qint64, qint64)), SLOT(changeProgress(qint64, qint64))); - - // if this didn't connect to an already running task, invoke start - if(!task->isRunning()) - { - task->start(); - } - if(task->isRunning()) - { - changeProgress(task->getProgress(), task->getTotalProgress()); - changeStatus(task->getStatus()); - return QDialog::exec(); - } - else if(handleImmediateResult(result)) - { - return result; - } - else - { - return QDialog::Rejected; - } -} - -// TODO: only provide the unique_ptr overloads -int ProgressDialog::execWithTask(std::unique_ptr &&task) -{ - connect(this, &ProgressDialog::destroyed, task.get(), &Task::deleteLater); - return execWithTask(task.release()); -} -int ProgressDialog::execWithTask(std::unique_ptr &task) -{ - connect(this, &ProgressDialog::destroyed, task.get(), &Task::deleteLater); - return execWithTask(task.release()); -} - -bool ProgressDialog::handleImmediateResult(QDialog::DialogCode &result) -{ - if(task->isFinished()) - { - if(task->wasSuccessful()) - { - result = QDialog::Accepted; - } - else - { - result = QDialog::Rejected; - } - return true; - } - return false; -} - -Task *ProgressDialog::getTask() -{ - return task; -} - -void ProgressDialog::onTaskStarted() -{ -} - -void ProgressDialog::onTaskFailed(QString failure) -{ - reject(); -} - -void ProgressDialog::onTaskSucceeded() -{ - accept(); -} - -void ProgressDialog::changeStatus(const QString &status) -{ - ui->statusLabel->setText(status); - updateSize(); -} - -void ProgressDialog::changeProgress(qint64 current, qint64 total) -{ - ui->taskProgressBar->setMaximum(total); - ui->taskProgressBar->setValue(current); -} - -void ProgressDialog::keyPressEvent(QKeyEvent *e) -{ - if(ui->skipButton->isVisible()) - { - if (e->key() == Qt::Key_Escape) - { - on_skipButton_clicked(true); - return; - } - else if(e->key() == Qt::Key_Tab) - { - ui->skipButton->setFocusPolicy(Qt::StrongFocus); - ui->skipButton->setFocus(); - ui->skipButton->setAutoDefault(true); - ui->skipButton->setDefault(true); - return; - } - } - QDialog::keyPressEvent(e); -} - -void ProgressDialog::closeEvent(QCloseEvent *e) -{ - if (task && task->isRunning()) - { - e->ignore(); - } - else - { - QDialog::closeEvent(e); - } -} diff --git a/application/dialogs/ProgressDialog.h b/application/dialogs/ProgressDialog.h deleted file mode 100644 index b28ad4fa..00000000 --- a/application/dialogs/ProgressDialog.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -class Task; - -namespace Ui -{ -class ProgressDialog; -} - -class ProgressDialog : public QDialog -{ - Q_OBJECT - -public: - explicit ProgressDialog(QWidget *parent = 0); - ~ProgressDialog(); - - void updateSize(); - - int execWithTask(Task *task); - int execWithTask(std::unique_ptr &&task); - int execWithTask(std::unique_ptr &task); - - void setSkipButton(bool present, QString label = QString()); - - Task *getTask(); - -public -slots: - void onTaskStarted(); - void onTaskFailed(QString failure); - void onTaskSucceeded(); - - void changeStatus(const QString &status); - void changeProgress(qint64 current, qint64 total); - - -private -slots: - void on_skipButton_clicked(bool checked); - -protected: - virtual void keyPressEvent(QKeyEvent *e); - virtual void closeEvent(QCloseEvent *e); - -private: - bool handleImmediateResult(QDialog::DialogCode &result); - -private: - Ui::ProgressDialog *ui; - - Task *task; -}; diff --git a/application/dialogs/ProgressDialog.ui b/application/dialogs/ProgressDialog.ui deleted file mode 100644 index 04b8fef3..00000000 --- a/application/dialogs/ProgressDialog.ui +++ /dev/null @@ -1,66 +0,0 @@ - - - ProgressDialog - - - - 0 - 0 - 400 - 100 - - - - - 400 - 0 - - - - - 600 - 16777215 - - - - Please wait... - - - - - - Task Status... - - - true - - - - - - - 24 - - - false - - - - - - - - 0 - 0 - - - - Skip - - - - - - - - diff --git a/application/dialogs/SkinUploadDialog.cpp b/application/dialogs/SkinUploadDialog.cpp deleted file mode 100644 index 56133529..00000000 --- a/application/dialogs/SkinUploadDialog.cpp +++ /dev/null @@ -1,114 +0,0 @@ -#include -#include -#include -#include -#include "SkinUploadDialog.h" -#include "ui_SkinUploadDialog.h" -#include "ProgressDialog.h" -#include "CustomMessageBox.h" - -void SkinUploadDialog::on_buttonBox_rejected() -{ - close(); -} - -void SkinUploadDialog::on_buttonBox_accepted() -{ - AuthSessionPtr session = std::make_shared(); - auto login = m_acct->login(session); - ProgressDialog prog(this); - if (prog.execWithTask((Task*)login.get()) != QDialog::Accepted) - { - //FIXME: recover with password prompt - CustomMessageBox::selectable(this, tr("Skin Upload"), tr("Failed to login!"), QMessageBox::Warning)->exec(); - close(); - return; - } - QString fileName; - QString input = ui->skinPathTextBox->text(); - QRegExp urlPrefixMatcher("^([a-z]+)://.+$"); - bool isLocalFile = false; - // it has an URL prefix -> it is an URL - if(urlPrefixMatcher.exactMatch(input)) - { - QUrl fileURL = input; - if(fileURL.isValid()) - { - // local? - if(fileURL.isLocalFile()) - { - isLocalFile = true; - fileName = fileURL.toLocalFile(); - } - else - { - CustomMessageBox::selectable( - this, - tr("Skin Upload"), - tr("Using remote URLs for setting skins is not implemented yet."), - QMessageBox::Warning - )->exec(); - close(); - return; - } - } - else - { - CustomMessageBox::selectable( - this, - tr("Skin Upload"), - tr("You cannot use an invalid URL for uploading skins."), - QMessageBox::Warning - )->exec(); - close(); - return; - } - } - else - { - // just assume it's a path then - isLocalFile = true; - fileName = ui->skinPathTextBox->text(); - } - if (isLocalFile && !QFile::exists(fileName)) - { - CustomMessageBox::selectable(this, tr("Skin Upload"), tr("Skin file does not exist!"), QMessageBox::Warning)->exec(); - close(); - return; - } - SkinUpload::Model model = SkinUpload::STEVE; - if (ui->steveBtn->isChecked()) - { - model = SkinUpload::STEVE; - } - else if (ui->alexBtn->isChecked()) - { - model = SkinUpload::ALEX; - } - SkinUploadPtr upload = std::make_shared(this, session, FS::read(fileName), model); - if (prog.execWithTask((Task*)upload.get()) != QDialog::Accepted) - { - CustomMessageBox::selectable(this, tr("Skin Upload"), tr("Failed to upload skin!"), QMessageBox::Warning)->exec(); - close(); - return; - } - CustomMessageBox::selectable(this, tr("Skin Upload"), tr("Success"), QMessageBox::Information)->exec(); - close(); -} - -void SkinUploadDialog::on_skinBrowseBtn_clicked() -{ - QString raw_path = QFileDialog::getOpenFileName(this, tr("Select Skin Texture"), QString(), "*.png"); - if (raw_path.isEmpty() || !QFileInfo::exists(raw_path)) - { - return; - } - QString cooked_path = FS::NormalizePath(raw_path); - ui->skinPathTextBox->setText(cooked_path); -} - -SkinUploadDialog::SkinUploadDialog(MojangAccountPtr acct, QWidget *parent) - :QDialog(parent), m_acct(acct), ui(new Ui::SkinUploadDialog) -{ - ui->setupUi(this); -} diff --git a/application/dialogs/SkinUploadDialog.h b/application/dialogs/SkinUploadDialog.h deleted file mode 100644 index deb44eac..00000000 --- a/application/dialogs/SkinUploadDialog.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#include -#include - -namespace Ui -{ - class SkinUploadDialog; -} - -class SkinUploadDialog : public QDialog { - Q_OBJECT -public: - explicit SkinUploadDialog(MojangAccountPtr acct, QWidget *parent = 0); - virtual ~SkinUploadDialog() {}; - -public slots: - void on_buttonBox_accepted(); - - void on_buttonBox_rejected(); - - void on_skinBrowseBtn_clicked(); - -protected: - MojangAccountPtr m_acct; - -private: - Ui::SkinUploadDialog *ui; -}; diff --git a/application/dialogs/SkinUploadDialog.ui b/application/dialogs/SkinUploadDialog.ui deleted file mode 100644 index 6f5307e3..00000000 --- a/application/dialogs/SkinUploadDialog.ui +++ /dev/null @@ -1,85 +0,0 @@ - - - SkinUploadDialog - - - - 0 - 0 - 413 - 300 - - - - Skin Upload - - - - - - Skin File - - - - - - - - - - 0 - 0 - - - - - 28 - 16777215 - - - - ... - - - - - - - - - - Player Model - - - - - - Steve Model - - - true - - - - - - - Alex Model - - - - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - diff --git a/application/dialogs/UpdateDialog.cpp b/application/dialogs/UpdateDialog.cpp deleted file mode 100644 index 2baaf5e9..00000000 --- a/application/dialogs/UpdateDialog.cpp +++ /dev/null @@ -1,182 +0,0 @@ -#include "UpdateDialog.h" -#include "ui_UpdateDialog.h" -#include -#include "MultiMC.h" -#include -#include - -#include "BuildConfig.h" -#include "HoeDown.h" - -UpdateDialog::UpdateDialog(bool hasUpdate, QWidget *parent) : QDialog(parent), ui(new Ui::UpdateDialog) -{ - ui->setupUi(this); - auto channel = MMC->settings()->get("UpdateChannel").toString(); - if(hasUpdate) - { - ui->label->setText(tr("A new %1 update is available!").arg(channel)); - } - else - { - ui->label->setText(tr("No %1 updates found. You are running the latest version.").arg(channel)); - ui->btnUpdateNow->setHidden(true); - ui->btnUpdateLater->setText(tr("Close")); - } - ui->changelogBrowser->setHtml(tr("

Loading changelog...

")); - loadChangelog(); - restoreGeometry(QByteArray::fromBase64(MMC->settings()->get("UpdateDialogGeometry").toByteArray())); -} - -UpdateDialog::~UpdateDialog() -{ -} - -void UpdateDialog::loadChangelog() -{ - auto channel = MMC->settings()->get("UpdateChannel").toString(); - dljob.reset(new NetJob("Changelog")); - QString url; - if(channel == "stable") - { - url = QString("https://raw.githubusercontent.com/MultiMC/MultiMC5/%1/changelog.md").arg(channel); - m_changelogType = CHANGELOG_MARKDOWN; - } - else - { - url = QString("https://api.github.com/repos/MultiMC/MultiMC5/compare/%1...%2").arg(BuildConfig.GIT_COMMIT, channel); - m_changelogType = CHANGELOG_COMMITS; - } - dljob->addNetAction(Net::Download::makeByteArray(QUrl(url), &changelogData)); - connect(dljob.get(), &NetJob::succeeded, this, &UpdateDialog::changelogLoaded); - connect(dljob.get(), &NetJob::failed, this, &UpdateDialog::changelogFailed); - dljob->start(); -} - -QString reprocessMarkdown(QByteArray markdown) -{ - HoeDown hoedown; - QString output = hoedown.process(markdown); - - // HACK: easier than customizing hoedown - output.replace(QRegExp("GH-([0-9]+)"), "GH-\\1"); - qDebug() << output; - return output; -} - -QString reprocessCommits(QByteArray json) -{ - auto channel = MMC->settings()->get("UpdateChannel").toString(); - try - { - QString result; - auto document = Json::requireDocument(json); - auto rootobject = Json::requireObject(document); - auto status = Json::requireString(rootobject, "status"); - auto diff_url = Json::requireString(rootobject, "html_url"); - - auto print_commits = [&]() - { - result += ""; - auto commitarray = Json::requireArray(rootobject, "commits"); - for(int i = commitarray.size() - 1; i >= 0; i--) - { - const auto & commitval = commitarray[i]; - auto commitobj = Json::requireObject(commitval); - auto parents_info = Json::ensureArray(commitobj, "parents"); - // NOTE: this ignores merge commits, because they have more than one parent - if(parents_info.size() > 1) - { - continue; - } - auto commit_url = Json::requireString(commitobj, "html_url"); - auto commit_info = Json::requireObject(commitobj, "commit"); - auto commit_message = Json::requireString(commit_info, "message"); - auto lines = commit_message.split('\n'); - QRegularExpression regexp("(?(GH-(?[0-9]+))|(NOISSUE)|(SCRATCH))? *(?.*) *"); - auto match = regexp.match(lines.takeFirst(), 0, QRegularExpression::NormalMatch); - auto issuenr = match.captured("issuenr"); - auto prefix = match.captured("prefix"); - auto rest = match.captured("rest"); - result += ""; - lines.prepend(rest); - result += ""; - } - result += "
"; - if(issuenr.length()) - { - result += QString("GH-%2").arg(issuenr, issuenr); - } - else if(prefix.length()) - { - result += QString("%2").arg(commit_url, prefix); - } - else - { - result += QString("NOISSUE").arg(commit_url); - } - result += "

" + lines.join("
") + "

"; - }; - - if(status == "identical") - { - return QObject::tr("

There are no code changes between your current version and latest %1.

").arg(channel); - } - else if(status == "ahead") - { - result += QObject::tr("

Following commits were added since last update:

"); - print_commits(); - } - else if(status == "diverged") - { - auto commit_ahead = Json::requireInteger(rootobject, "ahead_by"); - auto commit_behind = Json::requireInteger(rootobject, "behind_by"); - result += QObject::tr("

The update removes %1 commits and adds the following %2:

").arg(commit_behind).arg(commit_ahead); - print_commits(); - } - result += QObject::tr("

You can look at the changes on github.

").arg(diff_url); - return result; - } - catch (const JSONValidationError &e) - { - qWarning() << "Got an unparseable commit log from github:" << e.what(); - qDebug() << json; - } - return QString(); -} - -void UpdateDialog::changelogLoaded() -{ - QString result; - switch(m_changelogType) - { - case CHANGELOG_COMMITS: - result = reprocessCommits(changelogData); - break; - case CHANGELOG_MARKDOWN: - result = reprocessMarkdown(changelogData); - break; - } - changelogData.clear(); - ui->changelogBrowser->setHtml(result); -} - -void UpdateDialog::changelogFailed(QString reason) -{ - ui->changelogBrowser->setHtml(tr("

Failed to fetch changelog... Error: %1

").arg(reason)); -} - -void UpdateDialog::on_btnUpdateLater_clicked() -{ - reject(); -} - -void UpdateDialog::on_btnUpdateNow_clicked() -{ - done(UPDATE_NOW); -} - -void UpdateDialog::closeEvent(QCloseEvent* evt) -{ - MMC->settings()->set("UpdateDialogGeometry", saveGeometry().toBase64()); - QDialog::closeEvent(evt); -} diff --git a/application/dialogs/UpdateDialog.h b/application/dialogs/UpdateDialog.h deleted file mode 100644 index ae1799c3..00000000 --- a/application/dialogs/UpdateDialog.h +++ /dev/null @@ -1,67 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include "net/NetJob.h" - -namespace Ui -{ -class UpdateDialog; -} - -enum UpdateAction -{ - UPDATE_LATER = QDialog::Rejected, - UPDATE_NOW = QDialog::Accepted, -}; - -enum ChangelogType -{ - CHANGELOG_MARKDOWN, - CHANGELOG_COMMITS -}; - -class UpdateDialog : public QDialog -{ - Q_OBJECT - -public: - explicit UpdateDialog(bool hasUpdate = true, QWidget *parent = 0); - ~UpdateDialog(); - -public slots: - void on_btnUpdateNow_clicked(); - void on_btnUpdateLater_clicked(); - - /// Starts loading the changelog - void loadChangelog(); - - /// Slot for when the chengelog loads successfully. - void changelogLoaded(); - - /// Slot for when the chengelog fails to load... - void changelogFailed(QString reason); - -protected: - void closeEvent(QCloseEvent * ) override; - -private: - Ui::UpdateDialog *ui; - QByteArray changelogData; - NetJobPtr dljob; - ChangelogType m_changelogType = CHANGELOG_MARKDOWN; -}; diff --git a/application/dialogs/UpdateDialog.ui b/application/dialogs/UpdateDialog.ui deleted file mode 100644 index b0b3dd83..00000000 --- a/application/dialogs/UpdateDialog.ui +++ /dev/null @@ -1,91 +0,0 @@ - - - UpdateDialog - - - - 0 - 0 - 657 - 673 - - - - MultiMC Update - - - - :/icons/toolbar/checkupdate:/icons/toolbar/checkupdate - - - - - - - - - 14 - - - - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - changelogBrowser - - - - - - - - - true - - - - - - - - - - 0 - 0 - - - - Update now - - - - - - - - 0 - 0 - - - - Don't update yet - - - - - - - - - changelogBrowser - btnUpdateNow - btnUpdateLater - - - - - - diff --git a/application/dialogs/VersionSelectDialog.cpp b/application/dialogs/VersionSelectDialog.cpp deleted file mode 100644 index ed1210ba..00000000 --- a/application/dialogs/VersionSelectDialog.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "VersionSelectDialog.h" - -#include -#include -#include -#include -#include - -#include -#include "CustomMessageBox.h" - -#include -#include -#include -#include -#include "MultiMC.h" -#include -#include - -VersionSelectDialog::VersionSelectDialog(BaseVersionList *vlist, QString title, QWidget *parent, bool cancelable) - : QDialog(parent) -{ - setObjectName(QStringLiteral("VersionSelectDialog")); - resize(400, 347); - m_verticalLayout = new QVBoxLayout(this); - m_verticalLayout->setObjectName(QStringLiteral("verticalLayout")); - - m_versionWidget = new VersionSelectWidget(parent); - m_verticalLayout->addWidget(m_versionWidget); - - m_horizontalLayout = new QHBoxLayout(); - m_horizontalLayout->setObjectName(QStringLiteral("horizontalLayout")); - - m_refreshButton = new QPushButton(this); - m_refreshButton->setObjectName(QStringLiteral("refreshButton")); - m_horizontalLayout->addWidget(m_refreshButton); - - m_buttonBox = new QDialogButtonBox(this); - m_buttonBox->setObjectName(QStringLiteral("buttonBox")); - m_buttonBox->setOrientation(Qt::Horizontal); - m_buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); - m_horizontalLayout->addWidget(m_buttonBox); - - m_verticalLayout->addLayout(m_horizontalLayout); - - retranslate(); - - QObject::connect(m_buttonBox, SIGNAL(accepted()), this, SLOT(accept())); - QObject::connect(m_buttonBox, SIGNAL(rejected()), this, SLOT(reject())); - - QMetaObject::connectSlotsByName(this); - setWindowModality(Qt::WindowModal); - setWindowTitle(title); - - m_vlist = vlist; - - if (!cancelable) - { - m_buttonBox->button(QDialogButtonBox::Cancel)->setEnabled(false); - } -} - -void VersionSelectDialog::retranslate() -{ - // FIXME: overrides custom title given in constructor! - setWindowTitle(tr("Choose Version")); - m_refreshButton->setToolTip(tr("Reloads the version list.")); - m_refreshButton->setText(tr("&Refresh")); -} - -void VersionSelectDialog::setCurrentVersion(const QString& version) -{ - m_currentVersion = version; - m_versionWidget->setCurrentVersion(version); -} - -void VersionSelectDialog::setEmptyString(QString emptyString) -{ - m_versionWidget->setEmptyString(emptyString); -} - -void VersionSelectDialog::setEmptyErrorString(QString emptyErrorString) -{ - m_versionWidget->setEmptyErrorString(emptyErrorString); -} - -void VersionSelectDialog::setResizeOn(int column) -{ - resizeOnColumn = column; -} - -int VersionSelectDialog::exec() -{ - QDialog::open(); - m_versionWidget->initialize(m_vlist); - if(resizeOnColumn != -1) - { - m_versionWidget->setResizeOn(resizeOnColumn); - } - return QDialog::exec(); -} - -void VersionSelectDialog::selectRecommended() -{ - m_versionWidget->selectRecommended(); -} - -BaseVersionPtr VersionSelectDialog::selectedVersion() const -{ - return m_versionWidget->selectedVersion(); -} - -void VersionSelectDialog::on_refreshButton_clicked() -{ - m_versionWidget->loadList(); -} - -void VersionSelectDialog::setExactFilter(BaseVersionList::ModelRoles role, QString filter) -{ - m_versionWidget->setExactFilter(role, filter); -} - -void VersionSelectDialog::setFuzzyFilter(BaseVersionList::ModelRoles role, QString filter) -{ - m_versionWidget->setFuzzyFilter(role, filter); -} diff --git a/application/dialogs/VersionSelectDialog.h b/application/dialogs/VersionSelectDialog.h deleted file mode 100644 index ed30d3f3..00000000 --- a/application/dialogs/VersionSelectDialog.h +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - - -#include "BaseVersionList.h" - -class QVBoxLayout; -class QHBoxLayout; -class QDialogButtonBox; -class VersionSelectWidget; -class QPushButton; - -namespace Ui -{ -class VersionSelectDialog; -} - -class VersionProxyModel; - -class VersionSelectDialog : public QDialog -{ - Q_OBJECT - -public: - explicit VersionSelectDialog(BaseVersionList *vlist, QString title, QWidget *parent = 0, bool cancelable = true); - virtual ~VersionSelectDialog() {}; - - int exec() override; - - BaseVersionPtr selectedVersion() const; - - void setCurrentVersion(const QString & version); - void setFuzzyFilter(BaseVersionList::ModelRoles role, QString filter); - void setExactFilter(BaseVersionList::ModelRoles role, QString filter); - void setEmptyString(QString emptyString); - void setEmptyErrorString(QString emptyErrorString); - void setResizeOn(int column); - -private slots: - void on_refreshButton_clicked(); - -private: - void retranslate(); - void selectRecommended(); - -private: - QString m_currentVersion; - VersionSelectWidget *m_versionWidget = nullptr; - QVBoxLayout *m_verticalLayout = nullptr; - QHBoxLayout *m_horizontalLayout = nullptr; - QPushButton *m_refreshButton = nullptr; - QDialogButtonBox *m_buttonBox = nullptr; - - BaseVersionList *m_vlist = nullptr; - - VersionProxyModel *m_proxyModel = nullptr; - - int resizeOnColumn = -1; - - Task * loadTask = nullptr; -}; diff --git a/application/groupview/AccessibleGroupView.cpp b/application/groupview/AccessibleGroupView.cpp deleted file mode 100644 index c6541f18..00000000 --- a/application/groupview/AccessibleGroupView.cpp +++ /dev/null @@ -1,778 +0,0 @@ -#include "GroupView.h" -#include "AccessibleGroupView.h" -#include "AccessibleGroupView_p.h" - -#include -#include -#include - -#ifndef QT_NO_ACCESSIBILITY - -QAccessibleInterface *groupViewAccessibleFactory(const QString &classname, QObject *object) -{ - QAccessibleInterface *iface = 0; - if (!object || !object->isWidgetType()) - return iface; - - QWidget *widget = static_cast(object); - - if (classname == QLatin1String("GroupView")) { - iface = new AccessibleGroupView((GroupView *)widget); - } - return iface; -} - - -QAbstractItemView *AccessibleGroupView::view() const -{ - return qobject_cast(object()); -} - -int AccessibleGroupView::logicalIndex(const QModelIndex &index) const -{ - if (!view()->model() || !index.isValid()) - return -1; - return index.row() * (index.model()->columnCount()) + index.column(); -} - -AccessibleGroupView::AccessibleGroupView(QWidget *w) - : QAccessibleObject(w) -{ - Q_ASSERT(view()); -} - -bool AccessibleGroupView::isValid() const -{ - return view(); -} - -AccessibleGroupView::~AccessibleGroupView() -{ - for (QAccessible::Id id : childToId) { - QAccessible::deleteAccessibleInterface(id); - } -} - -QAccessibleInterface *AccessibleGroupView::cellAt(int row, int column) const -{ - if (!view()->model()) { - return 0; - } - - QModelIndex index = view()->model()->index(row, column, view()->rootIndex()); - if (Q_UNLIKELY(!index.isValid())) { - qWarning() << "AccessibleGroupView::cellAt: invalid index: " << index << " for " << view(); - return 0; - } - - return child(logicalIndex(index)); -} - -QAccessibleInterface *AccessibleGroupView::caption() const -{ - return 0; -} - -QString AccessibleGroupView::columnDescription(int column) const -{ - if (!view()->model()) - return QString(); - - return view()->model()->headerData(column, Qt::Horizontal).toString(); -} - -int AccessibleGroupView::columnCount() const -{ - if (!view()->model()) - return 0; - return 1; -} - -int AccessibleGroupView::rowCount() const -{ - if (!view()->model()) - return 0; - return view()->model()->rowCount(); -} - -int AccessibleGroupView::selectedCellCount() const -{ - if (!view()->selectionModel()) - return 0; - return view()->selectionModel()->selectedIndexes().count(); -} - -int AccessibleGroupView::selectedColumnCount() const -{ - if (!view()->selectionModel()) - return 0; - return view()->selectionModel()->selectedColumns().count(); -} - -int AccessibleGroupView::selectedRowCount() const -{ - if (!view()->selectionModel()) - return 0; - return view()->selectionModel()->selectedRows().count(); -} - -QString AccessibleGroupView::rowDescription(int row) const -{ - if (!view()->model()) - return QString(); - return view()->model()->headerData(row, Qt::Vertical).toString(); -} - -QList AccessibleGroupView::selectedCells() const -{ - QList cells; - if (!view()->selectionModel()) - return cells; - const QModelIndexList selectedIndexes = view()->selectionModel()->selectedIndexes(); - cells.reserve(selectedIndexes.size()); - for (const QModelIndex &index : selectedIndexes) - cells.append(child(logicalIndex(index))); - return cells; -} - -QList AccessibleGroupView::selectedColumns() const -{ - if (!view()->selectionModel()) { - return QList(); - } - - const QModelIndexList selectedColumns = view()->selectionModel()->selectedColumns(); - - QList columns; - columns.reserve(selectedColumns.size()); - for (const QModelIndex &index : selectedColumns) { - columns.append(index.column()); - } - - return columns; -} - -QList AccessibleGroupView::selectedRows() const -{ - if (!view()->selectionModel()) { - return QList(); - } - - QList rows; - - const QModelIndexList selectedRows = view()->selectionModel()->selectedRows(); - - rows.reserve(selectedRows.size()); - for (const QModelIndex &index : selectedRows) { - rows.append(index.row()); - } - - return rows; -} - -QAccessibleInterface *AccessibleGroupView::summary() const -{ - return 0; -} - -bool AccessibleGroupView::isColumnSelected(int column) const -{ - if (!view()->selectionModel()) { - return false; - } - - return view()->selectionModel()->isColumnSelected(column, QModelIndex()); -} - -bool AccessibleGroupView::isRowSelected(int row) const -{ - if (!view()->selectionModel()) { - return false; - } - - return view()->selectionModel()->isRowSelected(row, QModelIndex()); -} - -bool AccessibleGroupView::selectRow(int row) -{ - if (!view()->model() || !view()->selectionModel()) { - return false; - } - QModelIndex index = view()->model()->index(row, 0, view()->rootIndex()); - - if (!index.isValid() || view()->selectionBehavior() == QAbstractItemView::SelectColumns) { - return false; - } - - switch (view()->selectionMode()) { - case QAbstractItemView::NoSelection: { - return false; - } - case QAbstractItemView::SingleSelection: { - if (view()->selectionBehavior() != QAbstractItemView::SelectRows && columnCount() > 1 ) - return false; - view()->clearSelection(); - break; - } - case QAbstractItemView::ContiguousSelection: { - if ((!row || !view()->selectionModel()->isRowSelected(row - 1, view()->rootIndex())) && !view()->selectionModel()->isRowSelected(row + 1, view()->rootIndex())) { - view()->clearSelection(); - } - break; - } - default: { - break; - } - } - - view()->selectionModel()->select(index, QItemSelectionModel::Select | QItemSelectionModel::Rows); - return true; -} - -bool AccessibleGroupView::selectColumn(int column) -{ - if (!view()->model() || !view()->selectionModel()) { - return false; - } - QModelIndex index = view()->model()->index(0, column, view()->rootIndex()); - - if (!index.isValid() || view()->selectionBehavior() == QAbstractItemView::SelectRows) { - return false; - } - - switch (view()->selectionMode()) { - case QAbstractItemView::NoSelection: { - return false; - } - case QAbstractItemView::SingleSelection: { - if (view()->selectionBehavior() != QAbstractItemView::SelectColumns && rowCount() > 1) { - return false; - } - // fallthrough intentional - } - case QAbstractItemView::ContiguousSelection: { - if ((!column || !view()->selectionModel()->isColumnSelected(column - 1, view()->rootIndex())) && !view()->selectionModel()->isColumnSelected(column + 1, view()->rootIndex())) { - view()->clearSelection(); - } - break; - } - default: { - break; - } - } - - view()->selectionModel()->select(index, QItemSelectionModel::Select | QItemSelectionModel::Columns); - return true; -} - -bool AccessibleGroupView::unselectRow(int row) -{ - if (!view()->model() || !view()->selectionModel()) { - return false; - } - - QModelIndex index = view()->model()->index(row, 0, view()->rootIndex()); - if (!index.isValid()) { - return false; - } - - QItemSelection selection(index, index); - auto selectionModel = view()->selectionModel(); - - switch (view()->selectionMode()) { - case QAbstractItemView::SingleSelection: - // no unselect - if (selectedRowCount() == 1) { - return false; - } - break; - case QAbstractItemView::ContiguousSelection: { - // no unselect - if (selectedRowCount() == 1) { - return false; - } - - - if ((!row || selectionModel->isRowSelected(row - 1, view()->rootIndex())) && selectionModel->isRowSelected(row + 1, view()->rootIndex())) { - //If there are rows selected both up the current row and down the current rown, - //the ones which are down the current row will be deselected - selection = QItemSelection(index, view()->model()->index(rowCount() - 1, 0, view()->rootIndex())); - } - } - default: { - break; - } - } - - selectionModel->select(selection, QItemSelectionModel::Deselect | QItemSelectionModel::Rows); - return true; -} - -bool AccessibleGroupView::unselectColumn(int column) -{ - auto model = view()->model(); - if (!model || !view()->selectionModel()) { - return false; - } - - QModelIndex index = model->index(0, column, view()->rootIndex()); - if (!index.isValid()) { - return false; - } - - QItemSelection selection(index, index); - - switch (view()->selectionMode()) { - case QAbstractItemView::SingleSelection: { - //In SingleSelection and ContiguousSelection once an item - //is selected, there's no way for the user to unselect all items - if (selectedColumnCount() == 1) { - return false; - } - break; - } - case QAbstractItemView::ContiguousSelection: - if (selectedColumnCount() == 1) { - return false; - } - - if ((!column || view()->selectionModel()->isColumnSelected(column - 1, view()->rootIndex())) - && view()->selectionModel()->isColumnSelected(column + 1, view()->rootIndex())) { - //If there are columns selected both at the left of the current row and at the right - //of the current row, the ones which are at the right will be deselected - selection = QItemSelection(index, model->index(0, columnCount() - 1, view()->rootIndex())); - } - default: - break; - } - - view()->selectionModel()->select(selection, QItemSelectionModel::Deselect | QItemSelectionModel::Columns); - return true; -} - -QAccessible::Role AccessibleGroupView::role() const -{ - return QAccessible::List; -} - -QAccessible::State AccessibleGroupView::state() const -{ - return QAccessible::State(); -} - -QAccessibleInterface *AccessibleGroupView::childAt(int x, int y) const -{ - QPoint viewportOffset = view()->viewport()->mapTo(view(), QPoint(0,0)); - QPoint indexPosition = view()->mapFromGlobal(QPoint(x, y) - viewportOffset); - // FIXME: if indexPosition < 0 in one coordinate, return header - - QModelIndex index = view()->indexAt(indexPosition); - if (index.isValid()) { - return child(logicalIndex(index)); - } - return 0; -} - -int AccessibleGroupView::childCount() const -{ - if (!view()->model()) { - return 0; - } - return (view()->model()->rowCount()) * (view()->model()->columnCount()); -} - -int AccessibleGroupView::indexOfChild(const QAccessibleInterface *iface) const -{ - if (!view()->model()) - return -1; - QAccessibleInterface *parent = iface->parent(); - if (parent->object() != view()) - return -1; - - Q_ASSERT(iface->role() != QAccessible::TreeItem); // should be handled by tree class - if (iface->role() == QAccessible::Cell || iface->role() == QAccessible::ListItem) { - const AccessibleGroupViewItem* cell = static_cast(iface); - return logicalIndex(cell->m_index); - } else if (iface->role() == QAccessible::Pane) { - return 0; // corner button - } else { - qWarning() << "AccessibleGroupView::indexOfChild has a child with unknown role..." << iface->role() << iface->text(QAccessible::Name); - } - // FIXME: we are in denial of our children. this should stop. - return -1; -} - -QString AccessibleGroupView::text(QAccessible::Text t) const -{ - if (t == QAccessible::Description) - return view()->accessibleDescription(); - return view()->accessibleName(); -} - -QRect AccessibleGroupView::rect() const -{ - if (!view()->isVisible()) - return QRect(); - QPoint pos = view()->mapToGlobal(QPoint(0, 0)); - return QRect(pos.x(), pos.y(), view()->width(), view()->height()); -} - -QAccessibleInterface *AccessibleGroupView::parent() const -{ - if (view() && view()->parent()) { - if (qstrcmp("QComboBoxPrivateContainer", view()->parent()->metaObject()->className()) == 0) { - return QAccessible::queryAccessibleInterface(view()->parent()->parent()); - } - return QAccessible::queryAccessibleInterface(view()->parent()); - } - return 0; -} - -QAccessibleInterface *AccessibleGroupView::child(int logicalIndex) const -{ - if (!view()->model()) - return 0; - - auto id = childToId.constFind(logicalIndex); - if (id != childToId.constEnd()) - return QAccessible::accessibleInterface(id.value()); - - int columns = view()->model()->columnCount(); - - int row = logicalIndex / columns; - int column = logicalIndex % columns; - - QAccessibleInterface *iface = 0; - - QModelIndex index = view()->model()->index(row, column, view()->rootIndex()); - if (Q_UNLIKELY(!index.isValid())) { - qWarning("AccessibleGroupView::child: Invalid index at: %d %d", row, column); - return 0; - } - iface = new AccessibleGroupViewItem(view(), index); - - QAccessible::registerAccessibleInterface(iface); - childToId.insert(logicalIndex, QAccessible::uniqueId(iface)); - return iface; -} - -void *AccessibleGroupView::interface_cast(QAccessible::InterfaceType t) -{ - if (t == QAccessible::TableInterface) - return static_cast(this); - return 0; -} - -void AccessibleGroupView::modelChange(QAccessibleTableModelChangeEvent *event) -{ - // if there is no cache yet, we don't update anything - if (childToId.isEmpty()) - return; - - switch (event->modelChangeType()) { - case QAccessibleTableModelChangeEvent::ModelReset: - for (QAccessible::Id id : childToId) - QAccessible::deleteAccessibleInterface(id); - childToId.clear(); - break; - - // rows are inserted: move every row after that - case QAccessibleTableModelChangeEvent::RowsInserted: - case QAccessibleTableModelChangeEvent::ColumnsInserted: { - - ChildCache newCache; - ChildCache::ConstIterator iter = childToId.constBegin(); - - while (iter != childToId.constEnd()) { - QAccessible::Id id = iter.value(); - QAccessibleInterface *iface = QAccessible::accessibleInterface(id); - Q_ASSERT(iface); - if (indexOfChild(iface) >= 0) { - newCache.insert(indexOfChild(iface), id); - } else { - // ### This should really not happen, - // but it might if the view has a root index set. - // This needs to be fixed. - QAccessible::deleteAccessibleInterface(id); - } - ++iter; - } - childToId = newCache; - break; - } - - case QAccessibleTableModelChangeEvent::ColumnsRemoved: - case QAccessibleTableModelChangeEvent::RowsRemoved: { - ChildCache newCache; - ChildCache::ConstIterator iter = childToId.constBegin(); - while (iter != childToId.constEnd()) { - QAccessible::Id id = iter.value(); - QAccessibleInterface *iface = QAccessible::accessibleInterface(id); - Q_ASSERT(iface); - if (iface->role() == QAccessible::Cell || iface->role() == QAccessible::ListItem) { - Q_ASSERT(iface->tableCellInterface()); - AccessibleGroupViewItem *cell = static_cast(iface->tableCellInterface()); - // Since it is a QPersistentModelIndex, we only need to check if it is valid - if (cell->m_index.isValid()) - newCache.insert(indexOfChild(cell), id); - else - QAccessible::deleteAccessibleInterface(id); - } - ++iter; - } - childToId = newCache; - break; - } - - case QAccessibleTableModelChangeEvent::DataChanged: - // nothing to do in this case - break; - } -} - -// TABLE CELL - -AccessibleGroupViewItem::AccessibleGroupViewItem(QAbstractItemView *view_, const QModelIndex &index_) - : view(view_), m_index(index_) -{ - if (Q_UNLIKELY(!index_.isValid())) - qWarning() << "AccessibleGroupViewItem::AccessibleGroupViewItem with invalid index: " << index_; -} - -void *AccessibleGroupViewItem::interface_cast(QAccessible::InterfaceType t) -{ - if (t == QAccessible::TableCellInterface) - return static_cast(this); - if (t == QAccessible::ActionInterface) - return static_cast(this); - return 0; -} - -int AccessibleGroupViewItem::columnExtent() const { return 1; } -int AccessibleGroupViewItem::rowExtent() const { return 1; } - -QList AccessibleGroupViewItem::rowHeaderCells() const -{ - return {}; -} - -QList AccessibleGroupViewItem::columnHeaderCells() const -{ - return {}; -} - -int AccessibleGroupViewItem::columnIndex() const -{ - if (!isValid()) { - return -1; - } - - return m_index.column(); -} - -int AccessibleGroupViewItem::rowIndex() const -{ - if (!isValid()) { - return -1; - } - - return m_index.row(); -} - -bool AccessibleGroupViewItem::isSelected() const -{ - if (!isValid()) { - return false; - } - - return view->selectionModel()->isSelected(m_index); -} - -QStringList AccessibleGroupViewItem::actionNames() const -{ - QStringList names; - names << toggleAction(); - return names; -} - -void AccessibleGroupViewItem::doAction(const QString& actionName) -{ - if (actionName == toggleAction()) { - if (isSelected()) { - unselectCell(); - } - else { - selectCell(); - } - } -} - -QStringList AccessibleGroupViewItem::keyBindingsForAction(const QString &) const -{ - return QStringList(); -} - - -void AccessibleGroupViewItem::selectCell() -{ - if (!isValid()) { - return; - } - QAbstractItemView::SelectionMode selectionMode = view->selectionMode(); - if (selectionMode == QAbstractItemView::NoSelection) { - return; - } - - Q_ASSERT(table()); - QAccessibleTableInterface *cellTable = table()->tableInterface(); - - switch (view->selectionBehavior()) { - case QAbstractItemView::SelectItems: - break; - case QAbstractItemView::SelectColumns: - if (cellTable) - cellTable->selectColumn(m_index.column()); - return; - case QAbstractItemView::SelectRows: - if (cellTable) - cellTable->selectRow(m_index.row()); - return; - } - - if (selectionMode == QAbstractItemView::SingleSelection) { - view->clearSelection(); - } - - view->selectionModel()->select(m_index, QItemSelectionModel::Select); -} - -void AccessibleGroupViewItem::unselectCell() -{ - if (!isValid()) - return; - QAbstractItemView::SelectionMode selectionMode = view->selectionMode(); - if (selectionMode == QAbstractItemView::NoSelection) - return; - - QAccessibleTableInterface *cellTable = table()->tableInterface(); - - switch (view->selectionBehavior()) { - case QAbstractItemView::SelectItems: - break; - case QAbstractItemView::SelectColumns: - if (cellTable) - cellTable->unselectColumn(m_index.column()); - return; - case QAbstractItemView::SelectRows: - if (cellTable) - cellTable->unselectRow(m_index.row()); - return; - } - - //If the mode is not MultiSelection or ExtendedSelection and only - //one cell is selected it cannot be unselected by the user - if ((selectionMode != QAbstractItemView::MultiSelection) && (selectionMode != QAbstractItemView::ExtendedSelection) && (view->selectionModel()->selectedIndexes().count() <= 1)) - return; - - view->selectionModel()->select(m_index, QItemSelectionModel::Deselect); -} - -QAccessibleInterface *AccessibleGroupViewItem::table() const -{ - return QAccessible::queryAccessibleInterface(view); -} - -QAccessible::Role AccessibleGroupViewItem::role() const -{ - return QAccessible::ListItem; -} - -QAccessible::State AccessibleGroupViewItem::state() const -{ - QAccessible::State st; - if (!isValid()) - return st; - - QRect globalRect = view->rect(); - globalRect.translate(view->mapToGlobal(QPoint(0,0))); - if (!globalRect.intersects(rect())) - st.invisible = true; - - if (view->selectionModel()->isSelected(m_index)) - st.selected = true; - if (view->selectionModel()->currentIndex() == m_index) - st.focused = true; - if (m_index.model()->data(m_index, Qt::CheckStateRole).toInt() == Qt::Checked) - st.checked = true; - - Qt::ItemFlags flags = m_index.flags(); - if (flags & Qt::ItemIsSelectable) { - st.selectable = true; - st.focusable = true; - if (view->selectionMode() == QAbstractItemView::MultiSelection) - st.multiSelectable = true; - if (view->selectionMode() == QAbstractItemView::ExtendedSelection) - st.extSelectable = true; - } - return st; -} - - -QRect AccessibleGroupViewItem::rect() const -{ - QRect r; - if (!isValid()) - return r; - r = view->visualRect(m_index); - - if (!r.isNull()) { - r.translate(view->viewport()->mapTo(view, QPoint(0,0))); - r.translate(view->mapToGlobal(QPoint(0, 0))); - } - return r; -} - -QString AccessibleGroupViewItem::text(QAccessible::Text t) const -{ - QString value; - if (!isValid()) - return value; - QAbstractItemModel *model = view->model(); - switch (t) { - case QAccessible::Name: - value = model->data(m_index, Qt::AccessibleTextRole).toString(); - if (value.isEmpty()) - value = model->data(m_index, Qt::DisplayRole).toString(); - break; - case QAccessible::Description: - value = model->data(m_index, Qt::AccessibleDescriptionRole).toString(); - break; - default: - break; - } - return value; -} - -void AccessibleGroupViewItem::setText(QAccessible::Text /*t*/, const QString &text) -{ - if (!isValid() || !(m_index.flags() & Qt::ItemIsEditable)) - return; - view->model()->setData(m_index, text); -} - -bool AccessibleGroupViewItem::isValid() const -{ - return view && view->model() && m_index.isValid(); -} - -QAccessibleInterface *AccessibleGroupViewItem::parent() const -{ - return QAccessible::queryAccessibleInterface(view); -} - -QAccessibleInterface *AccessibleGroupViewItem::child(int) const -{ - return 0; -} - -#endif /* !QT_NO_ACCESSIBILITY */ diff --git a/application/groupview/AccessibleGroupView.h b/application/groupview/AccessibleGroupView.h deleted file mode 100644 index 9bfd1745..00000000 --- a/application/groupview/AccessibleGroupView.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -#include -class QAccessibleInterface; - -QAccessibleInterface *groupViewAccessibleFactory(const QString &classname, QObject *object); diff --git a/application/groupview/AccessibleGroupView_p.h b/application/groupview/AccessibleGroupView_p.h deleted file mode 100644 index e74da3be..00000000 --- a/application/groupview/AccessibleGroupView_p.h +++ /dev/null @@ -1,118 +0,0 @@ -#pragma once - -#include "QtCore/qpointer.h" -#include -#include -#include -#ifndef QT_NO_ACCESSIBILITY -#include "GroupView.h" -// #include - -class QAccessibleTableCell; -class QAccessibleTableHeaderCell; - -class AccessibleGroupView :public QAccessibleTableInterface, public QAccessibleObject -{ -public: - explicit AccessibleGroupView(QWidget *w); - bool isValid() const override; - - QAccessible::Role role() const override; - QAccessible::State state() const override; - QString text(QAccessible::Text t) const override; - QRect rect() const override; - - QAccessibleInterface *childAt(int x, int y) const override; - int childCount() const override; - int indexOfChild(const QAccessibleInterface *) const override; - - QAccessibleInterface *parent() const override; - QAccessibleInterface *child(int index) const override; - - void *interface_cast(QAccessible::InterfaceType t) override; - - // table interface - QAccessibleInterface *cellAt(int row, int column) const override; - QAccessibleInterface *caption() const override; - QAccessibleInterface *summary() const override; - QString columnDescription(int column) const override; - QString rowDescription(int row) const override; - int columnCount() const override; - int rowCount() const override; - - // selection - int selectedCellCount() const override; - int selectedColumnCount() const override; - int selectedRowCount() const override; - QList selectedCells() const override; - QList selectedColumns() const override; - QList selectedRows() const override; - bool isColumnSelected(int column) const override; - bool isRowSelected(int row) const override; - bool selectRow(int row) override; - bool selectColumn(int column) override; - bool unselectRow(int row) override; - bool unselectColumn(int column) override; - - QAbstractItemView *view() const; - - void modelChange(QAccessibleTableModelChangeEvent *event) override; - -protected: - // maybe vector - typedef QHash ChildCache; - mutable ChildCache childToId; - - virtual ~AccessibleGroupView(); - -private: - inline int logicalIndex(const QModelIndex &index) const; -}; - -class AccessibleGroupViewItem: public QAccessibleInterface, public QAccessibleTableCellInterface, public QAccessibleActionInterface -{ -public: - AccessibleGroupViewItem(QAbstractItemView *view, const QModelIndex &m_index); - - void *interface_cast(QAccessible::InterfaceType t) override; - QObject *object() const override { return nullptr; } - QAccessible::Role role() const override; - QAccessible::State state() const override; - QRect rect() const override; - bool isValid() const override; - - QAccessibleInterface *childAt(int, int) const override { return nullptr; } - int childCount() const override { return 0; } - int indexOfChild(const QAccessibleInterface *) const override { return -1; } - - QString text(QAccessible::Text t) const override; - void setText(QAccessible::Text t, const QString &text) override; - - QAccessibleInterface *parent() const override; - QAccessibleInterface *child(int) const override; - - // cell interface - int columnExtent() const override; - QList columnHeaderCells() const override; - int columnIndex() const override; - int rowExtent() const override; - QList rowHeaderCells() const override; - int rowIndex() const override; - bool isSelected() const override; - QAccessibleInterface* table() const override; - - //action interface - QStringList actionNames() const override; - void doAction(const QString &actionName) override; - QStringList keyBindingsForAction(const QString &actionName) const override; - -private: - QPointer view; - QPersistentModelIndex m_index; - - void selectCell(); - void unselectCell(); - - friend class AccessibleGroupView; -}; -#endif /* !QT_NO_ACCESSIBILITY */ diff --git a/application/groupview/GroupView.cpp b/application/groupview/GroupView.cpp deleted file mode 100644 index 6bfc9381..00000000 --- a/application/groupview/GroupView.cpp +++ /dev/null @@ -1,1020 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "GroupView.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "VisualGroup.h" -#include - -template bool listsIntersect(const QList &l1, const QList t2) -{ - for (auto &item : l1) - { - if (t2.contains(item)) - { - return true; - } - } - return false; -} - -GroupView::GroupView(QWidget *parent) - : QAbstractItemView(parent) -{ - setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); - setAcceptDrops(true); - setAutoScroll(true); -} - -GroupView::~GroupView() -{ - qDeleteAll(m_groups); - m_groups.clear(); -} - -void GroupView::setModel(QAbstractItemModel *model) -{ - QAbstractItemView::setModel(model); - connect(model, &QAbstractItemModel::modelReset, this, &GroupView::modelReset); - connect(model, &QAbstractItemModel::rowsRemoved, this, &GroupView::rowsRemoved); -} - -void GroupView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, - const QVector &roles) -{ - scheduleDelayedItemsLayout(); -} -void GroupView::rowsInserted(const QModelIndex &parent, int start, int end) -{ - scheduleDelayedItemsLayout(); -} - -void GroupView::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) -{ - scheduleDelayedItemsLayout(); -} - -void GroupView::modelReset() -{ - scheduleDelayedItemsLayout(); -} - -void GroupView::rowsRemoved() -{ - scheduleDelayedItemsLayout(); -} - -void GroupView::currentChanged(const QModelIndex& current, const QModelIndex& previous) -{ - QAbstractItemView::currentChanged(current, previous); - // TODO: for accessibility support, implement+register a factory, steal QAccessibleTable from Qt and return an instance of it for GroupView. -#ifndef QT_NO_ACCESSIBILITY - if (QAccessible::isActive() && current.isValid()) { - QAccessibleEvent event(this, QAccessible::Focus); - event.setChild(current.row()); - QAccessible::updateAccessibility(&event); - } -#endif /* !QT_NO_ACCESSIBILITY */ -} - - -class LocaleString : public QString -{ -public: - LocaleString(const char *s) : QString(s) - { - } - LocaleString(const QString &s) : QString(s) - { - } -}; - -inline bool operator<(const LocaleString &lhs, const LocaleString &rhs) -{ - return (QString::localeAwareCompare(lhs, rhs) < 0); -} - -void GroupView::updateScrollbar() -{ - int previousScroll = verticalScrollBar()->value(); - if (m_groups.isEmpty()) - { - verticalScrollBar()->setRange(0, 0); - } - else - { - int totalHeight = 0; - // top margin - totalHeight += m_categoryMargin; - int itemScroll = 0; - for (auto category : m_groups) - { - category->m_verticalPosition = totalHeight; - totalHeight += category->totalHeight() + m_categoryMargin; - if(!itemScroll && category->totalHeight() != 0) - { - itemScroll = category->contentHeight() / category->numRows(); - } - } - // do not divide by zero - if(itemScroll == 0) - itemScroll = 64; - - totalHeight += m_bottomMargin; - verticalScrollBar()->setSingleStep ( itemScroll ); - const int rowsPerPage = qMax ( viewport()->height() / itemScroll, 1 ); - verticalScrollBar()->setPageStep ( rowsPerPage * itemScroll ); - - verticalScrollBar()->setRange(0, totalHeight - height()); - } - - verticalScrollBar()->setValue(qMin(previousScroll, verticalScrollBar()->maximum())); -} - -void GroupView::updateGeometries() -{ - geometryCache.clear(); - - QMap cats; - - for (int i = 0; i < model()->rowCount(); ++i) - { - const QString groupName = model()->index(i, 0).data(GroupViewRoles::GroupRole).toString(); - if (!cats.contains(groupName)) - { - VisualGroup *old = this->category(groupName); - if (old) - { - auto cat = new VisualGroup(old); - cats.insert(groupName, cat); - cat->update(); - } - else - { - auto cat = new VisualGroup(groupName, this); - if(fVisibility) { - cat->collapsed = fVisibility(groupName); - } - cats.insert(groupName, cat); - cat->update(); - } - } - } - - qDeleteAll(m_groups); - m_groups = cats.values(); - updateScrollbar(); - viewport()->update(); -} - -bool GroupView::isIndexHidden(const QModelIndex &index) const -{ - VisualGroup *cat = category(index); - if (cat) - { - return cat->collapsed; - } - else - { - return false; - } -} - -VisualGroup *GroupView::category(const QModelIndex &index) const -{ - return category(index.data(GroupViewRoles::GroupRole).toString()); -} - -VisualGroup *GroupView::category(const QString &cat) const -{ - for (auto group : m_groups) - { - if (group->text == cat) - { - return group; - } - } - return nullptr; -} - -VisualGroup *GroupView::categoryAt(const QPoint &pos, VisualGroup::HitResults & result) const -{ - for (auto group : m_groups) - { - result = group->hitScan(pos); - if(result != VisualGroup::NoHit) - { - return group; - } - } - result = VisualGroup::NoHit; - return nullptr; -} - -QString GroupView::groupNameAt(const QPoint &point) -{ - executeDelayedItemsLayout(); - - VisualGroup::HitResults hitresult; - auto group = categoryAt(point + offset(), hitresult); - if(group && (hitresult & (VisualGroup::HeaderHit | VisualGroup::BodyHit))) - { - return group->text; - } - return QString(); -} - -int GroupView::calculateItemsPerRow() const -{ - return qFloor((qreal)(contentWidth()) / (qreal)(itemWidth() + m_spacing)); -} - -int GroupView::contentWidth() const -{ - return width() - m_leftMargin - m_rightMargin; -} - -int GroupView::itemWidth() const -{ - return m_itemWidth; -} - -void GroupView::mousePressEvent(QMouseEvent *event) -{ - executeDelayedItemsLayout(); - - QPoint visualPos = event->pos(); - QPoint geometryPos = event->pos() + offset(); - - QPersistentModelIndex index = indexAt(visualPos); - - m_pressedIndex = index; - 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 (index.isValid() && (index.flags() & Qt::ItemIsEnabled)) - { - if(index != currentIndex()) - { - // FIXME: better! - m_currentCursorColumn = -1; - } - // we disable scrollTo for mouse press so the item doesn't change position - // when the user is interacting with it (ie. clicking on it) - bool autoScroll = hasAutoScroll(); - setAutoScroll(false); - selectionModel()->setCurrentIndex(index, QItemSelectionModel::NoUpdate); - - setAutoScroll(autoScroll); - QRect rect(visualPos, visualPos); - setSelection(rect, QItemSelectionModel::ClearAndSelect); - - // signal handlers may change the model - emit pressed(index); - } - else - { - // Forces a finalize() even if mouse is pressed, but not on a item - selectionModel()->select(QModelIndex(), QItemSelectionModel::Select); - } -} - -void GroupView::mouseMoveEvent(QMouseEvent *event) -{ - executeDelayedItemsLayout(); - - QPoint topLeft; - QPoint visualPos = event->pos(); - QPoint geometryPos = event->pos() + offset(); - - if (state() == ExpandingState || state() == CollapsingState) - { - return; - } - - if (state() == DraggingState) - { - topLeft = m_pressedPosition - offset(); - if ((topLeft - event->pos()).manhattanLength() > QApplication::startDragDistance()) - { - m_pressedIndex = QModelIndex(); - startDrag(model()->supportedDragActions()); - setState(NoState); - stopAutoScroll(); - } - return; - } - - if (selectionMode() != SingleSelection) - { - topLeft = m_pressedPosition - offset(); - } - else - { - topLeft = geometryPos; - } - - if (m_pressedIndex.isValid() && (state() != DragSelectingState) && - (event->buttons() != Qt::NoButton) && !selectedIndexes().isEmpty()) - { - setState(DraggingState); - return; - } - - if ((event->buttons() & Qt::LeftButton) && selectionModel()) - { - setState(DragSelectingState); - - setSelection(QRect(visualPos, visualPos), QItemSelectionModel::ClearAndSelect); - QModelIndex index = indexAt(visualPos); - - // set at the end because it might scroll the view - if (index.isValid() && (index != selectionModel()->currentIndex()) && - (index.flags() & Qt::ItemIsEnabled)) - { - selectionModel()->setCurrentIndex(index, QItemSelectionModel::NoUpdate); - } - } -} - -void GroupView::mouseReleaseEvent(QMouseEvent *event) -{ - executeDelayedItemsLayout(); - - QPoint visualPos = event->pos(); - QPoint geometryPos = event->pos() + offset(); - QPersistentModelIndex index = indexAt(visualPos); - - VisualGroup::HitResults hitresult; - - bool click = (index == m_pressedIndex && index.isValid()) || - (m_pressedCategory && m_pressedCategory == categoryAt(geometryPos, hitresult)); - - if (click && m_pressedCategory) - { - if (state() == ExpandingState) - { - m_pressedCategory->collapsed = false; - emit groupStateChanged(m_pressedCategory->text, false); - - updateGeometries(); - viewport()->update(); - event->accept(); - m_pressedCategory = nullptr; - setState(NoState); - return; - } - else if (state() == CollapsingState) - { - m_pressedCategory->collapsed = true; - emit groupStateChanged(m_pressedCategory->text, true); - - updateGeometries(); - viewport()->update(); - event->accept(); - m_pressedCategory = nullptr; - setState(NoState); - return; - } - } - - m_ctrlDragSelectionFlag = QItemSelectionModel::NoUpdate; - - setState(NoState); - - if (click) - { - if (event->button() == Qt::LeftButton) - { - emit clicked(index); - } - QStyleOptionViewItem option = viewOptions(); - if (m_pressedAlreadySelected) - { - option.state |= QStyle::State_Selected; - } - if ((model()->flags(index) & Qt::ItemIsEnabled) && - style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, &option, this)) - { - emit activated(index); - } - } -} - -void GroupView::mouseDoubleClickEvent(QMouseEvent *event) -{ - executeDelayedItemsLayout(); - - QModelIndex index = indexAt(event->pos()); - if (!index.isValid() || !(index.flags() & Qt::ItemIsEnabled) || (m_pressedIndex != index)) - { - QMouseEvent me(QEvent::MouseButtonPress, event->localPos(), event->windowPos(), - event->screenPos(), event->button(), event->buttons(), - event->modifiers()); - mousePressEvent(&me); - return; - } - // signal handlers may change the model - QPersistentModelIndex persistent = index; - emit doubleClicked(persistent); - - QStyleOptionViewItem option = viewOptions(); - if ((model()->flags(index) & Qt::ItemIsEnabled) && !style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, &option, this)) - { - emit activated(index); - } -} - -void GroupView::paintEvent(QPaintEvent *event) -{ - executeDelayedItemsLayout(); - - QPainter painter(this->viewport()); - - QStyleOptionViewItem option(viewOptions()); - option.widget = this; - - int wpWidth = viewport()->width(); - option.rect.setWidth(wpWidth); - for (int i = 0; i < m_groups.size(); ++i) - { - VisualGroup *category = m_groups.at(i); - int y = category->verticalPosition(); - y -= verticalOffset(); - QRect backup = option.rect; - int height = category->totalHeight(); - option.rect.setTop(y); - option.rect.setHeight(height); - option.rect.setLeft(m_leftMargin); - option.rect.setRight(wpWidth - m_rightMargin); - category->drawHeader(&painter, option); - y += category->totalHeight() + m_categoryMargin; - option.rect = backup; - } - - for (int i = 0; i < model()->rowCount(); ++i) - { - const QModelIndex index = model()->index(i, 0); - if (isIndexHidden(index)) - { - continue; - } - Qt::ItemFlags flags = index.flags(); - option.rect = visualRect(index); - option.features |= QStyleOptionViewItem::WrapText; - if (flags & Qt::ItemIsSelectable && selectionModel()->isSelected(index)) - { - option.state |= selectionModel()->isSelected(index) ? QStyle::State_Selected - : QStyle::State_None; - } - else - { - option.state &= ~QStyle::State_Selected; - } - option.state |= (index == currentIndex()) ? QStyle::State_HasFocus : QStyle::State_None; - if (!(flags & Qt::ItemIsEnabled)) - { - option.state &= ~QStyle::State_Enabled; - } - itemDelegate()->paint(&painter, option, index); - } - - /* - * Drop indicators for manual reordering... - */ -#if 0 - if (!m_lastDragPosition.isNull()) - { - QPair pair = rowDropPos(m_lastDragPosition); - Group *category = pair.first; - int row = pair.second; - if (category) - { - int internalRow = row - category->firstItemIndex; - QLine line; - if (internalRow >= category->numItems()) - { - QRect toTheRightOfRect = visualRect(category->lastItem()); - line = QLine(toTheRightOfRect.topRight(), toTheRightOfRect.bottomRight()); - } - else - { - QRect toTheLeftOfRect = visualRect(model()->index(row, 0)); - line = QLine(toTheLeftOfRect.topLeft(), toTheLeftOfRect.bottomLeft()); - } - painter.save(); - painter.setPen(QPen(Qt::black, 3)); - painter.drawLine(line); - painter.restore(); - } - } -#endif -} - -void GroupView::resizeEvent(QResizeEvent *event) -{ - int newItemsPerRow = calculateItemsPerRow(); - if(newItemsPerRow != m_currentItemsPerRow) - { - m_currentCursorColumn = -1; - m_currentItemsPerRow = newItemsPerRow; - updateGeometries(); - } - else - { - updateScrollbar(); - } -} - -void GroupView::dragEnterEvent(QDragEnterEvent *event) -{ - executeDelayedItemsLayout(); - - if (!isDragEventAccepted(event)) - { - return; - } - m_lastDragPosition = event->pos() + offset(); - viewport()->update(); - event->accept(); -} - -void GroupView::dragMoveEvent(QDragMoveEvent *event) -{ - executeDelayedItemsLayout(); - - if (!isDragEventAccepted(event)) - { - return; - } - m_lastDragPosition = event->pos() + offset(); - viewport()->update(); - event->accept(); -} - -void GroupView::dragLeaveEvent(QDragLeaveEvent *event) -{ - executeDelayedItemsLayout(); - - m_lastDragPosition = QPoint(); - viewport()->update(); -} - -void GroupView::dropEvent(QDropEvent *event) -{ - executeDelayedItemsLayout(); - - m_lastDragPosition = QPoint(); - - stopAutoScroll(); - setState(NoState); - - if (event->source() == this) - { - if(event->possibleActions() & Qt::MoveAction) - { - QPair dropPos = rowDropPos(event->pos() + offset()); - const VisualGroup *category = dropPos.first; - const int row = dropPos.second; - - if (row == -1) - { - viewport()->update(); - return; - } - - const QString categoryText = category->text; - if (model()->dropMimeData(event->mimeData(), Qt::MoveAction, row, 0, QModelIndex())) - { - model()->setData(model()->index(row, 0), categoryText, GroupViewRoles::GroupRole); - event->setDropAction(Qt::MoveAction); - event->accept(); - } - updateGeometries(); - viewport()->update(); - } - } - auto mimedata = event->mimeData(); - - // check if the action is supported - if (!mimedata) - { - return; - } - - // files dropped from outside? - if (mimedata->hasUrls()) - { - auto urls = mimedata->urls(); - event->accept(); - emit droppedURLs(urls); - } -} - -void GroupView::startDrag(Qt::DropActions supportedActions) -{ - executeDelayedItemsLayout(); - - QModelIndexList indexes = selectionModel()->selectedIndexes(); - if(indexes.count() == 0) - return; - - QMimeData *data = model()->mimeData(indexes); - if (!data) - { - return; - } - QRect rect; - QPixmap pixmap = renderToPixmap(indexes, &rect); - //rect.translate(offset()); - // rect.adjust(horizontalOffset(), verticalOffset(), 0, 0); - QDrag *drag = new QDrag(this); - drag->setPixmap(pixmap); - drag->setMimeData(data); - Qt::DropAction defaultDropAction = Qt::IgnoreAction; - if (this->defaultDropAction() != Qt::IgnoreAction && - (supportedActions & this->defaultDropAction())) - { - defaultDropAction = this->defaultDropAction(); - } - if (drag->exec(supportedActions, defaultDropAction) == Qt::MoveAction) - { - const QItemSelection selection = selectionModel()->selection(); - - for (auto it = selection.constBegin(); it != selection.constEnd(); ++it) - { - QModelIndex parent = (*it).parent(); - if ((*it).left() != 0) - { - continue; - } - if ((*it).right() != (model()->columnCount(parent) - 1)) - { - continue; - } - int count = (*it).bottom() - (*it).top() + 1; - model()->removeRows((*it).top(), count, parent); - } - } -} - -QRect GroupView::visualRect(const QModelIndex &index) const -{ - const_cast(this)->executeDelayedItemsLayout(); - - return geometryRect(index).translated(-offset()); -} - -QRect GroupView::geometryRect(const QModelIndex &index) const -{ - const_cast(this)->executeDelayedItemsLayout(); - - if (!index.isValid() || isIndexHidden(index) || index.column() > 0) - { - return QRect(); - } - - int row = index.row(); - if(geometryCache.contains(row)) - { - return *geometryCache[row]; - } - - const VisualGroup *cat = category(index); - QPair pos = cat->positionOf(index); - int x = pos.first; - // int y = pos.second; - - QRect out; - out.setTop(cat->verticalPosition() + cat->headerHeight() + 5 + cat->rowTopOf(index)); - out.setLeft(m_spacing + x * (itemWidth() + m_spacing)); - out.setSize(itemDelegate()->sizeHint(viewOptions(), index)); - geometryCache.insert(row, new QRect(out)); - return out; -} - -QModelIndex GroupView::indexAt(const QPoint &point) const -{ - const_cast(this)->executeDelayedItemsLayout(); - - for (int i = 0; i < model()->rowCount(); ++i) - { - QModelIndex index = model()->index(i, 0); - if (visualRect(index).contains(point)) - { - return index; - } - } - return QModelIndex(); -} - -void GroupView::setSelection(const QRect &rect, const QItemSelectionModel::SelectionFlags commands) -{ - executeDelayedItemsLayout(); - - for (int i = 0; i < model()->rowCount(); ++i) - { - QModelIndex index = model()->index(i, 0); - QRect itemRect = visualRect(index); - if (itemRect.intersects(rect)) - { - selectionModel()->select(index, commands); - update(itemRect.translated(-offset())); - } - } -} - -QPixmap GroupView::renderToPixmap(const QModelIndexList &indices, QRect *r) const -{ - Q_ASSERT(r); - auto paintPairs = draggablePaintPairs(indices, r); - if (paintPairs.isEmpty()) - { - return QPixmap(); - } - QPixmap pixmap(r->size()); - pixmap.fill(Qt::transparent); - QPainter painter(&pixmap); - QStyleOptionViewItem option = viewOptions(); - option.state |= QStyle::State_Selected; - for (int j = 0; j < paintPairs.count(); ++j) - { - option.rect = paintPairs.at(j).first.translated(-r->topLeft()); - const QModelIndex ¤t = paintPairs.at(j).second; - itemDelegate()->paint(&painter, option, current); - } - return pixmap; -} - -QList> GroupView::draggablePaintPairs(const QModelIndexList &indices, QRect *r) const -{ - Q_ASSERT(r); - QRect &rect = *r; - QList> ret; - for (int i = 0; i < indices.count(); ++i) - { - const QModelIndex &index = indices.at(i); - const QRect current = geometryRect(index); - ret += qMakePair(current, index); - rect |= current; - } - return ret; -} - -bool GroupView::isDragEventAccepted(QDropEvent *event) -{ - return true; -} - -QPair GroupView::rowDropPos(const QPoint &pos) -{ - return qMakePair(nullptr, -1); -} - -QPoint GroupView::offset() const -{ - return QPoint(horizontalOffset(), verticalOffset()); -} - -QRegion GroupView::visualRegionForSelection(const QItemSelection &selection) const -{ - QRegion region; - for (auto &range : selection) - { - int start_row = range.top(); - int end_row = range.bottom(); - for (int row = start_row; row <= end_row; ++row) - { - int start_column = range.left(); - int end_column = range.right(); - for (int column = start_column; column <= end_column; ++column) - { - QModelIndex index = model()->index(row, column, rootIndex()); - region += visualRect(index); // OK - } - } - } - return region; -} - -QModelIndex GroupView::moveCursor(QAbstractItemView::CursorAction cursorAction, - Qt::KeyboardModifiers modifiers) -{ - auto current = currentIndex(); - if(!current.isValid()) - { - return current; - } - auto cat = category(current); - int group_index = m_groups.indexOf(cat); - if(group_index < 0) - return current; - - auto real_group = m_groups[group_index]; - int beginning_row = 0; - for(auto group: m_groups) - { - if(group == real_group) - break; - beginning_row += group->numRows(); - } - - QPair pos = cat->positionOf(current); - int column = pos.first; - int row = pos.second; - if(m_currentCursorColumn < 0) - { - m_currentCursorColumn = column; - } - switch(cursorAction) - { - case MoveUp: - { - if(row == 0) - { - int prevgroupindex = group_index-1; - while(prevgroupindex >= 0) - { - auto prevgroup = m_groups[prevgroupindex]; - if(prevgroup->collapsed) - { - prevgroupindex--; - continue; - } - int newRow = prevgroup->numRows() - 1; - int newRowSize = prevgroup->rows[newRow].size(); - int newColumn = m_currentCursorColumn; - if (m_currentCursorColumn >= newRowSize) - { - newColumn = newRowSize - 1; - } - return prevgroup->rows[newRow][newColumn]; - } - } - else - { - int newRow = row - 1; - int newRowSize = cat->rows[newRow].size(); - int newColumn = m_currentCursorColumn; - if (m_currentCursorColumn >= newRowSize) - { - newColumn = newRowSize - 1; - } - return cat->rows[newRow][newColumn]; - } - return current; - } - case MoveDown: - { - if(row == cat->rows.size() - 1) - { - int nextgroupindex = group_index+1; - while (nextgroupindex < m_groups.size()) - { - auto nextgroup = m_groups[nextgroupindex]; - if(nextgroup->collapsed) - { - nextgroupindex++; - continue; - } - int newRowSize = nextgroup->rows[0].size(); - int newColumn = m_currentCursorColumn; - if (m_currentCursorColumn >= newRowSize) - { - newColumn = newRowSize - 1; - } - return nextgroup->rows[0][newColumn]; - } - } - else - { - int newRow = row + 1; - int newRowSize = cat->rows[newRow].size(); - int newColumn = m_currentCursorColumn; - if (m_currentCursorColumn >= newRowSize) - { - newColumn = newRowSize - 1; - } - return cat->rows[newRow][newColumn]; - } - return current; - } - case MoveLeft: - { - if(column > 0) - { - m_currentCursorColumn = column - 1; - return cat->rows[row][column - 1]; - } - // TODO: moving to previous line - return current; - } - case MoveRight: - { - if(column < cat->rows[row].size() - 1) - { - m_currentCursorColumn = column + 1; - return cat->rows[row][column + 1]; - } - // TODO: moving to next line - return current; - } - case MoveHome: - { - m_currentCursorColumn = 0; - return cat->rows[row][0]; - } - case MoveEnd: - { - auto last = cat->rows[row].size() - 1; - m_currentCursorColumn = last; - return cat->rows[row][last]; - } - default: - break; - } - return current; -} - -int GroupView::horizontalOffset() const -{ - return horizontalScrollBar()->value(); -} - -int GroupView::verticalOffset() const -{ - return verticalScrollBar()->value(); -} - -void GroupView::scrollContentsBy(int dx, int dy) -{ - scrollDirtyRegion(dx, dy); - viewport()->scroll(dx, dy); -} - -void GroupView::scrollTo(const QModelIndex &index, ScrollHint hint) -{ - if (!index.isValid()) - return; - - const QRect rect = visualRect(index); - if (hint == EnsureVisible && viewport()->rect().contains(rect)) - { - viewport()->update(rect); - return; - } - - verticalScrollBar()->setValue(verticalScrollToValue(index, rect, hint)); -} - -int GroupView::verticalScrollToValue(const QModelIndex &index, const QRect &rect, - QListView::ScrollHint hint) const -{ - const QRect area = viewport()->rect(); - const bool above = (hint == QListView::EnsureVisible && rect.top() < area.top()); - const bool below = (hint == QListView::EnsureVisible && rect.bottom() > area.bottom()); - - int verticalValue = verticalScrollBar()->value(); - QRect adjusted = rect.adjusted(-spacing(), -spacing(), spacing(), spacing()); - if (hint == QListView::PositionAtTop || above) - verticalValue += adjusted.top(); - else if (hint == QListView::PositionAtBottom || below) - verticalValue += qMin(adjusted.top(), adjusted.bottom() - area.height() + 1); - else if (hint == QListView::PositionAtCenter) - verticalValue += adjusted.top() - ((area.height() - adjusted.height()) / 2); - return verticalValue; -} diff --git a/application/groupview/GroupView.h b/application/groupview/GroupView.h deleted file mode 100644 index cc5a58aa..00000000 --- a/application/groupview/GroupView.h +++ /dev/null @@ -1,157 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include -#include -#include "VisualGroup.h" -#include - -struct GroupViewRoles -{ - enum - { - GroupRole = Qt::UserRole, - ProgressValueRole, - ProgressMaximumRole - }; -}; - -class GroupView : public QAbstractItemView -{ - Q_OBJECT - -public: - GroupView(QWidget *parent = 0); - ~GroupView(); - - void setModel(QAbstractItemModel *model) override; - - using visibilityFunction = std::function; - void setSourceOfGroupCollapseStatus(visibilityFunction f) { - fVisibility = f; - } - - /// return geometry rectangle occupied by the specified model item - QRect geometryRect(const QModelIndex &index) const; - /// return visual rectangle occupied by the specified model item - virtual QRect visualRect(const QModelIndex &index) const override; - /// 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; - - virtual int horizontalOffset() const override; - virtual int verticalOffset() const override; - virtual void scrollContentsBy(int dx, int dy) override; - virtual void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) override; - - virtual QModelIndex moveCursor(CursorAction cursorAction, - Qt::KeyboardModifiers modifiers) override; - - virtual QRegion visualRegionForSelection(const QItemSelection &selection) const override; - - int spacing() const - { - return m_spacing; - }; - -public slots: - virtual void updateGeometries() override; - -protected slots: - virtual void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, - const QVector &roles) override; - virtual void rowsInserted(const QModelIndex &parent, int start, int end) override; - virtual void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) override; - void modelReset(); - void rowsRemoved(); - void currentChanged(const QModelIndex ¤t, const QModelIndex &previous) override; - -signals: - void droppedURLs(QList urls); - void groupStateChanged(QString group, bool collapsed); - -protected: - virtual bool isIndexHidden(const QModelIndex &index) const override; - void mousePressEvent(QMouseEvent *event) override; - void mouseMoveEvent(QMouseEvent *event) override; - void mouseReleaseEvent(QMouseEvent *event) override; - void mouseDoubleClickEvent(QMouseEvent *event) override; - void paintEvent(QPaintEvent *event) override; - void resizeEvent(QResizeEvent *event) override; - - void dragEnterEvent(QDragEnterEvent *event) override; - void dragMoveEvent(QDragMoveEvent *event) override; - void dragLeaveEvent(QDragLeaveEvent *event) override; - void dropEvent(QDropEvent *event) override; - - void startDrag(Qt::DropActions supportedActions) override; - - void updateScrollbar(); - -private: - friend struct VisualGroup; - QList m_groups; - - visibilityFunction fVisibility; - - // geometry - int m_leftMargin = 5; - int m_rightMargin = 5; - int m_bottomMargin = 5; - int m_categoryMargin = 5; - int m_spacing = 5; - int m_itemWidth = 100; - int m_currentItemsPerRow = -1; - int m_currentCursorColumn= -1; - mutable QCache geometryCache; - - // point where the currently active mouse action started in geometry coordinates - QPoint m_pressedPosition; - QPersistentModelIndex m_pressedIndex; - bool m_pressedAlreadySelected; - VisualGroup *m_pressedCategory; - QItemSelectionModel::SelectionFlag m_ctrlDragSelectionFlag; - QPoint m_lastDragPosition; - - VisualGroup *category(const QModelIndex &index) const; - VisualGroup *category(const QString &cat) const; - VisualGroup *categoryAt(const QPoint &pos, VisualGroup::HitResults & result) const; - - int itemsPerRow() const - { - return m_currentItemsPerRow; - }; - int contentWidth() const; - -private: /* methods */ - int itemWidth() const; - int calculateItemsPerRow() const; - int verticalScrollToValue(const QModelIndex &index, const QRect &rect, - QListView::ScrollHint hint) const; - QPixmap renderToPixmap(const QModelIndexList &indices, QRect *r) const; - QList> draggablePaintPairs(const QModelIndexList &indices, - QRect *r) const; - - bool isDragEventAccepted(QDropEvent *event); - - QPair rowDropPos(const QPoint &pos); - - QPoint offset() const; -}; diff --git a/application/groupview/GroupedProxyModel.cpp b/application/groupview/GroupedProxyModel.cpp deleted file mode 100644 index dc4212d5..00000000 --- a/application/groupview/GroupedProxyModel.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "GroupedProxyModel.h" - -#include "GroupView.h" -#include - -GroupedProxyModel::GroupedProxyModel(QObject *parent) : QSortFilterProxyModel(parent) -{ -} - -bool GroupedProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const -{ - const QString leftCategory = left.data(GroupViewRoles::GroupRole).toString(); - const QString rightCategory = right.data(GroupViewRoles::GroupRole).toString(); - if (leftCategory == rightCategory) - { - return subSortLessThan(left, right); - } - else - { - // FIXME: real group sorting happens in GroupView::updateGeometries(), see LocaleString - auto result = leftCategory.localeAwareCompare(rightCategory); - if(result == 0) - { - return subSortLessThan(left, right); - } - return result < 0; - } -} - -bool GroupedProxyModel::subSortLessThan(const QModelIndex &left, const QModelIndex &right) const -{ - return left.row() < right.row(); -} diff --git a/application/groupview/GroupedProxyModel.h b/application/groupview/GroupedProxyModel.h deleted file mode 100644 index fabf11c1..00000000 --- a/application/groupview/GroupedProxyModel.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -class GroupedProxyModel : public QSortFilterProxyModel -{ - Q_OBJECT - -public: - GroupedProxyModel(QObject *parent = 0); - -protected: - virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const override; - virtual bool subSortLessThan(const QModelIndex &left, const QModelIndex &right) const; -}; diff --git a/application/groupview/InstanceDelegate.cpp b/application/groupview/InstanceDelegate.cpp deleted file mode 100644 index fc959565..00000000 --- a/application/groupview/InstanceDelegate.cpp +++ /dev/null @@ -1,428 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "InstanceDelegate.h" -#include -#include -#include -#include -#include -#include - -#include "GroupView.h" -#include "BaseInstance.h" -#include "InstanceList.h" -#include -#include - -// Origin: Qt -static void viewItemTextLayout(QTextLayout &textLayout, int lineWidth, qreal &height, - qreal &widthUsed) -{ - height = 0; - widthUsed = 0; - textLayout.beginLayout(); - QString str = textLayout.text(); - while (true) - { - QTextLine line = textLayout.createLine(); - if (!line.isValid()) - break; - if (line.textLength() == 0) - break; - line.setLineWidth(lineWidth); - line.setPosition(QPointF(0, height)); - height += line.height(); - widthUsed = qMax(widthUsed, line.naturalTextWidth()); - } - textLayout.endLayout(); -} - -ListViewDelegate::ListViewDelegate(QObject *parent) : QStyledItemDelegate(parent) -{ -} - -void drawSelectionRect(QPainter *painter, const QStyleOptionViewItem &option, - const QRect &rect) -{ - if ((option.state & QStyle::State_Selected)) - painter->fillRect(rect, option.palette.brush(QPalette::Highlight)); - else - { - QColor backgroundColor = option.palette.color(QPalette::Background); - backgroundColor.setAlpha(160); - painter->fillRect(rect, QBrush(backgroundColor)); - } -} - -void drawFocusRect(QPainter *painter, const QStyleOptionViewItem &option, const QRect &rect) -{ - if (!(option.state & QStyle::State_HasFocus)) - return; - QStyleOptionFocusRect opt; - opt.direction = option.direction; - opt.fontMetrics = option.fontMetrics; - opt.palette = option.palette; - opt.rect = rect; - // opt.state = option.state | QStyle::State_KeyboardFocusChange | - // QStyle::State_Item; - auto col = option.state & QStyle::State_Selected ? QPalette::Highlight : QPalette::Base; - opt.backgroundColor = option.palette.color(col); - // Apparently some widget styles expect this hint to not be set - painter->setRenderHint(QPainter::Antialiasing, false); - - QStyle *style = option.widget ? option.widget->style() : QApplication::style(); - - style->drawPrimitive(QStyle::PE_FrameFocusRect, &opt, painter, option.widget); - - painter->setRenderHint(QPainter::Antialiasing); -} - -// TODO this can be made a lot prettier -void drawProgressOverlay(QPainter *painter, const QStyleOptionViewItem &option, - const int value, const int maximum) -{ - if (maximum == 0 || value == maximum) - { - return; - } - - painter->save(); - - qreal percent = (qreal)value / (qreal)maximum; - QColor color = option.palette.color(QPalette::Dark); - color.setAlphaF(0.70f); - painter->setBrush(color); - painter->setPen(QPen(QBrush(), 0)); - painter->drawPie(option.rect, 90 * 16, -percent * 360 * 16); - - painter->restore(); -} - -void drawBadges(QPainter *painter, const QStyleOptionViewItem &option, BaseInstance *instance, QIcon::Mode mode, QIcon::State state) -{ - QList pixmaps; - if (instance->isRunning()) - { - pixmaps.append("status-running"); - } - else if (instance->hasCrashed() || instance->hasVersionBroken()) - { - pixmaps.append("status-bad"); - } - if (instance->hasUpdateAvailable()) - { - pixmaps.append("checkupdate"); - } - - static const int itemSide = 24; - static const int spacing = 1; - const int itemsPerRow = qMax(1, qFloor(double(option.rect.width() + spacing) / double(itemSide + spacing))); - const int rows = qCeil((double)pixmaps.size() / (double)itemsPerRow); - QListIterator it(pixmaps); - painter->translate(option.rect.topLeft()); - for (int y = 0; y < rows; ++y) - { - for (int x = 0; x < itemsPerRow; ++x) - { - if (!it.hasNext()) - { - return; - } - // FIXME: inject this. - auto icon = XdgIcon::fromTheme(it.next()); - // opt.icon.paint(painter, iconbox, Qt::AlignCenter, mode, state); - const QPixmap pixmap; - // itemSide - QRect badgeRect( - option.rect.width() - x * itemSide + qMax(x - 1, 0) * spacing - itemSide, - y * itemSide + qMax(y - 1, 0) * spacing, - itemSide, - itemSide - ); - icon.paint(painter, badgeRect, Qt::AlignCenter, mode, state); - } - } - painter->translate(-option.rect.topLeft()); -} - -static QSize viewItemTextSize(const QStyleOptionViewItem *option) -{ - QStyle *style = option->widget ? option->widget->style() : QApplication::style(); - QTextOption textOption; - textOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); - QTextLayout textLayout; - textLayout.setTextOption(textOption); - textLayout.setFont(option->font); - textLayout.setText(option->text); - const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, option, option->widget) + 1; - QRect bounds(0, 0, 100 - 2 * textMargin, 600); - qreal height = 0, widthUsed = 0; - viewItemTextLayout(textLayout, bounds.width(), height, widthUsed); - const QSize size(qCeil(widthUsed), qCeil(height)); - return QSize(size.width() + 2 * textMargin, size.height()); -} - -void ListViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, - const QModelIndex &index) const -{ - QStyleOptionViewItem opt = option; - initStyleOption(&opt, index); - painter->save(); - painter->setClipRect(opt.rect); - - opt.features |= QStyleOptionViewItem::WrapText; - opt.text = index.data().toString(); - opt.textElideMode = Qt::ElideRight; - opt.displayAlignment = Qt::AlignTop | Qt::AlignHCenter; - - QStyle *style = opt.widget ? opt.widget->style() : QApplication::style(); - - // const int iconSize = style->pixelMetric(QStyle::PM_IconViewIconSize); - const int iconSize = 48; - QRect iconbox = opt.rect; - const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, opt.widget) + 1; - QRect textRect = opt.rect; - QRect textHighlightRect = textRect; - // clip the decoration on top, remove width padding - textRect.adjust(textMargin, iconSize + textMargin + 5, -textMargin, 0); - - textHighlightRect.adjust(0, iconSize + 5, 0, 0); - - // draw background - { - // FIXME: unused - // QSize textSize = viewItemTextSize ( &opt ); - drawSelectionRect(painter, opt, textHighlightRect); - /* - QPalette::ColorGroup cg; - QStyleOptionViewItem opt2(opt); - - if ((opt.widget && opt.widget->isEnabled()) || (opt.state & QStyle::State_Enabled)) - { - if (!(opt.state & QStyle::State_Active)) - cg = QPalette::Inactive; - else - cg = QPalette::Normal; - } - else - { - cg = QPalette::Disabled; - } - */ - /* - opt2.palette.setCurrentColorGroup(cg); - - // fill in background, if any - - - if (opt.backgroundBrush.style() != Qt::NoBrush) - { - QPointF oldBO = painter->brushOrigin(); - painter->setBrushOrigin(opt.rect.topLeft()); - painter->fillRect(opt.rect, opt.backgroundBrush); - painter->setBrushOrigin(oldBO); - } - - drawSelectionRect(painter, opt2, textHighlightRect); - */ - - /* - if (opt.showDecorationSelected) - { - drawSelectionRect(painter, opt2, opt.rect); - drawFocusRect(painter, opt2, opt.rect); - // painter->fillRect ( opt.rect, opt.palette.brush ( cg, QPalette::Highlight ) ); - } - else - { - - // if ( opt.state & QStyle::State_Selected ) - { - // QRect textRect = subElementRect ( QStyle::SE_ItemViewItemText, opt, - // opt.widget ); - // painter->fillRect ( textHighlightRect, opt.palette.brush ( cg, - // QPalette::Highlight ) ); - drawSelectionRect(painter, opt2, textHighlightRect); - drawFocusRect(painter, opt2, textHighlightRect); - } - } - */ - } - - // icon mode and state, also used for badges - QIcon::Mode mode = QIcon::Normal; - if (!(opt.state & QStyle::State_Enabled)) - mode = QIcon::Disabled; - else if (opt.state & QStyle::State_Selected) - mode = QIcon::Selected; - QIcon::State state = opt.state & QStyle::State_Open ? QIcon::On : QIcon::Off; - - // draw the icon - { - iconbox.setHeight(iconSize); - opt.icon.paint(painter, iconbox, Qt::AlignCenter, mode, state); - } - // set the text colors - QPalette::ColorGroup cg = - opt.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled; - if (cg == QPalette::Normal && !(opt.state & QStyle::State_Active)) - cg = QPalette::Inactive; - if (opt.state & QStyle::State_Selected) - { - painter->setPen(opt.palette.color(cg, QPalette::HighlightedText)); - } - else - { - painter->setPen(opt.palette.color(cg, QPalette::Text)); - } - - // draw the text - QTextOption textOption; - textOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); - textOption.setTextDirection(opt.direction); - textOption.setAlignment(QStyle::visualAlignment(opt.direction, opt.displayAlignment)); - QTextLayout textLayout; - textLayout.setTextOption(textOption); - textLayout.setFont(opt.font); - textLayout.setText(opt.text); - - qreal width, height; - viewItemTextLayout(textLayout, textRect.width(), height, width); - - const int lineCount = textLayout.lineCount(); - - const QRect layoutRect = QStyle::alignedRect( - opt.direction, opt.displayAlignment, QSize(textRect.width(), int(height)), textRect); - const QPointF position = layoutRect.topLeft(); - for (int i = 0; i < lineCount; ++i) - { - const QTextLine line = textLayout.lineAt(i); - line.draw(painter, position); - } - - // FIXME: this really has no business of being here. Make generic. - auto instance = (BaseInstance*)index.data(InstanceList::InstancePointerRole) - .value(); - if (instance) - { - drawBadges(painter, opt, instance, mode, state); - } - - drawProgressOverlay(painter, opt, index.data(GroupViewRoles::ProgressValueRole).toInt(), - index.data(GroupViewRoles::ProgressMaximumRole).toInt()); - - painter->restore(); -} - -QSize ListViewDelegate::sizeHint(const QStyleOptionViewItem &option, - const QModelIndex &index) const -{ - QStyleOptionViewItem opt = option; - initStyleOption(&opt, index); - opt.features |= QStyleOptionViewItem::WrapText; - opt.text = index.data().toString(); - opt.textElideMode = Qt::ElideRight; - opt.displayAlignment = Qt::AlignTop | Qt::AlignHCenter; - - QStyle *style = opt.widget ? opt.widget->style() : QApplication::style(); - const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, &option, opt.widget) + 1; - int height = 48 + textMargin * 2 + 5; // TODO: turn constants into variables - QSize szz = viewItemTextSize(&opt); - height += szz.height(); - // FIXME: maybe the icon items could scale and keep proportions? - QSize sz(100, height); - return sz; -} - -class NoReturnTextEdit: public QTextEdit -{ - Q_OBJECT -public: - explicit NoReturnTextEdit(QWidget *parent) : QTextEdit(parent) - { - setTextInteractionFlags(Qt::TextEditorInteraction); - setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOff); - setVerticalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOff); - } - bool event(QEvent * event) override - { - auto eventType = event->type(); - if(eventType == QEvent::KeyPress || eventType == QEvent::KeyRelease) - { - QKeyEvent *keyEvent = static_cast(event); - auto key = keyEvent->key(); - if (key == Qt::Key_Return || key == Qt::Key_Enter) - { - emit editingDone(); - return true; - } - if(key == Qt::Key_Tab) - { - return true; - } - } - return QTextEdit::event(event); - } -signals: - void editingDone(); -}; - -void ListViewDelegate::updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index) const -{ - const int iconSize = 48; - QRect textRect = option.rect; - // QStyle *style = option.widget ? option.widget->style() : QApplication::style(); - textRect.adjust(0, iconSize + 5, 0, 0); - editor->setGeometry(textRect); -} - -void ListViewDelegate::setEditorData(QWidget* editor, const QModelIndex& index) const -{ - auto text = index.data(Qt::EditRole).toString(); - QTextEdit * realeditor = qobject_cast(editor); - realeditor->setAlignment(Qt::AlignHCenter | Qt::AlignTop); - realeditor->append(text); - realeditor->selectAll(); - realeditor->document()->clearUndoRedoStacks(); -} - -void ListViewDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const -{ - QTextEdit * realeditor = qobject_cast(editor); - QString text = realeditor->toPlainText(); - text.replace(QChar('\n'), QChar(' ')); - text = text.trimmed(); - if(text.size() != 0) - { - model->setData(index, text); - } -} - -QWidget * ListViewDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const -{ - auto editor = new NoReturnTextEdit(parent); - connect(editor, &NoReturnTextEdit::editingDone, this, &ListViewDelegate::editingDone); - return editor; -} - -void ListViewDelegate::editingDone() -{ - NoReturnTextEdit *editor = qobject_cast(sender()); - emit commitData(editor); - emit closeEditor(editor); -} - -#include "InstanceDelegate.moc" diff --git a/application/groupview/InstanceDelegate.h b/application/groupview/InstanceDelegate.h deleted file mode 100644 index d95279f3..00000000 --- a/application/groupview/InstanceDelegate.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -class ListViewDelegate : public QStyledItemDelegate -{ - Q_OBJECT - -public: - explicit ListViewDelegate(QObject *parent = 0); - virtual ~ListViewDelegate() {} - - void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override; - QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override; - void updateEditorGeometry(QWidget * editor, const QStyleOptionViewItem & option, const QModelIndex & index) const override; - QWidget * createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index) const override; - - void setEditorData(QWidget * editor, const QModelIndex & index) const override; - void setModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex & index) const override; - -private slots: - void editingDone(); -}; diff --git a/application/groupview/VisualGroup.cpp b/application/groupview/VisualGroup.cpp deleted file mode 100644 index 76bf8678..00000000 --- a/application/groupview/VisualGroup.cpp +++ /dev/null @@ -1,317 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "VisualGroup.h" - -#include -#include -#include -#include -#include - -#include "GroupView.h" - -VisualGroup::VisualGroup(const QString &text, GroupView *view) : view(view), text(text), collapsed(false) -{ -} - -VisualGroup::VisualGroup(const VisualGroup *other) - : view(other->view), text(other->text), collapsed(other->collapsed) -{ -} - -void VisualGroup::update() -{ - auto temp_items = items(); - auto itemsPerRow = view->itemsPerRow(); - - int numRows = qMax(1, qCeil((qreal)temp_items.size() / (qreal)itemsPerRow)); - rows = QVector(numRows); - - int maxRowHeight = 0; - int positionInRow = 0; - int currentRow = 0; - int offsetFromTop = 0; - for (auto item: temp_items) - { - if(positionInRow == itemsPerRow) - { - rows[currentRow].height = maxRowHeight; - rows[currentRow].top = offsetFromTop; - currentRow ++; - offsetFromTop += maxRowHeight + 5; - positionInRow = 0; - maxRowHeight = 0; - } - auto itemHeight = view->itemDelegate()->sizeHint(view->viewOptions(), item).height(); - if(itemHeight > maxRowHeight) - { - maxRowHeight = itemHeight; - } - rows[currentRow].items.append(item); - positionInRow++; - } - rows[currentRow].height = maxRowHeight; - rows[currentRow].top = offsetFromTop; -} - -QPair VisualGroup::positionOf(const QModelIndex &index) const -{ - int y = 0; - for (auto & row: rows) - { - for(auto x = 0; x < row.items.size(); x++) - { - if(row.items[x] == index) - { - return qMakePair(x,y); - } - } - y++; - } - qWarning() << "Item" << index.row() << index.data(Qt::DisplayRole).toString() << "not found in visual group" << text; - return qMakePair(0, 0); -} - -int VisualGroup::rowTopOf(const QModelIndex &index) const -{ - auto position = positionOf(index); - return rows[position.second].top; -} - -int VisualGroup::rowHeightOf(const QModelIndex &index) const -{ - auto position = positionOf(index); - return rows[position.second].height; -} - -VisualGroup::HitResults VisualGroup::hitScan(const QPoint &pos) const -{ - VisualGroup::HitResults results = VisualGroup::NoHit; - int y_start = verticalPosition(); - int body_start = y_start + headerHeight(); - int body_end = body_start + contentHeight() + 5; // FIXME: wtf is this 5? - int y = pos.y(); - // int x = pos.x(); - if (y < y_start) - { - results = VisualGroup::NoHit; - } - else if (y < body_start) - { - results = VisualGroup::HeaderHit; - int collapseSize = headerHeight() - 4; - - // the icon - QRect iconRect = QRect(view->m_leftMargin + 2, 2 + y_start, collapseSize, collapseSize); - if (iconRect.contains(pos)) - { - results |= VisualGroup::CheckboxHit; - } - } - else if (y < body_end) - { - results |= VisualGroup::BodyHit; - } - return results; -} - -void VisualGroup::drawHeader(QPainter *painter, const QStyleOptionViewItem &option) -{ - painter->setRenderHint(QPainter::Antialiasing); - - const QRect optRect = option.rect; - QFont font(QApplication::font()); - font.setBold(true); - const QFontMetrics fontMetrics = QFontMetrics(font); - - QColor outlineColor = option.palette.text().color(); - outlineColor.setAlphaF(0.35); - - //BEGIN: top left corner - { - painter->save(); - painter->setPen(outlineColor); - const QPointF topLeft(optRect.topLeft()); - QRectF arc(topLeft, QSizeF(4, 4)); - arc.translate(0.5, 0.5); - painter->drawArc(arc, 1440, 1440); - painter->restore(); - } - //END: top left corner - - //BEGIN: left vertical line - { - QPoint start(optRect.topLeft()); - start.ry() += 3; - QPoint verticalGradBottom(optRect.topLeft()); - verticalGradBottom.ry() += fontMetrics.height() + 5; - QLinearGradient gradient(start, verticalGradBottom); - gradient.setColorAt(0, outlineColor); - gradient.setColorAt(1, Qt::transparent); - painter->fillRect(QRect(start, QSize(1, fontMetrics.height() + 5)), gradient); - } - //END: left vertical line - - //BEGIN: horizontal line - { - QPoint start(optRect.topLeft()); - start.rx() += 3; - QPoint horizontalGradTop(optRect.topLeft()); - horizontalGradTop.rx() += optRect.width() - 6; - painter->fillRect(QRect(start, QSize(optRect.width() - 6, 1)), outlineColor); - } - //END: horizontal line - - //BEGIN: top right corner - { - painter->save(); - painter->setPen(outlineColor); - QPointF topRight(optRect.topRight()); - topRight.rx() -= 4; - QRectF arc(topRight, QSizeF(4, 4)); - arc.translate(0.5, 0.5); - painter->drawArc(arc, 0, 1440); - painter->restore(); - } - //END: top right corner - - //BEGIN: right vertical line - { - QPoint start(optRect.topRight()); - start.ry() += 3; - QPoint verticalGradBottom(optRect.topRight()); - verticalGradBottom.ry() += fontMetrics.height() + 5; - QLinearGradient gradient(start, verticalGradBottom); - gradient.setColorAt(0, outlineColor); - gradient.setColorAt(1, Qt::transparent); - painter->fillRect(QRect(start, QSize(1, fontMetrics.height() + 5)), gradient); - } - //END: right vertical line - - //BEGIN: checkboxy thing - { - painter->save(); - painter->setRenderHint(QPainter::Antialiasing, false); - painter->setFont(font); - QColor penColor(option.palette.text().color()); - penColor.setAlphaF(0.6); - painter->setPen(penColor); - QRect iconSubRect(option.rect); - iconSubRect.setTop(iconSubRect.top() + 7); - iconSubRect.setLeft(iconSubRect.left() + 7); - - int sizing = fontMetrics.height(); - int even = ( (sizing - 1) % 2 ); - - iconSubRect.setHeight(sizing - even); - iconSubRect.setWidth(sizing - even); - painter->drawRect(iconSubRect); - - - /* - if(collapsed) - painter->drawText(iconSubRect, Qt::AlignHCenter | Qt::AlignVCenter, "+"); - else - painter->drawText(iconSubRect, Qt::AlignHCenter | Qt::AlignVCenter, "-"); - */ - painter->setBrush(option.palette.text()); - painter->fillRect(iconSubRect.x(), iconSubRect.y() + iconSubRect.height() / 2, - iconSubRect.width(), 2, penColor); - if (collapsed) - { - painter->fillRect(iconSubRect.x() + iconSubRect.width() / 2, iconSubRect.y(), 2, - iconSubRect.height(), penColor); - } - - painter->restore(); - } - //END: checkboxy thing - - //BEGIN: text - { - QRect textRect(option.rect); - textRect.setTop(textRect.top() + 7); - textRect.setLeft(textRect.left() + 7 + fontMetrics.height() + 7); - textRect.setHeight(fontMetrics.height()); - textRect.setRight(textRect.right() - 7); - - painter->save(); - painter->setFont(font); - QColor penColor(option.palette.text().color()); - penColor.setAlphaF(0.6); - painter->setPen(penColor); - painter->drawText(textRect, Qt::AlignLeft | Qt::AlignVCenter, text); - painter->restore(); - } - //END: text -} - -int VisualGroup::totalHeight() const -{ - return headerHeight() + 5 + contentHeight(); // FIXME: wtf is that '5'? -} - -int VisualGroup::headerHeight() const -{ - QFont font(QApplication::font()); - font.setBold(true); - QFontMetrics fontMetrics(font); - - const int height = fontMetrics.height() + 1 /* 1 pixel-width gradient */ - + 11 /* top and bottom separation */; - return height; - /* - int raw = view->viewport()->fontMetrics().height() + 4; - // add english. maybe. depends on font height. - if (raw % 2 == 0) - raw++; - return std::min(raw, 25); - */ -} - -int VisualGroup::contentHeight() const -{ - if (collapsed) - { - return 0; - } - auto last = rows[numRows() - 1]; - return last.top + last.height; -} - -int VisualGroup::numRows() const -{ - return rows.size(); -} - -int VisualGroup::verticalPosition() const -{ - return m_verticalPosition; -} - -QList VisualGroup::items() const -{ - QList indices; - for (int i = 0; i < view->model()->rowCount(); ++i) - { - const QModelIndex index = view->model()->index(i, 0); - if (index.data(GroupViewRoles::GroupRole).toString() == text) - { - indices.append(index); - } - } - return indices; -} diff --git a/application/groupview/VisualGroup.h b/application/groupview/VisualGroup.h deleted file mode 100644 index 239ee9d7..00000000 --- a/application/groupview/VisualGroup.h +++ /dev/null @@ -1,106 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include -#include - -class GroupView; -class QPainter; -class QModelIndex; - -struct VisualRow -{ - QList items; - int height = 0; - int top = 0; - inline int size() const - { - return items.size(); - } - inline QModelIndex &operator[](int i) - { - return items[i]; - } -}; - -struct VisualGroup -{ -/* constructors */ - VisualGroup(const QString &text, GroupView *view); - VisualGroup(const VisualGroup *other); - -/* data */ - GroupView *view = nullptr; - QString text; - bool collapsed = false; - QVector rows; - int firstItemIndex = 0; - int m_verticalPosition = 0; - -/* logic */ - /// update the internal list of items and flow them into the rows. - void update(); - - /// draw the header at y-position. - void drawHeader(QPainter *painter, const QStyleOptionViewItem &option); - - /// height of the group, in total. includes a small bit of padding. - int totalHeight() const; - - /// height of the group header, in pixels - int headerHeight() const; - - /// height of the group content, in pixels - int contentHeight() const; - - /// the number of visual rows this group has - int numRows() const; - - /// actually calculate the above value - int calculateNumRows() const; - - /// the height at which this group starts, in pixels - int verticalPosition() const; - - /// relative geometry - top of the row of the given item - int rowTopOf(const QModelIndex &index) const; - - /// height of the row of the given item - int rowHeightOf(const QModelIndex &index) const; - - /// x/y position of the given item inside the group (in items!) - QPair positionOf(const QModelIndex &index) const; - - enum HitResult - { - NoHit = 0x0, - TextHit = 0x1, - CheckboxHit = 0x2, - HeaderHit = 0x4, - BodyHit = 0x8 - }; - Q_DECLARE_FLAGS(HitResults, HitResult) - - /// shoot! BANG! what did we hit? - HitResults hitScan (const QPoint &pos) const; - - QList items() const; -}; - -Q_DECLARE_OPERATORS_FOR_FLAGS(VisualGroup::HitResults) diff --git a/application/install_prereqs.cmake.in b/application/install_prereqs.cmake.in deleted file mode 100644 index e4408d16..00000000 --- a/application/install_prereqs.cmake.in +++ /dev/null @@ -1,27 +0,0 @@ -set(CMAKE_MODULE_PATH "@CMAKE_MODULE_PATH@") - -file(GLOB_RECURSE QTPLUGINS "${CMAKE_INSTALL_PREFIX}/@PLUGIN_DEST_DIR@/*@CMAKE_SHARED_LIBRARY_SUFFIX@") -function(gp_resolved_file_type_override resolved_file type_var) - if(resolved_file MATCHES "^/(usr/)?lib/libQt") - set(${type_var} other PARENT_SCOPE) - elseif(resolved_file MATCHES "^/(usr/)?lib(.+)?/libxcb-") - set(${type_var} other PARENT_SCOPE) - elseif(resolved_file MATCHES "^/(usr/)?lib(.+)?/libicu") - set(${type_var} other PARENT_SCOPE) - elseif(resolved_file MATCHES "^/(usr/)?lib(.+)?/libpng") - set(${type_var} other PARENT_SCOPE) - elseif(resolved_file MATCHES "^/(usr/)?lib(.+)?/libproxy") - set(${type_var} other PARENT_SCOPE) - elseif((resolved_file MATCHES "^/(usr/)?lib(.+)?/libstdc\\+\\+") AND (UNIX AND NOT APPLE)) - set(${type_var} other PARENT_SCOPE) - endif() -endfunction() - -set(gp_tool "@CMAKE_GP_TOOL@") -set(gp_cmd_paths ${gp_cmd_paths} - "@CMAKE_GP_CMD_PATHS@" -) - -include(BundleUtilities) -fixup_bundle("@APPS@" "${QTPLUGINS}" "@DIRS@") - diff --git a/application/main.cpp b/application/main.cpp deleted file mode 100644 index b0360c7e..00000000 --- a/application/main.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include "MultiMC.h" -#include "MainWindow.h" -#include "LaunchController.h" -#include -#include - -// #define BREAK_INFINITE_LOOP -// #define BREAK_EXCEPTION -// #define BREAK_RETURN - -#ifdef BREAK_INFINITE_LOOP -#include -#include -#endif - -int main(int argc, char *argv[]) -{ -#ifdef BREAK_INFINITE_LOOP - while(true) - { - std::this_thread::sleep_for(std::chrono::milliseconds(250)); - } -#endif -#ifdef BREAK_EXCEPTION - throw 42; -#endif -#ifdef BREAK_RETURN - return 42; -#endif - -#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) - QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); -#endif - - // initialize Qt - MultiMC app(argc, argv); - - switch (app.status()) - { - case MultiMC::StartingUp: - case MultiMC::Initialized: - { - Q_INIT_RESOURCE(multimc); - Q_INIT_RESOURCE(backgrounds); - - Q_INIT_RESOURCE(pe_dark); - Q_INIT_RESOURCE(pe_light); - Q_INIT_RESOURCE(pe_blue); - Q_INIT_RESOURCE(pe_colored); - Q_INIT_RESOURCE(OSX); - Q_INIT_RESOURCE(iOS); - Q_INIT_RESOURCE(flat); - return app.exec(); - } - case MultiMC::Failed: - return 1; - case MultiMC::Succeeded: - return 0; - } -} diff --git a/application/package/linux/MultiMC b/application/package/linux/MultiMC deleted file mode 100755 index da6373bc..00000000 --- a/application/package/linux/MultiMC +++ /dev/null @@ -1,93 +0,0 @@ -#!/bin/bash -# Basic start script for running MultiMC with the libs packaged with it. - -function printerror { - printf "$1" - if which zenity >/dev/null; then zenity --error --text="$1" &>/dev/null; - elif which kdialog >/dev/null; then kdialog --error "$1" &>/dev/null; - fi -} - -if [[ $EUID -eq 0 ]]; then - printerror "This program should not be run using sudo or as the root user!\n" - exit 1 -fi - - -MMC_DIR="$(dirname "$(readlink -f "$0")")" -echo "MultiMC Dir: ${MMC_DIR}" - -# Set up env - filter out input LD_ variables but pass them in under different names -export GAME_LIBRARY_PATH=${GAME_LIBRARY_PATH-${LD_LIBRARY_PATH}} -export GAME_PRELOAD=${GAME_PRELOAD-${LD_PRELOAD}} -export LD_LIBRARY_PATH="${MMC_DIR}/bin":$MMC_LIBRARY_PATH -export LD_PRELOAD=$MMC_PRELOAD -export QT_PLUGIN_PATH="${MMC_DIR}/plugins" -export QT_FONTPATH="${MMC_DIR}/fonts" - -# Detect missing dependencies... -DEPS_LIST=`ldd "${MMC_DIR}"/plugins/*/*.so 2>/dev/null | grep "not found" | sort -u | awk -vORS=", " '{ print $1 }'` -if [ "x$DEPS_LIST" = "x" ]; then - # We have all our dependencies. Run MultiMC. - echo "No missing dependencies found." - - # Just to be sure... - chmod +x "${MMC_DIR}/bin/MultiMC" - - # Run MultiMC - "${MMC_DIR}/bin/MultiMC" -d "${MMC_DIR}" "$@" - - # Run MultiMC in valgrind - # valgrind --log-file="valgrind.log" --leak-check=full --track-origins=yes "${MMC_DIR}/bin/MultiMC" -d "${MMC_DIR}" "$@" - - # Run MultiMC with callgrind, delay instrumentation - # valgrind --log-file="valgrind.log" --tool=callgrind --instr-atstart=no "${MMC_DIR}/bin/MultiMC" -d "${MMC_DIR}" "$@" - # use callgrind_control -i on/off to profile actions - - # Exit with MultiMC's exit code. - exit $? -else - # apt - if which apt-file &>/dev/null; then - LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*" | sort -u` - COMMAND_LIBS=`for LIBRARY in $LIBRARIES; do apt-file -l search $LIBRARY; done` - COMMAND_LIBS=`echo "$COMMAND_LIBS" | sort -u | awk -vORS=" " '{ print $1 }'` - INSTALL_CMD="sudo apt-get install $COMMAND_LIBS" - # pacman - elif which pkgfile &>/dev/null; then - LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*" | sort -u` - COMMAND_LIBS=`for LIBRARY in $LIBRARIES; do pkgfile $LIBRARY; done` - COMMAND_LIBS=`echo "$COMMAND_LIBS" | sort -u | awk -vORS=" " '{ print $1 }'` - INSTALL_CMD="sudo pacman -S $COMMAND_LIBS" - # dnf - elif which dnf &>/dev/null; then - LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*" | sort -u` - COMMAND_LIBS=`for LIBRARY in $LIBRARIES; do dnf whatprovides -q $LIBRARY; done` - COMMAND_LIBS=`echo "$COMMAND_LIBS" | grep -v 'Repo' | sort -u | awk -vORS=" " '{ print $1 }'` - INSTALL_CMD="sudo dnf install $COMMAND_LIBS" - # yum - elif which yum &>/dev/null; then - LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*" | sort -u` - COMMAND_LIBS=`for LIBRARY in $LIBRARIES; do yum whatprovides $LIBRARY; done` - COMMAND_LIBS=`echo "$COMMAND_LIBS" | sort -u | awk -vORS=" " '{ print $1 }'` - INSTALL_CMD="sudo yum install $COMMAND_LIBS" - # zypper - elif which zypper &>/dev/null; then - LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*" | sort -u` - COMMAND_LIBS=`for LIBRARY in $LIBRARIES; do zypper wp $LIBRARY; done` - COMMAND_LIBS=`echo "$COMMAND_LIBS" | sort -u | awk -vORS=" " '{ print $1 }'` - INSTALL_CMD="sudo zypper install $COMMAND_LIBS" - # emerge - elif which pfl &>/dev/null; then - LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*" | sort -u` - COMMAND_LIBS=`for LIBRARY in $LIBRARIES; do pfl $LIBRARY; done` - COMMAND_LIBS=`echo "$COMMAND_LIBS" | sort -u | awk -vORS=" " '{ print $1 }'` - INSTALL_CMD="sudo emerge $COMMAND_LIBS" - fi - - MESSAGE="Error: MultiMC is missing the following libraries that it needs to work correctly:\n\t${DEPS_LIST}\nPlease install them from your distribution's package manager." - MESSAGE="$MESSAGE\n\nHint (please apply common sense): $INSTALL_CMD\n" - - printerror "$MESSAGE" - exit 1 -fi diff --git a/application/package/linux/multimc.desktop b/application/package/linux/multimc.desktop deleted file mode 100755 index c25be047..00000000 --- a/application/package/linux/multimc.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Version=1.0 -Name=MultiMC -GenericName=Minecraft Launcher -Comment=Free, open source launcher and instance manager for Minecraft. -Type=Application -Terminal=false -Exec=multimc -Icon=multimc -Categories=Game -Keywords=game;minecraft; diff --git a/application/package/rpm/MultiMC5.spec b/application/package/rpm/MultiMC5.spec deleted file mode 100644 index 78b9000e..00000000 --- a/application/package/rpm/MultiMC5.spec +++ /dev/null @@ -1,47 +0,0 @@ -Name: MultiMC5 -Version: 1.4 -Release: 2%{?dist} -Summary: A local install wrapper for MultiMC - -License: ASL 2.0 -URL: https://multimc.org -BuildArch: x86_64 - -Requires: zenity qt5-qtbase wget xrandr -Provides: multimc MultiMC multimc5 - -%description -A local install wrapper for MultiMC - -%prep - - -%build - - -%install -mkdir -p %{buildroot}/opt/multimc -install -m 0644 ../ubuntu/multimc/opt/multimc/icon.svg %{buildroot}/opt/multimc/icon.svg -install -m 0755 ../ubuntu/multimc/opt/multimc/run.sh %{buildroot}/opt/multimc/run.sh -mkdir -p %{buildroot}/%{_datadir}/applications -install -m 0644 ../ubuntu/multimc/usr/share/applications/multimc.desktop %{buildroot}/%{_datadir}/applications/multimc.desktop -mkdir -p %{buildroot}/%{_metainfodir} -install -m 0644 ../ubuntu/multimc/usr/share/metainfo/multimc.metainfo.xml %{buildroot}/%{_metainfodir}/multimc.metainfo.xml - -%files -%dir /opt/multimc -/opt/multimc/icon.svg -/opt/multimc/run.sh -%{_datadir}/applications/multimc.desktop -%{_metainfodir}/multimc.metainfo.xml - - -%changelog -* Tue Jun 01 2021 kb1000 - 1.4-2 -- Add xrandr to the dependencies - -* Tue Dec 08 00:34:35 CET 2020 joshua-stone -- Add metainfo.xml for improving package metadata - -* Wed Nov 25 22:53:59 CET 2020 kb1000 -- Initial version of the RPM package, based on the Ubuntu package diff --git a/application/package/rpm/README.md b/application/package/rpm/README.md deleted file mode 100644 index 0c2b1e49..00000000 --- a/application/package/rpm/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# What is this? -A simple RPM package for MultiMC that contains a script that downloads and installs real MultiMC on Red Hat based systems. - -It contains a `.desktop` file, a `.metainfo.xml` file, an icon, and a simple script that does the heavy lifting. - -# How to build this? -You need the `rpm-build` package. Switch into this directory, then run: -``` -rpmbuild --build-in-place -bb MultiMC5.spec -``` - -Replace the version with whatever is appropriate. diff --git a/application/package/ubuntu/README.md b/application/package/ubuntu/README.md deleted file mode 100644 index 892abd12..00000000 --- a/application/package/ubuntu/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# What is this? -A simple Ubuntu package for MultiMC that contains a script that downloads and installs real MultiMC on Ubuntu based systems. - -It contains a `.desktop` file, an icon, and a simple script that does the heavy lifting. - -This is also the source for the files in the [RPM package](../rpm). If you rename, create or delete files here, you'll likely also have to update the RPM spec file there. - -# How to build this? -You need dpkg utils. Rename the `multimc` folder to `multimc_1.5-1` and then run: -``` -fakeroot dpkg-deb --build multimc_1.5-1 -``` - -Replace the version with whatever is appropriate. diff --git a/application/package/ubuntu/multimc/DEBIAN/control b/application/package/ubuntu/multimc/DEBIAN/control deleted file mode 100644 index 3e0f570c..00000000 --- a/application/package/ubuntu/multimc/DEBIAN/control +++ /dev/null @@ -1,12 +0,0 @@ -Package: multimc -Version: 1.5-1 -Architecture: all -Maintainer: Petr Mrázek -Section: games -Priority: optional -Installed-Size: 75 -Depends: zenity, desktop-file-utils, libqt5widgets5, libqt5gui5, libqt5network5, libqt5core5a, libqt5xml5, libqt5concurrent5, wget -Recommends: openjdk-8-jre -Homepage: http://multimc.org -Description: A local install wrapper for MultiMC - diff --git a/application/package/ubuntu/multimc/DEBIAN/postrm b/application/package/ubuntu/multimc/DEBIAN/postrm deleted file mode 100755 index f9bbc8a7..00000000 --- a/application/package/ubuntu/multimc/DEBIAN/postrm +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -set -e -update-desktop-database diff --git a/application/package/ubuntu/multimc/opt/multimc/icon.svg b/application/package/ubuntu/multimc/opt/multimc/icon.svg deleted file mode 100644 index 8bb0e289..00000000 --- a/application/package/ubuntu/multimc/opt/multimc/icon.svg +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/package/ubuntu/multimc/opt/multimc/run.sh b/application/package/ubuntu/multimc/opt/multimc/run.sh deleted file mode 100755 index c493a513..00000000 --- a/application/package/ubuntu/multimc/opt/multimc/run.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -INSTDIR="${XDG_DATA_HOME-$HOME/.local/share}/multimc" - -if [ `getconf LONG_BIT` = "64" ] -then - PACKAGE="mmc-stable-lin64.tar.gz" -else - PACKAGE="mmc-stable-lin32.tar.gz" -fi - -deploy() { - mkdir -p $INSTDIR - cd ${INSTDIR} - - wget --progress=dot:force "https://files.multimc.org/downloads/${PACKAGE}" 2>&1 | sed -u 's/.* \([0-9]\+%\)\ \+\([0-9.]\+.\) \(.*\)/\1\n# Downloading at \2\/s, ETA \3/' | zenity --progress --auto-close --auto-kill --title="Downloading MultiMC..." - - tar -xzf ${PACKAGE} --transform='s,MultiMC/,,' - rm ${PACKAGE} - chmod +x MultiMC -} - -runmmc() { - cd ${INSTDIR} - ./MultiMC "$@" -} - -if [[ ! -f ${INSTDIR}/MultiMC ]]; then - deploy - runmmc "$@" -else - runmmc "$@" -fi diff --git a/application/package/ubuntu/multimc/usr/share/applications/multimc.desktop b/application/package/ubuntu/multimc/usr/share/applications/multimc.desktop deleted file mode 100755 index e0456f89..00000000 --- a/application/package/ubuntu/multimc/usr/share/applications/multimc.desktop +++ /dev/null @@ -1,16 +0,0 @@ -[Desktop Entry] -Categories=Game; -Exec=/opt/multimc/run.sh -Icon=/opt/multimc/icon.svg -Keywords=game;Minecraft; -MimeType= -Name=MultiMC 5 -Path= -StartupNotify=true -Terminal=false -TerminalOptions= -Type=Application -X-DBUS-ServiceName= -X-DBUS-StartupType= -X-KDE-SubstituteUID=false -X-KDE-Username= diff --git a/application/package/ubuntu/multimc/usr/share/metainfo/multimc.metainfo.xml b/application/package/ubuntu/multimc/usr/share/metainfo/multimc.metainfo.xml deleted file mode 100644 index 4c6b7450..00000000 --- a/application/package/ubuntu/multimc/usr/share/metainfo/multimc.metainfo.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - multimc - multimc.desktop - MultiMC - Manage Minecraft instances with ease - -

Overview

-

MultiMC is a free, open source launcher for Minecraft. It allows you to have multiple, cleanly separated instances of Minecraft (each with their own mods, texture packs, saves, etc) and helps you manage them and their associated options with a simple and powerful interface.

-

Features

-
    -
  • Manage multiple instances of Minecraft at once
  • -
  • Start Minecraft with a custom resolution
  • -
  • Change Java's runtime options (including memory options)
  • -
  • Shows Minecraft's console output in a colour coded window
  • -
  • Kill Minecraft easily if it crashes / freezes
  • -
  • Custom icons and groups for instances
  • -
  • Forge integration (automatic installation, version downloads, mod management)
  • -
  • Minecraft world management
  • -
  • Import and export Minecraft instances to share them with anyone
  • -
  • Supports every version of Minecraft that the vanilla launcher does
  • -
-
- - - https://multimc.org/images/screenshots/main.png - - - https://multimc.org/images/screenshots/editmods.png - - - https://multimc.org/images/screenshots/version.png - - - https://multimc.org/images/screenshots/console.png - - - https://multimc.org/images/screenshots/settings.png - - - - - - https://multimc.org/ - https://discord.com/invite/0k2zsXGNHs0fE4Wm - https://github.com/MultiMC/MultiMC5/wiki/FAQ - https://github.com/MultiMC/MultiMC5/issues - https://translate.multimc.org/ - https://www.patreon.com/multimc - The MultiMC Team - CC0-1.0 - Apache-2.0 - peterix_at_gmail.com -
diff --git a/application/pagedialog/PageDialog.cpp b/application/pagedialog/PageDialog.cpp deleted file mode 100644 index fd5d36d4..00000000 --- a/application/pagedialog/PageDialog.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "PageDialog.h" - -#include -#include -#include -#include - -#include "MultiMC.h" -#include "settings/SettingsObject.h" -#include "widgets/IconLabel.h" -#include "widgets/PageContainer.h" - -PageDialog::PageDialog(BasePageProvider *pageProvider, QString defaultId, QWidget *parent) - : QDialog(parent) -{ - setWindowTitle(pageProvider->dialogTitle()); - m_container = new PageContainer(pageProvider, defaultId, this); - - QVBoxLayout *mainLayout = new QVBoxLayout; - mainLayout->addWidget(m_container); - mainLayout->setSpacing(0); - mainLayout->setContentsMargins(0, 0, 0, 0); - setLayout(mainLayout); - - QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Help | QDialogButtonBox::Close); - buttons->button(QDialogButtonBox::Close)->setDefault(true); - buttons->setContentsMargins(6, 0, 6, 0); - m_container->addButtons(buttons); - - connect(buttons->button(QDialogButtonBox::Close), SIGNAL(clicked()), this, SLOT(close())); - connect(buttons->button(QDialogButtonBox::Help), SIGNAL(clicked()), m_container, SLOT(help())); - - restoreGeometry(QByteArray::fromBase64(MMC->settings()->get("PagedGeometry").toByteArray())); -} - -void PageDialog::closeEvent(QCloseEvent *event) -{ - qDebug() << "Paged dialog close requested"; - if (m_container->prepareToClose()) - { - qDebug() << "Paged dialog close approved"; - MMC->settings()->set("PagedGeometry", saveGeometry().toBase64()); - qDebug() << "Paged dialog geometry saved"; - QDialog::closeEvent(event); - } -} diff --git a/application/pagedialog/PageDialog.h b/application/pagedialog/PageDialog.h deleted file mode 100644 index 1029bc30..00000000 --- a/application/pagedialog/PageDialog.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include "pages/BasePageProvider.h" - -class PageContainer; -class PageDialog : public QDialog -{ - Q_OBJECT -public: - explicit PageDialog(BasePageProvider *pageProvider, QString defaultId = QString(), QWidget *parent = 0); - virtual ~PageDialog() {} - -private -slots: - virtual void closeEvent(QCloseEvent *event); - -private: - PageContainer * m_container; -}; diff --git a/application/pages/BasePage.h b/application/pages/BasePage.h deleted file mode 100644 index 408965d0..00000000 --- a/application/pages/BasePage.h +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include - -#include "BasePageContainer.h" - -class BasePage -{ -public: - virtual ~BasePage() {} - virtual QString id() const = 0; - virtual QString displayName() const = 0; - virtual QIcon icon() const = 0; - virtual bool apply() { return true; } - virtual bool shouldDisplay() const { return true; } - virtual QString helpPage() const { return QString(); } - void opened() - { - isOpened = true; - openedImpl(); - } - void closed() - { - isOpened = false; - closedImpl(); - } - virtual void openedImpl() {} - virtual void closedImpl() {} - virtual void setParentContainer(BasePageContainer * container) - { - m_container = container; - }; -public: - int stackIndex = -1; - int listIndex = -1; -protected: - BasePageContainer * m_container = nullptr; - bool isOpened = false; -}; - -typedef std::shared_ptr BasePagePtr; diff --git a/application/pages/BasePageContainer.h b/application/pages/BasePageContainer.h deleted file mode 100644 index f8c7adeb..00000000 --- a/application/pages/BasePageContainer.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -class BasePageContainer -{ -public: - virtual ~BasePageContainer(){}; - virtual bool selectPage(QString pageId) = 0; - virtual void refreshContainer() = 0; - virtual bool requestClose() = 0; -}; diff --git a/application/pages/BasePageProvider.h b/application/pages/BasePageProvider.h deleted file mode 100644 index 7bfaaf3b..00000000 --- a/application/pages/BasePageProvider.h +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "pages/BasePage.h" -#include -#include - -class BasePageProvider -{ -public: - virtual QList getPages() = 0; - virtual QString dialogTitle() = 0; -}; - -class GenericPageProvider : public BasePageProvider -{ - typedef std::function PageCreator; -public: - explicit GenericPageProvider(const QString &dialogTitle) - : m_dialogTitle(dialogTitle) - { - } - virtual ~GenericPageProvider() {} - - QList getPages() override - { - QList pages; - for (PageCreator creator : m_creators) - { - pages.append(creator()); - } - return pages; - } - QString dialogTitle() override { return m_dialogTitle; } - - void setDialogTitle(const QString &title) - { - m_dialogTitle = title; - } - void addPageCreator(PageCreator page) - { - m_creators.append(page); - } - - template - void addPage() - { - addPageCreator([](){return new PageClass();}); - } - -private: - QList m_creators; - QString m_dialogTitle; -}; diff --git a/application/pages/global/AccountListPage.cpp b/application/pages/global/AccountListPage.cpp deleted file mode 100644 index ff3736ed..00000000 --- a/application/pages/global/AccountListPage.cpp +++ /dev/null @@ -1,217 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "AccountListPage.h" -#include "ui_AccountListPage.h" - -#include -#include - -#include - -#include "net/NetJob.h" -#include "Env.h" - -#include "dialogs/ProgressDialog.h" -#include "dialogs/LoginDialog.h" -#include "dialogs/CustomMessageBox.h" -#include "dialogs/SkinUploadDialog.h" -#include "tasks/Task.h" -#include "minecraft/auth/YggdrasilTask.h" -#include "minecraft/services/SkinDelete.h" - -#include "MultiMC.h" - -#include "BuildConfig.h" - -AccountListPage::AccountListPage(QWidget *parent) - : QMainWindow(parent), ui(new Ui::AccountListPage) -{ - ui->setupUi(this); - ui->listView->setEmptyString(tr( - "Welcome!\n" - "If you're new here, you can click the \"Add\" button to add your Mojang or Minecraft account." - )); - ui->listView->setEmptyMode(VersionListView::String); - ui->listView->setContextMenuPolicy(Qt::CustomContextMenu); - - m_accounts = MMC->accounts(); - - ui->listView->setModel(m_accounts.get()); - ui->listView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); - ui->listView->setSelectionMode(QAbstractItemView::SingleSelection); - - // Expand the account column - ui->listView->header()->setSectionResizeMode(1, QHeaderView::Stretch); - - QItemSelectionModel *selectionModel = ui->listView->selectionModel(); - - connect(selectionModel, &QItemSelectionModel::selectionChanged, [this](const QItemSelection &sel, const QItemSelection &dsel) { - updateButtonStates(); - }); - connect(ui->listView, &VersionListView::customContextMenuRequested, this, &AccountListPage::ShowContextMenu); - - connect(m_accounts.get(), SIGNAL(listChanged()), SLOT(listChanged())); - connect(m_accounts.get(), SIGNAL(activeAccountChanged()), SLOT(listChanged())); - - updateButtonStates(); -} - -AccountListPage::~AccountListPage() -{ - delete ui; -} - -void AccountListPage::ShowContextMenu(const QPoint& pos) -{ - auto menu = ui->toolBar->createContextMenu(this, tr("Context menu")); - menu->exec(ui->listView->mapToGlobal(pos)); - delete menu; -} - -void AccountListPage::changeEvent(QEvent* event) -{ - if (event->type() == QEvent::LanguageChange) - { - ui->retranslateUi(this); - } - QMainWindow::changeEvent(event); -} - -QMenu * AccountListPage::createPopupMenu() -{ - QMenu* filteredMenu = QMainWindow::createPopupMenu(); - filteredMenu->removeAction(ui->toolBar->toggleViewAction() ); - return filteredMenu; -} - - -void AccountListPage::listChanged() -{ - updateButtonStates(); -} - -void AccountListPage::on_actionAdd_triggered() -{ - addAccount(tr("Please enter your Minecraft account email and password to add your account.")); -} - -void AccountListPage::on_actionRemove_triggered() -{ - QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes(); - if (selection.size() > 0) - { - QModelIndex selected = selection.first(); - m_accounts->removeAccount(selected); - } -} - -void AccountListPage::on_actionSetDefault_triggered() -{ - QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes(); - if (selection.size() > 0) - { - QModelIndex selected = selection.first(); - MojangAccountPtr account = - selected.data(MojangAccountList::PointerRole).value(); - m_accounts->setActiveAccount(account->username()); - } -} - -void AccountListPage::on_actionNoDefault_triggered() -{ - m_accounts->setActiveAccount(""); -} - -void AccountListPage::updateButtonStates() -{ - // If there is no selection, disable buttons that require something selected. - QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes(); - - ui->actionRemove->setEnabled(selection.size() > 0); - ui->actionSetDefault->setEnabled(selection.size() > 0); - ui->actionUploadSkin->setEnabled(selection.size() > 0); - ui->actionDeleteSkin->setEnabled(selection.size() > 0); - - if(m_accounts->activeAccount().get() == nullptr) { - ui->actionNoDefault->setEnabled(false); - ui->actionNoDefault->setChecked(true); - } - else { - ui->actionNoDefault->setEnabled(true); - ui->actionNoDefault->setChecked(false); - } - -} - -void AccountListPage::addAccount(const QString &errMsg) -{ - // TODO: The login dialog isn't quite done yet - MojangAccountPtr account = LoginDialog::newAccount(this, errMsg); - - if (account != nullptr) - { - m_accounts->addAccount(account); - if (m_accounts->count() == 1) - m_accounts->setActiveAccount(account->username()); - - // Grab associated player skins - auto job = new NetJob("Player skins: " + account->username()); - - for (AccountProfile profile : account->profiles()) - { - auto meta = Env::getInstance().metacache()->resolveEntry("skins", profile.id + ".png"); - auto action = Net::Download::makeCached(QUrl(BuildConfig.SKINS_BASE + profile.id + ".png"), meta); - job->addNetAction(action); - meta->setStale(true); - } - - job->start(); - } -} - -void AccountListPage::on_actionUploadSkin_triggered() -{ - QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes(); - if (selection.size() > 0) - { - QModelIndex selected = selection.first(); - MojangAccountPtr account = selected.data(MojangAccountList::PointerRole).value(); - SkinUploadDialog dialog(account, this); - dialog.exec(); - } -} - -void AccountListPage::on_actionDeleteSkin_triggered() -{ - QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes(); - if (selection.size() <= 0) - return; - - QModelIndex selected = selection.first(); - AuthSessionPtr session = std::make_shared(); - MojangAccountPtr account = selected.data(MojangAccountList::PointerRole).value(); - auto login = account->login(session); - ProgressDialog prog(this); - if (prog.execWithTask((Task*)login.get()) != QDialog::Accepted) { - CustomMessageBox::selectable(this, tr("Skin Delete"), tr("Failed to login!"), QMessageBox::Warning)->exec(); - return; - } - auto deleteSkinTask = std::make_shared(this, session); - if (prog.execWithTask((Task*)deleteSkinTask.get()) != QDialog::Accepted) { - CustomMessageBox::selectable(this, tr("Skin Delete"), tr("Failed to delete current skin!"), QMessageBox::Warning)->exec(); - return; - } -} diff --git a/application/pages/global/AccountListPage.h b/application/pages/global/AccountListPage.h deleted file mode 100644 index fba1833f..00000000 --- a/application/pages/global/AccountListPage.h +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#include "pages/BasePage.h" - -#include "minecraft/auth/MojangAccountList.h" -#include "MultiMC.h" - -namespace Ui -{ -class AccountListPage; -} - -class AuthenticateTask; - -class AccountListPage : public QMainWindow, public BasePage -{ - Q_OBJECT -public: - explicit AccountListPage(QWidget *parent = 0); - ~AccountListPage(); - - QString displayName() const override - { - return tr("Accounts"); - } - QIcon icon() const override - { - auto icon = MMC->getThemedIcon("accounts"); - if(icon.isNull()) - { - icon = MMC->getThemedIcon("noaccount"); - } - return icon; - } - QString id() const override - { - return "accounts"; - } - QString helpPage() const override - { - return "Getting-Started#adding-an-account"; - } - -public slots: - void on_actionAdd_triggered(); - void on_actionRemove_triggered(); - void on_actionSetDefault_triggered(); - void on_actionNoDefault_triggered(); - void on_actionUploadSkin_triggered(); - void on_actionDeleteSkin_triggered(); - - void listChanged(); - - //! Updates the states of the dialog's buttons. - void updateButtonStates(); - -protected slots: - void ShowContextMenu(const QPoint &pos); - void addAccount(const QString& errMsg=""); - -private: - void changeEvent(QEvent * event) override; - QMenu * createPopupMenu() override; - std::shared_ptr m_accounts; - Ui::AccountListPage *ui; -}; diff --git a/application/pages/global/AccountListPage.ui b/application/pages/global/AccountListPage.ui deleted file mode 100644 index 71647db3..00000000 --- a/application/pages/global/AccountListPage.ui +++ /dev/null @@ -1,98 +0,0 @@ - - - AccountListPage - - - - 0 - 0 - 800 - 600 - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - - RightToolBarArea - - - false - - - - - - - - - - - - Add - - - - - Remove - - - - - Set Default - - - - - true - - - No Default - - - - - Upload Skin - - - - - Delete Skin - - - Delete the currently active skin and go back to the default one - - - - - - VersionListView - QTreeView -
widgets/VersionListView.h
-
- - WideBar - QToolBar -
widgets/WideBar.h
-
-
- - -
diff --git a/application/pages/global/CustomCommandsPage.cpp b/application/pages/global/CustomCommandsPage.cpp deleted file mode 100644 index 3b182319..00000000 --- a/application/pages/global/CustomCommandsPage.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include "CustomCommandsPage.h" -#include -#include -#include - -CustomCommandsPage::CustomCommandsPage(QWidget* parent): QWidget(parent) -{ - - auto verticalLayout = new QVBoxLayout(this); - verticalLayout->setObjectName(QStringLiteral("verticalLayout")); - verticalLayout->setContentsMargins(0, 0, 0, 0); - - auto tabWidget = new QTabWidget(this); - tabWidget->setObjectName(QStringLiteral("tabWidget")); - commands = new CustomCommands(this); - commands->setContentsMargins(6, 6, 6, 6); - tabWidget->addTab(commands, "Foo"); - tabWidget->tabBar()->hide(); - verticalLayout->addWidget(tabWidget); - loadSettings(); -} - -CustomCommandsPage::~CustomCommandsPage() -{ -} - -bool CustomCommandsPage::apply() -{ - applySettings(); - return true; -} - -void CustomCommandsPage::applySettings() -{ - auto s = MMC->settings(); - s->set("PreLaunchCommand", commands->prelaunchCommand()); - s->set("WrapperCommand", commands->wrapperCommand()); - s->set("PostExitCommand", commands->postexitCommand()); -} - -void CustomCommandsPage::loadSettings() -{ - auto s = MMC->settings(); - commands->initialize( - false, - true, - s->get("PreLaunchCommand").toString(), - s->get("WrapperCommand").toString(), - s->get("PostExitCommand").toString() - ); -} diff --git a/application/pages/global/CustomCommandsPage.h b/application/pages/global/CustomCommandsPage.h deleted file mode 100644 index 414c3259..00000000 --- a/application/pages/global/CustomCommandsPage.h +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright 2018-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#include "pages/BasePage.h" -#include -#include "widgets/CustomCommands.h" - -class CustomCommandsPage : public QWidget, public BasePage -{ - Q_OBJECT - -public: - explicit CustomCommandsPage(QWidget *parent = 0); - ~CustomCommandsPage(); - - QString displayName() const override - { - return tr("Custom Commands"); - } - QIcon icon() const override - { - return MMC->getThemedIcon("custom-commands"); - } - QString id() const override - { - return "custom-commands"; - } - QString helpPage() const override - { - return "Custom-commands"; - } - bool apply() override; - -private: - void applySettings(); - void loadSettings(); - CustomCommands * commands; -}; diff --git a/application/pages/global/ExternalToolsPage.cpp b/application/pages/global/ExternalToolsPage.cpp deleted file mode 100644 index 6a0a38be..00000000 --- a/application/pages/global/ExternalToolsPage.cpp +++ /dev/null @@ -1,233 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "ExternalToolsPage.h" -#include "ui_ExternalToolsPage.h" - -#include -#include -#include -#include - -#include "settings/SettingsObject.h" -#include "tools/BaseProfiler.h" -#include -#include "MultiMC.h" -#include - -ExternalToolsPage::ExternalToolsPage(QWidget *parent) : - QWidget(parent), - ui(new Ui::ExternalToolsPage) -{ - ui->setupUi(this); - ui->tabWidget->tabBar()->hide(); - - #if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0) - ui->jsonEditorTextBox->setClearButtonEnabled(true); - #endif - - ui->mceditLink->setOpenExternalLinks(true); - ui->jvisualvmLink->setOpenExternalLinks(true); - ui->jprofilerLink->setOpenExternalLinks(true); - loadSettings(); -} - -ExternalToolsPage::~ExternalToolsPage() -{ - delete ui; -} - -void ExternalToolsPage::loadSettings() -{ - auto s = MMC->settings(); - ui->jprofilerPathEdit->setText(s->get("JProfilerPath").toString()); - ui->jvisualvmPathEdit->setText(s->get("JVisualVMPath").toString()); - ui->mceditPathEdit->setText(s->get("MCEditPath").toString()); - - // Editors - ui->jsonEditorTextBox->setText(s->get("JsonEditor").toString()); -} -void ExternalToolsPage::applySettings() -{ - auto s = MMC->settings(); - - s->set("JProfilerPath", ui->jprofilerPathEdit->text()); - s->set("JVisualVMPath", ui->jvisualvmPathEdit->text()); - s->set("MCEditPath", ui->mceditPathEdit->text()); - - // Editors - QString jsonEditor = ui->jsonEditorTextBox->text(); - if (!jsonEditor.isEmpty() && - (!QFileInfo(jsonEditor).exists() || !QFileInfo(jsonEditor).isExecutable())) - { - QString found = QStandardPaths::findExecutable(jsonEditor); - if (!found.isEmpty()) - { - jsonEditor = found; - } - } - s->set("JsonEditor", jsonEditor); -} - -void ExternalToolsPage::on_jprofilerPathBtn_clicked() -{ - QString raw_dir = ui->jprofilerPathEdit->text(); - QString error; - do - { - raw_dir = QFileDialog::getExistingDirectory(this, tr("JProfiler Folder"), raw_dir); - if (raw_dir.isEmpty()) - { - break; - } - QString cooked_dir = FS::NormalizePath(raw_dir); - if (!MMC->profilers()["jprofiler"]->check(cooked_dir, &error)) - { - QMessageBox::critical(this, tr("Error"), tr("Error while checking JProfiler install:\n%1").arg(error)); - continue; - } - else - { - ui->jprofilerPathEdit->setText(cooked_dir); - break; - } - } while (1); -} -void ExternalToolsPage::on_jprofilerCheckBtn_clicked() -{ - QString error; - if (!MMC->profilers()["jprofiler"]->check(ui->jprofilerPathEdit->text(), &error)) - { - QMessageBox::critical(this, tr("Error"), tr("Error while checking JProfiler install:\n%1").arg(error)); - } - else - { - QMessageBox::information(this, tr("OK"), tr("JProfiler setup seems to be OK")); - } -} - -void ExternalToolsPage::on_jvisualvmPathBtn_clicked() -{ - QString raw_dir = ui->jvisualvmPathEdit->text(); - QString error; - do - { - raw_dir = QFileDialog::getOpenFileName(this, tr("JVisualVM Executable"), raw_dir); - if (raw_dir.isEmpty()) - { - break; - } - QString cooked_dir = FS::NormalizePath(raw_dir); - if (!MMC->profilers()["jvisualvm"]->check(cooked_dir, &error)) - { - QMessageBox::critical(this, tr("Error"), tr("Error while checking JVisualVM install:\n%1").arg(error)); - continue; - } - else - { - ui->jvisualvmPathEdit->setText(cooked_dir); - break; - } - } while (1); -} -void ExternalToolsPage::on_jvisualvmCheckBtn_clicked() -{ - QString error; - if (!MMC->profilers()["jvisualvm"]->check(ui->jvisualvmPathEdit->text(), &error)) - { - QMessageBox::critical(this, tr("Error"), tr("Error while checking JVisualVM install:\n%1").arg(error)); - } - else - { - QMessageBox::information(this, tr("OK"), tr("JVisualVM setup seems to be OK")); - } -} - -void ExternalToolsPage::on_mceditPathBtn_clicked() -{ - QString raw_dir = ui->mceditPathEdit->text(); - QString error; - do - { -#ifdef Q_OS_OSX - raw_dir = QFileDialog::getOpenFileName(this, tr("MCEdit Application"), raw_dir); -#else - raw_dir = QFileDialog::getExistingDirectory(this, tr("MCEdit Folder"), raw_dir); -#endif - if (raw_dir.isEmpty()) - { - break; - } - QString cooked_dir = FS::NormalizePath(raw_dir); - if (!MMC->mcedit()->check(cooked_dir, error)) - { - QMessageBox::critical(this, tr("Error"), tr("Error while checking MCEdit install:\n%1").arg(error)); - continue; - } - else - { - ui->mceditPathEdit->setText(cooked_dir); - break; - } - } while (1); -} -void ExternalToolsPage::on_mceditCheckBtn_clicked() -{ - QString error; - if (!MMC->mcedit()->check(ui->mceditPathEdit->text(), error)) - { - QMessageBox::critical(this, tr("Error"), tr("Error while checking MCEdit install:\n%1").arg(error)); - } - else - { - QMessageBox::information(this, tr("OK"), tr("MCEdit setup seems to be OK")); - } -} - -void ExternalToolsPage::on_jsonEditorBrowseBtn_clicked() -{ - QString raw_file = QFileDialog::getOpenFileName( - this, tr("JSON Editor"), - ui->jsonEditorTextBox->text().isEmpty() -#if defined(Q_OS_LINUX) - ? QString("/usr/bin") -#else - ? QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation).first() -#endif - : ui->jsonEditorTextBox->text()); - - if (raw_file.isEmpty()) - { - return; - } - QString cooked_file = FS::NormalizePath(raw_file); - - // it has to exist and be an executable - if (QFileInfo(cooked_file).exists() && QFileInfo(cooked_file).isExecutable()) - { - ui->jsonEditorTextBox->setText(cooked_file); - } - else - { - QMessageBox::warning(this, tr("Invalid"), - tr("The file chosen does not seem to be an executable")); - } -} - -bool ExternalToolsPage::apply() -{ - applySettings(); - return true; -} diff --git a/application/pages/global/ExternalToolsPage.h b/application/pages/global/ExternalToolsPage.h deleted file mode 100644 index 0fc8ebe1..00000000 --- a/application/pages/global/ExternalToolsPage.h +++ /dev/null @@ -1,74 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include "pages/BasePage.h" -#include - -namespace Ui { -class ExternalToolsPage; -} - -class ExternalToolsPage : public QWidget, public BasePage -{ - Q_OBJECT - -public: - explicit ExternalToolsPage(QWidget *parent = 0); - ~ExternalToolsPage(); - - QString displayName() const override - { - return tr("External Tools"); - } - QIcon icon() const override - { - auto icon = MMC->getThemedIcon("externaltools"); - if(icon.isNull()) - { - icon = MMC->getThemedIcon("loadermods"); - } - return icon; - } - QString id() const override - { - return "external-tools"; - } - QString helpPage() const override - { - return "Tools"; - } - virtual bool apply() override; - -private: - void loadSettings(); - void applySettings(); - -private: - Ui::ExternalToolsPage *ui; - -private -slots: - void on_jprofilerPathBtn_clicked(); - void on_jprofilerCheckBtn_clicked(); - void on_jvisualvmPathBtn_clicked(); - void on_jvisualvmCheckBtn_clicked(); - void on_mceditPathBtn_clicked(); - void on_mceditCheckBtn_clicked(); - void on_jsonEditorBrowseBtn_clicked(); -}; diff --git a/application/pages/global/ExternalToolsPage.ui b/application/pages/global/ExternalToolsPage.ui deleted file mode 100644 index e79e9388..00000000 --- a/application/pages/global/ExternalToolsPage.ui +++ /dev/null @@ -1,194 +0,0 @@ - - - ExternalToolsPage - - - - 0 - 0 - 673 - 751 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 0 - - - - Tab 1 - - - - - - JProfiler - - - - - - - - - - - ... - - - - - - - - - Check - - - - - - - <html><head/><body><p><a href="https://www.ej-technologies.com/products/jprofiler/overview.html">https://www.ej-technologies.com/products/jprofiler/overview.html</a></p></body></html> - - - - - - - - - - JVisualVM - - - - - - - - - - - ... - - - - - - - - - Check - - - - - - - <html><head/><body><p><a href="https://visualvm.github.io/">https://visualvm.github.io/</a></p></body></html> - - - - - - - - - - MCEdit - - - - - - - - - - - ... - - - - - - - - - Check - - - - - - - <html><head/><body><p><a href="https://www.mcedit.net/">https://www.mcedit.net/</a></p></body></html> - - - - - - - - - - External Editors (leave empty for system default) - - - - - - - - - Text Editor: - - - - - - - ... - - - - - - - - - - Qt::Vertical - - - - 20 - 216 - - - - - - - - - - - - - diff --git a/application/pages/global/JavaPage.cpp b/application/pages/global/JavaPage.cpp deleted file mode 100644 index cde0e035..00000000 --- a/application/pages/global/JavaPage.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "JavaPage.h" -#include "JavaCommon.h" -#include "ui_JavaPage.h" - -#include -#include -#include -#include - -#include "dialogs/VersionSelectDialog.h" - -#include "java/JavaUtils.h" -#include "java/JavaInstallList.h" - -#include "settings/SettingsObject.h" -#include -#include "MultiMC.h" -#include - -JavaPage::JavaPage(QWidget *parent) : QWidget(parent), ui(new Ui::JavaPage) -{ - ui->setupUi(this); - ui->tabWidget->tabBar()->hide(); - - auto sysMiB = Sys::getSystemRam() / Sys::mebibyte; - ui->maxMemSpinBox->setMaximum(sysMiB); - loadSettings(); -} - -JavaPage::~JavaPage() -{ - delete ui; -} - -bool JavaPage::apply() -{ - applySettings(); - return true; -} - -void JavaPage::applySettings() -{ - auto s = MMC->settings(); - - // Memory - int min = ui->minMemSpinBox->value(); - int max = ui->maxMemSpinBox->value(); - if(min < max) - { - s->set("MinMemAlloc", min); - s->set("MaxMemAlloc", max); - } - else - { - s->set("MinMemAlloc", max); - s->set("MaxMemAlloc", min); - } - s->set("PermGen", ui->permGenSpinBox->value()); - - // Java Settings - s->set("JavaPath", ui->javaPathTextBox->text()); - s->set("JvmArgs", ui->jvmArgsTextBox->text()); - JavaCommon::checkJVMArgs(s->get("JvmArgs").toString(), this->parentWidget()); -} -void JavaPage::loadSettings() -{ - auto s = MMC->settings(); - // Memory - int min = s->get("MinMemAlloc").toInt(); - int max = s->get("MaxMemAlloc").toInt(); - if(min < max) - { - ui->minMemSpinBox->setValue(min); - ui->maxMemSpinBox->setValue(max); - } - else - { - ui->minMemSpinBox->setValue(max); - ui->maxMemSpinBox->setValue(min); - } - ui->permGenSpinBox->setValue(s->get("PermGen").toInt()); - - // Java Settings - ui->javaPathTextBox->setText(s->get("JavaPath").toString()); - ui->jvmArgsTextBox->setText(s->get("JvmArgs").toString()); -} - -void JavaPage::on_javaDetectBtn_clicked() -{ - JavaInstallPtr java; - - VersionSelectDialog vselect(MMC->javalist().get(), tr("Select a Java version"), this, true); - vselect.setResizeOn(2); - vselect.exec(); - - if (vselect.result() == QDialog::Accepted && vselect.selectedVersion()) - { - java = std::dynamic_pointer_cast(vselect.selectedVersion()); - ui->javaPathTextBox->setText(java->path); - } -} - -void JavaPage::on_javaBrowseBtn_clicked() -{ - QString raw_path = QFileDialog::getOpenFileName(this, tr("Find Java executable")); - - // do not allow current dir - it's dirty. Do not allow dirs that don't exist - if(raw_path.isEmpty()) - { - return; - } - - QString cooked_path = FS::NormalizePath(raw_path); - QFileInfo javaInfo(cooked_path);; - if(!javaInfo.exists() || !javaInfo.isExecutable()) - { - return; - } - ui->javaPathTextBox->setText(cooked_path); -} - -void JavaPage::on_javaTestBtn_clicked() -{ - if(checker) - { - return; - } - checker.reset(new JavaCommon::TestCheck( - this, ui->javaPathTextBox->text(), ui->jvmArgsTextBox->text(), - ui->minMemSpinBox->value(), ui->maxMemSpinBox->value(), ui->permGenSpinBox->value())); - connect(checker.get(), SIGNAL(finished()), SLOT(checkerFinished())); - checker->run(); -} - -void JavaPage::checkerFinished() -{ - checker.reset(); -} diff --git a/application/pages/global/JavaPage.h b/application/pages/global/JavaPage.h deleted file mode 100644 index 832f460b..00000000 --- a/application/pages/global/JavaPage.h +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include "pages/BasePage.h" -#include "JavaCommon.h" -#include -#include - -class SettingsObject; - -namespace Ui -{ -class JavaPage; -} - -class JavaPage : public QWidget, public BasePage -{ - Q_OBJECT - -public: - explicit JavaPage(QWidget *parent = 0); - ~JavaPage(); - - QString displayName() const override - { - return tr("Java"); - } - QIcon icon() const override - { - return MMC->getThemedIcon("java"); - } - QString id() const override - { - return "java-settings"; - } - QString helpPage() const override - { - return "Java-settings"; - } - bool apply() override; - -private: - void applySettings(); - void loadSettings(); - -private -slots: - void on_javaDetectBtn_clicked(); - void on_javaTestBtn_clicked(); - void on_javaBrowseBtn_clicked(); - void checkerFinished(); - -private: - Ui::JavaPage *ui; - unique_qobject_ptr checker; -}; diff --git a/application/pages/global/JavaPage.ui b/application/pages/global/JavaPage.ui deleted file mode 100644 index b67e9994..00000000 --- a/application/pages/global/JavaPage.ui +++ /dev/null @@ -1,260 +0,0 @@ - - - JavaPage - - - - 0 - 0 - 545 - 580 - - - - - 0 - 0 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 0 - - - - Tab 1 - - - - - - Memory - - - - - - The maximum amount of memory Minecraft is allowed to use. - - - MiB - - - 128 - - - 65536 - - - 128 - - - 1024 - - - - - - - Minimum memory allocation: - - - - - - - Maximum memory allocation: - - - - - - - The amount of memory Minecraft is started with. - - - MiB - - - 128 - - - 65536 - - - 128 - - - 256 - - - - - - - PermGen: - - - - - - - The amount of memory available to store loaded Java classes. - - - MiB - - - 64 - - - 999999999 - - - 8 - - - 64 - - - - - - - - - - Java Runtime - - - - - - - 0 - 0 - - - - Java path: - - - - - - - - - - - - - 0 - 0 - - - - - 28 - 16777215 - - - - ... - - - - - - - - - - - - - 0 - 0 - - - - JVM arguments: - - - - - - - - 0 - 0 - - - - Auto-detect... - - - - - - - - 0 - 0 - - - - Test - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - minMemSpinBox - maxMemSpinBox - permGenSpinBox - javaBrowseBtn - javaPathTextBox - jvmArgsTextBox - javaDetectBtn - javaTestBtn - tabWidget - - - - diff --git a/application/pages/global/LanguagePage.cpp b/application/pages/global/LanguagePage.cpp deleted file mode 100644 index ae3168cc..00000000 --- a/application/pages/global/LanguagePage.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include "LanguagePage.h" - -#include "widgets/LanguageSelectionWidget.h" -#include - -LanguagePage::LanguagePage(QWidget* parent) : - QWidget(parent) -{ - setObjectName(QStringLiteral("languagePage")); - auto layout = new QVBoxLayout(this); - mainWidget = new LanguageSelectionWidget(this); - layout->setContentsMargins(0,0,0,0); - layout->addWidget(mainWidget); - retranslate(); -} - -LanguagePage::~LanguagePage() -{ -} - -bool LanguagePage::apply() -{ - applySettings(); - return true; -} - -void LanguagePage::applySettings() -{ - auto settings = MMC->settings(); - QString key = mainWidget->getSelectedLanguageKey(); - settings->set("Language", key); -} - -void LanguagePage::loadSettings() -{ - // NIL -} - -void LanguagePage::retranslate() -{ - mainWidget->retranslate(); -} - -void LanguagePage::changeEvent(QEvent* event) -{ - if (event->type() == QEvent::LanguageChange) - { - retranslate(); - } - QWidget::changeEvent(event); -} diff --git a/application/pages/global/LanguagePage.h b/application/pages/global/LanguagePage.h deleted file mode 100644 index ca8eecc6..00000000 --- a/application/pages/global/LanguagePage.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include "pages/BasePage.h" -#include -#include - -class LanguageSelectionWidget; - -class LanguagePage : public QWidget, public BasePage -{ - Q_OBJECT - -public: - explicit LanguagePage(QWidget *parent = 0); - virtual ~LanguagePage(); - - QString displayName() const override - { - return tr("Language"); - } - QIcon icon() const override - { - return MMC->getThemedIcon("language"); - } - QString id() const override - { - return "language-settings"; - } - QString helpPage() const override - { - return "Language-settings"; - } - bool apply() override; - - void changeEvent(QEvent * ) override; - -private: - void applySettings(); - void loadSettings(); - void retranslate(); - -private: - LanguageSelectionWidget *mainWidget; -}; diff --git a/application/pages/global/MinecraftPage.cpp b/application/pages/global/MinecraftPage.cpp deleted file mode 100644 index 6c9bd307..00000000 --- a/application/pages/global/MinecraftPage.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "MinecraftPage.h" -#include "ui_MinecraftPage.h" - -#include -#include -#include - -#include "settings/SettingsObject.h" -#include "MultiMC.h" - -MinecraftPage::MinecraftPage(QWidget *parent) : QWidget(parent), ui(new Ui::MinecraftPage) -{ - ui->setupUi(this); - ui->tabWidget->tabBar()->hide(); - loadSettings(); - updateCheckboxStuff(); -} - -MinecraftPage::~MinecraftPage() -{ - delete ui; -} - -bool MinecraftPage::apply() -{ - applySettings(); - return true; -} - -void MinecraftPage::updateCheckboxStuff() -{ - ui->windowWidthSpinBox->setEnabled(!ui->maximizedCheckBox->isChecked()); - ui->windowHeightSpinBox->setEnabled(!ui->maximizedCheckBox->isChecked()); -} - -void MinecraftPage::on_maximizedCheckBox_clicked(bool checked) -{ - Q_UNUSED(checked); - updateCheckboxStuff(); -} - - -void MinecraftPage::applySettings() -{ - auto s = MMC->settings(); - - // Window Size - s->set("LaunchMaximized", ui->maximizedCheckBox->isChecked()); - s->set("MinecraftWinWidth", ui->windowWidthSpinBox->value()); - s->set("MinecraftWinHeight", ui->windowHeightSpinBox->value()); - - // Native library workarounds - s->set("UseNativeOpenAL", ui->useNativeOpenALCheck->isChecked()); - s->set("UseNativeGLFW", ui->useNativeGLFWCheck->isChecked()); - - // Game time - s->set("ShowGameTime", ui->showGameTime->isChecked()); - s->set("RecordGameTime", ui->recordGameTime->isChecked()); -} - -void MinecraftPage::loadSettings() -{ - auto s = MMC->settings(); - - // Window Size - ui->maximizedCheckBox->setChecked(s->get("LaunchMaximized").toBool()); - ui->windowWidthSpinBox->setValue(s->get("MinecraftWinWidth").toInt()); - ui->windowHeightSpinBox->setValue(s->get("MinecraftWinHeight").toInt()); - - ui->useNativeOpenALCheck->setChecked(s->get("UseNativeOpenAL").toBool()); - ui->useNativeGLFWCheck->setChecked(s->get("UseNativeGLFW").toBool()); - - ui->showGameTime->setChecked(s->get("ShowGameTime").toBool()); - ui->recordGameTime->setChecked(s->get("RecordGameTime").toBool()); -} diff --git a/application/pages/global/MinecraftPage.h b/application/pages/global/MinecraftPage.h deleted file mode 100644 index 5e781aed..00000000 --- a/application/pages/global/MinecraftPage.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#include "java/JavaChecker.h" -#include "pages/BasePage.h" -#include - -class SettingsObject; - -namespace Ui -{ -class MinecraftPage; -} - -class MinecraftPage : public QWidget, public BasePage -{ - Q_OBJECT - -public: - explicit MinecraftPage(QWidget *parent = 0); - ~MinecraftPage(); - - QString displayName() const override - { - return tr("Minecraft"); - } - QIcon icon() const override - { - return MMC->getThemedIcon("minecraft"); - } - QString id() const override - { - return "minecraft-settings"; - } - QString helpPage() const override - { - return "Minecraft-settings"; - } - bool apply() override; - -private: - void updateCheckboxStuff(); - void applySettings(); - void loadSettings(); - -private -slots: - void on_maximizedCheckBox_clicked(bool checked); - -private: - Ui::MinecraftPage *ui; - -}; diff --git a/application/pages/global/MinecraftPage.ui b/application/pages/global/MinecraftPage.ui deleted file mode 100644 index 2abd4bd4..00000000 --- a/application/pages/global/MinecraftPage.ui +++ /dev/null @@ -1,189 +0,0 @@ - - - MinecraftPage - - - - 0 - 0 - 936 - 1134 - - - - - 0 - 0 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - QTabWidget::Rounded - - - 0 - - - - Minecraft - - - - - - Window Size - - - - - - Start Minecraft maximized? - - - - - - - - - Window hei&ght: - - - windowHeightSpinBox - - - - - - - W&indow width: - - - windowWidthSpinBox - - - - - - - 1 - - - 65536 - - - 1 - - - 854 - - - - - - - 1 - - - 65536 - - - 480 - - - - - - - - - - - - Native library workarounds - - - - - - Use system installation of GLFW - - - - - - - Use system installation of OpenAL - - - - - - - - - - Game time - - - - - - Show time spent playing instances - - - - - - - Record time spent playing instances - - - - - - - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - - - - - tabWidget - maximizedCheckBox - windowWidthSpinBox - windowHeightSpinBox - useNativeGLFWCheck - useNativeOpenALCheck - - - - diff --git a/application/pages/global/MultiMCPage.cpp b/application/pages/global/MultiMCPage.cpp deleted file mode 100644 index d383e6ed..00000000 --- a/application/pages/global/MultiMCPage.cpp +++ /dev/null @@ -1,467 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "MultiMCPage.h" -#include "ui_MultiMCPage.h" - -#include -#include -#include -#include - -#include "updater/UpdateChecker.h" - -#include "settings/SettingsObject.h" -#include -#include "MultiMC.h" -#include "BuildConfig.h" -#include "themes/ITheme.h" - -#include -#include - -// FIXME: possibly move elsewhere -enum InstSortMode -{ - // Sort alphabetically by name. - Sort_Name, - // Sort by which instance was launched most recently. - Sort_LastLaunch -}; - -MultiMCPage::MultiMCPage(QWidget *parent) : QWidget(parent), ui(new Ui::MultiMCPage) -{ - ui->setupUi(this); - auto origForeground = ui->fontPreview->palette().color(ui->fontPreview->foregroundRole()); - auto origBackground = ui->fontPreview->palette().color(ui->fontPreview->backgroundRole()); - m_colors.reset(new LogColorCache(origForeground, origBackground)); - - ui->sortingModeGroup->setId(ui->sortByNameBtn, Sort_Name); - ui->sortingModeGroup->setId(ui->sortLastLaunchedBtn, Sort_LastLaunch); - - defaultFormat = new QTextCharFormat(ui->fontPreview->currentCharFormat()); - - m_languageModel = MMC->translations(); - loadSettings(); - - if(BuildConfig.UPDATER_ENABLED) - { - QObject::connect(MMC->updateChecker().get(), &UpdateChecker::channelListLoaded, this, - &MultiMCPage::refreshUpdateChannelList); - - if (MMC->updateChecker()->hasChannels()) - { - refreshUpdateChannelList(); - } - else - { - MMC->updateChecker()->updateChanList(false); - } - } - else - { - ui->updateSettingsBox->setHidden(true); - } - // Analytics - if(BuildConfig.ANALYTICS_ID.isEmpty()) - { - ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->analyticsTab)); - } - connect(ui->fontSizeBox, SIGNAL(valueChanged(int)), SLOT(refreshFontPreview())); - connect(ui->consoleFont, SIGNAL(currentFontChanged(QFont)), SLOT(refreshFontPreview())); - - //move mac data button - QFile file(QDir::current().absolutePath() + "/dontmovemacdata"); - if (!file.exists()) - { - ui->migrateDataFolderMacBtn->setVisible(false); - } -} - -MultiMCPage::~MultiMCPage() -{ - delete ui; - delete defaultFormat; -} - -bool MultiMCPage::apply() -{ - applySettings(); - return true; -} - -void MultiMCPage::on_instDirBrowseBtn_clicked() -{ - QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Instance Folder"), ui->instDirTextBox->text()); - - // do not allow current dir - it's dirty. Do not allow dirs that don't exist - if (!raw_dir.isEmpty() && QDir(raw_dir).exists()) - { - QString cooked_dir = FS::NormalizePath(raw_dir); - if (FS::checkProblemticPathJava(QDir(cooked_dir))) - { - QMessageBox warning; - warning.setText(tr("You're trying to specify an instance folder which\'s path " - "contains at least one \'!\'. " - "Java is known to cause problems if that is the case, your " - "instances (probably) won't start!")); - warning.setInformativeText( - tr("Do you really want to use this path? " - "Selecting \"No\" will close this and not alter your instance path.")); - warning.setStandardButtons(QMessageBox::Yes | QMessageBox::No); - int result = warning.exec(); - if (result == QMessageBox::Yes) - { - ui->instDirTextBox->setText(cooked_dir); - } - } - else - { - ui->instDirTextBox->setText(cooked_dir); - } - } -} - -void MultiMCPage::on_iconsDirBrowseBtn_clicked() -{ - QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Icons Folder"), ui->iconsDirTextBox->text()); - - // do not allow current dir - it's dirty. Do not allow dirs that don't exist - if (!raw_dir.isEmpty() && QDir(raw_dir).exists()) - { - QString cooked_dir = FS::NormalizePath(raw_dir); - ui->iconsDirTextBox->setText(cooked_dir); - } -} -void MultiMCPage::on_modsDirBrowseBtn_clicked() -{ - QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Mods Folder"), ui->modsDirTextBox->text()); - - // do not allow current dir - it's dirty. Do not allow dirs that don't exist - if (!raw_dir.isEmpty() && QDir(raw_dir).exists()) - { - QString cooked_dir = FS::NormalizePath(raw_dir); - ui->modsDirTextBox->setText(cooked_dir); - } -} -void MultiMCPage::on_migrateDataFolderMacBtn_clicked() -{ - QFile file(QDir::current().absolutePath() + "/dontmovemacdata"); - file.remove(); - QProcess::startDetached(qApp->arguments()[0]); - qApp->quit(); -} - -void MultiMCPage::refreshUpdateChannelList() -{ - // Stop listening for selection changes. It's going to change a lot while we update it and - // we don't need to update the - // description label constantly. - QObject::disconnect(ui->updateChannelComboBox, SIGNAL(currentIndexChanged(int)), this, - SLOT(updateChannelSelectionChanged(int))); - - QList channelList = MMC->updateChecker()->getChannelList(); - ui->updateChannelComboBox->clear(); - int selection = -1; - for (int i = 0; i < channelList.count(); i++) - { - UpdateChecker::ChannelListEntry entry = channelList.at(i); - - // When it comes to selection, we'll rely on the indexes of a channel entry being the - // same in the - // combo box as it is in the update checker's channel list. - // This probably isn't very safe, but the channel list doesn't change often enough (or - // at all) for - // this to be a big deal. Hope it doesn't break... - ui->updateChannelComboBox->addItem(entry.name); - - // If the update channel we just added was the selected one, set the current index in - // the combo box to it. - if (entry.id == m_currentUpdateChannel) - { - qDebug() << "Selected index" << i << "channel id" << m_currentUpdateChannel; - selection = i; - } - } - - ui->updateChannelComboBox->setCurrentIndex(selection); - - // Start listening for selection changes again and update the description label. - QObject::connect(ui->updateChannelComboBox, SIGNAL(currentIndexChanged(int)), this, - SLOT(updateChannelSelectionChanged(int))); - refreshUpdateChannelDesc(); - - // Now that we've updated the channel list, we can enable the combo box. - // It starts off disabled so that if the channel list hasn't been loaded, it will be - // disabled. - ui->updateChannelComboBox->setEnabled(true); -} - -void MultiMCPage::updateChannelSelectionChanged(int index) -{ - refreshUpdateChannelDesc(); -} - -void MultiMCPage::refreshUpdateChannelDesc() -{ - // Get the channel list. - QList channelList = MMC->updateChecker()->getChannelList(); - int selectedIndex = ui->updateChannelComboBox->currentIndex(); - if (selectedIndex < 0) - { - return; - } - if (selectedIndex < channelList.count()) - { - // Find the channel list entry with the given index. - UpdateChecker::ChannelListEntry selected = channelList.at(selectedIndex); - - // Set the description text. - ui->updateChannelDescLabel->setText(selected.description); - - // Set the currently selected channel ID. - m_currentUpdateChannel = selected.id; - } -} - -void MultiMCPage::applySettings() -{ - auto s = MMC->settings(); - - if (ui->resetNotificationsBtn->isChecked()) - { - s->set("ShownNotifications", QString()); - } - - // Updates - s->set("AutoUpdate", ui->autoUpdateCheckBox->isChecked()); - s->set("UpdateChannel", m_currentUpdateChannel); - auto original = s->get("IconTheme").toString(); - //FIXME: make generic - switch (ui->themeComboBox->currentIndex()) - { - case 1: - s->set("IconTheme", "pe_dark"); - break; - case 2: - s->set("IconTheme", "pe_light"); - break; - case 3: - s->set("IconTheme", "pe_blue"); - break; - case 4: - s->set("IconTheme", "pe_colored"); - break; - case 5: - s->set("IconTheme", "OSX"); - break; - case 6: - s->set("IconTheme", "iOS"); - break; - case 7: - s->set("IconTheme", "flat"); - break; - case 8: - s->set("IconTheme", "custom"); - break; - case 0: - default: - s->set("IconTheme", "multimc"); - break; - } - - if(original != s->get("IconTheme")) - { - MMC->setIconTheme(s->get("IconTheme").toString()); - } - - auto originalAppTheme = s->get("ApplicationTheme").toString(); - auto newAppTheme = ui->themeComboBoxColors->currentData().toString(); - if(originalAppTheme != newAppTheme) - { - s->set("ApplicationTheme", newAppTheme); - MMC->setApplicationTheme(newAppTheme, false); - } - - // Console settings - s->set("ShowConsole", ui->showConsoleCheck->isChecked()); - s->set("AutoCloseConsole", ui->autoCloseConsoleCheck->isChecked()); - s->set("ShowConsoleOnError", ui->showConsoleErrorCheck->isChecked()); - QString consoleFontFamily = ui->consoleFont->currentFont().family(); - s->set("ConsoleFont", consoleFontFamily); - s->set("ConsoleFontSize", ui->fontSizeBox->value()); - s->set("ConsoleMaxLines", ui->lineLimitSpinBox->value()); - s->set("ConsoleOverflowStop", ui->checkStopLogging->checkState() != Qt::Unchecked); - - // Folders - // TODO: Offer to move instances to new instance folder. - s->set("InstanceDir", ui->instDirTextBox->text()); - s->set("CentralModsDir", ui->modsDirTextBox->text()); - s->set("IconsDir", ui->iconsDirTextBox->text()); - - auto sortMode = (InstSortMode)ui->sortingModeGroup->checkedId(); - switch (sortMode) - { - case Sort_LastLaunch: - s->set("InstSortMode", "LastLaunch"); - break; - case Sort_Name: - default: - s->set("InstSortMode", "Name"); - break; - } - - // Analytics - if(!BuildConfig.ANALYTICS_ID.isEmpty()) - { - s->set("Analytics", ui->analyticsCheck->isChecked()); - } -} -void MultiMCPage::loadSettings() -{ - auto s = MMC->settings(); - // Updates - ui->autoUpdateCheckBox->setChecked(s->get("AutoUpdate").toBool()); - m_currentUpdateChannel = s->get("UpdateChannel").toString(); - //FIXME: make generic - auto theme = s->get("IconTheme").toString(); - if (theme == "pe_dark") - { - ui->themeComboBox->setCurrentIndex(1); - } - else if (theme == "pe_light") - { - ui->themeComboBox->setCurrentIndex(2); - } - else if (theme == "pe_blue") - { - ui->themeComboBox->setCurrentIndex(3); - } - else if (theme == "pe_colored") - { - ui->themeComboBox->setCurrentIndex(4); - } - else if (theme == "OSX") - { - ui->themeComboBox->setCurrentIndex(5); - } - else if (theme == "iOS") - { - ui->themeComboBox->setCurrentIndex(6); - } - else if (theme == "flat") - { - ui->themeComboBox->setCurrentIndex(7); - } - else if (theme == "custom") - { - ui->themeComboBox->setCurrentIndex(8); - } - else - { - ui->themeComboBox->setCurrentIndex(0); - } - - { - auto currentTheme = s->get("ApplicationTheme").toString(); - auto themes = MMC->getValidApplicationThemes(); - int idx = 0; - for(auto &theme: themes) - { - ui->themeComboBoxColors->addItem(theme->name(), theme->id()); - if(currentTheme == theme->id()) - { - ui->themeComboBoxColors->setCurrentIndex(idx); - } - idx++; - } - } - - // Console settings - ui->showConsoleCheck->setChecked(s->get("ShowConsole").toBool()); - ui->autoCloseConsoleCheck->setChecked(s->get("AutoCloseConsole").toBool()); - ui->showConsoleErrorCheck->setChecked(s->get("ShowConsoleOnError").toBool()); - QString fontFamily = MMC->settings()->get("ConsoleFont").toString(); - QFont consoleFont(fontFamily); - ui->consoleFont->setCurrentFont(consoleFont); - - bool conversionOk = true; - int fontSize = MMC->settings()->get("ConsoleFontSize").toInt(&conversionOk); - if(!conversionOk) - { - fontSize = 11; - } - ui->fontSizeBox->setValue(fontSize); - refreshFontPreview(); - ui->lineLimitSpinBox->setValue(s->get("ConsoleMaxLines").toInt()); - ui->checkStopLogging->setChecked(s->get("ConsoleOverflowStop").toBool()); - - // Folders - ui->instDirTextBox->setText(s->get("InstanceDir").toString()); - ui->modsDirTextBox->setText(s->get("CentralModsDir").toString()); - ui->iconsDirTextBox->setText(s->get("IconsDir").toString()); - - QString sortMode = s->get("InstSortMode").toString(); - - if (sortMode == "LastLaunch") - { - ui->sortLastLaunchedBtn->setChecked(true); - } - else - { - ui->sortByNameBtn->setChecked(true); - } - - // Analytics - if(!BuildConfig.ANALYTICS_ID.isEmpty()) - { - ui->analyticsCheck->setChecked(s->get("Analytics").toBool()); - } -} - -void MultiMCPage::refreshFontPreview() -{ - int fontSize = ui->fontSizeBox->value(); - QString fontFamily = ui->consoleFont->currentFont().family(); - ui->fontPreview->clear(); - defaultFormat->setFont(QFont(fontFamily, fontSize)); - { - QTextCharFormat format(*defaultFormat); - format.setForeground(m_colors->getFront(MessageLevel::Error)); - // append a paragraph/line - auto workCursor = ui->fontPreview->textCursor(); - workCursor.movePosition(QTextCursor::End); - workCursor.insertText(tr("[Something/ERROR] A spooky error!"), format); - workCursor.insertBlock(); - } - { - QTextCharFormat format(*defaultFormat); - format.setForeground(m_colors->getFront(MessageLevel::Message)); - // append a paragraph/line - auto workCursor = ui->fontPreview->textCursor(); - workCursor.movePosition(QTextCursor::End); - workCursor.insertText(tr("[Test/INFO] A harmless message..."), format); - workCursor.insertBlock(); - } - { - QTextCharFormat format(*defaultFormat); - format.setForeground(m_colors->getFront(MessageLevel::Warning)); - // append a paragraph/line - auto workCursor = ui->fontPreview->textCursor(); - workCursor.movePosition(QTextCursor::End); - workCursor.insertText(tr("[Something/WARN] A not so spooky warning."), format); - workCursor.insertBlock(); - } -} diff --git a/application/pages/global/MultiMCPage.h b/application/pages/global/MultiMCPage.h deleted file mode 100644 index fae75bf2..00000000 --- a/application/pages/global/MultiMCPage.h +++ /dev/null @@ -1,103 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#include "java/JavaChecker.h" -#include "pages/BasePage.h" -#include -#include "ColorCache.h" -#include - -class QTextCharFormat; -class SettingsObject; - -namespace Ui -{ -class MultiMCPage; -} - -class MultiMCPage : public QWidget, public BasePage -{ - Q_OBJECT - -public: - explicit MultiMCPage(QWidget *parent = 0); - ~MultiMCPage(); - - QString displayName() const override - { - return "MultiMC"; - } - QIcon icon() const override - { - return MMC->getThemedIcon("multimc"); - } - QString id() const override - { - return "multimc-settings"; - } - QString helpPage() const override - { - return "MultiMC-settings"; - } - bool apply() override; - -private: - void applySettings(); - void loadSettings(); - -private -slots: - void on_instDirBrowseBtn_clicked(); - void on_modsDirBrowseBtn_clicked(); - void on_iconsDirBrowseBtn_clicked(); - void on_migrateDataFolderMacBtn_clicked(); - - /*! - * Updates the list of update channels in the combo box. - */ - void refreshUpdateChannelList(); - - /*! - * Updates the channel description label. - */ - void refreshUpdateChannelDesc(); - - /*! - * Updates the font preview - */ - void refreshFontPreview(); - - void updateChannelSelectionChanged(int index); - -private: - Ui::MultiMCPage *ui; - - /*! - * Stores the currently selected update channel. - */ - QString m_currentUpdateChannel; - - // default format for the font preview... - QTextCharFormat *defaultFormat; - - std::unique_ptr m_colors; - - std::shared_ptr m_languageModel; -}; diff --git a/application/pages/global/MultiMCPage.ui b/application/pages/global/MultiMCPage.ui deleted file mode 100644 index 4ad20242..00000000 --- a/application/pages/global/MultiMCPage.ui +++ /dev/null @@ -1,584 +0,0 @@ - - - MultiMCPage - - - - 0 - 0 - 514 - 629 - - - - - 0 - 0 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - QTabWidget::Rounded - - - 0 - - - - Features - - - - - - Update Settings - - - - - - Check for updates when MultiMC starts? - - - - - - - Up&date Channel: - - - updateChannelComboBox - - - - - - - false - - - - - - - No channel selected. - - - true - - - - - - - - - - Folders - - - - - - I&nstances: - - - instDirTextBox - - - - - - - - - - ... - - - - - - - &Mods: - - - modsDirTextBox - - - - - - - - - - ... - - - - - - - - - - &Icons: - - - iconsDirTextBox - - - - - - - ... - - - - - - - - - - Move MultiMC data to new location (will restart MultiMC) - - - - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - - User Interface - - - - - - MultiMC notifications - - - - - - Reset hidden notifications - - - true - - - - - - - - - - true - - - Instance view sorting mode - - - - - - By &last launched - - - sortingModeGroup - - - - - - - By &name - - - sortingModeGroup - - - - - - - - - - Theme - - - - - - &Icons - - - themeComboBox - - - - - - - - 0 - 0 - - - - Qt::StrongFocus - - - - Default - - - - - Simple (Dark Icons) - - - - - Simple (Light Icons) - - - - - Simple (Blue Icons) - - - - - Simple (Colored Icons) - - - - - OSX - - - - - iOS - - - - - Flat - - - - - Custom - - - - - - - - - 0 - 0 - - - - Qt::StrongFocus - - - - - - - Colors - - - themeComboBoxColors - - - - - - - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - - Console - - - - - - Console Settings - - - - - - Show console while the game is running? - - - - - - - Automatically close console when the game quits? - - - - - - - Show console when the game crashes? - - - - - - - - - - History limit - - - - - - Stop logging when log overflows - - - - - - - - 0 - 0 - - - - lines - - - 10000 - - - 1000000 - - - 10000 - - - 100000 - - - - - - - - - - - 0 - 0 - - - - Console font - - - - - - - 0 - 0 - - - - Qt::ScrollBarAlwaysOff - - - false - - - Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - 0 - 0 - - - - - - - - 5 - - - 16 - - - 11 - - - - - - - - - - - Analytics - - - - - - Analytics Settings - - - - - - Send anonymous usage statistics? - - - - - - - Qt::Horizontal - - - - - - - <html><head/> -<body> -<p>MultiMC sends anonymous usage statistics on every start of the application.</p><p>The following data is collected:</p> -<ul> -<li>MultiMC version.</li> -<li>Operating system name, version and architecture.</li> -<li>CPU architecture (kernel architecture on linux).</li> -<li>Size of system memory.</li> -<li>Java version, architecture and memory settings.</li> -</ul> -</body></html> - - - true - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - tabWidget - autoUpdateCheckBox - updateChannelComboBox - instDirTextBox - instDirBrowseBtn - modsDirTextBox - modsDirBrowseBtn - iconsDirTextBox - iconsDirBrowseBtn - resetNotificationsBtn - sortLastLaunchedBtn - sortByNameBtn - themeComboBox - themeComboBoxColors - showConsoleCheck - autoCloseConsoleCheck - showConsoleErrorCheck - lineLimitSpinBox - checkStopLogging - consoleFont - fontSizeBox - fontPreview - - - - - - - diff --git a/application/pages/global/PasteEEPage.cpp b/application/pages/global/PasteEEPage.cpp deleted file mode 100644 index f932dede..00000000 --- a/application/pages/global/PasteEEPage.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "PasteEEPage.h" -#include "ui_PasteEEPage.h" - -#include -#include -#include -#include - -#include "settings/SettingsObject.h" -#include "tools/BaseProfiler.h" -#include "MultiMC.h" - -PasteEEPage::PasteEEPage(QWidget *parent) : - QWidget(parent), - ui(new Ui::PasteEEPage) -{ - ui->setupUi(this); - ui->tabWidget->tabBar()->hide();\ - connect(ui->customAPIkeyEdit, &QLineEdit::textEdited, this, &PasteEEPage::textEdited); - loadSettings(); -} - -PasteEEPage::~PasteEEPage() -{ - delete ui; -} - -void PasteEEPage::loadSettings() -{ - auto s = MMC->settings(); - QString keyToUse = s->get("PasteEEAPIKey").toString(); - if(keyToUse == "multimc") - { - ui->multimcButton->setChecked(true); - } - else - { - ui->customButton->setChecked(true); - ui->customAPIkeyEdit->setText(keyToUse); - } -} - -void PasteEEPage::applySettings() -{ - auto s = MMC->settings(); - - QString pasteKeyToUse; - if (ui->customButton->isChecked()) - pasteKeyToUse = ui->customAPIkeyEdit->text(); - else - { - pasteKeyToUse = "multimc"; - } - s->set("PasteEEAPIKey", pasteKeyToUse); -} - -bool PasteEEPage::apply() -{ - applySettings(); - return true; -} - -void PasteEEPage::textEdited(const QString& text) -{ - ui->customButton->setChecked(true); -} diff --git a/application/pages/global/PasteEEPage.h b/application/pages/global/PasteEEPage.h deleted file mode 100644 index 001decdb..00000000 --- a/application/pages/global/PasteEEPage.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include "pages/BasePage.h" -#include - -namespace Ui { -class PasteEEPage; -} - -class PasteEEPage : public QWidget, public BasePage -{ - Q_OBJECT - -public: - explicit PasteEEPage(QWidget *parent = 0); - ~PasteEEPage(); - - QString displayName() const override - { - return tr("Log Upload"); - } - QIcon icon() const override - { - return MMC->getThemedIcon("log"); - } - QString id() const override - { - return "log-upload"; - } - QString helpPage() const override - { - return "Log-Upload"; - } - virtual bool apply() override; - -private: - void loadSettings(); - void applySettings(); - -private slots: - void textEdited(const QString &text); - -private: - Ui::PasteEEPage *ui; -}; diff --git a/application/pages/global/PasteEEPage.ui b/application/pages/global/PasteEEPage.ui deleted file mode 100644 index 10883781..00000000 --- a/application/pages/global/PasteEEPage.ui +++ /dev/null @@ -1,128 +0,0 @@ - - - PasteEEPage - - - - 0 - 0 - 491 - 474 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 0 - - - - Tab 1 - - - - - - paste.ee API key - - - - - - MultiMC key - 12MB &upload limit - - - pasteButtonGroup - - - - - - - &Your own key - 12MB upload limit: - - - pasteButtonGroup - - - - - - - QLineEdit::Password - - - Paste your API key here! - - - - - - - Qt::Horizontal - - - - - - - <html><head/><body><p><a href="https://paste.ee">paste.ee</a> is used by MultiMC for log uploads. If you have a <a href="https://paste.ee">paste.ee</a> account, you can add your API key here and have your uploaded logs paired with your account.</p></body></html> - - - Qt::RichText - - - true - - - true - - - - - - - - - - Qt::Vertical - - - - 20 - 216 - - - - - - - - - - - - tabWidget - multimcButton - customButton - customAPIkeyEdit - - - - - - - diff --git a/application/pages/global/ProxyPage.cpp b/application/pages/global/ProxyPage.cpp deleted file mode 100644 index 809059ff..00000000 --- a/application/pages/global/ProxyPage.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "ProxyPage.h" -#include "ui_ProxyPage.h" - -#include - -#include "settings/SettingsObject.h" -#include "MultiMC.h" -#include "Env.h" - -ProxyPage::ProxyPage(QWidget *parent) : QWidget(parent), ui(new Ui::ProxyPage) -{ - ui->setupUi(this); - ui->tabWidget->tabBar()->hide(); - loadSettings(); - updateCheckboxStuff(); - - connect(ui->proxyGroup, SIGNAL(buttonClicked(int)), SLOT(proxyChanged(int))); -} - -ProxyPage::~ProxyPage() -{ - delete ui; -} - -bool ProxyPage::apply() -{ - applySettings(); - return true; -} - -void ProxyPage::updateCheckboxStuff() -{ - ui->proxyAddrBox->setEnabled(!ui->proxyNoneBtn->isChecked() && - !ui->proxyDefaultBtn->isChecked()); - ui->proxyAuthBox->setEnabled(!ui->proxyNoneBtn->isChecked() && - !ui->proxyDefaultBtn->isChecked()); -} - -void ProxyPage::proxyChanged(int) -{ - updateCheckboxStuff(); -} - -void ProxyPage::applySettings() -{ - auto s = MMC->settings(); - - // Proxy - QString proxyType = "None"; - if (ui->proxyDefaultBtn->isChecked()) - proxyType = "Default"; - else if (ui->proxyNoneBtn->isChecked()) - proxyType = "None"; - else if (ui->proxySOCKS5Btn->isChecked()) - proxyType = "SOCKS5"; - else if (ui->proxyHTTPBtn->isChecked()) - proxyType = "HTTP"; - - s->set("ProxyType", proxyType); - s->set("ProxyAddr", ui->proxyAddrEdit->text()); - s->set("ProxyPort", ui->proxyPortEdit->value()); - s->set("ProxyUser", ui->proxyUserEdit->text()); - s->set("ProxyPass", ui->proxyPassEdit->text()); - - ENV.updateProxySettings(proxyType, ui->proxyAddrEdit->text(), ui->proxyPortEdit->value(), - ui->proxyUserEdit->text(), ui->proxyPassEdit->text()); -} -void ProxyPage::loadSettings() -{ - auto s = MMC->settings(); - // Proxy - QString proxyType = s->get("ProxyType").toString(); - if (proxyType == "Default") - ui->proxyDefaultBtn->setChecked(true); - else if (proxyType == "None") - ui->proxyNoneBtn->setChecked(true); - else if (proxyType == "SOCKS5") - ui->proxySOCKS5Btn->setChecked(true); - else if (proxyType == "HTTP") - ui->proxyHTTPBtn->setChecked(true); - - ui->proxyAddrEdit->setText(s->get("ProxyAddr").toString()); - ui->proxyPortEdit->setValue(s->get("ProxyPort").value()); - ui->proxyUserEdit->setText(s->get("ProxyUser").toString()); - ui->proxyPassEdit->setText(s->get("ProxyPass").toString()); -} diff --git a/application/pages/global/ProxyPage.h b/application/pages/global/ProxyPage.h deleted file mode 100644 index ff94ec49..00000000 --- a/application/pages/global/ProxyPage.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#include "pages/BasePage.h" -#include - -namespace Ui -{ -class ProxyPage; -} - -class ProxyPage : public QWidget, public BasePage -{ - Q_OBJECT - -public: - explicit ProxyPage(QWidget *parent = 0); - ~ProxyPage(); - - QString displayName() const override - { - return tr("Proxy"); - } - QIcon icon() const override - { - return MMC->getThemedIcon("proxy"); - } - QString id() const override - { - return "proxy-settings"; - } - QString helpPage() const override - { - return "Proxy-settings"; - } - bool apply() override; - -private: - void updateCheckboxStuff(); - void applySettings(); - void loadSettings(); - -private -slots: - void proxyChanged(int); - -private: - Ui::ProxyPage *ui; -}; diff --git a/application/pages/global/ProxyPage.ui b/application/pages/global/ProxyPage.ui deleted file mode 100644 index 69fcef1e..00000000 --- a/application/pages/global/ProxyPage.ui +++ /dev/null @@ -1,203 +0,0 @@ - - - ProxyPage - - - - 0 - 0 - 598 - 617 - - - - - 0 - 0 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - - - - - This only applies to MultiMC. Minecraft does not accept proxy settings. - - - Qt::AlignCenter - - - true - - - - - - - Type - - - - - - Uses your system's default proxy settings. - - - &Default - - - proxyGroup - - - - - - - &None - - - proxyGroup - - - - - - - SOC&KS5 - - - proxyGroup - - - - - - - H&TTP - - - proxyGroup - - - - - - - - - - Address and Port - - - - - - 127.0.0.1 - - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - QAbstractSpinBox::PlusMinus - - - 65535 - - - 8080 - - - - - - - - - - Authentication - - - - - - - - - Username: - - - - - - - Password: - - - - - - - QLineEdit::Password - - - - - - - Note: Proxy username and password are stored in plain text inside MultiMC's configuration file! - - - true - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - - - - diff --git a/application/pages/instance/GameOptionsPage.cpp b/application/pages/instance/GameOptionsPage.cpp deleted file mode 100644 index 782f2ab3..00000000 --- a/application/pages/instance/GameOptionsPage.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include "GameOptionsPage.h" -#include "ui_GameOptionsPage.h" -#include "minecraft/MinecraftInstance.h" -#include "minecraft/gameoptions/GameOptions.h" - -GameOptionsPage::GameOptionsPage(MinecraftInstance * inst, QWidget* parent) - : QWidget(parent), ui(new Ui::GameOptionsPage) -{ - ui->setupUi(this); - ui->tabWidget->tabBar()->hide(); - m_model = inst->gameOptionsModel(); - ui->optionsView->setModel(m_model.get()); - auto head = ui->optionsView->header(); - if(head->count()) - { - head->setSectionResizeMode(0, QHeaderView::ResizeToContents); - for(int i = 1; i < head->count(); i++) - { - head->setSectionResizeMode(i, QHeaderView::Stretch); - } - } -} - -GameOptionsPage::~GameOptionsPage() -{ - // m_model->save(); -} - -void GameOptionsPage::openedImpl() -{ - // m_model->observe(); -} - -void GameOptionsPage::closedImpl() -{ - // m_model->unobserve(); -} diff --git a/application/pages/instance/GameOptionsPage.h b/application/pages/instance/GameOptionsPage.h deleted file mode 100644 index 0fd2fbff..00000000 --- a/application/pages/instance/GameOptionsPage.h +++ /dev/null @@ -1,63 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#include "pages/BasePage.h" -#include - -namespace Ui -{ -class GameOptionsPage; -} - -class GameOptions; -class MinecraftInstance; - -class GameOptionsPage : public QWidget, public BasePage -{ - Q_OBJECT - -public: - explicit GameOptionsPage(MinecraftInstance *inst, QWidget *parent = 0); - virtual ~GameOptionsPage(); - - void openedImpl() override; - void closedImpl() override; - - virtual QString displayName() const override - { - return tr("Game Options"); - } - virtual QIcon icon() const override - { - return MMC->getThemedIcon("settings"); - } - virtual QString id() const override - { - return "gameoptions"; - } - virtual QString helpPage() const override - { - return "Game-Options-management"; - } - -private: // data - Ui::GameOptionsPage *ui = nullptr; - std::shared_ptr m_model; -}; diff --git a/application/pages/instance/GameOptionsPage.ui b/application/pages/instance/GameOptionsPage.ui deleted file mode 100644 index f0a5ce0e..00000000 --- a/application/pages/instance/GameOptionsPage.ui +++ /dev/null @@ -1,88 +0,0 @@ - - - GameOptionsPage - - - - 0 - 0 - 706 - 575 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 0 - - - - - 0 - 0 - - - - Tab 1 - - - - - - - 0 - 0 - - - - true - - - true - - - QAbstractItemView::SingleSelection - - - QAbstractItemView::SelectRows - - - - 64 - 64 - - - - false - - - false - - - - - - - - - - - tabWidget - optionsView - - - - diff --git a/application/pages/instance/InstanceSettingsPage.cpp b/application/pages/instance/InstanceSettingsPage.cpp deleted file mode 100644 index 7bd424c0..00000000 --- a/application/pages/instance/InstanceSettingsPage.cpp +++ /dev/null @@ -1,338 +0,0 @@ -#include "InstanceSettingsPage.h" -#include "ui_InstanceSettingsPage.h" - -#include -#include -#include - -#include "dialogs/VersionSelectDialog.h" -#include "JavaCommon.h" -#include "MultiMC.h" - -#include -#include -#include -#include - -InstanceSettingsPage::InstanceSettingsPage(BaseInstance *inst, QWidget *parent) - : QWidget(parent), ui(new Ui::InstanceSettingsPage), m_instance(inst) -{ - m_settings = inst->settings(); - ui->setupUi(this); - auto sysMB = Sys::getSystemRam() / Sys::mebibyte; - ui->maxMemSpinBox->setMaximum(sysMB); - connect(ui->openGlobalJavaSettingsButton, &QCommandLinkButton::clicked, this, &InstanceSettingsPage::globalSettingsButtonClicked); - connect(MMC, &MultiMC::globalSettingsAboutToOpen, this, &InstanceSettingsPage::applySettings); - connect(MMC, &MultiMC::globalSettingsClosed, this, &InstanceSettingsPage::loadSettings); - loadSettings(); -} - -bool InstanceSettingsPage::shouldDisplay() const -{ - return !m_instance->isRunning(); -} - -InstanceSettingsPage::~InstanceSettingsPage() -{ - delete ui; -} - -void InstanceSettingsPage::globalSettingsButtonClicked(bool) -{ - switch(ui->settingsTabs->currentIndex()) { - case 0: - MMC->ShowGlobalSettings(this, "java-settings"); - return; - case 1: - MMC->ShowGlobalSettings(this, "minecraft-settings"); - return; - case 2: - MMC->ShowGlobalSettings(this, "custom-commands"); - return; - } -} - -bool InstanceSettingsPage::apply() -{ - applySettings(); - return true; -} - -void InstanceSettingsPage::applySettings() -{ - SettingsObject::Lock lock(m_settings); - - // Console - bool console = ui->consoleSettingsBox->isChecked(); - m_settings->set("OverrideConsole", console); - if (console) - { - m_settings->set("ShowConsole", ui->showConsoleCheck->isChecked()); - m_settings->set("AutoCloseConsole", ui->autoCloseConsoleCheck->isChecked()); - m_settings->set("ShowConsoleOnError", ui->showConsoleErrorCheck->isChecked()); - } - else - { - m_settings->reset("ShowConsole"); - m_settings->reset("AutoCloseConsole"); - m_settings->reset("ShowConsoleOnError"); - } - - // Window Size - bool window = ui->windowSizeGroupBox->isChecked(); - m_settings->set("OverrideWindow", window); - if (window) - { - m_settings->set("LaunchMaximized", ui->maximizedCheckBox->isChecked()); - m_settings->set("MinecraftWinWidth", ui->windowWidthSpinBox->value()); - m_settings->set("MinecraftWinHeight", ui->windowHeightSpinBox->value()); - } - else - { - m_settings->reset("LaunchMaximized"); - m_settings->reset("MinecraftWinWidth"); - m_settings->reset("MinecraftWinHeight"); - } - - // Memory - bool memory = ui->memoryGroupBox->isChecked(); - m_settings->set("OverrideMemory", memory); - if (memory) - { - int min = ui->minMemSpinBox->value(); - int max = ui->maxMemSpinBox->value(); - if(min < max) - { - m_settings->set("MinMemAlloc", min); - m_settings->set("MaxMemAlloc", max); - } - else - { - m_settings->set("MinMemAlloc", max); - m_settings->set("MaxMemAlloc", min); - } - m_settings->set("PermGen", ui->permGenSpinBox->value()); - } - else - { - m_settings->reset("MinMemAlloc"); - m_settings->reset("MaxMemAlloc"); - m_settings->reset("PermGen"); - } - - // Java Install Settings - bool javaInstall = ui->javaSettingsGroupBox->isChecked(); - m_settings->set("OverrideJavaLocation", javaInstall); - if (javaInstall) - { - m_settings->set("JavaPath", ui->javaPathTextBox->text()); - } - else - { - m_settings->reset("JavaPath"); - } - - // Java arguments - bool javaArgs = ui->javaArgumentsGroupBox->isChecked(); - m_settings->set("OverrideJavaArgs", javaArgs); - if(javaArgs) - { - m_settings->set("JvmArgs", ui->jvmArgsTextBox->toPlainText().replace("\n", " ")); - JavaCommon::checkJVMArgs(m_settings->get("JvmArgs").toString(), this->parentWidget()); - } - else - { - m_settings->reset("JvmArgs"); - } - - // old generic 'override both' is removed. - m_settings->reset("OverrideJava"); - - // Custom Commands - bool custcmd = ui->customCommands->checked(); - m_settings->set("OverrideCommands", custcmd); - if (custcmd) - { - m_settings->set("PreLaunchCommand", ui->customCommands->prelaunchCommand()); - m_settings->set("WrapperCommand", ui->customCommands->wrapperCommand()); - m_settings->set("PostExitCommand", ui->customCommands->postexitCommand()); - } - else - { - m_settings->reset("PreLaunchCommand"); - m_settings->reset("WrapperCommand"); - m_settings->reset("PostExitCommand"); - } - - // Workarounds - bool workarounds = ui->nativeWorkaroundsGroupBox->isChecked(); - m_settings->set("OverrideNativeWorkarounds", workarounds); - if(workarounds) - { - m_settings->set("UseNativeOpenAL", ui->useNativeOpenALCheck->isChecked()); - m_settings->set("UseNativeGLFW", ui->useNativeGLFWCheck->isChecked()); - } - else - { - m_settings->reset("UseNativeOpenAL"); - m_settings->reset("UseNativeGLFW"); - } - - // Game time - bool gameTime = ui->gameTimeGroupBox->isChecked(); - m_settings->set("OverrideGameTime", gameTime); - if (gameTime) - { - m_settings->set("ShowGameTime", ui->showGameTime->isChecked()); - m_settings->set("RecordGameTime", ui->recordGameTime->isChecked()); - } - else - { - m_settings->reset("ShowGameTime"); - m_settings->reset("RecordGameTime"); - } - - // Join server on launch - bool joinServerOnLaunch = ui->serverJoinGroupBox->isChecked(); - m_settings->set("JoinServerOnLaunch", joinServerOnLaunch); - if (joinServerOnLaunch) - { - m_settings->set("JoinServerOnLaunchAddress", ui->serverJoinAddress->text()); - } - else - { - m_settings->reset("JoinServerOnLaunchAddress"); - } -} - -void InstanceSettingsPage::loadSettings() -{ - // Console - ui->consoleSettingsBox->setChecked(m_settings->get("OverrideConsole").toBool()); - ui->showConsoleCheck->setChecked(m_settings->get("ShowConsole").toBool()); - ui->autoCloseConsoleCheck->setChecked(m_settings->get("AutoCloseConsole").toBool()); - ui->showConsoleErrorCheck->setChecked(m_settings->get("ShowConsoleOnError").toBool()); - - // Window Size - ui->windowSizeGroupBox->setChecked(m_settings->get("OverrideWindow").toBool()); - ui->maximizedCheckBox->setChecked(m_settings->get("LaunchMaximized").toBool()); - ui->windowWidthSpinBox->setValue(m_settings->get("MinecraftWinWidth").toInt()); - ui->windowHeightSpinBox->setValue(m_settings->get("MinecraftWinHeight").toInt()); - - // Memory - ui->memoryGroupBox->setChecked(m_settings->get("OverrideMemory").toBool()); - int min = m_settings->get("MinMemAlloc").toInt(); - int max = m_settings->get("MaxMemAlloc").toInt(); - if(min < max) - { - ui->minMemSpinBox->setValue(min); - ui->maxMemSpinBox->setValue(max); - } - else - { - ui->minMemSpinBox->setValue(max); - ui->maxMemSpinBox->setValue(min); - } - ui->permGenSpinBox->setValue(m_settings->get("PermGen").toInt()); - bool permGenVisible = m_settings->get("PermGenVisible").toBool(); - ui->permGenSpinBox->setVisible(permGenVisible); - ui->labelPermGen->setVisible(permGenVisible); - ui->labelPermgenNote->setVisible(permGenVisible); - - - // Java Settings - bool overrideJava = m_settings->get("OverrideJava").toBool(); - bool overrideLocation = m_settings->get("OverrideJavaLocation").toBool() || overrideJava; - bool overrideArgs = m_settings->get("OverrideJavaArgs").toBool() || overrideJava; - - ui->javaSettingsGroupBox->setChecked(overrideLocation); - ui->javaPathTextBox->setText(m_settings->get("JavaPath").toString()); - - ui->javaArgumentsGroupBox->setChecked(overrideArgs); - ui->jvmArgsTextBox->setPlainText(m_settings->get("JvmArgs").toString()); - - // Custom commands - ui->customCommands->initialize( - true, - m_settings->get("OverrideCommands").toBool(), - m_settings->get("PreLaunchCommand").toString(), - m_settings->get("WrapperCommand").toString(), - m_settings->get("PostExitCommand").toString() - ); - - // Workarounds - ui->nativeWorkaroundsGroupBox->setChecked(m_settings->get("OverrideNativeWorkarounds").toBool()); - ui->useNativeGLFWCheck->setChecked(m_settings->get("UseNativeGLFW").toBool()); - ui->useNativeOpenALCheck->setChecked(m_settings->get("UseNativeOpenAL").toBool()); - - // Miscellanous - ui->gameTimeGroupBox->setChecked(m_settings->get("OverrideGameTime").toBool()); - ui->showGameTime->setChecked(m_settings->get("ShowGameTime").toBool()); - ui->recordGameTime->setChecked(m_settings->get("RecordGameTime").toBool()); - - ui->serverJoinGroupBox->setChecked(m_settings->get("JoinServerOnLaunch").toBool()); - ui->serverJoinAddress->setText(m_settings->get("JoinServerOnLaunchAddress").toString()); -} - -void InstanceSettingsPage::on_javaDetectBtn_clicked() -{ - JavaInstallPtr java; - - VersionSelectDialog vselect(MMC->javalist().get(), tr("Select a Java version"), this, true); - vselect.setResizeOn(2); - vselect.exec(); - - if (vselect.result() == QDialog::Accepted && vselect.selectedVersion()) - { - java = std::dynamic_pointer_cast(vselect.selectedVersion()); - ui->javaPathTextBox->setText(java->path); - bool visible = java->id.requiresPermGen() && m_settings->get("OverrideMemory").toBool(); - ui->permGenSpinBox->setVisible(visible); - ui->labelPermGen->setVisible(visible); - ui->labelPermgenNote->setVisible(visible); - m_settings->set("PermGenVisible", visible); - } -} - -void InstanceSettingsPage::on_javaBrowseBtn_clicked() -{ - QString raw_path = QFileDialog::getOpenFileName(this, tr("Find Java executable")); - - // do not allow current dir - it's dirty. Do not allow dirs that don't exist - if(raw_path.isEmpty()) - { - return; - } - QString cooked_path = FS::NormalizePath(raw_path); - - QFileInfo javaInfo(cooked_path); - if(!javaInfo.exists() || !javaInfo.isExecutable()) - { - return; - } - ui->javaPathTextBox->setText(cooked_path); - - // custom Java could be anything... enable perm gen option - ui->permGenSpinBox->setVisible(true); - ui->labelPermGen->setVisible(true); - ui->labelPermgenNote->setVisible(true); - m_settings->set("PermGenVisible", true); -} - -void InstanceSettingsPage::on_javaTestBtn_clicked() -{ - if(checker) - { - return; - } - checker.reset(new JavaCommon::TestCheck( - this, ui->javaPathTextBox->text(), ui->jvmArgsTextBox->toPlainText().replace("\n", " "), - ui->minMemSpinBox->value(), ui->maxMemSpinBox->value(), ui->permGenSpinBox->value())); - connect(checker.get(), SIGNAL(finished()), SLOT(checkerFinished())); - checker->run(); -} - -void InstanceSettingsPage::checkerFinished() -{ - checker.reset(); -} diff --git a/application/pages/instance/InstanceSettingsPage.h b/application/pages/instance/InstanceSettingsPage.h deleted file mode 100644 index 068213a8..00000000 --- a/application/pages/instance/InstanceSettingsPage.h +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include "java/JavaChecker.h" -#include "BaseInstance.h" -#include -#include "pages/BasePage.h" -#include "JavaCommon.h" -#include "MultiMC.h" - -class JavaChecker; -namespace Ui -{ -class InstanceSettingsPage; -} - -class InstanceSettingsPage : public QWidget, public BasePage -{ - Q_OBJECT - -public: - explicit InstanceSettingsPage(BaseInstance *inst, QWidget *parent = 0); - virtual ~InstanceSettingsPage(); - virtual QString displayName() const override - { - return tr("Settings"); - } - virtual QIcon icon() const override - { - return MMC->getThemedIcon("instance-settings"); - } - virtual QString id() const override - { - return "settings"; - } - virtual bool apply() override; - virtual QString helpPage() const override - { - return "Instance-settings"; - } - virtual bool shouldDisplay() const override; - -private slots: - void on_javaDetectBtn_clicked(); - void on_javaTestBtn_clicked(); - void on_javaBrowseBtn_clicked(); - - void applySettings(); - void loadSettings(); - - void checkerFinished(); - - void globalSettingsButtonClicked(bool checked); - -private: - Ui::InstanceSettingsPage *ui; - BaseInstance *m_instance; - SettingsObjectPtr m_settings; - unique_qobject_ptr checker; -}; diff --git a/application/pages/instance/InstanceSettingsPage.ui b/application/pages/instance/InstanceSettingsPage.ui deleted file mode 100644 index e569ce56..00000000 --- a/application/pages/instance/InstanceSettingsPage.ui +++ /dev/null @@ -1,548 +0,0 @@ - - - InstanceSettingsPage - - - - 0 - 0 - 691 - 581 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Open Global Settings - - - The settings here are overrides for global settings. - - - - - - - QTabWidget::Rounded - - - 0 - - - - Java - - - - - - true - - - Java insta&llation - - - true - - - false - - - - - - - - - Auto-detect... - - - - - - - Browse... - - - - - - - Test - - - - - - - - - - true - - - Memor&y - - - true - - - false - - - - - - Minimum memory allocation: - - - - - - - The maximum amount of memory Minecraft is allowed to use. - - - MiB - - - 128 - - - 65536 - - - 128 - - - 1024 - - - - - - - The amount of memory Minecraft is started with. - - - MiB - - - 128 - - - 65536 - - - 128 - - - 256 - - - - - - - The amount of memory available to store loaded Java classes. - - - MiB - - - 64 - - - 999999999 - - - 8 - - - 64 - - - - - - - PermGen: - - - - - - - Maximum memory allocation: - - - - - - - Note: Permgen is set automatically by Java 8 and later - - - - - - - - - - true - - - Java argumen&ts - - - true - - - false - - - - - - - - - - - - - Game windows - - - - - - true - - - Game Window - - - true - - - false - - - - - - Start Minecraft maximized? - - - - - - - - - Window height: - - - - - - - Window width: - - - - - - - 1 - - - 65536 - - - 1 - - - 854 - - - - - - - 1 - - - 65536 - - - 480 - - - - - - - - - - - - true - - - Conso&le Settings - - - true - - - false - - - - - - Show console while the game is running? - - - - - - - Automatically close console when the game quits? - - - - - - - Show console when the game crashes? - - - - - - - - - - Qt::Vertical - - - - 88 - 125 - - - - - - - - - Custom commands - - - - - - - - - - Workarounds - - - - - - true - - - Native libraries - - - true - - - false - - - - - - Use system installation of GLFW - - - - - - - Use system installation of OpenAL - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - Miscellanous - - - - - - true - - - Override global game time settings - - - true - - - false - - - - - - Show time spent playing this instance - - - - - - - Record time spent playing this instance - - - - - - - - - - Set a server to join on launch - - - true - - - false - - - - - - - - - 0 - 0 - - - - Server address: - - - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - CustomCommands - QWidget -
widgets/CustomCommands.h
- 1 -
-
- - openGlobalJavaSettingsButton - settingsTabs - javaSettingsGroupBox - javaPathTextBox - javaDetectBtn - javaBrowseBtn - javaTestBtn - memoryGroupBox - minMemSpinBox - maxMemSpinBox - permGenSpinBox - javaArgumentsGroupBox - jvmArgsTextBox - windowSizeGroupBox - maximizedCheckBox - windowWidthSpinBox - windowHeightSpinBox - consoleSettingsBox - showConsoleCheck - autoCloseConsoleCheck - showConsoleErrorCheck - nativeWorkaroundsGroupBox - useNativeGLFWCheck - useNativeOpenALCheck - showGameTime - recordGameTime - - - -
diff --git a/application/pages/instance/LegacyUpgradePage.cpp b/application/pages/instance/LegacyUpgradePage.cpp deleted file mode 100644 index af800b03..00000000 --- a/application/pages/instance/LegacyUpgradePage.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include "LegacyUpgradePage.h" -#include "ui_LegacyUpgradePage.h" - -#include "InstanceList.h" -#include "minecraft/legacy/LegacyInstance.h" -#include "minecraft/legacy/LegacyUpgradeTask.h" -#include "MultiMC.h" -#include "dialogs/CustomMessageBox.h" -#include "dialogs/ProgressDialog.h" - -LegacyUpgradePage::LegacyUpgradePage(InstancePtr inst, QWidget *parent) - : QWidget(parent), ui(new Ui::LegacyUpgradePage), m_inst(inst) -{ - ui->setupUi(this); -} - -LegacyUpgradePage::~LegacyUpgradePage() -{ - delete ui; -} - -void LegacyUpgradePage::runModalTask(Task *task) -{ - connect(task, &Task::failed, [this](QString reason) - { - CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Warning)->show(); - }); - ProgressDialog loadDialog(this); - loadDialog.setSkipButton(true, tr("Abort")); - if(loadDialog.execWithTask(task) == QDialog::Accepted) - { - m_container->requestClose(); - } -} - -void LegacyUpgradePage::on_upgradeButton_clicked() -{ - QString newName = tr("%1 (Migrated)").arg(m_inst->name()); - auto upgradeTask = new LegacyUpgradeTask(m_inst); - upgradeTask->setName(newName); - upgradeTask->setGroup(MMC->instances()->getInstanceGroup(m_inst->id())); - upgradeTask->setIcon(m_inst->iconKey()); - unique_qobject_ptr task(MMC->instances()->wrapInstanceTask(upgradeTask)); - runModalTask(task.get()); -} - -bool LegacyUpgradePage::shouldDisplay() const -{ - return !m_inst->isRunning(); -} diff --git a/application/pages/instance/LegacyUpgradePage.h b/application/pages/instance/LegacyUpgradePage.h deleted file mode 100644 index df34e33a..00000000 --- a/application/pages/instance/LegacyUpgradePage.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include "minecraft/legacy/LegacyInstance.h" -#include "pages/BasePage.h" -#include -#include "tasks/Task.h" - -namespace Ui -{ -class LegacyUpgradePage; -} - -class LegacyUpgradePage : public QWidget, public BasePage -{ - Q_OBJECT - -public: - explicit LegacyUpgradePage(InstancePtr inst, QWidget *parent = 0); - virtual ~LegacyUpgradePage(); - virtual QString displayName() const override - { - return tr("Upgrade"); - } - virtual QIcon icon() const override - { - return MMC->getThemedIcon("checkupdate"); - } - virtual QString id() const override - { - return "upgrade"; - } - virtual QString helpPage() const override - { - return "Legacy-upgrade"; - } - virtual bool shouldDisplay() const override; - -private slots: - void on_upgradeButton_clicked(); - -private: - void runModalTask(Task *task); - -private: - Ui::LegacyUpgradePage *ui; - InstancePtr m_inst; -}; diff --git a/application/pages/instance/LegacyUpgradePage.ui b/application/pages/instance/LegacyUpgradePage.ui deleted file mode 100644 index a94ee039..00000000 --- a/application/pages/instance/LegacyUpgradePage.ui +++ /dev/null @@ -1,47 +0,0 @@ - - - LegacyUpgradePage - - - - 0 - 0 - 546 - 405 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - <html><body><h1>Upgrade is required</h1><p>MultiMC now supports old Minecraft versions and all the required features in the new (OneSix) instance format. As a consequence, the old (Legacy) format has been entirely disabled and old instances need to be upgraded.</p><p>The upgrade will create a new instance with the same contents as the current one, in the new format. The original instance will remain untouched, in case anything goes wrong in the process.</p><p>Please report any issues on our <a href="https://github.com/MultiMC/MultiMC5/issues">github issues page</a>.</p><p>There is also a <a href="https://discord.gg/GtPmv93">discord channel for testing here</a>.</p></body></html> - - - true - - - - - - - Upgrade the instance - - - - - - - - diff --git a/application/pages/instance/LogPage.cpp b/application/pages/instance/LogPage.cpp deleted file mode 100644 index 3d2085c6..00000000 --- a/application/pages/instance/LogPage.cpp +++ /dev/null @@ -1,312 +0,0 @@ -#include "LogPage.h" -#include "ui_LogPage.h" - -#include "MultiMC.h" - -#include -#include -#include - -#include "launch/LaunchTask.h" -#include -#include "GuiUtil.h" -#include - -class LogFormatProxyModel : public QIdentityProxyModel -{ -public: - LogFormatProxyModel(QObject* parent = nullptr) : QIdentityProxyModel(parent) - { - } - QVariant data(const QModelIndex &index, int role) const override - { - switch(role) - { - case Qt::FontRole: - return m_font; - case Qt::TextColorRole: - { - MessageLevel::Enum level = (MessageLevel::Enum) QIdentityProxyModel::data(index, LogModel::LevelRole).toInt(); - return m_colors->getFront(level); - } - case Qt::BackgroundRole: - { - MessageLevel::Enum level = (MessageLevel::Enum) QIdentityProxyModel::data(index, LogModel::LevelRole).toInt(); - return m_colors->getBack(level); - } - default: - return QIdentityProxyModel::data(index, role); - } - } - - void setFont(QFont font) - { - m_font = font; - } - - void setColors(LogColorCache* colors) - { - m_colors.reset(colors); - } - - QModelIndex find(const QModelIndex &start, const QString &value, bool reverse) const - { - QModelIndex parentIndex = parent(start); - auto compare = [&](int r) -> QModelIndex - { - QModelIndex idx = index(r, start.column(), parentIndex); - if (!idx.isValid() || idx == start) - { - return QModelIndex(); - } - QVariant v = data(idx, Qt::DisplayRole); - QString t = v.toString(); - if (t.contains(value, Qt::CaseInsensitive)) - return idx; - return QModelIndex(); - }; - if(reverse) - { - int from = start.row(); - int to = 0; - - for (int i = 0; i < 2; ++i) - { - for (int r = from; (r >= to); --r) - { - auto idx = compare(r); - if(idx.isValid()) - return idx; - } - // prepare for the next iteration - from = rowCount() - 1; - to = start.row(); - } - } - else - { - int from = start.row(); - int to = rowCount(parentIndex); - - for (int i = 0; i < 2; ++i) - { - for (int r = from; (r < to); ++r) - { - auto idx = compare(r); - if(idx.isValid()) - return idx; - } - // prepare for the next iteration - from = 0; - to = start.row(); - } - } - return QModelIndex(); - } -private: - QFont m_font; - std::unique_ptr m_colors; -}; - -LogPage::LogPage(InstancePtr instance, QWidget *parent) - : QWidget(parent), ui(new Ui::LogPage), m_instance(instance) -{ - ui->setupUi(this); - ui->tabWidget->tabBar()->hide(); - - m_proxy = new LogFormatProxyModel(this); - // set up text colors in the log proxy and adapt them to the current theme foreground and background - { - auto origForeground = ui->text->palette().color(ui->text->foregroundRole()); - auto origBackground = ui->text->palette().color(ui->text->backgroundRole()); - m_proxy->setColors(new LogColorCache(origForeground, origBackground)); - } - - // set up fonts in the log proxy - { - QString fontFamily = MMC->settings()->get("ConsoleFont").toString(); - bool conversionOk = false; - int fontSize = MMC->settings()->get("ConsoleFontSize").toInt(&conversionOk); - if(!conversionOk) - { - fontSize = 11; - } - m_proxy->setFont(QFont(fontFamily, fontSize)); - } - - ui->text->setModel(m_proxy); - - // set up instance and launch process recognition - { - auto launchTask = m_instance->getLaunchTask(); - if(launchTask) - { - setInstanceLaunchTaskChanged(launchTask, true); - } - connect(m_instance.get(), &BaseInstance::launchTaskChanged, this, &LogPage::onInstanceLaunchTaskChanged); - } - - auto findShortcut = new QShortcut(QKeySequence(QKeySequence::Find), this); - connect(findShortcut, SIGNAL(activated()), SLOT(findActivated())); - auto findNextShortcut = new QShortcut(QKeySequence(QKeySequence::FindNext), this); - connect(findNextShortcut, SIGNAL(activated()), SLOT(findNextActivated())); - connect(ui->searchBar, SIGNAL(returnPressed()), SLOT(on_findButton_clicked())); - auto findPreviousShortcut = new QShortcut(QKeySequence(QKeySequence::FindPrevious), this); - connect(findPreviousShortcut, SIGNAL(activated()), SLOT(findPreviousActivated())); -} - -LogPage::~LogPage() -{ - delete ui; -} - -void LogPage::modelStateToUI() -{ - if(m_model->wrapLines()) - { - ui->text->setWordWrap(true); - ui->wrapCheckbox->setCheckState(Qt::Checked); - } - else - { - ui->text->setWordWrap(false); - ui->wrapCheckbox->setCheckState(Qt::Unchecked); - } - if(m_model->suspended()) - { - ui->trackLogCheckbox->setCheckState(Qt::Unchecked); - } - else - { - ui->trackLogCheckbox->setCheckState(Qt::Checked); - } -} - -void LogPage::UIToModelState() -{ - if(!m_model) - { - return; - } - m_model->setLineWrap(ui->wrapCheckbox->checkState() == Qt::Checked); - m_model->suspend(ui->trackLogCheckbox->checkState() != Qt::Checked); -} - -void LogPage::setInstanceLaunchTaskChanged(shared_qobject_ptr proc, bool initial) -{ - m_process = proc; - if(m_process) - { - m_model = proc->getLogModel(); - m_proxy->setSourceModel(m_model.get()); - if(initial) - { - modelStateToUI(); - } - else - { - UIToModelState(); - } - } - else - { - m_proxy->setSourceModel(nullptr); - m_model.reset(); - } -} - -void LogPage::onInstanceLaunchTaskChanged(shared_qobject_ptr proc) -{ - setInstanceLaunchTaskChanged(proc, false); -} - -bool LogPage::apply() -{ - return true; -} - -bool LogPage::shouldDisplay() const -{ - return m_instance->isRunning() || m_proxy->rowCount() > 0; -} - -void LogPage::on_btnPaste_clicked() -{ - if(!m_model) - return; - - //FIXME: turn this into a proper task and move the upload logic out of GuiUtil! - m_model->append(MessageLevel::MultiMC, QString("MultiMC: Log upload triggered at: %1").arg(QDateTime::currentDateTime().toString(Qt::RFC2822Date))); - auto url = GuiUtil::uploadPaste(m_model->toPlainText(), this); - if(!url.isEmpty()) - { - m_model->append(MessageLevel::MultiMC, QString("MultiMC: Log uploaded to: %1").arg(url)); - } - else - { - m_model->append(MessageLevel::Error, "MultiMC: Log upload failed!"); - } -} - -void LogPage::on_btnCopy_clicked() -{ - if(!m_model) - return; - m_model->append(MessageLevel::MultiMC, QString("Clipboard copy at: %1").arg(QDateTime::currentDateTime().toString(Qt::RFC2822Date))); - GuiUtil::setClipboardText(m_model->toPlainText()); -} - -void LogPage::on_btnClear_clicked() -{ - if(!m_model) - return; - m_model->clear(); - m_container->refreshContainer(); -} - -void LogPage::on_btnBottom_clicked() -{ - ui->text->scrollToBottom(); -} - -void LogPage::on_trackLogCheckbox_clicked(bool checked) -{ - if(!m_model) - return; - m_model->suspend(!checked); -} - -void LogPage::on_wrapCheckbox_clicked(bool checked) -{ - ui->text->setWordWrap(checked); - if(!m_model) - return; - m_model->setLineWrap(checked); -} - -void LogPage::on_findButton_clicked() -{ - auto modifiers = QApplication::keyboardModifiers(); - bool reverse = modifiers & Qt::ShiftModifier; - ui->text->findNext(ui->searchBar->text(), reverse); -} - -void LogPage::findNextActivated() -{ - ui->text->findNext(ui->searchBar->text(), false); -} - -void LogPage::findPreviousActivated() -{ - ui->text->findNext(ui->searchBar->text(), true); -} - -void LogPage::findActivated() -{ - // focus the search bar if it doesn't have focus - if (!ui->searchBar->hasFocus()) - { - ui->searchBar->setFocus(); - ui->searchBar->selectAll(); - } -} diff --git a/application/pages/instance/LogPage.h b/application/pages/instance/LogPage.h deleted file mode 100644 index b0b0e04b..00000000 --- a/application/pages/instance/LogPage.h +++ /dev/null @@ -1,86 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include "BaseInstance.h" -#include "launch/LaunchTask.h" -#include "pages/BasePage.h" -#include - -namespace Ui -{ -class LogPage; -} -class QTextCharFormat; -class LogFormatProxyModel; - -class LogPage : public QWidget, public BasePage -{ - Q_OBJECT - -public: - explicit LogPage(InstancePtr instance, QWidget *parent = 0); - virtual ~LogPage(); - virtual QString displayName() const override - { - return tr("Minecraft Log"); - } - virtual QIcon icon() const override - { - return MMC->getThemedIcon("log"); - } - virtual QString id() const override - { - return "console"; - } - virtual bool apply() override; - virtual QString helpPage() const override - { - return "Minecraft-Logs"; - } - virtual bool shouldDisplay() const override; - -private slots: - void on_btnPaste_clicked(); - void on_btnCopy_clicked(); - void on_btnClear_clicked(); - void on_btnBottom_clicked(); - - void on_trackLogCheckbox_clicked(bool checked); - void on_wrapCheckbox_clicked(bool checked); - - void on_findButton_clicked(); - void findActivated(); - void findNextActivated(); - void findPreviousActivated(); - - void onInstanceLaunchTaskChanged(shared_qobject_ptr proc); - -private: - void modelStateToUI(); - void UIToModelState(); - void setInstanceLaunchTaskChanged(shared_qobject_ptr proc, bool initial); - -private: - Ui::LogPage *ui; - InstancePtr m_instance; - shared_qobject_ptr m_process; - - LogFormatProxyModel * m_proxy; - shared_qobject_ptr m_model; -}; diff --git a/application/pages/instance/LogPage.ui b/application/pages/instance/LogPage.ui deleted file mode 100644 index 4843d7c3..00000000 --- a/application/pages/instance/LogPage.ui +++ /dev/null @@ -1,182 +0,0 @@ - - - LogPage - - - - 0 - 0 - 825 - 782 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 0 - - - - Tab 1 - - - - - - false - - - true - - - - - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - false - - - - - - - - - Keep updating - - - true - - - - - - - Wrap lines - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Copy the whole log into the clipboard - - - &Copy - - - - - - - Upload the log to paste.ee - it will stay online for a month - - - Upload - - - - - - - Clear the log - - - Clear - - - - - - - - - Search: - - - - - - - Find - - - - - - - - - - Scroll all the way to bottom - - - Bottom - - - - - - - Qt::Vertical - - - - - - - - - - - - LogView - QPlainTextEdit -
widgets/LogView.h
-
-
- - tabWidget - trackLogCheckbox - wrapCheckbox - btnCopy - btnPaste - btnClear - text - searchBar - findButton - - - -
diff --git a/application/pages/instance/ModFolderPage.cpp b/application/pages/instance/ModFolderPage.cpp deleted file mode 100644 index 98f20e77..00000000 --- a/application/pages/instance/ModFolderPage.cpp +++ /dev/null @@ -1,363 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "ModFolderPage.h" -#include "ui_ModFolderPage.h" - -#include -#include -#include -#include -#include - -#include "MultiMC.h" -#include "dialogs/CustomMessageBox.h" -#include -#include "minecraft/mod/ModFolderModel.h" -#include "minecraft/mod/Mod.h" -#include "minecraft/VersionFilterData.h" -#include "minecraft/PackProfile.h" -#include - -#include -#include "Version.h" - -namespace { - // FIXME: wasteful - void RemoveThePrefix(QString & string) { - QRegularExpression regex(QStringLiteral("^(([Tt][Hh][eE])|([Tt][eE][Hh])) +")); - string.remove(regex); - string = string.trimmed(); - } -} - -class ModSortProxy : public QSortFilterProxyModel -{ -public: - explicit ModSortProxy(QObject *parent = 0) : QSortFilterProxyModel(parent) - { - } - -protected: - bool filterAcceptsRow(int source_row, const QModelIndex & source_parent) const override { - ModFolderModel *model = qobject_cast(sourceModel()); - if(!model) { - return false; - } - const auto &mod = model->at(source_row); - if(mod.name().contains(filterRegExp())) { - return true; - } - if(mod.description().contains(filterRegExp())) { - return true; - } - for(auto & author: mod.authors()) { - if (author.contains(filterRegExp())) { - return true; - } - } - return false; - } - - bool lessThan(const QModelIndex & source_left, const QModelIndex & source_right) const override - { - ModFolderModel *model = qobject_cast(sourceModel()); - if( - !model || - !source_left.isValid() || - !source_right.isValid() || - source_left.column() != source_right.column() - ) { - return QSortFilterProxyModel::lessThan(source_left, source_right); - } - - // we are now guaranteed to have two valid indexes in the same column... we love the provided invariants unconditionally and proceed. - - auto column = (ModFolderModel::Columns) source_left.column(); - bool invert = false; - switch(column) { - // GH-2550 - sort by enabled/disabled - case ModFolderModel::ActiveColumn: { - auto dataL = source_left.data(Qt::CheckStateRole).toBool(); - auto dataR = source_right.data(Qt::CheckStateRole).toBool(); - if(dataL != dataR) { - return dataL > dataR; - } - // fallthrough - invert = sortOrder() == Qt::DescendingOrder; - } - // GH-2722 - sort mod names in a way that discards "The" prefixes - case ModFolderModel::NameColumn: { - auto dataL = model->data(model->index(source_left.row(), ModFolderModel::NameColumn)).toString(); - RemoveThePrefix(dataL); - auto dataR = model->data(model->index(source_right.row(), ModFolderModel::NameColumn)).toString(); - RemoveThePrefix(dataR); - - auto less = dataL.compare(dataR, sortCaseSensitivity()); - if(less != 0) { - return invert ? (less > 0) : (less < 0); - } - // fallthrough - invert = sortOrder() == Qt::DescendingOrder; - } - // GH-2762 - sort versions by parsing them as versions - case ModFolderModel::VersionColumn: { - auto dataL = Version(model->data(model->index(source_left.row(), ModFolderModel::VersionColumn)).toString()); - auto dataR = Version(model->data(model->index(source_right.row(), ModFolderModel::VersionColumn)).toString()); - return invert ? (dataL > dataR) : (dataL < dataR); - } - default: { - return QSortFilterProxyModel::lessThan(source_left, source_right); - } - } - } -}; - -ModFolderPage::ModFolderPage( - BaseInstance *inst, - std::shared_ptr mods, - QString id, - QString iconName, - QString displayName, - QString helpPage, - QWidget *parent -) : - QMainWindow(parent), - ui(new Ui::ModFolderPage) -{ - ui->setupUi(this); - ui->actionsToolbar->insertSpacer(ui->actionView_configs); - - m_inst = inst; - on_RunningState_changed(m_inst && m_inst->isRunning()); - m_mods = mods; - m_id = id; - m_displayName = displayName; - m_iconName = iconName; - m_helpName = helpPage; - m_fileSelectionFilter = "%1 (*.zip *.jar)"; - m_filterModel = new ModSortProxy(this); - m_filterModel->setDynamicSortFilter(true); - m_filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive); - m_filterModel->setSortCaseSensitivity(Qt::CaseInsensitive); - m_filterModel->setSourceModel(m_mods.get()); - m_filterModel->setFilterKeyColumn(-1); - ui->modTreeView->setModel(m_filterModel); - ui->modTreeView->installEventFilter(this); - ui->modTreeView->sortByColumn(1, Qt::AscendingOrder); - ui->modTreeView->setContextMenuPolicy(Qt::CustomContextMenu); - connect(ui->modTreeView, &ModListView::customContextMenuRequested, this, &ModFolderPage::ShowContextMenu); - connect(ui->modTreeView, &ModListView::activated, this, &ModFolderPage::modItemActivated); - - auto smodel = ui->modTreeView->selectionModel(); - connect(smodel, &QItemSelectionModel::currentChanged, this, &ModFolderPage::modCurrent); - connect(ui->filterEdit, &QLineEdit::textChanged, this, &ModFolderPage::on_filterTextChanged); - connect(m_inst, &BaseInstance::runningStatusChanged, this, &ModFolderPage::on_RunningState_changed); -} - -void ModFolderPage::modItemActivated(const QModelIndex&) -{ - if(!m_controlsEnabled) { - return; - } - auto selection = m_filterModel->mapSelectionToSource(ui->modTreeView->selectionModel()->selection()); - m_mods->setModStatus(selection.indexes(), ModFolderModel::Toggle); -} - -QMenu * ModFolderPage::createPopupMenu() -{ - QMenu* filteredMenu = QMainWindow::createPopupMenu(); - filteredMenu->removeAction(ui->actionsToolbar->toggleViewAction() ); - return filteredMenu; -} - -void ModFolderPage::ShowContextMenu(const QPoint& pos) -{ - auto menu = ui->actionsToolbar->createContextMenu(this, tr("Context menu")); - menu->exec(ui->modTreeView->mapToGlobal(pos)); - delete menu; -} - -void ModFolderPage::openedImpl() -{ - m_mods->startWatching(); -} - -void ModFolderPage::closedImpl() -{ - m_mods->stopWatching(); -} - -void ModFolderPage::on_filterTextChanged(const QString& newContents) -{ - m_viewFilter = newContents; - m_filterModel->setFilterFixedString(m_viewFilter); -} - - -CoreModFolderPage::CoreModFolderPage(BaseInstance *inst, std::shared_ptr mods, - QString id, QString iconName, QString displayName, - QString helpPage, QWidget *parent) - : ModFolderPage(inst, mods, id, iconName, displayName, helpPage, parent) -{ -} - -ModFolderPage::~ModFolderPage() -{ - m_mods->stopWatching(); - delete ui; -} - -void ModFolderPage::on_RunningState_changed(bool running) -{ - if(m_controlsEnabled == !running) { - return; - } - m_controlsEnabled = !running; - ui->actionAdd->setEnabled(m_controlsEnabled); - ui->actionDisable->setEnabled(m_controlsEnabled); - ui->actionEnable->setEnabled(m_controlsEnabled); - ui->actionRemove->setEnabled(m_controlsEnabled); -} - -bool ModFolderPage::shouldDisplay() const -{ - return true; -} - -bool CoreModFolderPage::shouldDisplay() const -{ - if (ModFolderPage::shouldDisplay()) - { - auto inst = dynamic_cast(m_inst); - if (!inst) - return true; - auto version = inst->getPackProfile(); - if (!version) - return true; - if(!version->getComponent("net.minecraftforge")) - { - return false; - } - if(!version->getComponent("net.minecraft")) - { - return false; - } - if(version->getComponent("net.minecraft")->getReleaseDateTime() < g_VersionFilterData.legacyCutoffDate) - { - return true; - } - } - return false; -} - -bool ModFolderPage::modListFilter(QKeyEvent *keyEvent) -{ - switch (keyEvent->key()) - { - case Qt::Key_Delete: - on_actionRemove_triggered(); - return true; - case Qt::Key_Plus: - on_actionAdd_triggered(); - return true; - default: - break; - } - return QWidget::eventFilter(ui->modTreeView, keyEvent); -} - -bool ModFolderPage::eventFilter(QObject *obj, QEvent *ev) -{ - if (ev->type() != QEvent::KeyPress) - { - return QWidget::eventFilter(obj, ev); - } - QKeyEvent *keyEvent = static_cast(ev); - if (obj == ui->modTreeView) - return modListFilter(keyEvent); - return QWidget::eventFilter(obj, ev); -} - -void ModFolderPage::on_actionAdd_triggered() -{ - if(!m_controlsEnabled) { - return; - } - auto list = GuiUtil::BrowseForFiles( - m_helpName, - tr("Select %1", - "Select whatever type of files the page contains. Example: 'Loader Mods'") - .arg(m_displayName), - m_fileSelectionFilter.arg(m_displayName), MMC->settings()->get("CentralModsDir").toString(), - this->parentWidget()); - if (!list.empty()) - { - for (auto filename : list) - { - m_mods->installMod(filename); - } - } -} - -void ModFolderPage::on_actionEnable_triggered() -{ - if(!m_controlsEnabled) { - return; - } - auto selection = m_filterModel->mapSelectionToSource(ui->modTreeView->selectionModel()->selection()); - m_mods->setModStatus(selection.indexes(), ModFolderModel::Enable); -} - -void ModFolderPage::on_actionDisable_triggered() -{ - if(!m_controlsEnabled) { - return; - } - auto selection = m_filterModel->mapSelectionToSource(ui->modTreeView->selectionModel()->selection()); - m_mods->setModStatus(selection.indexes(), ModFolderModel::Disable); -} - -void ModFolderPage::on_actionRemove_triggered() -{ - if(!m_controlsEnabled) { - return; - } - auto selection = m_filterModel->mapSelectionToSource(ui->modTreeView->selectionModel()->selection()); - m_mods->deleteMods(selection.indexes()); -} - -void ModFolderPage::on_actionView_configs_triggered() -{ - DesktopServices::openDirectory(m_inst->instanceConfigFolder(), true); -} - -void ModFolderPage::on_actionView_Folder_triggered() -{ - DesktopServices::openDirectory(m_mods->dir().absolutePath(), true); -} - -void ModFolderPage::modCurrent(const QModelIndex ¤t, const QModelIndex &previous) -{ - if (!current.isValid()) - { - ui->frame->clear(); - return; - } - auto sourceCurrent = m_filterModel->mapToSource(current); - int row = sourceCurrent.row(); - Mod &m = m_mods->operator[](row); - ui->frame->updateWithMod(m); -} diff --git a/application/pages/instance/ModFolderPage.h b/application/pages/instance/ModFolderPage.h deleted file mode 100644 index f653a8c0..00000000 --- a/application/pages/instance/ModFolderPage.h +++ /dev/null @@ -1,119 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include "minecraft/MinecraftInstance.h" -#include "pages/BasePage.h" -#include - -class ModFolderModel; -namespace Ui -{ -class ModFolderPage; -} - -class ModFolderPage : public QMainWindow, public BasePage -{ - Q_OBJECT - -public: - explicit ModFolderPage( - BaseInstance *inst, - std::shared_ptr mods, - QString id, - QString iconName, - QString displayName, - QString helpPage = "", - QWidget *parent = 0 - ); - virtual ~ModFolderPage(); - - void setFilter(const QString & filter) - { - m_fileSelectionFilter = filter; - } - - virtual QString displayName() const override - { - return m_displayName; - } - virtual QIcon icon() const override - { - return MMC->getThemedIcon(m_iconName); - } - virtual QString id() const override - { - return m_id; - } - virtual QString helpPage() const override - { - return m_helpName; - } - virtual bool shouldDisplay() const override; - - virtual void openedImpl() override; - virtual void closedImpl() override; -protected: - bool eventFilter(QObject *obj, QEvent *ev) override; - bool modListFilter(QKeyEvent *ev); - QMenu * createPopupMenu() override; - -protected: - BaseInstance *m_inst = nullptr; - -protected: - Ui::ModFolderPage *ui = nullptr; - std::shared_ptr m_mods; - QSortFilterProxyModel *m_filterModel = nullptr; - QString m_iconName; - QString m_id; - QString m_displayName; - QString m_helpName; - QString m_fileSelectionFilter; - QString m_viewFilter; - bool m_controlsEnabled = true; - -public -slots: - void modCurrent(const QModelIndex ¤t, const QModelIndex &previous); - -private -slots: - void modItemActivated(const QModelIndex &index); - void on_filterTextChanged(const QString & newContents); - void on_RunningState_changed(bool running); - void on_actionAdd_triggered(); - void on_actionRemove_triggered(); - void on_actionEnable_triggered(); - void on_actionDisable_triggered(); - void on_actionView_Folder_triggered(); - void on_actionView_configs_triggered(); - void ShowContextMenu(const QPoint &pos); -}; - -class CoreModFolderPage : public ModFolderPage -{ -public: - explicit CoreModFolderPage(BaseInstance *inst, std::shared_ptr mods, QString id, - QString iconName, QString displayName, QString helpPage = "", - QWidget *parent = 0); - virtual ~CoreModFolderPage() - { - } - virtual bool shouldDisplay() const; -}; diff --git a/application/pages/instance/ModFolderPage.ui b/application/pages/instance/ModFolderPage.ui deleted file mode 100644 index 954a0167..00000000 --- a/application/pages/instance/ModFolderPage.ui +++ /dev/null @@ -1,164 +0,0 @@ - - - ModFolderPage - - - - 0 - 0 - 1042 - 501 - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - true - - - - - - - Filter: - - - - - - - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - true - - - QAbstractItemView::DropOnly - - - - - - - - Actions - - - Qt::ToolButtonTextOnly - - - RightToolBarArea - - - false - - - - - - - - - - - - &Add - - - Add mods - - - - - &Remove - - - Remove selected mods - - - - - &Enable - - - Enable selected mods - - - - - &Disable - - - Disable selected mods - - - - - View &Configs - - - Open the 'config' folder in the system file manager. - - - - - View &Folder - - - - - - ModListView - QTreeView -
widgets/ModListView.h
-
- - MCModInfoFrame - QFrame -
widgets/MCModInfoFrame.h
- 1 -
- - WideBar - QToolBar -
widgets/WideBar.h
-
-
- - modTreeView - filterEdit - - - -
diff --git a/application/pages/instance/NotesPage.cpp b/application/pages/instance/NotesPage.cpp deleted file mode 100644 index fa966c91..00000000 --- a/application/pages/instance/NotesPage.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "NotesPage.h" -#include "ui_NotesPage.h" -#include - -NotesPage::NotesPage(BaseInstance *inst, QWidget *parent) - : QWidget(parent), ui(new Ui::NotesPage), m_inst(inst) -{ - ui->setupUi(this); - ui->noteEditor->setText(m_inst->notes()); -} - -NotesPage::~NotesPage() -{ - delete ui; -} - -bool NotesPage::apply() -{ - m_inst->setNotes(ui->noteEditor->toPlainText()); - return true; -} diff --git a/application/pages/instance/NotesPage.h b/application/pages/instance/NotesPage.h deleted file mode 100644 index d0c00ac1..00000000 --- a/application/pages/instance/NotesPage.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include "BaseInstance.h" -#include "pages/BasePage.h" -#include - -namespace Ui -{ -class NotesPage; -} - -class NotesPage : public QWidget, public BasePage -{ - Q_OBJECT - -public: - explicit NotesPage(BaseInstance *inst, QWidget *parent = 0); - virtual ~NotesPage(); - virtual QString displayName() const override - { - return tr("Notes"); - } - virtual QIcon icon() const override - { - auto icon = MMC->getThemedIcon("notes"); - if(icon.isNull()) - icon = MMC->getThemedIcon("news"); - return icon; - } - virtual QString id() const override - { - return "notes"; - } - virtual bool apply() override; - virtual QString helpPage() const override - { - return "Notes"; - } - -private: - Ui::NotesPage *ui; - BaseInstance *m_inst; -}; diff --git a/application/pages/instance/NotesPage.ui b/application/pages/instance/NotesPage.ui deleted file mode 100644 index 67cb261c..00000000 --- a/application/pages/instance/NotesPage.ui +++ /dev/null @@ -1,49 +0,0 @@ - - - NotesPage - - - - 0 - 0 - 731 - 538 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Qt::ScrollBarAlwaysOn - - - true - - - false - - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextEditable|Qt::TextEditorInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - noteEditor - - - - diff --git a/application/pages/instance/OtherLogsPage.cpp b/application/pages/instance/OtherLogsPage.cpp deleted file mode 100644 index b67b84bd..00000000 --- a/application/pages/instance/OtherLogsPage.cpp +++ /dev/null @@ -1,313 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "OtherLogsPage.h" -#include "ui_OtherLogsPage.h" - -#include - -#include "GuiUtil.h" -#include "RecursiveFileSystemWatcher.h" -#include -#include -#include - -OtherLogsPage::OtherLogsPage(QString path, IPathMatcher::Ptr fileFilter, QWidget *parent) - : QWidget(parent), ui(new Ui::OtherLogsPage), m_path(path), m_fileFilter(fileFilter), - m_watcher(new RecursiveFileSystemWatcher(this)) -{ - ui->setupUi(this); - ui->tabWidget->tabBar()->hide(); - - m_watcher->setMatcher(fileFilter); - m_watcher->setRootDir(QDir::current().absoluteFilePath(m_path)); - - connect(m_watcher, &RecursiveFileSystemWatcher::filesChanged, this, &OtherLogsPage::populateSelectLogBox); - populateSelectLogBox(); - - auto findShortcut = new QShortcut(QKeySequence(QKeySequence::Find), this); - connect(findShortcut, &QShortcut::activated, this, &OtherLogsPage::findActivated); - - auto findNextShortcut = new QShortcut(QKeySequence(QKeySequence::FindNext), this); - connect(findNextShortcut, &QShortcut::activated, this, &OtherLogsPage::findNextActivated); - - auto findPreviousShortcut = new QShortcut(QKeySequence(QKeySequence::FindPrevious), this); - connect(findPreviousShortcut, &QShortcut::activated, this, &OtherLogsPage::findPreviousActivated); - - connect(ui->searchBar, &QLineEdit::returnPressed, this, &OtherLogsPage::on_findButton_clicked); -} - -OtherLogsPage::~OtherLogsPage() -{ - delete ui; -} - -void OtherLogsPage::openedImpl() -{ - m_watcher->enable(); -} -void OtherLogsPage::closedImpl() -{ - m_watcher->disable(); -} - -void OtherLogsPage::populateSelectLogBox() -{ - ui->selectLogBox->clear(); - ui->selectLogBox->addItems(m_watcher->files()); - if (m_currentFile.isEmpty()) - { - setControlsEnabled(false); - ui->selectLogBox->setCurrentIndex(-1); - } - else - { - const int index = ui->selectLogBox->findText(m_currentFile); - if (index != -1) - { - ui->selectLogBox->setCurrentIndex(index); - setControlsEnabled(true); - } - else - { - setControlsEnabled(false); - } - } -} - -void OtherLogsPage::on_selectLogBox_currentIndexChanged(const int index) -{ - QString file; - if (index != -1) - { - file = ui->selectLogBox->itemText(index); - } - - if (file.isEmpty() || !QFile::exists(FS::PathCombine(m_path, file))) - { - m_currentFile = QString(); - ui->text->clear(); - setControlsEnabled(false); - } - else - { - m_currentFile = file; - on_btnReload_clicked(); - setControlsEnabled(true); - } -} - -void OtherLogsPage::on_btnReload_clicked() -{ - if(m_currentFile.isEmpty()) - { - setControlsEnabled(false); - return; - } - QFile file(FS::PathCombine(m_path, m_currentFile)); - if (!file.open(QFile::ReadOnly)) - { - setControlsEnabled(false); - ui->btnReload->setEnabled(true); // allow reload - m_currentFile = QString(); - QMessageBox::critical(this, tr("Error"), tr("Unable to open %1 for reading: %2") - .arg(m_currentFile, file.errorString())); - } - else - { - auto setPlainText = [&](const QString & text) - { - QString fontFamily = MMC->settings()->get("ConsoleFont").toString(); - bool conversionOk = false; - int fontSize = MMC->settings()->get("ConsoleFontSize").toInt(&conversionOk); - if(!conversionOk) - { - fontSize = 11; - } - QTextDocument *doc = ui->text->document(); - doc->setDefaultFont(QFont(fontFamily, fontSize)); - ui->text->setPlainText(text); - }; - auto showTooBig = [&]() - { - setPlainText( - tr("The file (%1) is too big. You may want to open it in a viewer optimized " - "for large files.").arg(file.fileName())); - }; - if(file.size() > (1024ll * 1024ll * 12ll)) - { - showTooBig(); - return; - } - QString content; - if(file.fileName().endsWith(".gz")) - { - QByteArray temp; - if(!GZip::unzip(file.readAll(), temp)) - { - setPlainText( - tr("The file (%1) is not readable.").arg(file.fileName())); - return; - } - content = QString::fromUtf8(temp); - } - else - { - content = QString::fromUtf8(file.readAll()); - } - if (content.size() >= 50000000ll) - { - showTooBig(); - return; - } - setPlainText(content); - } -} - -void OtherLogsPage::on_btnPaste_clicked() -{ - GuiUtil::uploadPaste(ui->text->toPlainText(), this); -} - -void OtherLogsPage::on_btnCopy_clicked() -{ - GuiUtil::setClipboardText(ui->text->toPlainText()); -} - -void OtherLogsPage::on_btnDelete_clicked() -{ - if(m_currentFile.isEmpty()) - { - setControlsEnabled(false); - return; - } - if (QMessageBox::question(this, tr("Delete"), - tr("Do you really want to delete %1?").arg(m_currentFile), - QMessageBox::Yes, QMessageBox::No) == QMessageBox::No) - { - return; - } - QFile file(FS::PathCombine(m_path, m_currentFile)); - if (!file.remove()) - { - QMessageBox::critical(this, tr("Error"), tr("Unable to delete %1: %2") - .arg(m_currentFile, file.errorString())); - } -} - - - -void OtherLogsPage::on_btnClean_clicked() -{ - auto toDelete = m_watcher->files(); - if(toDelete.isEmpty()) - { - return; - } - QMessageBox *messageBox = new QMessageBox(this); - messageBox->setWindowTitle(tr("Clean up")); - if(toDelete.size() > 5) - { - messageBox->setText(tr("Do you really want to delete all log files?")); - messageBox->setDetailedText(toDelete.join('\n')); - } - else - { - messageBox->setText(tr("Do you really want to delete these files?\n%1").arg(toDelete.join('\n'))); - } - messageBox->setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); - messageBox->setDefaultButton(QMessageBox::Ok); - messageBox->setTextInteractionFlags(Qt::TextSelectableByMouse); - messageBox->setIcon(QMessageBox::Question); - messageBox->setTextInteractionFlags(Qt::TextBrowserInteraction); - - if (messageBox->exec() != QMessageBox::Ok) - { - return; - } - QStringList failed; - for(auto item: toDelete) - { - QFile file(FS::PathCombine(m_path, item)); - if (!file.remove()) - { - failed.push_back(item); - } - } - if(!failed.empty()) - { - QMessageBox *messageBox = new QMessageBox(this); - messageBox->setWindowTitle(tr("Error")); - if(failed.size() > 5) - { - messageBox->setText(tr("Couldn't delete some files!")); - messageBox->setDetailedText(failed.join('\n')); - } - else - { - messageBox->setText(tr("Couldn't delete some files:\n%1").arg(failed.join('\n'))); - } - messageBox->setStandardButtons(QMessageBox::Ok); - messageBox->setDefaultButton(QMessageBox::Ok); - messageBox->setTextInteractionFlags(Qt::TextSelectableByMouse); - messageBox->setIcon(QMessageBox::Critical); - messageBox->setTextInteractionFlags(Qt::TextBrowserInteraction); - messageBox->exec(); - } -} - - -void OtherLogsPage::setControlsEnabled(const bool enabled) -{ - ui->btnReload->setEnabled(enabled); - ui->btnDelete->setEnabled(enabled); - ui->btnCopy->setEnabled(enabled); - ui->btnPaste->setEnabled(enabled); - ui->text->setEnabled(enabled); - ui->btnClean->setEnabled(enabled); -} - -// FIXME: HACK, use LogView instead? -static void findNext(QPlainTextEdit * _this, const QString& what, bool reverse) -{ - _this->find(what, reverse ? QTextDocument::FindFlag::FindBackward : QTextDocument::FindFlag(0)); -} - -void OtherLogsPage::on_findButton_clicked() -{ - auto modifiers = QApplication::keyboardModifiers(); - bool reverse = modifiers & Qt::ShiftModifier; - findNext(ui->text, ui->searchBar->text(), reverse); -} - -void OtherLogsPage::findNextActivated() -{ - findNext(ui->text, ui->searchBar->text(), false); -} - -void OtherLogsPage::findPreviousActivated() -{ - findNext(ui->text, ui->searchBar->text(), true); -} - -void OtherLogsPage::findActivated() -{ - // focus the search bar if it doesn't have focus - if (!ui->searchBar->hasFocus()) - { - ui->searchBar->setFocus(); - ui->searchBar->selectAll(); - } -} diff --git a/application/pages/instance/OtherLogsPage.h b/application/pages/instance/OtherLogsPage.h deleted file mode 100644 index 7f21c0fa..00000000 --- a/application/pages/instance/OtherLogsPage.h +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include "pages/BasePage.h" -#include -#include - -namespace Ui -{ -class OtherLogsPage; -} - -class RecursiveFileSystemWatcher; - -class OtherLogsPage : public QWidget, public BasePage -{ - Q_OBJECT - -public: - explicit OtherLogsPage(QString path, IPathMatcher::Ptr fileFilter, QWidget *parent = 0); - ~OtherLogsPage(); - - QString id() const override - { - return "logs"; - } - QString displayName() const override - { - return tr("Other logs"); - } - QIcon icon() const override - { - return MMC->getThemedIcon("log"); - } - QString helpPage() const override - { - return "Minecraft-Logs"; - } - void openedImpl() override; - void closedImpl() override; - -private slots: - void populateSelectLogBox(); - void on_selectLogBox_currentIndexChanged(const int index); - void on_btnReload_clicked(); - void on_btnPaste_clicked(); - void on_btnCopy_clicked(); - void on_btnDelete_clicked(); - void on_btnClean_clicked(); - - void on_findButton_clicked(); - void findActivated(); - void findNextActivated(); - void findPreviousActivated(); - -private: - void setControlsEnabled(const bool enabled); - -private: - Ui::OtherLogsPage *ui; - QString m_path; - QString m_currentFile; - IPathMatcher::Ptr m_fileFilter; - RecursiveFileSystemWatcher *m_watcher; -}; diff --git a/application/pages/instance/OtherLogsPage.ui b/application/pages/instance/OtherLogsPage.ui deleted file mode 100644 index 56ff3b62..00000000 --- a/application/pages/instance/OtherLogsPage.ui +++ /dev/null @@ -1,150 +0,0 @@ - - - OtherLogsPage - - - - 0 - 0 - 657 - 538 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 0 - - - - Tab 1 - - - - - - - - - Find - - - - - - - false - - - Qt::ScrollBarAlwaysOn - - - true - - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - - Copy the whole log into the clipboard - - - &Copy - - - - - - - Clear the log - - - Delete - - - - - - - Upload the log to paste.ee - it will stay online for a month - - - Upload - - - - - - - Clear the log - - - Clean - - - - - - - Reload - - - - - - - - 0 - 0 - - - - - - - - - - Search: - - - - - - - - - - - tabWidget - selectLogBox - btnReload - btnCopy - btnPaste - btnDelete - btnClean - text - searchBar - findButton - - - - diff --git a/application/pages/instance/ResourcePackPage.h b/application/pages/instance/ResourcePackPage.h deleted file mode 100644 index 1486bf52..00000000 --- a/application/pages/instance/ResourcePackPage.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include "ModFolderPage.h" -#include "ui_ModFolderPage.h" - -class ResourcePackPage : public ModFolderPage -{ - Q_OBJECT -public: - explicit ResourcePackPage(MinecraftInstance *instance, QWidget *parent = 0) - : ModFolderPage(instance, instance->resourcePackList(), "resourcepacks", - "resourcepacks", tr("Resource packs"), "Resource-packs", parent) - { - ui->actionView_configs->setVisible(false); - } - virtual ~ResourcePackPage() {} - - virtual bool shouldDisplay() const override - { - return !m_inst->traits().contains("no-texturepacks") && - !m_inst->traits().contains("texturepacks"); - } -}; diff --git a/application/pages/instance/ScreenshotsPage.cpp b/application/pages/instance/ScreenshotsPage.cpp deleted file mode 100644 index efa0f9f2..00000000 --- a/application/pages/instance/ScreenshotsPage.cpp +++ /dev/null @@ -1,422 +0,0 @@ -#include "ScreenshotsPage.h" -#include "ui_ScreenshotsPage.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "dialogs/ProgressDialog.h" -#include "dialogs/CustomMessageBox.h" -#include "net/NetJob.h" -#include "screenshots/ImgurUpload.h" -#include "screenshots/ImgurAlbumCreation.h" -#include "tasks/SequentialTask.h" - -#include "RWStorage.h" -#include -#include - -typedef RWStorage SharedIconCache; -typedef std::shared_ptr SharedIconCachePtr; - -class ThumbnailingResult : public QObject -{ - Q_OBJECT -public slots: - inline void emitResultsReady(const QString &path) { emit resultsReady(path); } - inline void emitResultsFailed(const QString &path) { emit resultsFailed(path); } -signals: - void resultsReady(const QString &path); - void resultsFailed(const QString &path); -}; - -class ThumbnailRunnable : public QRunnable -{ -public: - ThumbnailRunnable(QString path, SharedIconCachePtr cache) - { - m_path = path; - m_cache = cache; - } - void run() - { - QFileInfo info(m_path); - if (info.isDir()) - 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); - return; - } - m_resultEmitter.emitResultsFailed(m_path); - } - QString m_path; - SharedIconCachePtr m_cache; - ThumbnailingResult m_resultEmitter; -}; - -// this is about as elegant and well written as a bag of bricks with scribbles done by insane -// asylum patients. -class FilterModel : public QIdentityProxyModel -{ - Q_OBJECT -public: - explicit FilterModel(QObject *parent = 0) : QIdentityProxyModel(parent) - { - m_thumbnailingPool.setMaxThreadCount(4); - m_thumbnailCache = std::make_shared(); - m_thumbnailCache->add("placeholder", MMC->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 QVariant data(const QModelIndex &proxyIndex, int role = Qt::DisplayRole) const - { - auto model = sourceModel(); - if (!model) - return QVariant(); - if (role == Qt::DisplayRole || role == Qt::EditRole) - { - QVariant result = sourceModel()->data(mapToSource(proxyIndex), role); - return result.toString().remove(QRegExp("\\.png$")); - } - if (role == Qt::DecorationRole) - { - QVariant result = - sourceModel()->data(mapToSource(proxyIndex), QFileSystemModel::FilePathRole); - QString filePath = result.toString(); - QIcon temp; - if (!watched.contains(filePath)) - { - ((QFileSystemWatcher &)watcher).addPath(filePath); - ((QSet &)watched).insert(filePath); - } - if (m_thumbnailCache->get(filePath, temp)) - { - return temp; - } - if (!m_failed.contains(filePath)) - { - ((FilterModel *)this)->thumbnailImage(filePath); - } - return (m_thumbnailCache->get("placeholder")); - } - return sourceModel()->data(mapToSource(proxyIndex), role); - } - virtual bool setData(const QModelIndex &index, const QVariant &value, - int role = Qt::EditRole) - { - auto model = sourceModel(); - if (!model) - return false; - if (role != Qt::EditRole) - return false; - // FIXME: this is a workaround for a bug in QFileSystemModel, where it doesn't - // sort after renames - { - ((QFileSystemModel *)model)->setNameFilterDisables(true); - ((QFileSystemModel *)model)->setNameFilterDisables(false); - } - return model->setData(mapToSource(index), value.toString() + ".png", role); - } - -private: - void thumbnailImage(QString path) - { - auto runnable = new ThumbnailRunnable(path, m_thumbnailCache); - connect(&(runnable->m_resultEmitter), SIGNAL(resultsReady(QString)), - SLOT(thumbnailReady(QString))); - connect(&(runnable->m_resultEmitter), SIGNAL(resultsFailed(QString)), - SLOT(thumbnailFailed(QString))); - ((QThreadPool &)m_thumbnailingPool).start(runnable); - } -private slots: - void thumbnailReady(QString path) { emit layoutChanged(); } - void thumbnailFailed(QString path) { m_failed.insert(path); } - void fileChanged(QString filepath) - { - m_thumbnailCache->setStale(filepath); - thumbnailImage(filepath); - // reinsert the path... - watcher.removePath(filepath); - watcher.addPath(filepath); - } - -private: - SharedIconCachePtr m_thumbnailCache; - QThreadPool m_thumbnailingPool; - QSet m_failed; - QSet watched; - QFileSystemWatcher watcher; -}; - -class CenteredEditingDelegate : public QStyledItemDelegate -{ -public: - explicit CenteredEditingDelegate(QObject *parent = 0) : QStyledItemDelegate(parent) {} - virtual ~CenteredEditingDelegate() {} - virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, - const QModelIndex &index) const - { - auto widget = QStyledItemDelegate::createEditor(parent, option, index); - auto foo = dynamic_cast(widget); - if (foo) - { - foo->setAlignment(Qt::AlignHCenter); - foo->setFrame(true); - foo->setMaximumWidth(192); - } - return widget; - } -}; - -ScreenshotsPage::ScreenshotsPage(QString path, QWidget *parent) - : QMainWindow(parent), ui(new Ui::ScreenshotsPage) -{ - m_model.reset(new QFileSystemModel()); - m_filterModel.reset(new FilterModel()); - m_filterModel->setSourceModel(m_model.get()); - m_model->setFilter(QDir::Files | QDir::Writable | QDir::Readable); - m_model->setReadOnly(false); - m_model->setNameFilters({"*.png"}); - m_model->setNameFilterDisables(false); - m_folder = path; - m_valid = FS::ensureFolderPathExists(m_folder); - - ui->setupUi(this); - ui->toolBar->insertSpacer(ui->actionView_Folder); - - ui->listView->setIconSize(QSize(128, 128)); - ui->listView->setGridSize(QSize(192, 160)); - ui->listView->setSpacing(9); - // ui->listView->setUniformItemSizes(true); - ui->listView->setLayoutMode(QListView::Batched); - ui->listView->setViewMode(QListView::IconMode); - ui->listView->setResizeMode(QListView::Adjust); - ui->listView->installEventFilter(this); - ui->listView->setEditTriggers(0); - ui->listView->setItemDelegate(new CenteredEditingDelegate(this)); - ui->listView->setContextMenuPolicy(Qt::CustomContextMenu); - connect(ui->listView, &QListView::customContextMenuRequested, this, &ScreenshotsPage::ShowContextMenu); - connect(ui->listView, SIGNAL(activated(QModelIndex)), SLOT(onItemActivated(QModelIndex))); -} - -bool ScreenshotsPage::eventFilter(QObject *obj, QEvent *evt) -{ - if (obj != ui->listView) - return QWidget::eventFilter(obj, evt); - if (evt->type() != QEvent::KeyPress) - { - return QWidget::eventFilter(obj, evt); - } - QKeyEvent *keyEvent = static_cast(evt); - switch (keyEvent->key()) - { - case Qt::Key_Delete: - on_actionDelete_triggered(); - return true; - case Qt::Key_F2: - on_actionRename_triggered(); - return true; - default: - break; - } - return QWidget::eventFilter(obj, evt); -} - -ScreenshotsPage::~ScreenshotsPage() -{ - delete ui; -} - -void ScreenshotsPage::ShowContextMenu(const QPoint& pos) -{ - auto menu = ui->toolBar->createContextMenu(this, tr("Context menu")); - menu->exec(ui->listView->mapToGlobal(pos)); - delete menu; -} - -QMenu * ScreenshotsPage::createPopupMenu() -{ - QMenu* filteredMenu = QMainWindow::createPopupMenu(); - filteredMenu->removeAction( ui->toolBar->toggleViewAction() ); - return filteredMenu; -} - -void ScreenshotsPage::onItemActivated(QModelIndex index) -{ - if (!index.isValid()) - return; - auto info = m_model->fileInfo(index); - QString fileName = info.absoluteFilePath(); - DesktopServices::openFile(info.absoluteFilePath()); -} - -void ScreenshotsPage::on_actionView_Folder_triggered() -{ - DesktopServices::openDirectory(m_folder, true); -} - -void ScreenshotsPage::on_actionUpload_triggered() -{ - auto selection = ui->listView->selectionModel()->selectedRows(); - if (selection.isEmpty()) - return; - - QList uploaded; - auto job = NetJobPtr(new NetJob("Screenshot Upload")); - if(selection.size() < 2) - { - auto item = selection.at(0); - auto info = m_model->fileInfo(item); - auto screenshot = std::make_shared(info); - job->addNetAction(ImgurUpload::make(screenshot)); - - m_uploadActive = true; - ProgressDialog dialog(this); - if(dialog.execWithTask(job.get()) != QDialog::Accepted) - { - CustomMessageBox::selectable(this, tr("Failed to upload screenshots!"), - tr("Unknown error"), QMessageBox::Warning)->exec(); - } - else - { - auto link = screenshot->m_url; - QClipboard *clipboard = QApplication::clipboard(); - clipboard->setText(link); - CustomMessageBox::selectable( - this, - tr("Upload finished"), - tr("The link to the uploaded screenshot has been placed in your clipboard.") - .arg(link), - QMessageBox::Information - )->exec(); - } - - m_uploadActive = false; - return; - } - - for (auto item : selection) - { - auto info = m_model->fileInfo(item); - auto screenshot = std::make_shared(info); - uploaded.push_back(screenshot); - job->addNetAction(ImgurUpload::make(screenshot)); - } - SequentialTask task; - auto albumTask = NetJobPtr(new NetJob("Imgur Album Creation")); - auto imgurAlbum = ImgurAlbumCreation::make(uploaded); - albumTask->addNetAction(imgurAlbum); - task.addTask(job.unwrap()); - task.addTask(albumTask.unwrap()); - m_uploadActive = true; - ProgressDialog prog(this); - if (prog.execWithTask(&task) != QDialog::Accepted) - { - CustomMessageBox::selectable(this, tr("Failed to upload screenshots!"), - tr("Unknown error"), QMessageBox::Warning)->exec(); - } - else - { - auto link = QString("https://imgur.com/a/%1").arg(imgurAlbum->id()); - QClipboard *clipboard = QApplication::clipboard(); - clipboard->setText(link); - CustomMessageBox::selectable( - this, - tr("Upload finished"), - tr("The link to the uploaded album has been placed in your clipboard.") .arg(link), - QMessageBox::Information - )->exec(); - } - m_uploadActive = false; -} - -void ScreenshotsPage::on_actionDelete_triggered() -{ - auto mbox = CustomMessageBox::selectable( - this, tr("Are you sure?"), tr("This will delete all selected screenshots."), - QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No); - std::unique_ptr box(mbox); - - if (box->exec() != QMessageBox::Yes) - return; - - auto selected = ui->listView->selectionModel()->selectedIndexes(); - for (auto item : selected) - { - m_model->remove(item); - } -} - -void ScreenshotsPage::on_actionRename_triggered() -{ - auto selection = ui->listView->selectionModel()->selectedIndexes(); - if (selection.isEmpty()) - return; - ui->listView->edit(selection[0]); - // TODO: mass renaming -} - -void ScreenshotsPage::openedImpl() -{ - if(!m_valid) - { - m_valid = FS::ensureFolderPathExists(m_folder); - } - if (m_valid) - { - QString path = QDir(m_folder).absolutePath(); - auto idx = m_model->setRootPath(path); - if(idx.isValid()) - { - ui->listView->setModel(m_filterModel.get()); - ui->listView->setRootIndex(m_filterModel->mapFromSource(idx)); - } - else - { - ui->listView->setModel(nullptr); - } - } -} - -#include "ScreenshotsPage.moc" diff --git a/application/pages/instance/ScreenshotsPage.h b/application/pages/instance/ScreenshotsPage.h deleted file mode 100644 index 03a809de..00000000 --- a/application/pages/instance/ScreenshotsPage.h +++ /dev/null @@ -1,89 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include "pages/BasePage.h" -#include - -class QFileSystemModel; -class QIdentityProxyModel; -namespace Ui -{ -class ScreenshotsPage; -} - -struct ScreenShot; -class ScreenshotList; -class ImgurAlbumCreation; - -class ScreenshotsPage : public QMainWindow, public BasePage -{ - Q_OBJECT - -public: - explicit ScreenshotsPage(QString path, QWidget *parent = 0); - virtual ~ScreenshotsPage(); - - virtual void openedImpl() override; - - enum - { - NothingDone = 0x42 - }; - - virtual bool eventFilter(QObject *, QEvent *) override; - virtual QString displayName() const override - { - return tr("Screenshots"); - } - virtual QIcon icon() const override - { - return MMC->getThemedIcon("screenshots"); - } - virtual QString id() const override - { - return "screenshots"; - } - virtual QString helpPage() const override - { - return "Screenshots-management"; - } - virtual bool apply() override - { - return !m_uploadActive; - } - -protected: - QMenu * createPopupMenu() override; - -private slots: - void on_actionUpload_triggered(); - void on_actionDelete_triggered(); - void on_actionRename_triggered(); - void on_actionView_Folder_triggered(); - void onItemActivated(QModelIndex); - void ShowContextMenu(const QPoint &pos); - -private: - Ui::ScreenshotsPage *ui; - std::shared_ptr m_model; - std::shared_ptr m_filterModel; - QString m_folder; - bool m_valid = false; - bool m_uploadActive = false; -}; diff --git a/application/pages/instance/ScreenshotsPage.ui b/application/pages/instance/ScreenshotsPage.ui deleted file mode 100644 index f11f4cd4..00000000 --- a/application/pages/instance/ScreenshotsPage.ui +++ /dev/null @@ -1,87 +0,0 @@ - - - ScreenshotsPage - - - - 0 - 0 - 800 - 600 - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - QAbstractItemView::ExtendedSelection - - - QAbstractItemView::SelectRows - - - - - - - - Actions - - - Qt::ToolButtonTextOnly - - - RightToolBarArea - - - false - - - - - - - - - Upload - - - - - Delete - - - - - Rename - - - - - View Folder - - - - - - WideBar - QToolBar -
widgets/WideBar.h
-
-
- - -
diff --git a/application/pages/instance/ServersPage.cpp b/application/pages/instance/ServersPage.cpp deleted file mode 100644 index d63c6e70..00000000 --- a/application/pages/instance/ServersPage.cpp +++ /dev/null @@ -1,768 +0,0 @@ -#include "ServersPage.h" -#include "ui_ServersPage.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -static const int COLUMN_COUNT = 2; // 3 , TBD: latency and other nice things. - -struct Server -{ - // Types - enum class AcceptsTextures : int - { - ASK = 0, - ALWAYS = 1, - NEVER = 2 - }; - - // Methods - Server() - { - m_name = QObject::tr("Minecraft Server"); - } - Server(const QString & name, const QString & address) - { - m_name = name; - m_address = address; - } - Server(nbt::tag_compound& server) - { - std::string addressStr(server["ip"]); - m_address = QString::fromUtf8(addressStr.c_str()); - - std::string nameStr(server["name"]); - m_name = QString::fromUtf8(nameStr.c_str()); - - if(server["icon"]) - { - std::string base64str(server["icon"]); - m_icon = QByteArray::fromBase64(base64str.c_str()); - } - - if(server.has_key("acceptTextures", nbt::tag_type::Byte)) - { - bool value = server["acceptTextures"].as().get(); - if(value) - { - m_acceptsTextures = AcceptsTextures::ALWAYS; - } - else - { - m_acceptsTextures = AcceptsTextures::NEVER; - } - } - } - - void serialize(nbt::tag_compound& server) - { - server.insert("name", m_name.trimmed().toUtf8().toStdString()); - server.insert("ip", m_address.trimmed().toUtf8().toStdString()); - if(m_icon.size()) - { - server.insert("icon", m_icon.toBase64().toStdString()); - } - if(m_acceptsTextures != AcceptsTextures::ASK) - { - server.insert("acceptTextures", nbt::tag_byte(m_acceptsTextures == AcceptsTextures::ALWAYS)); - } - } - - // Data - persistent and user changeable - QString m_name; - QString m_address; - AcceptsTextures m_acceptsTextures = AcceptsTextures::ASK; - - // Data - persistent and automatically updated - QByteArray m_icon; - - // Data - temporary - bool m_checked = false; - bool m_up = false; - QString m_motd; // https://mctools.org/motd-creator - int m_ping = 0; - int m_currentPlayers = 0; - int m_maxPlayers = 0; -}; - -static std::unique_ptr parseServersDat(const QString& filename) -{ - try - { - QByteArray input = FS::read(filename); - std::istringstream foo(std::string(input.constData(), input.size())); - auto pair = nbt::io::read_compound(foo); - - if(pair.first != "") - return nullptr; - - if(pair.second == nullptr) - return nullptr; - - return std::move(pair.second); - } - catch (...) - { - return nullptr; - } -} - -static bool serializeServerDat(const QString& filename, nbt::tag_compound * levelInfo) -{ - try - { - if(!FS::ensureFilePathExists(filename)) - { - return false; - } - std::ostringstream s; - nbt::io::write_tag("", *levelInfo, s); - QByteArray val(s.str().data(), (int) s.str().size() ); - FS::write(filename, val); - return true; - } - catch (...) - { - return false; - } -} - -class ServersModel: public QAbstractListModel -{ - Q_OBJECT -public: - enum Roles - { - ServerPtrRole = Qt::UserRole, - }; - explicit ServersModel(const QString &path, QObject *parent = 0) - : QAbstractListModel(parent) - { - m_path = path; - m_watcher = new QFileSystemWatcher(this); - connect(m_watcher, &QFileSystemWatcher::fileChanged, this, &ServersModel::fileChanged); - connect(m_watcher, &QFileSystemWatcher::directoryChanged, this, &ServersModel::dirChanged); - m_saveTimer.setSingleShot(true); - m_saveTimer.setInterval(5000); - connect(&m_saveTimer, &QTimer::timeout, this, &ServersModel::save_internal); - } - virtual ~ServersModel() {}; - - void observe() - { - if(m_observed) - { - return; - } - m_observed = true; - - if(!m_loaded) - { - load(); - } - - updateFSObserver(); - } - - void unobserve() - { - if(!m_observed) - { - return; - } - m_observed = false; - - updateFSObserver(); - } - - void lock() - { - if(m_locked) - { - return; - } - saveNow(); - - m_locked = true; - updateFSObserver(); - } - - void unlock() - { - if(!m_locked) - { - return; - } - m_locked = false; - - updateFSObserver(); - } - - int addEmptyRow(int position) - { - if(m_locked) - { - return -1; - } - if(position < 0 || position >= rowCount()) - { - position = rowCount(); - } - beginInsertRows(QModelIndex(), position, position); - m_servers.insert(position, Server()); - endInsertRows(); - scheduleSave(); - return position; - } - - bool removeRow(int row) - { - if(m_locked) - { - return false; - } - if(row < 0 || row >= rowCount()) - { - return false; - } - beginRemoveRows(QModelIndex(), row, row); - m_servers.removeAt(row); - endRemoveRows(); // does absolutely nothing, the selected server stays as the next line... - scheduleSave(); - return true; - } - - bool moveUp(int row) - { - if(m_locked) - { - return false; - } - if(row <= 0) - { - return false; - } - beginMoveRows(QModelIndex(), row, row, QModelIndex(), row - 1); - m_servers.swap(row-1, row); - endMoveRows(); - scheduleSave(); - return true; - } - - bool moveDown(int row) - { - if(m_locked) - { - return false; - } - int count = rowCount(); - if(row + 1 >= count) - { - return false; - } - beginMoveRows(QModelIndex(), row, row, QModelIndex(), row + 2); - m_servers.swap(row+1, row); - endMoveRows(); - scheduleSave(); - return true; - } - - QVariant headerData(int section, Qt::Orientation orientation, int role) const override - { - if (section < 0 || section >= COLUMN_COUNT) - return QVariant(); - - if(role == Qt::DisplayRole) - { - switch(section) - { - case 0: - return tr("Name"); - case 1: - return tr("Address"); - case 2: - return tr("Latency"); - } - } - - return QAbstractListModel::headerData(section, orientation, role); - } - - virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override - { - if (!index.isValid()) - return QVariant(); - - int row = index.row(); - int column = index.column(); - if(column < 0 || column >= COLUMN_COUNT) - return QVariant(); - - if (row < 0 || row >= m_servers.size()) - return QVariant(); - - switch(column) - { - case 0: - switch (role) - { - case Qt::DecorationRole: - { - auto & bytes = m_servers[row].m_icon; - if(bytes.size()) - { - QPixmap px; - if(px.loadFromData(bytes)) - return QIcon(px); - } - return MMC->getThemedIcon("unknown_server"); - } - case Qt::DisplayRole: - return m_servers[row].m_name; - case ServerPtrRole: - return QVariant::fromValue((void *)&m_servers[row]); - default: - return QVariant(); - } - case 1: - switch (role) - { - case Qt::DisplayRole: - return m_servers[row].m_address; - default: - return QVariant(); - } - case 2: - switch (role) - { - case Qt::DisplayRole: - return m_servers[row].m_ping; - default: - return QVariant(); - } - default: - return QVariant(); - } - } - - virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override - { - return m_servers.size(); - } - int columnCount(const QModelIndex & parent) const override - { - return COLUMN_COUNT; - } - - Server * at(int index) - { - if(index < 0 || index >= rowCount()) - { - return nullptr; - } - return &m_servers[index]; - } - - void setName(int row, const QString & name) - { - if(m_locked) - { - return; - } - auto server = at(row); - if(!server || server->m_name == name) - { - return; - } - server->m_name = name; - emit dataChanged(index(row, 0), index(row, COLUMN_COUNT - 1)); - scheduleSave(); - } - - void setAddress(int row, const QString & address) - { - if(m_locked) - { - return; - } - auto server = at(row); - if(!server || server->m_address == address) - { - return; - } - server->m_address = address; - emit dataChanged(index(row, 0), index(row, COLUMN_COUNT - 1)); - scheduleSave(); - } - - void setAcceptsTextures(int row, Server::AcceptsTextures textures) - { - if(m_locked) - { - return; - } - auto server = at(row); - if(!server || server->m_acceptsTextures == textures) - { - return; - } - server->m_acceptsTextures = textures; - emit dataChanged(index(row, 0), index(row, COLUMN_COUNT - 1)); - scheduleSave(); - } - - void load() - { - cancelSave(); - beginResetModel(); - QList servers; - auto serversDat = parseServersDat(serversPath()); - if(serversDat) - { - auto &serversList = serversDat->at("servers").as(); - for(auto iter = serversList.begin(); iter != serversList.end(); iter++) - { - auto & serverTag = (*iter).as(); - Server s(serverTag); - servers.append(s); - } - } - m_servers.swap(servers); - m_loaded = true; - endResetModel(); - } - - void saveNow() - { - if(saveIsScheduled()) - { - save_internal(); - } - } - - -public slots: - void dirChanged(const QString& path) - { - qDebug() << "Changed:" << path; - load(); - } - void fileChanged(const QString& path) - { - qDebug() << "Changed:" << path; - } - -private slots: - void save_internal() - { - cancelSave(); - QString path = serversPath(); - qDebug() << "Server list about to be saved to" << path; - - nbt::tag_compound out; - nbt::tag_list list; - for(auto & server: m_servers) - { - nbt::tag_compound serverNbt; - server.serialize(serverNbt); - list.push_back(std::move(serverNbt)); - } - out.insert("servers", nbt::value(std::move(list))); - - if(!serializeServerDat(path, &out)) - { - qDebug() << "Failed to save server list:" << path << "Will try again."; - scheduleSave(); - } - } - -private: - void scheduleSave() - { - if(!m_loaded) - { - qDebug() << "Server list should never save if it didn't successfully load, path:" << m_path; - return; - } - if(!m_dirty) - { - m_dirty = true; - qDebug() << "Server list save is scheduled for" << m_path; - } - m_saveTimer.start(); - } - - void cancelSave() - { - m_dirty = false; - m_saveTimer.stop(); - } - - bool saveIsScheduled() const - { - return m_dirty; - } - - void updateFSObserver() - { - bool observingFS = m_watcher->directories().contains(m_path); - if(m_observed && m_locked) - { - if(!observingFS) - { - qWarning() << "Will watch" << m_path; - if(!m_watcher->addPath(m_path)) - { - qWarning() << "Failed to start watching" << m_path; - } - } - } - else - { - if(observingFS) - { - qWarning() << "Will stop watching" << m_path; - if(!m_watcher->removePath(m_path)) - { - qWarning() << "Failed to stop watching" << m_path; - } - } - } - } - - QString serversPath() - { - QFileInfo foo(FS::PathCombine(m_path, "servers.dat")); - return foo.filePath(); - } - -private: - bool m_loaded = false; - bool m_locked = false; - bool m_observed = false; - bool m_dirty = false; - QString m_path; - QList m_servers; - QFileSystemWatcher *m_watcher = nullptr; - QTimer m_saveTimer; -}; - -ServersPage::ServersPage(InstancePtr inst, QWidget* parent) - : QMainWindow(parent), ui(new Ui::ServersPage) -{ - ui->setupUi(this); - m_inst = inst; - m_model = new ServersModel(inst->gameRoot(), this); - ui->serversView->setIconSize(QSize(64,64)); - ui->serversView->setModel(m_model); - ui->serversView->setContextMenuPolicy(Qt::CustomContextMenu); - connect(ui->serversView, &QTreeView::customContextMenuRequested, this, &ServersPage::ShowContextMenu); - - auto head = ui->serversView->header(); - if(head->count()) - { - head->setSectionResizeMode(0, QHeaderView::Stretch); - for(int i = 1; i < head->count(); i++) - { - head->setSectionResizeMode(i, QHeaderView::ResizeToContents); - } - } - - auto selectionModel = ui->serversView->selectionModel(); - connect(selectionModel, &QItemSelectionModel::currentChanged, this, &ServersPage::currentChanged); - connect(m_inst.get(), &MinecraftInstance::runningStatusChanged, this, &ServersPage::on_RunningState_changed); - connect(ui->nameLine, &QLineEdit::textEdited, this, &ServersPage::nameEdited); - connect(ui->addressLine, &QLineEdit::textEdited, this, &ServersPage::addressEdited); - connect(ui->resourceComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(resourceIndexChanged(int))); - connect(m_model, &QAbstractItemModel::rowsRemoved, this, &ServersPage::rowsRemoved); - - m_locked = m_inst->isRunning(); - if(m_locked) - { - m_model->lock(); - } - - updateState(); -} - -ServersPage::~ServersPage() -{ - m_model->saveNow(); - delete ui; -} - -void ServersPage::ShowContextMenu(const QPoint& pos) -{ - auto menu = ui->toolBar->createContextMenu(this, tr("Context menu")); - menu->exec(ui->serversView->mapToGlobal(pos)); - delete menu; -} - -QMenu * ServersPage::createPopupMenu() -{ - QMenu* filteredMenu = QMainWindow::createPopupMenu(); - filteredMenu->removeAction( ui->toolBar->toggleViewAction() ); - return filteredMenu; -} - -void ServersPage::on_RunningState_changed(bool running) -{ - if(m_locked == running) - { - return; - } - m_locked = running; - if(m_locked) - { - m_model->lock(); - } - else - { - m_model->unlock(); - } - updateState(); -} - -void ServersPage::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) -{ - int nextServer = -1; - if (!current.isValid()) - { - nextServer = -1; - } - else - { - nextServer = current.row(); - } - currentServer = nextServer; - updateState(); -} - -// WARNING: this is here because currentChanged is not accurate when removing rows. the current item needs to be fixed up after removal. -void ServersPage::rowsRemoved(const QModelIndex& parent, int first, int last) -{ - if(currentServer < first) - { - // current was before the removal - return; - } - else if(currentServer >= first && currentServer <= last) - { - // current got removed... - return; - } - else - { - // current was past the removal - int count = last - first + 1; - currentServer -= count; - } -} - -void ServersPage::nameEdited(const QString& name) -{ - m_model->setName(currentServer, name); -} - -void ServersPage::addressEdited(const QString& address) -{ - m_model->setAddress(currentServer, address); -} - -void ServersPage::resourceIndexChanged(int index) -{ - auto acceptsTextures = Server::AcceptsTextures(index); - m_model->setAcceptsTextures(currentServer, acceptsTextures); -} - -void ServersPage::updateState() -{ - auto server = m_model->at(currentServer); - - bool serverEditEnabled = server && !m_locked; - ui->addressLine->setEnabled(serverEditEnabled); - ui->nameLine->setEnabled(serverEditEnabled); - ui->resourceComboBox->setEnabled(serverEditEnabled); - ui->actionMove_Down->setEnabled(serverEditEnabled); - ui->actionMove_Up->setEnabled(serverEditEnabled); - ui->actionRemove->setEnabled(serverEditEnabled); - ui->actionJoin->setEnabled(serverEditEnabled); - - if(server) - { - ui->addressLine->setText(server->m_address); - ui->nameLine->setText(server->m_name); - ui->resourceComboBox->setCurrentIndex(int(server->m_acceptsTextures)); - } - else - { - ui->addressLine->setText(QString()); - ui->nameLine->setText(QString()); - ui->resourceComboBox->setCurrentIndex(0); - } - - ui->actionAdd->setDisabled(m_locked); -} - -void ServersPage::openedImpl() -{ - m_model->observe(); -} - -void ServersPage::closedImpl() -{ - m_model->unobserve(); -} - -void ServersPage::on_actionAdd_triggered() -{ - int position = m_model->addEmptyRow(currentServer + 1); - if(position < 0) - { - return; - } - // select the new row - ui->serversView->selectionModel()->setCurrentIndex( - m_model->index(position), - QItemSelectionModel::SelectCurrent | QItemSelectionModel::Clear | QItemSelectionModel::Rows - ); - currentServer = position; -} - -void ServersPage::on_actionRemove_triggered() -{ - m_model->removeRow(currentServer); -} - -void ServersPage::on_actionMove_Up_triggered() -{ - if(m_model->moveUp(currentServer)) - { - currentServer --; - } -} - -void ServersPage::on_actionMove_Down_triggered() -{ - if(m_model->moveDown(currentServer)) - { - currentServer ++; - } -} - -void ServersPage::on_actionJoin_triggered() -{ - const auto &address = m_model->at(currentServer)->m_address; - MMC->launch(m_inst, true, nullptr, std::make_shared(MinecraftServerTarget::parse(address))); -} - -#include "ServersPage.moc" diff --git a/application/pages/instance/ServersPage.h b/application/pages/instance/ServersPage.h deleted file mode 100644 index 8c5b7eb8..00000000 --- a/application/pages/instance/ServersPage.h +++ /dev/null @@ -1,94 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#include "pages/BasePage.h" -#include - -namespace Ui -{ -class ServersPage; -} - -struct Server; -class ServersModel; -class MinecraftInstance; - -class ServersPage : public QMainWindow, public BasePage -{ - Q_OBJECT - -public: - explicit ServersPage(InstancePtr inst, QWidget *parent = 0); - virtual ~ServersPage(); - - void openedImpl() override; - void closedImpl() override; - - virtual QString displayName() const override - { - return tr("Servers"); - } - virtual QIcon icon() const override - { - return MMC->getThemedIcon("unknown_server"); - } - virtual QString id() const override - { - return "servers"; - } - virtual QString helpPage() const override - { - return "Servers-management"; - } - -protected: - QMenu * createPopupMenu() override; - -private: - void updateState(); - void scheduleSave(); - bool saveIsScheduled() const; - -private slots: - void currentChanged(const QModelIndex ¤t, const QModelIndex &previous); - void rowsRemoved(const QModelIndex &parent, int first, int last); - - void on_actionAdd_triggered(); - void on_actionRemove_triggered(); - void on_actionMove_Up_triggered(); - void on_actionMove_Down_triggered(); - void on_actionJoin_triggered(); - - void on_RunningState_changed(bool running); - - void nameEdited(const QString & name); - void addressEdited(const QString & address); - void resourceIndexChanged(int index);\ - - void ShowContextMenu(const QPoint &pos); - -private: // data - int currentServer = -1; - bool m_locked = true; - Ui::ServersPage *ui = nullptr; - ServersModel * m_model = nullptr; - InstancePtr m_inst = nullptr; -}; - diff --git a/application/pages/instance/ServersPage.ui b/application/pages/instance/ServersPage.ui deleted file mode 100644 index d89b7cba..00000000 --- a/application/pages/instance/ServersPage.ui +++ /dev/null @@ -1,194 +0,0 @@ - - - ServersPage - - - - 0 - 0 - 1318 - 879 - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - true - - - true - - - QAbstractItemView::SingleSelection - - - QAbstractItemView::SelectRows - - - - 64 - 64 - - - - false - - - false - - - - - - - 6 - - - 6 - - - - - &Name - - - nameLine - - - - - - - - - - Address - - - addressLine - - - - - - - - - - Reso&urces - - - resourceComboBox - - - - - - - - Ask to download - - - - - Always download - - - - - Never download - - - - - - - - - - - Actions - - - Qt::LeftToolBarArea|Qt::RightToolBarArea - - - Qt::ToolButtonTextOnly - - - false - - - RightToolBarArea - - - false - - - - - - - - - - Add - - - - - Remove - - - - - Move Up - - - - - Move Down - - - - - Join - - - - - - WideBar - QToolBar -
widgets/WideBar.h
-
-
- - serversView - nameLine - addressLine - resourceComboBox - - - -
diff --git a/application/pages/instance/TexturePackPage.h b/application/pages/instance/TexturePackPage.h deleted file mode 100644 index 3f04997d..00000000 --- a/application/pages/instance/TexturePackPage.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include "ModFolderPage.h" -#include "ui_ModFolderPage.h" - -class TexturePackPage : public ModFolderPage -{ - Q_OBJECT -public: - explicit TexturePackPage(MinecraftInstance *instance, QWidget *parent = 0) - : ModFolderPage(instance, instance->texturePackList(), "texturepacks", "resourcepacks", - tr("Texture packs"), "Texture-packs", parent) - { - ui->actionView_configs->setVisible(false); - } - virtual ~TexturePackPage() {} - - virtual bool shouldDisplay() const override - { - return m_inst->traits().contains("texturepacks"); - } -}; diff --git a/application/pages/instance/VersionPage.cpp b/application/pages/instance/VersionPage.cpp deleted file mode 100644 index a98bfb7d..00000000 --- a/application/pages/instance/VersionPage.cpp +++ /dev/null @@ -1,642 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "MultiMC.h" - -#include -#include -#include -#include -#include - -#include "VersionPage.h" -#include "ui_VersionPage.h" - -#include "dialogs/CustomMessageBox.h" -#include "dialogs/VersionSelectDialog.h" -#include "dialogs/NewComponentDialog.h" - -#include "dialogs/ProgressDialog.h" -#include - -#include -#include -#include -#include -#include - -#include "minecraft/PackProfile.h" -#include "minecraft/auth/MojangAccountList.h" -#include "minecraft/mod/Mod.h" -#include "icons/IconList.h" -#include "Exception.h" -#include "Version.h" -#include "DesktopServices.h" - -#include -#include - -class IconProxy : public QIdentityProxyModel -{ - Q_OBJECT -public: - - IconProxy(QWidget *parentWidget) : QIdentityProxyModel(parentWidget) - { - connect(parentWidget, &QObject::destroyed, this, &IconProxy::widgetGone); - m_parentWidget = parentWidget; - } - - virtual QVariant data(const QModelIndex &proxyIndex, int role = Qt::DisplayRole) const override - { - QVariant var = QIdentityProxyModel::data(proxyIndex, role); - int column = proxyIndex.column(); - if(column == 0 && role == Qt::DecorationRole && m_parentWidget) - { - if(!var.isNull()) - { - auto string = var.toString(); - if(string == "warning") - { - return MMC->getThemedIcon("status-yellow"); - } - else if(string == "error") - { - return MMC->getThemedIcon("status-bad"); - } - } - return MMC->getThemedIcon("status-good"); - } - return var; - } -private slots: - void widgetGone() - { - m_parentWidget = nullptr; - } - -private: - QWidget *m_parentWidget = nullptr; -}; - -QIcon VersionPage::icon() const -{ - return MMC->icons()->getIcon(m_inst->iconKey()); -} -bool VersionPage::shouldDisplay() const -{ - return true; -} - -QMenu * VersionPage::createPopupMenu() -{ - QMenu* filteredMenu = QMainWindow::createPopupMenu(); - filteredMenu->removeAction( ui->toolBar->toggleViewAction() ); - return filteredMenu; -} - -VersionPage::VersionPage(MinecraftInstance *inst, QWidget *parent) - : QMainWindow(parent), ui(new Ui::VersionPage), m_inst(inst) -{ - ui->setupUi(this); - - ui->toolBar->insertSpacer(ui->actionReload); - - m_profile = m_inst->getPackProfile(); - - reloadPackProfile(); - - auto proxy = new IconProxy(ui->packageView); - proxy->setSourceModel(m_profile.get()); - - m_filterModel = new QSortFilterProxyModel(); - m_filterModel->setDynamicSortFilter(true); - m_filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive); - m_filterModel->setSortCaseSensitivity(Qt::CaseInsensitive); - m_filterModel->setSourceModel(proxy); - m_filterModel->setFilterKeyColumn(-1); - - ui->packageView->setModel(m_filterModel); - ui->packageView->installEventFilter(this); - ui->packageView->setSelectionMode(QAbstractItemView::SingleSelection); - ui->packageView->setContextMenuPolicy(Qt::CustomContextMenu); - - connect(ui->packageView->selectionModel(), &QItemSelectionModel::currentChanged, this, &VersionPage::versionCurrent); - auto smodel = ui->packageView->selectionModel(); - connect(smodel, &QItemSelectionModel::currentChanged, this, &VersionPage::packageCurrent); - - connect(m_profile.get(), &PackProfile::minecraftChanged, this, &VersionPage::updateVersionControls); - controlsEnabled = !m_inst->isRunning(); - updateVersionControls(); - preselect(0); - connect(m_inst, &BaseInstance::runningStatusChanged, this, &VersionPage::updateRunningStatus); - connect(ui->packageView, &ModListView::customContextMenuRequested, this, &VersionPage::showContextMenu); - connect(ui->filterEdit, &QLineEdit::textChanged, this, &VersionPage::onFilterTextChanged); -} - -VersionPage::~VersionPage() -{ - delete ui; -} - -void VersionPage::showContextMenu(const QPoint& pos) -{ - auto menu = ui->toolBar->createContextMenu(this, tr("Context menu")); - menu->exec(ui->packageView->mapToGlobal(pos)); - delete menu; -} - -void VersionPage::packageCurrent(const QModelIndex ¤t, const QModelIndex &previous) -{ - if (!current.isValid()) - { - ui->frame->clear(); - return; - } - int row = current.row(); - auto patch = m_profile->getComponent(row); - auto severity = patch->getProblemSeverity(); - switch(severity) - { - case ProblemSeverity::Warning: - ui->frame->setModText(tr("%1 possibly has issues.").arg(patch->getName())); - break; - case ProblemSeverity::Error: - ui->frame->setModText(tr("%1 has issues!").arg(patch->getName())); - break; - default: - case ProblemSeverity::None: - ui->frame->clear(); - return; - } - - auto &problems = patch->getProblems(); - QString problemOut; - for (auto &problem: problems) - { - if(problem.m_severity == ProblemSeverity::Error) - { - problemOut += tr("Error: "); - } - else if(problem.m_severity == ProblemSeverity::Warning) - { - problemOut += tr("Warning: "); - } - problemOut += problem.m_description; - problemOut += "\n"; - } - ui->frame->setModDescription(problemOut); -} - -void VersionPage::updateRunningStatus(bool running) -{ - if(controlsEnabled == running) { - controlsEnabled = !running; - updateVersionControls(); - } -} - -void VersionPage::updateVersionControls() -{ - // FIXME: this is a dirty hack - auto minecraftVersion = Version(m_profile->getComponentVersion("net.minecraft")); - - bool supportsFabric = minecraftVersion >= Version("1.14"); - ui->actionInstall_Fabric->setEnabled(controlsEnabled && supportsFabric); - - bool supportsForge = minecraftVersion <= Version("1.16.5"); - ui->actionInstall_Forge->setEnabled(controlsEnabled && supportsForge); - - bool supportsLiteLoader = minecraftVersion <= Version("1.12.2"); - ui->actionInstall_LiteLoader->setEnabled(controlsEnabled && supportsLiteLoader); - - updateButtons(); -} - -void VersionPage::updateButtons(int row) -{ - if(row == -1) - row = currentRow(); - auto patch = m_profile->getComponent(row); - ui->actionRemove->setEnabled(controlsEnabled && patch && patch->isRemovable()); - ui->actionMove_down->setEnabled(controlsEnabled && patch && patch->isMoveable()); - ui->actionMove_up->setEnabled(controlsEnabled && patch && patch->isMoveable()); - ui->actionChange_version->setEnabled(controlsEnabled && patch && patch->isVersionChangeable()); - ui->actionEdit->setEnabled(controlsEnabled && patch && patch->isCustom()); - ui->actionCustomize->setEnabled(controlsEnabled && patch && patch->isCustomizable()); - ui->actionRevert->setEnabled(controlsEnabled && patch && patch->isRevertible()); - ui->actionDownload_All->setEnabled(controlsEnabled); - ui->actionAdd_Empty->setEnabled(controlsEnabled); - ui->actionReload->setEnabled(controlsEnabled); - ui->actionInstall_mods->setEnabled(controlsEnabled); - ui->actionReplace_Minecraft_jar->setEnabled(controlsEnabled); - ui->actionAdd_to_Minecraft_jar->setEnabled(controlsEnabled); -} - -bool VersionPage::reloadPackProfile() -{ - try - { - m_profile->reload(Net::Mode::Online); - return true; - } - catch (const Exception &e) - { - QMessageBox::critical(this, tr("Error"), e.cause()); - return false; - } - catch (...) - { - QMessageBox::critical( - this, tr("Error"), - tr("Couldn't load the instance profile.")); - return false; - } -} - -void VersionPage::on_actionReload_triggered() -{ - reloadPackProfile(); - m_container->refreshContainer(); -} - -void VersionPage::on_actionRemove_triggered() -{ - if (ui->packageView->currentIndex().isValid()) - { - // FIXME: use actual model, not reloading. - if (!m_profile->remove(ui->packageView->currentIndex().row())) - { - QMessageBox::critical(this, tr("Error"), tr("Couldn't remove file")); - } - } - updateButtons(); - reloadPackProfile(); - m_container->refreshContainer(); -} - -void VersionPage::on_actionInstall_mods_triggered() -{ - if(m_container) - { - m_container->selectPage("mods"); - } -} - -void VersionPage::on_actionAdd_to_Minecraft_jar_triggered() -{ - auto list = GuiUtil::BrowseForFiles("jarmod", tr("Select jar mods"), tr("Minecraft.jar mods (*.zip *.jar)"), MMC->settings()->get("CentralModsDir").toString(), this->parentWidget()); - if(!list.empty()) - { - m_profile->installJarMods(list); - } - updateButtons(); -} - -void VersionPage::on_actionReplace_Minecraft_jar_triggered() -{ - auto jarPath = GuiUtil::BrowseForFile("jar", tr("Select jar"), tr("Minecraft.jar replacement (*.jar)"), MMC->settings()->get("CentralModsDir").toString(), this->parentWidget()); - if(!jarPath.isEmpty()) - { - m_profile->installCustomJar(jarPath); - } - updateButtons(); -} - -void VersionPage::on_actionMove_up_triggered() -{ - try - { - m_profile->move(currentRow(), PackProfile::MoveUp); - } - catch (const Exception &e) - { - QMessageBox::critical(this, tr("Error"), e.cause()); - } - updateButtons(); -} - -void VersionPage::on_actionMove_down_triggered() -{ - try - { - m_profile->move(currentRow(), PackProfile::MoveDown); - } - catch (const Exception &e) - { - QMessageBox::critical(this, tr("Error"), e.cause()); - } - updateButtons(); -} - -void VersionPage::on_actionChange_version_triggered() -{ - auto versionRow = currentRow(); - if(versionRow == -1) - { - return; - } - auto patch = m_profile->getComponent(versionRow); - auto name = patch->getName(); - auto list = patch->getVersionList(); - if(!list) - { - return; - } - auto uid = list->uid(); - // FIXME: this is a horrible HACK. Get version filtering information from the actual metadata... - if(uid == "net.minecraftforge") - { - on_actionInstall_Forge_triggered(); - return; - } - else if (uid == "com.mumfrey.liteloader") - { - on_actionInstall_LiteLoader_triggered(); - return; - } - VersionSelectDialog vselect(list.get(), tr("Change %1 version").arg(name), this); - if (uid == "net.fabricmc.intermediary") - { - vselect.setEmptyString(tr("No intermediary mappings versions are currently available.")); - vselect.setEmptyErrorString(tr("Couldn't load or download the intermediary mappings version lists!")); - vselect.setExactFilter(BaseVersionList::ParentVersionRole, m_profile->getComponentVersion("net.minecraft")); - } - auto currentVersion = patch->getVersion(); - if(!currentVersion.isEmpty()) - { - vselect.setCurrentVersion(currentVersion); - } - if (!vselect.exec() || !vselect.selectedVersion()) - return; - - qDebug() << "Change" << uid << "to" << vselect.selectedVersion()->descriptor(); - bool important = false; - if(uid == "net.minecraft") - { - important = true; - } - m_profile->setComponentVersion(uid, vselect.selectedVersion()->descriptor(), important); - m_profile->resolve(Net::Mode::Online); - m_container->refreshContainer(); -} - -void VersionPage::on_actionDownload_All_triggered() -{ - if (!MMC->accounts()->anyAccountIsValid()) - { - CustomMessageBox::selectable( - this, tr("Error"), - tr("MultiMC cannot download Minecraft or update instances unless you have at least " - "one account added.\nPlease add your Mojang or Minecraft account."), - QMessageBox::Warning)->show(); - return; - } - - auto updateTask = m_inst->createUpdateTask(Net::Mode::Online); - if (!updateTask) - { - return; - } - ProgressDialog tDialog(this); - connect(updateTask.get(), SIGNAL(failed(QString)), SLOT(onGameUpdateError(QString))); - // FIXME: unused return value - tDialog.execWithTask(updateTask.get()); - updateButtons(); - m_container->refreshContainer(); -} - -void VersionPage::on_actionInstall_Forge_triggered() -{ - auto vlist = ENV.metadataIndex()->get("net.minecraftforge"); - if(!vlist) - { - return; - } - VersionSelectDialog vselect(vlist.get(), tr("Select Forge version"), this); - vselect.setExactFilter(BaseVersionList::ParentVersionRole, m_profile->getComponentVersion("net.minecraft")); - vselect.setEmptyString(tr("No Forge versions are currently available for Minecraft ") + m_profile->getComponentVersion("net.minecraft")); - vselect.setEmptyErrorString(tr("Couldn't load or download the Forge version lists!")); - - auto currentVersion = m_profile->getComponentVersion("net.minecraftforge"); - if(!currentVersion.isEmpty()) - { - vselect.setCurrentVersion(currentVersion); - } - - if (vselect.exec() && vselect.selectedVersion()) - { - auto vsn = vselect.selectedVersion(); - m_profile->setComponentVersion("net.minecraftforge", vsn->descriptor()); - m_profile->resolve(Net::Mode::Online); - // m_profile->installVersion(); - preselect(m_profile->rowCount(QModelIndex())-1); - m_container->refreshContainer(); - } -} - -void VersionPage::on_actionInstall_Fabric_triggered() -{ - auto vlist = ENV.metadataIndex()->get("net.fabricmc.fabric-loader"); - if(!vlist) - { - return; - } - VersionSelectDialog vselect(vlist.get(), tr("Select Fabric Loader version"), this); - vselect.setEmptyString(tr("No Fabric Loader versions are currently available.")); - vselect.setEmptyErrorString(tr("Couldn't load or download the Fabric Loader version lists!")); - - auto currentVersion = m_profile->getComponentVersion("net.fabricmc.fabric-loader"); - if(!currentVersion.isEmpty()) - { - vselect.setCurrentVersion(currentVersion); - } - - if (vselect.exec() && vselect.selectedVersion()) - { - auto vsn = vselect.selectedVersion(); - m_profile->setComponentVersion("net.fabricmc.fabric-loader", vsn->descriptor()); - m_profile->resolve(Net::Mode::Online); - preselect(m_profile->rowCount(QModelIndex())-1); - m_container->refreshContainer(); - } -} - -void VersionPage::on_actionAdd_Empty_triggered() -{ - NewComponentDialog compdialog(QString(), QString(), this); - QStringList blacklist; - for(int i = 0; i < m_profile->rowCount(); i++) - { - auto comp = m_profile->getComponent(i); - blacklist.push_back(comp->getID()); - } - compdialog.setBlacklist(blacklist); - if (compdialog.exec()) - { - qDebug() << "name:" << compdialog.name(); - qDebug() << "uid:" << compdialog.uid(); - m_profile->installEmpty(compdialog.uid(), compdialog.name()); - } -} - -void VersionPage::on_actionInstall_LiteLoader_triggered() -{ - auto vlist = ENV.metadataIndex()->get("com.mumfrey.liteloader"); - if(!vlist) - { - return; - } - VersionSelectDialog vselect(vlist.get(), tr("Select LiteLoader version"), this); - vselect.setExactFilter(BaseVersionList::ParentVersionRole, m_profile->getComponentVersion("net.minecraft")); - vselect.setEmptyString(tr("No LiteLoader versions are currently available for Minecraft ") + m_profile->getComponentVersion("net.minecraft")); - vselect.setEmptyErrorString(tr("Couldn't load or download the LiteLoader version lists!")); - - auto currentVersion = m_profile->getComponentVersion("com.mumfrey.liteloader"); - if(!currentVersion.isEmpty()) - { - vselect.setCurrentVersion(currentVersion); - } - - if (vselect.exec() && vselect.selectedVersion()) - { - auto vsn = vselect.selectedVersion(); - m_profile->setComponentVersion("com.mumfrey.liteloader", vsn->descriptor()); - m_profile->resolve(Net::Mode::Online); - // m_profile->installVersion(vselect.selectedVersion()); - preselect(m_profile->rowCount(QModelIndex())-1); - m_container->refreshContainer(); - } -} - -void VersionPage::on_actionLibrariesFolder_triggered() -{ - DesktopServices::openDirectory(m_inst->getLocalLibraryPath(), true); -} - -void VersionPage::on_actionMinecraftFolder_triggered() -{ - DesktopServices::openDirectory(m_inst->gameRoot(), true); -} - -void VersionPage::versionCurrent(const QModelIndex ¤t, const QModelIndex &previous) -{ - currentIdx = current.row(); - updateButtons(currentIdx); -} - -void VersionPage::preselect(int row) -{ - if(row < 0) - { - row = 0; - } - if(row >= m_profile->rowCount(QModelIndex())) - { - row = m_profile->rowCount(QModelIndex()) - 1; - } - if(row < 0) - { - return; - } - auto model_index = m_profile->index(row); - ui->packageView->selectionModel()->select(model_index, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); - updateButtons(row); -} - -void VersionPage::onGameUpdateError(QString error) -{ - CustomMessageBox::selectable(this, tr("Error updating instance"), error, QMessageBox::Warning)->show(); -} - -Component * VersionPage::current() -{ - auto row = currentRow(); - if(row < 0) - { - return nullptr; - } - return m_profile->getComponent(row); -} - -int VersionPage::currentRow() -{ - if (ui->packageView->selectionModel()->selectedRows().isEmpty()) - { - return -1; - } - return ui->packageView->selectionModel()->selectedRows().first().row(); -} - -void VersionPage::on_actionCustomize_triggered() -{ - auto version = currentRow(); - if(version == -1) - { - return; - } - auto patch = m_profile->getComponent(version); - if(!patch->getVersionFile()) - { - // TODO: wait for the update task to finish here... - return; - } - if(!m_profile->customize(version)) - { - // TODO: some error box here - } - updateButtons(); - preselect(currentIdx); -} - -void VersionPage::on_actionEdit_triggered() -{ - auto version = current(); - if(!version) - { - return; - } - auto filename = version->getFilename(); - if(!QFileInfo::exists(filename)) - { - qWarning() << "file" << filename << "can't be opened for editing, doesn't exist!"; - return; - } - MMC->openJsonEditor(filename); -} - -void VersionPage::on_actionRevert_triggered() -{ - auto version = currentRow(); - if(version == -1) - { - return; - } - if(!m_profile->revertToBase(version)) - { - // TODO: some error box here - } - updateButtons(); - preselect(currentIdx); - m_container->refreshContainer(); -} - -void VersionPage::onFilterTextChanged(const QString &newContents) -{ - m_filterModel->setFilterFixedString(newContents); -} - -#include "VersionPage.moc" - diff --git a/application/pages/instance/VersionPage.h b/application/pages/instance/VersionPage.h deleted file mode 100644 index b5b4a6f5..00000000 --- a/application/pages/instance/VersionPage.h +++ /dev/null @@ -1,104 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include "minecraft/MinecraftInstance.h" -#include "minecraft/PackProfile.h" -#include "pages/BasePage.h" - -namespace Ui -{ -class VersionPage; -} - -class VersionPage : public QMainWindow, public BasePage -{ - Q_OBJECT - -public: - explicit VersionPage(MinecraftInstance *inst, QWidget *parent = 0); - virtual ~VersionPage(); - virtual QString displayName() const override - { - return tr("Version"); - } - virtual QIcon icon() const override; - virtual QString id() const override - { - return "version"; - } - virtual QString helpPage() const override - { - return "Instance-Version"; - } - virtual bool shouldDisplay() const override; - -private slots: - void on_actionChange_version_triggered(); - void on_actionInstall_Forge_triggered(); - void on_actionInstall_Fabric_triggered(); - void on_actionAdd_Empty_triggered(); - void on_actionInstall_LiteLoader_triggered(); - void on_actionReload_triggered(); - void on_actionRemove_triggered(); - void on_actionMove_up_triggered(); - void on_actionMove_down_triggered(); - void on_actionAdd_to_Minecraft_jar_triggered(); - void on_actionReplace_Minecraft_jar_triggered(); - void on_actionRevert_triggered(); - void on_actionEdit_triggered(); - void on_actionInstall_mods_triggered(); - void on_actionCustomize_triggered(); - void on_actionDownload_All_triggered(); - - void on_actionMinecraftFolder_triggered(); - void on_actionLibrariesFolder_triggered(); - - void updateVersionControls(); - -private: - Component * current(); - int currentRow(); - void updateButtons(int row = -1); - void preselect(int row = 0); - int doUpdate(); - -protected: - QMenu * createPopupMenu() override; - - /// FIXME: this shouldn't be necessary! - bool reloadPackProfile(); - -private: - Ui::VersionPage *ui; - QSortFilterProxyModel *m_filterModel; - std::shared_ptr m_profile; - MinecraftInstance *m_inst; - int currentIdx = 0; - bool controlsEnabled = false; - -public slots: - void versionCurrent(const QModelIndex ¤t, const QModelIndex &previous); - -private slots: - void updateRunningStatus(bool running); - void onGameUpdateError(QString error); - void packageCurrent(const QModelIndex ¤t, const QModelIndex &previous); - void showContextMenu(const QPoint &pos); - void onFilterTextChanged(const QString & newContents); -}; diff --git a/application/pages/instance/VersionPage.ui b/application/pages/instance/VersionPage.ui deleted file mode 100644 index 84d06e2e..00000000 --- a/application/pages/instance/VersionPage.ui +++ /dev/null @@ -1,285 +0,0 @@ - - - VersionPage - - - - 0 - 0 - 961 - 1091 - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - Qt::ScrollBarAlwaysOn - - - Qt::ScrollBarAlwaysOff - - - false - - - false - - - true - - - - - - - - - true - - - - - - - Filter: - - - - - - - - - - 0 - 0 - - - - - - - - - - - Actions - - - Qt::LeftToolBarArea|Qt::RightToolBarArea - - - Qt::ToolButtonTextOnly - - - false - - - RightToolBarArea - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - Change version - - - Change version of the selected package. - - - - - Move up - - - Make the selected package apply sooner. - - - - - Move down - - - Make the selected package apply later. - - - - - Remove - - - Remove selected package from the instance. - - - - - Customize - - - Customize selected package. - - - - - Edit - - - Edit selected package. - - - - - Revert - - - Revert the selected package to default. - - - - - Install Forge - - - Install the Minecraft Forge package. - - - - - Install Fabric - - - Install the Fabric Loader package. - - - - - Install LiteLoader - - - Install the LiteLoader package. - - - - - Install mods - - - Install normal mods. - - - - - Add to Minecraft.jar - - - Add a mod into the Minecraft jar file. - - - - - Replace Minecraft.jar - - - - - Add Empty - - - Add an empty custom package. - - - - - Reload - - - Reload all packages. - - - - - Download All - - - Download the files needed to launch the instance now. - - - - - Open .minecraft - - - Open the instance's .minecraft folder. - - - - - Open libraries - - - Open the instance's local libraries folder. - - - - - - ModListView - QTreeView -
widgets/ModListView.h
-
- - MCModInfoFrame - QFrame -
widgets/MCModInfoFrame.h
- 1 -
- - WideBar - QToolBar -
widgets/WideBar.h
-
-
- - -
diff --git a/application/pages/instance/WorldListPage.cpp b/application/pages/instance/WorldListPage.cpp deleted file mode 100644 index 119cff3e..00000000 --- a/application/pages/instance/WorldListPage.cpp +++ /dev/null @@ -1,408 +0,0 @@ -/* Copyright 2015-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "WorldListPage.h" -#include "ui_WorldListPage.h" -#include "minecraft/WorldList.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "MultiMC.h" -#include -#include -#include - -class WorldListProxyModel : public QSortFilterProxyModel -{ - Q_OBJECT - -public: - WorldListProxyModel(QObject *parent) : QSortFilterProxyModel(parent) {} - - virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const - { - QModelIndex sourceIndex = mapToSource(index); - - if (index.column() == 0 && role == Qt::DecorationRole) - { - WorldList *worlds = qobject_cast(sourceModel()); - auto iconFile = worlds->data(sourceIndex, WorldList::IconFileRole).toString(); - if(iconFile.isNull()) { - // NOTE: Minecraft uses the same placeholder for servers AND worlds - return MMC->getThemedIcon("unknown_server"); - } - return QIcon(iconFile); - } - - return sourceIndex.data(role); - } -}; - - -WorldListPage::WorldListPage(BaseInstance *inst, std::shared_ptr worlds, QWidget *parent) - : QMainWindow(parent), m_inst(inst), ui(new Ui::WorldListPage), m_worlds(worlds) -{ - ui->setupUi(this); - - ui->toolBar->insertSpacer(ui->actionRefresh); - - WorldListProxyModel * proxy = new WorldListProxyModel(this); - proxy->setSortCaseSensitivity(Qt::CaseInsensitive); - proxy->setSourceModel(m_worlds.get()); - ui->worldTreeView->setSortingEnabled(true); - ui->worldTreeView->setModel(proxy); - ui->worldTreeView->installEventFilter(this); - ui->worldTreeView->setContextMenuPolicy(Qt::CustomContextMenu); - ui->worldTreeView->setIconSize(QSize(64,64)); - connect(ui->worldTreeView, &QTreeView::customContextMenuRequested, this, &WorldListPage::ShowContextMenu); - - auto head = ui->worldTreeView->header(); - head->setSectionResizeMode(0, QHeaderView::Stretch); - head->setSectionResizeMode(1, QHeaderView::ResizeToContents); - - connect(ui->worldTreeView->selectionModel(), &QItemSelectionModel::currentChanged, this, &WorldListPage::worldChanged); - worldChanged(QModelIndex(), QModelIndex()); -} - -void WorldListPage::openedImpl() -{ - m_worlds->startWatching(); -} - -void WorldListPage::closedImpl() -{ - m_worlds->stopWatching(); -} - -WorldListPage::~WorldListPage() -{ - m_worlds->stopWatching(); - delete ui; -} - -void WorldListPage::ShowContextMenu(const QPoint& pos) -{ - auto menu = ui->toolBar->createContextMenu(this, tr("Context menu")); - menu->exec(ui->worldTreeView->mapToGlobal(pos)); - delete menu; -} - -QMenu * WorldListPage::createPopupMenu() -{ - QMenu* filteredMenu = QMainWindow::createPopupMenu(); - filteredMenu->removeAction( ui->toolBar->toggleViewAction() ); - return filteredMenu; -} - -bool WorldListPage::shouldDisplay() const -{ - return true; -} - -bool WorldListPage::worldListFilter(QKeyEvent *keyEvent) -{ - switch (keyEvent->key()) - { - case Qt::Key_Delete: - on_actionRemove_triggered(); - return true; - default: - break; - } - return QWidget::eventFilter(ui->worldTreeView, keyEvent); -} - -bool WorldListPage::eventFilter(QObject *obj, QEvent *ev) -{ - if (ev->type() != QEvent::KeyPress) - { - return QWidget::eventFilter(obj, ev); - } - QKeyEvent *keyEvent = static_cast(ev); - if (obj == ui->worldTreeView) - return worldListFilter(keyEvent); - return QWidget::eventFilter(obj, ev); -} - -void WorldListPage::on_actionRemove_triggered() -{ - auto proxiedIndex = getSelectedWorld(); - - if(!proxiedIndex.isValid()) - return; - - auto result = QMessageBox::question(this, - tr("Are you sure?"), - tr("This will remove the selected world permenantly.\n" - "The world will be gone forever (A LONG TIME).\n" - "\n" - "Do you want to continue?")); - if(result != QMessageBox::Yes) - { - return; - } - m_worlds->stopWatching(); - m_worlds->deleteWorld(proxiedIndex.row()); - m_worlds->startWatching(); -} - -void WorldListPage::on_actionView_Folder_triggered() -{ - DesktopServices::openDirectory(m_worlds->dir().absolutePath(), true); -} - -void WorldListPage::on_actionDatapacks_triggered() -{ - QModelIndex index = getSelectedWorld(); - - if (!index.isValid()) - { - return; - } - - if(!worldSafetyNagQuestion()) - return; - - auto fullPath = m_worlds->data(index, WorldList::FolderRole).toString(); - - DesktopServices::openDirectory(FS::PathCombine(fullPath, "datapacks"), true); -} - - -void WorldListPage::on_actionReset_Icon_triggered() -{ - auto proxiedIndex = getSelectedWorld(); - - if(!proxiedIndex.isValid()) - return; - - if(m_worlds->resetIcon(proxiedIndex.row())) { - ui->actionReset_Icon->setEnabled(false); - } -} - - -QModelIndex WorldListPage::getSelectedWorld() -{ - auto index = ui->worldTreeView->selectionModel()->currentIndex(); - - auto proxy = (QSortFilterProxyModel *) ui->worldTreeView->model(); - return proxy->mapToSource(index); -} - -void WorldListPage::on_actionCopy_Seed_triggered() -{ - QModelIndex index = getSelectedWorld(); - - if (!index.isValid()) - { - return; - } - int64_t seed = m_worlds->data(index, WorldList::SeedRole).toLongLong(); - MMC->clipboard()->setText(QString::number(seed)); -} - -void WorldListPage::on_actionMCEdit_triggered() -{ - if(m_mceditStarting) - return; - - auto mcedit = MMC->mcedit(); - - const QString mceditPath = mcedit->path(); - - QModelIndex index = getSelectedWorld(); - - if (!index.isValid()) - { - return; - } - - if(!worldSafetyNagQuestion()) - return; - - auto fullPath = m_worlds->data(index, WorldList::FolderRole).toString(); - - auto program = mcedit->getProgramPath(); - if(program.size()) - { -#ifdef Q_OS_WIN32 - if(!QProcess::startDetached(program, {fullPath}, mceditPath)) - { - mceditError(); - } -#else - m_mceditProcess.reset(new LoggedProcess()); - m_mceditProcess->setDetachable(true); - connect(m_mceditProcess.get(), &LoggedProcess::stateChanged, this, &WorldListPage::mceditState); - m_mceditProcess->start(program, {fullPath}); - m_mceditProcess->setWorkingDirectory(mceditPath); - m_mceditStarting = true; -#endif - } - else - { - QMessageBox::warning( - this->parentWidget(), - tr("No MCEdit found or set up!"), - tr("You do not have MCEdit set up or it was moved.\nYou can set it up in the global settings.") - ); - } -} - -void WorldListPage::mceditError() -{ - QMessageBox::warning( - this->parentWidget(), - tr("MCEdit failed to start!"), - tr("MCEdit failed to start.\nIt may be necessary to reinstall it.") - ); -} - -void WorldListPage::mceditState(LoggedProcess::State state) -{ - bool failed = false; - switch(state) - { - case LoggedProcess::NotRunning: - case LoggedProcess::Starting: - return; - case LoggedProcess::FailedToStart: - case LoggedProcess::Crashed: - case LoggedProcess::Aborted: - { - failed = true; - } - case LoggedProcess::Running: - case LoggedProcess::Finished: - { - m_mceditStarting = false; - break; - } - } - if(failed) - { - mceditError(); - } -} - -void WorldListPage::worldChanged(const QModelIndex ¤t, const QModelIndex &previous) -{ - QModelIndex index = getSelectedWorld(); - bool enable = index.isValid(); - ui->actionCopy_Seed->setEnabled(enable); - ui->actionMCEdit->setEnabled(enable); - ui->actionRemove->setEnabled(enable); - ui->actionCopy->setEnabled(enable); - ui->actionRename->setEnabled(enable); - ui->actionDatapacks->setEnabled(enable); - bool hasIcon = !index.data(WorldList::IconFileRole).isNull(); - ui->actionReset_Icon->setEnabled(enable && hasIcon); -} - -void WorldListPage::on_actionAdd_triggered() -{ - auto list = GuiUtil::BrowseForFiles( - displayName(), - tr("Select a Minecraft world zip"), - tr("Minecraft World Zip File (*.zip)"), QString(), this->parentWidget()); - if (!list.empty()) - { - m_worlds->stopWatching(); - for (auto filename : list) - { - m_worlds->installWorld(QFileInfo(filename)); - } - m_worlds->startWatching(); - } -} - -bool WorldListPage::isWorldSafe(QModelIndex) -{ - return !m_inst->isRunning(); -} - -bool WorldListPage::worldSafetyNagQuestion() -{ - if(!isWorldSafe(getSelectedWorld())) - { - auto result = QMessageBox::question(this, tr("Copy World"), tr("Changing a world while Minecraft is running is potentially unsafe.\nDo you wish to proceed?")); - if(result == QMessageBox::No) - { - return false; - } - } - return true; -} - - -void WorldListPage::on_actionCopy_triggered() -{ - QModelIndex index = getSelectedWorld(); - if (!index.isValid()) - { - return; - } - - if(!worldSafetyNagQuestion()) - return; - - auto worldVariant = m_worlds->data(index, WorldList::ObjectRole); - auto world = (World *) worldVariant.value(); - bool ok = false; - QString name = QInputDialog::getText(this, tr("World name"), tr("Enter a new name for the copy."), QLineEdit::Normal, world->name(), &ok); - - if (ok && name.length() > 0) - { - world->install(m_worlds->dir().absolutePath(), name); - } -} - -void WorldListPage::on_actionRename_triggered() -{ - QModelIndex index = getSelectedWorld(); - if (!index.isValid()) - { - return; - } - - if(!worldSafetyNagQuestion()) - return; - - auto worldVariant = m_worlds->data(index, WorldList::ObjectRole); - auto world = (World *) worldVariant.value(); - - bool ok = false; - QString name = QInputDialog::getText(this, tr("World name"), tr("Enter a new world name."), QLineEdit::Normal, world->name(), &ok); - - if (ok && name.length() > 0) - { - world->rename(name); - } -} - -void WorldListPage::on_actionRefresh_triggered() -{ - m_worlds->update(); -} - -#include "WorldListPage.moc" diff --git a/application/pages/instance/WorldListPage.h b/application/pages/instance/WorldListPage.h deleted file mode 100644 index 4fc9aa09..00000000 --- a/application/pages/instance/WorldListPage.h +++ /dev/null @@ -1,99 +0,0 @@ -/* Copyright 2015-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include "minecraft/MinecraftInstance.h" -#include "pages/BasePage.h" -#include -#include - -class WorldList; -namespace Ui -{ -class WorldListPage; -} - -class WorldListPage : public QMainWindow, public BasePage -{ - Q_OBJECT - -public: - explicit WorldListPage( - BaseInstance *inst, - std::shared_ptr worlds, - QWidget *parent = 0 - ); - virtual ~WorldListPage(); - - virtual QString displayName() const override - { - return tr("Worlds"); - } - virtual QIcon icon() const override - { - return MMC->getThemedIcon("worlds"); - } - virtual QString id() const override - { - return "worlds"; - } - virtual QString helpPage() const override - { - return "Worlds"; - } - virtual bool shouldDisplay() const override; - - virtual void openedImpl() override; - virtual void closedImpl() override; - -protected: - bool eventFilter(QObject *obj, QEvent *ev) override; - bool worldListFilter(QKeyEvent *ev); - QMenu * createPopupMenu() override; - -protected: - BaseInstance *m_inst; - -private: - QModelIndex getSelectedWorld(); - bool isWorldSafe(QModelIndex index); - bool worldSafetyNagQuestion(); - void mceditError(); - -private: - Ui::WorldListPage *ui; - std::shared_ptr m_worlds; - unique_qobject_ptr m_mceditProcess; - bool m_mceditStarting = false; - -private slots: - void on_actionCopy_Seed_triggered(); - void on_actionMCEdit_triggered(); - void on_actionRemove_triggered(); - void on_actionAdd_triggered(); - void on_actionCopy_triggered(); - void on_actionRename_triggered(); - void on_actionRefresh_triggered(); - void on_actionView_Folder_triggered(); - void on_actionDatapacks_triggered(); - void on_actionReset_Icon_triggered(); - void worldChanged(const QModelIndex ¤t, const QModelIndex &previous); - void mceditState(LoggedProcess::State state); - - void ShowContextMenu(const QPoint &pos); -}; diff --git a/application/pages/instance/WorldListPage.ui b/application/pages/instance/WorldListPage.ui deleted file mode 100644 index ed078d94..00000000 --- a/application/pages/instance/WorldListPage.ui +++ /dev/null @@ -1,161 +0,0 @@ - - - WorldListPage - - - - 0 - 0 - 800 - 600 - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - true - - - QAbstractItemView::DragDrop - - - true - - - false - - - false - - - true - - - true - - - false - - - - - - - - Actions - - - Qt::LeftToolBarArea|Qt::RightToolBarArea - - - Qt::ToolButtonTextOnly - - - false - - - RightToolBarArea - - - false - - - - - - - - - - - - - - - - - Add - - - - - Rename - - - - - Copy - - - - - Remove - - - - - MCEdit - - - - - Copy Seed - - - - - Refresh - - - - - View Folder - - - - - Reset Icon - - - Remove world icon to make the game re-generate it on next load. - - - - - Datapacks - - - Manage datapacks inside the world. - - - - - - WideBar - QToolBar -
widgets/WideBar.h
-
-
- - -
diff --git a/application/pages/modplatform/ImportPage.cpp b/application/pages/modplatform/ImportPage.cpp deleted file mode 100644 index c2369bdc..00000000 --- a/application/pages/modplatform/ImportPage.cpp +++ /dev/null @@ -1,130 +0,0 @@ -#include "ImportPage.h" -#include "ui_ImportPage.h" - -#include "MultiMC.h" -#include "dialogs/NewInstanceDialog.h" -#include -#include -#include - -class UrlValidator : public QValidator -{ -public: - using QValidator::QValidator; - - State validate(QString &in, int &pos) const - { - const QUrl url(in); - if (url.isValid() && !url.isRelative() && !url.isEmpty()) - { - return Acceptable; - } - else if (QFile::exists(in)) - { - return Acceptable; - } - else - { - return Intermediate; - } - } -}; - -ImportPage::ImportPage(NewInstanceDialog* dialog, QWidget *parent) - : QWidget(parent), ui(new Ui::ImportPage), dialog(dialog) -{ - ui->setupUi(this); - ui->modpackEdit->setValidator(new UrlValidator(ui->modpackEdit)); - connect(ui->modpackEdit, &QLineEdit::textChanged, this, &ImportPage::updateState); -} - -ImportPage::~ImportPage() -{ - delete ui; -} - -bool ImportPage::shouldDisplay() const -{ - return true; -} - -void ImportPage::openedImpl() -{ - updateState(); -} - -void ImportPage::updateState() -{ - if(!isOpened) - { - return; - } - if(ui->modpackEdit->hasAcceptableInput()) - { - QString input = ui->modpackEdit->text(); - auto url = QUrl::fromUserInput(input); - if(url.isLocalFile()) - { - // FIXME: actually do some validation of what's inside here... this is fake AF - QFileInfo fi(input); - if(fi.exists() && fi.suffix() == "zip") - { - QFileInfo fi(url.fileName()); - dialog->setSuggestedPack(fi.completeBaseName(), new InstanceImportTask(url)); - dialog->setSuggestedIcon("default"); - } - } - else - { - if(input.endsWith("?client=y")) { - input.chop(9); - input.append("/file"); - url = QUrl::fromUserInput(input); - } - // hook, line and sinker. - QFileInfo fi(url.fileName()); - dialog->setSuggestedPack(fi.completeBaseName(), new InstanceImportTask(url)); - dialog->setSuggestedIcon("default"); - } - } - else - { - dialog->setSuggestedPack(); - } -} - -void ImportPage::setUrl(const QString& url) -{ - ui->modpackEdit->setText(url); - updateState(); -} - -void ImportPage::on_modpackBtn_clicked() -{ - const QUrl url = QFileDialog::getOpenFileUrl(this, tr("Choose modpack"), modpackUrl(), tr("Zip (*.zip)")); - if (url.isValid()) - { - if (url.isLocalFile()) - { - ui->modpackEdit->setText(url.toLocalFile()); - } - else - { - ui->modpackEdit->setText(url.toString()); - } - } -} - - -QUrl ImportPage::modpackUrl() const -{ - const QUrl url(ui->modpackEdit->text()); - if (url.isValid() && !url.isRelative() && !url.host().isEmpty()) - { - return url; - } - else - { - return QUrl::fromLocalFile(ui->modpackEdit->text()); - } -} diff --git a/application/pages/modplatform/ImportPage.h b/application/pages/modplatform/ImportPage.h deleted file mode 100644 index 67e3c201..00000000 --- a/application/pages/modplatform/ImportPage.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include "pages/BasePage.h" -#include -#include "tasks/Task.h" - -namespace Ui -{ -class ImportPage; -} - -class NewInstanceDialog; - -class ImportPage : public QWidget, public BasePage -{ - Q_OBJECT - -public: - explicit ImportPage(NewInstanceDialog* dialog, QWidget *parent = 0); - virtual ~ImportPage(); - virtual QString displayName() const override - { - return tr("Import from zip"); - } - virtual QIcon icon() const override - { - return MMC->getThemedIcon("viewfolder"); - } - virtual QString id() const override - { - return "import"; - } - virtual QString helpPage() const override - { - return "Zip-import"; - } - virtual bool shouldDisplay() const override; - - void setUrl(const QString & url); - void openedImpl() override; - -private slots: - void on_modpackBtn_clicked(); - void updateState(); - -private: - QUrl modpackUrl() const; - -private: - Ui::ImportPage *ui = nullptr; - NewInstanceDialog* dialog = nullptr; -}; - diff --git a/application/pages/modplatform/ImportPage.ui b/application/pages/modplatform/ImportPage.ui deleted file mode 100644 index eb63cbe9..00000000 --- a/application/pages/modplatform/ImportPage.ui +++ /dev/null @@ -1,52 +0,0 @@ - - - ImportPage - - - - 0 - 0 - 546 - 405 - - - - - - - Browse - - - - - - - http:// - - - - - - - Local file or link to a direct download: - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - diff --git a/application/pages/modplatform/VanillaPage.cpp b/application/pages/modplatform/VanillaPage.cpp deleted file mode 100644 index 02638315..00000000 --- a/application/pages/modplatform/VanillaPage.cpp +++ /dev/null @@ -1,104 +0,0 @@ -#include "VanillaPage.h" -#include "ui_VanillaPage.h" - -#include "MultiMC.h" - -#include -#include -#include -#include -#include -#include -#include - -VanillaPage::VanillaPage(NewInstanceDialog *dialog, QWidget *parent) - : QWidget(parent), dialog(dialog), ui(new Ui::VanillaPage) -{ - ui->setupUi(this); - ui->tabWidget->tabBar()->hide(); - connect(ui->versionList, &VersionSelectWidget::selectedVersionChanged, this, &VanillaPage::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); -} - -void VanillaPage::openedImpl() -{ - if(!initialized) - { - auto vlist = ENV.metadataIndex()->get("net.minecraft"); - ui->versionList->initialize(vlist.get()); - initialized = true; - } - else - { - suggestCurrent(); - } -} - -void VanillaPage::refresh() -{ - ui->versionList->loadList(); -} - -void VanillaPage::filterChanged() -{ - QStringList out; - if(ui->alphaFilter->isChecked()) - out << "(old_alpha)"; - if(ui->betaFilter->isChecked()) - out << "(old_beta)"; - if(ui->snapshotFilter->isChecked()) - out << "(snapshot)"; - if(ui->oldSnapshotFilter->isChecked()) - out << "(old_snapshot)"; - if(ui->releaseFilter->isChecked()) - out << "(release)"; - if(ui->experimentsFilter->isChecked()) - out << "(experiment)"; - auto regexp = out.join('|'); - ui->versionList->setFilter(BaseVersionList::TypeRole, new RegexpFilter(regexp, false)); -} - -VanillaPage::~VanillaPage() -{ - delete ui; -} - -bool VanillaPage::shouldDisplay() const -{ - return true; -} - -BaseVersionPtr VanillaPage::selectedVersion() const -{ - return m_selectedVersion; -} - -void VanillaPage::suggestCurrent() -{ - if (!isOpened) - { - return; - } - - if(!m_selectedVersion) - { - dialog->setSuggestedPack(); - return; - } - - dialog->setSuggestedPack(m_selectedVersion->descriptor(), new InstanceCreationTask(m_selectedVersion)); - dialog->setSuggestedIcon("default"); -} - -void VanillaPage::setSelectedVersion(BaseVersionPtr version) -{ - m_selectedVersion = version; - suggestCurrent(); -} diff --git a/application/pages/modplatform/VanillaPage.h b/application/pages/modplatform/VanillaPage.h deleted file mode 100644 index af6fd392..00000000 --- a/application/pages/modplatform/VanillaPage.h +++ /dev/null @@ -1,75 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include "pages/BasePage.h" -#include -#include "tasks/Task.h" - -namespace Ui -{ -class VanillaPage; -} - -class NewInstanceDialog; - -class VanillaPage : public QWidget, public BasePage -{ - Q_OBJECT - -public: - explicit VanillaPage(NewInstanceDialog *dialog, QWidget *parent = 0); - virtual ~VanillaPage(); - virtual QString displayName() const override - { - return tr("Vanilla"); - } - virtual QIcon icon() const override - { - return MMC->getThemedIcon("minecraft"); - } - virtual QString id() const override - { - return "vanilla"; - } - virtual QString helpPage() const override - { - return "Vanilla-platform"; - } - virtual bool shouldDisplay() const override; - void openedImpl() override; - - BaseVersionPtr selectedVersion() const; - -public slots: - void setSelectedVersion(BaseVersionPtr version); - -private slots: - void filterChanged(); - -private: - void refresh(); - void suggestCurrent(); - -private: - bool initialized = false; - NewInstanceDialog *dialog = nullptr; - Ui::VanillaPage *ui = nullptr; - bool m_versionSetByUser = false; - BaseVersionPtr m_selectedVersion; -}; diff --git a/application/pages/modplatform/VanillaPage.ui b/application/pages/modplatform/VanillaPage.ui deleted file mode 100644 index 47effc86..00000000 --- a/application/pages/modplatform/VanillaPage.ui +++ /dev/null @@ -1,169 +0,0 @@ - - - VanillaPage - - - - 0 - 0 - 815 - 607 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 0 - - - - - - - - - - - - Filter - - - Qt::AlignCenter - - - - - - - Releases - - - true - - - true - - - - - - - Snapshots - - - true - - - - - - - Old Snapshots - - - true - - - - - - - Betas - - - true - - - - - - - Alphas - - - true - - - - - - - Experiments - - - true - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Refresh - - - - - - - - - - 0 - 0 - - - - - - - - - - - - - VersionSelectWidget - QWidget -
widgets/VersionSelectWidget.h
- 1 -
-
- - tabWidget - releaseFilter - snapshotFilter - oldSnapshotFilter - betaFilter - alphaFilter - experimentsFilter - refreshBtn - - - -
diff --git a/application/pages/modplatform/atlauncher/AtlFilterModel.cpp b/application/pages/modplatform/atlauncher/AtlFilterModel.cpp deleted file mode 100644 index b5d8f22b..00000000 --- a/application/pages/modplatform/atlauncher/AtlFilterModel.cpp +++ /dev/null @@ -1,81 +0,0 @@ -#include "AtlFilterModel.h" - -#include - -#include -#include -#include - -namespace Atl { - -FilterModel::FilterModel(QObject *parent) : QSortFilterProxyModel(parent) -{ - currentSorting = Sorting::ByPopularity; - sortings.insert(tr("Sort by popularity"), Sorting::ByPopularity); - sortings.insert(tr("Sort by name"), Sorting::ByName); - sortings.insert(tr("Sort by game version"), Sorting::ByGameVersion); - - searchTerm = ""; -} - -const QMap FilterModel::getAvailableSortings() -{ - return sortings; -} - -QString FilterModel::translateCurrentSorting() -{ - return sortings.key(currentSorting); -} - -void FilterModel::setSorting(Sorting sorting) -{ - currentSorting = sorting; - invalidate(); -} - -FilterModel::Sorting FilterModel::getCurrentSorting() -{ - return currentSorting; -} - -void FilterModel::setSearchTerm(const QString term) -{ - searchTerm = term.trimmed(); - invalidate(); -} - -bool FilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const -{ - if (searchTerm.isEmpty()) { - return true; - } - - QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); - ATLauncher::IndexedPack pack = sourceModel()->data(index, Qt::UserRole).value(); - return pack.name.contains(searchTerm, Qt::CaseInsensitive); -} - -bool FilterModel::lessThan(const QModelIndex &left, const QModelIndex &right) const -{ - ATLauncher::IndexedPack leftPack = sourceModel()->data(left, Qt::UserRole).value(); - ATLauncher::IndexedPack rightPack = sourceModel()->data(right, Qt::UserRole).value(); - - if (currentSorting == ByPopularity) { - return leftPack.position > rightPack.position; - } - else if (currentSorting == ByGameVersion) { - Version lv(leftPack.versions.at(0).minecraft); - Version rv(rightPack.versions.at(0).minecraft); - return lv < rv; - } - else if (currentSorting == ByName) { - return Strings::naturalCompare(leftPack.name, rightPack.name, Qt::CaseSensitive) >= 0; - } - - // Invalid sorting set, somehow... - qWarning() << "Invalid sorting set!"; - return true; -} - -} diff --git a/application/pages/modplatform/atlauncher/AtlFilterModel.h b/application/pages/modplatform/atlauncher/AtlFilterModel.h deleted file mode 100644 index bd72ad91..00000000 --- a/application/pages/modplatform/atlauncher/AtlFilterModel.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include - -namespace Atl { - -class FilterModel : public QSortFilterProxyModel -{ - Q_OBJECT -public: - FilterModel(QObject* parent = Q_NULLPTR); - enum Sorting { - ByPopularity, - ByGameVersion, - ByName, - }; - const QMap getAvailableSortings(); - QString translateCurrentSorting(); - void setSorting(Sorting sorting); - Sorting getCurrentSorting(); - void setSearchTerm(QString term); - -protected: - bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; - bool lessThan(const QModelIndex &left, const QModelIndex &right) const override; - -private: - QMap sortings; - Sorting currentSorting; - QString searchTerm; - -}; - -} diff --git a/application/pages/modplatform/atlauncher/AtlListModel.cpp b/application/pages/modplatform/atlauncher/AtlListModel.cpp deleted file mode 100644 index f3be6198..00000000 --- a/application/pages/modplatform/atlauncher/AtlListModel.cpp +++ /dev/null @@ -1,194 +0,0 @@ -#include "AtlListModel.h" - -#include -#include -#include -#include - -namespace Atl { - -ListModel::ListModel(QObject *parent) : QAbstractListModel(parent) -{ -} - -ListModel::~ListModel() -{ -} - -int ListModel::rowCount(const QModelIndex &parent) const -{ - return modpacks.size(); -} - -int ListModel::columnCount(const QModelIndex &parent) const -{ - return 1; -} - -QVariant ListModel::data(const QModelIndex &index, int role) const -{ - int pos = index.row(); - if(pos >= modpacks.size() || pos < 0 || !index.isValid()) - { - return QString("INVALID INDEX %1").arg(pos); - } - - ATLauncher::IndexedPack pack = modpacks.at(pos); - if(role == Qt::DisplayRole) - { - return pack.name; - } - else if (role == Qt::ToolTipRole) - { - return pack.name; - } - else if(role == Qt::DecorationRole) - { - if(m_logoMap.contains(pack.safeName)) - { - return (m_logoMap.value(pack.safeName)); - } - auto icon = MMC->getThemedIcon("atlauncher-placeholder"); - - auto url = QString(BuildConfig.ATL_DOWNLOAD_SERVER_URL + "launcher/images/%1.png").arg(pack.safeName.toLower()); - ((ListModel *)this)->requestLogo(pack.safeName, url); - - return icon; - } - else if(role == Qt::UserRole) - { - QVariant v; - v.setValue(pack); - return v; - } - - return QVariant(); -} - -void ListModel::request() -{ - beginResetModel(); - modpacks.clear(); - endResetModel(); - - auto *netJob = new NetJob("Atl::Request"); - auto url = QString(BuildConfig.ATL_DOWNLOAD_SERVER_URL + "launcher/json/packsnew.json"); - netJob->addNetAction(Net::Download::makeByteArray(QUrl(url), &response)); - jobPtr = netJob; - jobPtr->start(); - - QObject::connect(netJob, &NetJob::succeeded, this, &ListModel::requestFinished); - QObject::connect(netJob, &NetJob::failed, this, &ListModel::requestFailed); -} - -void ListModel::requestFinished() -{ - jobPtr.reset(); - - QJsonParseError parse_error; - QJsonDocument doc = QJsonDocument::fromJson(response, &parse_error); - if(parse_error.error != QJsonParseError::NoError) { - qWarning() << "Error while parsing JSON response from ATL at " << parse_error.offset << " reason: " << parse_error.errorString(); - qWarning() << response; - return; - } - - QList newList; - - auto packs = doc.array(); - for(auto packRaw : packs) { - auto packObj = packRaw.toObject(); - - ATLauncher::IndexedPack pack; - - try { - ATLauncher::loadIndexedPack(pack, packObj); - } - catch (const JSONValidationError &e) { - qDebug() << QString::fromUtf8(response); - qWarning() << "Error while reading pack manifest from ATLauncher: " << e.cause(); - return; - } - - // ignore packs without a published version - if(pack.versions.length() == 0) continue; - // only display public packs (for now) - if(pack.type != ATLauncher::PackType::Public) continue; - // ignore "system" packs (Vanilla, Vanilla with Forge, etc) - if(pack.system) continue; - - newList.append(pack); - } - - beginInsertRows(QModelIndex(), modpacks.size(), modpacks.size() + newList.size() - 1); - modpacks.append(newList); - endInsertRows(); -} - -void ListModel::requestFailed(QString reason) -{ - jobPtr.reset(); -} - -void ListModel::getLogo(const QString &logo, const QString &logoUrl, LogoCallback callback) -{ - if(m_logoMap.contains(logo)) - { - callback(ENV.metacache()->resolveEntry("ATLauncherPacks", QString("logos/%1").arg(logo.section(".", 0, 0)))->getFullPath()); - } - else - { - requestLogo(logo, logoUrl); - } -} - -void ListModel::logoFailed(QString logo) -{ - m_failedLogos.append(logo); - m_loadingLogos.removeAll(logo); -} - -void ListModel::logoLoaded(QString logo, QIcon out) -{ - m_loadingLogos.removeAll(logo); - m_logoMap.insert(logo, out); - - for(int i = 0; i < modpacks.size(); i++) { - if(modpacks[i].safeName == logo) { - emit dataChanged(createIndex(i, 0), createIndex(i, 0), {Qt::DecorationRole}); - } - } -} - -void ListModel::requestLogo(QString file, QString url) -{ - if(m_loadingLogos.contains(file) || m_failedLogos.contains(file)) - { - return; - } - - MetaEntryPtr entry = ENV.metacache()->resolveEntry("ATLauncherPacks", QString("logos/%1").arg(file.section(".", 0, 0))); - NetJob *job = new NetJob(QString("ATLauncher Icon Download %1").arg(file)); - job->addNetAction(Net::Download::makeCached(QUrl(url), entry)); - - auto fullPath = entry->getFullPath(); - QObject::connect(job, &NetJob::succeeded, this, [this, file, fullPath] - { - emit logoLoaded(file, QIcon(fullPath)); - if(waitingCallbacks.contains(file)) - { - waitingCallbacks.value(file)(fullPath); - } - }); - - QObject::connect(job, &NetJob::failed, this, [this, file] - { - emit logoFailed(file); - }); - - job->start(); - - m_loadingLogos.append(file); -} - -} diff --git a/application/pages/modplatform/atlauncher/AtlListModel.h b/application/pages/modplatform/atlauncher/AtlListModel.h deleted file mode 100644 index 2d30a64e..00000000 --- a/application/pages/modplatform/atlauncher/AtlListModel.h +++ /dev/null @@ -1,52 +0,0 @@ -#pragma once - -#include - -#include "net/NetJob.h" -#include -#include - -namespace Atl { - -typedef QMap LogoMap; -typedef std::function LogoCallback; - -class ListModel : public QAbstractListModel -{ - Q_OBJECT - -public: - ListModel(QObject *parent); - virtual ~ListModel(); - - int rowCount(const QModelIndex &parent) const override; - int columnCount(const QModelIndex &parent) const override; - QVariant data(const QModelIndex &index, int role) const override; - - void request(); - - void getLogo(const QString &logo, const QString &logoUrl, LogoCallback callback); - -private slots: - void requestFinished(); - void requestFailed(QString reason); - - void logoFailed(QString logo); - void logoLoaded(QString logo, QIcon out); - -private: - void requestLogo(QString file, QString url); - -private: - QList modpacks; - - QStringList m_failedLogos; - QStringList m_loadingLogos; - LogoMap m_logoMap; - QMap waitingCallbacks; - - NetJobPtr jobPtr; - QByteArray response; -}; - -} diff --git a/application/pages/modplatform/atlauncher/AtlOptionalModDialog.cpp b/application/pages/modplatform/atlauncher/AtlOptionalModDialog.cpp deleted file mode 100644 index 14bbd18b..00000000 --- a/application/pages/modplatform/atlauncher/AtlOptionalModDialog.cpp +++ /dev/null @@ -1,209 +0,0 @@ -#include "AtlOptionalModDialog.h" -#include "ui_AtlOptionalModDialog.h" - -AtlOptionalModListModel::AtlOptionalModListModel(QWidget *parent, QVector mods) - : QAbstractListModel(parent), m_mods(mods) { - - // fill mod index - for (int i = 0; i < m_mods.size(); i++) { - auto mod = m_mods.at(i); - m_index[mod.name] = i; - } - // set initial state - for (int i = 0; i < m_mods.size(); i++) { - auto mod = m_mods.at(i); - m_selection[mod.name] = false; - setMod(mod, i, mod.selected, false); - } -} - -QVector AtlOptionalModListModel::getResult() { - QVector result; - - for (const auto& mod : m_mods) { - if (m_selection[mod.name]) { - result.push_back(mod.name); - } - } - - return result; -} - -int AtlOptionalModListModel::rowCount(const QModelIndex &parent) const { - return m_mods.size(); -} - -int AtlOptionalModListModel::columnCount(const QModelIndex &parent) const { - // Enabled, Name, Description - return 3; -} - -QVariant AtlOptionalModListModel::data(const QModelIndex &index, int role) const { - auto row = index.row(); - auto mod = m_mods.at(row); - - if (role == Qt::DisplayRole) { - if (index.column() == NameColumn) { - return mod.name; - } - if (index.column() == DescriptionColumn) { - return mod.description; - } - } - else if (role == Qt::ToolTipRole) { - if (index.column() == DescriptionColumn) { - return mod.description; - } - } - else if (role == Qt::CheckStateRole) { - if (index.column() == EnabledColumn) { - return m_selection[mod.name] ? Qt::Checked : Qt::Unchecked; - } - } - - return QVariant(); -} - -bool AtlOptionalModListModel::setData(const QModelIndex &index, const QVariant &value, int role) { - if (role == Qt::CheckStateRole) { - auto row = index.row(); - auto mod = m_mods.at(row); - - toggleMod(mod, row); - return true; - } - - return false; -} - -QVariant AtlOptionalModListModel::headerData(int section, Qt::Orientation orientation, int role) const { - if (role == Qt::DisplayRole && orientation == Qt::Horizontal) { - switch (section) { - case EnabledColumn: - return QString(); - case NameColumn: - return QString("Name"); - case DescriptionColumn: - return QString("Description"); - } - } - - return QVariant(); -} - -Qt::ItemFlags AtlOptionalModListModel::flags(const QModelIndex &index) const { - auto flags = QAbstractListModel::flags(index); - if (index.isValid() && index.column() == EnabledColumn) { - flags |= Qt::ItemIsUserCheckable; - } - return flags; -} - -void AtlOptionalModListModel::selectRecommended() { - for (const auto& mod : m_mods) { - m_selection[mod.name] = mod.recommended; - } - - emit dataChanged(AtlOptionalModListModel::index(0, EnabledColumn), - AtlOptionalModListModel::index(m_mods.size() - 1, EnabledColumn)); -} - -void AtlOptionalModListModel::clearAll() { - for (const auto& mod : m_mods) { - m_selection[mod.name] = false; - } - - emit dataChanged(AtlOptionalModListModel::index(0, EnabledColumn), - AtlOptionalModListModel::index(m_mods.size() - 1, EnabledColumn)); -} - -void AtlOptionalModListModel::toggleMod(ATLauncher::VersionMod mod, int index) { - setMod(mod, index, !m_selection[mod.name]); -} - -void AtlOptionalModListModel::setMod(ATLauncher::VersionMod mod, int index, bool enable, bool shouldEmit) { - if (m_selection[mod.name] == enable) return; - - m_selection[mod.name] = enable; - - // disable other mods in the group, if applicable - if (enable && !mod.group.isEmpty()) { - for (int i = 0; i < m_mods.size(); i++) { - if (index == i) continue; - auto other = m_mods.at(i); - - if (mod.group == other.group) { - setMod(other, i, false, shouldEmit); - } - } - } - - for (const auto& dependencyName : mod.depends) { - auto dependencyIndex = m_index[dependencyName]; - auto dependencyMod = m_mods.at(dependencyIndex); - - // enable/disable dependencies - if (enable) { - setMod(dependencyMod, dependencyIndex, true, shouldEmit); - } - - // if the dependency is 'effectively hidden', then track which mods - // depend on it - so we can efficiently disable it when no more dependents - // depend on it. - auto dependants = m_dependants[dependencyName]; - - if (enable) { - dependants.append(mod.name); - } - else { - dependants.removeAll(mod.name); - - // if there are no longer any dependents, let's disable the mod - if (dependencyMod.effectively_hidden && dependants.isEmpty()) { - setMod(dependencyMod, dependencyIndex, false, shouldEmit); - } - } - } - - // disable mods that depend on this one, if disabling - if (!enable) { - auto dependants = m_dependants[mod.name]; - for (const auto& dependencyName : dependants) { - auto dependencyIndex = m_index[dependencyName]; - auto dependencyMod = m_mods.at(dependencyIndex); - - setMod(dependencyMod, dependencyIndex, false, shouldEmit); - } - } - - if (shouldEmit) { - emit dataChanged(AtlOptionalModListModel::index(index, EnabledColumn), - AtlOptionalModListModel::index(index, EnabledColumn)); - } -} - - -AtlOptionalModDialog::AtlOptionalModDialog(QWidget *parent, QVector mods) - : QDialog(parent), ui(new Ui::AtlOptionalModDialog) { - ui->setupUi(this); - - listModel = new AtlOptionalModListModel(this, mods); - ui->treeView->setModel(listModel); - - ui->treeView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - ui->treeView->header()->setSectionResizeMode( - AtlOptionalModListModel::NameColumn, QHeaderView::ResizeToContents); - ui->treeView->header()->setSectionResizeMode( - AtlOptionalModListModel::DescriptionColumn, QHeaderView::Stretch); - - connect(ui->selectRecommendedButton, &QPushButton::pressed, - listModel, &AtlOptionalModListModel::selectRecommended); - connect(ui->clearAllButton, &QPushButton::pressed, - listModel, &AtlOptionalModListModel::clearAll); - connect(ui->installButton, &QPushButton::pressed, - this, &QDialog::close); -} - -AtlOptionalModDialog::~AtlOptionalModDialog() { - delete ui; -} diff --git a/application/pages/modplatform/atlauncher/AtlOptionalModDialog.h b/application/pages/modplatform/atlauncher/AtlOptionalModDialog.h deleted file mode 100644 index a1df43f6..00000000 --- a/application/pages/modplatform/atlauncher/AtlOptionalModDialog.h +++ /dev/null @@ -1,66 +0,0 @@ -#pragma once - -#include -#include - -#include "modplatform/atlauncher/ATLPackIndex.h" - -namespace Ui { -class AtlOptionalModDialog; -} - -class AtlOptionalModListModel : public QAbstractListModel { - Q_OBJECT - -public: - enum Columns - { - EnabledColumn = 0, - NameColumn, - DescriptionColumn, - }; - - AtlOptionalModListModel(QWidget *parent, QVector mods); - - QVector getResult(); - - int rowCount(const QModelIndex &parent) const override; - int columnCount(const QModelIndex &parent) const override; - - QVariant data(const QModelIndex &index, int role) const override; - bool setData(const QModelIndex &index, const QVariant &value, int role) override; - QVariant headerData(int section, Qt::Orientation orientation, int role) const override; - - Qt::ItemFlags flags(const QModelIndex &index) const override; - -public slots: - void selectRecommended(); - void clearAll(); - -private: - void toggleMod(ATLauncher::VersionMod mod, int index); - void setMod(ATLauncher::VersionMod mod, int index, bool enable, bool shouldEmit = true); - -private: - QVector m_mods; - QMap m_selection; - QMap m_index; - QMap> m_dependants; -}; - -class AtlOptionalModDialog : public QDialog { - Q_OBJECT - -public: - AtlOptionalModDialog(QWidget *parent, QVector mods); - ~AtlOptionalModDialog() override; - - QVector getResult() { - return listModel->getResult(); - } - -private: - Ui::AtlOptionalModDialog *ui; - - AtlOptionalModListModel *listModel; -}; diff --git a/application/pages/modplatform/atlauncher/AtlOptionalModDialog.ui b/application/pages/modplatform/atlauncher/AtlOptionalModDialog.ui deleted file mode 100644 index 5d3193a4..00000000 --- a/application/pages/modplatform/atlauncher/AtlOptionalModDialog.ui +++ /dev/null @@ -1,65 +0,0 @@ - - - AtlOptionalModDialog - - - - 0 - 0 - 550 - 310 - - - - Select Mods To Install - - - - - - Install - - - true - - - - - - - Select Recommended - - - - - - - false - - - Use Share Code - - - - - - - Clear All - - - - - - - - - - - ModListView - QTreeView -
widgets/ModListView.h
-
-
- - -
diff --git a/application/pages/modplatform/atlauncher/AtlPage.cpp b/application/pages/modplatform/atlauncher/AtlPage.cpp deleted file mode 100644 index 9fdf111f..00000000 --- a/application/pages/modplatform/atlauncher/AtlPage.cpp +++ /dev/null @@ -1,175 +0,0 @@ -#include "AtlPage.h" -#include "ui_AtlPage.h" - -#include "dialogs/NewInstanceDialog.h" -#include "AtlOptionalModDialog.h" -#include -#include -#include - -AtlPage::AtlPage(NewInstanceDialog* dialog, QWidget *parent) - : QWidget(parent), ui(new Ui::AtlPage), dialog(dialog) -{ - ui->setupUi(this); - - filterModel = new Atl::FilterModel(this); - listModel = new Atl::ListModel(this); - filterModel->setSourceModel(listModel); - ui->packView->setModel(filterModel); - ui->packView->setSortingEnabled(true); - - ui->packView->header()->hide(); - ui->packView->setIndentation(0); - - ui->versionSelectionBox->view()->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); - ui->versionSelectionBox->view()->parentWidget()->setMaximumHeight(300); - - for(int i = 0; i < filterModel->getAvailableSortings().size(); i++) - { - ui->sortByBox->addItem(filterModel->getAvailableSortings().keys().at(i)); - } - ui->sortByBox->setCurrentText(filterModel->translateCurrentSorting()); - - connect(ui->searchEdit, &QLineEdit::textChanged, this, &AtlPage::triggerSearch); - connect(ui->resetButton, &QPushButton::clicked, this, &AtlPage::resetSearch); - connect(ui->sortByBox, &QComboBox::currentTextChanged, this, &AtlPage::onSortingSelectionChanged); - connect(ui->packView->selectionModel(), &QItemSelectionModel::currentChanged, this, &AtlPage::onSelectionChanged); - connect(ui->versionSelectionBox, &QComboBox::currentTextChanged, this, &AtlPage::onVersionSelectionChanged); -} - -AtlPage::~AtlPage() -{ - delete ui; -} - -bool AtlPage::shouldDisplay() const -{ - return true; -} - -void AtlPage::openedImpl() -{ - if(!initialized) - { - listModel->request(); - initialized = true; - } - - suggestCurrent(); -} - -void AtlPage::suggestCurrent() -{ - if(!isOpened) - { - return; - } - - if (selectedVersion.isEmpty()) - { - dialog->setSuggestedPack(); - return; - } - - dialog->setSuggestedPack(selected.name, new ATLauncher::PackInstallTask(this, selected.safeName, selectedVersion)); - auto editedLogoName = selected.safeName; - auto url = QString(BuildConfig.ATL_DOWNLOAD_SERVER_URL + "launcher/images/%1.png").arg(selected.safeName.toLower()); - listModel->getLogo(selected.safeName, url, [this, editedLogoName](QString logo) - { - dialog->setSuggestedIconFromFile(logo, editedLogoName); - }); -} - -void AtlPage::triggerSearch() -{ - filterModel->setSearchTerm(ui->searchEdit->text()); -} - -void AtlPage::resetSearch() -{ - ui->searchEdit->setText(""); -} - -void AtlPage::onSortingSelectionChanged(QString data) -{ - auto toSet = filterModel->getAvailableSortings().value(data); - filterModel->setSorting(toSet); -} - -void AtlPage::onSelectionChanged(QModelIndex first, QModelIndex second) -{ - ui->versionSelectionBox->clear(); - - if(!first.isValid()) - { - if(isOpened) - { - dialog->setSuggestedPack(); - } - return; - } - - selected = filterModel->data(first, Qt::UserRole).value(); - - ui->packDescription->setHtml(selected.description.replace("\n", "
")); - - for(const auto& version : selected.versions) { - ui->versionSelectionBox->addItem(version.version); - } - - suggestCurrent(); -} - -void AtlPage::onVersionSelectionChanged(QString data) -{ - if(data.isNull() || data.isEmpty()) - { - selectedVersion = ""; - return; - } - - selectedVersion = data; - suggestCurrent(); -} - -QVector AtlPage::chooseOptionalMods(QVector mods) { - AtlOptionalModDialog optionalModDialog(this, mods); - optionalModDialog.exec(); - return optionalModDialog.getResult(); -} - -QString AtlPage::chooseVersion(Meta::VersionListPtr vlist, QString minecraftVersion) { - VersionSelectDialog vselect(vlist.get(), "Choose Version", MMC->activeWindow(), false); - if (minecraftVersion != Q_NULLPTR) { - vselect.setExactFilter(BaseVersionList::ParentVersionRole, minecraftVersion); - vselect.setEmptyString(tr("No versions are currently available for Minecraft %1").arg(minecraftVersion)); - } - else { - vselect.setEmptyString(tr("No versions are currently available")); - } - vselect.setEmptyErrorString(tr("Couldn't load or download the version lists!")); - - // select recommended build - for (int i = 0; i < vlist->versions().size(); i++) { - auto version = vlist->versions().at(i); - auto reqs = version->requires(); - - // filter by minecraft version, if the loader depends on a certain version. - if (minecraftVersion != Q_NULLPTR) { - auto iter = std::find_if(reqs.begin(), reqs.end(), [](const Meta::Require &req) { - return req.uid == "net.minecraft"; - }); - if (iter == reqs.end()) continue; - if (iter->equalsVersion != minecraftVersion) continue; - } - - // first recommended build we find, we use. - if (version->isRecommended()) { - vselect.setCurrentVersion(version->descriptor()); - break; - } - } - - vselect.exec(); - return vselect.selectedVersion()->descriptor(); -} diff --git a/application/pages/modplatform/atlauncher/AtlPage.h b/application/pages/modplatform/atlauncher/AtlPage.h deleted file mode 100644 index 932ec6a6..00000000 --- a/application/pages/modplatform/atlauncher/AtlPage.h +++ /dev/null @@ -1,87 +0,0 @@ -/* Copyright 2013-2019 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "AtlFilterModel.h" -#include "AtlListModel.h" - -#include -#include - -#include "MultiMC.h" -#include "pages/BasePage.h" -#include "tasks/Task.h" - -namespace Ui -{ - class AtlPage; -} - -class NewInstanceDialog; - -class AtlPage : public QWidget, public BasePage, public ATLauncher::UserInteractionSupport -{ -Q_OBJECT - -public: - explicit AtlPage(NewInstanceDialog* dialog, QWidget *parent = 0); - virtual ~AtlPage(); - virtual QString displayName() const override - { - return tr("ATLauncher"); - } - virtual QIcon icon() const override - { - return MMC->getThemedIcon("atlauncher"); - } - virtual QString id() const override - { - return "atl"; - } - virtual QString helpPage() const override - { - return "ATL-platform"; - } - virtual bool shouldDisplay() const override; - - void openedImpl() override; - -private: - void suggestCurrent(); - - QString chooseVersion(Meta::VersionListPtr vlist, QString minecraftVersion) override; - QVector chooseOptionalMods(QVector mods) override; - -private slots: - void triggerSearch(); - void resetSearch(); - - void onSortingSelectionChanged(QString data); - - void onSelectionChanged(QModelIndex first, QModelIndex second); - void onVersionSelectionChanged(QString data); - -private: - Ui::AtlPage *ui = nullptr; - NewInstanceDialog* dialog = nullptr; - Atl::ListModel* listModel = nullptr; - Atl::FilterModel* filterModel = nullptr; - - ATLauncher::IndexedPack selected; - QString selectedVersion; - - bool initialized = false; -}; diff --git a/application/pages/modplatform/atlauncher/AtlPage.ui b/application/pages/modplatform/atlauncher/AtlPage.ui deleted file mode 100644 index f16c24b8..00000000 --- a/application/pages/modplatform/atlauncher/AtlPage.ui +++ /dev/null @@ -1,97 +0,0 @@ - - - AtlPage - - - - 0 - 0 - 837 - 685 - - - - - - - - - - 96 - 48 - - - - true - - - - - - - true - - - true - - - - - - - Warning: This is still a work in progress. If you run into issues with the imported modpack, it may be a bug. - - - true - - - - - - - - - - - - - - Version selected: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - Reset - - - - - - - Search and filter ... - - - - - - - searchEdit - resetButton - packView - packDescription - sortByBox - versionSelectionBox - - - - diff --git a/application/pages/modplatform/flame/FlameModel.cpp b/application/pages/modplatform/flame/FlameModel.cpp deleted file mode 100644 index 228a88c5..00000000 --- a/application/pages/modplatform/flame/FlameModel.cpp +++ /dev/null @@ -1,259 +0,0 @@ -#include "FlameModel.h" -#include "MultiMC.h" -#include - -#include -#include - -#include -#include - -#include -#include - -namespace Flame { - -ListModel::ListModel(QObject *parent) : QAbstractListModel(parent) -{ -} - -ListModel::~ListModel() -{ -} - -int ListModel::rowCount(const QModelIndex &parent) const -{ - return modpacks.size(); -} - -int ListModel::columnCount(const QModelIndex &parent) const -{ - return 1; -} - -QVariant ListModel::data(const QModelIndex &index, int role) const -{ - int pos = index.row(); - if(pos >= modpacks.size() || pos < 0 || !index.isValid()) - { - return QString("INVALID INDEX %1").arg(pos); - } - - IndexedPack pack = modpacks.at(pos); - if(role == Qt::DisplayRole) - { - return pack.name; - } - else if (role == Qt::ToolTipRole) - { - if(pack.description.length() > 100) - { - //some magic to prevent to long tooltips and replace html linebreaks - QString edit = pack.description.left(97); - edit = edit.left(edit.lastIndexOf("
")).left(edit.lastIndexOf(" ")).append("..."); - return edit; - - } - return pack.description; - } - else if(role == Qt::DecorationRole) - { - if(m_logoMap.contains(pack.logoName)) - { - return (m_logoMap.value(pack.logoName)); - } - QIcon icon = MMC->getThemedIcon("screenshot-placeholder"); - ((ListModel *)this)->requestLogo(pack.logoName, pack.logoUrl); - return icon; - } - else if(role == Qt::UserRole) - { - QVariant v; - v.setValue(pack); - return v; - } - - return QVariant(); -} - -void ListModel::logoLoaded(QString logo, QIcon out) -{ - m_loadingLogos.removeAll(logo); - m_logoMap.insert(logo, out); - for(int i = 0; i < modpacks.size(); i++) { - if(modpacks[i].logoName == logo) { - emit dataChanged(createIndex(i, 0), createIndex(i, 0), {Qt::DecorationRole}); - } - } -} - -void ListModel::logoFailed(QString logo) -{ - m_failedLogos.append(logo); - m_loadingLogos.removeAll(logo); -} - -void ListModel::requestLogo(QString logo, QString url) -{ - if(m_loadingLogos.contains(logo) || m_failedLogos.contains(logo)) - { - return; - } - - MetaEntryPtr entry = ENV.metacache()->resolveEntry("FlamePacks", QString("logos/%1").arg(logo.section(".", 0, 0))); - NetJob *job = new NetJob(QString("Flame Icon Download %1").arg(logo)); - job->addNetAction(Net::Download::makeCached(QUrl(url), entry)); - - auto fullPath = entry->getFullPath(); - QObject::connect(job, &NetJob::succeeded, this, [this, logo, fullPath] - { - emit logoLoaded(logo, QIcon(fullPath)); - if(waitingCallbacks.contains(logo)) - { - waitingCallbacks.value(logo)(fullPath); - } - }); - - QObject::connect(job, &NetJob::failed, this, [this, logo] - { - emit logoFailed(logo); - }); - - job->start(); - - m_loadingLogos.append(logo); -} - -void ListModel::getLogo(const QString &logo, const QString &logoUrl, LogoCallback callback) -{ - if(m_logoMap.contains(logo)) - { - callback(ENV.metacache()->resolveEntry("FlamePacks", QString("logos/%1").arg(logo.section(".", 0, 0)))->getFullPath()); - } - else - { - requestLogo(logo, logoUrl); - } -} - -Qt::ItemFlags ListModel::flags(const QModelIndex &index) const -{ - return QAbstractListModel::flags(index); -} - -bool ListModel::canFetchMore(const QModelIndex& parent) const -{ - return searchState == CanPossiblyFetchMore; -} - -void ListModel::fetchMore(const QModelIndex& parent) -{ - if (parent.isValid()) - return; - if(nextSearchOffset == 0) { - qWarning() << "fetchMore with 0 offset is wrong..."; - return; - } - performPaginatedSearch(); -} - -void ListModel::performPaginatedSearch() -{ - NetJob *netJob = new NetJob("Flame::Search"); - auto searchUrl = QString( - "https://addons-ecs.forgesvc.net/api/v2/addon/search?" - "categoryId=0&" - "gameId=432&" - "index=%1&" - "pageSize=25&" - "searchFilter=%2&" - "sectionId=4471&" - "sort=%3" - ).arg(nextSearchOffset).arg(currentSearchTerm).arg(currentSort); - netJob->addNetAction(Net::Download::makeByteArray(QUrl(searchUrl), &response)); - jobPtr = netJob; - jobPtr->start(); - QObject::connect(netJob, &NetJob::succeeded, this, &ListModel::searchRequestFinished); - QObject::connect(netJob, &NetJob::failed, this, &ListModel::searchRequestFailed); -} - -void ListModel::searchWithTerm(const QString& term, int sort) -{ - if(currentSearchTerm == term && currentSearchTerm.isNull() == term.isNull() && currentSort == sort) { - return; - } - currentSearchTerm = term; - currentSort = sort; - if(jobPtr) { - jobPtr->abort(); - searchState = ResetRequested; - return; - } - else { - beginResetModel(); - modpacks.clear(); - endResetModel(); - searchState = None; - } - nextSearchOffset = 0; - performPaginatedSearch(); -} - -void Flame::ListModel::searchRequestFinished() -{ - jobPtr.reset(); - - QJsonParseError parse_error; - QJsonDocument doc = QJsonDocument::fromJson(response, &parse_error); - if(parse_error.error != QJsonParseError::NoError) { - qWarning() << "Error while parsing JSON response from CurseForge at " << parse_error.offset << " reason: " << parse_error.errorString(); - qWarning() << response; - return; - } - - QList newList; - auto packs = doc.array(); - for(auto packRaw : packs) { - auto packObj = packRaw.toObject(); - - Flame::IndexedPack pack; - try - { - Flame::loadIndexedPack(pack, packObj); - newList.append(pack); - } - catch(const JSONValidationError &e) - { - qWarning() << "Error while loading pack from CurseForge: " << e.cause(); - continue; - } - } - if(packs.size() < 25) { - searchState = Finished; - } else { - nextSearchOffset += 25; - searchState = CanPossiblyFetchMore; - } - beginInsertRows(QModelIndex(), modpacks.size(), modpacks.size() + newList.size() - 1); - modpacks.append(newList); - endInsertRows(); -} - -void Flame::ListModel::searchRequestFailed(QString reason) -{ - jobPtr.reset(); - - if(searchState == ResetRequested) { - beginResetModel(); - modpacks.clear(); - endResetModel(); - - nextSearchOffset = 0; - performPaginatedSearch(); - } else { - searchState = Finished; - } -} - -} - diff --git a/application/pages/modplatform/flame/FlameModel.h b/application/pages/modplatform/flame/FlameModel.h deleted file mode 100644 index 24383db0..00000000 --- a/application/pages/modplatform/flame/FlameModel.h +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -namespace Flame { - - -typedef QMap LogoMap; -typedef std::function LogoCallback; - -class ListModel : public QAbstractListModel -{ - Q_OBJECT - -public: - ListModel(QObject *parent); - virtual ~ListModel(); - - int rowCount(const QModelIndex &parent) const override; - int columnCount(const QModelIndex &parent) const override; - QVariant data(const QModelIndex &index, int role) const override; - Qt::ItemFlags flags(const QModelIndex &index) const override; - bool canFetchMore(const QModelIndex & parent) const override; - void fetchMore(const QModelIndex & parent) override; - - void getLogo(const QString &logo, const QString &logoUrl, LogoCallback callback); - void searchWithTerm(const QString & term, const int sort); - -private slots: - void performPaginatedSearch(); - - void logoFailed(QString logo); - void logoLoaded(QString logo, QIcon out); - - void searchRequestFinished(); - void searchRequestFailed(QString reason); - -private: - void requestLogo(QString file, QString url); - -private: - QList modpacks; - QStringList m_failedLogos; - QStringList m_loadingLogos; - LogoMap m_logoMap; - QMap waitingCallbacks; - - QString currentSearchTerm; - int currentSort = 0; - int nextSearchOffset = 0; - enum SearchState { - None, - CanPossiblyFetchMore, - ResetRequested, - Finished - } searchState = None; - NetJobPtr jobPtr; - QByteArray response; -}; - -} diff --git a/application/pages/modplatform/flame/FlamePage.cpp b/application/pages/modplatform/flame/FlamePage.cpp deleted file mode 100644 index ade58431..00000000 --- a/application/pages/modplatform/flame/FlamePage.cpp +++ /dev/null @@ -1,185 +0,0 @@ -#include "FlamePage.h" -#include "ui_FlamePage.h" - -#include "MultiMC.h" -#include -#include "dialogs/NewInstanceDialog.h" -#include -#include "FlameModel.h" -#include - -FlamePage::FlamePage(NewInstanceDialog* dialog, QWidget *parent) - : QWidget(parent), ui(new Ui::FlamePage), dialog(dialog) -{ - ui->setupUi(this); - connect(ui->searchButton, &QPushButton::clicked, this, &FlamePage::triggerSearch); - ui->searchEdit->installEventFilter(this); - listModel = new Flame::ListModel(this); - ui->packView->setModel(listModel); - - ui->versionSelectionBox->view()->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); - ui->versionSelectionBox->view()->parentWidget()->setMaximumHeight(300); - - // index is used to set the sorting with the curseforge api - ui->sortByBox->addItem(tr("Sort by featured")); - ui->sortByBox->addItem(tr("Sort by popularity")); - ui->sortByBox->addItem(tr("Sort by last updated")); - ui->sortByBox->addItem(tr("Sort by name")); - ui->sortByBox->addItem(tr("Sort by author")); - ui->sortByBox->addItem(tr("Sort by total downloads")); - - connect(ui->sortByBox, SIGNAL(currentIndexChanged(int)), this, SLOT(triggerSearch())); - connect(ui->packView->selectionModel(), &QItemSelectionModel::currentChanged, this, &FlamePage::onSelectionChanged); - connect(ui->versionSelectionBox, &QComboBox::currentTextChanged, this, &FlamePage::onVersionSelectionChanged); -} - -FlamePage::~FlamePage() -{ - delete ui; -} - -bool FlamePage::eventFilter(QObject* watched, QEvent* event) -{ - if (watched == ui->searchEdit && event->type() == QEvent::KeyPress) { - QKeyEvent* keyEvent = static_cast(event); - if (keyEvent->key() == Qt::Key_Return) { - triggerSearch(); - keyEvent->accept(); - return true; - } - } - return QWidget::eventFilter(watched, event); -} - -bool FlamePage::shouldDisplay() const -{ - return true; -} - -void FlamePage::openedImpl() -{ - suggestCurrent(); - triggerSearch(); -} - -void FlamePage::triggerSearch() -{ - listModel->searchWithTerm(ui->searchEdit->text(), ui->sortByBox->currentIndex()); -} - -void FlamePage::onSelectionChanged(QModelIndex first, QModelIndex second) -{ - ui->versionSelectionBox->clear(); - - if(!first.isValid()) - { - if(isOpened) - { - dialog->setSuggestedPack(); - } - return; - } - - current = listModel->data(first, Qt::UserRole).value(); - QString text = ""; - QString name = current.name; - - if (current.websiteUrl.isEmpty()) - text = name; - else - text = "" + name + ""; - if (!current.authors.empty()) { - auto authorToStr = [](Flame::ModpackAuthor & author) { - if(author.url.isEmpty()) { - return author.name; - } - return QString("%2").arg(author.url, author.name); - }; - QStringList authorStrs; - for(auto & author: current.authors) { - authorStrs.push_back(authorToStr(author)); - } - text += "
" + tr(" by ") + authorStrs.join(", "); - } - text += "

"; - - ui->packDescription->setHtml(text + current.description); - - if (current.versionsLoaded == false) - { - qDebug() << "Loading flame modpack versions"; - NetJob *netJob = new NetJob(QString("Flame::PackVersions(%1)").arg(current.name)); - std::shared_ptr response = std::make_shared(); - int addonId = current.addonId; - netJob->addNetAction(Net::Download::makeByteArray(QString("https://addons-ecs.forgesvc.net/api/v2/addon/%1/files").arg(addonId), response.get())); - - QObject::connect(netJob, &NetJob::succeeded, this, [this, response] - { - QJsonParseError parse_error; - QJsonDocument doc = QJsonDocument::fromJson(*response, &parse_error); - if(parse_error.error != QJsonParseError::NoError) { - qWarning() << "Error while parsing JSON response from CurseForge at " << parse_error.offset << " reason: " << parse_error.errorString(); - qWarning() << *response; - return; - } - QJsonArray arr = doc.array(); - try - { - Flame::loadIndexedPackVersions(current, arr); - } - catch(const JSONValidationError &e) - { - qDebug() << *response; - qWarning() << "Error while reading flame modpack version: " << e.cause(); - } - - for(auto version : current.versions) { - ui->versionSelectionBox->addItem(version.version, QVariant(version.downloadUrl)); - } - - suggestCurrent(); - }); - netJob->start(); - } - else - { - for(auto version : current.versions) { - ui->versionSelectionBox->addItem(version.version, QVariant(version.downloadUrl)); - } - - suggestCurrent(); - } -} - -void FlamePage::suggestCurrent() -{ - if(!isOpened) - { - return; - } - - if (selectedVersion.isEmpty()) - { - dialog->setSuggestedPack(); - return; - } - - dialog->setSuggestedPack(current.name, new InstanceImportTask(selectedVersion)); - QString editedLogoName; - editedLogoName = "curseforge_" + current.logoName.section(".", 0, 0); - listModel->getLogo(current.logoName, current.logoUrl, [this, editedLogoName](QString logo) - { - dialog->setSuggestedIconFromFile(logo, editedLogoName); - }); -} - -void FlamePage::onVersionSelectionChanged(QString data) -{ - if(data.isNull() || data.isEmpty()) - { - selectedVersion = ""; - return; - } - selectedVersion = ui->versionSelectionBox->currentData().toString(); - suggestCurrent(); -} diff --git a/application/pages/modplatform/flame/FlamePage.h b/application/pages/modplatform/flame/FlamePage.h deleted file mode 100644 index 467bb44b..00000000 --- a/application/pages/modplatform/flame/FlamePage.h +++ /dev/null @@ -1,80 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include "pages/BasePage.h" -#include -#include "tasks/Task.h" -#include - -namespace Ui -{ -class FlamePage; -} - -class NewInstanceDialog; - -namespace Flame { - class ListModel; -} - -class FlamePage : public QWidget, public BasePage -{ - Q_OBJECT - -public: - explicit FlamePage(NewInstanceDialog* dialog, QWidget *parent = 0); - virtual ~FlamePage(); - virtual QString displayName() const override - { - return tr("CurseForge"); - } - virtual QIcon icon() const override - { - return MMC->getThemedIcon("flame"); - } - virtual QString id() const override - { - return "flame"; - } - virtual QString helpPage() const override - { - return "Flame-platform"; - } - virtual bool shouldDisplay() const override; - - void openedImpl() override; - - bool eventFilter(QObject * watched, QEvent * event) override; - -private: - void suggestCurrent(); - -private slots: - void triggerSearch(); - void onSelectionChanged(QModelIndex first, QModelIndex second); - void onVersionSelectionChanged(QString data); - -private: - Ui::FlamePage *ui = nullptr; - NewInstanceDialog* dialog = nullptr; - Flame::ListModel* listModel = nullptr; - Flame::IndexedPack current; - - QString selectedVersion; -}; diff --git a/application/pages/modplatform/flame/FlamePage.ui b/application/pages/modplatform/flame/FlamePage.ui deleted file mode 100644 index 9723815a..00000000 --- a/application/pages/modplatform/flame/FlamePage.ui +++ /dev/null @@ -1,90 +0,0 @@ - - - FlamePage - - - - 0 - 0 - 837 - 685 - - - - - - - - - - 48 - 48 - - - - Qt::ScrollBarAlwaysOff - - - true - - - - - - - true - - - true - - - - - - - - - - - - - - Version selected: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - Search - - - - - - - Search and filter ... - - - - - - - searchEdit - searchButton - packView - packDescription - sortByBox - versionSelectionBox - - - - diff --git a/application/pages/modplatform/ftb/FtbFilterModel.cpp b/application/pages/modplatform/ftb/FtbFilterModel.cpp deleted file mode 100644 index dec3a017..00000000 --- a/application/pages/modplatform/ftb/FtbFilterModel.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#include "FtbFilterModel.h" - -#include - -#include "modplatform/modpacksch/FTBPackManifest.h" -#include - -namespace Ftb { - -FilterModel::FilterModel(QObject *parent) : QSortFilterProxyModel(parent) -{ - currentSorting = Sorting::ByPlays; - sortings.insert(tr("Sort by plays"), Sorting::ByPlays); - sortings.insert(tr("Sort by installs"), Sorting::ByInstalls); - sortings.insert(tr("Sort by name"), Sorting::ByName); -} - -const QMap FilterModel::getAvailableSortings() -{ - return sortings; -} - -QString FilterModel::translateCurrentSorting() -{ - return sortings.key(currentSorting); -} - -void FilterModel::setSorting(Sorting sorting) -{ - currentSorting = sorting; - invalidate(); -} - -FilterModel::Sorting FilterModel::getCurrentSorting() -{ - return currentSorting; -} - -bool FilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const -{ - return true; -} - -bool FilterModel::lessThan(const QModelIndex &left, const QModelIndex &right) const -{ - ModpacksCH::Modpack leftPack = sourceModel()->data(left, Qt::UserRole).value(); - ModpacksCH::Modpack rightPack = sourceModel()->data(right, Qt::UserRole).value(); - - if (currentSorting == ByPlays) { - return leftPack.plays < rightPack.plays; - } - else if (currentSorting == ByInstalls) { - return leftPack.installs < rightPack.installs; - } - else if (currentSorting == ByName) { - return Strings::naturalCompare(leftPack.name, rightPack.name, Qt::CaseSensitive) >= 0; - } - - // Invalid sorting set, somehow... - qWarning() << "Invalid sorting set!"; - return true; -} - -} diff --git a/application/pages/modplatform/ftb/FtbFilterModel.h b/application/pages/modplatform/ftb/FtbFilterModel.h deleted file mode 100644 index 4fe2a274..00000000 --- a/application/pages/modplatform/ftb/FtbFilterModel.h +++ /dev/null @@ -1,33 +0,0 @@ -#pragma once - -#include - -namespace Ftb { - -class FilterModel : public QSortFilterProxyModel -{ - Q_OBJECT - -public: - FilterModel(QObject* parent = Q_NULLPTR); - enum Sorting { - ByPlays, - ByInstalls, - ByName, - }; - const QMap getAvailableSortings(); - QString translateCurrentSorting(); - void setSorting(Sorting sorting); - Sorting getCurrentSorting(); - -protected: - bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; - bool lessThan(const QModelIndex &left, const QModelIndex &right) const override; - -private: - QMap sortings; - Sorting currentSorting; - -}; - -} diff --git a/application/pages/modplatform/ftb/FtbListModel.cpp b/application/pages/modplatform/ftb/FtbListModel.cpp deleted file mode 100644 index 98973f2e..00000000 --- a/application/pages/modplatform/ftb/FtbListModel.cpp +++ /dev/null @@ -1,304 +0,0 @@ -#include "FtbListModel.h" - -#include "BuildConfig.h" -#include "Env.h" -#include "MultiMC.h" -#include "Json.h" - -#include - -namespace Ftb { - -ListModel::ListModel(QObject *parent) : QAbstractListModel(parent) -{ -} - -ListModel::~ListModel() -{ -} - -int ListModel::rowCount(const QModelIndex &parent) const -{ - return modpacks.size(); -} - -int ListModel::columnCount(const QModelIndex &parent) const -{ - return 1; -} - -QVariant ListModel::data(const QModelIndex &index, int role) const -{ - int pos = index.row(); - if(pos >= modpacks.size() || pos < 0 || !index.isValid()) - { - return QString("INVALID INDEX %1").arg(pos); - } - - ModpacksCH::Modpack pack = modpacks.at(pos); - if(role == Qt::DisplayRole) - { - return pack.name; - } - else if (role == Qt::ToolTipRole) - { - return pack.synopsis; - } - else if(role == Qt::DecorationRole) - { - QIcon placeholder = MMC->getThemedIcon("screenshot-placeholder"); - - auto iter = m_logoMap.find(pack.name); - if (iter != m_logoMap.end()) { - auto & logo = *iter; - if(!logo.result.isNull()) { - return logo.result; - } - return placeholder; - } - - for(auto art : pack.art) { - if(art.type == "square") { - ((ListModel *)this)->requestLogo(pack.name, art.url); - } - } - return placeholder; - } - else if(role == Qt::UserRole) - { - QVariant v; - v.setValue(pack); - return v; - } - - return QVariant(); -} - -void ListModel::performSearch() -{ - auto *netJob = new NetJob("Ftb::Search"); - QString searchUrl; - if(currentSearchTerm.isEmpty()) { - searchUrl = BuildConfig.MODPACKSCH_API_BASE_URL + "public/modpack/all"; - } - else { - searchUrl = QString(BuildConfig.MODPACKSCH_API_BASE_URL + "public/modpack/search/25?term=%1") - .arg(currentSearchTerm); - } - netJob->addNetAction(Net::Download::makeByteArray(QUrl(searchUrl), &response)); - jobPtr = netJob; - jobPtr->start(); - QObject::connect(netJob, &NetJob::succeeded, this, &ListModel::searchRequestFinished); - QObject::connect(netJob, &NetJob::failed, this, &ListModel::searchRequestFailed); -} - -void ListModel::getLogo(const QString &logo, const QString &logoUrl, LogoCallback callback) -{ - if(m_logoMap.contains(logo)) - { - callback(ENV.metacache()->resolveEntry("ModpacksCHPacks", QString("logos/%1").arg(logo.section(".", 0, 0)))->getFullPath()); - } - else - { - requestLogo(logo, logoUrl); - } -} - -void ListModel::searchWithTerm(const QString &term) -{ - if(searchState != Failed && currentSearchTerm == term && currentSearchTerm.isNull() == term.isNull()) { - // unless the search has failed, then there is no need to perform an identical search. - return; - } - currentSearchTerm = term; - - if(jobPtr) { - jobPtr->abort(); - jobPtr.reset(); - } - - beginResetModel(); - modpacks.clear(); - endResetModel(); - searchState = None; - - performSearch(); -} - -void ListModel::searchRequestFinished() -{ - jobPtr.reset(); - remainingPacks.clear(); - - QJsonParseError parse_error; - QJsonDocument doc = QJsonDocument::fromJson(response, &parse_error); - if(parse_error.error != QJsonParseError::NoError) { - qWarning() << "Error while parsing JSON response from FTB at " << parse_error.offset << " reason: " << parse_error.errorString(); - qWarning() << response; - return; - } - - auto packs = doc.object().value("packs").toArray(); - for(auto pack : packs) { - auto packId = pack.toInt(); - remainingPacks.append(packId); - } - - if(!remainingPacks.isEmpty()) { - currentPack = remainingPacks.at(0); - requestPack(); - } -} - -void ListModel::searchRequestFailed(QString reason) -{ - jobPtr.reset(); - remainingPacks.clear(); - - searchState = Failed; -} - -void ListModel::requestPack() -{ - auto *netJob = new NetJob("Ftb::Search"); - auto searchUrl = QString(BuildConfig.MODPACKSCH_API_BASE_URL + "public/modpack/%1") - .arg(currentPack); - netJob->addNetAction(Net::Download::makeByteArray(QUrl(searchUrl), &response)); - jobPtr = netJob; - jobPtr->start(); - - QObject::connect(netJob, &NetJob::succeeded, this, &ListModel::packRequestFinished); - QObject::connect(netJob, &NetJob::failed, this, &ListModel::packRequestFailed); -} - -void ListModel::packRequestFinished() -{ - jobPtr.reset(); - remainingPacks.removeOne(currentPack); - - QJsonParseError parse_error; - QJsonDocument doc = QJsonDocument::fromJson(response, &parse_error); - - if(parse_error.error != QJsonParseError::NoError) { - qWarning() << "Error while parsing JSON response from FTB at " << parse_error.offset << " reason: " << parse_error.errorString(); - qWarning() << response; - return; - } - - auto obj = doc.object(); - - ModpacksCH::Modpack pack; - try - { - ModpacksCH::loadModpack(pack, obj); - } - catch (const JSONValidationError &e) - { - qDebug() << QString::fromUtf8(response); - qWarning() << "Error while reading pack manifest from FTB: " << e.cause(); - return; - } - - // Since there is no guarantee that packs have a version, this will just - // ignore those "dud" packs. - if (pack.versions.empty()) - { - qWarning() << "FTB Pack " << pack.id << " ignored. reason: lacking any versions"; - } - else - { - beginInsertRows(QModelIndex(), modpacks.size(), modpacks.size()); - modpacks.append(pack); - endInsertRows(); - } - - if(!remainingPacks.isEmpty()) { - currentPack = remainingPacks.at(0); - requestPack(); - } -} - -void ListModel::packRequestFailed(QString reason) -{ - jobPtr.reset(); - remainingPacks.removeOne(currentPack); -} - -void ListModel::logoLoaded(QString logo, bool stale) -{ - auto & logoObj = m_logoMap[logo]; - logoObj.downloadJob.reset(); - QString smallPath = logoObj.fullpath + ".small"; - - QFileInfo smallInfo(smallPath); - - if(stale || !smallInfo.exists()) { - QImage image(logoObj.fullpath); - if (image.isNull()) - { - logoObj.failed = true; - return; - } - 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(); - - square.save(logoObj.fullpath + ".small", "PNG"); - } - - logoObj.result = QIcon(logoObj.fullpath + ".small"); - for(int i = 0; i < modpacks.size(); i++) { - if(modpacks[i].name == logo) { - emit dataChanged(createIndex(i, 0), createIndex(i, 0), {Qt::DecorationRole}); - } - } -} - -void ListModel::logoFailed(QString logo) -{ - m_logoMap[logo].failed = true; - m_logoMap[logo].downloadJob.reset(); -} - -void ListModel::requestLogo(QString logo, QString url) -{ - if(m_logoMap.contains(logo)) { - return; - } - - MetaEntryPtr entry = ENV.metacache()->resolveEntry("ModpacksCHPacks", QString("logos/%1").arg(logo.section(".", 0, 0))); - - bool stale = entry->isStale(); - - NetJob *job = new NetJob(QString("FTB Icon Download %1").arg(logo)); - job->addNetAction(Net::Download::makeCached(QUrl(url), entry)); - - auto fullPath = entry->getFullPath(); - QObject::connect(job, &NetJob::finished, this, [this, logo, fullPath, stale] - { - logoLoaded(logo, stale); - }); - - QObject::connect(job, &NetJob::failed, this, [this, logo] - { - logoFailed(logo); - }); - - auto &newLogoEntry = m_logoMap[logo]; - newLogoEntry.downloadJob = job; - newLogoEntry.fullpath = fullPath; - job->start(); -} - -} diff --git a/application/pages/modplatform/ftb/FtbListModel.h b/application/pages/modplatform/ftb/FtbListModel.h deleted file mode 100644 index de94e6ba..00000000 --- a/application/pages/modplatform/ftb/FtbListModel.h +++ /dev/null @@ -1,69 +0,0 @@ -#pragma once - -#include - -#include "modplatform/modpacksch/FTBPackManifest.h" -#include "net/NetJob.h" -#include - -namespace Ftb { - -struct Logo { - QString fullpath; - NetJobPtr downloadJob; - QIcon result; - bool failed = false; -}; - -typedef QMap LogoMap; -typedef std::function LogoCallback; - -class ListModel : public QAbstractListModel -{ - Q_OBJECT - -public: - ListModel(QObject *parent); - virtual ~ListModel(); - - int rowCount(const QModelIndex &parent) const override; - int columnCount(const QModelIndex &parent) const override; - QVariant data(const QModelIndex &index, int role) const override; - - void getLogo(const QString &logo, const QString &logoUrl, LogoCallback callback); - void searchWithTerm(const QString & term); - -private slots: - void performSearch(); - void searchRequestFinished(); - void searchRequestFailed(QString reason); - - void requestPack(); - void packRequestFinished(); - void packRequestFailed(QString reason); - - void logoFailed(QString logo); - void logoLoaded(QString logo, bool stale); - -private: - void requestLogo(QString file, QString url); - -private: - QList modpacks; - LogoMap m_logoMap; - - QString currentSearchTerm; - enum SearchState { - None, - CanPossiblyFetchMore, - ResetRequested, - Finished, - Failed, - } searchState = None; - NetJobPtr jobPtr; - int currentPack; - QList remainingPacks; - QByteArray response; -}; - -} diff --git a/application/pages/modplatform/ftb/FtbPage.cpp b/application/pages/modplatform/ftb/FtbPage.cpp deleted file mode 100644 index b7f35c5d..00000000 --- a/application/pages/modplatform/ftb/FtbPage.cpp +++ /dev/null @@ -1,145 +0,0 @@ -#include "FtbPage.h" -#include "ui_FtbPage.h" - -#include - -#include "dialogs/NewInstanceDialog.h" -#include "modplatform/modpacksch/FTBPackInstallTask.h" - -#include "HoeDown.h" - -FtbPage::FtbPage(NewInstanceDialog* dialog, QWidget *parent) - : QWidget(parent), ui(new Ui::FtbPage), dialog(dialog) -{ - ui->setupUi(this); - - filterModel = new Ftb::FilterModel(this); - listModel = new Ftb::ListModel(this); - filterModel->setSourceModel(listModel); - ui->packView->setModel(filterModel); - ui->packView->setSortingEnabled(true); - ui->packView->header()->hide(); - ui->packView->setIndentation(0); - - ui->searchEdit->installEventFilter(this); - - ui->versionSelectionBox->view()->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); - ui->versionSelectionBox->view()->parentWidget()->setMaximumHeight(300); - - for(int i = 0; i < filterModel->getAvailableSortings().size(); i++) - { - ui->sortByBox->addItem(filterModel->getAvailableSortings().keys().at(i)); - } - ui->sortByBox->setCurrentText(filterModel->translateCurrentSorting()); - - connect(ui->searchButton, &QPushButton::clicked, this, &FtbPage::triggerSearch); - connect(ui->sortByBox, &QComboBox::currentTextChanged, this, &FtbPage::onSortingSelectionChanged); - connect(ui->packView->selectionModel(), &QItemSelectionModel::currentChanged, this, &FtbPage::onSelectionChanged); - connect(ui->versionSelectionBox, &QComboBox::currentTextChanged, this, &FtbPage::onVersionSelectionChanged); -} - -FtbPage::~FtbPage() -{ - delete ui; -} - -bool FtbPage::eventFilter(QObject* watched, QEvent* event) -{ - if (watched == ui->searchEdit && event->type() == QEvent::KeyPress) { - QKeyEvent* keyEvent = static_cast(event); - if (keyEvent->key() == Qt::Key_Return) { - triggerSearch(); - keyEvent->accept(); - return true; - } - } - return QWidget::eventFilter(watched, event); -} - -bool FtbPage::shouldDisplay() const -{ - return true; -} - -void FtbPage::openedImpl() -{ - triggerSearch(); - suggestCurrent(); -} - -void FtbPage::suggestCurrent() -{ - if(!isOpened) - { - return; - } - - if (selectedVersion.isEmpty()) - { - dialog->setSuggestedPack(); - return; - } - - dialog->setSuggestedPack(selected.name, new ModpacksCH::PackInstallTask(selected, selectedVersion)); - for(auto art : selected.art) { - if(art.type == "square") { - QString editedLogoName; - editedLogoName = selected.name; - - listModel->getLogo(selected.name, art.url, [this, editedLogoName](QString logo) - { - dialog->setSuggestedIconFromFile(logo + ".small", editedLogoName); - }); - } - } -} - -void FtbPage::triggerSearch() -{ - listModel->searchWithTerm(ui->searchEdit->text()); -} - -void FtbPage::onSortingSelectionChanged(QString data) -{ - auto toSet = filterModel->getAvailableSortings().value(data); - filterModel->setSorting(toSet); -} - -void FtbPage::onSelectionChanged(QModelIndex first, QModelIndex second) -{ - ui->versionSelectionBox->clear(); - - if(!first.isValid()) - { - if(isOpened) - { - dialog->setSuggestedPack(); - } - return; - } - - selected = filterModel->data(first, Qt::UserRole).value(); - - HoeDown hoedown; - QString output = hoedown.process(selected.description.toUtf8()); - ui->packDescription->setHtml(output); - - // reverse foreach, so that the newest versions are first - for (auto i = selected.versions.size(); i--;) { - ui->versionSelectionBox->addItem(selected.versions.at(i).name); - } - - suggestCurrent(); -} - -void FtbPage::onVersionSelectionChanged(QString data) -{ - if(data.isNull() || data.isEmpty()) - { - selectedVersion = ""; - return; - } - - selectedVersion = data; - suggestCurrent(); -} diff --git a/application/pages/modplatform/ftb/FtbPage.h b/application/pages/modplatform/ftb/FtbPage.h deleted file mode 100644 index c9c93897..00000000 --- a/application/pages/modplatform/ftb/FtbPage.h +++ /dev/null @@ -1,80 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "FtbFilterModel.h" -#include "FtbListModel.h" - -#include - -#include "MultiMC.h" -#include "pages/BasePage.h" -#include "tasks/Task.h" - -namespace Ui -{ - class FtbPage; -} - -class NewInstanceDialog; - -class FtbPage : public QWidget, public BasePage -{ -Q_OBJECT - -public: - explicit FtbPage(NewInstanceDialog* dialog, QWidget *parent = 0); - virtual ~FtbPage(); - virtual QString displayName() const override - { - return tr("FTB"); - } - virtual QIcon icon() const override - { - return MMC->getThemedIcon("ftb_logo"); - } - virtual QString id() const override - { - return "ftb"; - } - virtual QString helpPage() const override - { - return "FTB-platform"; - } - virtual bool shouldDisplay() const override; - - void openedImpl() override; - - bool eventFilter(QObject * watched, QEvent * event) override; - -private: - void suggestCurrent(); - -private slots: - void triggerSearch(); - void onSortingSelectionChanged(QString data); - void onSelectionChanged(QModelIndex first, QModelIndex second); - void onVersionSelectionChanged(QString data); - -private: - Ui::FtbPage *ui = nullptr; - NewInstanceDialog* dialog = nullptr; - Ftb::ListModel* listModel = nullptr; - Ftb::FilterModel* filterModel = nullptr; - - ModpacksCH::Modpack selected; - QString selectedVersion; -}; diff --git a/application/pages/modplatform/ftb/FtbPage.ui b/application/pages/modplatform/ftb/FtbPage.ui deleted file mode 100644 index 135afc6d..00000000 --- a/application/pages/modplatform/ftb/FtbPage.ui +++ /dev/null @@ -1,84 +0,0 @@ - - - FtbPage - - - - 0 - 0 - 875 - 745 - - - - - - - - - - - - Version selected: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - Search and filter ... - - - - - - - Search - - - - - - - - - - 48 - 48 - - - - true - - - - - - - true - - - true - - - - - - - - - searchEdit - searchButton - versionSelectionBox - - - - diff --git a/application/pages/modplatform/legacy_ftb/ListModel.cpp b/application/pages/modplatform/legacy_ftb/ListModel.cpp deleted file mode 100644 index 32596fb3..00000000 --- a/application/pages/modplatform/legacy_ftb/ListModel.cpp +++ /dev/null @@ -1,260 +0,0 @@ -#include "ListModel.h" -#include "MultiMC.h" - -#include -#include - -#include -#include - -#include -#include - -#include - -namespace LegacyFTB { - -FilterModel::FilterModel(QObject *parent) : QSortFilterProxyModel(parent) -{ - currentSorting = Sorting::ByGameVersion; - sortings.insert(tr("Sort by name"), Sorting::ByName); - sortings.insert(tr("Sort by game version"), Sorting::ByGameVersion); -} - -bool FilterModel::lessThan(const QModelIndex &left, const QModelIndex &right) const -{ - Modpack leftPack = sourceModel()->data(left, Qt::UserRole).value(); - Modpack rightPack = sourceModel()->data(right, Qt::UserRole).value(); - - if(currentSorting == Sorting::ByGameVersion) { - Version lv(leftPack.mcVersion); - Version rv(rightPack.mcVersion); - return lv < rv; - - } else if(currentSorting == Sorting::ByName) { - return Strings::naturalCompare(leftPack.name, rightPack.name, Qt::CaseSensitive) >= 0; - } - - //UHM, some inavlid value set?! - qWarning() << "Invalid sorting set!"; - return true; -} - -bool FilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const -{ - return true; -} - -const QMap FilterModel::getAvailableSortings() -{ - return sortings; -} - -QString FilterModel::translateCurrentSorting() -{ - return sortings.key(currentSorting); -} - -void FilterModel::setSorting(Sorting s) -{ - currentSorting = s; - invalidate(); -} - -FilterModel::Sorting FilterModel::getCurrentSorting() -{ - return currentSorting; -} - -ListModel::ListModel(QObject *parent) : QAbstractListModel(parent) -{ -} - -ListModel::~ListModel() -{ -} - -QString ListModel::translatePackType(PackType type) const -{ - switch(type) - { - case PackType::Public: - return tr("Public Modpack"); - case PackType::ThirdParty: - return tr("Third Party Modpack"); - case PackType::Private: - return tr("Private Modpack"); - } - qWarning() << "Unknown FTB modpack type:" << int(type); - return QString(); -} - -int ListModel::rowCount(const QModelIndex &parent) const -{ - return modpacks.size(); -} - -int ListModel::columnCount(const QModelIndex &parent) const -{ - return 1; -} - -QVariant ListModel::data(const QModelIndex &index, int role) const -{ - int pos = index.row(); - if(pos >= modpacks.size() || pos < 0 || !index.isValid()) - { - return QString("INVALID INDEX %1").arg(pos); - } - - Modpack pack = modpacks.at(pos); - if(role == Qt::DisplayRole) - { - return pack.name + "\n" + translatePackType(pack.type); - } - else if (role == Qt::ToolTipRole) - { - if(pack.description.length() > 100) - { - //some magic to prevent to long tooltips and replace html linebreaks - QString edit = pack.description.left(97); - edit = edit.left(edit.lastIndexOf("
")).left(edit.lastIndexOf(" ")).append("..."); - return edit; - - } - return pack.description; - } - else if(role == Qt::DecorationRole) - { - if(m_logoMap.contains(pack.logo)) - { - return (m_logoMap.value(pack.logo)); - } - QIcon icon = MMC->getThemedIcon("screenshot-placeholder"); - ((ListModel *)this)->requestLogo(pack.logo); - return icon; - } - else if(role == Qt::TextColorRole) - { - if(pack.broken) - { - //FIXME: Hardcoded color - return QColor(255, 0, 50); - } - else if(pack.bugged) - { - //FIXME: Hardcoded color - //bugged pack, currently only indicates bugged xml - return QColor(244, 229, 66); - } - } - else if(role == Qt::UserRole) - { - QVariant v; - v.setValue(pack); - return v; - } - - return QVariant(); -} - -void ListModel::fill(ModpackList modpacks) -{ - beginResetModel(); - this->modpacks = modpacks; - endResetModel(); -} - -void ListModel::addPack(Modpack modpack) -{ - beginResetModel(); - this->modpacks.append(modpack); - endResetModel(); -} - -void ListModel::clear() -{ - beginResetModel(); - modpacks.clear(); - endResetModel(); -} - -Modpack ListModel::at(int row) -{ - return modpacks.at(row); -} - -void ListModel::remove(int row) -{ - if(row < 0 || row >= modpacks.size()) - { - qWarning() << "Attempt to remove FTB modpacks with invalid row" << row; - return; - } - beginRemoveRows(QModelIndex(), row, row); - modpacks.removeAt(row); - endRemoveRows(); -} - -void ListModel::logoLoaded(QString logo, QIcon out) -{ - m_loadingLogos.removeAll(logo); - m_logoMap.insert(logo, out); - emit dataChanged(createIndex(0, 0), createIndex(1, 0)); -} - -void ListModel::logoFailed(QString logo) -{ - m_failedLogos.append(logo); - m_loadingLogos.removeAll(logo); -} - -void ListModel::requestLogo(QString file) -{ - if(m_loadingLogos.contains(file) || m_failedLogos.contains(file)) - { - return; - } - - MetaEntryPtr entry = ENV.metacache()->resolveEntry("FTBPacks", QString("logos/%1").arg(file.section(".", 0, 0))); - NetJob *job = new NetJob(QString("FTB Icon Download for %1").arg(file)); - job->addNetAction(Net::Download::makeCached(QUrl(QString(BuildConfig.LEGACY_FTB_CDN_BASE_URL + "static/%1").arg(file)), entry)); - - auto fullPath = entry->getFullPath(); - QObject::connect(job, &NetJob::finished, this, [this, file, fullPath] - { - emit logoLoaded(file, QIcon(fullPath)); - if(waitingCallbacks.contains(file)) - { - waitingCallbacks.value(file)(fullPath); - } - }); - - QObject::connect(job, &NetJob::failed, this, [this, file] - { - emit logoFailed(file); - }); - - job->start(); - - m_loadingLogos.append(file); -} - -void ListModel::getLogo(const QString &logo, LogoCallback callback) -{ - if(m_logoMap.contains(logo)) - { - callback(ENV.metacache()->resolveEntry("FTBPacks", QString("logos/%1").arg(logo.section(".", 0, 0)))->getFullPath()); - } - else - { - requestLogo(logo); - } -} - -Qt::ItemFlags ListModel::flags(const QModelIndex &index) const -{ - return QAbstractListModel::flags(index); -} - -} diff --git a/application/pages/modplatform/legacy_ftb/ListModel.h b/application/pages/modplatform/legacy_ftb/ListModel.h deleted file mode 100644 index c55df000..00000000 --- a/application/pages/modplatform/legacy_ftb/ListModel.h +++ /dev/null @@ -1,78 +0,0 @@ -#pragma once - -#include -#include - -#include -#include -#include -#include -#include - -#include - -namespace LegacyFTB { - -typedef QMap FTBLogoMap; -typedef std::function LogoCallback; - -class FilterModel : public QSortFilterProxyModel -{ - Q_OBJECT -public: - FilterModel(QObject* parent = Q_NULLPTR); - enum Sorting { - ByName, - ByGameVersion - }; - const QMap getAvailableSortings(); - QString translateCurrentSorting(); - void setSorting(Sorting sorting); - Sorting getCurrentSorting(); - -protected: - bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; - bool lessThan(const QModelIndex &left, const QModelIndex &right) const override; - -private: - QMap sortings; - Sorting currentSorting; - -}; - -class ListModel : public QAbstractListModel -{ - Q_OBJECT -private: - ModpackList modpacks; - QStringList m_failedLogos; - QStringList m_loadingLogos; - FTBLogoMap m_logoMap; - QMap waitingCallbacks; - - void requestLogo(QString file); - QString translatePackType(PackType type) const; - - -private slots: - void logoFailed(QString logo); - void logoLoaded(QString logo, QIcon out); - -public: - ListModel(QObject *parent); - ~ListModel(); - int rowCount(const QModelIndex &parent) const override; - int columnCount(const QModelIndex &parent) const override; - QVariant data(const QModelIndex &index, int role) const override; - Qt::ItemFlags flags(const QModelIndex &index) const override; - - void fill(ModpackList modpacks); - void addPack(Modpack modpack); - void clear(); - void remove(int row); - - Modpack at(int row); - void getLogo(const QString &logo, LogoCallback callback); -}; - -} diff --git a/application/pages/modplatform/legacy_ftb/Page.cpp b/application/pages/modplatform/legacy_ftb/Page.cpp deleted file mode 100644 index a438f76c..00000000 --- a/application/pages/modplatform/legacy_ftb/Page.cpp +++ /dev/null @@ -1,369 +0,0 @@ -#include "Page.h" -#include "ui_Page.h" - -#include - -#include "MultiMC.h" -#include "dialogs/CustomMessageBox.h" -#include "dialogs/NewInstanceDialog.h" -#include "modplatform/legacy_ftb/PackFetchTask.h" -#include "modplatform/legacy_ftb/PackInstallTask.h" -#include "modplatform/legacy_ftb/PrivatePackManager.h" -#include "ListModel.h" - -namespace LegacyFTB { - -Page::Page(NewInstanceDialog* dialog, QWidget *parent) - : QWidget(parent), dialog(dialog), ui(new Ui::Page) -{ - ftbFetchTask.reset(new PackFetchTask()); - ftbPrivatePacks.reset(new PrivatePackManager()); - - ui->setupUi(this); - - { - publicFilterModel = new FilterModel(this); - publicListModel = new ListModel(this); - publicFilterModel->setSourceModel(publicListModel); - - ui->publicPackList->setModel(publicFilterModel); - ui->publicPackList->setSortingEnabled(true); - ui->publicPackList->header()->hide(); - ui->publicPackList->setIndentation(0); - ui->publicPackList->setIconSize(QSize(42, 42)); - - for(int i = 0; i < publicFilterModel->getAvailableSortings().size(); i++) - { - ui->sortByBox->addItem(publicFilterModel->getAvailableSortings().keys().at(i)); - } - - ui->sortByBox->setCurrentText(publicFilterModel->translateCurrentSorting()); - } - - { - thirdPartyFilterModel = new FilterModel(this); - thirdPartyModel = new ListModel(this); - thirdPartyFilterModel->setSourceModel(thirdPartyModel); - - ui->thirdPartyPackList->setModel(thirdPartyFilterModel); - ui->thirdPartyPackList->setSortingEnabled(true); - ui->thirdPartyPackList->header()->hide(); - ui->thirdPartyPackList->setIndentation(0); - ui->thirdPartyPackList->setIconSize(QSize(42, 42)); - - thirdPartyFilterModel->setSorting(publicFilterModel->getCurrentSorting()); - } - - { - privateFilterModel = new FilterModel(this); - privateListModel = new ListModel(this); - privateFilterModel->setSourceModel(privateListModel); - - ui->privatePackList->setModel(privateFilterModel); - ui->privatePackList->setSortingEnabled(true); - ui->privatePackList->header()->hide(); - ui->privatePackList->setIndentation(0); - ui->privatePackList->setIconSize(QSize(42, 42)); - - privateFilterModel->setSorting(publicFilterModel->getCurrentSorting()); - } - - ui->versionSelectionBox->view()->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); - ui->versionSelectionBox->view()->parentWidget()->setMaximumHeight(300); - - connect(ui->sortByBox, &QComboBox::currentTextChanged, this, &Page::onSortingSelectionChanged); - connect(ui->versionSelectionBox, &QComboBox::currentTextChanged, this, &Page::onVersionSelectionItemChanged); - - connect(ui->publicPackList->selectionModel(), &QItemSelectionModel::currentChanged, this, &Page::onPublicPackSelectionChanged); - 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->tabWidget, &QTabWidget::currentChanged, this, &Page::onTabChanged); - - // ui->modpackInfo->setOpenExternalLinks(true); - - ui->publicPackList->selectionModel()->reset(); - ui->thirdPartyPackList->selectionModel()->reset(); - ui->privatePackList->selectionModel()->reset(); - - onTabChanged(ui->tabWidget->currentIndex()); -} - -Page::~Page() -{ - delete ui; -} - -bool Page::shouldDisplay() const -{ - return true; -} - -void Page::openedImpl() -{ - if(!initialized) - { - connect(ftbFetchTask.get(), &PackFetchTask::finished, this, &Page::ftbPackDataDownloadSuccessfully); - connect(ftbFetchTask.get(), &PackFetchTask::failed, this, &Page::ftbPackDataDownloadFailed); - - connect(ftbFetchTask.get(), &PackFetchTask::privateFileDownloadFinished, this, &Page::ftbPrivatePackDataDownloadSuccessfully); - connect(ftbFetchTask.get(), &PackFetchTask::privateFileDownloadFailed, this, &Page::ftbPrivatePackDataDownloadFailed); - - ftbFetchTask->fetch(); - ftbPrivatePacks->load(); - ftbFetchTask->fetchPrivate(ftbPrivatePacks->getCurrentPackCodes().toList()); - initialized = true; - } - suggestCurrent(); -} - -void Page::suggestCurrent() -{ - if(!isOpened) - { - return; - } - - if(selected.broken || selectedVersion.isEmpty()) - { - dialog->setSuggestedPack(); - return; - } - - dialog->setSuggestedPack(selected.name, new PackInstallTask(selected, selectedVersion)); - QString editedLogoName; - if(selected.logo.toLower().startsWith("ftb")) - { - editedLogoName = selected.logo; - } - else - { - editedLogoName = "ftb_" + selected.logo; - } - - editedLogoName = editedLogoName.left(editedLogoName.lastIndexOf(".png")); - - if(selected.type == PackType::Public) - { - publicListModel->getLogo(selected.logo, [this, editedLogoName](QString logo) - { - dialog->setSuggestedIconFromFile(logo, editedLogoName); - }); - } - else if (selected.type == PackType::ThirdParty) - { - thirdPartyModel->getLogo(selected.logo, [this, editedLogoName](QString logo) - { - dialog->setSuggestedIconFromFile(logo, editedLogoName); - }); - } - else if (selected.type == PackType::Private) - { - privateListModel->getLogo(selected.logo, [this, editedLogoName](QString logo) - { - dialog->setSuggestedIconFromFile(logo, editedLogoName); - }); - } -} - -void Page::ftbPackDataDownloadSuccessfully(ModpackList publicPacks, ModpackList thirdPartyPacks) -{ - publicListModel->fill(publicPacks); - thirdPartyModel->fill(thirdPartyPacks); -} - -void Page::ftbPackDataDownloadFailed(QString reason) -{ - //TODO: Display the error -} - -void Page::ftbPrivatePackDataDownloadSuccessfully(Modpack pack) -{ - privateListModel->addPack(pack); -} - -void Page::ftbPrivatePackDataDownloadFailed(QString reason, QString packCode) -{ - auto reply = QMessageBox::question( - this, - tr("FTB private packs"), - tr("Failed to download pack information for code %1.\nShould it be removed now?").arg(packCode) - ); - if(reply == QMessageBox::Yes) - { - ftbPrivatePacks->remove(packCode); - } -} - -void Page::onPublicPackSelectionChanged(QModelIndex now, QModelIndex prev) -{ - if(!now.isValid()) - { - onPackSelectionChanged(); - return; - } - Modpack selectedPack = publicFilterModel->data(now, Qt::UserRole).value(); - onPackSelectionChanged(&selectedPack); -} - -void Page::onThirdPartyPackSelectionChanged(QModelIndex now, QModelIndex prev) -{ - if(!now.isValid()) - { - onPackSelectionChanged(); - return; - } - Modpack selectedPack = thirdPartyFilterModel->data(now, Qt::UserRole).value(); - onPackSelectionChanged(&selectedPack); -} - -void Page::onPrivatePackSelectionChanged(QModelIndex now, QModelIndex prev) -{ - if(!now.isValid()) - { - onPackSelectionChanged(); - return; - } - Modpack selectedPack = privateFilterModel->data(now, Qt::UserRole).value(); - onPackSelectionChanged(&selectedPack); -} - -void Page::onPackSelectionChanged(Modpack* pack) -{ - ui->versionSelectionBox->clear(); - if(pack) - { - currentModpackInfo->setHtml("Pack by " + pack->author + "" + - "
Minecraft " + pack->mcVersion + "
" + "
" + pack->description + "
  • " + pack->mods.replace(";", "
  • ") - + "
"); - bool currentAdded = false; - - for(int i = 0; i < pack->oldVersions.size(); i++) - { - if(pack->currentVersion == pack->oldVersions.at(i)) - { - currentAdded = true; - } - ui->versionSelectionBox->addItem(pack->oldVersions.at(i)); - } - - if(!currentAdded) - { - ui->versionSelectionBox->addItem(pack->currentVersion); - } - selected = *pack; - } - else - { - currentModpackInfo->setHtml(""); - ui->versionSelectionBox->clear(); - if(isOpened) - { - dialog->setSuggestedPack(); - } - return; - } - suggestCurrent(); -} - -void Page::onVersionSelectionItemChanged(QString data) -{ - if(data.isNull() || data.isEmpty()) - { - selectedVersion = ""; - return; - } - - selectedVersion = data; - suggestCurrent(); -} - -void Page::onSortingSelectionChanged(QString data) -{ - FilterModel::Sorting toSet = publicFilterModel->getAvailableSortings().value(data); - publicFilterModel->setSorting(toSet); - thirdPartyFilterModel->setSorting(toSet); - privateFilterModel->setSorting(toSet); -} - -void Page::onTabChanged(int tab) -{ - if(tab == 1) - { - currentModel = thirdPartyFilterModel; - currentList = ui->thirdPartyPackList; - currentModpackInfo = ui->thirdPartyPackDescription; - } - else if(tab == 2) - { - currentModel = privateFilterModel; - currentList = ui->privatePackList; - currentModpackInfo = ui->privatePackDescription; - } - else - { - currentModel = publicFilterModel; - currentList = ui->publicPackList; - currentModpackInfo = ui->publicPackDescription; - } - - currentList->selectionModel()->reset(); - QModelIndex idx = currentList->currentIndex(); - if(idx.isValid()) - { - auto pack = currentModel->data(idx, Qt::UserRole).value(); - onPackSelectionChanged(&pack); - } - else - { - onPackSelectionChanged(); - } -} - -void Page::onAddPackClicked() -{ - bool ok; - QString text = QInputDialog::getText( - this, - tr("Add FTB pack"), - tr("Enter pack code:"), - QLineEdit::Normal, - QString(), - &ok - ); - if(ok && !text.isEmpty()) - { - ftbPrivatePacks->add(text); - ftbFetchTask->fetchPrivate({text}); - } -} - -void Page::onRemovePackClicked() -{ - auto index = ui->privatePackList->currentIndex(); - if(!index.isValid()) - { - return; - } - auto row = index.row(); - Modpack pack = privateListModel->at(row); - auto answer = QMessageBox::question( - this, - tr("Remove pack"), - tr("Are you sure you want to remove pack %1?").arg(pack.name), - QMessageBox::Yes | QMessageBox::No - ); - if(answer != QMessageBox::Yes) - { - return; - } - - ftbPrivatePacks->remove(pack.packCode); - privateListModel->remove(row); - onPackSelectionChanged(); -} - -} diff --git a/application/pages/modplatform/legacy_ftb/Page.h b/application/pages/modplatform/legacy_ftb/Page.h deleted file mode 100644 index e840216e..00000000 --- a/application/pages/modplatform/legacy_ftb/Page.h +++ /dev/null @@ -1,119 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include - -#include "pages/BasePage.h" -#include -#include "tasks/Task.h" -#include "modplatform/legacy_ftb/PackHelpers.h" -#include "modplatform/legacy_ftb/PackFetchTask.h" -#include "QObjectPtr.h" - -class NewInstanceDialog; - -namespace LegacyFTB { - -namespace Ui -{ -class Page; -} - -class ListModel; -class FilterModel; -class PrivatePackListModel; -class PrivatePackFilterModel; -class PrivatePackManager; - -class Page : public QWidget, public BasePage -{ - Q_OBJECT - -public: - explicit Page(NewInstanceDialog * dialog, QWidget *parent = 0); - virtual ~Page(); - QString displayName() const override - { - return tr("FTB Legacy"); - } - QIcon icon() const override - { - return MMC->getThemedIcon("ftb_logo"); - } - QString id() const override - { - return "legacy_ftb"; - } - QString helpPage() const override - { - return "FTB-platform"; - } - bool shouldDisplay() const override; - void openedImpl() override; - -private: - void suggestCurrent(); - void onPackSelectionChanged(Modpack *pack = nullptr); - -private slots: - void ftbPackDataDownloadSuccessfully(ModpackList publicPacks, ModpackList thirdPartyPacks); - void ftbPackDataDownloadFailed(QString reason); - - void ftbPrivatePackDataDownloadSuccessfully(Modpack pack); - void ftbPrivatePackDataDownloadFailed(QString reason, QString packCode); - - void onSortingSelectionChanged(QString data); - void onVersionSelectionItemChanged(QString data); - - void onPublicPackSelectionChanged(QModelIndex first, QModelIndex second); - void onThirdPartyPackSelectionChanged(QModelIndex first, QModelIndex second); - void onPrivatePackSelectionChanged(QModelIndex first, QModelIndex second); - - void onTabChanged(int tab); - - void onAddPackClicked(); - void onRemovePackClicked(); - -private: - FilterModel* currentModel = nullptr; - QTreeView* currentList = nullptr; - QTextBrowser* currentModpackInfo = nullptr; - - bool initialized = false; - Modpack selected; - QString selectedVersion; - - ListModel* publicListModel = nullptr; - FilterModel* publicFilterModel = nullptr; - - ListModel *thirdPartyModel = nullptr; - FilterModel *thirdPartyFilterModel = nullptr; - - ListModel *privateListModel = nullptr; - FilterModel *privateFilterModel = nullptr; - - unique_qobject_ptr ftbFetchTask; - std::unique_ptr ftbPrivatePacks; - - NewInstanceDialog* dialog = nullptr; - - Ui::Page *ui = nullptr; -}; - -} diff --git a/application/pages/modplatform/legacy_ftb/Page.ui b/application/pages/modplatform/legacy_ftb/Page.ui deleted file mode 100644 index 15e5d432..00000000 --- a/application/pages/modplatform/legacy_ftb/Page.ui +++ /dev/null @@ -1,135 +0,0 @@ - - - LegacyFTB::Page - - - - 0 - 0 - 709 - 602 - - - - - - - 0 - - - - Public - - - - - - - 250 - 16777215 - - - - true - - - - - - - - - - - 3rd Party - - - - - - - - - - 250 - 16777215 - - - - true - - - - - - - - Private - - - - - - - 250 - 16777215 - - - - true - - - - - - - Add pack - - - - - - - Remove selected pack - - - - - - - - - - - - - - - - Version selected: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - 265 - 0 - - - - - - - - - - - diff --git a/application/pages/modplatform/technic/TechnicData.h b/application/pages/modplatform/technic/TechnicData.h deleted file mode 100644 index 50fd75e8..00000000 --- a/application/pages/modplatform/technic/TechnicData.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright 2020-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -namespace Technic { -struct Modpack { - QString slug; - - QString name; - QString logoUrl; - QString logoName; - - bool broken = true; - - QString url; - bool isSolder = false; - QString minecraftVersion; - - bool metadataLoaded = false; - QString websiteUrl; - QString author; - QString description; -}; -} - -Q_DECLARE_METATYPE(Technic::Modpack) diff --git a/application/pages/modplatform/technic/TechnicModel.cpp b/application/pages/modplatform/technic/TechnicModel.cpp deleted file mode 100644 index def30783..00000000 --- a/application/pages/modplatform/technic/TechnicModel.cpp +++ /dev/null @@ -1,238 +0,0 @@ -/* Copyright 2020-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "TechnicModel.h" -#include "Env.h" -#include "MultiMC.h" -#include "Json.h" - -#include - -Technic::ListModel::ListModel(QObject *parent) : QAbstractListModel(parent) -{ -} - -Technic::ListModel::~ListModel() -{ -} - -QVariant Technic::ListModel::data(const QModelIndex& index, int role) const -{ - int pos = index.row(); - if(pos >= modpacks.size() || pos < 0 || !index.isValid()) - { - return QString("INVALID INDEX %1").arg(pos); - } - - Modpack pack = modpacks.at(pos); - if(role == Qt::DisplayRole) - { - return pack.name; - } - else if(role == Qt::DecorationRole) - { - if(m_logoMap.contains(pack.logoName)) - { - return (m_logoMap.value(pack.logoName)); - } - QIcon icon = MMC->getThemedIcon("screenshot-placeholder"); - ((ListModel *)this)->requestLogo(pack.logoName, pack.logoUrl); - return icon; - } - else if(role == Qt::UserRole) - { - QVariant v; - v.setValue(pack); - return v; - } - return QVariant(); -} - -int Technic::ListModel::columnCount(const QModelIndex&) const -{ - return 1; -} - -int Technic::ListModel::rowCount(const QModelIndex&) const -{ - return modpacks.size(); -} - -void Technic::ListModel::searchWithTerm(const QString& term) -{ - if(currentSearchTerm == term && currentSearchTerm.isNull() == term.isNull()) { - return; - } - currentSearchTerm = term; - if(jobPtr) { - jobPtr->abort(); - searchState = ResetRequested; - return; - } - else { - beginResetModel(); - modpacks.clear(); - endResetModel(); - searchState = None; - } - performSearch(); -} - -void Technic::ListModel::performSearch() -{ - NetJob *netJob = new NetJob("Technic::Search"); - QString searchUrl = ""; - if (currentSearchTerm.isEmpty()) { - searchUrl = "https://api.technicpack.net/trending?build=multimc"; - } - else - { - searchUrl = QString( - "https://api.technicpack.net/search?build=multimc&q=%1" - ).arg(currentSearchTerm); - } - netJob->addNetAction(Net::Download::makeByteArray(QUrl(searchUrl), &response)); - jobPtr = netJob; - jobPtr->start(); - QObject::connect(netJob, &NetJob::succeeded, this, &ListModel::searchRequestFinished); - QObject::connect(netJob, &NetJob::failed, this, &ListModel::searchRequestFailed); -} - -void Technic::ListModel::searchRequestFinished() -{ - jobPtr.reset(); - - QJsonParseError parse_error; - QJsonDocument doc = QJsonDocument::fromJson(response, &parse_error); - if(parse_error.error != QJsonParseError::NoError) - { - qWarning() << "Error while parsing JSON response from Technic at " << parse_error.offset << " reason: " << parse_error.errorString(); - qWarning() << response; - return; - } - - QList newList; - try { - auto root = Json::requireObject(doc); - auto objs = Json::requireArray(root, "modpacks"); - for (auto technicPack: objs) { - Modpack pack; - auto technicPackObject = Json::requireObject(technicPack); - pack.name = Json::requireString(technicPackObject, "name"); - pack.slug = Json::requireString(technicPackObject, "slug"); - if (pack.slug == "vanilla") - continue; - - auto rawURL = Json::ensureString(technicPackObject, "iconUrl", "null"); - if(rawURL == "null") { - pack.logoUrl = "null"; - pack.logoName = "null"; - } - else { - pack.logoUrl = rawURL; - pack.logoName = rawURL.section(QLatin1Char('/'), -1).section(QLatin1Char('.'), 0, 0); - } - pack.broken = false; - newList.append(pack); - } - } - catch (const JSONValidationError &err) - { - qCritical() << "Couldn't parse technic search results:" << err.cause() ; - return; - } - searchState = Finished; - beginInsertRows(QModelIndex(), modpacks.size(), modpacks.size() + newList.size() - 1); - modpacks.append(newList); - endInsertRows(); -} - -void Technic::ListModel::getLogo(const QString& logo, const QString& logoUrl, Technic::LogoCallback callback) -{ - if(m_logoMap.contains(logo)) - { - callback(ENV.metacache()->resolveEntry("TechnicPacks", QString("logos/%1").arg(logo))->getFullPath()); - } - else - { - requestLogo(logo, logoUrl); - } -} - -void Technic::ListModel::searchRequestFailed() -{ - jobPtr.reset(); - - if(searchState == ResetRequested) - { - beginResetModel(); - modpacks.clear(); - endResetModel(); - - performSearch(); - } - else - { - searchState = Finished; - } -} - - -void Technic::ListModel::logoLoaded(QString logo, QString out) -{ - m_loadingLogos.removeAll(logo); - m_logoMap.insert(logo, QIcon(out)); - for(int i = 0; i < modpacks.size(); i++) - { - if(modpacks[i].logoName == logo) - { - emit dataChanged(createIndex(i, 0), createIndex(i, 0), {Qt::DecorationRole}); - } - } -} - -void Technic::ListModel::logoFailed(QString logo) -{ - m_failedLogos.append(logo); - m_loadingLogos.removeAll(logo); -} - -void Technic::ListModel::requestLogo(QString logo, QString url) -{ - if(m_loadingLogos.contains(logo) || m_failedLogos.contains(logo) || logo == "null") - { - return; - } - - MetaEntryPtr entry = ENV.metacache()->resolveEntry("TechnicPacks", QString("logos/%1").arg(logo)); - NetJob *job = new NetJob(QString("Technic Icon Download %1").arg(logo)); - job->addNetAction(Net::Download::makeCached(QUrl(url), entry)); - - auto fullPath = entry->getFullPath(); - - QObject::connect(job, &NetJob::succeeded, this, [this, logo, fullPath] - { - logoLoaded(logo, fullPath); - }); - - QObject::connect(job, &NetJob::failed, this, [this, logo] - { - logoFailed(logo); - }); - - job->start(); - - m_loadingLogos.append(logo); -} diff --git a/application/pages/modplatform/technic/TechnicModel.h b/application/pages/modplatform/technic/TechnicModel.h deleted file mode 100644 index 82a03842..00000000 --- a/application/pages/modplatform/technic/TechnicModel.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright 2020-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include "TechnicData.h" -#include "net/NetJob.h" - -namespace Technic { - -typedef std::function LogoCallback; - -class ListModel : public QAbstractListModel -{ - Q_OBJECT - -public: - ListModel(QObject *parent); - virtual ~ListModel(); - - virtual QVariant data(const QModelIndex& index, int role) const; - virtual int columnCount(const QModelIndex& parent) const; - virtual int rowCount(const QModelIndex& parent) const; - - void getLogo(const QString &logo, const QString &logoUrl, LogoCallback callback); - void searchWithTerm(const QString & term); - -private slots: - void searchRequestFinished(); - void searchRequestFailed(); - - void logoFailed(QString logo); - void logoLoaded(QString logo, QString out); - -private: - void performSearch(); - void requestLogo(QString logo, QString url); - -private: - QList modpacks; - QStringList m_failedLogos; - QStringList m_loadingLogos; - QMap m_logoMap; - QMap waitingCallbacks; - - QString currentSearchTerm; - enum SearchState { - None, - ResetRequested, - Finished - } searchState = None; - NetJobPtr jobPtr; - QByteArray response; -}; - -} diff --git a/application/pages/modplatform/technic/TechnicPage.cpp b/application/pages/modplatform/technic/TechnicPage.cpp deleted file mode 100644 index e836f767..00000000 --- a/application/pages/modplatform/technic/TechnicPage.cpp +++ /dev/null @@ -1,198 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "TechnicPage.h" -#include "ui_TechnicPage.h" - -#include "MultiMC.h" -#include "dialogs/NewInstanceDialog.h" -#include "TechnicModel.h" -#include -#include "modplatform/technic/SingleZipPackInstallTask.h" -#include "modplatform/technic/SolderPackInstallTask.h" -#include "Json.h" - -TechnicPage::TechnicPage(NewInstanceDialog* dialog, QWidget *parent) - : QWidget(parent), ui(new Ui::TechnicPage), dialog(dialog) -{ - ui->setupUi(this); - connect(ui->searchButton, &QPushButton::clicked, this, &TechnicPage::triggerSearch); - ui->searchEdit->installEventFilter(this); - model = new Technic::ListModel(this); - ui->packView->setModel(model); - connect(ui->packView->selectionModel(), &QItemSelectionModel::currentChanged, this, &TechnicPage::onSelectionChanged); -} - -bool TechnicPage::eventFilter(QObject* watched, QEvent* event) -{ - if (watched == ui->searchEdit && event->type() == QEvent::KeyPress) { - QKeyEvent* keyEvent = static_cast(event); - if (keyEvent->key() == Qt::Key_Return) { - triggerSearch(); - keyEvent->accept(); - return true; - } - } - return QWidget::eventFilter(watched, event); -} - -TechnicPage::~TechnicPage() -{ - delete ui; -} - -bool TechnicPage::shouldDisplay() const -{ - return true; -} - -void TechnicPage::openedImpl() -{ - suggestCurrent(); - triggerSearch(); -} - -void TechnicPage::triggerSearch() { - model->searchWithTerm(ui->searchEdit->text()); -} - -void TechnicPage::onSelectionChanged(QModelIndex first, QModelIndex second) -{ - if(!first.isValid()) - { - if(isOpened) - { - dialog->setSuggestedPack(); - } - //ui->frame->clear(); - return; - } - - current = model->data(first, Qt::UserRole).value(); - suggestCurrent(); -} - -void TechnicPage::suggestCurrent() -{ - if (!isOpened) - { - return; - } - if (current.broken) - { - dialog->setSuggestedPack(); - return; - } - - QString editedLogoName = "technic_" + current.logoName.section(".", 0, 0); - model->getLogo(current.logoName, current.logoUrl, [this, editedLogoName](QString logo) - { - dialog->setSuggestedIconFromFile(logo, editedLogoName); - }); - - if (current.metadataLoaded) - { - metadataLoaded(); - return; - } - - NetJob *netJob = new NetJob(QString("Technic::PackMeta(%1)").arg(current.name)); - std::shared_ptr response = std::make_shared(); - QString slug = current.slug; - netJob->addNetAction(Net::Download::makeByteArray(QString("https://api.technicpack.net/modpack/%1?build=multimc").arg(slug), response.get())); - QObject::connect(netJob, &NetJob::succeeded, this, [this, response, slug] - { - if (current.slug != slug) - { - return; - } - QJsonParseError parse_error; - QJsonDocument doc = QJsonDocument::fromJson(*response, &parse_error); - QJsonObject obj = doc.object(); - if(parse_error.error != QJsonParseError::NoError) - { - qWarning() << "Error while parsing JSON response from Technic at " << parse_error.offset << " reason: " << parse_error.errorString(); - qWarning() << *response; - return; - } - if (!obj.contains("url")) - { - qWarning() << "Json doesn't contain an url key"; - return; - } - QJsonValueRef url = obj["url"]; - if (url.isString()) - { - current.url = url.toString(); - } - else - { - if (!obj.contains("solder")) - { - qWarning() << "Json doesn't contain a valid url or solder key"; - return; - } - QJsonValueRef solderUrl = obj["solder"]; - if (solderUrl.isString()) - { - current.url = solderUrl.toString(); - current.isSolder = true; - } - else - { - qWarning() << "Json doesn't contain a valid url or solder key"; - return; - } - } - - current.minecraftVersion = Json::ensureString(obj, "minecraft", QString(), "__placeholder__"); - current.websiteUrl = Json::ensureString(obj, "platformUrl", QString(), "__placeholder__"); - current.author = Json::ensureString(obj, "user", QString(), "__placeholder__"); - current.description = Json::ensureString(obj, "description", QString(), "__placeholder__"); - current.metadataLoaded = true; - metadataLoaded(); - }); - netJob->start(); -} - -// expects current.metadataLoaded to be true -void TechnicPage::metadataLoaded() -{ - QString text = ""; - QString name = current.name; - - if (current.websiteUrl.isEmpty()) - // This allows injecting HTML here. - text = name; - else - // URL not properly escaped for inclusion in HTML. The name allows for injecting HTML. - text = "" + name + ""; - if (!current.author.isEmpty()) { - // This allows injecting HTML here - text += tr(" by ") + current.author; - } - - ui->frame->setModText(text); - ui->frame->setModDescription(current.description); - if (!current.isSolder) - { - dialog->setSuggestedPack(current.name, new Technic::SingleZipPackInstallTask(current.url, current.minecraftVersion)); - } - else - { - while (current.url.endsWith('/')) current.url.chop(1); - dialog->setSuggestedPack(current.name, new Technic::SolderPackInstallTask(current.url + "/modpack/" + current.slug, current.minecraftVersion)); - } -} diff --git a/application/pages/modplatform/technic/TechnicPage.h b/application/pages/modplatform/technic/TechnicPage.h deleted file mode 100644 index 27e1258a..00000000 --- a/application/pages/modplatform/technic/TechnicPage.h +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -#include "pages/BasePage.h" -#include -#include "tasks/Task.h" -#include "TechnicData.h" - -namespace Ui -{ -class TechnicPage; -} - -class NewInstanceDialog; - -namespace Technic { - class ListModel; -} - -class TechnicPage : public QWidget, public BasePage -{ - Q_OBJECT - -public: - explicit TechnicPage(NewInstanceDialog* dialog, QWidget *parent = 0); - virtual ~TechnicPage(); - virtual QString displayName() const override - { - return tr("Technic"); - } - virtual QIcon icon() const override - { - return MMC->getThemedIcon("technic"); - } - virtual QString id() const override - { - return "technic"; - } - virtual QString helpPage() const override - { - return "Technic-platform"; - } - virtual bool shouldDisplay() const override; - - void openedImpl() override; - - bool eventFilter(QObject* watched, QEvent* event) override; - -private: - void suggestCurrent(); - void metadataLoaded(); - -private slots: - void triggerSearch(); - void onSelectionChanged(QModelIndex first, QModelIndex second); - -private: - Ui::TechnicPage *ui = nullptr; - NewInstanceDialog* dialog = nullptr; - Technic::ListModel* model = nullptr; - Technic::Modpack current; -}; diff --git a/application/pages/modplatform/technic/TechnicPage.ui b/application/pages/modplatform/technic/TechnicPage.ui deleted file mode 100644 index 2ca45dd2..00000000 --- a/application/pages/modplatform/technic/TechnicPage.ui +++ /dev/null @@ -1,95 +0,0 @@ - - - TechnicPage - - - - 0 - 0 - 546 - 405 - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Search and filter ... - - - - - - - Search - - - - - - - - - - Qt::ScrollBarAlwaysOff - - - true - - - - 48 - 48 - - - - - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - MCModInfoFrame - QFrame -
widgets/MCModInfoFrame.h
- 1 -
-
- - searchEdit - searchButton - packView - - - -
diff --git a/application/resources/MultiMC.icns b/application/resources/MultiMC.icns deleted file mode 100644 index c4eb59d5..00000000 Binary files a/application/resources/MultiMC.icns and /dev/null differ diff --git a/application/resources/MultiMC.ico b/application/resources/MultiMC.ico deleted file mode 100644 index a86a1f0d..00000000 Binary files a/application/resources/MultiMC.ico and /dev/null differ diff --git a/application/resources/MultiMC.manifest b/application/resources/MultiMC.manifest deleted file mode 100644 index 9278f6e4..00000000 --- a/application/resources/MultiMC.manifest +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - Custom Minecraft launcher for managing multiple installs. - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/application/resources/OSX/OSX.qrc b/application/resources/OSX/OSX.qrc deleted file mode 100644 index 19fd4b6a..00000000 --- a/application/resources/OSX/OSX.qrc +++ /dev/null @@ -1,38 +0,0 @@ - - - - index.theme - scalable/about.svg - scalable/accounts.svg - scalable/bug.svg - scalable/centralmods.svg - scalable/checkupdate.svg - scalable/copy.svg - scalable/coremods.svg - scalable/externaltools.svg - scalable/help.svg - scalable/instance-settings.svg - scalable/jarmods.svg - scalable/java.svg - scalable/language.svg - scalable/loadermods.svg - scalable/log.svg - scalable/minecraft.svg - scalable/multimc.svg - scalable/new.svg - scalable/news.svg - scalable/notes.svg - scalable/patreon.svg - scalable/proxy.svg - scalable/quickmods.svg - scalable/refresh.svg - scalable/resourcepacks.svg - scalable/screenshots.svg - scalable/settings.svg - scalable/status-bad.svg - scalable/status-good.svg - scalable/status-yellow.svg - scalable/viewfolder.svg - scalable/worlds.svg - - diff --git a/application/resources/OSX/index.theme b/application/resources/OSX/index.theme deleted file mode 100644 index 7f90a32e..00000000 --- a/application/resources/OSX/index.theme +++ /dev/null @@ -1,11 +0,0 @@ -[Icon Theme] -Name=OSX -Comment=OSX theme by pexner -Inherits=multimc -Directories=scalable - -[scalable] -Size=48 -Type=Scalable -MinSize=16 -MaxSize=256 diff --git a/application/resources/OSX/scalable/about.svg b/application/resources/OSX/scalable/about.svg deleted file mode 100644 index eb87ccf1..00000000 --- a/application/resources/OSX/scalable/about.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/application/resources/OSX/scalable/accounts.svg b/application/resources/OSX/scalable/accounts.svg deleted file mode 100644 index 163bcee0..00000000 --- a/application/resources/OSX/scalable/accounts.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - diff --git a/application/resources/OSX/scalable/bug.svg b/application/resources/OSX/scalable/bug.svg deleted file mode 100644 index 00565bb6..00000000 --- a/application/resources/OSX/scalable/bug.svg +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - diff --git a/application/resources/OSX/scalable/centralmods.svg b/application/resources/OSX/scalable/centralmods.svg deleted file mode 100644 index 37b821e4..00000000 --- a/application/resources/OSX/scalable/centralmods.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - diff --git a/application/resources/OSX/scalable/checkupdate.svg b/application/resources/OSX/scalable/checkupdate.svg deleted file mode 100644 index 30cec51f..00000000 --- a/application/resources/OSX/scalable/checkupdate.svg +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/application/resources/OSX/scalable/copy.svg b/application/resources/OSX/scalable/copy.svg deleted file mode 100644 index 7382d6e2..00000000 --- a/application/resources/OSX/scalable/copy.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - diff --git a/application/resources/OSX/scalable/coremods.svg b/application/resources/OSX/scalable/coremods.svg deleted file mode 100644 index b0df6052..00000000 --- a/application/resources/OSX/scalable/coremods.svg +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/application/resources/OSX/scalable/externaltools.svg b/application/resources/OSX/scalable/externaltools.svg deleted file mode 100644 index a2b7488e..00000000 --- a/application/resources/OSX/scalable/externaltools.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - diff --git a/application/resources/OSX/scalable/help.svg b/application/resources/OSX/scalable/help.svg deleted file mode 100644 index 9d1b367c..00000000 --- a/application/resources/OSX/scalable/help.svg +++ /dev/null @@ -1,51 +0,0 @@ - -image/svg+xml \ No newline at end of file diff --git a/application/resources/OSX/scalable/instance-settings.svg b/application/resources/OSX/scalable/instance-settings.svg deleted file mode 100644 index 394877f8..00000000 --- a/application/resources/OSX/scalable/instance-settings.svg +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/application/resources/OSX/scalable/jarmods.svg b/application/resources/OSX/scalable/jarmods.svg deleted file mode 100644 index 213ec833..00000000 --- a/application/resources/OSX/scalable/jarmods.svg +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/OSX/scalable/java.svg b/application/resources/OSX/scalable/java.svg deleted file mode 100644 index e1aee159..00000000 --- a/application/resources/OSX/scalable/java.svg +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/OSX/scalable/language.svg b/application/resources/OSX/scalable/language.svg deleted file mode 100644 index 4f7d002a..00000000 --- a/application/resources/OSX/scalable/language.svg +++ /dev/null @@ -1,40 +0,0 @@ - -image/svg+xml \ No newline at end of file diff --git a/application/resources/OSX/scalable/loadermods.svg b/application/resources/OSX/scalable/loadermods.svg deleted file mode 100644 index 76951ebd..00000000 --- a/application/resources/OSX/scalable/loadermods.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - diff --git a/application/resources/OSX/scalable/log.svg b/application/resources/OSX/scalable/log.svg deleted file mode 100644 index 0ac45d54..00000000 --- a/application/resources/OSX/scalable/log.svg +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - diff --git a/application/resources/OSX/scalable/minecraft.svg b/application/resources/OSX/scalable/minecraft.svg deleted file mode 100644 index 86c915bc..00000000 --- a/application/resources/OSX/scalable/minecraft.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - diff --git a/application/resources/OSX/scalable/multimc.svg b/application/resources/OSX/scalable/multimc.svg deleted file mode 100644 index caad21b5..00000000 --- a/application/resources/OSX/scalable/multimc.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - diff --git a/application/resources/OSX/scalable/new.svg b/application/resources/OSX/scalable/new.svg deleted file mode 100644 index 79ee87ba..00000000 --- a/application/resources/OSX/scalable/new.svg +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - diff --git a/application/resources/OSX/scalable/news.svg b/application/resources/OSX/scalable/news.svg deleted file mode 100644 index b8ce3cd1..00000000 --- a/application/resources/OSX/scalable/news.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - diff --git a/application/resources/OSX/scalable/notes.svg b/application/resources/OSX/scalable/notes.svg deleted file mode 100644 index c2e95cfd..00000000 --- a/application/resources/OSX/scalable/notes.svg +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - diff --git a/application/resources/OSX/scalable/patreon.svg b/application/resources/OSX/scalable/patreon.svg deleted file mode 100644 index 4f0da3e5..00000000 --- a/application/resources/OSX/scalable/patreon.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - diff --git a/application/resources/OSX/scalable/proxy.svg b/application/resources/OSX/scalable/proxy.svg deleted file mode 100644 index 99acaa2b..00000000 --- a/application/resources/OSX/scalable/proxy.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - diff --git a/application/resources/OSX/scalable/quickmods.svg b/application/resources/OSX/scalable/quickmods.svg deleted file mode 100644 index e0aaad87..00000000 --- a/application/resources/OSX/scalable/quickmods.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - diff --git a/application/resources/OSX/scalable/refresh.svg b/application/resources/OSX/scalable/refresh.svg deleted file mode 100644 index c97489c1..00000000 --- a/application/resources/OSX/scalable/refresh.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - diff --git a/application/resources/OSX/scalable/resourcepacks.svg b/application/resources/OSX/scalable/resourcepacks.svg deleted file mode 100644 index c85d4e3c..00000000 --- a/application/resources/OSX/scalable/resourcepacks.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - diff --git a/application/resources/OSX/scalable/screenshots.svg b/application/resources/OSX/scalable/screenshots.svg deleted file mode 100644 index 12df0c88..00000000 --- a/application/resources/OSX/scalable/screenshots.svg +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/application/resources/OSX/scalable/settings.svg b/application/resources/OSX/scalable/settings.svg deleted file mode 100644 index dcdd9f1c..00000000 --- a/application/resources/OSX/scalable/settings.svg +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - diff --git a/application/resources/OSX/scalable/status-bad.svg b/application/resources/OSX/scalable/status-bad.svg deleted file mode 100644 index add7a6f7..00000000 --- a/application/resources/OSX/scalable/status-bad.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - diff --git a/application/resources/OSX/scalable/status-good.svg b/application/resources/OSX/scalable/status-good.svg deleted file mode 100644 index f10da757..00000000 --- a/application/resources/OSX/scalable/status-good.svg +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - diff --git a/application/resources/OSX/scalable/status-yellow.svg b/application/resources/OSX/scalable/status-yellow.svg deleted file mode 100644 index fba697bc..00000000 --- a/application/resources/OSX/scalable/status-yellow.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - diff --git a/application/resources/OSX/scalable/viewfolder.svg b/application/resources/OSX/scalable/viewfolder.svg deleted file mode 100644 index 682c72c7..00000000 --- a/application/resources/OSX/scalable/viewfolder.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - diff --git a/application/resources/OSX/scalable/worlds.svg b/application/resources/OSX/scalable/worlds.svg deleted file mode 100644 index b1491272..00000000 --- a/application/resources/OSX/scalable/worlds.svg +++ /dev/null @@ -1,58 +0,0 @@ - -image/svg+xml \ No newline at end of file diff --git a/application/resources/assets/underconstruction.png b/application/resources/assets/underconstruction.png deleted file mode 100644 index 6ae06476..00000000 Binary files a/application/resources/assets/underconstruction.png and /dev/null differ diff --git a/application/resources/backgrounds/backgrounds.qrc b/application/resources/backgrounds/backgrounds.qrc deleted file mode 100644 index 83505635..00000000 --- a/application/resources/backgrounds/backgrounds.qrc +++ /dev/null @@ -1,7 +0,0 @@ - - - - catbgrnd2.png - catmas.png - - diff --git a/application/resources/backgrounds/catbgrnd2.png b/application/resources/backgrounds/catbgrnd2.png deleted file mode 100644 index e9de7f27..00000000 Binary files a/application/resources/backgrounds/catbgrnd2.png and /dev/null differ diff --git a/application/resources/backgrounds/catmas.png b/application/resources/backgrounds/catmas.png deleted file mode 100644 index 8bdb1d5c..00000000 Binary files a/application/resources/backgrounds/catmas.png and /dev/null differ diff --git a/application/resources/documents/documents.qrc b/application/resources/documents/documents.qrc deleted file mode 100644 index 007efcde..00000000 --- a/application/resources/documents/documents.qrc +++ /dev/null @@ -1,7 +0,0 @@ - - - - ../../../COPYING.md - - - diff --git a/application/resources/flat/flat.qrc b/application/resources/flat/flat.qrc deleted file mode 100644 index b6e2ee38..00000000 --- a/application/resources/flat/flat.qrc +++ /dev/null @@ -1,45 +0,0 @@ - - - - index.theme - scalable/about.svg - scalable/accounts.svg - scalable/bug.svg - scalable/cat.svg - scalable/centralmods.svg - scalable/checkupdate.svg - scalable/copy.svg - scalable/coremods.svg - scalable/discord.svg - scalable/externaltools.svg - scalable/help.svg - scalable/instance-settings.svg - scalable/jarmods.svg - scalable/java.svg - scalable/language.svg - scalable/loadermods.svg - scalable/log.svg - scalable/minecraft.svg - scalable/multimc.svg - scalable/new.svg - scalable/news.svg - scalable/notes.svg - scalable/packages.svg - scalable/patreon.svg - scalable/proxy.svg - scalable/quickmods.svg - scalable/reddit-alien.svg - scalable/refresh.svg - scalable/resourcepacks.svg - scalable/screenshot-placeholder.svg - scalable/screenshots.svg - scalable/settings.svg - scalable/star.svg - scalable/status-bad.svg - scalable/status-good.svg - scalable/status-running.svg - scalable/status-yellow.svg - scalable/viewfolder.svg - scalable/worlds.svg - - diff --git a/application/resources/flat/index.theme b/application/resources/flat/index.theme deleted file mode 100644 index 34e27aa0..00000000 --- a/application/resources/flat/index.theme +++ /dev/null @@ -1,11 +0,0 @@ -[Icon Theme] -Name=Flat -Comment=Flat icons -Inherits=multimc -Directories=scalable - -[scalable] -Size=48 -Type=Scalable -MinSize=16 -MaxSize=256 diff --git a/application/resources/flat/scalable/about.svg b/application/resources/flat/scalable/about.svg deleted file mode 100644 index 4f85045d..00000000 --- a/application/resources/flat/scalable/about.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/accounts.svg b/application/resources/flat/scalable/accounts.svg deleted file mode 100644 index e6a1328d..00000000 --- a/application/resources/flat/scalable/accounts.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/bug.svg b/application/resources/flat/scalable/bug.svg deleted file mode 100644 index ea370faa..00000000 --- a/application/resources/flat/scalable/bug.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/cat.svg b/application/resources/flat/scalable/cat.svg deleted file mode 100644 index e90763b5..00000000 --- a/application/resources/flat/scalable/cat.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/centralmods.svg b/application/resources/flat/scalable/centralmods.svg deleted file mode 100644 index c694662a..00000000 --- a/application/resources/flat/scalable/centralmods.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/checkupdate.svg b/application/resources/flat/scalable/checkupdate.svg deleted file mode 100644 index e6525a08..00000000 --- a/application/resources/flat/scalable/checkupdate.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/copy.svg b/application/resources/flat/scalable/copy.svg deleted file mode 100644 index 36986e0d..00000000 --- a/application/resources/flat/scalable/copy.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/coremods.svg b/application/resources/flat/scalable/coremods.svg deleted file mode 100644 index 21a3450e..00000000 --- a/application/resources/flat/scalable/coremods.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/discord.svg b/application/resources/flat/scalable/discord.svg deleted file mode 100644 index ad63180f..00000000 --- a/application/resources/flat/scalable/discord.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/externaltools.svg b/application/resources/flat/scalable/externaltools.svg deleted file mode 100644 index 55820dfc..00000000 --- a/application/resources/flat/scalable/externaltools.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/help.svg b/application/resources/flat/scalable/help.svg deleted file mode 100644 index 26d5d7f4..00000000 --- a/application/resources/flat/scalable/help.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - - diff --git a/application/resources/flat/scalable/instance-settings.svg b/application/resources/flat/scalable/instance-settings.svg deleted file mode 100644 index dd9d86ed..00000000 --- a/application/resources/flat/scalable/instance-settings.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/jarmods.svg b/application/resources/flat/scalable/jarmods.svg deleted file mode 100644 index db90fa34..00000000 --- a/application/resources/flat/scalable/jarmods.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/java.svg b/application/resources/flat/scalable/java.svg deleted file mode 100644 index dc19ee23..00000000 --- a/application/resources/flat/scalable/java.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/language.svg b/application/resources/flat/scalable/language.svg deleted file mode 100644 index f4d3f2f4..00000000 --- a/application/resources/flat/scalable/language.svg +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/flat/scalable/loadermods.svg b/application/resources/flat/scalable/loadermods.svg deleted file mode 100644 index 8a2fd12c..00000000 --- a/application/resources/flat/scalable/loadermods.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/log.svg b/application/resources/flat/scalable/log.svg deleted file mode 100644 index e8caa08a..00000000 --- a/application/resources/flat/scalable/log.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/minecraft.svg b/application/resources/flat/scalable/minecraft.svg deleted file mode 100644 index c17c44cd..00000000 --- a/application/resources/flat/scalable/minecraft.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/multimc.svg b/application/resources/flat/scalable/multimc.svg deleted file mode 100644 index 1c1f2359..00000000 --- a/application/resources/flat/scalable/multimc.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/new.svg b/application/resources/flat/scalable/new.svg deleted file mode 100644 index 01f19d7c..00000000 --- a/application/resources/flat/scalable/new.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/news.svg b/application/resources/flat/scalable/news.svg deleted file mode 100644 index 8868414e..00000000 --- a/application/resources/flat/scalable/news.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/notes.svg b/application/resources/flat/scalable/notes.svg deleted file mode 100644 index ebe0cb5a..00000000 --- a/application/resources/flat/scalable/notes.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/packages.svg b/application/resources/flat/scalable/packages.svg deleted file mode 100644 index fe576a43..00000000 --- a/application/resources/flat/scalable/packages.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/patreon.svg b/application/resources/flat/scalable/patreon.svg deleted file mode 100644 index ad561f57..00000000 --- a/application/resources/flat/scalable/patreon.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/proxy.svg b/application/resources/flat/scalable/proxy.svg deleted file mode 100644 index 4956fec8..00000000 --- a/application/resources/flat/scalable/proxy.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/quickmods.svg b/application/resources/flat/scalable/quickmods.svg deleted file mode 100644 index 952d1e0e..00000000 --- a/application/resources/flat/scalable/quickmods.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/reddit-alien.svg b/application/resources/flat/scalable/reddit-alien.svg deleted file mode 100644 index 9bcfbedc..00000000 --- a/application/resources/flat/scalable/reddit-alien.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/refresh.svg b/application/resources/flat/scalable/refresh.svg deleted file mode 100644 index 94be1e27..00000000 --- a/application/resources/flat/scalable/refresh.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/resourcepacks.svg b/application/resources/flat/scalable/resourcepacks.svg deleted file mode 100644 index b6054baf..00000000 --- a/application/resources/flat/scalable/resourcepacks.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/screenshot-placeholder.svg b/application/resources/flat/scalable/screenshot-placeholder.svg deleted file mode 100644 index 99e0c17a..00000000 --- a/application/resources/flat/scalable/screenshot-placeholder.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/screenshots.svg b/application/resources/flat/scalable/screenshots.svg deleted file mode 100644 index 208bb104..00000000 --- a/application/resources/flat/scalable/screenshots.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/settings.svg b/application/resources/flat/scalable/settings.svg deleted file mode 100644 index dd9d86ed..00000000 --- a/application/resources/flat/scalable/settings.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/star.svg b/application/resources/flat/scalable/star.svg deleted file mode 100644 index 878bdca8..00000000 --- a/application/resources/flat/scalable/star.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/status-bad.svg b/application/resources/flat/scalable/status-bad.svg deleted file mode 100644 index 3f8e0116..00000000 --- a/application/resources/flat/scalable/status-bad.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/status-good.svg b/application/resources/flat/scalable/status-good.svg deleted file mode 100644 index 3503d6ba..00000000 --- a/application/resources/flat/scalable/status-good.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/status-running.svg b/application/resources/flat/scalable/status-running.svg deleted file mode 100644 index 7c750319..00000000 --- a/application/resources/flat/scalable/status-running.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/status-yellow.svg b/application/resources/flat/scalable/status-yellow.svg deleted file mode 100644 index ac2d2349..00000000 --- a/application/resources/flat/scalable/status-yellow.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/viewfolder.svg b/application/resources/flat/scalable/viewfolder.svg deleted file mode 100644 index 2f5e29c9..00000000 --- a/application/resources/flat/scalable/viewfolder.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/flat/scalable/worlds.svg b/application/resources/flat/scalable/worlds.svg deleted file mode 100644 index 95a59bd4..00000000 --- a/application/resources/flat/scalable/worlds.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/application/resources/iOS/iOS.qrc b/application/resources/iOS/iOS.qrc deleted file mode 100644 index 511e390b..00000000 --- a/application/resources/iOS/iOS.qrc +++ /dev/null @@ -1,38 +0,0 @@ - - - - index.theme - scalable/about.svg - scalable/accounts.svg - scalable/bug.svg - scalable/centralmods.svg - scalable/checkupdate.svg - scalable/copy.svg - scalable/coremods.svg - scalable/externaltools.svg - scalable/help.svg - scalable/instance-settings.svg - scalable/jarmods.svg - scalable/java.svg - scalable/language.svg - scalable/loadermods.svg - scalable/log.svg - scalable/minecraft.svg - scalable/multimc.svg - scalable/new.svg - scalable/news.svg - scalable/notes.svg - scalable/patreon.svg - scalable/proxy.svg - scalable/quickmods.svg - scalable/refresh.svg - scalable/resourcepacks.svg - scalable/screenshots.svg - scalable/settings.svg - scalable/status-bad.svg - scalable/status-good.svg - scalable/status-yellow.svg - scalable/viewfolder.svg - scalable/worlds.svg - - diff --git a/application/resources/iOS/index.theme b/application/resources/iOS/index.theme deleted file mode 100644 index b0f2f6ba..00000000 --- a/application/resources/iOS/index.theme +++ /dev/null @@ -1,11 +0,0 @@ -[Icon Theme] -Name=iOS -Comment=iOS theme by pexner -Inherits=multimc -Directories=scalable - -[scalable] -Size=48 -Type=Scalable -MinSize=16 -MaxSize=256 diff --git a/application/resources/iOS/scalable/about.svg b/application/resources/iOS/scalable/about.svg deleted file mode 100644 index c4d35471..00000000 --- a/application/resources/iOS/scalable/about.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - diff --git a/application/resources/iOS/scalable/accounts.svg b/application/resources/iOS/scalable/accounts.svg deleted file mode 100644 index 65f76c3f..00000000 --- a/application/resources/iOS/scalable/accounts.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - diff --git a/application/resources/iOS/scalable/bug.svg b/application/resources/iOS/scalable/bug.svg deleted file mode 100644 index fc4a3d69..00000000 --- a/application/resources/iOS/scalable/bug.svg +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - diff --git a/application/resources/iOS/scalable/centralmods.svg b/application/resources/iOS/scalable/centralmods.svg deleted file mode 100644 index 1b4c4741..00000000 --- a/application/resources/iOS/scalable/centralmods.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - diff --git a/application/resources/iOS/scalable/checkupdate.svg b/application/resources/iOS/scalable/checkupdate.svg deleted file mode 100644 index 9fc983d1..00000000 --- a/application/resources/iOS/scalable/checkupdate.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - diff --git a/application/resources/iOS/scalable/copy.svg b/application/resources/iOS/scalable/copy.svg deleted file mode 100644 index 3ccc2f06..00000000 --- a/application/resources/iOS/scalable/copy.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - diff --git a/application/resources/iOS/scalable/coremods.svg b/application/resources/iOS/scalable/coremods.svg deleted file mode 100644 index ea47872c..00000000 --- a/application/resources/iOS/scalable/coremods.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/application/resources/iOS/scalable/externaltools.svg b/application/resources/iOS/scalable/externaltools.svg deleted file mode 100644 index 16e9fa48..00000000 --- a/application/resources/iOS/scalable/externaltools.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - diff --git a/application/resources/iOS/scalable/help.svg b/application/resources/iOS/scalable/help.svg deleted file mode 100644 index 9c2d2e93..00000000 --- a/application/resources/iOS/scalable/help.svg +++ /dev/null @@ -1,38 +0,0 @@ - -image/svg+xml \ No newline at end of file diff --git a/application/resources/iOS/scalable/instance-settings.svg b/application/resources/iOS/scalable/instance-settings.svg deleted file mode 100644 index 95b8a508..00000000 --- a/application/resources/iOS/scalable/instance-settings.svg +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - diff --git a/application/resources/iOS/scalable/jarmods.svg b/application/resources/iOS/scalable/jarmods.svg deleted file mode 100644 index c4c5ca8c..00000000 --- a/application/resources/iOS/scalable/jarmods.svg +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/iOS/scalable/java.svg b/application/resources/iOS/scalable/java.svg deleted file mode 100644 index 8d7c2798..00000000 --- a/application/resources/iOS/scalable/java.svg +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/iOS/scalable/language.svg b/application/resources/iOS/scalable/language.svg deleted file mode 100644 index fcc3436e..00000000 --- a/application/resources/iOS/scalable/language.svg +++ /dev/null @@ -1,32 +0,0 @@ - -image/svg+xml - - - - - \ No newline at end of file diff --git a/application/resources/iOS/scalable/loadermods.svg b/application/resources/iOS/scalable/loadermods.svg deleted file mode 100644 index 010efa11..00000000 --- a/application/resources/iOS/scalable/loadermods.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - diff --git a/application/resources/iOS/scalable/log.svg b/application/resources/iOS/scalable/log.svg deleted file mode 100644 index 5d1c7f06..00000000 --- a/application/resources/iOS/scalable/log.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - diff --git a/application/resources/iOS/scalable/minecraft.svg b/application/resources/iOS/scalable/minecraft.svg deleted file mode 100644 index 069b4e71..00000000 --- a/application/resources/iOS/scalable/minecraft.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - diff --git a/application/resources/iOS/scalable/multimc.svg b/application/resources/iOS/scalable/multimc.svg deleted file mode 100644 index bc819433..00000000 --- a/application/resources/iOS/scalable/multimc.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - diff --git a/application/resources/iOS/scalable/new.svg b/application/resources/iOS/scalable/new.svg deleted file mode 100644 index 9f221580..00000000 --- a/application/resources/iOS/scalable/new.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - diff --git a/application/resources/iOS/scalable/news.svg b/application/resources/iOS/scalable/news.svg deleted file mode 100644 index d3c010bb..00000000 --- a/application/resources/iOS/scalable/news.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - diff --git a/application/resources/iOS/scalable/notes.svg b/application/resources/iOS/scalable/notes.svg deleted file mode 100644 index b42ebeef..00000000 --- a/application/resources/iOS/scalable/notes.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - diff --git a/application/resources/iOS/scalable/patreon.svg b/application/resources/iOS/scalable/patreon.svg deleted file mode 100644 index 1bd06f4a..00000000 --- a/application/resources/iOS/scalable/patreon.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - diff --git a/application/resources/iOS/scalable/proxy.svg b/application/resources/iOS/scalable/proxy.svg deleted file mode 100644 index f6552281..00000000 --- a/application/resources/iOS/scalable/proxy.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/application/resources/iOS/scalable/quickmods.svg b/application/resources/iOS/scalable/quickmods.svg deleted file mode 100644 index cd63ba71..00000000 --- a/application/resources/iOS/scalable/quickmods.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - diff --git a/application/resources/iOS/scalable/refresh.svg b/application/resources/iOS/scalable/refresh.svg deleted file mode 100644 index 297b79c9..00000000 --- a/application/resources/iOS/scalable/refresh.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - diff --git a/application/resources/iOS/scalable/resourcepacks.svg b/application/resources/iOS/scalable/resourcepacks.svg deleted file mode 100644 index 5b359d63..00000000 --- a/application/resources/iOS/scalable/resourcepacks.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - diff --git a/application/resources/iOS/scalable/screenshots.svg b/application/resources/iOS/scalable/screenshots.svg deleted file mode 100644 index 39ce7b82..00000000 --- a/application/resources/iOS/scalable/screenshots.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - diff --git a/application/resources/iOS/scalable/settings.svg b/application/resources/iOS/scalable/settings.svg deleted file mode 100644 index 95b8a508..00000000 --- a/application/resources/iOS/scalable/settings.svg +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - diff --git a/application/resources/iOS/scalable/status-bad.svg b/application/resources/iOS/scalable/status-bad.svg deleted file mode 100644 index 4019c8da..00000000 --- a/application/resources/iOS/scalable/status-bad.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - diff --git a/application/resources/iOS/scalable/status-good.svg b/application/resources/iOS/scalable/status-good.svg deleted file mode 100644 index e1859113..00000000 --- a/application/resources/iOS/scalable/status-good.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - diff --git a/application/resources/iOS/scalable/status-yellow.svg b/application/resources/iOS/scalable/status-yellow.svg deleted file mode 100644 index d8a28e23..00000000 --- a/application/resources/iOS/scalable/status-yellow.svg +++ /dev/null @@ -1,56 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/application/resources/iOS/scalable/viewfolder.svg b/application/resources/iOS/scalable/viewfolder.svg deleted file mode 100644 index 0ae0c0b5..00000000 --- a/application/resources/iOS/scalable/viewfolder.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - diff --git a/application/resources/iOS/scalable/worlds.svg b/application/resources/iOS/scalable/worlds.svg deleted file mode 100644 index 1596fd76..00000000 --- a/application/resources/iOS/scalable/worlds.svg +++ /dev/null @@ -1,44 +0,0 @@ - -image/svg+xml \ No newline at end of file diff --git a/application/resources/multimc.rc b/application/resources/multimc.rc deleted file mode 100644 index e7340f2a..00000000 --- a/application/resources/multimc.rc +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include - -IDI_ICON1 ICON DISCARDABLE "MultiMC.ico" -1 RT_MANIFEST "MultiMC.manifest" - -VS_VERSION_INFO VERSIONINFO -FILEVERSION 1,0,0,0 -FILEOS VOS_NT_WINDOWS32 -FILETYPE VFT_APP -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "000004b0" - BEGIN - VALUE "CompanyName", "MultiMC Contributors" - VALUE "FileDescription", "MultiMC Launcher" - VALUE "FileVersion", "1.0.0.0" - VALUE "ProductName", "MultiMC" - VALUE "ProductVersion", "5" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0000, 0x04b0 // Unicode - END -END diff --git a/application/resources/multimc/128x128/instances/chicken.png b/application/resources/multimc/128x128/instances/chicken.png deleted file mode 100644 index 71f6dedc..00000000 Binary files a/application/resources/multimc/128x128/instances/chicken.png and /dev/null differ diff --git a/application/resources/multimc/128x128/instances/creeper.png b/application/resources/multimc/128x128/instances/creeper.png deleted file mode 100644 index 41b7d07d..00000000 Binary files a/application/resources/multimc/128x128/instances/creeper.png and /dev/null differ diff --git a/application/resources/multimc/128x128/instances/enderpearl.png b/application/resources/multimc/128x128/instances/enderpearl.png deleted file mode 100644 index 0a5bf91a..00000000 Binary files a/application/resources/multimc/128x128/instances/enderpearl.png and /dev/null differ diff --git a/application/resources/multimc/128x128/instances/flame.png b/application/resources/multimc/128x128/instances/flame.png deleted file mode 100644 index 8a50a0b4..00000000 Binary files a/application/resources/multimc/128x128/instances/flame.png and /dev/null differ diff --git a/application/resources/multimc/128x128/instances/ftb_glow.png b/application/resources/multimc/128x128/instances/ftb_glow.png deleted file mode 100644 index 86632b21..00000000 Binary files a/application/resources/multimc/128x128/instances/ftb_glow.png and /dev/null differ diff --git a/application/resources/multimc/128x128/instances/ftb_logo.png b/application/resources/multimc/128x128/instances/ftb_logo.png deleted file mode 100644 index e725b7fe..00000000 Binary files a/application/resources/multimc/128x128/instances/ftb_logo.png and /dev/null differ diff --git a/application/resources/multimc/128x128/instances/gear.png b/application/resources/multimc/128x128/instances/gear.png deleted file mode 100644 index 75c68a66..00000000 Binary files a/application/resources/multimc/128x128/instances/gear.png and /dev/null differ diff --git a/application/resources/multimc/128x128/instances/herobrine.png b/application/resources/multimc/128x128/instances/herobrine.png deleted file mode 100644 index 13f1494c..00000000 Binary files a/application/resources/multimc/128x128/instances/herobrine.png and /dev/null differ diff --git a/application/resources/multimc/128x128/instances/infinity.png b/application/resources/multimc/128x128/instances/infinity.png deleted file mode 100644 index cc7ca7bc..00000000 Binary files a/application/resources/multimc/128x128/instances/infinity.png and /dev/null differ diff --git a/application/resources/multimc/128x128/instances/magitech.png b/application/resources/multimc/128x128/instances/magitech.png deleted file mode 100644 index 0f81a199..00000000 Binary files a/application/resources/multimc/128x128/instances/magitech.png and /dev/null differ diff --git a/application/resources/multimc/128x128/instances/meat.png b/application/resources/multimc/128x128/instances/meat.png deleted file mode 100644 index fefc9bf1..00000000 Binary files a/application/resources/multimc/128x128/instances/meat.png and /dev/null differ diff --git a/application/resources/multimc/128x128/instances/netherstar.png b/application/resources/multimc/128x128/instances/netherstar.png deleted file mode 100644 index 132085f0..00000000 Binary files a/application/resources/multimc/128x128/instances/netherstar.png and /dev/null differ diff --git a/application/resources/multimc/128x128/instances/skeleton.png b/application/resources/multimc/128x128/instances/skeleton.png deleted file mode 100644 index 55fcf5a9..00000000 Binary files a/application/resources/multimc/128x128/instances/skeleton.png and /dev/null differ diff --git a/application/resources/multimc/128x128/instances/squarecreeper.png b/application/resources/multimc/128x128/instances/squarecreeper.png deleted file mode 100644 index c82d8406..00000000 Binary files a/application/resources/multimc/128x128/instances/squarecreeper.png and /dev/null differ diff --git a/application/resources/multimc/128x128/instances/steve.png b/application/resources/multimc/128x128/instances/steve.png deleted file mode 100644 index a07cbd2f..00000000 Binary files a/application/resources/multimc/128x128/instances/steve.png and /dev/null differ diff --git a/application/resources/multimc/128x128/unknown_server.png b/application/resources/multimc/128x128/unknown_server.png deleted file mode 100644 index ec98382d..00000000 Binary files a/application/resources/multimc/128x128/unknown_server.png and /dev/null differ diff --git a/application/resources/multimc/16x16/about.png b/application/resources/multimc/16x16/about.png deleted file mode 100644 index a6a986e1..00000000 Binary files a/application/resources/multimc/16x16/about.png and /dev/null differ diff --git a/application/resources/multimc/16x16/bug.png b/application/resources/multimc/16x16/bug.png deleted file mode 100644 index 0c5b78b4..00000000 Binary files a/application/resources/multimc/16x16/bug.png and /dev/null differ diff --git a/application/resources/multimc/16x16/cat.png b/application/resources/multimc/16x16/cat.png deleted file mode 100644 index e6e31b44..00000000 Binary files a/application/resources/multimc/16x16/cat.png and /dev/null differ diff --git a/application/resources/multimc/16x16/centralmods.png b/application/resources/multimc/16x16/centralmods.png deleted file mode 100644 index c1b91c76..00000000 Binary files a/application/resources/multimc/16x16/centralmods.png and /dev/null differ diff --git a/application/resources/multimc/16x16/checkupdate.png b/application/resources/multimc/16x16/checkupdate.png deleted file mode 100644 index f3742058..00000000 Binary files a/application/resources/multimc/16x16/checkupdate.png and /dev/null differ diff --git a/application/resources/multimc/16x16/copy.png b/application/resources/multimc/16x16/copy.png deleted file mode 100644 index ccaed9e1..00000000 Binary files a/application/resources/multimc/16x16/copy.png and /dev/null differ diff --git a/application/resources/multimc/16x16/coremods.png b/application/resources/multimc/16x16/coremods.png deleted file mode 100644 index af0f1166..00000000 Binary files a/application/resources/multimc/16x16/coremods.png and /dev/null differ diff --git a/application/resources/multimc/16x16/help.png b/application/resources/multimc/16x16/help.png deleted file mode 100644 index e6edf6ba..00000000 Binary files a/application/resources/multimc/16x16/help.png and /dev/null differ diff --git a/application/resources/multimc/16x16/instance-settings.png b/application/resources/multimc/16x16/instance-settings.png deleted file mode 100644 index b916cd24..00000000 Binary files a/application/resources/multimc/16x16/instance-settings.png and /dev/null differ diff --git a/application/resources/multimc/16x16/jarmods.png b/application/resources/multimc/16x16/jarmods.png deleted file mode 100644 index 1a97c9c0..00000000 Binary files a/application/resources/multimc/16x16/jarmods.png and /dev/null differ diff --git a/application/resources/multimc/16x16/loadermods.png b/application/resources/multimc/16x16/loadermods.png deleted file mode 100644 index b5ab3fce..00000000 Binary files a/application/resources/multimc/16x16/loadermods.png and /dev/null differ diff --git a/application/resources/multimc/16x16/log.png b/application/resources/multimc/16x16/log.png deleted file mode 100644 index efa2a0b5..00000000 Binary files a/application/resources/multimc/16x16/log.png and /dev/null differ diff --git a/application/resources/multimc/16x16/minecraft.png b/application/resources/multimc/16x16/minecraft.png deleted file mode 100644 index e9f2f2a5..00000000 Binary files a/application/resources/multimc/16x16/minecraft.png and /dev/null differ diff --git a/application/resources/multimc/16x16/new.png b/application/resources/multimc/16x16/new.png deleted file mode 100644 index 2e56f589..00000000 Binary files a/application/resources/multimc/16x16/new.png and /dev/null differ diff --git a/application/resources/multimc/16x16/news.png b/application/resources/multimc/16x16/news.png deleted file mode 100644 index 872e85db..00000000 Binary files a/application/resources/multimc/16x16/news.png and /dev/null differ diff --git a/application/resources/multimc/16x16/noaccount.png b/application/resources/multimc/16x16/noaccount.png deleted file mode 100644 index b49bcf36..00000000 Binary files a/application/resources/multimc/16x16/noaccount.png and /dev/null differ diff --git a/application/resources/multimc/16x16/patreon.png b/application/resources/multimc/16x16/patreon.png deleted file mode 100644 index 9150c478..00000000 Binary files a/application/resources/multimc/16x16/patreon.png and /dev/null differ diff --git a/application/resources/multimc/16x16/refresh.png b/application/resources/multimc/16x16/refresh.png deleted file mode 100644 index 86b6f82c..00000000 Binary files a/application/resources/multimc/16x16/refresh.png and /dev/null differ diff --git a/application/resources/multimc/16x16/resourcepacks.png b/application/resources/multimc/16x16/resourcepacks.png deleted file mode 100644 index d862f5ca..00000000 Binary files a/application/resources/multimc/16x16/resourcepacks.png and /dev/null differ diff --git a/application/resources/multimc/16x16/screenshots.png b/application/resources/multimc/16x16/screenshots.png deleted file mode 100644 index 460000d4..00000000 Binary files a/application/resources/multimc/16x16/screenshots.png and /dev/null differ diff --git a/application/resources/multimc/16x16/settings.png b/application/resources/multimc/16x16/settings.png deleted file mode 100644 index b916cd24..00000000 Binary files a/application/resources/multimc/16x16/settings.png and /dev/null differ diff --git a/application/resources/multimc/16x16/star.png b/application/resources/multimc/16x16/star.png deleted file mode 100644 index 4963e6ec..00000000 Binary files a/application/resources/multimc/16x16/star.png and /dev/null differ diff --git a/application/resources/multimc/16x16/status-bad.png b/application/resources/multimc/16x16/status-bad.png deleted file mode 100644 index 5b3f2051..00000000 Binary files a/application/resources/multimc/16x16/status-bad.png and /dev/null differ diff --git a/application/resources/multimc/16x16/status-good.png b/application/resources/multimc/16x16/status-good.png deleted file mode 100644 index 5cbdee81..00000000 Binary files a/application/resources/multimc/16x16/status-good.png and /dev/null differ diff --git a/application/resources/multimc/16x16/status-running.png b/application/resources/multimc/16x16/status-running.png deleted file mode 100644 index a4c42e39..00000000 Binary files a/application/resources/multimc/16x16/status-running.png and /dev/null differ diff --git a/application/resources/multimc/16x16/status-yellow.png b/application/resources/multimc/16x16/status-yellow.png deleted file mode 100644 index b25375d1..00000000 Binary files a/application/resources/multimc/16x16/status-yellow.png and /dev/null differ diff --git a/application/resources/multimc/16x16/viewfolder.png b/application/resources/multimc/16x16/viewfolder.png deleted file mode 100644 index 98b8a944..00000000 Binary files a/application/resources/multimc/16x16/viewfolder.png and /dev/null differ diff --git a/application/resources/multimc/16x16/worlds.png b/application/resources/multimc/16x16/worlds.png deleted file mode 100644 index 1a38f38e..00000000 Binary files a/application/resources/multimc/16x16/worlds.png and /dev/null differ diff --git a/application/resources/multimc/22x22/about.png b/application/resources/multimc/22x22/about.png deleted file mode 100644 index 57775e25..00000000 Binary files a/application/resources/multimc/22x22/about.png and /dev/null differ diff --git a/application/resources/multimc/22x22/bug.png b/application/resources/multimc/22x22/bug.png deleted file mode 100644 index 90481bba..00000000 Binary files a/application/resources/multimc/22x22/bug.png and /dev/null differ diff --git a/application/resources/multimc/22x22/cat.png b/application/resources/multimc/22x22/cat.png deleted file mode 100644 index 3ea7ba69..00000000 Binary files a/application/resources/multimc/22x22/cat.png and /dev/null differ diff --git a/application/resources/multimc/22x22/centralmods.png b/application/resources/multimc/22x22/centralmods.png deleted file mode 100644 index a10f9a2b..00000000 Binary files a/application/resources/multimc/22x22/centralmods.png and /dev/null differ diff --git a/application/resources/multimc/22x22/checkupdate.png b/application/resources/multimc/22x22/checkupdate.png deleted file mode 100644 index badb200c..00000000 Binary files a/application/resources/multimc/22x22/checkupdate.png and /dev/null differ diff --git a/application/resources/multimc/22x22/copy.png b/application/resources/multimc/22x22/copy.png deleted file mode 100644 index ea236a24..00000000 Binary files a/application/resources/multimc/22x22/copy.png and /dev/null differ diff --git a/application/resources/multimc/22x22/help.png b/application/resources/multimc/22x22/help.png deleted file mode 100644 index da79b3e3..00000000 Binary files a/application/resources/multimc/22x22/help.png and /dev/null differ diff --git a/application/resources/multimc/22x22/instance-settings.png b/application/resources/multimc/22x22/instance-settings.png deleted file mode 100644 index daf56aad..00000000 Binary files a/application/resources/multimc/22x22/instance-settings.png and /dev/null differ diff --git a/application/resources/multimc/22x22/new.png b/application/resources/multimc/22x22/new.png deleted file mode 100644 index c707fbbf..00000000 Binary files a/application/resources/multimc/22x22/new.png and /dev/null differ diff --git a/application/resources/multimc/22x22/news.png b/application/resources/multimc/22x22/news.png deleted file mode 100644 index 1953bf7b..00000000 Binary files a/application/resources/multimc/22x22/news.png and /dev/null differ diff --git a/application/resources/multimc/22x22/patreon.png b/application/resources/multimc/22x22/patreon.png deleted file mode 100644 index f2c2076c..00000000 Binary files a/application/resources/multimc/22x22/patreon.png and /dev/null differ diff --git a/application/resources/multimc/22x22/refresh.png b/application/resources/multimc/22x22/refresh.png deleted file mode 100644 index 45b5535c..00000000 Binary files a/application/resources/multimc/22x22/refresh.png and /dev/null differ diff --git a/application/resources/multimc/22x22/screenshots.png b/application/resources/multimc/22x22/screenshots.png deleted file mode 100644 index 6fb42bbd..00000000 Binary files a/application/resources/multimc/22x22/screenshots.png and /dev/null differ diff --git a/application/resources/multimc/22x22/settings.png b/application/resources/multimc/22x22/settings.png deleted file mode 100644 index daf56aad..00000000 Binary files a/application/resources/multimc/22x22/settings.png and /dev/null differ diff --git a/application/resources/multimc/22x22/status-bad.png b/application/resources/multimc/22x22/status-bad.png deleted file mode 100644 index 2707539e..00000000 Binary files a/application/resources/multimc/22x22/status-bad.png and /dev/null differ diff --git a/application/resources/multimc/22x22/status-good.png b/application/resources/multimc/22x22/status-good.png deleted file mode 100644 index f55debc3..00000000 Binary files a/application/resources/multimc/22x22/status-good.png and /dev/null differ diff --git a/application/resources/multimc/22x22/status-running.png b/application/resources/multimc/22x22/status-running.png deleted file mode 100644 index 0dffba18..00000000 Binary files a/application/resources/multimc/22x22/status-running.png and /dev/null differ diff --git a/application/resources/multimc/22x22/status-yellow.png b/application/resources/multimc/22x22/status-yellow.png deleted file mode 100644 index 481eb7f3..00000000 Binary files a/application/resources/multimc/22x22/status-yellow.png and /dev/null differ diff --git a/application/resources/multimc/22x22/viewfolder.png b/application/resources/multimc/22x22/viewfolder.png deleted file mode 100644 index b645167f..00000000 Binary files a/application/resources/multimc/22x22/viewfolder.png and /dev/null differ diff --git a/application/resources/multimc/22x22/worlds.png b/application/resources/multimc/22x22/worlds.png deleted file mode 100644 index e8825bab..00000000 Binary files a/application/resources/multimc/22x22/worlds.png and /dev/null differ diff --git a/application/resources/multimc/24x24/cat.png b/application/resources/multimc/24x24/cat.png deleted file mode 100644 index c93245f6..00000000 Binary files a/application/resources/multimc/24x24/cat.png and /dev/null differ diff --git a/application/resources/multimc/24x24/coremods.png b/application/resources/multimc/24x24/coremods.png deleted file mode 100644 index 90603d24..00000000 Binary files a/application/resources/multimc/24x24/coremods.png and /dev/null differ diff --git a/application/resources/multimc/24x24/jarmods.png b/application/resources/multimc/24x24/jarmods.png deleted file mode 100644 index 68cb8e9d..00000000 Binary files a/application/resources/multimc/24x24/jarmods.png and /dev/null differ diff --git a/application/resources/multimc/24x24/loadermods.png b/application/resources/multimc/24x24/loadermods.png deleted file mode 100644 index 250a6260..00000000 Binary files a/application/resources/multimc/24x24/loadermods.png and /dev/null differ diff --git a/application/resources/multimc/24x24/log.png b/application/resources/multimc/24x24/log.png deleted file mode 100644 index fe302053..00000000 Binary files a/application/resources/multimc/24x24/log.png and /dev/null differ diff --git a/application/resources/multimc/24x24/minecraft.png b/application/resources/multimc/24x24/minecraft.png deleted file mode 100644 index b31177c9..00000000 Binary files a/application/resources/multimc/24x24/minecraft.png and /dev/null differ diff --git a/application/resources/multimc/24x24/noaccount.png b/application/resources/multimc/24x24/noaccount.png deleted file mode 100644 index ac12437c..00000000 Binary files a/application/resources/multimc/24x24/noaccount.png and /dev/null differ diff --git a/application/resources/multimc/24x24/patreon.png b/application/resources/multimc/24x24/patreon.png deleted file mode 100644 index add80668..00000000 Binary files a/application/resources/multimc/24x24/patreon.png and /dev/null differ diff --git a/application/resources/multimc/24x24/resourcepacks.png b/application/resources/multimc/24x24/resourcepacks.png deleted file mode 100644 index 68359d39..00000000 Binary files a/application/resources/multimc/24x24/resourcepacks.png and /dev/null differ diff --git a/application/resources/multimc/24x24/star.png b/application/resources/multimc/24x24/star.png deleted file mode 100644 index 7f16618a..00000000 Binary files a/application/resources/multimc/24x24/star.png and /dev/null differ diff --git a/application/resources/multimc/24x24/status-bad.png b/application/resources/multimc/24x24/status-bad.png deleted file mode 100644 index d1547a47..00000000 Binary files a/application/resources/multimc/24x24/status-bad.png and /dev/null differ diff --git a/application/resources/multimc/24x24/status-good.png b/application/resources/multimc/24x24/status-good.png deleted file mode 100644 index 3545bc4c..00000000 Binary files a/application/resources/multimc/24x24/status-good.png and /dev/null differ diff --git a/application/resources/multimc/24x24/status-running.png b/application/resources/multimc/24x24/status-running.png deleted file mode 100644 index ecd64451..00000000 Binary files a/application/resources/multimc/24x24/status-running.png and /dev/null differ diff --git a/application/resources/multimc/24x24/status-yellow.png b/application/resources/multimc/24x24/status-yellow.png deleted file mode 100644 index dd5fde67..00000000 Binary files a/application/resources/multimc/24x24/status-yellow.png and /dev/null differ diff --git a/application/resources/multimc/256x256/minecraft.png b/application/resources/multimc/256x256/minecraft.png deleted file mode 100644 index 77e3f03e..00000000 Binary files a/application/resources/multimc/256x256/minecraft.png and /dev/null differ diff --git a/application/resources/multimc/32x32/about.png b/application/resources/multimc/32x32/about.png deleted file mode 100644 index 5174c4f1..00000000 Binary files a/application/resources/multimc/32x32/about.png and /dev/null differ diff --git a/application/resources/multimc/32x32/bug.png b/application/resources/multimc/32x32/bug.png deleted file mode 100644 index ada46653..00000000 Binary files a/application/resources/multimc/32x32/bug.png and /dev/null differ diff --git a/application/resources/multimc/32x32/cat.png b/application/resources/multimc/32x32/cat.png deleted file mode 100644 index 78ff98e9..00000000 Binary files a/application/resources/multimc/32x32/cat.png and /dev/null differ diff --git a/application/resources/multimc/32x32/centralmods.png b/application/resources/multimc/32x32/centralmods.png deleted file mode 100644 index cd2b8208..00000000 Binary files a/application/resources/multimc/32x32/centralmods.png and /dev/null differ diff --git a/application/resources/multimc/32x32/checkupdate.png b/application/resources/multimc/32x32/checkupdate.png deleted file mode 100644 index 754005f9..00000000 Binary files a/application/resources/multimc/32x32/checkupdate.png and /dev/null differ diff --git a/application/resources/multimc/32x32/copy.png b/application/resources/multimc/32x32/copy.png deleted file mode 100644 index c137b0f1..00000000 Binary files a/application/resources/multimc/32x32/copy.png and /dev/null differ diff --git a/application/resources/multimc/32x32/coremods.png b/application/resources/multimc/32x32/coremods.png deleted file mode 100644 index 770d695e..00000000 Binary files a/application/resources/multimc/32x32/coremods.png and /dev/null differ diff --git a/application/resources/multimc/32x32/help.png b/application/resources/multimc/32x32/help.png deleted file mode 100644 index b3854278..00000000 Binary files a/application/resources/multimc/32x32/help.png and /dev/null differ diff --git a/application/resources/multimc/32x32/instance-settings.png b/application/resources/multimc/32x32/instance-settings.png deleted file mode 100644 index a9c0817c..00000000 Binary files a/application/resources/multimc/32x32/instance-settings.png and /dev/null differ diff --git a/application/resources/multimc/32x32/instances/brick.png b/application/resources/multimc/32x32/instances/brick.png deleted file mode 100644 index c324fda0..00000000 Binary files a/application/resources/multimc/32x32/instances/brick.png and /dev/null differ diff --git a/application/resources/multimc/32x32/instances/chicken.png b/application/resources/multimc/32x32/instances/chicken.png deleted file mode 100644 index f870467a..00000000 Binary files a/application/resources/multimc/32x32/instances/chicken.png and /dev/null differ diff --git a/application/resources/multimc/32x32/instances/creeper.png b/application/resources/multimc/32x32/instances/creeper.png deleted file mode 100644 index a67ecfc3..00000000 Binary files a/application/resources/multimc/32x32/instances/creeper.png and /dev/null differ diff --git a/application/resources/multimc/32x32/instances/diamond.png b/application/resources/multimc/32x32/instances/diamond.png deleted file mode 100644 index 1eb26469..00000000 Binary files a/application/resources/multimc/32x32/instances/diamond.png and /dev/null differ diff --git a/application/resources/multimc/32x32/instances/dirt.png b/application/resources/multimc/32x32/instances/dirt.png deleted file mode 100644 index 9e19eb8f..00000000 Binary files a/application/resources/multimc/32x32/instances/dirt.png and /dev/null differ diff --git a/application/resources/multimc/32x32/instances/enderpearl.png b/application/resources/multimc/32x32/instances/enderpearl.png deleted file mode 100644 index a818eb8e..00000000 Binary files a/application/resources/multimc/32x32/instances/enderpearl.png and /dev/null differ diff --git a/application/resources/multimc/32x32/instances/flame.png b/application/resources/multimc/32x32/instances/flame.png deleted file mode 100644 index d8987338..00000000 Binary files a/application/resources/multimc/32x32/instances/flame.png and /dev/null differ diff --git a/application/resources/multimc/32x32/instances/ftb_glow.png b/application/resources/multimc/32x32/instances/ftb_glow.png deleted file mode 100644 index c4e6fd5d..00000000 Binary files a/application/resources/multimc/32x32/instances/ftb_glow.png and /dev/null differ diff --git a/application/resources/multimc/32x32/instances/ftb_logo.png b/application/resources/multimc/32x32/instances/ftb_logo.png deleted file mode 100644 index 20df7171..00000000 Binary files a/application/resources/multimc/32x32/instances/ftb_logo.png and /dev/null differ diff --git a/application/resources/multimc/32x32/instances/gear.png b/application/resources/multimc/32x32/instances/gear.png deleted file mode 100644 index da9ba2f9..00000000 Binary files a/application/resources/multimc/32x32/instances/gear.png and /dev/null differ diff --git a/application/resources/multimc/32x32/instances/gold.png b/application/resources/multimc/32x32/instances/gold.png deleted file mode 100644 index 593410fa..00000000 Binary files a/application/resources/multimc/32x32/instances/gold.png and /dev/null differ diff --git a/application/resources/multimc/32x32/instances/grass.png b/application/resources/multimc/32x32/instances/grass.png deleted file mode 100644 index f1694547..00000000 Binary files a/application/resources/multimc/32x32/instances/grass.png and /dev/null differ diff --git a/application/resources/multimc/32x32/instances/herobrine.png b/application/resources/multimc/32x32/instances/herobrine.png deleted file mode 100644 index e5460da3..00000000 Binary files a/application/resources/multimc/32x32/instances/herobrine.png and /dev/null differ diff --git a/application/resources/multimc/32x32/instances/infinity.png b/application/resources/multimc/32x32/instances/infinity.png deleted file mode 100644 index bd94a3dc..00000000 Binary files a/application/resources/multimc/32x32/instances/infinity.png and /dev/null differ diff --git a/application/resources/multimc/32x32/instances/iron.png b/application/resources/multimc/32x32/instances/iron.png deleted file mode 100644 index 3e811bd6..00000000 Binary files a/application/resources/multimc/32x32/instances/iron.png and /dev/null differ diff --git a/application/resources/multimc/32x32/instances/magitech.png b/application/resources/multimc/32x32/instances/magitech.png deleted file mode 100644 index 6fd8ff60..00000000 Binary files a/application/resources/multimc/32x32/instances/magitech.png and /dev/null differ diff --git a/application/resources/multimc/32x32/instances/meat.png b/application/resources/multimc/32x32/instances/meat.png deleted file mode 100644 index 6694859d..00000000 Binary files a/application/resources/multimc/32x32/instances/meat.png and /dev/null differ diff --git a/application/resources/multimc/32x32/instances/netherstar.png b/application/resources/multimc/32x32/instances/netherstar.png deleted file mode 100644 index 43cb5113..00000000 Binary files a/application/resources/multimc/32x32/instances/netherstar.png and /dev/null differ diff --git a/application/resources/multimc/32x32/instances/planks.png b/application/resources/multimc/32x32/instances/planks.png deleted file mode 100644 index a94b7502..00000000 Binary files a/application/resources/multimc/32x32/instances/planks.png and /dev/null differ diff --git a/application/resources/multimc/32x32/instances/skeleton.png b/application/resources/multimc/32x32/instances/skeleton.png deleted file mode 100644 index 0c8d3505..00000000 Binary files a/application/resources/multimc/32x32/instances/skeleton.png and /dev/null differ diff --git a/application/resources/multimc/32x32/instances/squarecreeper.png b/application/resources/multimc/32x32/instances/squarecreeper.png deleted file mode 100644 index b78c4ae0..00000000 Binary files a/application/resources/multimc/32x32/instances/squarecreeper.png and /dev/null differ diff --git a/application/resources/multimc/32x32/instances/steve.png b/application/resources/multimc/32x32/instances/steve.png deleted file mode 100644 index 07c6acde..00000000 Binary files a/application/resources/multimc/32x32/instances/steve.png and /dev/null differ diff --git a/application/resources/multimc/32x32/instances/stone.png b/application/resources/multimc/32x32/instances/stone.png deleted file mode 100644 index 1b6ef7a4..00000000 Binary files a/application/resources/multimc/32x32/instances/stone.png and /dev/null differ diff --git a/application/resources/multimc/32x32/instances/tnt.png b/application/resources/multimc/32x32/instances/tnt.png deleted file mode 100644 index e40d404d..00000000 Binary files a/application/resources/multimc/32x32/instances/tnt.png and /dev/null differ diff --git a/application/resources/multimc/32x32/jarmods.png b/application/resources/multimc/32x32/jarmods.png deleted file mode 100644 index 5cda173a..00000000 Binary files a/application/resources/multimc/32x32/jarmods.png and /dev/null differ diff --git a/application/resources/multimc/32x32/loadermods.png b/application/resources/multimc/32x32/loadermods.png deleted file mode 100644 index c4ca12e2..00000000 Binary files a/application/resources/multimc/32x32/loadermods.png and /dev/null differ diff --git a/application/resources/multimc/32x32/log.png b/application/resources/multimc/32x32/log.png deleted file mode 100644 index d620da12..00000000 Binary files a/application/resources/multimc/32x32/log.png and /dev/null differ diff --git a/application/resources/multimc/32x32/minecraft.png b/application/resources/multimc/32x32/minecraft.png deleted file mode 100644 index 816bec98..00000000 Binary files a/application/resources/multimc/32x32/minecraft.png and /dev/null differ diff --git a/application/resources/multimc/32x32/new.png b/application/resources/multimc/32x32/new.png deleted file mode 100644 index a3555ba4..00000000 Binary files a/application/resources/multimc/32x32/new.png and /dev/null differ diff --git a/application/resources/multimc/32x32/news.png b/application/resources/multimc/32x32/news.png deleted file mode 100644 index c579fd44..00000000 Binary files a/application/resources/multimc/32x32/news.png and /dev/null differ diff --git a/application/resources/multimc/32x32/noaccount.png b/application/resources/multimc/32x32/noaccount.png deleted file mode 100644 index a73afc94..00000000 Binary files a/application/resources/multimc/32x32/noaccount.png and /dev/null differ diff --git a/application/resources/multimc/32x32/patreon.png b/application/resources/multimc/32x32/patreon.png deleted file mode 100644 index 70085aa1..00000000 Binary files a/application/resources/multimc/32x32/patreon.png and /dev/null differ diff --git a/application/resources/multimc/32x32/refresh.png b/application/resources/multimc/32x32/refresh.png deleted file mode 100644 index afa2a9d7..00000000 Binary files a/application/resources/multimc/32x32/refresh.png and /dev/null differ diff --git a/application/resources/multimc/32x32/resourcepacks.png b/application/resources/multimc/32x32/resourcepacks.png deleted file mode 100644 index c14759ef..00000000 Binary files a/application/resources/multimc/32x32/resourcepacks.png and /dev/null differ diff --git a/application/resources/multimc/32x32/screenshots.png b/application/resources/multimc/32x32/screenshots.png deleted file mode 100644 index 4fcd6224..00000000 Binary files a/application/resources/multimc/32x32/screenshots.png and /dev/null differ diff --git a/application/resources/multimc/32x32/settings.png b/application/resources/multimc/32x32/settings.png deleted file mode 100644 index a9c0817c..00000000 Binary files a/application/resources/multimc/32x32/settings.png and /dev/null differ diff --git a/application/resources/multimc/32x32/star.png b/application/resources/multimc/32x32/star.png deleted file mode 100644 index b271f0d1..00000000 Binary files a/application/resources/multimc/32x32/star.png and /dev/null differ diff --git a/application/resources/multimc/32x32/status-bad.png b/application/resources/multimc/32x32/status-bad.png deleted file mode 100644 index 8c2c9d4f..00000000 Binary files a/application/resources/multimc/32x32/status-bad.png and /dev/null differ diff --git a/application/resources/multimc/32x32/status-good.png b/application/resources/multimc/32x32/status-good.png deleted file mode 100644 index 1a805e68..00000000 Binary files a/application/resources/multimc/32x32/status-good.png and /dev/null differ diff --git a/application/resources/multimc/32x32/status-running.png b/application/resources/multimc/32x32/status-running.png deleted file mode 100644 index f561f01a..00000000 Binary files a/application/resources/multimc/32x32/status-running.png and /dev/null differ diff --git a/application/resources/multimc/32x32/status-yellow.png b/application/resources/multimc/32x32/status-yellow.png deleted file mode 100644 index 42c68552..00000000 Binary files a/application/resources/multimc/32x32/status-yellow.png and /dev/null differ diff --git a/application/resources/multimc/32x32/viewfolder.png b/application/resources/multimc/32x32/viewfolder.png deleted file mode 100644 index 74ab8fa6..00000000 Binary files a/application/resources/multimc/32x32/viewfolder.png and /dev/null differ diff --git a/application/resources/multimc/32x32/worlds.png b/application/resources/multimc/32x32/worlds.png deleted file mode 100644 index c986596c..00000000 Binary files a/application/resources/multimc/32x32/worlds.png and /dev/null differ diff --git a/application/resources/multimc/48x48/about.png b/application/resources/multimc/48x48/about.png deleted file mode 100644 index b4ac71b8..00000000 Binary files a/application/resources/multimc/48x48/about.png and /dev/null differ diff --git a/application/resources/multimc/48x48/bug.png b/application/resources/multimc/48x48/bug.png deleted file mode 100644 index 298f9397..00000000 Binary files a/application/resources/multimc/48x48/bug.png and /dev/null differ diff --git a/application/resources/multimc/48x48/cat.png b/application/resources/multimc/48x48/cat.png deleted file mode 100644 index 25912a3c..00000000 Binary files a/application/resources/multimc/48x48/cat.png and /dev/null differ diff --git a/application/resources/multimc/48x48/centralmods.png b/application/resources/multimc/48x48/centralmods.png deleted file mode 100644 index d927e39b..00000000 Binary files a/application/resources/multimc/48x48/centralmods.png and /dev/null differ diff --git a/application/resources/multimc/48x48/checkupdate.png b/application/resources/multimc/48x48/checkupdate.png deleted file mode 100644 index 2e2c7d6b..00000000 Binary files a/application/resources/multimc/48x48/checkupdate.png and /dev/null differ diff --git a/application/resources/multimc/48x48/copy.png b/application/resources/multimc/48x48/copy.png deleted file mode 100644 index ea40e34b..00000000 Binary files a/application/resources/multimc/48x48/copy.png and /dev/null differ diff --git a/application/resources/multimc/48x48/help.png b/application/resources/multimc/48x48/help.png deleted file mode 100644 index 82d828fa..00000000 Binary files a/application/resources/multimc/48x48/help.png and /dev/null differ diff --git a/application/resources/multimc/48x48/instance-settings.png b/application/resources/multimc/48x48/instance-settings.png deleted file mode 100644 index 6674eb23..00000000 Binary files a/application/resources/multimc/48x48/instance-settings.png and /dev/null differ diff --git a/application/resources/multimc/48x48/log.png b/application/resources/multimc/48x48/log.png deleted file mode 100644 index 45f60e6b..00000000 Binary files a/application/resources/multimc/48x48/log.png and /dev/null differ diff --git a/application/resources/multimc/48x48/minecraft.png b/application/resources/multimc/48x48/minecraft.png deleted file mode 100644 index 38fc9f6c..00000000 Binary files a/application/resources/multimc/48x48/minecraft.png and /dev/null differ diff --git a/application/resources/multimc/48x48/new.png b/application/resources/multimc/48x48/new.png deleted file mode 100644 index a81753b3..00000000 Binary files a/application/resources/multimc/48x48/new.png and /dev/null differ diff --git a/application/resources/multimc/48x48/news.png b/application/resources/multimc/48x48/news.png deleted file mode 100644 index 0f82d857..00000000 Binary files a/application/resources/multimc/48x48/news.png and /dev/null differ diff --git a/application/resources/multimc/48x48/noaccount.png b/application/resources/multimc/48x48/noaccount.png deleted file mode 100644 index 4703796c..00000000 Binary files a/application/resources/multimc/48x48/noaccount.png and /dev/null differ diff --git a/application/resources/multimc/48x48/patreon.png b/application/resources/multimc/48x48/patreon.png deleted file mode 100644 index 7aec4d7d..00000000 Binary files a/application/resources/multimc/48x48/patreon.png and /dev/null differ diff --git a/application/resources/multimc/48x48/refresh.png b/application/resources/multimc/48x48/refresh.png deleted file mode 100644 index 0b08b238..00000000 Binary files a/application/resources/multimc/48x48/refresh.png and /dev/null differ diff --git a/application/resources/multimc/48x48/screenshots.png b/application/resources/multimc/48x48/screenshots.png deleted file mode 100644 index 03c0059f..00000000 Binary files a/application/resources/multimc/48x48/screenshots.png and /dev/null differ diff --git a/application/resources/multimc/48x48/settings.png b/application/resources/multimc/48x48/settings.png deleted file mode 100644 index 6674eb23..00000000 Binary files a/application/resources/multimc/48x48/settings.png and /dev/null differ diff --git a/application/resources/multimc/48x48/star.png b/application/resources/multimc/48x48/star.png deleted file mode 100644 index d9468e7e..00000000 Binary files a/application/resources/multimc/48x48/star.png and /dev/null differ diff --git a/application/resources/multimc/48x48/status-bad.png b/application/resources/multimc/48x48/status-bad.png deleted file mode 100644 index 41c9cf22..00000000 Binary files a/application/resources/multimc/48x48/status-bad.png and /dev/null differ diff --git a/application/resources/multimc/48x48/status-good.png b/application/resources/multimc/48x48/status-good.png deleted file mode 100644 index df7cb59b..00000000 Binary files a/application/resources/multimc/48x48/status-good.png and /dev/null differ diff --git a/application/resources/multimc/48x48/status-running.png b/application/resources/multimc/48x48/status-running.png deleted file mode 100644 index b8c0bf7c..00000000 Binary files a/application/resources/multimc/48x48/status-running.png and /dev/null differ diff --git a/application/resources/multimc/48x48/status-yellow.png b/application/resources/multimc/48x48/status-yellow.png deleted file mode 100644 index 4f3b11d6..00000000 Binary files a/application/resources/multimc/48x48/status-yellow.png and /dev/null differ diff --git a/application/resources/multimc/48x48/viewfolder.png b/application/resources/multimc/48x48/viewfolder.png deleted file mode 100644 index 0492a736..00000000 Binary files a/application/resources/multimc/48x48/viewfolder.png and /dev/null differ diff --git a/application/resources/multimc/48x48/worlds.png b/application/resources/multimc/48x48/worlds.png deleted file mode 100644 index 4fc33751..00000000 Binary files a/application/resources/multimc/48x48/worlds.png and /dev/null differ diff --git a/application/resources/multimc/50x50/instances/enderman.png b/application/resources/multimc/50x50/instances/enderman.png deleted file mode 100644 index 9f3a72b3..00000000 Binary files a/application/resources/multimc/50x50/instances/enderman.png and /dev/null differ diff --git a/application/resources/multimc/64x64/about.png b/application/resources/multimc/64x64/about.png deleted file mode 100644 index b83e9269..00000000 Binary files a/application/resources/multimc/64x64/about.png and /dev/null differ diff --git a/application/resources/multimc/64x64/bug.png b/application/resources/multimc/64x64/bug.png deleted file mode 100644 index 156b0315..00000000 Binary files a/application/resources/multimc/64x64/bug.png and /dev/null differ diff --git a/application/resources/multimc/64x64/cat.png b/application/resources/multimc/64x64/cat.png deleted file mode 100644 index 2cc21f80..00000000 Binary files a/application/resources/multimc/64x64/cat.png and /dev/null differ diff --git a/application/resources/multimc/64x64/centralmods.png b/application/resources/multimc/64x64/centralmods.png deleted file mode 100644 index 8831f437..00000000 Binary files a/application/resources/multimc/64x64/centralmods.png and /dev/null differ diff --git a/application/resources/multimc/64x64/checkupdate.png b/application/resources/multimc/64x64/checkupdate.png deleted file mode 100644 index dd1e29ac..00000000 Binary files a/application/resources/multimc/64x64/checkupdate.png and /dev/null differ diff --git a/application/resources/multimc/64x64/copy.png b/application/resources/multimc/64x64/copy.png deleted file mode 100644 index d12cf9c8..00000000 Binary files a/application/resources/multimc/64x64/copy.png and /dev/null differ diff --git a/application/resources/multimc/64x64/coremods.png b/application/resources/multimc/64x64/coremods.png deleted file mode 100644 index 668be334..00000000 Binary files a/application/resources/multimc/64x64/coremods.png and /dev/null differ diff --git a/application/resources/multimc/64x64/help.png b/application/resources/multimc/64x64/help.png deleted file mode 100644 index 0f3948c2..00000000 Binary files a/application/resources/multimc/64x64/help.png and /dev/null differ diff --git a/application/resources/multimc/64x64/instance-settings.png b/application/resources/multimc/64x64/instance-settings.png deleted file mode 100644 index e3ff58fa..00000000 Binary files a/application/resources/multimc/64x64/instance-settings.png and /dev/null differ diff --git a/application/resources/multimc/64x64/jarmods.png b/application/resources/multimc/64x64/jarmods.png deleted file mode 100644 index 55d1a42a..00000000 Binary files a/application/resources/multimc/64x64/jarmods.png and /dev/null differ diff --git a/application/resources/multimc/64x64/loadermods.png b/application/resources/multimc/64x64/loadermods.png deleted file mode 100644 index 24618fd0..00000000 Binary files a/application/resources/multimc/64x64/loadermods.png and /dev/null differ diff --git a/application/resources/multimc/64x64/log.png b/application/resources/multimc/64x64/log.png deleted file mode 100644 index 0f531cdf..00000000 Binary files a/application/resources/multimc/64x64/log.png and /dev/null differ diff --git a/application/resources/multimc/64x64/new.png b/application/resources/multimc/64x64/new.png deleted file mode 100644 index c3c6796c..00000000 Binary files a/application/resources/multimc/64x64/new.png and /dev/null differ diff --git a/application/resources/multimc/64x64/news.png b/application/resources/multimc/64x64/news.png deleted file mode 100644 index e306eed3..00000000 Binary files a/application/resources/multimc/64x64/news.png and /dev/null differ diff --git a/application/resources/multimc/64x64/patreon.png b/application/resources/multimc/64x64/patreon.png deleted file mode 100644 index ef5d690e..00000000 Binary files a/application/resources/multimc/64x64/patreon.png and /dev/null differ diff --git a/application/resources/multimc/64x64/refresh.png b/application/resources/multimc/64x64/refresh.png deleted file mode 100644 index 8373d819..00000000 Binary files a/application/resources/multimc/64x64/refresh.png and /dev/null differ diff --git a/application/resources/multimc/64x64/resourcepacks.png b/application/resources/multimc/64x64/resourcepacks.png deleted file mode 100644 index fb874e7d..00000000 Binary files a/application/resources/multimc/64x64/resourcepacks.png and /dev/null differ diff --git a/application/resources/multimc/64x64/screenshots.png b/application/resources/multimc/64x64/screenshots.png deleted file mode 100644 index af18e39c..00000000 Binary files a/application/resources/multimc/64x64/screenshots.png and /dev/null differ diff --git a/application/resources/multimc/64x64/settings.png b/application/resources/multimc/64x64/settings.png deleted file mode 100644 index e3ff58fa..00000000 Binary files a/application/resources/multimc/64x64/settings.png and /dev/null differ diff --git a/application/resources/multimc/64x64/star.png b/application/resources/multimc/64x64/star.png deleted file mode 100644 index 4ed5d978..00000000 Binary files a/application/resources/multimc/64x64/star.png and /dev/null differ diff --git a/application/resources/multimc/64x64/status-bad.png b/application/resources/multimc/64x64/status-bad.png deleted file mode 100644 index 64060ba0..00000000 Binary files a/application/resources/multimc/64x64/status-bad.png and /dev/null differ diff --git a/application/resources/multimc/64x64/status-good.png b/application/resources/multimc/64x64/status-good.png deleted file mode 100644 index e862ddcd..00000000 Binary files a/application/resources/multimc/64x64/status-good.png and /dev/null differ diff --git a/application/resources/multimc/64x64/status-running.png b/application/resources/multimc/64x64/status-running.png deleted file mode 100644 index 38afda0f..00000000 Binary files a/application/resources/multimc/64x64/status-running.png and /dev/null differ diff --git a/application/resources/multimc/64x64/status-yellow.png b/application/resources/multimc/64x64/status-yellow.png deleted file mode 100644 index 3d54d320..00000000 Binary files a/application/resources/multimc/64x64/status-yellow.png and /dev/null differ diff --git a/application/resources/multimc/64x64/viewfolder.png b/application/resources/multimc/64x64/viewfolder.png deleted file mode 100644 index 7d531f9c..00000000 Binary files a/application/resources/multimc/64x64/viewfolder.png and /dev/null differ diff --git a/application/resources/multimc/64x64/worlds.png b/application/resources/multimc/64x64/worlds.png deleted file mode 100644 index 1d40f1df..00000000 Binary files a/application/resources/multimc/64x64/worlds.png and /dev/null differ diff --git a/application/resources/multimc/8x8/noaccount.png b/application/resources/multimc/8x8/noaccount.png deleted file mode 100644 index 466e4c07..00000000 Binary files a/application/resources/multimc/8x8/noaccount.png and /dev/null differ diff --git a/application/resources/multimc/index.theme b/application/resources/multimc/index.theme deleted file mode 100644 index 6061b7f8..00000000 --- a/application/resources/multimc/index.theme +++ /dev/null @@ -1,58 +0,0 @@ -[Icon Theme] -Name=multimc -Comment=MultiMC Default Icons -Inherits=default -Directories=8x8,16x16,22x22,24x24,32x32,32x32/instances,48x48,50x50/instances,64x64,128x128/instances,256x256,scalable,scalable/instances - -[8x8] -Size=8 - -[16x16] -Size=16 - -[22x22] -Size=22 - -[24x24] -Size=24 - -[32x32] -Size=32 - -[32x32/instances] -Size=32 -MinSize=1 -MaxSize=32 - -[48x48] -Size=48 - -[50x50/instances] -Size=50 - -[64x64] -Size=64 - -[128x128] -Size=128 -MinSize=33 -MaxSize=128 - -[128x128/instances] -Size=128 -MinSize=33 -MaxSize=128 - -[256x256] -Size=256 - -[scalable] -Size=48 -Type=Scalable -MinSize=16 -MaxSize=256 - -[scalable/instances] -Size=128 -MinSize=16 -MaxSize=256 diff --git a/application/resources/multimc/multimc.qrc b/application/resources/multimc/multimc.qrc deleted file mode 100644 index 249e8e28..00000000 --- a/application/resources/multimc/multimc.qrc +++ /dev/null @@ -1,320 +0,0 @@ - - - - index.theme - - scalable/logo.svg - - - scalable/multimc.svg - - - scalable/reddit-alien.svg - - - 32x32/instances/flame.png - 128x128/instances/flame.png - - - scalable/technic.svg - - - scalable/atlauncher.svg - scalable/atlauncher-placeholder.png - - - scalable/proxy.svg - - - scalable/language.svg - - - scalable/java.svg - - - 16x16/star.png - 24x24/star.png - 32x32/star.png - 48x48/star.png - 64x64/star.png - - - 16x16/worlds.png - 22x22/worlds.png - 32x32/worlds.png - 48x48/worlds.png - 64x64/worlds.png - - - 16x16/minecraft.png - 24x24/minecraft.png - 32x32/minecraft.png - 48x48/minecraft.png - 256x256/minecraft.png - - - 16x16/about.png - 22x22/about.png - 32x32/about.png - 48x48/about.png - 64x64/about.png - - - scalable/bug.svg - 16x16/bug.png - 22x22/bug.png - 32x32/bug.png - 48x48/bug.png - 64x64/bug.png - - - - 16x16/screenshots.png - 22x22/screenshots.png - 32x32/screenshots.png - 48x48/screenshots.png - 64x64/screenshots.png - scalable/screenshots.svg - - - scalable/custom-commands.svg - - - 16x16/patreon.png - 22x22/patreon.png - 24x24/patreon.png - 32x32/patreon.png - 48x48/patreon.png - 64x64/patreon.png - - - 16x16/cat.png - 22x22/cat.png - 24x24/cat.png - 32x32/cat.png - 48x48/cat.png - 64x64/cat.png - - - scalable/centralmods.svg - 16x16/centralmods.png - 22x22/centralmods.png - 32x32/centralmods.png - 48x48/centralmods.png - 64x64/centralmods.png - - - scalable/checkupdate.svg - 16x16/checkupdate.png - 22x22/checkupdate.png - 32x32/checkupdate.png - 48x48/checkupdate.png - 64x64/checkupdate.png - - - 16x16/copy.png - 22x22/copy.png - 32x32/copy.png - 48x48/copy.png - 64x64/copy.png - - - 16x16/help.png - 22x22/help.png - 32x32/help.png - 48x48/help.png - 64x64/help.png - - - 16x16/new.png - 22x22/new.png - 32x32/new.png - 48x48/new.png - 64x64/new.png - - - scalable/news.svg - 16x16/news.png - 22x22/news.png - 32x32/news.png - 48x48/news.png - 64x64/news.png - - - 16x16/status-bad.png - 24x24/status-bad.png - 22x22/status-bad.png - 32x32/status-bad.png - 48x48/status-bad.png - 64x64/status-bad.png - - - 16x16/status-good.png - 24x24/status-good.png - 22x22/status-good.png - 32x32/status-good.png - 48x48/status-good.png - 64x64/status-good.png - - - 16x16/status-yellow.png - 24x24/status-yellow.png - 22x22/status-yellow.png - 32x32/status-yellow.png - 48x48/status-yellow.png - 64x64/status-yellow.png - - - 16x16/status-running.png - 24x24/status-running.png - 22x22/status-running.png - 32x32/status-running.png - 48x48/status-running.png - 64x64/status-running.png - scalable/status-running.svg - - - 16x16/loadermods.png - 24x24/loadermods.png - 32x32/loadermods.png - 64x64/loadermods.png - - - 16x16/jarmods.png - 24x24/jarmods.png - 32x32/jarmods.png - 64x64/jarmods.png - - - 16x16/coremods.png - 24x24/coremods.png - 32x32/coremods.png - 64x64/coremods.png - - - 16x16/resourcepacks.png - 24x24/resourcepacks.png - 32x32/resourcepacks.png - 64x64/resourcepacks.png - - - 16x16/refresh.png - 22x22/refresh.png - 32x32/refresh.png - 48x48/refresh.png - 64x64/refresh.png - - - 16x16/settings.png - 22x22/settings.png - 32x32/settings.png - 48x48/settings.png - 64x64/settings.png - - - 16x16/instance-settings.png - 22x22/instance-settings.png - 32x32/instance-settings.png - 48x48/instance-settings.png - 64x64/instance-settings.png - - - scalable/viewfolder.svg - 16x16/viewfolder.png - 22x22/viewfolder.png - 32x32/viewfolder.png - 48x48/viewfolder.png - 64x64/viewfolder.png - - - 8x8/noaccount.png - 16x16/noaccount.png - 24x24/noaccount.png - 32x32/noaccount.png - 48x48/noaccount.png - - - 8x8/noaccount.png - 16x16/noaccount.png - 24x24/noaccount.png - 32x32/noaccount.png - 48x48/noaccount.png - - - 16x16/log.png - 24x24/log.png - 32x32/log.png - 48x48/log.png - 64x64/log.png - - - 128x128/unknown_server.png - - - scalable/screenshot-placeholder.svg - - - scalable/discord.svg - - - 32x32/instances/chicken.png - 128x128/instances/chicken.png - - 32x32/instances/creeper.png - 128x128/instances/creeper.png - - 32x32/instances/enderpearl.png - 128x128/instances/enderpearl.png - - 32x32/instances/ftb_glow.png - 128x128/instances/ftb_glow.png - - 32x32/instances/ftb_logo.png - 128x128/instances/ftb_logo.png - - 32x32/instances/flame.png - 128x128/instances/flame.png - - 32x32/instances/gear.png - 128x128/instances/gear.png - - 32x32/instances/herobrine.png - 128x128/instances/herobrine.png - - 32x32/instances/infinity.png - 128x128/instances/infinity.png - - 32x32/instances/magitech.png - 128x128/instances/magitech.png - - 32x32/instances/meat.png - 128x128/instances/meat.png - - 32x32/instances/netherstar.png - 128x128/instances/netherstar.png - - 32x32/instances/skeleton.png - 128x128/instances/skeleton.png - - 32x32/instances/squarecreeper.png - 128x128/instances/squarecreeper.png - - 32x32/instances/steve.png - 128x128/instances/steve.png - - 32x32/instances/brick.png - 32x32/instances/diamond.png - 32x32/instances/dirt.png - 32x32/instances/gold.png - 32x32/instances/grass.png - 32x32/instances/iron.png - 32x32/instances/planks.png - 32x32/instances/stone.png - 32x32/instances/tnt.png - - 50x50/instances/enderman.png - - scalable/instances/fox.svg - scalable/instances/bee.svg - - diff --git a/application/resources/multimc/scalable/atlauncher-placeholder.png b/application/resources/multimc/scalable/atlauncher-placeholder.png deleted file mode 100644 index f4314c43..00000000 Binary files a/application/resources/multimc/scalable/atlauncher-placeholder.png and /dev/null differ diff --git a/application/resources/multimc/scalable/atlauncher.svg b/application/resources/multimc/scalable/atlauncher.svg deleted file mode 100644 index 1bb5f359..00000000 --- a/application/resources/multimc/scalable/atlauncher.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - diff --git a/application/resources/multimc/scalable/bug.svg b/application/resources/multimc/scalable/bug.svg deleted file mode 100644 index 178e3c23..00000000 --- a/application/resources/multimc/scalable/bug.svg +++ /dev/null @@ -1,387 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/multimc/scalable/centralmods.svg b/application/resources/multimc/scalable/centralmods.svg deleted file mode 100644 index a8b123d0..00000000 --- a/application/resources/multimc/scalable/centralmods.svg +++ /dev/null @@ -1,346 +0,0 @@ - - - - - - - - - - unsorted - - - - - Open Clip Art Library, Source: Oxygen Icons, Source: Oxygen Icons, Source: Oxygen Icons, Source: Oxygen Icons - - - - - - - - - - - - - - image/svg+xml - - - en - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/multimc/scalable/checkupdate.svg b/application/resources/multimc/scalable/checkupdate.svg deleted file mode 100644 index fc09cb4c..00000000 --- a/application/resources/multimc/scalable/checkupdate.svg +++ /dev/null @@ -1,167 +0,0 @@ - - - - - - - - - - unsorted - - - - - Open Clip Art Library, Source: GNOME-Colors, Source: GNOME-Colors, Source: GNOME-Colors, Source: GNOME-Colors, Source: GNOME-Colors - - - - - - - - - - - - - - image/svg+xml - - - en - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/multimc/scalable/custom-commands.svg b/application/resources/multimc/scalable/custom-commands.svg deleted file mode 100644 index b7f1a149..00000000 --- a/application/resources/multimc/scalable/custom-commands.svg +++ /dev/null @@ -1,338 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/multimc/scalable/discord.svg b/application/resources/multimc/scalable/discord.svg deleted file mode 100644 index 067be1e8..00000000 --- a/application/resources/multimc/scalable/discord.svg +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - diff --git a/application/resources/multimc/scalable/instances/bee.svg b/application/resources/multimc/scalable/instances/bee.svg deleted file mode 100644 index 49f216c8..00000000 --- a/application/resources/multimc/scalable/instances/bee.svg +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/multimc/scalable/instances/fox.svg b/application/resources/multimc/scalable/instances/fox.svg deleted file mode 100644 index fcf16b2f..00000000 --- a/application/resources/multimc/scalable/instances/fox.svg +++ /dev/null @@ -1,290 +0,0 @@ - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/multimc/scalable/java.svg b/application/resources/multimc/scalable/java.svg deleted file mode 100644 index fd15e5c6..00000000 --- a/application/resources/multimc/scalable/java.svg +++ /dev/null @@ -1,773 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/multimc/scalable/language.svg b/application/resources/multimc/scalable/language.svg deleted file mode 100644 index 968e3538..00000000 --- a/application/resources/multimc/scalable/language.svg +++ /dev/null @@ -1,109 +0,0 @@ - -image/svg+xml \ No newline at end of file diff --git a/application/resources/multimc/scalable/logo.svg b/application/resources/multimc/scalable/logo.svg deleted file mode 100644 index 8bb0e289..00000000 --- a/application/resources/multimc/scalable/logo.svg +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/multimc/scalable/multimc.svg b/application/resources/multimc/scalable/multimc.svg deleted file mode 100644 index 8bb0e289..00000000 --- a/application/resources/multimc/scalable/multimc.svg +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/multimc/scalable/new.svg b/application/resources/multimc/scalable/new.svg deleted file mode 100644 index c9cff358..00000000 --- a/application/resources/multimc/scalable/new.svg +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - New Document - - - - regular - plaintext - text - document - - - - - Source: GNOME Icon Theme, Source: GNOME Icon Theme, Source: GNOME Icon Theme, Source: GNOME Icon Theme, Source: GNOME Icon Theme - - - - - Jakub Steiner - - - - - Jakub Steiner - - - - image/svg+xml - - - en - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/multimc/scalable/news.svg b/application/resources/multimc/scalable/news.svg deleted file mode 100644 index 67a370df..00000000 --- a/application/resources/multimc/scalable/news.svg +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce convallis mauris ullamcorper mauris viverra molestie. Donec ultricies faucibus laoreet. Donec convallis congue neque consequat vehicula. Morbi condimentum tempor nulla et rhoncus. Etiam auctor, augue eu pharetra congue, elit justo lacinia risus, non lacinia est justo sed erat. Ut risus urna, viverra id interdum in, molestie non sem. Morbi leo orci, gravida auctor tempor vel, varius et enim. Nulla sem enim, ultricies vel laoreet ac, semper vel mauris. Ut adipiscing sapien sed leo pretium id vulputate erat gravida. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Cras tempor leo sit amet velit molestie commodo eget tincidunt leo. Cras dictum metus non ante pulvinar pellentesque. Morbi id elit ullamcorper mi vulputate lobortis. Cras ac vehicula felis. Phasellus dictum, tellus at molestie pellentesque, purus purus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce convallis mauris ullamcorper mauris viverra molestie. Donec ultricies faucibus laoreet. Donec convallis congue neque consequat vehicula. Morbi condimentum tempor nulla et rhoncus. Etiam auctor, augue eu pharetra congue, elit justo lacinia risus, non lacinia est justo sed erat. Ut risus urna, - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/multimc/scalable/proxy.svg b/application/resources/multimc/scalable/proxy.svg deleted file mode 100644 index 55ee6f93..00000000 --- a/application/resources/multimc/scalable/proxy.svg +++ /dev/null @@ -1,260 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/multimc/scalable/reddit-alien.svg b/application/resources/multimc/scalable/reddit-alien.svg deleted file mode 100644 index 46061a56..00000000 --- a/application/resources/multimc/scalable/reddit-alien.svg +++ /dev/null @@ -1,189 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/application/resources/multimc/scalable/screenshot-placeholder.svg b/application/resources/multimc/scalable/screenshot-placeholder.svg deleted file mode 100644 index a7a2a3d6..00000000 --- a/application/resources/multimc/scalable/screenshot-placeholder.svg +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - diff --git a/application/resources/multimc/scalable/screenshots.svg b/application/resources/multimc/scalable/screenshots.svg deleted file mode 100644 index a3d4d8e2..00000000 --- a/application/resources/multimc/scalable/screenshots.svg +++ /dev/null @@ -1,1231 +0,0 @@ - - - - - Golden Picture Frame - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - Open Clip Art Library - - - Golden Picture Frame - 2012-05-24T10:08:07 - Golden picture frame, Landscape - http://openclipart.org/detail/170182/golden-picture-frame-by-tasper - - - tasper - - - - - clip art - clipart - frame - golden - landscape - photo - picture - - - - - edited by Paul Sherman - - - - - - - - - - - diff --git a/application/resources/multimc/scalable/status-bad.svg b/application/resources/multimc/scalable/status-bad.svg deleted file mode 100644 index 9f47307e..00000000 --- a/application/resources/multimc/scalable/status-bad.svg +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - diff --git a/application/resources/multimc/scalable/status-good.svg b/application/resources/multimc/scalable/status-good.svg deleted file mode 100644 index 0a35c80f..00000000 --- a/application/resources/multimc/scalable/status-good.svg +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - diff --git a/application/resources/multimc/scalable/status-running.svg b/application/resources/multimc/scalable/status-running.svg deleted file mode 100644 index 18209940..00000000 --- a/application/resources/multimc/scalable/status-running.svg +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - diff --git a/application/resources/multimc/scalable/status-yellow.svg b/application/resources/multimc/scalable/status-yellow.svg deleted file mode 100644 index 140e6082..00000000 --- a/application/resources/multimc/scalable/status-yellow.svg +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/multimc/scalable/technic.svg b/application/resources/multimc/scalable/technic.svg deleted file mode 100644 index 91cbd3d7..00000000 --- a/application/resources/multimc/scalable/technic.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - image/svg+xml - - - - - - - diff --git a/application/resources/multimc/scalable/viewfolder.svg b/application/resources/multimc/scalable/viewfolder.svg deleted file mode 100644 index 4ba0ed0a..00000000 --- a/application/resources/multimc/scalable/viewfolder.svg +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - - - - unsorted - - - - - Open Clip Art Library, Source: Oxygen Icons, Source: Oxygen Icons, Source: Oxygen Icons, Source: Oxygen Icons - - - - - - - - - - - - - - image/svg+xml - - - en - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_blue/index.theme b/application/resources/pe_blue/index.theme deleted file mode 100644 index c9e0d93a..00000000 --- a/application/resources/pe_blue/index.theme +++ /dev/null @@ -1,11 +0,0 @@ -[Icon Theme] -Name=pe_blue -Comment=Icons by pexner (blue) -Inherits=multimc -Directories=scalable - -[scalable] -Size=48 -Type=Scalable -MinSize=16 -MaxSize=256 diff --git a/application/resources/pe_blue/pe_blue.qrc b/application/resources/pe_blue/pe_blue.qrc deleted file mode 100644 index 98445d88..00000000 --- a/application/resources/pe_blue/pe_blue.qrc +++ /dev/null @@ -1,38 +0,0 @@ - - - - index.theme - scalable/about.svg - scalable/accounts.svg - scalable/bug.svg - scalable/centralmods.svg - scalable/checkupdate.svg - scalable/copy.svg - scalable/coremods.svg - scalable/externaltools.svg - scalable/help.svg - scalable/instance-settings.svg - scalable/jarmods.svg - scalable/java.svg - scalable/language.svg - scalable/loadermods.svg - scalable/log.svg - scalable/minecraft.svg - scalable/multimc.svg - scalable/new.svg - scalable/news.svg - scalable/notes.svg - scalable/patreon.svg - scalable/proxy.svg - scalable/quickmods.svg - scalable/refresh.svg - scalable/resourcepacks.svg - scalable/screenshots.svg - scalable/settings.svg - scalable/status-bad.svg - scalable/status-good.svg - scalable/status-yellow.svg - scalable/viewfolder.svg - scalable/worlds.svg - - diff --git a/application/resources/pe_blue/scalable/about.svg b/application/resources/pe_blue/scalable/about.svg deleted file mode 100644 index 56e7fc9b..00000000 --- a/application/resources/pe_blue/scalable/about.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - diff --git a/application/resources/pe_blue/scalable/accounts.svg b/application/resources/pe_blue/scalable/accounts.svg deleted file mode 100644 index 77e3f45a..00000000 --- a/application/resources/pe_blue/scalable/accounts.svg +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_blue/scalable/bug.svg b/application/resources/pe_blue/scalable/bug.svg deleted file mode 100644 index 75a19e29..00000000 --- a/application/resources/pe_blue/scalable/bug.svg +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_blue/scalable/centralmods.svg b/application/resources/pe_blue/scalable/centralmods.svg deleted file mode 100644 index cda39b1f..00000000 --- a/application/resources/pe_blue/scalable/centralmods.svg +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_blue/scalable/checkupdate.svg b/application/resources/pe_blue/scalable/checkupdate.svg deleted file mode 100644 index a7d9ee81..00000000 --- a/application/resources/pe_blue/scalable/checkupdate.svg +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_blue/scalable/copy.svg b/application/resources/pe_blue/scalable/copy.svg deleted file mode 100644 index 7ce014ed..00000000 --- a/application/resources/pe_blue/scalable/copy.svg +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_blue/scalable/coremods.svg b/application/resources/pe_blue/scalable/coremods.svg deleted file mode 100644 index 4cc030d0..00000000 --- a/application/resources/pe_blue/scalable/coremods.svg +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_blue/scalable/externaltools.svg b/application/resources/pe_blue/scalable/externaltools.svg deleted file mode 100644 index 45b73496..00000000 --- a/application/resources/pe_blue/scalable/externaltools.svg +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_blue/scalable/help.svg b/application/resources/pe_blue/scalable/help.svg deleted file mode 100644 index e98540cb..00000000 --- a/application/resources/pe_blue/scalable/help.svg +++ /dev/null @@ -1,40 +0,0 @@ - -image/svg+xml \ No newline at end of file diff --git a/application/resources/pe_blue/scalable/instance-settings.svg b/application/resources/pe_blue/scalable/instance-settings.svg deleted file mode 100644 index 43f0b2f2..00000000 --- a/application/resources/pe_blue/scalable/instance-settings.svg +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_blue/scalable/jarmods.svg b/application/resources/pe_blue/scalable/jarmods.svg deleted file mode 100644 index bb75f4b1..00000000 --- a/application/resources/pe_blue/scalable/jarmods.svg +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - diff --git a/application/resources/pe_blue/scalable/java.svg b/application/resources/pe_blue/scalable/java.svg deleted file mode 100644 index 5e369203..00000000 --- a/application/resources/pe_blue/scalable/java.svg +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_blue/scalable/language.svg b/application/resources/pe_blue/scalable/language.svg deleted file mode 100644 index 92868516..00000000 --- a/application/resources/pe_blue/scalable/language.svg +++ /dev/null @@ -1,46 +0,0 @@ - -image/svg+xml \ No newline at end of file diff --git a/application/resources/pe_blue/scalable/loadermods.svg b/application/resources/pe_blue/scalable/loadermods.svg deleted file mode 100644 index a54dc211..00000000 --- a/application/resources/pe_blue/scalable/loadermods.svg +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_blue/scalable/log.svg b/application/resources/pe_blue/scalable/log.svg deleted file mode 100644 index 89d373f4..00000000 --- a/application/resources/pe_blue/scalable/log.svg +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_blue/scalable/minecraft.svg b/application/resources/pe_blue/scalable/minecraft.svg deleted file mode 100644 index 2fe6a028..00000000 --- a/application/resources/pe_blue/scalable/minecraft.svg +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_blue/scalable/multimc.svg b/application/resources/pe_blue/scalable/multimc.svg deleted file mode 100644 index 820c0b53..00000000 --- a/application/resources/pe_blue/scalable/multimc.svg +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_blue/scalable/new.svg b/application/resources/pe_blue/scalable/new.svg deleted file mode 100644 index dcc8579e..00000000 --- a/application/resources/pe_blue/scalable/new.svg +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_blue/scalable/news.svg b/application/resources/pe_blue/scalable/news.svg deleted file mode 100644 index 3ca3be37..00000000 --- a/application/resources/pe_blue/scalable/news.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/application/resources/pe_blue/scalable/notes.svg b/application/resources/pe_blue/scalable/notes.svg deleted file mode 100644 index d0991259..00000000 --- a/application/resources/pe_blue/scalable/notes.svg +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_blue/scalable/patreon.svg b/application/resources/pe_blue/scalable/patreon.svg deleted file mode 100644 index 644b9b41..00000000 --- a/application/resources/pe_blue/scalable/patreon.svg +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_blue/scalable/proxy.svg b/application/resources/pe_blue/scalable/proxy.svg deleted file mode 100644 index 8266f9b8..00000000 --- a/application/resources/pe_blue/scalable/proxy.svg +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_blue/scalable/quickmods.svg b/application/resources/pe_blue/scalable/quickmods.svg deleted file mode 100644 index 8b577376..00000000 --- a/application/resources/pe_blue/scalable/quickmods.svg +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_blue/scalable/refresh.svg b/application/resources/pe_blue/scalable/refresh.svg deleted file mode 100644 index a3d2281d..00000000 --- a/application/resources/pe_blue/scalable/refresh.svg +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_blue/scalable/resourcepacks.svg b/application/resources/pe_blue/scalable/resourcepacks.svg deleted file mode 100644 index a17e7e82..00000000 --- a/application/resources/pe_blue/scalable/resourcepacks.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - diff --git a/application/resources/pe_blue/scalable/screenshots.svg b/application/resources/pe_blue/scalable/screenshots.svg deleted file mode 100644 index 1aa4e559..00000000 --- a/application/resources/pe_blue/scalable/screenshots.svg +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_blue/scalable/settings.svg b/application/resources/pe_blue/scalable/settings.svg deleted file mode 100644 index 43f0b2f2..00000000 --- a/application/resources/pe_blue/scalable/settings.svg +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_blue/scalable/status-bad.svg b/application/resources/pe_blue/scalable/status-bad.svg deleted file mode 100644 index 4a48b5d8..00000000 --- a/application/resources/pe_blue/scalable/status-bad.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/application/resources/pe_blue/scalable/status-good.svg b/application/resources/pe_blue/scalable/status-good.svg deleted file mode 100644 index 4cfa56f0..00000000 --- a/application/resources/pe_blue/scalable/status-good.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - diff --git a/application/resources/pe_blue/scalable/status-yellow.svg b/application/resources/pe_blue/scalable/status-yellow.svg deleted file mode 100644 index 0551fed2..00000000 --- a/application/resources/pe_blue/scalable/status-yellow.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - diff --git a/application/resources/pe_blue/scalable/viewfolder.svg b/application/resources/pe_blue/scalable/viewfolder.svg deleted file mode 100644 index 2634f8ff..00000000 --- a/application/resources/pe_blue/scalable/viewfolder.svg +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_blue/scalable/worlds.svg b/application/resources/pe_blue/scalable/worlds.svg deleted file mode 100644 index 1670c035..00000000 --- a/application/resources/pe_blue/scalable/worlds.svg +++ /dev/null @@ -1,63 +0,0 @@ - -image/svg+xml \ No newline at end of file diff --git a/application/resources/pe_colored/index.theme b/application/resources/pe_colored/index.theme deleted file mode 100644 index b757bbd7..00000000 --- a/application/resources/pe_colored/index.theme +++ /dev/null @@ -1,11 +0,0 @@ -[Icon Theme] -Name=pe_colored -Comment=Icons by pexner (colored) -Inherits=multimc -Directories=scalable - -[scalable] -Size=48 -Type=Scalable -MinSize=16 -MaxSize=256 diff --git a/application/resources/pe_colored/pe_colored.qrc b/application/resources/pe_colored/pe_colored.qrc deleted file mode 100644 index fbaaf9e4..00000000 --- a/application/resources/pe_colored/pe_colored.qrc +++ /dev/null @@ -1,38 +0,0 @@ - - - - index.theme - scalable/about.svg - scalable/accounts.svg - scalable/bug.svg - scalable/centralmods.svg - scalable/checkupdate.svg - scalable/copy.svg - scalable/coremods.svg - scalable/externaltools.svg - scalable/help.svg - scalable/instance-settings.svg - scalable/jarmods.svg - scalable/java.svg - scalable/language.svg - scalable/loadermods.svg - scalable/log.svg - scalable/minecraft.svg - scalable/multimc.svg - scalable/new.svg - scalable/news.svg - scalable/notes.svg - scalable/patreon.svg - scalable/proxy.svg - scalable/quickmods.svg - scalable/refresh.svg - scalable/resourcepacks.svg - scalable/screenshots.svg - scalable/settings.svg - scalable/status-bad.svg - scalable/status-good.svg - scalable/status-yellow.svg - scalable/viewfolder.svg - scalable/worlds.svg - - diff --git a/application/resources/pe_colored/scalable/about.svg b/application/resources/pe_colored/scalable/about.svg deleted file mode 100644 index 95e99689..00000000 --- a/application/resources/pe_colored/scalable/about.svg +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/application/resources/pe_colored/scalable/accounts.svg b/application/resources/pe_colored/scalable/accounts.svg deleted file mode 100644 index 301eb368..00000000 --- a/application/resources/pe_colored/scalable/accounts.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - diff --git a/application/resources/pe_colored/scalable/bug.svg b/application/resources/pe_colored/scalable/bug.svg deleted file mode 100644 index 8c92df0a..00000000 --- a/application/resources/pe_colored/scalable/bug.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - diff --git a/application/resources/pe_colored/scalable/centralmods.svg b/application/resources/pe_colored/scalable/centralmods.svg deleted file mode 100644 index 57a97259..00000000 --- a/application/resources/pe_colored/scalable/centralmods.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - diff --git a/application/resources/pe_colored/scalable/checkupdate.svg b/application/resources/pe_colored/scalable/checkupdate.svg deleted file mode 100644 index 0adc8eeb..00000000 --- a/application/resources/pe_colored/scalable/checkupdate.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - diff --git a/application/resources/pe_colored/scalable/copy.svg b/application/resources/pe_colored/scalable/copy.svg deleted file mode 100644 index b9b0f1b1..00000000 --- a/application/resources/pe_colored/scalable/copy.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - diff --git a/application/resources/pe_colored/scalable/coremods.svg b/application/resources/pe_colored/scalable/coremods.svg deleted file mode 100644 index ca7a22f0..00000000 --- a/application/resources/pe_colored/scalable/coremods.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - diff --git a/application/resources/pe_colored/scalable/externaltools.svg b/application/resources/pe_colored/scalable/externaltools.svg deleted file mode 100644 index 1469674f..00000000 --- a/application/resources/pe_colored/scalable/externaltools.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - diff --git a/application/resources/pe_colored/scalable/help.svg b/application/resources/pe_colored/scalable/help.svg deleted file mode 100644 index c1ee5258..00000000 --- a/application/resources/pe_colored/scalable/help.svg +++ /dev/null @@ -1,46 +0,0 @@ - -image/svg+xml \ No newline at end of file diff --git a/application/resources/pe_colored/scalable/instance-settings.svg b/application/resources/pe_colored/scalable/instance-settings.svg deleted file mode 100644 index 72032f8a..00000000 --- a/application/resources/pe_colored/scalable/instance-settings.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_colored/scalable/jarmods.svg b/application/resources/pe_colored/scalable/jarmods.svg deleted file mode 100644 index bb75f4b1..00000000 --- a/application/resources/pe_colored/scalable/jarmods.svg +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - diff --git a/application/resources/pe_colored/scalable/java.svg b/application/resources/pe_colored/scalable/java.svg deleted file mode 100644 index 32c0225b..00000000 --- a/application/resources/pe_colored/scalable/java.svg +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_colored/scalable/language.svg b/application/resources/pe_colored/scalable/language.svg deleted file mode 100644 index 80c1dcad..00000000 --- a/application/resources/pe_colored/scalable/language.svg +++ /dev/null @@ -1,44 +0,0 @@ - -image/svg+xml - - - - - - - - \ No newline at end of file diff --git a/application/resources/pe_colored/scalable/loadermods.svg b/application/resources/pe_colored/scalable/loadermods.svg deleted file mode 100644 index 2d80c7f3..00000000 --- a/application/resources/pe_colored/scalable/loadermods.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - diff --git a/application/resources/pe_colored/scalable/log.svg b/application/resources/pe_colored/scalable/log.svg deleted file mode 100644 index 42659b53..00000000 --- a/application/resources/pe_colored/scalable/log.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - diff --git a/application/resources/pe_colored/scalable/minecraft.svg b/application/resources/pe_colored/scalable/minecraft.svg deleted file mode 100644 index 52815487..00000000 --- a/application/resources/pe_colored/scalable/minecraft.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - diff --git a/application/resources/pe_colored/scalable/multimc.svg b/application/resources/pe_colored/scalable/multimc.svg deleted file mode 100644 index a146c52e..00000000 --- a/application/resources/pe_colored/scalable/multimc.svg +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_colored/scalable/new.svg b/application/resources/pe_colored/scalable/new.svg deleted file mode 100644 index f18ed28a..00000000 --- a/application/resources/pe_colored/scalable/new.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - diff --git a/application/resources/pe_colored/scalable/news.svg b/application/resources/pe_colored/scalable/news.svg deleted file mode 100644 index 4f924cd8..00000000 --- a/application/resources/pe_colored/scalable/news.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/application/resources/pe_colored/scalable/notes.svg b/application/resources/pe_colored/scalable/notes.svg deleted file mode 100644 index 55ece163..00000000 --- a/application/resources/pe_colored/scalable/notes.svg +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_colored/scalable/patreon.svg b/application/resources/pe_colored/scalable/patreon.svg deleted file mode 100644 index d3c6d2d5..00000000 --- a/application/resources/pe_colored/scalable/patreon.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - diff --git a/application/resources/pe_colored/scalable/proxy.svg b/application/resources/pe_colored/scalable/proxy.svg deleted file mode 100644 index 0aee69b7..00000000 --- a/application/resources/pe_colored/scalable/proxy.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - diff --git a/application/resources/pe_colored/scalable/quickmods.svg b/application/resources/pe_colored/scalable/quickmods.svg deleted file mode 100644 index 199b2dae..00000000 --- a/application/resources/pe_colored/scalable/quickmods.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - diff --git a/application/resources/pe_colored/scalable/refresh.svg b/application/resources/pe_colored/scalable/refresh.svg deleted file mode 100644 index c2e7e91f..00000000 --- a/application/resources/pe_colored/scalable/refresh.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - diff --git a/application/resources/pe_colored/scalable/resourcepacks.svg b/application/resources/pe_colored/scalable/resourcepacks.svg deleted file mode 100644 index 0318354c..00000000 --- a/application/resources/pe_colored/scalable/resourcepacks.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - diff --git a/application/resources/pe_colored/scalable/screenshots.svg b/application/resources/pe_colored/scalable/screenshots.svg deleted file mode 100644 index 844fcbaa..00000000 --- a/application/resources/pe_colored/scalable/screenshots.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - diff --git a/application/resources/pe_colored/scalable/settings.svg b/application/resources/pe_colored/scalable/settings.svg deleted file mode 100644 index 72032f8a..00000000 --- a/application/resources/pe_colored/scalable/settings.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_colored/scalable/status-bad.svg b/application/resources/pe_colored/scalable/status-bad.svg deleted file mode 100644 index bc42c248..00000000 --- a/application/resources/pe_colored/scalable/status-bad.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/application/resources/pe_colored/scalable/status-good.svg b/application/resources/pe_colored/scalable/status-good.svg deleted file mode 100644 index 4cfa56f0..00000000 --- a/application/resources/pe_colored/scalable/status-good.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - diff --git a/application/resources/pe_colored/scalable/status-yellow.svg b/application/resources/pe_colored/scalable/status-yellow.svg deleted file mode 100644 index 0551fed2..00000000 --- a/application/resources/pe_colored/scalable/status-yellow.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - diff --git a/application/resources/pe_colored/scalable/viewfolder.svg b/application/resources/pe_colored/scalable/viewfolder.svg deleted file mode 100644 index 91832577..00000000 --- a/application/resources/pe_colored/scalable/viewfolder.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - diff --git a/application/resources/pe_colored/scalable/worlds.svg b/application/resources/pe_colored/scalable/worlds.svg deleted file mode 100644 index 087ba7c9..00000000 --- a/application/resources/pe_colored/scalable/worlds.svg +++ /dev/null @@ -1,50 +0,0 @@ - -image/svg+xml \ No newline at end of file diff --git a/application/resources/pe_dark/index.theme b/application/resources/pe_dark/index.theme deleted file mode 100644 index b7d1ad01..00000000 --- a/application/resources/pe_dark/index.theme +++ /dev/null @@ -1,11 +0,0 @@ -[Icon Theme] -Name=pe_dark -Comment=Icons by pexner (dark) -Inherits=multimc -Directories=scalable - -[scalable] -Size=48 -Type=Scalable -MinSize=16 -MaxSize=256 diff --git a/application/resources/pe_dark/pe_dark.qrc b/application/resources/pe_dark/pe_dark.qrc deleted file mode 100644 index a57b6a14..00000000 --- a/application/resources/pe_dark/pe_dark.qrc +++ /dev/null @@ -1,38 +0,0 @@ - - - - index.theme - scalable/about.svg - scalable/accounts.svg - scalable/bug.svg - scalable/centralmods.svg - scalable/checkupdate.svg - scalable/copy.svg - scalable/coremods.svg - scalable/externaltools.svg - scalable/help.svg - scalable/instance-settings.svg - scalable/jarmods.svg - scalable/java.svg - scalable/language.svg - scalable/loadermods.svg - scalable/log.svg - scalable/minecraft.svg - scalable/multimc.svg - scalable/new.svg - scalable/news.svg - scalable/notes.svg - scalable/patreon.svg - scalable/proxy.svg - scalable/quickmods.svg - scalable/refresh.svg - scalable/resourcepacks.svg - scalable/screenshots.svg - scalable/settings.svg - scalable/status-bad.svg - scalable/status-good.svg - scalable/status-yellow.svg - scalable/viewfolder.svg - scalable/worlds.svg - - diff --git a/application/resources/pe_dark/scalable/about.svg b/application/resources/pe_dark/scalable/about.svg deleted file mode 100644 index e75ea6ca..00000000 --- a/application/resources/pe_dark/scalable/about.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - diff --git a/application/resources/pe_dark/scalable/accounts.svg b/application/resources/pe_dark/scalable/accounts.svg deleted file mode 100644 index 6d46b2df..00000000 --- a/application/resources/pe_dark/scalable/accounts.svg +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_dark/scalable/bug.svg b/application/resources/pe_dark/scalable/bug.svg deleted file mode 100644 index 9da71adb..00000000 --- a/application/resources/pe_dark/scalable/bug.svg +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_dark/scalable/centralmods.svg b/application/resources/pe_dark/scalable/centralmods.svg deleted file mode 100644 index f3b0c0e4..00000000 --- a/application/resources/pe_dark/scalable/centralmods.svg +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_dark/scalable/checkupdate.svg b/application/resources/pe_dark/scalable/checkupdate.svg deleted file mode 100644 index 97585447..00000000 --- a/application/resources/pe_dark/scalable/checkupdate.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - diff --git a/application/resources/pe_dark/scalable/copy.svg b/application/resources/pe_dark/scalable/copy.svg deleted file mode 100644 index 8c30ac0b..00000000 --- a/application/resources/pe_dark/scalable/copy.svg +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_dark/scalable/coremods.svg b/application/resources/pe_dark/scalable/coremods.svg deleted file mode 100644 index 1e2eb227..00000000 --- a/application/resources/pe_dark/scalable/coremods.svg +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_dark/scalable/externaltools.svg b/application/resources/pe_dark/scalable/externaltools.svg deleted file mode 100644 index 29b45f26..00000000 --- a/application/resources/pe_dark/scalable/externaltools.svg +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_dark/scalable/help.svg b/application/resources/pe_dark/scalable/help.svg deleted file mode 100644 index 2a1518ae..00000000 --- a/application/resources/pe_dark/scalable/help.svg +++ /dev/null @@ -1,34 +0,0 @@ - -image/svg+xml \ No newline at end of file diff --git a/application/resources/pe_dark/scalable/instance-settings.svg b/application/resources/pe_dark/scalable/instance-settings.svg deleted file mode 100644 index c9f701e7..00000000 --- a/application/resources/pe_dark/scalable/instance-settings.svg +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_dark/scalable/jarmods.svg b/application/resources/pe_dark/scalable/jarmods.svg deleted file mode 100644 index cb9a97ba..00000000 --- a/application/resources/pe_dark/scalable/jarmods.svg +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_dark/scalable/java.svg b/application/resources/pe_dark/scalable/java.svg deleted file mode 100644 index 9e1091fa..00000000 --- a/application/resources/pe_dark/scalable/java.svg +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_dark/scalable/language.svg b/application/resources/pe_dark/scalable/language.svg deleted file mode 100644 index 1a9b4c5c..00000000 --- a/application/resources/pe_dark/scalable/language.svg +++ /dev/null @@ -1,45 +0,0 @@ - -image/svg+xml \ No newline at end of file diff --git a/application/resources/pe_dark/scalable/loadermods.svg b/application/resources/pe_dark/scalable/loadermods.svg deleted file mode 100644 index 24226a09..00000000 --- a/application/resources/pe_dark/scalable/loadermods.svg +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_dark/scalable/log.svg b/application/resources/pe_dark/scalable/log.svg deleted file mode 100644 index 68686a7d..00000000 --- a/application/resources/pe_dark/scalable/log.svg +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_dark/scalable/minecraft.svg b/application/resources/pe_dark/scalable/minecraft.svg deleted file mode 100644 index 01baf575..00000000 --- a/application/resources/pe_dark/scalable/minecraft.svg +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_dark/scalable/multimc.svg b/application/resources/pe_dark/scalable/multimc.svg deleted file mode 100644 index e4cf7b7f..00000000 --- a/application/resources/pe_dark/scalable/multimc.svg +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_dark/scalable/new.svg b/application/resources/pe_dark/scalable/new.svg deleted file mode 100644 index 0377aceb..00000000 --- a/application/resources/pe_dark/scalable/new.svg +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_dark/scalable/news.svg b/application/resources/pe_dark/scalable/news.svg deleted file mode 100644 index 84979dcb..00000000 --- a/application/resources/pe_dark/scalable/news.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/application/resources/pe_dark/scalable/notes.svg b/application/resources/pe_dark/scalable/notes.svg deleted file mode 100644 index 72649721..00000000 --- a/application/resources/pe_dark/scalable/notes.svg +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_dark/scalable/patreon.svg b/application/resources/pe_dark/scalable/patreon.svg deleted file mode 100644 index 01cb279a..00000000 --- a/application/resources/pe_dark/scalable/patreon.svg +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_dark/scalable/proxy.svg b/application/resources/pe_dark/scalable/proxy.svg deleted file mode 100644 index 98bcfac1..00000000 --- a/application/resources/pe_dark/scalable/proxy.svg +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_dark/scalable/quickmods.svg b/application/resources/pe_dark/scalable/quickmods.svg deleted file mode 100644 index 346729f1..00000000 --- a/application/resources/pe_dark/scalable/quickmods.svg +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_dark/scalable/refresh.svg b/application/resources/pe_dark/scalable/refresh.svg deleted file mode 100644 index c227cd6c..00000000 --- a/application/resources/pe_dark/scalable/refresh.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - diff --git a/application/resources/pe_dark/scalable/resourcepacks.svg b/application/resources/pe_dark/scalable/resourcepacks.svg deleted file mode 100644 index 0db2beb1..00000000 --- a/application/resources/pe_dark/scalable/resourcepacks.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - diff --git a/application/resources/pe_dark/scalable/screenshots.svg b/application/resources/pe_dark/scalable/screenshots.svg deleted file mode 100644 index 2803b9aa..00000000 --- a/application/resources/pe_dark/scalable/screenshots.svg +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_dark/scalable/settings.svg b/application/resources/pe_dark/scalable/settings.svg deleted file mode 100644 index c9f701e7..00000000 --- a/application/resources/pe_dark/scalable/settings.svg +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_dark/scalable/status-bad.svg b/application/resources/pe_dark/scalable/status-bad.svg deleted file mode 100644 index f455965a..00000000 --- a/application/resources/pe_dark/scalable/status-bad.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/application/resources/pe_dark/scalable/status-good.svg b/application/resources/pe_dark/scalable/status-good.svg deleted file mode 100644 index 4ba91f2d..00000000 --- a/application/resources/pe_dark/scalable/status-good.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - diff --git a/application/resources/pe_dark/scalable/status-yellow.svg b/application/resources/pe_dark/scalable/status-yellow.svg deleted file mode 100644 index 69133817..00000000 --- a/application/resources/pe_dark/scalable/status-yellow.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - diff --git a/application/resources/pe_dark/scalable/viewfolder.svg b/application/resources/pe_dark/scalable/viewfolder.svg deleted file mode 100644 index 3af36240..00000000 --- a/application/resources/pe_dark/scalable/viewfolder.svg +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_dark/scalable/worlds.svg b/application/resources/pe_dark/scalable/worlds.svg deleted file mode 100644 index 2b01070f..00000000 --- a/application/resources/pe_dark/scalable/worlds.svg +++ /dev/null @@ -1,63 +0,0 @@ - -image/svg+xml \ No newline at end of file diff --git a/application/resources/pe_light/index.theme b/application/resources/pe_light/index.theme deleted file mode 100644 index c106acc8..00000000 --- a/application/resources/pe_light/index.theme +++ /dev/null @@ -1,11 +0,0 @@ -[Icon Theme] -Name=pe_light -Comment=Icons by pexner (light) -Inherits=multimc -Directories=scalable - -[scalable] -Size=48 -Type=Scalable -MinSize=16 -MaxSize=256 diff --git a/application/resources/pe_light/pe_light.qrc b/application/resources/pe_light/pe_light.qrc deleted file mode 100644 index 6d77c835..00000000 --- a/application/resources/pe_light/pe_light.qrc +++ /dev/null @@ -1,39 +0,0 @@ - - - - index.theme - scalable/about.svg - scalable/accounts.svg - scalable/bug.svg - scalable/centralmods.svg - scalable/checkupdate.svg - scalable/copy.svg - scalable/coremods.svg - scalable/externaltools.svg - scalable/help.svg - scalable/instance-settings.svg - scalable/jarmods.svg - scalable/java.svg - scalable/language.svg - scalable/loadermods.svg - scalable/log.svg - scalable/minecraft.svg - scalable/multimc.svg - scalable/new.svg - scalable/news.svg - scalable/notes.svg - scalable/patreon.svg - scalable/proxy.svg - scalable/quickmods.svg - scalable/refresh.svg - scalable/resourcepacks.svg - scalable/screenshots.svg - scalable/settings.svg - scalable/status-bad.svg - scalable/status-good.svg - scalable/status-yellow.svg - scalable/viewfolder.svg - scalable/worlds.svg - - - diff --git a/application/resources/pe_light/scalable/about.svg b/application/resources/pe_light/scalable/about.svg deleted file mode 100644 index 8d00c32e..00000000 --- a/application/resources/pe_light/scalable/about.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - diff --git a/application/resources/pe_light/scalable/accounts.svg b/application/resources/pe_light/scalable/accounts.svg deleted file mode 100644 index 3a092d03..00000000 --- a/application/resources/pe_light/scalable/accounts.svg +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_light/scalable/bug.svg b/application/resources/pe_light/scalable/bug.svg deleted file mode 100644 index ccb64bc5..00000000 --- a/application/resources/pe_light/scalable/bug.svg +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_light/scalable/centralmods.svg b/application/resources/pe_light/scalable/centralmods.svg deleted file mode 100644 index 050fdc58..00000000 --- a/application/resources/pe_light/scalable/centralmods.svg +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_light/scalable/checkupdate.svg b/application/resources/pe_light/scalable/checkupdate.svg deleted file mode 100644 index 08b8dcd5..00000000 --- a/application/resources/pe_light/scalable/checkupdate.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - diff --git a/application/resources/pe_light/scalable/copy.svg b/application/resources/pe_light/scalable/copy.svg deleted file mode 100644 index abdcce09..00000000 --- a/application/resources/pe_light/scalable/copy.svg +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_light/scalable/coremods.svg b/application/resources/pe_light/scalable/coremods.svg deleted file mode 100644 index c8fb0eb9..00000000 --- a/application/resources/pe_light/scalable/coremods.svg +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_light/scalable/externaltools.svg b/application/resources/pe_light/scalable/externaltools.svg deleted file mode 100644 index 4d232bcf..00000000 --- a/application/resources/pe_light/scalable/externaltools.svg +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_light/scalable/help.svg b/application/resources/pe_light/scalable/help.svg deleted file mode 100644 index f820c679..00000000 --- a/application/resources/pe_light/scalable/help.svg +++ /dev/null @@ -1,36 +0,0 @@ - -image/svg+xml \ No newline at end of file diff --git a/application/resources/pe_light/scalable/instance-settings.svg b/application/resources/pe_light/scalable/instance-settings.svg deleted file mode 100644 index 83b92a52..00000000 --- a/application/resources/pe_light/scalable/instance-settings.svg +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_light/scalable/jarmods.svg b/application/resources/pe_light/scalable/jarmods.svg deleted file mode 100644 index 9852c805..00000000 --- a/application/resources/pe_light/scalable/jarmods.svg +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_light/scalable/java.svg b/application/resources/pe_light/scalable/java.svg deleted file mode 100644 index 0584058a..00000000 --- a/application/resources/pe_light/scalable/java.svg +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_light/scalable/language.svg b/application/resources/pe_light/scalable/language.svg deleted file mode 100644 index 57d5e3de..00000000 --- a/application/resources/pe_light/scalable/language.svg +++ /dev/null @@ -1,80 +0,0 @@ - -image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/application/resources/pe_light/scalable/loadermods.svg b/application/resources/pe_light/scalable/loadermods.svg deleted file mode 100644 index 913c1968..00000000 --- a/application/resources/pe_light/scalable/loadermods.svg +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_light/scalable/log.svg b/application/resources/pe_light/scalable/log.svg deleted file mode 100644 index 82282ca4..00000000 --- a/application/resources/pe_light/scalable/log.svg +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_light/scalable/minecraft.svg b/application/resources/pe_light/scalable/minecraft.svg deleted file mode 100644 index d772111f..00000000 --- a/application/resources/pe_light/scalable/minecraft.svg +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_light/scalable/multimc.svg b/application/resources/pe_light/scalable/multimc.svg deleted file mode 100644 index 8b2cb631..00000000 --- a/application/resources/pe_light/scalable/multimc.svg +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_light/scalable/new.svg b/application/resources/pe_light/scalable/new.svg deleted file mode 100644 index 96fd1f5b..00000000 --- a/application/resources/pe_light/scalable/new.svg +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_light/scalable/news.svg b/application/resources/pe_light/scalable/news.svg deleted file mode 100644 index 6f184afc..00000000 --- a/application/resources/pe_light/scalable/news.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - diff --git a/application/resources/pe_light/scalable/notes.svg b/application/resources/pe_light/scalable/notes.svg deleted file mode 100644 index 02dc11ec..00000000 --- a/application/resources/pe_light/scalable/notes.svg +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_light/scalable/patreon.svg b/application/resources/pe_light/scalable/patreon.svg deleted file mode 100644 index 0bd08826..00000000 --- a/application/resources/pe_light/scalable/patreon.svg +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_light/scalable/proxy.svg b/application/resources/pe_light/scalable/proxy.svg deleted file mode 100644 index 9de8d6d1..00000000 --- a/application/resources/pe_light/scalable/proxy.svg +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_light/scalable/quickmods.svg b/application/resources/pe_light/scalable/quickmods.svg deleted file mode 100644 index 6dbeab52..00000000 --- a/application/resources/pe_light/scalable/quickmods.svg +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_light/scalable/refresh.svg b/application/resources/pe_light/scalable/refresh.svg deleted file mode 100644 index 9a724d91..00000000 --- a/application/resources/pe_light/scalable/refresh.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - diff --git a/application/resources/pe_light/scalable/resourcepacks.svg b/application/resources/pe_light/scalable/resourcepacks.svg deleted file mode 100644 index 7d6323f2..00000000 --- a/application/resources/pe_light/scalable/resourcepacks.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - diff --git a/application/resources/pe_light/scalable/screenshots.svg b/application/resources/pe_light/scalable/screenshots.svg deleted file mode 100644 index f2887be6..00000000 --- a/application/resources/pe_light/scalable/screenshots.svg +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_light/scalable/settings.svg b/application/resources/pe_light/scalable/settings.svg deleted file mode 100644 index 83b92a52..00000000 --- a/application/resources/pe_light/scalable/settings.svg +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_light/scalable/status-bad.svg b/application/resources/pe_light/scalable/status-bad.svg deleted file mode 100644 index 2c24970c..00000000 --- a/application/resources/pe_light/scalable/status-bad.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/application/resources/pe_light/scalable/status-good.svg b/application/resources/pe_light/scalable/status-good.svg deleted file mode 100644 index bf9a4174..00000000 --- a/application/resources/pe_light/scalable/status-good.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - diff --git a/application/resources/pe_light/scalable/status-yellow.svg b/application/resources/pe_light/scalable/status-yellow.svg deleted file mode 100644 index f7d2236b..00000000 --- a/application/resources/pe_light/scalable/status-yellow.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - diff --git a/application/resources/pe_light/scalable/viewfolder.svg b/application/resources/pe_light/scalable/viewfolder.svg deleted file mode 100644 index b36343fe..00000000 --- a/application/resources/pe_light/scalable/viewfolder.svg +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/pe_light/scalable/worlds.svg b/application/resources/pe_light/scalable/worlds.svg deleted file mode 100644 index bf4c21a3..00000000 --- a/application/resources/pe_light/scalable/worlds.svg +++ /dev/null @@ -1,64 +0,0 @@ - -image/svg+xml \ No newline at end of file diff --git a/application/resources/sources/clucker.svg b/application/resources/sources/clucker.svg deleted file mode 100644 index 0c1727eb..00000000 --- a/application/resources/sources/clucker.svg +++ /dev/null @@ -1,404 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/sources/creeper.svg b/application/resources/sources/creeper.svg deleted file mode 100644 index 2a2e39b6..00000000 --- a/application/resources/sources/creeper.svg +++ /dev/null @@ -1,775 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/sources/enderpearl.svg b/application/resources/sources/enderpearl.svg deleted file mode 100644 index ac9378f5..00000000 --- a/application/resources/sources/enderpearl.svg +++ /dev/null @@ -1,271 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - diff --git a/application/resources/sources/flame.svg b/application/resources/sources/flame.svg deleted file mode 100644 index 8a6da2f7..00000000 --- a/application/resources/sources/flame.svg +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - diff --git a/application/resources/sources/ftb-glow.svg b/application/resources/sources/ftb-glow.svg deleted file mode 100644 index be78c78e..00000000 --- a/application/resources/sources/ftb-glow.svg +++ /dev/null @@ -1,606 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/sources/ftb-logo.svg b/application/resources/sources/ftb-logo.svg deleted file mode 100644 index 8cf73567..00000000 --- a/application/resources/sources/ftb-logo.svg +++ /dev/null @@ -1,257 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/sources/gear.svg b/application/resources/sources/gear.svg deleted file mode 100644 index c0169aec..00000000 --- a/application/resources/sources/gear.svg +++ /dev/null @@ -1,434 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - diff --git a/application/resources/sources/herobrine.svg b/application/resources/sources/herobrine.svg deleted file mode 100644 index 7392ba36..00000000 --- a/application/resources/sources/herobrine.svg +++ /dev/null @@ -1,583 +0,0 @@ - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/sources/magitech.svg b/application/resources/sources/magitech.svg deleted file mode 100644 index c6dd6bc0..00000000 --- a/application/resources/sources/magitech.svg +++ /dev/null @@ -1,886 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/sources/meat.svg b/application/resources/sources/meat.svg deleted file mode 100644 index 69a20073..00000000 --- a/application/resources/sources/meat.svg +++ /dev/null @@ -1,371 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/sources/multimc-discord.svg b/application/resources/sources/multimc-discord.svg deleted file mode 100644 index c3c73044..00000000 --- a/application/resources/sources/multimc-discord.svg +++ /dev/null @@ -1,265 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/sources/netherstar.svg b/application/resources/sources/netherstar.svg deleted file mode 100644 index 4046e4ec..00000000 --- a/application/resources/sources/netherstar.svg +++ /dev/null @@ -1,342 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/sources/pskeleton.svg b/application/resources/sources/pskeleton.svg deleted file mode 100644 index c2783df8..00000000 --- a/application/resources/sources/pskeleton.svg +++ /dev/null @@ -1,581 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/sources/skeleton.svg b/application/resources/sources/skeleton.svg deleted file mode 100644 index 5d55f272..00000000 --- a/application/resources/sources/skeleton.svg +++ /dev/null @@ -1,610 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/sources/squarecreeper.svg b/application/resources/sources/squarecreeper.svg deleted file mode 100644 index a1b0f4d1..00000000 --- a/application/resources/sources/squarecreeper.svg +++ /dev/null @@ -1,828 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/resources/sources/steve.svg b/application/resources/sources/steve.svg deleted file mode 100644 index 2233272c..00000000 --- a/application/resources/sources/steve.svg +++ /dev/null @@ -1,534 +0,0 @@ - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/application/setupwizard/AnalyticsWizardPage.cpp b/application/setupwizard/AnalyticsWizardPage.cpp deleted file mode 100644 index 4fb0bcca..00000000 --- a/application/setupwizard/AnalyticsWizardPage.cpp +++ /dev/null @@ -1,63 +0,0 @@ -#include "AnalyticsWizardPage.h" -#include - -#include -#include -#include - -#include -#include - -AnalyticsWizardPage::AnalyticsWizardPage(QWidget *parent) - : BaseWizardPage(parent) -{ - setObjectName(QStringLiteral("analyticsPage")); - verticalLayout_3 = new QVBoxLayout(this); - verticalLayout_3->setObjectName(QStringLiteral("verticalLayout_3")); - textBrowser = new QTextBrowser(this); - textBrowser->setObjectName(QStringLiteral("textBrowser")); - textBrowser->setAcceptRichText(false); - textBrowser->setOpenExternalLinks(true); - verticalLayout_3->addWidget(textBrowser); - - checkBox = new QCheckBox(this); - checkBox->setObjectName(QStringLiteral("checkBox")); - checkBox->setChecked(true); - verticalLayout_3->addWidget(checkBox); - retranslate(); -} - -AnalyticsWizardPage::~AnalyticsWizardPage() -{ -} - -bool AnalyticsWizardPage::validatePage() -{ - auto settings = MMC->settings(); - auto analytics = MMC->analytics(); - auto status = checkBox->isChecked(); - settings->set("AnalyticsSeen", analytics->version()); - settings->set("Analytics", status); - return true; -} - -void AnalyticsWizardPage::retranslate() -{ - setTitle(tr("Analytics")); - setSubTitle(tr("We track some anonymous statistics about users.")); - textBrowser->setHtml(tr( - "" - "

MultiMC sends anonymous usage statistics on every start of the application. This helps us decide what platforms and issues to focus on.

" - "

The data is processed by Google Analytics, see their article on the " - "matter.

" - "

The following data is collected:

" - "
  • A random unique ID of the MultiMC installation.
    It is stored in the application settings (multimc.cfg).
  • " - "
  • Anonymized (partial) IP address.
  • " - "
  • MultiMC version.
  • " - "
  • Operating system name, version and architecture.
  • " - "
  • CPU architecture (kernel architecture on linux).
  • " - "
  • Size of system memory.
  • " - "
  • Java version, architecture and memory settings.
" - "

If we change the tracked information, you will see this page again.

")); - checkBox->setText(tr("Enable Analytics")); -} diff --git a/application/setupwizard/AnalyticsWizardPage.h b/application/setupwizard/AnalyticsWizardPage.h deleted file mode 100644 index c451db2c..00000000 --- a/application/setupwizard/AnalyticsWizardPage.h +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once - -#include "BaseWizardPage.h" - -class QVBoxLayout; -class QTextBrowser; -class QCheckBox; - -class AnalyticsWizardPage : public BaseWizardPage -{ - Q_OBJECT -public: - explicit AnalyticsWizardPage(QWidget *parent = Q_NULLPTR); - virtual ~AnalyticsWizardPage(); - - bool validatePage() override; - -protected: - void retranslate() override; - -private: - QVBoxLayout *verticalLayout_3 = nullptr; - QTextBrowser *textBrowser = nullptr; - QCheckBox *checkBox = nullptr; -}; \ No newline at end of file diff --git a/application/setupwizard/BaseWizardPage.h b/application/setupwizard/BaseWizardPage.h deleted file mode 100644 index 72dbecfd..00000000 --- a/application/setupwizard/BaseWizardPage.h +++ /dev/null @@ -1,33 +0,0 @@ -#pragma once - -#include -#include - -class BaseWizardPage : public QWizardPage -{ -public: - explicit BaseWizardPage(QWidget *parent = Q_NULLPTR) - : QWizardPage(parent) - { - } - virtual ~BaseWizardPage() {}; - - virtual bool wantsRefreshButton() - { - return false; - } - virtual void refresh() - { - } - -protected: - virtual void retranslate() = 0; - void changeEvent(QEvent * event) override - { - if (event->type() == QEvent::LanguageChange) - { - retranslate(); - } - QWizardPage::changeEvent(event); - } -}; diff --git a/application/setupwizard/JavaWizardPage.cpp b/application/setupwizard/JavaWizardPage.cpp deleted file mode 100644 index ad571c09..00000000 --- a/application/setupwizard/JavaWizardPage.cpp +++ /dev/null @@ -1,96 +0,0 @@ -#include "JavaWizardPage.h" -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include "widgets/JavaSettingsWidget.h" - - -JavaWizardPage::JavaWizardPage(QWidget *parent) - :BaseWizardPage(parent) -{ - setupUi(); -} - -void JavaWizardPage::setupUi() -{ - setObjectName(QStringLiteral("javaPage")); - QVBoxLayout * layout = new QVBoxLayout(this); - - m_java_widget = new JavaSettingsWidget(this); - layout->addWidget(m_java_widget); - setLayout(layout); - - retranslate(); -} - -void JavaWizardPage::refresh() -{ - m_java_widget->refresh(); -} - -void JavaWizardPage::initializePage() -{ - m_java_widget->initialize(); -} - -bool JavaWizardPage::wantsRefreshButton() -{ - return true; -} - -bool JavaWizardPage::validatePage() -{ - auto settings = MMC->settings(); - auto result = m_java_widget->validate(); - switch(result) - { - default: - case JavaSettingsWidget::ValidationStatus::Bad: - { - return false; - } - case JavaSettingsWidget::ValidationStatus::AllOK: - { - settings->set("JavaPath", m_java_widget->javaPath()); - } - case JavaSettingsWidget::ValidationStatus::JavaBad: - { - // Memory - auto s = MMC->settings(); - s->set("MinMemAlloc", m_java_widget->minHeapSize()); - s->set("MaxMemAlloc", m_java_widget->maxHeapSize()); - if (m_java_widget->permGenEnabled()) - { - s->set("PermGen", m_java_widget->permGenSize()); - } - else - { - s->reset("PermGen"); - } - return true; - } - } -} - -void JavaWizardPage::retranslate() -{ - setTitle(tr("Java")); - setSubTitle(tr("You do not have a working Java set up yet or it went missing.\n" - "Please select one of the following or browse for a java executable.")); - m_java_widget->retranslate(); -} diff --git a/application/setupwizard/JavaWizardPage.h b/application/setupwizard/JavaWizardPage.h deleted file mode 100644 index 0d749039..00000000 --- a/application/setupwizard/JavaWizardPage.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#include "BaseWizardPage.h" - -class JavaSettingsWidget; - -class JavaWizardPage : public BaseWizardPage -{ - Q_OBJECT -public: - explicit JavaWizardPage(QWidget *parent = Q_NULLPTR); - - virtual ~JavaWizardPage() - { - }; - - bool wantsRefreshButton() override; - void refresh() override; - void initializePage() override; - bool validatePage() override; - -protected: /* methods */ - void setupUi(); - void retranslate() override; - -private: /* data */ - JavaSettingsWidget *m_java_widget = nullptr; -}; - diff --git a/application/setupwizard/LanguageWizardPage.cpp b/application/setupwizard/LanguageWizardPage.cpp deleted file mode 100644 index ca93c6f5..00000000 --- a/application/setupwizard/LanguageWizardPage.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include "LanguageWizardPage.h" -#include -#include - -#include "widgets/LanguageSelectionWidget.h" -#include - -LanguageWizardPage::LanguageWizardPage(QWidget *parent) - : BaseWizardPage(parent) -{ - setObjectName(QStringLiteral("languagePage")); - auto layout = new QVBoxLayout(this); - mainWidget = new LanguageSelectionWidget(this); - layout->setContentsMargins(0,0,0,0); - layout->addWidget(mainWidget); - - retranslate(); -} - -LanguageWizardPage::~LanguageWizardPage() -{ -} - -bool LanguageWizardPage::wantsRefreshButton() -{ - return true; -} - -void LanguageWizardPage::refresh() -{ - auto translations = MMC->translations(); - translations->downloadIndex(); -} - -bool LanguageWizardPage::validatePage() -{ - auto settings = MMC->settings(); - QString key = mainWidget->getSelectedLanguageKey(); - settings->set("Language", key); - return true; -} - -void LanguageWizardPage::retranslate() -{ - setTitle(tr("Language")); - setSubTitle(tr("Select the language to use in MultiMC")); - mainWidget->retranslate(); -} diff --git a/application/setupwizard/LanguageWizardPage.h b/application/setupwizard/LanguageWizardPage.h deleted file mode 100644 index 45a0e5c0..00000000 --- a/application/setupwizard/LanguageWizardPage.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include "BaseWizardPage.h" - -class LanguageSelectionWidget; - -class LanguageWizardPage : public BaseWizardPage -{ - Q_OBJECT -public: - explicit LanguageWizardPage(QWidget *parent = Q_NULLPTR); - - virtual ~LanguageWizardPage(); - - bool wantsRefreshButton() override; - - void refresh() override; - - bool validatePage() override; - -protected: - void retranslate() override; - -private: - LanguageSelectionWidget *mainWidget = nullptr; -}; diff --git a/application/setupwizard/SetupWizard.cpp b/application/setupwizard/SetupWizard.cpp deleted file mode 100644 index 60a78b8d..00000000 --- a/application/setupwizard/SetupWizard.cpp +++ /dev/null @@ -1,88 +0,0 @@ -#include "SetupWizard.h" - -#include "LanguageWizardPage.h" -#include "JavaWizardPage.h" -#include "AnalyticsWizardPage.h" - -#include "translations/TranslationsModel.h" -#include -#include -#include - -#include - -SetupWizard::SetupWizard(QWidget *parent) : QWizard(parent) -{ - setObjectName(QStringLiteral("SetupWizard")); - resize(615, 659); - // make it ugly everywhere to avoid variability in theming - setWizardStyle(QWizard::ClassicStyle); - setOptions(QWizard::NoCancelButton | QWizard::IndependentPages | QWizard::HaveCustomButton1); - - retranslate(); - - connect(this, &QWizard::currentIdChanged, this, &SetupWizard::pageChanged); -} - -void SetupWizard::retranslate() -{ - setButtonText(QWizard::NextButton, tr("&Next >")); - setButtonText(QWizard::BackButton, tr("< &Back")); - setButtonText(QWizard::FinishButton, tr("&Finish")); - setButtonText(QWizard::CustomButton1, tr("&Refresh")); - setWindowTitle(tr("MultiMC Quick Setup")); -} - -BaseWizardPage * SetupWizard::getBasePage(int id) -{ - if(id == -1) - return nullptr; - auto pagePtr = page(id); - if(!pagePtr) - return nullptr; - return dynamic_cast(pagePtr); -} - -BaseWizardPage * SetupWizard::getCurrentBasePage() -{ - return getBasePage(currentId()); -} - -void SetupWizard::pageChanged(int id) -{ - auto basePagePtr = getBasePage(id); - if(!basePagePtr) - { - return; - } - if(basePagePtr->wantsRefreshButton()) - { - setButtonLayout({QWizard::CustomButton1, QWizard::Stretch, QWizard::BackButton, QWizard::NextButton, QWizard::FinishButton}); - auto customButton = button(QWizard::CustomButton1); - connect(customButton, &QAbstractButton::pressed, [&](){ - auto basePagePtr = getCurrentBasePage(); - if(basePagePtr) - { - basePagePtr->refresh(); - } - }); - } - else - { - setButtonLayout({QWizard::Stretch, QWizard::BackButton, QWizard::NextButton, QWizard::FinishButton}); - } -} - - -void SetupWizard::changeEvent(QEvent *event) -{ - if (event->type() == QEvent::LanguageChange) - { - retranslate(); - } - QWizard::changeEvent(event); -} - -SetupWizard::~SetupWizard() -{ -} diff --git a/application/setupwizard/SetupWizard.h b/application/setupwizard/SetupWizard.h deleted file mode 100644 index 9b8adb4d..00000000 --- a/application/setupwizard/SetupWizard.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright 2017-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -namespace Ui -{ -class SetupWizard; -} - -class BaseWizardPage; - -class SetupWizard : public QWizard -{ - Q_OBJECT - -public: /* con/destructors */ - explicit SetupWizard(QWidget *parent = 0); - virtual ~SetupWizard(); - - void changeEvent(QEvent * event) override; - BaseWizardPage *getBasePage(int id); - BaseWizardPage *getCurrentBasePage(); - -private slots: - void pageChanged(int id); - -private: /* methods */ - void retranslate(); -}; - diff --git a/application/themes/BrightTheme.cpp b/application/themes/BrightTheme.cpp deleted file mode 100644 index b9188bdd..00000000 --- a/application/themes/BrightTheme.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#include "BrightTheme.h" - -QString BrightTheme::id() -{ - return "bright"; -} - -QString BrightTheme::name() -{ - return QObject::tr("Bright"); -} - -bool BrightTheme::hasColorScheme() -{ - return true; -} - -QPalette BrightTheme::colorScheme() -{ - QPalette brightPalette; - brightPalette.setColor(QPalette::Window, QColor(239,240,241)); - brightPalette.setColor(QPalette::WindowText, QColor(49,54,59)); - brightPalette.setColor(QPalette::Base, QColor(252,252,252)); - brightPalette.setColor(QPalette::AlternateBase, QColor(239,240,241)); - brightPalette.setColor(QPalette::ToolTipBase, QColor(49,54,59)); - brightPalette.setColor(QPalette::ToolTipText, QColor(239,240,241)); - brightPalette.setColor(QPalette::Text, QColor(49,54,59)); - brightPalette.setColor(QPalette::Button, QColor(239,240,241)); - brightPalette.setColor(QPalette::ButtonText, QColor(49,54,59)); - brightPalette.setColor(QPalette::BrightText, Qt::red); - brightPalette.setColor(QPalette::Link, QColor(41, 128, 185)); - brightPalette.setColor(QPalette::Highlight, QColor(61, 174, 233)); - brightPalette.setColor(QPalette::HighlightedText, QColor(239,240,241)); - return fadeInactive(brightPalette, fadeAmount(), fadeColor()); -} - -double BrightTheme::fadeAmount() -{ - return 0.5; -} - -QColor BrightTheme::fadeColor() -{ - return QColor(239,240,241); -} - -bool BrightTheme::hasStyleSheet() -{ - return false; -} - -QString BrightTheme::appStyleSheet() -{ - return QString(); -} - diff --git a/application/themes/BrightTheme.h b/application/themes/BrightTheme.h deleted file mode 100644 index c61f52d5..00000000 --- a/application/themes/BrightTheme.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include "FusionTheme.h" - -class BrightTheme: public FusionTheme -{ -public: - virtual ~BrightTheme() {} - - QString id() override; - QString name() override; - bool hasStyleSheet() override; - QString appStyleSheet() override; - bool hasColorScheme() override; - QPalette colorScheme() override; - double fadeAmount() override; - QColor fadeColor() override; -}; - diff --git a/application/themes/CustomTheme.cpp b/application/themes/CustomTheme.cpp deleted file mode 100644 index 3e3e27de..00000000 --- a/application/themes/CustomTheme.cpp +++ /dev/null @@ -1,244 +0,0 @@ -#include "CustomTheme.h" -#include -#include -#include - -const char * themeFile = "theme.json"; -const char * styleFile = "themeStyle.css"; - -static bool readThemeJson(const QString &path, QPalette &palette, double &fadeAmount, QColor &fadeColor, QString &name, QString &widgets) -{ - QFileInfo pathInfo(path); - if(pathInfo.exists() && pathInfo.isFile()) - { - try - { - auto doc = Json::requireDocument(path, "Theme JSON file"); - const QJsonObject root = doc.object(); - name = Json::requireString(root, "name", "Theme name"); - widgets = Json::requireString(root, "widgets", "Qt widget theme"); - auto colorsRoot = Json::requireObject(root, "colors", "colors object"); - auto readColor = [&](QString colorName) -> QColor - { - auto colorValue = Json::ensureString(colorsRoot, colorName, QString()); - if(!colorValue.isEmpty()) - { - QColor color(colorValue); - if(!color.isValid()) - { - qWarning() << "Color value" << colorValue << "for" << colorName << "was not recognized."; - return QColor(); - } - return color; - } - return QColor(); - }; - auto readAndSetColor = [&](QPalette::ColorRole role, QString colorName) - { - auto color = readColor(colorName); - if(color.isValid()) - { - palette.setColor(role, color); - } - else - { - qDebug() << "Color value for" << colorName << "was not present."; - } - }; - - // palette - readAndSetColor(QPalette::Window, "Window"); - readAndSetColor(QPalette::WindowText, "WindowText"); - readAndSetColor(QPalette::Base, "Base"); - readAndSetColor(QPalette::AlternateBase, "AlternateBase"); - readAndSetColor(QPalette::ToolTipBase, "ToolTipBase"); - readAndSetColor(QPalette::ToolTipText, "ToolTipText"); - readAndSetColor(QPalette::Text, "Text"); - readAndSetColor(QPalette::Button, "Button"); - readAndSetColor(QPalette::ButtonText, "ButtonText"); - readAndSetColor(QPalette::BrightText, "BrightText"); - readAndSetColor(QPalette::Link, "Link"); - readAndSetColor(QPalette::Highlight, "Highlight"); - readAndSetColor(QPalette::HighlightedText, "HighlightedText"); - - //fade - fadeColor = readColor("fadeColor"); - fadeAmount = Json::ensureDouble(colorsRoot, "fadeAmount", 0.5, "fade amount"); - - } - catch (const Exception &e) - { - qWarning() << "Couldn't load theme json: " << e.cause(); - return false; - } - } - else - { - qDebug() << "No theme json present."; - return false; - } - return true; -} - -static bool writeThemeJson(const QString &path, const QPalette &palette, double fadeAmount, QColor fadeColor, QString name, QString widgets) -{ - QJsonObject rootObj; - rootObj.insert("name", name); - rootObj.insert("widgets", widgets); - - QJsonObject colorsObj; - auto insertColor = [&](QPalette::ColorRole role, QString colorName) - { - colorsObj.insert(colorName, palette.color(role).name()); - }; - - // palette - insertColor(QPalette::Window, "Window"); - insertColor(QPalette::WindowText, "WindowText"); - insertColor(QPalette::Base, "Base"); - insertColor(QPalette::AlternateBase, "AlternateBase"); - insertColor(QPalette::ToolTipBase, "ToolTipBase"); - insertColor(QPalette::ToolTipText, "ToolTipText"); - insertColor(QPalette::Text, "Text"); - insertColor(QPalette::Button, "Button"); - insertColor(QPalette::ButtonText, "ButtonText"); - insertColor(QPalette::BrightText, "BrightText"); - insertColor(QPalette::Link, "Link"); - insertColor(QPalette::Highlight, "Highlight"); - insertColor(QPalette::HighlightedText, "HighlightedText"); - - // fade - colorsObj.insert("fadeColor", fadeColor.name()); - colorsObj.insert("fadeAmount", fadeAmount); - - rootObj.insert("colors", colorsObj); - try - { - Json::write(rootObj, path); - return true; - } - catch (const Exception &e) - { - qWarning() << "Failed to write theme json to" << path; - return false; - } -} - -CustomTheme::CustomTheme(ITheme* baseTheme, QString folder) -{ - m_id = folder; - QString path = FS::PathCombine("themes", m_id); - QString pathResources = FS::PathCombine("themes", m_id, "resources"); - - qDebug() << "Loading theme" << m_id; - - if(!FS::ensureFolderPathExists(path) || !FS::ensureFolderPathExists(pathResources)) - { - qWarning() << "couldn't create folder for theme!"; - m_palette = baseTheme->colorScheme(); - m_styleSheet = baseTheme->appStyleSheet(); - return; - } - - auto themeFilePath = FS::PathCombine(path, themeFile); - - m_palette = baseTheme->colorScheme(); - if (!readThemeJson(themeFilePath, m_palette, m_fadeAmount, m_fadeColor, m_name, m_widgets)) - { - m_name = "Custom"; - m_palette = baseTheme->colorScheme(); - m_fadeColor = baseTheme->fadeColor(); - m_fadeAmount = baseTheme->fadeAmount(); - m_widgets = baseTheme->qtTheme(); - - QFileInfo info(themeFilePath); - if(!info.exists()) - { - writeThemeJson(themeFilePath, m_palette, m_fadeAmount, m_fadeColor, "Custom", m_widgets); - } - } - else - { - m_palette = fadeInactive(m_palette, m_fadeAmount, m_fadeColor); - } - - auto cssFilePath = FS::PathCombine(path, styleFile); - QFileInfo info (cssFilePath); - if(info.isFile()) - { - try - { - // TODO: validate css? - m_styleSheet = QString::fromUtf8(FS::read(cssFilePath)); - } - catch (const Exception &e) - { - qWarning() << "Couldn't load css:" << e.cause() << "from" << cssFilePath; - m_styleSheet = baseTheme->appStyleSheet(); - } - } - else - { - qDebug() << "No theme css present."; - m_styleSheet = baseTheme->appStyleSheet(); - try - { - FS::write(cssFilePath, m_styleSheet.toUtf8()); - } - catch (const Exception &e) - { - qWarning() << "Couldn't write css:" << e.cause() << "to" << cssFilePath; - } - } -} - -QStringList CustomTheme::searchPaths() -{ - return { FS::PathCombine("themes", m_id, "resources") }; -} - - -QString CustomTheme::id() -{ - return m_id; -} - -QString CustomTheme::name() -{ - return m_name; -} - -bool CustomTheme::hasColorScheme() -{ - return true; -} - -QPalette CustomTheme::colorScheme() -{ - return m_palette; -} - -bool CustomTheme::hasStyleSheet() -{ - return true; -} - -QString CustomTheme::appStyleSheet() -{ - return m_styleSheet; -} - -double CustomTheme::fadeAmount() -{ - return m_fadeAmount; -} - -QColor CustomTheme::fadeColor() -{ - return m_fadeColor; -} - -QString CustomTheme::qtTheme() -{ - return m_widgets; -} diff --git a/application/themes/CustomTheme.h b/application/themes/CustomTheme.h deleted file mode 100644 index d216895d..00000000 --- a/application/themes/CustomTheme.h +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once - -#include "ITheme.h" - -class CustomTheme: public ITheme -{ -public: - CustomTheme(ITheme * baseTheme, QString folder); - virtual ~CustomTheme() {} - - QString id() override; - QString name() override; - bool hasStyleSheet() override; - QString appStyleSheet() override; - bool hasColorScheme() override; - QPalette colorScheme() override; - double fadeAmount() override; - QColor fadeColor() override; - QString qtTheme() override; - QStringList searchPaths() override; - -private: /* data */ - QPalette m_palette; - QColor m_fadeColor; - double m_fadeAmount; - QString m_styleSheet; - QString m_name; - QString m_id; - QString m_widgets; -}; - diff --git a/application/themes/DarkTheme.cpp b/application/themes/DarkTheme.cpp deleted file mode 100644 index 31ecd559..00000000 --- a/application/themes/DarkTheme.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include "DarkTheme.h" - -QString DarkTheme::id() -{ - return "dark"; -} - -QString DarkTheme::name() -{ - return QObject::tr("Dark"); -} - -bool DarkTheme::hasColorScheme() -{ - return true; -} - -QPalette DarkTheme::colorScheme() -{ - QPalette darkPalette; - darkPalette.setColor(QPalette::Window, QColor(49,54,59)); - darkPalette.setColor(QPalette::WindowText, Qt::white); - darkPalette.setColor(QPalette::Base, QColor(35,38,41)); - darkPalette.setColor(QPalette::AlternateBase, QColor(49,54,59)); - darkPalette.setColor(QPalette::ToolTipBase, Qt::white); - darkPalette.setColor(QPalette::ToolTipText, Qt::white); - darkPalette.setColor(QPalette::Text, Qt::white); - darkPalette.setColor(QPalette::Button, QColor(49,54,59)); - darkPalette.setColor(QPalette::ButtonText, Qt::white); - darkPalette.setColor(QPalette::BrightText, Qt::red); - darkPalette.setColor(QPalette::Link, QColor(42, 130, 218)); - darkPalette.setColor(QPalette::Highlight, QColor(42, 130, 218)); - darkPalette.setColor(QPalette::HighlightedText, Qt::black); - return fadeInactive(darkPalette, fadeAmount(), fadeColor()); -} - -double DarkTheme::fadeAmount() -{ - return 0.5; -} - -QColor DarkTheme::fadeColor() -{ - return QColor(49,54,59); -} - -bool DarkTheme::hasStyleSheet() -{ - return true; -} - -QString DarkTheme::appStyleSheet() -{ - return "QToolTip { color: #ffffff; background-color: #2a82da; border: 1px solid white; }"; -} diff --git a/application/themes/DarkTheme.h b/application/themes/DarkTheme.h deleted file mode 100644 index 9bd2f343..00000000 --- a/application/themes/DarkTheme.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "FusionTheme.h" - -class DarkTheme: public FusionTheme -{ -public: - virtual ~DarkTheme() {} - - QString id() override; - QString name() override; - bool hasStyleSheet() override; - QString appStyleSheet() override; - bool hasColorScheme() override; - QPalette colorScheme() override; - double fadeAmount() override; - QColor fadeColor() override; -}; diff --git a/application/themes/FusionTheme.cpp b/application/themes/FusionTheme.cpp deleted file mode 100644 index cf3286ba..00000000 --- a/application/themes/FusionTheme.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "FusionTheme.h" - -QString FusionTheme::qtTheme() -{ - return "Fusion"; -} diff --git a/application/themes/FusionTheme.h b/application/themes/FusionTheme.h deleted file mode 100644 index ee34245a..00000000 --- a/application/themes/FusionTheme.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once - -#include "ITheme.h" - -class FusionTheme: public ITheme -{ -public: - virtual ~FusionTheme() {} - - QString qtTheme() override; -}; diff --git a/application/themes/ITheme.cpp b/application/themes/ITheme.cpp deleted file mode 100644 index bfec87e7..00000000 --- a/application/themes/ITheme.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include "ITheme.h" -#include "rainbow.h" -#include -#include -#include "MultiMC.h" - -void ITheme::apply(bool) -{ - QApplication::setStyle(QStyleFactory::create(qtTheme())); - if(hasColorScheme()) - { - QApplication::setPalette(colorScheme()); - } - if(hasStyleSheet()) - { - MMC->setStyleSheet(appStyleSheet()); - } - else - { - MMC->setStyleSheet(QString()); - } - QDir::setSearchPaths("theme", searchPaths()); -} - -QPalette ITheme::fadeInactive(QPalette in, qreal bias, QColor color) -{ - auto blend = [&in, bias, color](QPalette::ColorRole role) - { - QColor from = in.color(QPalette::Active, role); - QColor blended = Rainbow::mix(from, color, bias); - in.setColor(QPalette::Disabled, role, blended); - }; - blend(QPalette::Window); - blend(QPalette::WindowText); - blend(QPalette::Base); - blend(QPalette::AlternateBase); - blend(QPalette::ToolTipBase); - blend(QPalette::ToolTipText); - blend(QPalette::Text); - blend(QPalette::Button); - blend(QPalette::ButtonText); - blend(QPalette::BrightText); - blend(QPalette::Link); - blend(QPalette::Highlight); - blend(QPalette::HighlightedText); - return in; -} diff --git a/application/themes/ITheme.h b/application/themes/ITheme.h deleted file mode 100644 index c2347cf6..00000000 --- a/application/themes/ITheme.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once -#include -#include - -class QStyle; - -class ITheme -{ -public: - virtual ~ITheme() {} - virtual void apply(bool initial); - virtual QString id() = 0; - virtual QString name() = 0; - virtual bool hasStyleSheet() = 0; - virtual QString appStyleSheet() = 0; - virtual QString qtTheme() = 0; - virtual bool hasColorScheme() = 0; - virtual QPalette colorScheme() = 0; - virtual QColor fadeColor() = 0; - virtual double fadeAmount() = 0; - virtual QStringList searchPaths() - { - return {}; - } - - static QPalette fadeInactive(QPalette in, qreal bias, QColor color); -}; diff --git a/application/themes/SystemTheme.cpp b/application/themes/SystemTheme.cpp deleted file mode 100644 index 49b1afaa..00000000 --- a/application/themes/SystemTheme.cpp +++ /dev/null @@ -1,83 +0,0 @@ -#include "SystemTheme.h" -#include -#include -#include -#include - -SystemTheme::SystemTheme() -{ - qDebug() << "Determining System Theme..."; - const auto & style = QApplication::style(); - systemPalette = style->standardPalette(); - QString lowerThemeName = style->objectName(); - qDebug() << "System theme seems to be:" << lowerThemeName; - QStringList styles = QStyleFactory::keys(); - for(auto &st: styles) - { - qDebug() << "Considering theme from theme factory:" << st.toLower(); - if(st.toLower() == lowerThemeName) - { - systemTheme = st; - qDebug() << "System theme has been determined to be:" << systemTheme; - return; - } - } - // fall back to fusion if we can't find the current theme. - systemTheme = "Fusion"; - qDebug() << "System theme not found, defaulted to Fusion"; -} - -void SystemTheme::apply(bool initial) -{ - // if we are applying the system theme as the first theme, just don't touch anything. it's for the better... - if(initial) - { - return; - } - ITheme::apply(initial); -} - -QString SystemTheme::id() -{ - return "system"; -} - -QString SystemTheme::name() -{ - return QObject::tr("System"); -} - -QString SystemTheme::qtTheme() -{ - return systemTheme; -} - -QPalette SystemTheme::colorScheme() -{ - return systemPalette; -} - -QString SystemTheme::appStyleSheet() -{ - return QString(); -} - -double SystemTheme::fadeAmount() -{ - return 0.5; -} - -QColor SystemTheme::fadeColor() -{ - return QColor(128,128,128); -} - -bool SystemTheme::hasStyleSheet() -{ - return false; -} - -bool SystemTheme::hasColorScheme() -{ - return true; -} diff --git a/application/themes/SystemTheme.h b/application/themes/SystemTheme.h deleted file mode 100644 index fe450600..00000000 --- a/application/themes/SystemTheme.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include "ITheme.h" - -class SystemTheme: public ITheme -{ -public: - SystemTheme(); - virtual ~SystemTheme() {} - void apply(bool initial) override; - - QString id() override; - QString name() override; - QString qtTheme() override; - bool hasStyleSheet() override; - QString appStyleSheet() override; - bool hasColorScheme() override; - QPalette colorScheme() override; - double fadeAmount() override; - QColor fadeColor() override; -private: - QPalette systemPalette; - QString systemTheme; -}; diff --git a/application/widgets/Common.cpp b/application/widgets/Common.cpp deleted file mode 100644 index f72f3596..00000000 --- a/application/widgets/Common.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "Common.h" - -// Origin: Qt -QStringList viewItemTextLayout(QTextLayout &textLayout, int lineWidth, qreal &height, - qreal &widthUsed) -{ - QStringList lines; - height = 0; - widthUsed = 0; - textLayout.beginLayout(); - QString str = textLayout.text(); - while (true) - { - QTextLine line = textLayout.createLine(); - if (!line.isValid()) - break; - if (line.textLength() == 0) - break; - line.setLineWidth(lineWidth); - line.setPosition(QPointF(0, height)); - height += line.height(); - lines.append(str.mid(line.textStart(), line.textLength())); - widthUsed = qMax(widthUsed, line.naturalTextWidth()); - } - textLayout.endLayout(); - return lines; -} diff --git a/application/widgets/Common.h b/application/widgets/Common.h deleted file mode 100644 index b3fbe1a0..00000000 --- a/application/widgets/Common.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once -#include -#include - -QStringList viewItemTextLayout(QTextLayout &textLayout, int lineWidth, qreal &height, - qreal &widthUsed); \ No newline at end of file diff --git a/application/widgets/CustomCommands.cpp b/application/widgets/CustomCommands.cpp deleted file mode 100644 index 24bdc07d..00000000 --- a/application/widgets/CustomCommands.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include "CustomCommands.h" -#include "ui_CustomCommands.h" - -CustomCommands::~CustomCommands() -{ - delete ui; -} - -CustomCommands::CustomCommands(QWidget* parent): - QWidget(parent), - ui(new Ui::CustomCommands) -{ - ui->setupUi(this); -} - -void CustomCommands::initialize(bool checkable, bool checked, const QString& prelaunch, const QString& wrapper, const QString& postexit) -{ - ui->customCommandsGroupBox->setCheckable(checkable); - if(checkable) - { - ui->customCommandsGroupBox->setChecked(checked); - } - ui->preLaunchCmdTextBox->setText(prelaunch); - ui->wrapperCmdTextBox->setText(wrapper); - ui->postExitCmdTextBox->setText(postexit); -} - - -bool CustomCommands::checked() const -{ - if(!ui->customCommandsGroupBox->isCheckable()) - return true; - return ui->customCommandsGroupBox->isChecked(); -} - -QString CustomCommands::prelaunchCommand() const -{ - return ui->preLaunchCmdTextBox->text(); -} - -QString CustomCommands::wrapperCommand() const -{ - return ui->wrapperCmdTextBox->text(); -} - -QString CustomCommands::postexitCommand() const -{ - return ui->postExitCmdTextBox->text(); -} diff --git a/application/widgets/CustomCommands.h b/application/widgets/CustomCommands.h deleted file mode 100644 index 8db991fa..00000000 --- a/application/widgets/CustomCommands.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright 2018-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -namespace Ui -{ -class CustomCommands; -} - -class CustomCommands : public QWidget -{ - Q_OBJECT - -public: - explicit CustomCommands(QWidget *parent = 0); - virtual ~CustomCommands(); - void initialize(bool checkable, bool checked, const QString & prelaunch, const QString & wrapper, const QString & postexit); - - bool checked() const; - QString prelaunchCommand() const; - QString wrapperCommand() const; - QString postexitCommand() const; - -private: - Ui::CustomCommands *ui; -}; - - diff --git a/application/widgets/CustomCommands.ui b/application/widgets/CustomCommands.ui deleted file mode 100644 index 25b2681b..00000000 --- a/application/widgets/CustomCommands.ui +++ /dev/null @@ -1,107 +0,0 @@ - - - CustomCommands - - - - 0 - 0 - 518 - 646 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - true - - - Cus&tom Commands - - - true - - - false - - - - - - Post-exit command: - - - - - - - - - - Pre-launch command: - - - - - - - - - - Wrapper command: - - - - - - - - - - - - - <html><head/><body><p>Pre-launch command runs before the instance launches and post-exit command runs after it exits.</p><p>Both will be run in MultiMC's working folder with extra environment variables:</p><ul><li>$INST_NAME - Name of the instance</li><li>$INST_ID - ID of the instance (its folder name)</li><li>$INST_DIR - absolute path of the instance</li><li>$INST_MC_DIR - absolute path of minecraft</li><li>$INST_JAVA - java binary used for launch</li><li>$INST_JAVA_ARGS - command-line parameters used for launch</li></ul><p>Wrapper command allows launching using an extra wrapper program (like 'optirun' on Linux)</p></body></html> - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - diff --git a/application/widgets/DropLabel.cpp b/application/widgets/DropLabel.cpp deleted file mode 100644 index a900e57c..00000000 --- a/application/widgets/DropLabel.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "DropLabel.h" - -#include -#include - -DropLabel::DropLabel(QWidget *parent) : QLabel(parent) -{ - setAcceptDrops(true); -} - -void DropLabel::dragEnterEvent(QDragEnterEvent *event) -{ - event->acceptProposedAction(); -} - -void DropLabel::dragMoveEvent(QDragMoveEvent *event) -{ - event->acceptProposedAction(); -} - -void DropLabel::dragLeaveEvent(QDragLeaveEvent *event) -{ - event->accept(); -} - -void DropLabel::dropEvent(QDropEvent *event) -{ - const QMimeData *mimeData = event->mimeData(); - - if (!mimeData) - { - return; - } - - if (mimeData->hasUrls()) { - auto urls = mimeData->urls(); - emit droppedURLs(urls); - } - - event->acceptProposedAction(); -} diff --git a/application/widgets/DropLabel.h b/application/widgets/DropLabel.h deleted file mode 100644 index c5ca0bcc..00000000 --- a/application/widgets/DropLabel.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include - -class DropLabel : public QLabel -{ - Q_OBJECT - -public: - explicit DropLabel(QWidget *parent = nullptr); - -signals: - void droppedURLs(QList urls); - -protected: - void dropEvent(QDropEvent *event) override; - void dragEnterEvent(QDragEnterEvent *event) override; - void dragMoveEvent(QDragMoveEvent *event) override; - void dragLeaveEvent(QDragLeaveEvent *event) override; -}; diff --git a/application/widgets/FocusLineEdit.cpp b/application/widgets/FocusLineEdit.cpp deleted file mode 100644 index b272100c..00000000 --- a/application/widgets/FocusLineEdit.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "FocusLineEdit.h" -#include - -FocusLineEdit::FocusLineEdit(QWidget *parent) : QLineEdit(parent) -{ - _selectOnMousePress = false; -} - -void FocusLineEdit::focusInEvent(QFocusEvent *e) -{ - QLineEdit::focusInEvent(e); - selectAll(); - _selectOnMousePress = true; -} - -void FocusLineEdit::mousePressEvent(QMouseEvent *me) -{ - QLineEdit::mousePressEvent(me); - if (_selectOnMousePress) - { - selectAll(); - _selectOnMousePress = false; - } - qDebug() << selectedText(); -} diff --git a/application/widgets/FocusLineEdit.h b/application/widgets/FocusLineEdit.h deleted file mode 100644 index 71b4f140..00000000 --- a/application/widgets/FocusLineEdit.h +++ /dev/null @@ -1,17 +0,0 @@ -#include - -class FocusLineEdit : public QLineEdit -{ - Q_OBJECT -public: - FocusLineEdit(QWidget *parent); - virtual ~FocusLineEdit() - { - } - -protected: - void focusInEvent(QFocusEvent *e); - void mousePressEvent(QMouseEvent *me); - - bool _selectOnMousePress; -}; diff --git a/application/widgets/IconLabel.cpp b/application/widgets/IconLabel.cpp deleted file mode 100644 index bf1c2358..00000000 --- a/application/widgets/IconLabel.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include "IconLabel.h" - -#include -#include -#include -#include -#include - -IconLabel::IconLabel(QWidget *parent, QIcon icon, QSize size) - : QWidget(parent), m_size(size), m_icon(icon) -{ - setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); -} - -QSize IconLabel::sizeHint() const -{ - return m_size; -} - -void IconLabel::setIcon(QIcon icon) -{ - m_icon = icon; - update(); -} - -void IconLabel::paintEvent(QPaintEvent *) -{ - QPainter p(this); - QRect rect = contentsRect(); - int width = rect.width(); - int height = rect.height(); - if(width < height) - { - rect.setHeight(width); - rect.translate(0, (height - width) / 2); - } - else if (width > height) - { - rect.setWidth(height); - rect.translate((width - height) / 2, 0); - } - m_icon.paint(&p, rect); -} diff --git a/application/widgets/IconLabel.h b/application/widgets/IconLabel.h deleted file mode 100644 index 6d212c4c..00000000 --- a/application/widgets/IconLabel.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once -#include -#include - -class QStyleOption; - -/** - * This is a trivial widget that paints a QIcon of the specified size. - */ -class IconLabel : public QWidget -{ - Q_OBJECT - -public: - /// Create a line separator. orientation is the orientation of the line. - explicit IconLabel(QWidget *parent, QIcon icon, QSize size); - - virtual QSize sizeHint() const; - virtual void paintEvent(QPaintEvent *); - - void setIcon(QIcon icon); - -private: - QSize m_size; - QIcon m_icon; -}; diff --git a/application/widgets/InstanceCardWidget.ui b/application/widgets/InstanceCardWidget.ui deleted file mode 100644 index 6eeeb076..00000000 --- a/application/widgets/InstanceCardWidget.ui +++ /dev/null @@ -1,58 +0,0 @@ - - - InstanceCardWidget - - - - 0 - 0 - 473 - 118 - - - - - - - - 80 - 80 - - - - - - - - &Name: - - - instNameTextBox - - - - - - - - - - &Group: - - - groupBox - - - - - - - true - - - - - - - - diff --git a/application/widgets/JavaSettingsWidget.cpp b/application/widgets/JavaSettingsWidget.cpp deleted file mode 100644 index 7f53dc23..00000000 --- a/application/widgets/JavaSettingsWidget.cpp +++ /dev/null @@ -1,428 +0,0 @@ -#include "JavaSettingsWidget.h" -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -JavaSettingsWidget::JavaSettingsWidget(QWidget* parent) : QWidget(parent) -{ - m_availableMemory = Sys::getSystemRam() / Sys::mebibyte; - - goodIcon = MMC->getThemedIcon("status-good"); - yellowIcon = MMC->getThemedIcon("status-yellow"); - badIcon = MMC->getThemedIcon("status-bad"); - setupUi(); - - connect(m_minMemSpinBox, SIGNAL(valueChanged(int)), this, SLOT(memoryValueChanged(int))); - connect(m_maxMemSpinBox, SIGNAL(valueChanged(int)), this, SLOT(memoryValueChanged(int))); - connect(m_permGenSpinBox, SIGNAL(valueChanged(int)), this, SLOT(memoryValueChanged(int))); - connect(m_versionWidget, &VersionSelectWidget::selectedVersionChanged, this, &JavaSettingsWidget::javaVersionSelected); - connect(m_javaBrowseBtn, &QPushButton::clicked, this, &JavaSettingsWidget::on_javaBrowseBtn_clicked); - connect(m_javaPathTextBox, &QLineEdit::textEdited, this, &JavaSettingsWidget::javaPathEdited); - connect(m_javaStatusBtn, &QToolButton::clicked, this, &JavaSettingsWidget::on_javaStatusBtn_clicked); -} - -void JavaSettingsWidget::setupUi() -{ - setObjectName(QStringLiteral("javaSettingsWidget")); - m_verticalLayout = new QVBoxLayout(this); - m_verticalLayout->setObjectName(QStringLiteral("verticalLayout")); - - m_versionWidget = new VersionSelectWidget(this); - m_verticalLayout->addWidget(m_versionWidget); - - m_horizontalLayout = new QHBoxLayout(); - m_horizontalLayout->setObjectName(QStringLiteral("horizontalLayout")); - m_javaPathTextBox = new QLineEdit(this); - m_javaPathTextBox->setObjectName(QStringLiteral("javaPathTextBox")); - - m_horizontalLayout->addWidget(m_javaPathTextBox); - - m_javaBrowseBtn = new QPushButton(this); - m_javaBrowseBtn->setObjectName(QStringLiteral("javaBrowseBtn")); - - m_horizontalLayout->addWidget(m_javaBrowseBtn); - - m_javaStatusBtn = new QToolButton(this); - m_javaStatusBtn->setIcon(yellowIcon); - m_horizontalLayout->addWidget(m_javaStatusBtn); - - m_verticalLayout->addLayout(m_horizontalLayout); - - m_memoryGroupBox = new QGroupBox(this); - m_memoryGroupBox->setObjectName(QStringLiteral("memoryGroupBox")); - m_gridLayout_2 = new QGridLayout(m_memoryGroupBox); - m_gridLayout_2->setObjectName(QStringLiteral("gridLayout_2")); - - m_labelMinMem = new QLabel(m_memoryGroupBox); - m_labelMinMem->setObjectName(QStringLiteral("labelMinMem")); - m_gridLayout_2->addWidget(m_labelMinMem, 0, 0, 1, 1); - - m_minMemSpinBox = new QSpinBox(m_memoryGroupBox); - m_minMemSpinBox->setObjectName(QStringLiteral("minMemSpinBox")); - m_minMemSpinBox->setSuffix(QStringLiteral(" MB")); - m_minMemSpinBox->setMinimum(128); - m_minMemSpinBox->setMaximum(m_availableMemory); - m_minMemSpinBox->setSingleStep(128); - m_labelMinMem->setBuddy(m_minMemSpinBox); - m_gridLayout_2->addWidget(m_minMemSpinBox, 0, 1, 1, 1); - - m_labelMaxMem = new QLabel(m_memoryGroupBox); - m_labelMaxMem->setObjectName(QStringLiteral("labelMaxMem")); - m_gridLayout_2->addWidget(m_labelMaxMem, 1, 0, 1, 1); - - m_maxMemSpinBox = new QSpinBox(m_memoryGroupBox); - m_maxMemSpinBox->setObjectName(QStringLiteral("maxMemSpinBox")); - m_maxMemSpinBox->setSuffix(QStringLiteral(" MB")); - m_maxMemSpinBox->setMinimum(128); - m_maxMemSpinBox->setMaximum(m_availableMemory); - m_maxMemSpinBox->setSingleStep(128); - m_labelMaxMem->setBuddy(m_maxMemSpinBox); - m_gridLayout_2->addWidget(m_maxMemSpinBox, 1, 1, 1, 1); - - m_labelPermGen = new QLabel(m_memoryGroupBox); - m_labelPermGen->setObjectName(QStringLiteral("labelPermGen")); - m_labelPermGen->setText(QStringLiteral("PermGen:")); - m_gridLayout_2->addWidget(m_labelPermGen, 2, 0, 1, 1); - m_labelPermGen->setVisible(false); - - m_permGenSpinBox = new QSpinBox(m_memoryGroupBox); - m_permGenSpinBox->setObjectName(QStringLiteral("permGenSpinBox")); - m_permGenSpinBox->setSuffix(QStringLiteral(" MB")); - m_permGenSpinBox->setMinimum(64); - m_permGenSpinBox->setMaximum(m_availableMemory); - m_permGenSpinBox->setSingleStep(8); - m_gridLayout_2->addWidget(m_permGenSpinBox, 2, 1, 1, 1); - m_permGenSpinBox->setVisible(false); - - m_verticalLayout->addWidget(m_memoryGroupBox); - - retranslate(); -} - -void JavaSettingsWidget::initialize() -{ - m_versionWidget->initialize(MMC->javalist().get()); - m_versionWidget->setResizeOn(2); - auto s = MMC->settings(); - // Memory - observedMinMemory = s->get("MinMemAlloc").toInt(); - observedMaxMemory = s->get("MaxMemAlloc").toInt(); - observedPermGenMemory = s->get("PermGen").toInt(); - m_minMemSpinBox->setValue(observedMinMemory); - m_maxMemSpinBox->setValue(observedMaxMemory); - m_permGenSpinBox->setValue(observedPermGenMemory); -} - -void JavaSettingsWidget::refresh() -{ - m_versionWidget->loadList(); -} - -JavaSettingsWidget::ValidationStatus JavaSettingsWidget::validate() -{ - switch(javaStatus) - { - default: - case JavaStatus::NotSet: - case JavaStatus::DoesNotExist: - case JavaStatus::DoesNotStart: - case JavaStatus::ReturnedInvalidData: - { - int button = CustomMessageBox::selectable( - this, - tr("No Java version selected"), - tr("You didn't select a Java version or selected something that doesn't work.\n" - "MultiMC will not be able to start Minecraft.\n" - "Do you wish to proceed without any Java?" - "\n\n" - "You can change the Java version in the settings later.\n" - ), - QMessageBox::Warning, - QMessageBox::Yes | QMessageBox::No, - QMessageBox::NoButton - )->exec(); - if(button == QMessageBox::No) - { - return ValidationStatus::Bad; - } - return ValidationStatus::JavaBad; - } - break; - case JavaStatus::Pending: - { - return ValidationStatus::Bad; - } - case JavaStatus::Good: - { - return ValidationStatus::AllOK; - } - } -} - -QString JavaSettingsWidget::javaPath() const -{ - return m_javaPathTextBox->text(); -} - -int JavaSettingsWidget::maxHeapSize() const -{ - return m_maxMemSpinBox->value(); -} - -int JavaSettingsWidget::minHeapSize() const -{ - return m_minMemSpinBox->value(); -} - -bool JavaSettingsWidget::permGenEnabled() const -{ - return m_permGenSpinBox->isVisible(); -} - -int JavaSettingsWidget::permGenSize() const -{ - return m_permGenSpinBox->value(); -} - -void JavaSettingsWidget::memoryValueChanged(int) -{ - bool actuallyChanged = false; - int min = m_minMemSpinBox->value(); - int max = m_maxMemSpinBox->value(); - int permgen = m_permGenSpinBox->value(); - QObject *obj = sender(); - if (obj == m_minMemSpinBox && min != observedMinMemory) - { - observedMinMemory = min; - actuallyChanged = true; - if (min > max) - { - observedMaxMemory = min; - m_maxMemSpinBox->setValue(min); - } - } - else if (obj == m_maxMemSpinBox && max != observedMaxMemory) - { - observedMaxMemory = max; - actuallyChanged = true; - if (min > max) - { - observedMinMemory = max; - m_minMemSpinBox->setValue(max); - } - } - else if (obj == m_permGenSpinBox && permgen != observedPermGenMemory) - { - observedPermGenMemory = permgen; - actuallyChanged = true; - } - if(actuallyChanged) - { - checkJavaPathOnEdit(m_javaPathTextBox->text()); - } -} - -void JavaSettingsWidget::javaVersionSelected(BaseVersionPtr version) -{ - auto java = std::dynamic_pointer_cast(version); - if(!java) - { - return; - } - auto visible = java->id.requiresPermGen(); - m_labelPermGen->setVisible(visible); - m_permGenSpinBox->setVisible(visible); - m_javaPathTextBox->setText(java->path); - checkJavaPath(java->path); -} - -void JavaSettingsWidget::on_javaBrowseBtn_clicked() -{ - QString filter; -#if defined Q_OS_WIN32 - filter = "Java (javaw.exe)"; -#else - filter = "Java (java)"; -#endif - QString raw_path = QFileDialog::getOpenFileName(this, tr("Find Java executable"), QString(), filter); - if(raw_path.isEmpty()) - { - return; - } - QString cooked_path = FS::NormalizePath(raw_path); - m_javaPathTextBox->setText(cooked_path); - checkJavaPath(cooked_path); -} - -void JavaSettingsWidget::on_javaStatusBtn_clicked() -{ - QString text; - bool failed = false; - switch(javaStatus) - { - case JavaStatus::NotSet: - checkJavaPath(m_javaPathTextBox->text()); - return; - case JavaStatus::DoesNotExist: - text += QObject::tr("The specified file either doesn't exist or is not a proper executable."); - failed = true; - break; - case JavaStatus::DoesNotStart: - { - text += QObject::tr("The specified java binary didn't start properly.
"); - auto htmlError = m_result.errorLog; - if(!htmlError.isEmpty()) - { - htmlError.replace('\n', "
"); - text += QString("%1").arg(htmlError); - } - failed = true; - break; - } - case JavaStatus::ReturnedInvalidData: - { - text += QObject::tr("The specified java binary returned unexpected results:
"); - auto htmlOut = m_result.outLog; - if(!htmlOut.isEmpty()) - { - htmlOut.replace('\n', "
"); - text += QString("%1").arg(htmlOut); - } - failed = true; - break; - } - case JavaStatus::Good: - text += QObject::tr("Java test succeeded!
Platform reported: %1
Java version " - "reported: %2
").arg(m_result.realPlatform, m_result.javaVersion.toString()); - break; - case JavaStatus::Pending: - // TODO: abort here? - return; - } - CustomMessageBox::selectable( - this, - failed ? QObject::tr("Java test success") : QObject::tr("Java test failure"), - text, - failed ? QMessageBox::Critical : QMessageBox::Information - )->show(); -} - -void JavaSettingsWidget::setJavaStatus(JavaSettingsWidget::JavaStatus status) -{ - javaStatus = status; - switch(javaStatus) - { - case JavaStatus::Good: - m_javaStatusBtn->setIcon(goodIcon); - break; - case JavaStatus::NotSet: - case JavaStatus::Pending: - m_javaStatusBtn->setIcon(yellowIcon); - break; - default: - m_javaStatusBtn->setIcon(badIcon); - break; - } -} - -void JavaSettingsWidget::javaPathEdited(const QString& path) -{ - checkJavaPathOnEdit(path); -} - -void JavaSettingsWidget::checkJavaPathOnEdit(const QString& path) -{ - auto realPath = FS::ResolveExecutable(path); - QFileInfo pathInfo(realPath); - if (pathInfo.baseName().toLower().contains("java")) - { - checkJavaPath(path); - } - else - { - if(!m_checker) - { - setJavaStatus(JavaStatus::NotSet); - } - } -} - -void JavaSettingsWidget::checkJavaPath(const QString &path) -{ - if(m_checker) - { - queuedCheck = path; - return; - } - auto realPath = FS::ResolveExecutable(path); - if(realPath.isNull()) - { - setJavaStatus(JavaStatus::DoesNotExist); - return; - } - setJavaStatus(JavaStatus::Pending); - m_checker.reset(new JavaChecker()); - m_checker->m_path = path; - m_checker->m_minMem = m_minMemSpinBox->value(); - m_checker->m_maxMem = m_maxMemSpinBox->value(); - if(m_permGenSpinBox->isVisible()) - { - m_checker->m_permGen = m_permGenSpinBox->value(); - } - connect(m_checker.get(), &JavaChecker::checkFinished, this, &JavaSettingsWidget::checkFinished); - m_checker->performCheck(); -} - -void JavaSettingsWidget::checkFinished(JavaCheckResult result) -{ - m_result = result; - switch(result.validity) - { - case JavaCheckResult::Validity::Valid: - { - setJavaStatus(JavaStatus::Good); - break; - } - case JavaCheckResult::Validity::ReturnedInvalidData: - { - setJavaStatus(JavaStatus::ReturnedInvalidData); - break; - } - case JavaCheckResult::Validity::Errored: - { - setJavaStatus(JavaStatus::DoesNotStart); - break; - } - } - m_checker.reset(); - if(!queuedCheck.isNull()) - { - checkJavaPath(queuedCheck); - queuedCheck.clear(); - } -} - -void JavaSettingsWidget::retranslate() -{ - m_memoryGroupBox->setTitle(tr("Memory")); - m_maxMemSpinBox->setToolTip(tr("The maximum amount of memory Minecraft is allowed to use.")); - m_labelMinMem->setText(tr("Minimum memory allocation:")); - m_labelMaxMem->setText(tr("Maximum memory allocation:")); - m_minMemSpinBox->setToolTip(tr("The amount of memory Minecraft is started with.")); - m_permGenSpinBox->setToolTip(tr("The amount of memory available to store loaded Java classes.")); - m_javaBrowseBtn->setText(tr("Browse")); -} diff --git a/application/widgets/JavaSettingsWidget.h b/application/widgets/JavaSettingsWidget.h deleted file mode 100644 index 0d280daf..00000000 --- a/application/widgets/JavaSettingsWidget.h +++ /dev/null @@ -1,102 +0,0 @@ -#pragma once -#include - -#include -#include -#include -#include - -class QLineEdit; -class VersionSelectWidget; -class QSpinBox; -class QPushButton; -class QVBoxLayout; -class QHBoxLayout; -class QGroupBox; -class QGridLayout; -class QLabel; -class QToolButton; - -/** - * This is a widget for all the Java settings dialogs and pages. - */ -class JavaSettingsWidget : public QWidget -{ - Q_OBJECT - -public: - explicit JavaSettingsWidget(QWidget *parent); - virtual ~JavaSettingsWidget() {}; - - enum class JavaStatus - { - NotSet, - Pending, - Good, - DoesNotExist, - DoesNotStart, - ReturnedInvalidData - } javaStatus = JavaStatus::NotSet; - - enum class ValidationStatus - { - Bad, - JavaBad, - AllOK - }; - - void refresh(); - void initialize(); - ValidationStatus validate(); - void retranslate(); - - bool permGenEnabled() const; - int permGenSize() const; - int minHeapSize() const; - int maxHeapSize() const; - QString javaPath() const; - - -protected slots: - void memoryValueChanged(int); - void javaPathEdited(const QString &path); - void javaVersionSelected(BaseVersionPtr version); - void on_javaBrowseBtn_clicked(); - void on_javaStatusBtn_clicked(); - void checkFinished(JavaCheckResult result); - -protected: /* methods */ - void checkJavaPathOnEdit(const QString &path); - void checkJavaPath(const QString &path); - void setJavaStatus(JavaStatus status); - void setupUi(); - -private: /* data */ - VersionSelectWidget *m_versionWidget = nullptr; - QVBoxLayout *m_verticalLayout = nullptr; - - QLineEdit * m_javaPathTextBox = nullptr; - QPushButton * m_javaBrowseBtn = nullptr; - QToolButton * m_javaStatusBtn = nullptr; - QHBoxLayout *m_horizontalLayout = nullptr; - - QGroupBox *m_memoryGroupBox = nullptr; - QGridLayout *m_gridLayout_2 = nullptr; - QSpinBox *m_maxMemSpinBox = nullptr; - QLabel *m_labelMinMem = nullptr; - QLabel *m_labelMaxMem = nullptr; - QSpinBox *m_minMemSpinBox = nullptr; - QLabel *m_labelPermGen = nullptr; - QSpinBox *m_permGenSpinBox = nullptr; - QIcon goodIcon; - QIcon yellowIcon; - QIcon badIcon; - - int observedMinMemory = 0; - int observedMaxMemory = 0; - int observedPermGenMemory = 0; - QString queuedCheck; - uint64_t m_availableMemory = 0ull; - shared_qobject_ptr m_checker; - JavaCheckResult m_result; -}; diff --git a/application/widgets/LabeledToolButton.cpp b/application/widgets/LabeledToolButton.cpp deleted file mode 100644 index ab2d3278..00000000 --- a/application/widgets/LabeledToolButton.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include -#include -#include -#include "LabeledToolButton.h" -#include -#include - -/* - * - * Tool Button with a label on it, instead of the normal text rendering - * - */ - -LabeledToolButton::LabeledToolButton(QWidget * parent) - : QToolButton(parent) - , m_label(new QLabel(this)) -{ - //QToolButton::setText(" "); - m_label->setWordWrap(true); - m_label->setMouseTracking(false); - m_label->setAlignment(Qt::AlignCenter); - m_label->setTextInteractionFlags(Qt::NoTextInteraction); - // somehow, this makes word wrap work in the QLabel. yay. - //m_label->setMinimumWidth(100); -} - -QString LabeledToolButton::text() const -{ - return m_label->text(); -} - -void LabeledToolButton::setText(const QString & text) -{ - m_label->setText(text); -} - -void LabeledToolButton::setIcon(QIcon icon) -{ - m_icon = icon; - resetIcon(); -} - - -/*! - \reimp -*/ -QSize LabeledToolButton::sizeHint() const -{ - /* - Q_D(const QToolButton); - if (d->sizeHint.isValid()) - return d->sizeHint; - */ - ensurePolished(); - - int w = 0, h = 0; - QStyleOptionToolButton opt; - initStyleOption(&opt); - QSize sz =m_label->sizeHint(); - w = sz.width(); - h = sz.height(); - - opt.rect.setSize(QSize(w, h)); // PM_MenuButtonIndicator depends on the height - if (popupMode() == MenuButtonPopup) - w += style()->pixelMetric(QStyle::PM_MenuButtonIndicator, &opt, this); - - QSize rawSize = style()->sizeFromContents(QStyle::CT_ToolButton, &opt, QSize(w, h), this); - QSize sizeHint = rawSize.expandedTo(QApplication::globalStrut()); - return sizeHint; -} - - - -void LabeledToolButton::resizeEvent(QResizeEvent * event) -{ - m_label->setGeometry(QRect(4, 4, width()-8, height()-8)); - if(!m_icon.isNull()) - { - resetIcon(); - } - QWidget::resizeEvent(event); -} - -void LabeledToolButton::resetIcon() -{ - auto iconSz = m_icon.actualSize(QSize(160, 80)); - float w = iconSz.width(); - float h = iconSz.height(); - float ar = w/h; - // FIXME: hardcoded max size of 160x80 - int newW = 80 * ar; - if(newW > 160) - newW = 160; - QSize newSz (newW, 80); - auto pixmap = m_icon.pixmap(newSz); - m_label->setPixmap(pixmap); - m_label->setMinimumHeight(80); - m_label->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred ); -} diff --git a/application/widgets/LabeledToolButton.h b/application/widgets/LabeledToolButton.h deleted file mode 100644 index 51f99e9b..00000000 --- a/application/widgets/LabeledToolButton.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -class QLabel; - -class LabeledToolButton : public QToolButton -{ - Q_OBJECT - - QLabel * m_label; - QIcon m_icon; - -public: - LabeledToolButton(QWidget * parent = 0); - - QString text() const; - void setText(const QString & text); - void setIcon(QIcon icon); - virtual QSize sizeHint() const; -protected: - void resizeEvent(QResizeEvent * event); - void resetIcon(); -}; diff --git a/application/widgets/LanguageSelectionWidget.cpp b/application/widgets/LanguageSelectionWidget.cpp deleted file mode 100644 index 8d23bdc5..00000000 --- a/application/widgets/LanguageSelectionWidget.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include "LanguageSelectionWidget.h" - -#include -#include -#include -#include -#include "MultiMC.h" -#include "translations/TranslationsModel.h" - -LanguageSelectionWidget::LanguageSelectionWidget(QWidget *parent) : - QWidget(parent) -{ - verticalLayout = new QVBoxLayout(this); - verticalLayout->setObjectName(QStringLiteral("verticalLayout")); - languageView = new QTreeView(this); - languageView->setObjectName(QStringLiteral("languageView")); - languageView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - languageView->setAlternatingRowColors(true); - languageView->setRootIsDecorated(false); - languageView->setItemsExpandable(false); - languageView->setWordWrap(true); - languageView->header()->setCascadingSectionResizes(true); - languageView->header()->setStretchLastSection(false); - verticalLayout->addWidget(languageView); - helpUsLabel = new QLabel(this); - helpUsLabel->setObjectName(QStringLiteral("helpUsLabel")); - helpUsLabel->setTextInteractionFlags(Qt::LinksAccessibleByMouse); - helpUsLabel->setOpenExternalLinks(true); - helpUsLabel->setWordWrap(true); - verticalLayout->addWidget(helpUsLabel); - - auto translations = MMC->translations(); - auto index = translations->selectedIndex(); - languageView->setModel(translations.get()); - languageView->setCurrentIndex(index); - languageView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); - languageView->header()->setSectionResizeMode(0, QHeaderView::Stretch); - connect(languageView->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &LanguageSelectionWidget::languageRowChanged); - verticalLayout->setContentsMargins(0,0,0,0); -} - -QString LanguageSelectionWidget::getSelectedLanguageKey() const -{ - auto translations = MMC->translations(); - return translations->data(languageView->currentIndex(), Qt::UserRole).toString(); -} - -void LanguageSelectionWidget::retranslate() -{ - QString text = tr("Don't see your language or the quality is poor?
Help us with translations!") - .arg("https://github.com/MultiMC/MultiMC5/wiki/Translating-MultiMC"); - helpUsLabel->setText(text); - -} - -void LanguageSelectionWidget::languageRowChanged(const QModelIndex& current, const QModelIndex& previous) -{ - if (current == previous) - { - return; - } - auto translations = MMC->translations(); - QString key = translations->data(current, Qt::UserRole).toString(); - translations->selectLanguage(key); - translations->updateLanguage(key); -} diff --git a/application/widgets/LanguageSelectionWidget.h b/application/widgets/LanguageSelectionWidget.h deleted file mode 100644 index e65936db..00000000 --- a/application/widgets/LanguageSelectionWidget.h +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -class QVBoxLayout; -class QTreeView; -class QLabel; - -class LanguageSelectionWidget: public QWidget -{ - Q_OBJECT -public: - explicit LanguageSelectionWidget(QWidget *parent = 0); - virtual ~LanguageSelectionWidget() { }; - - QString getSelectedLanguageKey() const; - void retranslate(); - -protected slots: - void languageRowChanged(const QModelIndex ¤t, const QModelIndex &previous); - -private: - QVBoxLayout *verticalLayout = nullptr; - QTreeView *languageView = nullptr; - QLabel *helpUsLabel = nullptr; -}; diff --git a/application/widgets/LineSeparator.cpp b/application/widgets/LineSeparator.cpp deleted file mode 100644 index d03e6762..00000000 --- a/application/widgets/LineSeparator.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include "LineSeparator.h" - -#include -#include -#include -#include - -void LineSeparator::initStyleOption(QStyleOption *option) const -{ - option->initFrom(this); - // in a horizontal layout, the line is vertical (and vice versa) - if (m_orientation == Qt::Vertical) - option->state |= QStyle::State_Horizontal; -} - -LineSeparator::LineSeparator(QWidget *parent, Qt::Orientation orientation) - : QWidget(parent), m_orientation(orientation) -{ - setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); -} - -QSize LineSeparator::sizeHint() const -{ - QStyleOption opt; - initStyleOption(&opt); - const int extent = - style()->pixelMetric(QStyle::PM_ToolBarSeparatorExtent, &opt, parentWidget()); - return QSize(extent, extent); -} - -void LineSeparator::paintEvent(QPaintEvent *) -{ - QPainter p(this); - QStyleOption opt; - initStyleOption(&opt); - style()->drawPrimitive(QStyle::PE_IndicatorToolBarSeparator, &opt, &p, parentWidget()); -} diff --git a/application/widgets/LineSeparator.h b/application/widgets/LineSeparator.h deleted file mode 100644 index 22927b68..00000000 --- a/application/widgets/LineSeparator.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once -#include - -class QStyleOption; - -class LineSeparator : public QWidget -{ - Q_OBJECT - -public: - /// Create a line separator. orientation is the orientation of the line. - explicit LineSeparator(QWidget *parent, Qt::Orientation orientation = Qt::Horizontal); - QSize sizeHint() const; - void paintEvent(QPaintEvent *); - void initStyleOption(QStyleOption *option) const; -private: - Qt::Orientation m_orientation = Qt::Horizontal; -}; diff --git a/application/widgets/LogView.cpp b/application/widgets/LogView.cpp deleted file mode 100644 index 26a2a527..00000000 --- a/application/widgets/LogView.cpp +++ /dev/null @@ -1,144 +0,0 @@ -#include "LogView.h" -#include -#include - -LogView::LogView(QWidget* parent) : QPlainTextEdit(parent) -{ - setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); - m_defaultFormat = new QTextCharFormat(currentCharFormat()); -} - -LogView::~LogView() -{ - delete m_defaultFormat; -} - -void LogView::setWordWrap(bool wrapping) -{ - if(wrapping) - { - setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - setLineWrapMode(QPlainTextEdit::WidgetWidth); - } - else - { - setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); - setLineWrapMode(QPlainTextEdit::NoWrap); - } -} - -void LogView::setModel(QAbstractItemModel* model) -{ - if(m_model) - { - disconnect(m_model, &QAbstractItemModel::modelReset, this, &LogView::repopulate); - disconnect(m_model, &QAbstractItemModel::rowsInserted, this, &LogView::rowsInserted); - disconnect(m_model, &QAbstractItemModel::rowsAboutToBeInserted, this, &LogView::rowsAboutToBeInserted); - disconnect(m_model, &QAbstractItemModel::rowsRemoved, this, &LogView::rowsRemoved); - } - m_model = model; - if(m_model) - { - connect(m_model, &QAbstractItemModel::modelReset, this, &LogView::repopulate); - connect(m_model, &QAbstractItemModel::rowsInserted, this, &LogView::rowsInserted); - connect(m_model, &QAbstractItemModel::rowsAboutToBeInserted, this, &LogView::rowsAboutToBeInserted); - connect(m_model, &QAbstractItemModel::rowsRemoved, this, &LogView::rowsRemoved); - connect(m_model, &QAbstractItemModel::destroyed, this, &LogView::modelDestroyed); - } - repopulate(); -} - -QAbstractItemModel * LogView::model() const -{ - return m_model; -} - -void LogView::modelDestroyed(QObject* model) -{ - if(m_model == model) - { - setModel(nullptr); - } -} - -void LogView::repopulate() -{ - auto doc = document(); - doc->clear(); - if(!m_model) - { - return; - } - rowsInserted(QModelIndex(), 0, m_model->rowCount() - 1); -} - -void LogView::rowsAboutToBeInserted(const QModelIndex& parent, int first, int last) -{ - Q_UNUSED(parent) - Q_UNUSED(first) - Q_UNUSED(last) - QScrollBar *bar = verticalScrollBar(); - int max_bar = bar->maximum(); - int val_bar = bar->value(); - if (m_scroll) - { - m_scroll = (max_bar - val_bar) <= 1; - } - else - { - m_scroll = val_bar == max_bar; - } -} - -void LogView::rowsInserted(const QModelIndex& parent, int first, int last) -{ - for(int i = first; i <= last; i++) - { - auto idx = m_model->index(i, 0, parent); - auto text = m_model->data(idx, Qt::DisplayRole).toString(); - QTextCharFormat format(*m_defaultFormat); - auto font = m_model->data(idx, Qt::FontRole); - if(font.isValid()) - { - format.setFont(font.value()); - } - auto fg = m_model->data(idx, Qt::TextColorRole); - if(fg.isValid()) - { - format.setForeground(fg.value()); - } - auto bg = m_model->data(idx, Qt::BackgroundRole); - if(bg.isValid()) - { - format.setBackground(bg.value()); - } - auto workCursor = textCursor(); - workCursor.movePosition(QTextCursor::End); - workCursor.insertText(text, format); - workCursor.insertBlock(); - } - if(m_scroll && !m_scrolling) - { - m_scrolling = true; - QMetaObject::invokeMethod( this, "scrollToBottom", Qt::QueuedConnection); - } -} - -void LogView::rowsRemoved(const QModelIndex& parent, int first, int last) -{ - // TODO: some day... maybe - Q_UNUSED(parent) - Q_UNUSED(first) - Q_UNUSED(last) -} - -void LogView::scrollToBottom() -{ - m_scrolling = false; - verticalScrollBar()->setSliderPosition(verticalScrollBar()->maximum()); -} - -void LogView::findNext(const QString& what, bool reverse) -{ - find(what, reverse ? QTextDocument::FindFlag::FindBackward : QTextDocument::FindFlag(0)); -} diff --git a/application/widgets/LogView.h b/application/widgets/LogView.h deleted file mode 100644 index 3143360a..00000000 --- a/application/widgets/LogView.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once -#include -#include - -class QAbstractItemModel; - -class LogView: public QPlainTextEdit -{ - Q_OBJECT -public: - explicit LogView(QWidget *parent = nullptr); - virtual ~LogView(); - - virtual void setModel(QAbstractItemModel *model); - QAbstractItemModel *model() const; - -public slots: - void setWordWrap(bool wrapping); - void findNext(const QString & what, bool reverse); - void scrollToBottom(); - -protected slots: - void repopulate(); - // note: this supports only appending - void rowsInserted(const QModelIndex &parent, int first, int last); - void rowsAboutToBeInserted(const QModelIndex &parent, int first, int last); - // note: this supports only removing from front - void rowsRemoved(const QModelIndex &parent, int first, int last); - void modelDestroyed(QObject * model); - -protected: - QAbstractItemModel *m_model = nullptr; - QTextCharFormat *m_defaultFormat = nullptr; - bool m_scroll = false; - bool m_scrolling = false; -}; diff --git a/application/widgets/MCModInfoFrame.cpp b/application/widgets/MCModInfoFrame.cpp deleted file mode 100644 index 5b1f6230..00000000 --- a/application/widgets/MCModInfoFrame.cpp +++ /dev/null @@ -1,167 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include - -#include "MCModInfoFrame.h" -#include "ui_MCModInfoFrame.h" -#include "dialogs/CustomMessageBox.h" - -void MCModInfoFrame::updateWithMod(Mod &m) -{ - if (m.type() == m.MOD_FOLDER) - { - clear(); - return; - } - - QString text = ""; - QString name = ""; - if (m.name().isEmpty()) - name = m.mmc_id(); - else - name = m.name(); - - if (m.homeurl().isEmpty()) - text = name; - else - text = "" + name + ""; - if (!m.authors().isEmpty()) - text += " by " + m.authors().join(", "); - - setModText(text); - - if (m.description().isEmpty()) - { - setModDescription(QString()); - } - else - { - setModDescription(m.description()); - } -} - -void MCModInfoFrame::clear() -{ - setModText(QString()); - setModDescription(QString()); -} - -MCModInfoFrame::MCModInfoFrame(QWidget *parent) : - QFrame(parent), - ui(new Ui::MCModInfoFrame) -{ - ui->setupUi(this); - ui->label_ModDescription->setHidden(true); - ui->label_ModText->setHidden(true); - updateHiddenState(); -} - -MCModInfoFrame::~MCModInfoFrame() -{ - delete ui; -} - -void MCModInfoFrame::updateHiddenState() -{ - if(ui->label_ModDescription->isHidden() && ui->label_ModText->isHidden()) - { - setHidden(true); - } - else - { - setHidden(false); - } -} - -void MCModInfoFrame::setModText(QString text) -{ - if(text.isEmpty()) - { - ui->label_ModText->setHidden(true); - } - else - { - ui->label_ModText->setText(text); - ui->label_ModText->setHidden(false); - } - updateHiddenState(); -} - -void MCModInfoFrame::setModDescription(QString text) -{ - if(text.isEmpty()) - { - ui->label_ModDescription->setHidden(true); - updateHiddenState(); - return; - } - else - { - ui->label_ModDescription->setHidden(false); - updateHiddenState(); - } - ui->label_ModDescription->setToolTip(""); - QString intermediatetext = text.trimmed(); - bool prev(false); - QChar rem('\n'); - QString finaltext; - finaltext.reserve(intermediatetext.size()); - foreach(const QChar& c, intermediatetext) - { - if(c == rem && prev){ - continue; - } - prev = c == rem; - finaltext += c; - } - QString labeltext; - labeltext.reserve(300); - if(finaltext.length() > 290) - { - ui->label_ModDescription->setOpenExternalLinks(false); - ui->label_ModDescription->setTextFormat(Qt::TextFormat::RichText); - desc = text; - // This allows injecting HTML here. - labeltext.append("" + finaltext.left(287) + "..."); - QObject::connect(ui->label_ModDescription, &QLabel::linkActivated, this, &MCModInfoFrame::modDescEllipsisHandler); - } - else - { - ui->label_ModDescription->setTextFormat(Qt::TextFormat::PlainText); - labeltext.append(finaltext); - } - ui->label_ModDescription->setText(labeltext); -} - -void MCModInfoFrame::modDescEllipsisHandler(const QString &link) -{ - if(!currentBox) - { - currentBox = CustomMessageBox::selectable(this, QString(), desc); - connect(currentBox, &QMessageBox::finished, this, &MCModInfoFrame::boxClosed); - currentBox->show(); - } - else - { - currentBox->setText(desc); - } -} - -void MCModInfoFrame::boxClosed(int result) -{ - currentBox = nullptr; -} diff --git a/application/widgets/MCModInfoFrame.h b/application/widgets/MCModInfoFrame.h deleted file mode 100644 index 0b7ef537..00000000 --- a/application/widgets/MCModInfoFrame.h +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include "minecraft/mod/Mod.h" - -namespace Ui -{ -class MCModInfoFrame; -} - -class MCModInfoFrame : public QFrame -{ - Q_OBJECT - -public: - explicit MCModInfoFrame(QWidget *parent = 0); - ~MCModInfoFrame(); - - void setModText(QString text); - void setModDescription(QString text); - - void updateWithMod(Mod &m); - void clear(); - -public slots: - void modDescEllipsisHandler(const QString& link ); - void boxClosed(int result); - -private: - void updateHiddenState(); - -private: - Ui::MCModInfoFrame *ui; - QString desc; - class QMessageBox * currentBox = nullptr; -}; - diff --git a/application/widgets/MCModInfoFrame.ui b/application/widgets/MCModInfoFrame.ui deleted file mode 100644 index 5ef33379..00000000 --- a/application/widgets/MCModInfoFrame.ui +++ /dev/null @@ -1,92 +0,0 @@ - - - MCModInfoFrame - - - - 0 - 0 - 527 - 113 - - - - - 0 - 0 - - - - - 16777215 - 120 - - - - - 6 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - Qt::RichText - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - true - - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - - - - - - Qt::RichText - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - true - - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - diff --git a/application/widgets/ModListView.cpp b/application/widgets/ModListView.cpp deleted file mode 100644 index c8ccd292..00000000 --- a/application/widgets/ModListView.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "ModListView.h" -#include -#include -#include -#include -#include - -ModListView::ModListView ( QWidget* parent ) - :QTreeView ( parent ) -{ - setAllColumnsShowFocus ( true ); - setExpandsOnDoubleClick ( false ); - setRootIsDecorated ( false ); - setSortingEnabled ( true ); - setAlternatingRowColors ( true ); - setSelectionMode ( QAbstractItemView::ExtendedSelection ); - setHeaderHidden ( false ); - setSelectionBehavior(QAbstractItemView::SelectRows); - setVerticalScrollBarPolicy ( Qt::ScrollBarAlwaysOn ); - setHorizontalScrollBarPolicy ( Qt::ScrollBarAsNeeded ); - setDropIndicatorShown(true); - setDragEnabled(true); - setDragDropMode(QAbstractItemView::DropOnly); - viewport()->setAcceptDrops(true); -} - -void ModListView::setModel ( QAbstractItemModel* model ) -{ - QTreeView::setModel ( model ); - auto head = header(); - head->setStretchLastSection(false); - // HACK: this is true for the checkbox column of mod lists - auto string = model->headerData(0,head->orientation()).toString(); - if(head->count() < 1) - { - return; - } - if(!string.size()) - { - head->setSectionResizeMode(0, QHeaderView::ResizeToContents); - head->setSectionResizeMode(1, QHeaderView::Stretch); - for(int i = 2; i < head->count(); i++) - head->setSectionResizeMode(i, QHeaderView::ResizeToContents); - } - else - { - head->setSectionResizeMode(0, QHeaderView::Stretch); - for(int i = 1; i < head->count(); i++) - head->setSectionResizeMode(i, QHeaderView::ResizeToContents); - } -} diff --git a/application/widgets/ModListView.h b/application/widgets/ModListView.h deleted file mode 100644 index 881e092f..00000000 --- a/application/widgets/ModListView.h +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once -#include - -class ModListView: public QTreeView -{ - Q_OBJECT -public: - explicit ModListView ( QWidget* parent = 0 ); - virtual void setModel ( QAbstractItemModel* model ); -}; diff --git a/application/widgets/PageContainer.cpp b/application/widgets/PageContainer.cpp deleted file mode 100644 index 05a5e6b4..00000000 --- a/application/widgets/PageContainer.cpp +++ /dev/null @@ -1,239 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "PageContainer.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "MultiMC.h" -#include "settings/SettingsObject.h" -#include "widgets/IconLabel.h" -#include "PageContainer_p.h" -#include -#include - -class PageEntryFilterModel : public QSortFilterProxyModel -{ -public: - explicit PageEntryFilterModel(QObject *parent = 0) : QSortFilterProxyModel(parent) - { - } - -protected: - bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const - { - const QString pattern = filterRegExp().pattern(); - const auto model = static_cast(sourceModel()); - const auto page = model->pages().at(sourceRow); - if (!page->shouldDisplay()) - return false; - // Regular contents check, then check page-filter. - return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent); - } -}; - -PageContainer::PageContainer(BasePageProvider *pageProvider, QString defaultId, - QWidget *parent) - : QWidget(parent) -{ - createUI(); - m_model = new PageModel(this); - m_proxyModel = new PageEntryFilterModel(this); - int counter = 0; - auto pages = pageProvider->getPages(); - for (auto page : pages) - { - page->stackIndex = m_pageStack->addWidget(dynamic_cast(page)); - page->listIndex = counter; - page->setParentContainer(this); - counter++; - } - m_model->setPages(pages); - - m_proxyModel->setSourceModel(m_model); - m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); - - m_pageList->setIconSize(QSize(pageIconSize, pageIconSize)); - m_pageList->setSelectionMode(QAbstractItemView::SingleSelection); - m_pageList->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); - m_pageList->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents); - m_pageList->setModel(m_proxyModel); - connect(m_pageList->selectionModel(), SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), - this, SLOT(currentChanged(QModelIndex))); - m_pageStack->setStackingMode(QStackedLayout::StackOne); - m_pageList->setFocus(); - selectPage(defaultId); -} - -bool PageContainer::selectPage(QString pageId) -{ - // now find what we want to have selected... - auto page = m_model->findPageEntryById(pageId); - QModelIndex index; - if (page) - { - index = m_proxyModel->mapFromSource(m_model->index(page->listIndex)); - } - if(!index.isValid()) - { - index = m_proxyModel->index(0, 0); - } - if (index.isValid()) - { - m_pageList->setCurrentIndex(index); - return true; - } - return false; -} - -void PageContainer::refreshContainer() -{ - m_proxyModel->invalidate(); - if(!m_currentPage->shouldDisplay()) - { - auto index = m_proxyModel->index(0, 0); - if(index.isValid()) - { - m_pageList->setCurrentIndex(index); - } - else - { - // FIXME: unhandled corner case: what to do when there's no page to select? - } - } -} - -void PageContainer::createUI() -{ - m_pageStack = new QStackedLayout; - m_pageList = new PageView; - m_header = new QLabel(); - m_iconHeader = new IconLabel(this, QIcon(), QSize(24, 24)); - - QFont headerLabelFont = m_header->font(); - headerLabelFont.setBold(true); - const int pointSize = headerLabelFont.pointSize(); - if (pointSize > 0) - headerLabelFont.setPointSize(pointSize + 2); - m_header->setFont(headerLabelFont); - - QHBoxLayout *headerHLayout = new QHBoxLayout; - const int leftMargin = MMC->style()->pixelMetric(QStyle::PM_LayoutLeftMargin); - headerHLayout->addSpacerItem(new QSpacerItem(leftMargin, 0, QSizePolicy::Fixed, QSizePolicy::Ignored)); - headerHLayout->addWidget(m_header); - headerHLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored)); - headerHLayout->addWidget(m_iconHeader); - const int rightMargin = MMC->style()->pixelMetric(QStyle::PM_LayoutRightMargin); - headerHLayout->addSpacerItem(new QSpacerItem(rightMargin, 0, QSizePolicy::Fixed, QSizePolicy::Ignored)); - headerHLayout->setContentsMargins(0, 6, 0, 0); - - m_pageStack->setMargin(0); - m_pageStack->addWidget(new QWidget(this)); - - m_layout = new QGridLayout; - m_layout->addLayout(headerHLayout, 0, 1, 1, 1); - m_layout->addWidget(m_pageList, 0, 0, 2, 1); - m_layout->addLayout(m_pageStack, 1, 1, 1, 1); - m_layout->setColumnStretch(1, 4); - m_layout->setContentsMargins(0,0,0,6); - setLayout(m_layout); -} - -void PageContainer::addButtons(QWidget *buttons) -{ - m_layout->addWidget(buttons, 2, 0, 1, 2); -} - -void PageContainer::addButtons(QLayout *buttons) -{ - m_layout->addLayout(buttons, 2, 0, 1, 2); -} - -void PageContainer::showPage(int row) -{ - if (m_currentPage) - { - m_currentPage->closed(); - } - if (row != -1) - { - m_currentPage = m_model->pages().at(row); - } - else - { - m_currentPage = nullptr; - } - if (m_currentPage) - { - m_pageStack->setCurrentIndex(m_currentPage->stackIndex); - m_header->setText(m_currentPage->displayName()); - m_iconHeader->setIcon(m_currentPage->icon()); - m_currentPage->opened(); - } - else - { - m_pageStack->setCurrentIndex(0); - m_header->setText(QString()); - m_iconHeader->setIcon(MMC->getThemedIcon("bug")); - } -} - -void PageContainer::help() -{ - if (m_currentPage) - { - QString pageId = m_currentPage->helpPage(); - if (pageId.isEmpty()) - return; - DesktopServices::openUrl(QUrl("https://github.com/MultiMC/MultiMC5/wiki/" + pageId)); - } -} - -void PageContainer::currentChanged(const QModelIndex ¤t) -{ - showPage(current.isValid() ? m_proxyModel->mapToSource(current).row() : -1); -} - -bool PageContainer::prepareToClose() -{ - if(!saveAll()) - { - return false; - } - if (m_currentPage) - { - m_currentPage->closed(); - } - return true; -} - -bool PageContainer::saveAll() -{ - for (auto page : m_model->pages()) - { - if (!page->apply()) - return false; - } - return true; -} diff --git a/application/widgets/PageContainer.h b/application/widgets/PageContainer.h deleted file mode 100644 index 976d34e9..00000000 --- a/application/widgets/PageContainer.h +++ /dev/null @@ -1,89 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#include "pages/BasePageProvider.h" -#include "pages/BasePageContainer.h" - -class QLayout; -class IconLabel; -class QSortFilterProxyModel; -class PageModel; -class QLabel; -class QListView; -class QLineEdit; -class QStackedLayout; -class QGridLayout; - -class PageContainer : public QWidget, public BasePageContainer -{ - Q_OBJECT -public: - explicit PageContainer(BasePageProvider *pageProvider, QString defaultId = QString(), - QWidget *parent = 0); - virtual ~PageContainer() {} - - void addButtons(QWidget * buttons); - void addButtons(QLayout * buttons); - /* - * Save any unsaved state and prepare to be closed. - * @return true if everything can be saved, false if there is something that requires attention - */ - bool prepareToClose(); - bool saveAll(); - - /* request close - used by individual pages */ - bool requestClose() override - { - if(m_container) - { - return m_container->requestClose(); - } - return false; - } - - virtual bool selectPage(QString pageId) override; - - void refreshContainer() override; - virtual void setParentContainer(BasePageContainer * container) - { - m_container = container; - }; - -private: - void createUI(); - -public slots: - void help(); - -private slots: - void currentChanged(const QModelIndex ¤t); - void showPage(int row); - -private: - BasePageContainer * m_container = nullptr; - BasePage * m_currentPage = 0; - QSortFilterProxyModel *m_proxyModel; - PageModel *m_model; - QStackedLayout *m_pageStack; - QListView *m_pageList; - QLabel *m_header; - IconLabel *m_iconHeader; - QGridLayout *m_layout; -}; diff --git a/application/widgets/PageContainer_p.h b/application/widgets/PageContainer_p.h deleted file mode 100644 index da1a66f4..00000000 --- a/application/widgets/PageContainer_p.h +++ /dev/null @@ -1,123 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include -#include - -class BasePage; -const int pageIconSize = 24; - -class PageViewDelegate : public QStyledItemDelegate -{ -public: - PageViewDelegate(QObject *parent) : QStyledItemDelegate(parent) - { - } - QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const - { - QSize size = QStyledItemDelegate::sizeHint(option, index); - size.setHeight(qMax(size.height(), 32)); - return size; - } -}; - -class PageModel : public QAbstractListModel -{ -public: - PageModel(QObject *parent = 0) : QAbstractListModel(parent) - { - QPixmap empty(pageIconSize, pageIconSize); - empty.fill(Qt::transparent); - m_emptyIcon = QIcon(empty); - } - virtual ~PageModel() {} - - int rowCount(const QModelIndex &parent = QModelIndex()) const - { - return parent.isValid() ? 0 : m_pages.size(); - } - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const - { - switch (role) - { - case Qt::DisplayRole: - return m_pages.at(index.row())->displayName(); - case Qt::DecorationRole: - { - QIcon icon = m_pages.at(index.row())->icon(); - if (icon.isNull()) - icon = m_emptyIcon; - // HACK: fixes icon stretching on windows. TODO: report Qt bug for this - return QIcon(icon.pixmap(QSize(48,48))); - } - } - return QVariant(); - } - - void setPages(const QList &pages) - { - beginResetModel(); - m_pages = pages; - endResetModel(); - } - const QList &pages() const - { - return m_pages; - } - - BasePage * findPageEntryById(QString id) - { - for(auto page: m_pages) - { - if (page->id() == id) - return page; - } - return nullptr; - } - - QList m_pages; - QIcon m_emptyIcon; -}; - -class PageView : public QListView -{ -public: - PageView(QWidget *parent = 0) : QListView(parent) - { - setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding); - setItemDelegate(new PageViewDelegate(this)); - setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - } - - virtual QSize sizeHint() const - { - int width = sizeHintForColumn(0) + frameWidth() * 2 + 5; - if (verticalScrollBar()->isVisible()) - width += verticalScrollBar()->width(); - return QSize(width, 100); - } - - virtual bool eventFilter(QObject *obj, QEvent *event) - { - if (obj == verticalScrollBar() && - (event->type() == QEvent::Show || event->type() == QEvent::Hide)) - updateGeometry(); - return QListView::eventFilter(obj, event); - } -}; diff --git a/application/widgets/ProgressWidget.cpp b/application/widgets/ProgressWidget.cpp deleted file mode 100644 index 911e555d..00000000 --- a/application/widgets/ProgressWidget.cpp +++ /dev/null @@ -1,73 +0,0 @@ -// Licensed under the Apache-2.0 license. See README.md for details. - -#include "ProgressWidget.h" -#include -#include -#include -#include - -#include "tasks/Task.h" - -ProgressWidget::ProgressWidget(QWidget *parent) - : QWidget(parent) -{ - m_label = new QLabel(this); - m_label->setWordWrap(true); - m_bar = new QProgressBar(this); - m_bar->setMinimum(0); - m_bar->setMaximum(100); - QVBoxLayout *layout = new QVBoxLayout(this); - layout->addWidget(m_label); - layout->addWidget(m_bar); - layout->addStretch(); - setLayout(layout); -} - -void ProgressWidget::start(std::shared_ptr task) -{ - if (m_task) - { - disconnect(m_task.get(), 0, this, 0); - } - m_task = task; - connect(m_task.get(), &Task::finished, this, &ProgressWidget::handleTaskFinish); - connect(m_task.get(), &Task::status, this, &ProgressWidget::handleTaskStatus); - connect(m_task.get(), &Task::progress, this, &ProgressWidget::handleTaskProgress); - connect(m_task.get(), &Task::destroyed, this, &ProgressWidget::taskDestroyed); - if (!m_task->isRunning()) - { - QMetaObject::invokeMethod(m_task.get(), "start", Qt::QueuedConnection); - } -} -bool ProgressWidget::exec(std::shared_ptr task) -{ - QEventLoop loop; - connect(task.get(), &Task::finished, &loop, &QEventLoop::quit); - start(task); - if (task->isRunning()) - { - loop.exec(); - } - return task->wasSuccessful(); -} - -void ProgressWidget::handleTaskFinish() -{ - if (!m_task->wasSuccessful()) - { - m_label->setText(m_task->failReason()); - } -} -void ProgressWidget::handleTaskStatus(const QString &status) -{ - m_label->setText(status); -} -void ProgressWidget::handleTaskProgress(qint64 current, qint64 total) -{ - m_bar->setMaximum(total); - m_bar->setValue(current); -} -void ProgressWidget::taskDestroyed() -{ - m_task = nullptr; -} diff --git a/application/widgets/ProgressWidget.h b/application/widgets/ProgressWidget.h deleted file mode 100644 index fa67748a..00000000 --- a/application/widgets/ProgressWidget.h +++ /dev/null @@ -1,32 +0,0 @@ -// Licensed under the Apache-2.0 license. See README.md for details. - -#pragma once - -#include -#include - -class Task; -class QProgressBar; -class QLabel; - -class ProgressWidget : public QWidget -{ - Q_OBJECT -public: - explicit ProgressWidget(QWidget *parent = nullptr); - -public slots: - void start(std::shared_ptr task); - bool exec(std::shared_ptr task); - -private slots: - void handleTaskFinish(); - void handleTaskStatus(const QString &status); - void handleTaskProgress(qint64 current, qint64 total); - void taskDestroyed(); - -private: - QLabel *m_label; - QProgressBar *m_bar; - std::shared_ptr m_task; -}; diff --git a/application/widgets/ServerStatus.cpp b/application/widgets/ServerStatus.cpp deleted file mode 100644 index 87c34f70..00000000 --- a/application/widgets/ServerStatus.cpp +++ /dev/null @@ -1,179 +0,0 @@ -#include "ServerStatus.h" -#include "LineSeparator.h" -#include "IconLabel.h" -#include "status/StatusChecker.h" -#include - -#include "MultiMC.h" - -#include -#include -#include -#include -#include -#include - -class ClickableLabel : public QLabel -{ - Q_OBJECT -public: - ClickableLabel(QWidget *parent) : QLabel(parent) - { - setCursor(Qt::PointingHandCursor); - } - - ~ClickableLabel(){}; - -signals: - void clicked(); - -protected: - void mousePressEvent(QMouseEvent *event) - { - emit clicked(); - } -}; - -class ClickableIconLabel : public IconLabel -{ - Q_OBJECT -public: - ClickableIconLabel(QWidget *parent, QIcon icon, QSize size) : IconLabel(parent, icon, size) - { - setCursor(Qt::PointingHandCursor); - } - - ~ClickableIconLabel(){}; - -signals: - void clicked(); - -protected: - void mousePressEvent(QMouseEvent *event) - { - emit clicked(); - } -}; - -ServerStatus::ServerStatus(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f) -{ - layout = new QHBoxLayout(this); - layout->setContentsMargins(0, 0, 0, 0); - goodIcon = MMC->getThemedIcon("status-good"); - yellowIcon = MMC->getThemedIcon("status-yellow"); - badIcon = MMC->getThemedIcon("status-bad"); - - addStatus("authserver.mojang.com", tr("Auth")); - addLine(); - addStatus("session.minecraft.net", tr("Session")); - addLine(); - addStatus("textures.minecraft.net", tr("Skins")); - addLine(); - addStatus("api.mojang.com", tr("API")); - - m_statusRefresh = new QToolButton(this); - m_statusRefresh->setCheckable(true); - m_statusRefresh->setToolButtonStyle(Qt::ToolButtonIconOnly); - m_statusRefresh->setIcon(MMC->getThemedIcon("refresh")); - layout->addWidget(m_statusRefresh); - - setLayout(layout); - - // Start status checker - m_statusChecker.reset(new StatusChecker()); - { - auto reloader = m_statusChecker.get(); - connect(reloader, &StatusChecker::statusChanged, this, &ServerStatus::StatusChanged); - connect(reloader, &StatusChecker::statusLoading, this, &ServerStatus::StatusReloading); - connect(m_statusRefresh, &QAbstractButton::clicked, this, &ServerStatus::reloadStatus); - m_statusChecker->startTimer(60000); - reloadStatus(); - } -} - -ServerStatus::~ServerStatus() -{ -} - -void ServerStatus::reloadStatus() -{ - m_statusChecker->reloadStatus(); -} - -void ServerStatus::addLine() -{ - layout->addWidget(new LineSeparator(this, Qt::Vertical)); -} - -void ServerStatus::addStatus(QString key, QString name) -{ - { - auto label = new ClickableIconLabel(this, badIcon, QSize(16, 16)); - label->setToolTip(key); - serverLabels[key] = label; - layout->addWidget(label); - connect(label,SIGNAL(clicked()),SLOT(clicked())); - } - { - auto label = new ClickableLabel(this); - label->setText(name); - label->setToolTip(key); - layout->addWidget(label); - connect(label,SIGNAL(clicked()),SLOT(clicked())); - } -} - -void ServerStatus::clicked() -{ - DesktopServices::openUrl(QUrl("https://github.com/MultiMC/MultiMC5/wiki/Mojang-Services-Status")); -} - -void ServerStatus::setStatus(QString key, int value) -{ - if (!serverLabels.contains(key)) - return; - IconLabel *label = serverLabels[key]; - switch(value) - { - case 0: - label->setIcon(goodIcon); - break; - case 1: - label->setIcon(yellowIcon); - break; - default: - case 2: - label->setIcon(badIcon); - break; - } -} - -void ServerStatus::StatusChanged(const QMap statusEntries) -{ - auto convertStatus = [&](QString status)->int - { - if (status == "green") - return 0; - else if (status == "yellow") - return 1; - else if (status == "red") - return 2; - return 2; - } - ; - auto iter = statusEntries.begin(); - while (iter != statusEntries.end()) - { - QString key = iter.key(); - auto value = convertStatus(iter.value()); - setStatus(key, value); - iter++; - } -} - -void ServerStatus::StatusReloading(bool is_reloading) -{ - m_statusRefresh->setChecked(is_reloading); -} - -#include "ServerStatus.moc" diff --git a/application/widgets/ServerStatus.h b/application/widgets/ServerStatus.h deleted file mode 100644 index e1e70dfb..00000000 --- a/application/widgets/ServerStatus.h +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once -#include -#include -#include -#include -#include - -class IconLabel; -class QToolButton; -class QHBoxLayout; -class StatusChecker; - -class ServerStatus: public QWidget -{ - Q_OBJECT -public: - explicit ServerStatus(QWidget *parent = nullptr, Qt::WindowFlags f = 0); - virtual ~ServerStatus(); - -public slots: - void reloadStatus(); - void StatusChanged(const QMap statuses); - void StatusReloading(bool is_reloading); - -private slots: - void clicked(); - -private: /* methods */ - void addLine(); - void addStatus(QString key, QString name); - void setStatus(QString key, int value); -private: /* data */ - QHBoxLayout * layout = nullptr; - QToolButton *m_statusRefresh = nullptr; - QMap serverLabels; - QIcon goodIcon; - QIcon yellowIcon; - QIcon badIcon; - std::shared_ptr m_statusChecker; -}; diff --git a/application/widgets/VersionListView.cpp b/application/widgets/VersionListView.cpp deleted file mode 100644 index 8424fedd..00000000 --- a/application/widgets/VersionListView.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include -#include -#include -#include -#include "VersionListView.h" -#include "Common.h" - -VersionListView::VersionListView(QWidget *parent) - :QTreeView ( parent ) -{ - m_emptyString = tr("No versions are currently available."); -} - -void VersionListView::rowsInserted(const QModelIndex &parent, int start, int end) -{ - m_itemCount += end-start+1; - updateEmptyViewPort(); - QTreeView::rowsInserted(parent, start, end); -} - - -void VersionListView::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) -{ - m_itemCount -= end-start+1; - updateEmptyViewPort(); - QTreeView::rowsInserted(parent, start, end); -} - -void VersionListView::setModel(QAbstractItemModel *model) -{ - m_itemCount = model->rowCount(); - updateEmptyViewPort(); - QTreeView::setModel(model); -} - -void VersionListView::reset() -{ - if(model()) - { - m_itemCount = model()->rowCount(); - } - else { - m_itemCount = 0; - } - updateEmptyViewPort(); - QTreeView::reset(); -} - -void VersionListView::setEmptyString(QString emptyString) -{ - m_emptyString = emptyString; - updateEmptyViewPort(); -} - -void VersionListView::setEmptyErrorString(QString emptyErrorString) -{ - m_emptyErrorString = emptyErrorString; - updateEmptyViewPort(); -} - -void VersionListView::setEmptyMode(VersionListView::EmptyMode mode) -{ - m_emptyMode = mode; - updateEmptyViewPort(); -} - -void VersionListView::updateEmptyViewPort() -{ -#ifndef QT_NO_ACCESSIBILITY - setAccessibleDescription(currentEmptyString()); -#endif /* !QT_NO_ACCESSIBILITY */ - - if(!m_itemCount) - { - viewport()->update(); - } -} - -void VersionListView::paintEvent(QPaintEvent *event) -{ - if(m_itemCount) - { - QTreeView::paintEvent(event); - } - else - { - paintInfoLabel(event); - } -} - -QString VersionListView::currentEmptyString() const -{ - if(m_itemCount) { - return QString(); - } - switch(m_emptyMode) - { - default: - case VersionListView::Empty: - return QString(); - case VersionListView::String: - return m_emptyString; - case VersionListView::ErrorString: - return m_emptyErrorString; - } -} - - -void VersionListView::paintInfoLabel(QPaintEvent *event) const -{ - QString emptyString = currentEmptyString(); - - //calculate the rect for the overlay - QPainter painter(viewport()); - painter.setRenderHint(QPainter::Antialiasing, true); - QFont font("sans", 20); - font.setBold(true); - - QRect bounds = viewport()->geometry(); - bounds.moveTop(0); - auto innerBounds = bounds; - innerBounds.adjust(10, 10, -10, -10); - - QColor background = QApplication::palette().color(QPalette::Foreground); - QColor foreground = QApplication::palette().color(QPalette::Base); - foreground.setAlpha(190); - painter.setFont(font); - auto fontMetrics = painter.fontMetrics(); - auto textRect = fontMetrics.boundingRect(innerBounds, Qt::AlignHCenter | Qt::TextWordWrap, emptyString); - textRect.moveCenter(bounds.center()); - - auto wrapRect = textRect; - wrapRect.adjust(-10, -10, 10, 10); - - //check if we are allowed to draw in our area - if (!event->rect().intersects(wrapRect)) { - return; - } - - painter.setBrush(QBrush(background)); - painter.setPen(foreground); - painter.drawRoundedRect(wrapRect, 5.0, 5.0); - - painter.setPen(foreground); - painter.setFont(font); - painter.drawText(textRect, Qt::AlignHCenter | Qt::TextWordWrap, emptyString); -} diff --git a/application/widgets/VersionListView.h b/application/widgets/VersionListView.h deleted file mode 100644 index 4153b314..00000000 --- a/application/widgets/VersionListView.h +++ /dev/null @@ -1,56 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once -#include - -class VersionListView : public QTreeView -{ - Q_OBJECT -public: - - explicit VersionListView(QWidget *parent = 0); - virtual void paintEvent(QPaintEvent *event) override; - virtual void setModel(QAbstractItemModel* model) override; - - enum EmptyMode - { - Empty, - String, - ErrorString - }; - - void setEmptyString(QString emptyString); - void setEmptyErrorString(QString emptyErrorString); - void setEmptyMode(EmptyMode mode); - -public slots: - virtual void reset() override; - -protected slots: - virtual void rowsAboutToBeRemoved(const QModelIndex & parent, int start, int end) override; - virtual void rowsInserted(const QModelIndex &parent, int start, int end) override; - -private: /* methods */ - void paintInfoLabel(QPaintEvent *event) const; - void updateEmptyViewPort(); - QString currentEmptyString() const; - -private: /* variables */ - int m_itemCount = 0; - QString m_emptyString; - QString m_emptyErrorString; - EmptyMode m_emptyMode = Empty; -}; diff --git a/application/widgets/VersionSelectWidget.cpp b/application/widgets/VersionSelectWidget.cpp deleted file mode 100644 index 9925a6b4..00000000 --- a/application/widgets/VersionSelectWidget.cpp +++ /dev/null @@ -1,202 +0,0 @@ -#include "VersionSelectWidget.h" -#include -#include -#include "VersionListView.h" -#include -#include -#include - -VersionSelectWidget::VersionSelectWidget(QWidget* parent) - : QWidget(parent) -{ - setObjectName(QStringLiteral("VersionSelectWidget")); - verticalLayout = new QVBoxLayout(this); - verticalLayout->setObjectName(QStringLiteral("verticalLayout")); - verticalLayout->setContentsMargins(0, 0, 0, 0); - - m_proxyModel = new VersionProxyModel(this); - - listView = new VersionListView(this); - listView->setObjectName(QStringLiteral("listView")); - listView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - listView->setAlternatingRowColors(true); - listView->setRootIsDecorated(false); - listView->setItemsExpandable(false); - listView->setWordWrap(true); - listView->header()->setCascadingSectionResizes(true); - listView->header()->setStretchLastSection(false); - listView->setModel(m_proxyModel); - verticalLayout->addWidget(listView); - - sneakyProgressBar = new QProgressBar(this); - sneakyProgressBar->setObjectName(QStringLiteral("sneakyProgressBar")); - sneakyProgressBar->setFormat(QStringLiteral("%p%")); - verticalLayout->addWidget(sneakyProgressBar); - sneakyProgressBar->setHidden(true); - connect(listView->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &VersionSelectWidget::currentRowChanged); - - QMetaObject::connectSlotsByName(this); -} - -void VersionSelectWidget::setCurrentVersion(const QString& version) -{ - m_currentVersion = version; - m_proxyModel->setCurrentVersion(version); -} - -void VersionSelectWidget::setEmptyString(QString emptyString) -{ - listView->setEmptyString(emptyString); -} - -void VersionSelectWidget::setEmptyErrorString(QString emptyErrorString) -{ - listView->setEmptyErrorString(emptyErrorString); -} - -VersionSelectWidget::~VersionSelectWidget() -{ -} - -void VersionSelectWidget::setResizeOn(int column) -{ - listView->header()->setSectionResizeMode(resizeOnColumn, QHeaderView::ResizeToContents); - resizeOnColumn = column; - listView->header()->setSectionResizeMode(resizeOnColumn, QHeaderView::Stretch); -} - -void VersionSelectWidget::initialize(BaseVersionList *vlist) -{ - m_vlist = vlist; - m_proxyModel->setSourceModel(vlist); - listView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); - listView->header()->setSectionResizeMode(resizeOnColumn, QHeaderView::Stretch); - - if (!m_vlist->isLoaded()) - { - loadList(); - } - else - { - if (m_proxyModel->rowCount() == 0) - { - listView->setEmptyMode(VersionListView::String); - } - preselect(); - } -} - -void VersionSelectWidget::closeEvent(QCloseEvent * event) -{ - QWidget::closeEvent(event); -} - -void VersionSelectWidget::loadList() -{ - auto newTask = m_vlist->getLoadTask(); - if (!newTask) - { - return; - } - loadTask = newTask.get(); - connect(loadTask, &Task::succeeded, this, &VersionSelectWidget::onTaskSucceeded); - connect(loadTask, &Task::failed, this, &VersionSelectWidget::onTaskFailed); - connect(loadTask, &Task::progress, this, &VersionSelectWidget::changeProgress); - if(!loadTask->isRunning()) - { - loadTask->start(); - } - sneakyProgressBar->setHidden(false); -} - -void VersionSelectWidget::onTaskSucceeded() -{ - if (m_proxyModel->rowCount() == 0) - { - listView->setEmptyMode(VersionListView::String); - } - sneakyProgressBar->setHidden(true); - preselect(); - loadTask = nullptr; -} - -void VersionSelectWidget::onTaskFailed(const QString& reason) -{ - CustomMessageBox::selectable(this, tr("Error"), tr("List update failed:\n%1").arg(reason), QMessageBox::Warning)->show(); - onTaskSucceeded(); -} - -void VersionSelectWidget::changeProgress(qint64 current, qint64 total) -{ - sneakyProgressBar->setMaximum(total); - sneakyProgressBar->setValue(current); -} - -void VersionSelectWidget::currentRowChanged(const QModelIndex& current, const QModelIndex&) -{ - auto variant = m_proxyModel->data(current, BaseVersionList::VersionPointerRole); - emit selectedVersionChanged(variant.value()); -} - -void VersionSelectWidget::preselect() -{ - if(preselectedAlready) - return; - selectCurrent(); - if(preselectedAlready) - return; - selectRecommended(); -} - -void VersionSelectWidget::selectCurrent() -{ - if(m_currentVersion.isEmpty()) - { - return; - } - auto idx = m_proxyModel->getVersion(m_currentVersion); - if(idx.isValid()) - { - preselectedAlready = true; - listView->selectionModel()->setCurrentIndex(idx,QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); - listView->scrollTo(idx, QAbstractItemView::PositionAtCenter); - } -} - -void VersionSelectWidget::selectRecommended() -{ - auto idx = m_proxyModel->getRecommended(); - if(idx.isValid()) - { - preselectedAlready = true; - listView->selectionModel()->setCurrentIndex(idx,QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); - listView->scrollTo(idx, QAbstractItemView::PositionAtCenter); - } -} - -bool VersionSelectWidget::hasVersions() const -{ - return m_proxyModel->rowCount(QModelIndex()) != 0; -} - -BaseVersionPtr VersionSelectWidget::selectedVersion() const -{ - auto currentIndex = listView->selectionModel()->currentIndex(); - auto variant = m_proxyModel->data(currentIndex, BaseVersionList::VersionPointerRole); - return variant.value(); -} - -void VersionSelectWidget::setExactFilter(BaseVersionList::ModelRoles role, QString filter) -{ - m_proxyModel->setFilter(role, new ExactFilter(filter)); -} - -void VersionSelectWidget::setFuzzyFilter(BaseVersionList::ModelRoles role, QString filter) -{ - m_proxyModel->setFilter(role, new ContainsFilter(filter)); -} - -void VersionSelectWidget::setFilter(BaseVersionList::ModelRoles role, Filter *filter) -{ - m_proxyModel->setFilter(role, filter); -} diff --git a/application/widgets/VersionSelectWidget.h b/application/widgets/VersionSelectWidget.h deleted file mode 100644 index 0a649408..00000000 --- a/application/widgets/VersionSelectWidget.h +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright 2013-2021 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include "BaseVersionList.h" - -class VersionProxyModel; -class VersionListView; -class QVBoxLayout; -class QProgressBar; -class Filter; - -class VersionSelectWidget: public QWidget -{ - Q_OBJECT -public: - explicit VersionSelectWidget(QWidget *parent = 0); - ~VersionSelectWidget(); - - //! loads the list if needed. - void initialize(BaseVersionList *vlist); - - //! Starts a task that loads the list. - void loadList(); - - bool hasVersions() const; - BaseVersionPtr selectedVersion() const; - void selectRecommended(); - void selectCurrent(); - - void setCurrentVersion(const QString & version); - void setFuzzyFilter(BaseVersionList::ModelRoles role, QString filter); - void setExactFilter(BaseVersionList::ModelRoles role, QString filter); - void setFilter(BaseVersionList::ModelRoles role, Filter *filter); - void setEmptyString(QString emptyString); - void setEmptyErrorString(QString emptyErrorString); - void setResizeOn(int column); - -signals: - void selectedVersionChanged(BaseVersionPtr version); - -protected: - virtual void closeEvent ( QCloseEvent* ); - -private slots: - void onTaskSucceeded(); - void onTaskFailed(const QString &reason); - void changeProgress(qint64 current, qint64 total); - void currentRowChanged(const QModelIndex ¤t, const QModelIndex &); - -private: - void preselect(); - -private: - QString m_currentVersion; - BaseVersionList *m_vlist = nullptr; - VersionProxyModel *m_proxyModel = nullptr; - int resizeOnColumn = 0; - Task * loadTask; - bool preselectedAlready = false; - -private: - QVBoxLayout *verticalLayout = nullptr; - VersionListView *listView = nullptr; - QProgressBar *sneakyProgressBar = nullptr; -}; diff --git a/application/widgets/WideBar.cpp b/application/widgets/WideBar.cpp deleted file mode 100644 index cbd6c617..00000000 --- a/application/widgets/WideBar.cpp +++ /dev/null @@ -1,116 +0,0 @@ -#include "WideBar.h" -#include -#include - -class ActionButton : public QToolButton -{ - Q_OBJECT -public: - ActionButton(QAction * action, QWidget * parent = 0) : QToolButton(parent), m_action(action) { - setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - connect(action, &QAction::changed, this, &ActionButton::actionChanged); - connect(this, &ActionButton::clicked, action, &QAction::trigger); - actionChanged(); - }; -private slots: - void actionChanged() { - setEnabled(m_action->isEnabled()); - setChecked(m_action->isChecked()); - setCheckable(m_action->isCheckable()); - setText(m_action->text()); - setIcon(m_action->icon()); - setToolTip(m_action->toolTip()); - setHidden(!m_action->isVisible()); - setFocusPolicy(Qt::NoFocus); - } -private: - QAction * m_action; -}; - - -WideBar::WideBar(const QString& title, QWidget* parent) : QToolBar(title, parent) -{ - setFloatable(false); - setMovable(false); -} - -WideBar::WideBar(QWidget* parent) : QToolBar(parent) -{ - setFloatable(false); - setMovable(false); -} - -struct WideBar::BarEntry { - enum Type { - None, - Action, - Separator, - Spacer - } type = None; - QAction *qAction = nullptr; - QAction *wideAction = nullptr; -}; - - -WideBar::~WideBar() -{ - for(auto *iter: m_entries) { - delete iter; - } -} - -void WideBar::addAction(QAction* action) -{ - auto entry = new BarEntry(); - entry->qAction = addWidget(new ActionButton(action, this)); - entry->wideAction = action; - entry->type = BarEntry::Action; - m_entries.push_back(entry); -} - -void WideBar::addSeparator() -{ - auto entry = new BarEntry(); - entry->qAction = QToolBar::addSeparator(); - entry->type = BarEntry::Separator; - m_entries.push_back(entry); -} - -void WideBar::insertSpacer(QAction* action) -{ - auto iter = std::find_if(m_entries.begin(), m_entries.end(), [action](BarEntry * entry) { - return entry->wideAction == action; - }); - if(iter == m_entries.end()) { - return; - } - QWidget* spacer = new QWidget(); - spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - - auto entry = new BarEntry(); - entry->qAction = insertWidget((*iter)->qAction, spacer); - entry->type = BarEntry::Spacer; - m_entries.insert(iter, entry); -} - -QMenu * WideBar::createContextMenu(QWidget *parent, const QString & title) -{ - QMenu *contextMenu = new QMenu(title, parent); - for(auto & item: m_entries) { - switch(item->type) { - default: - case BarEntry::None: - break; - case BarEntry::Separator: - case BarEntry::Spacer: - contextMenu->addSeparator(); - break; - case BarEntry::Action: - contextMenu->addAction(item->wideAction); - break; - } - } - return contextMenu; -} - -#include "WideBar.moc" diff --git a/application/widgets/WideBar.h b/application/widgets/WideBar.h deleted file mode 100644 index d1b8cbe7..00000000 --- a/application/widgets/WideBar.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include -#include -#include - -class QMenu; - -class WideBar : public QToolBar -{ - Q_OBJECT - -public: - explicit WideBar(const QString &title, QWidget * parent = nullptr); - explicit WideBar(QWidget * parent = nullptr); - virtual ~WideBar(); - - void addAction(QAction *action); - void addSeparator(); - void insertSpacer(QAction *action); - QMenu *createContextMenu(QWidget *parent = nullptr, const QString & title = QString()); - -private: - struct BarEntry; - QList m_entries; -}; -- cgit