From db877ba121ff87a4e029daf8555d85dfef45993a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Mon, 9 Feb 2015 01:51:14 +0100 Subject: NOISSUE move everything. --- application/BuildConfig.cpp.in | 56 + application/BuildConfig.h | 63 + application/CMakeLists.txt | 473 +++++ application/ColumnResizer.cpp | 202 ++ application/ColumnResizer.h | 38 + application/ConsoleWindow.cpp | 260 +++ application/ConsoleWindow.h | 65 + application/GuiUtil.cpp | 48 + application/GuiUtil.h | 9 + application/InstancePageProvider.cpp | 0 application/InstancePageProvider.h | 52 + application/InstanceProxyModel.cpp | 23 + application/InstanceProxyModel.h | 13 + application/MainWindow.cpp | 2069 ++++++++++++++++++++ application/MainWindow.h | 218 +++ application/MultiMC.cpp | 632 ++++++ application/MultiMC.h | 188 ++ application/NagUtils.cpp | 38 + application/NagUtils.h | 23 + application/Platform.h | 32 + application/Platform_Other.cpp | 27 + application/Platform_X11.cpp | 62 + application/dialogs/AboutDialog.cpp | 127 ++ application/dialogs/AboutDialog.h | 47 + application/dialogs/AboutDialog.ui | 544 +++++ application/dialogs/AccountSelectDialog.cpp | 85 + application/dialogs/AccountSelectDialog.h | 90 + application/dialogs/AccountSelectDialog.ui | 56 + application/dialogs/CopyInstanceDialog.cpp | 101 + application/dialogs/CopyInstanceDialog.h | 52 + application/dialogs/CopyInstanceDialog.ui | 161 ++ application/dialogs/CustomMessageBox.cpp | 35 + application/dialogs/CustomMessageBox.h | 26 + application/dialogs/EditAccountDialog.cpp | 51 + application/dialogs/EditAccountDialog.h | 60 + application/dialogs/EditAccountDialog.ui | 94 + application/dialogs/IconPickerDialog.cpp | 156 ++ application/dialogs/IconPickerDialog.h | 48 + application/dialogs/IconPickerDialog.ui | 67 + application/dialogs/LoginDialog.cpp | 110 ++ application/dialogs/LoginDialog.h | 58 + application/dialogs/LoginDialog.ui | 77 + application/dialogs/ModEditDialogCommon.cpp | 40 + application/dialogs/ModEditDialogCommon.h | 9 + application/dialogs/NewInstanceDialog.cpp | 207 ++ application/dialogs/NewInstanceDialog.h | 59 + application/dialogs/NewInstanceDialog.ui | 309 +++ application/dialogs/NotificationDialog.cpp | 84 + application/dialogs/NotificationDialog.h | 44 + application/dialogs/NotificationDialog.ui | 85 + application/dialogs/ProgressDialog.cpp | 125 ++ application/dialogs/ProgressDialog.h | 65 + application/dialogs/ProgressDialog.ui | 66 + application/dialogs/UpdateDialog.cpp | 186 ++ application/dialogs/UpdateDialog.h | 61 + application/dialogs/UpdateDialog.ui | 106 + application/dialogs/VersionSelectDialog.cpp | 177 ++ application/dialogs/VersionSelectDialog.h | 66 + application/dialogs/VersionSelectDialog.ui | 110 ++ application/groupview/GroupView.cpp | 1003 ++++++++++ application/groupview/GroupView.h | 125 ++ application/groupview/GroupedProxyModel.cpp | 42 + application/groupview/GroupedProxyModel.h | 15 + application/groupview/InstanceDelegate.cpp | 362 ++++ application/groupview/InstanceDelegate.h | 35 + application/groupview/VisualGroup.cpp | 301 +++ application/groupview/VisualGroup.h | 91 + application/install_prereqs.cmake.in | 24 + application/main.cpp | 43 + application/package/linux/MultiMC | 80 + application/pagedialog/PageDialog.cpp | 62 + application/pagedialog/PageDialog.h | 36 + application/pages/BasePage.h | 38 + application/pages/BasePageProvider.h | 69 + application/pages/InstanceSettingsPage.cpp | 216 ++ application/pages/InstanceSettingsPage.h | 74 + application/pages/InstanceSettingsPage.ui | 453 +++++ application/pages/LogPage.cpp | 222 +++ application/pages/LogPage.h | 86 + application/pages/LogPage.ui | 140 ++ application/pages/ModFolderPage.cpp | 160 ++ application/pages/ModFolderPage.h | 94 + application/pages/ModFolderPage.ui | 124 ++ application/pages/NotesPage.cpp | 21 + application/pages/NotesPage.h | 61 + application/pages/NotesPage.ui | 60 + application/pages/OtherLogsPage.cpp | 150 ++ application/pages/OtherLogsPage.h | 72 + application/pages/OtherLogsPage.ui | 117 ++ application/pages/ResourcePackPage.h | 19 + application/pages/ScreenshotsPage.cpp | 362 ++++ application/pages/ScreenshotsPage.h | 79 + application/pages/ScreenshotsPage.ui | 109 ++ application/pages/TexturePackPage.h | 17 + application/pages/VersionPage.cpp | 321 +++ application/pages/VersionPage.h | 80 + application/pages/VersionPage.ui | 204 ++ application/pages/global/AccountListPage.cpp | 142 ++ application/pages/global/AccountListPage.h | 86 + application/pages/global/AccountListPage.ui | 115 ++ application/pages/global/ExternalToolsPage.cpp | 238 +++ application/pages/global/ExternalToolsPage.h | 74 + application/pages/global/ExternalToolsPage.ui | 197 ++ application/pages/global/JavaPage.cpp | 146 ++ application/pages/global/JavaPage.h | 73 + application/pages/global/JavaPage.ui | 303 +++ application/pages/global/MinecraftPage.cpp | 92 + application/pages/global/MinecraftPage.h | 70 + application/pages/global/MinecraftPage.ui | 148 ++ application/pages/global/MultiMCPage.cpp | 459 +++++ application/pages/global/MultiMCPage.h | 100 + application/pages/global/MultiMCPage.ui | 532 +++++ application/pages/global/ProxyPage.cpp | 95 + application/pages/global/ProxyPage.h | 66 + application/pages/global/ProxyPage.ui | 197 ++ application/resources/MultiMC.icns | Bin 0 -> 437319 bytes application/resources/MultiMC.ico | Bin 0 -> 76126 bytes application/resources/MultiMC.manifest | 27 + application/resources/OSX/OSX.qrc | 35 + 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 + .../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/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/backgrounds/backgrounds.qrc | 6 + application/resources/backgrounds/catbgrnd2.png | Bin 0 -> 78285 bytes application/resources/iOS/iOS.qrc | 35 + 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 + .../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/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/instances/brick.png | Bin 0 -> 713 bytes application/resources/instances/broken.png | Bin 0 -> 1139 bytes application/resources/instances/chicken.png | Bin 0 -> 1181 bytes application/resources/instances/chicken128.png | Bin 0 -> 6369 bytes application/resources/instances/creeper.png | Bin 0 -> 1524 bytes application/resources/instances/creeper128.png | Bin 0 -> 9046 bytes application/resources/instances/derp.png | Bin 0 -> 5225 bytes application/resources/instances/diamond.png | Bin 0 -> 708 bytes application/resources/instances/dirt.png | Bin 0 -> 482 bytes application/resources/instances/enderman.png | Bin 0 -> 2429 bytes application/resources/instances/enderpearl.png | Bin 0 -> 2120 bytes application/resources/instances/enderpearl128.png | Bin 0 -> 21425 bytes application/resources/instances/ftb_glow.png | Bin 0 -> 1747 bytes application/resources/instances/ftb_glow128.png | Bin 0 -> 12708 bytes application/resources/instances/ftb_logo.png | Bin 0 -> 1607 bytes application/resources/instances/ftb_logo128.png | Bin 0 -> 7883 bytes application/resources/instances/gear.png | Bin 0 -> 2414 bytes application/resources/instances/gear128.png | Bin 0 -> 18321 bytes application/resources/instances/gold.png | Bin 0 -> 978 bytes application/resources/instances/grass.png | Bin 0 -> 618 bytes application/resources/instances/herobrine.png | Bin 0 -> 1034 bytes application/resources/instances/herobrine128.png | Bin 0 -> 4937 bytes application/resources/instances/infinity.png | Bin 0 -> 1714 bytes application/resources/instances/infinity128.png | Bin 0 -> 9237 bytes application/resources/instances/instances.qrc | 49 + application/resources/instances/iron.png | Bin 0 -> 532 bytes application/resources/instances/kitten.png | Bin 0 -> 1605 bytes application/resources/instances/magitech.png | Bin 0 -> 2646 bytes application/resources/instances/magitech128.png | Bin 0 -> 23097 bytes application/resources/instances/meat.png | Bin 0 -> 1514 bytes application/resources/instances/meat128.png | Bin 0 -> 10583 bytes application/resources/instances/netherstar.png | Bin 0 -> 1942 bytes application/resources/instances/netherstar128.png | Bin 0 -> 14062 bytes application/resources/instances/planks.png | Bin 0 -> 461 bytes application/resources/instances/skeleton.png | Bin 0 -> 696 bytes application/resources/instances/skeleton128.png | Bin 0 -> 3673 bytes application/resources/instances/squarecreeper.png | Bin 0 -> 1623 bytes .../resources/instances/squarecreeper128.png | Bin 0 -> 9136 bytes application/resources/instances/steve.png | Bin 0 -> 969 bytes application/resources/instances/steve128.png | Bin 0 -> 4312 bytes application/resources/instances/stone.png | Bin 0 -> 438 bytes application/resources/instances/tnt.png | Bin 0 -> 378 bytes .../resources/instances/updateavailable.png | Bin 0 -> 2480 bytes application/resources/multimc.rc | 29 + application/resources/multimc/16x16/about.png | Bin 0 -> 1270 bytes application/resources/multimc/16x16/bug.png | Bin 0 -> 734 bytes application/resources/multimc/16x16/cat.png | Bin 0 -> 736 bytes .../resources/multimc/16x16/centralmods.png | Bin 0 -> 1145 bytes .../resources/multimc/16x16/checkupdate.png | Bin 0 -> 1212 bytes application/resources/multimc/16x16/copy.png | Bin 0 -> 957 bytes application/resources/multimc/16x16/coremods.png | Bin 0 -> 702 bytes application/resources/multimc/16x16/help.png | Bin 0 -> 1297 bytes .../resources/multimc/16x16/instance-settings.png | Bin 0 -> 1410 bytes application/resources/multimc/16x16/jarmods.png | Bin 0 -> 693 bytes application/resources/multimc/16x16/loadermods.png | Bin 0 -> 731 bytes application/resources/multimc/16x16/log.png | Bin 0 -> 630 bytes application/resources/multimc/16x16/minecraft.png | Bin 0 -> 782 bytes application/resources/multimc/16x16/new.png | Bin 0 -> 1175 bytes application/resources/multimc/16x16/news.png | Bin 0 -> 727 bytes application/resources/multimc/16x16/noaccount.png | Bin 0 -> 334 bytes application/resources/multimc/16x16/patreon.png | Bin 0 -> 682 bytes application/resources/multimc/16x16/refresh.png | Bin 0 -> 931 bytes .../resources/multimc/16x16/resourcepacks.png | Bin 0 -> 1207 bytes .../resources/multimc/16x16/screenshots.png | Bin 0 -> 976 bytes application/resources/multimc/16x16/settings.png | Bin 0 -> 1410 bytes application/resources/multimc/16x16/status-bad.png | Bin 0 -> 643 bytes .../resources/multimc/16x16/status-good.png | Bin 0 -> 714 bytes .../resources/multimc/16x16/status-yellow.png | Bin 0 -> 590 bytes application/resources/multimc/16x16/viewfolder.png | Bin 0 -> 852 bytes application/resources/multimc/22x22/about.png | Bin 0 -> 1693 bytes application/resources/multimc/22x22/bug.png | Bin 0 -> 1180 bytes application/resources/multimc/22x22/cat.png | Bin 0 -> 1034 bytes .../resources/multimc/22x22/centralmods.png | Bin 0 -> 1561 bytes .../resources/multimc/22x22/checkupdate.png | Bin 0 -> 1635 bytes application/resources/multimc/22x22/copy.png | Bin 0 -> 1004 bytes application/resources/multimc/22x22/help.png | Bin 0 -> 1735 bytes .../resources/multimc/22x22/instance-settings.png | Bin 0 -> 1964 bytes application/resources/multimc/22x22/new.png | Bin 0 -> 1440 bytes application/resources/multimc/22x22/news.png | Bin 0 -> 1173 bytes application/resources/multimc/22x22/patreon.png | Bin 0 -> 976 bytes application/resources/multimc/22x22/refresh.png | Bin 0 -> 1283 bytes .../resources/multimc/22x22/screenshots.png | Bin 0 -> 1320 bytes application/resources/multimc/22x22/settings.png | Bin 0 -> 1964 bytes application/resources/multimc/22x22/status-bad.png | Bin 0 -> 968 bytes .../resources/multimc/22x22/status-good.png | Bin 0 -> 994 bytes .../resources/multimc/22x22/status-yellow.png | Bin 0 -> 803 bytes application/resources/multimc/22x22/viewfolder.png | Bin 0 -> 1006 bytes application/resources/multimc/24x24/cat.png | Bin 0 -> 1252 bytes application/resources/multimc/24x24/coremods.png | Bin 0 -> 1281 bytes application/resources/multimc/24x24/jarmods.png | Bin 0 -> 1170 bytes application/resources/multimc/24x24/loadermods.png | Bin 0 -> 1240 bytes application/resources/multimc/24x24/log.png | Bin 0 -> 1117 bytes application/resources/multimc/24x24/minecraft.png | Bin 0 -> 1500 bytes application/resources/multimc/24x24/noaccount.png | Bin 0 -> 344 bytes application/resources/multimc/24x24/patreon.png | Bin 0 -> 1034 bytes .../resources/multimc/24x24/resourcepacks.png | Bin 0 -> 2000 bytes application/resources/multimc/24x24/status-bad.png | Bin 0 -> 1102 bytes .../resources/multimc/24x24/status-good.png | Bin 0 -> 1066 bytes .../resources/multimc/24x24/status-yellow.png | Bin 0 -> 872 bytes .../resources/multimc/256x256/minecraft.png | Bin 0 -> 49869 bytes application/resources/multimc/32x32/about.png | Bin 0 -> 2658 bytes application/resources/multimc/32x32/bug.png | Bin 0 -> 1772 bytes application/resources/multimc/32x32/cat.png | Bin 0 -> 1678 bytes .../resources/multimc/32x32/centralmods.png | Bin 0 -> 2119 bytes .../resources/multimc/32x32/checkupdate.png | Bin 0 -> 2480 bytes application/resources/multimc/32x32/copy.png | Bin 0 -> 1401 bytes application/resources/multimc/32x32/coremods.png | Bin 0 -> 1758 bytes application/resources/multimc/32x32/help.png | Bin 0 -> 2720 bytes .../resources/multimc/32x32/instance-settings.png | Bin 0 -> 2983 bytes application/resources/multimc/32x32/jarmods.png | Bin 0 -> 1566 bytes application/resources/multimc/32x32/loadermods.png | Bin 0 -> 1708 bytes application/resources/multimc/32x32/log.png | Bin 0 -> 1460 bytes application/resources/multimc/32x32/minecraft.png | Bin 0 -> 2495 bytes application/resources/multimc/32x32/new.png | Bin 0 -> 1769 bytes application/resources/multimc/32x32/news.png | Bin 0 -> 1752 bytes application/resources/multimc/32x32/noaccount.png | Bin 0 -> 363 bytes application/resources/multimc/32x32/patreon.png | Bin 0 -> 1450 bytes application/resources/multimc/32x32/refresh.png | Bin 0 -> 2182 bytes .../resources/multimc/32x32/resourcepacks.png | Bin 0 -> 2818 bytes .../resources/multimc/32x32/screenshots.png | Bin 0 -> 1892 bytes application/resources/multimc/32x32/settings.png | Bin 0 -> 2983 bytes application/resources/multimc/32x32/status-bad.png | Bin 0 -> 1422 bytes .../resources/multimc/32x32/status-good.png | Bin 0 -> 1400 bytes .../resources/multimc/32x32/status-yellow.png | Bin 0 -> 1158 bytes application/resources/multimc/32x32/viewfolder.png | Bin 0 -> 1518 bytes application/resources/multimc/48x48/about.png | Bin 0 -> 3995 bytes application/resources/multimc/48x48/bug.png | Bin 0 -> 3124 bytes application/resources/multimc/48x48/cat.png | Bin 0 -> 2733 bytes .../resources/multimc/48x48/centralmods.png | Bin 0 -> 3201 bytes .../resources/multimc/48x48/checkupdate.png | Bin 0 -> 4196 bytes application/resources/multimc/48x48/copy.png | Bin 0 -> 1952 bytes application/resources/multimc/48x48/help.png | Bin 0 -> 4170 bytes .../resources/multimc/48x48/instance-settings.png | Bin 0 -> 4797 bytes application/resources/multimc/48x48/log.png | Bin 0 -> 2825 bytes application/resources/multimc/48x48/minecraft.png | Bin 0 -> 5077 bytes application/resources/multimc/48x48/new.png | Bin 0 -> 2870 bytes application/resources/multimc/48x48/news.png | Bin 0 -> 3333 bytes application/resources/multimc/48x48/noaccount.png | Bin 0 -> 387 bytes application/resources/multimc/48x48/patreon.png | Bin 0 -> 2317 bytes application/resources/multimc/48x48/refresh.png | Bin 0 -> 3743 bytes .../resources/multimc/48x48/screenshots.png | Bin 0 -> 3010 bytes application/resources/multimc/48x48/settings.png | Bin 0 -> 4797 bytes application/resources/multimc/48x48/status-bad.png | Bin 0 -> 2389 bytes .../resources/multimc/48x48/status-good.png | Bin 0 -> 2248 bytes .../resources/multimc/48x48/status-yellow.png | Bin 0 -> 1773 bytes application/resources/multimc/48x48/viewfolder.png | Bin 0 -> 1945 bytes application/resources/multimc/64x64/about.png | Bin 0 -> 5513 bytes application/resources/multimc/64x64/bug.png | Bin 0 -> 4263 bytes application/resources/multimc/64x64/cat.png | Bin 0 -> 4033 bytes .../resources/multimc/64x64/centralmods.png | Bin 0 -> 4408 bytes .../resources/multimc/64x64/checkupdate.png | Bin 0 -> 5858 bytes application/resources/multimc/64x64/copy.png | Bin 0 -> 2884 bytes application/resources/multimc/64x64/coremods.png | Bin 0 -> 5036 bytes application/resources/multimc/64x64/help.png | Bin 0 -> 5402 bytes .../resources/multimc/64x64/instance-settings.png | Bin 0 -> 7125 bytes application/resources/multimc/64x64/jarmods.png | Bin 0 -> 4003 bytes application/resources/multimc/64x64/loadermods.png | Bin 0 -> 4406 bytes application/resources/multimc/64x64/log.png | Bin 0 -> 3686 bytes application/resources/multimc/64x64/new.png | Bin 0 -> 3949 bytes application/resources/multimc/64x64/news.png | Bin 0 -> 4968 bytes application/resources/multimc/64x64/patreon.png | Bin 0 -> 3212 bytes application/resources/multimc/64x64/refresh.png | Bin 0 -> 5745 bytes .../resources/multimc/64x64/resourcepacks.png | Bin 0 -> 6805 bytes .../resources/multimc/64x64/screenshots.png | Bin 0 -> 4518 bytes application/resources/multimc/64x64/settings.png | Bin 0 -> 7125 bytes application/resources/multimc/64x64/status-bad.png | Bin 0 -> 2827 bytes .../resources/multimc/64x64/status-good.png | Bin 0 -> 2954 bytes .../resources/multimc/64x64/status-yellow.png | Bin 0 -> 2358 bytes application/resources/multimc/64x64/viewfolder.png | Bin 0 -> 2134 bytes application/resources/multimc/8x8/noaccount.png | Bin 0 -> 284 bytes application/resources/multimc/index.theme | 42 + application/resources/multimc/multimc.qrc | 206 ++ application/resources/multimc/scalable/bug.svg | 387 ++++ .../resources/multimc/scalable/centralmods.svg | 346 ++++ .../resources/multimc/scalable/checkupdate.svg | 167 ++ application/resources/multimc/scalable/console.svg | 228 +++ .../resources/multimc/scalable/console_error.svg | 247 +++ application/resources/multimc/scalable/java.svg | 773 ++++++++ application/resources/multimc/scalable/multimc.svg | 1993 +++++++++++++++++++ application/resources/multimc/scalable/new.svg | 127 ++ application/resources/multimc/scalable/news.svg | 296 +++ application/resources/multimc/scalable/proxy.svg | 260 +++ .../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-yellow.svg | 155 ++ .../resources/multimc/scalable/viewfolder.svg | 122 ++ application/resources/pe_blue/index.theme | 11 + application/resources/pe_blue/pe_blue.qrc | 35 + 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 + .../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/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_colored/index.theme | 11 + application/resources/pe_colored/pe_colored.qrc | 35 + .../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 + .../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/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 + application/resources/pe_dark/index.theme | 11 + application/resources/pe_dark/pe_dark.qrc | 35 + 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 + .../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/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_light/index.theme | 11 + application/resources/pe_light/pe_light.qrc | 36 + 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 + .../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/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/sources/clucker.svg | 404 ++++ application/resources/sources/creeper.svg | 775 ++++++++ application/resources/sources/enderpearl.svg | 271 +++ 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/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/resources/versions/LWJGL/2.9.0.json | 45 + .../LWJGL/2.9.1-nightly-20130708-debug3.json | 45 + application/resources/versions/LWJGL/2.9.1.json | 45 + .../versions/LWJGL/2.9.2-nightly-20140822.json | 45 + application/resources/versions/minecraft.json | 668 +++++++ application/resources/versions/versions.qrc | 12 + application/widgets/Common.cpp | 27 + application/widgets/Common.h | 6 + application/widgets/IconLabel.cpp | 43 + application/widgets/IconLabel.h | 26 + application/widgets/LabeledToolButton.cpp | 86 + application/widgets/LabeledToolButton.h | 37 + application/widgets/LineSeparator.cpp | 37 + application/widgets/LineSeparator.h | 18 + application/widgets/MCModInfoFrame.cpp | 111 ++ application/widgets/MCModInfoFrame.h | 46 + application/widgets/MCModInfoFrame.ui | 68 + application/widgets/ModListView.cpp | 62 + application/widgets/ModListView.h | 27 + application/widgets/PageContainer.cpp | 210 ++ application/widgets/PageContainer.h | 63 + application/widgets/PageContainer_p.h | 123 ++ application/widgets/ServerStatus.cpp | 129 ++ application/widgets/ServerStatus.h | 37 + application/widgets/VersionListView.cpp | 147 ++ application/widgets/VersionListView.h | 43 + 534 files changed, 38884 insertions(+) create mode 100644 application/BuildConfig.cpp.in create mode 100644 application/BuildConfig.h create mode 100644 application/CMakeLists.txt create mode 100644 application/ColumnResizer.cpp create mode 100644 application/ColumnResizer.h create mode 100644 application/ConsoleWindow.cpp create mode 100644 application/ConsoleWindow.h create mode 100644 application/GuiUtil.cpp create mode 100644 application/GuiUtil.h create mode 100644 application/InstancePageProvider.cpp create mode 100644 application/InstancePageProvider.h create mode 100644 application/InstanceProxyModel.cpp create mode 100644 application/InstanceProxyModel.h create mode 100644 application/MainWindow.cpp create mode 100644 application/MainWindow.h create mode 100644 application/MultiMC.cpp create mode 100644 application/MultiMC.h create mode 100644 application/NagUtils.cpp create mode 100644 application/NagUtils.h create mode 100644 application/Platform.h create mode 100644 application/Platform_Other.cpp create mode 100644 application/Platform_X11.cpp create mode 100644 application/dialogs/AboutDialog.cpp create mode 100644 application/dialogs/AboutDialog.h create mode 100644 application/dialogs/AboutDialog.ui create mode 100644 application/dialogs/AccountSelectDialog.cpp create mode 100644 application/dialogs/AccountSelectDialog.h create mode 100644 application/dialogs/AccountSelectDialog.ui create mode 100644 application/dialogs/CopyInstanceDialog.cpp create mode 100644 application/dialogs/CopyInstanceDialog.h create mode 100644 application/dialogs/CopyInstanceDialog.ui create mode 100644 application/dialogs/CustomMessageBox.cpp create mode 100644 application/dialogs/CustomMessageBox.h create mode 100644 application/dialogs/EditAccountDialog.cpp create mode 100644 application/dialogs/EditAccountDialog.h create mode 100644 application/dialogs/EditAccountDialog.ui create mode 100644 application/dialogs/IconPickerDialog.cpp create mode 100644 application/dialogs/IconPickerDialog.h create mode 100644 application/dialogs/IconPickerDialog.ui create mode 100644 application/dialogs/LoginDialog.cpp create mode 100644 application/dialogs/LoginDialog.h create mode 100644 application/dialogs/LoginDialog.ui create mode 100644 application/dialogs/ModEditDialogCommon.cpp create mode 100644 application/dialogs/ModEditDialogCommon.h create mode 100644 application/dialogs/NewInstanceDialog.cpp create mode 100644 application/dialogs/NewInstanceDialog.h create mode 100644 application/dialogs/NewInstanceDialog.ui create mode 100644 application/dialogs/NotificationDialog.cpp create mode 100644 application/dialogs/NotificationDialog.h create mode 100644 application/dialogs/NotificationDialog.ui create mode 100644 application/dialogs/ProgressDialog.cpp create mode 100644 application/dialogs/ProgressDialog.h create mode 100644 application/dialogs/ProgressDialog.ui create mode 100644 application/dialogs/UpdateDialog.cpp create mode 100644 application/dialogs/UpdateDialog.h create mode 100644 application/dialogs/UpdateDialog.ui create mode 100644 application/dialogs/VersionSelectDialog.cpp create mode 100644 application/dialogs/VersionSelectDialog.h create mode 100644 application/dialogs/VersionSelectDialog.ui create mode 100644 application/groupview/GroupView.cpp create mode 100644 application/groupview/GroupView.h create mode 100644 application/groupview/GroupedProxyModel.cpp create mode 100644 application/groupview/GroupedProxyModel.h create mode 100644 application/groupview/InstanceDelegate.cpp create mode 100644 application/groupview/InstanceDelegate.h create mode 100644 application/groupview/VisualGroup.cpp create mode 100644 application/groupview/VisualGroup.h create mode 100644 application/install_prereqs.cmake.in create mode 100644 application/main.cpp create mode 100755 application/package/linux/MultiMC create mode 100644 application/pagedialog/PageDialog.cpp create mode 100644 application/pagedialog/PageDialog.h create mode 100644 application/pages/BasePage.h create mode 100644 application/pages/BasePageProvider.h create mode 100644 application/pages/InstanceSettingsPage.cpp create mode 100644 application/pages/InstanceSettingsPage.h create mode 100644 application/pages/InstanceSettingsPage.ui create mode 100644 application/pages/LogPage.cpp create mode 100644 application/pages/LogPage.h create mode 100644 application/pages/LogPage.ui create mode 100644 application/pages/ModFolderPage.cpp create mode 100644 application/pages/ModFolderPage.h create mode 100644 application/pages/ModFolderPage.ui create mode 100644 application/pages/NotesPage.cpp create mode 100644 application/pages/NotesPage.h create mode 100644 application/pages/NotesPage.ui create mode 100644 application/pages/OtherLogsPage.cpp create mode 100644 application/pages/OtherLogsPage.h create mode 100644 application/pages/OtherLogsPage.ui create mode 100644 application/pages/ResourcePackPage.h create mode 100644 application/pages/ScreenshotsPage.cpp create mode 100644 application/pages/ScreenshotsPage.h create mode 100644 application/pages/ScreenshotsPage.ui create mode 100644 application/pages/TexturePackPage.h create mode 100644 application/pages/VersionPage.cpp create mode 100644 application/pages/VersionPage.h create mode 100644 application/pages/VersionPage.ui create mode 100644 application/pages/global/AccountListPage.cpp create mode 100644 application/pages/global/AccountListPage.h create mode 100644 application/pages/global/AccountListPage.ui create mode 100644 application/pages/global/ExternalToolsPage.cpp create mode 100644 application/pages/global/ExternalToolsPage.h create mode 100644 application/pages/global/ExternalToolsPage.ui create mode 100644 application/pages/global/JavaPage.cpp create mode 100644 application/pages/global/JavaPage.h create mode 100644 application/pages/global/JavaPage.ui create mode 100644 application/pages/global/MinecraftPage.cpp create mode 100644 application/pages/global/MinecraftPage.h create mode 100644 application/pages/global/MinecraftPage.ui create mode 100644 application/pages/global/MultiMCPage.cpp create mode 100644 application/pages/global/MultiMCPage.h create mode 100644 application/pages/global/MultiMCPage.ui create mode 100644 application/pages/global/ProxyPage.cpp create mode 100644 application/pages/global/ProxyPage.h create mode 100644 application/pages/global/ProxyPage.ui create mode 100644 application/resources/MultiMC.icns create mode 100644 application/resources/MultiMC.ico create mode 100644 application/resources/MultiMC.manifest create mode 100644 application/resources/OSX/OSX.qrc create mode 100644 application/resources/OSX/index.theme create mode 100644 application/resources/OSX/scalable/about.svg create mode 100644 application/resources/OSX/scalable/accounts.svg create mode 100644 application/resources/OSX/scalable/bug.svg create mode 100644 application/resources/OSX/scalable/centralmods.svg create mode 100644 application/resources/OSX/scalable/checkupdate.svg create mode 100644 application/resources/OSX/scalable/copy.svg create mode 100644 application/resources/OSX/scalable/coremods.svg create mode 100644 application/resources/OSX/scalable/externaltools.svg create mode 100644 application/resources/OSX/scalable/instance-settings.svg create mode 100644 application/resources/OSX/scalable/jarmods.svg create mode 100644 application/resources/OSX/scalable/java.svg create mode 100644 application/resources/OSX/scalable/loadermods.svg create mode 100644 application/resources/OSX/scalable/log.svg create mode 100644 application/resources/OSX/scalable/minecraft.svg create mode 100644 application/resources/OSX/scalable/multimc.svg create mode 100644 application/resources/OSX/scalable/new.svg create mode 100644 application/resources/OSX/scalable/news.svg create mode 100644 application/resources/OSX/scalable/notes.svg create mode 100644 application/resources/OSX/scalable/patreon.svg create mode 100644 application/resources/OSX/scalable/proxy.svg create mode 100644 application/resources/OSX/scalable/quickmods.svg create mode 100644 application/resources/OSX/scalable/refresh.svg create mode 100644 application/resources/OSX/scalable/resourcepacks.svg create mode 100644 application/resources/OSX/scalable/screenshots.svg create mode 100644 application/resources/OSX/scalable/settings.svg create mode 100644 application/resources/OSX/scalable/status-bad.svg create mode 100644 application/resources/OSX/scalable/status-good.svg create mode 100644 application/resources/OSX/scalable/status-yellow.svg create mode 100644 application/resources/OSX/scalable/viewfolder.svg create mode 100644 application/resources/backgrounds/backgrounds.qrc create mode 100644 application/resources/backgrounds/catbgrnd2.png create mode 100644 application/resources/iOS/iOS.qrc create mode 100644 application/resources/iOS/index.theme create mode 100644 application/resources/iOS/scalable/about.svg create mode 100644 application/resources/iOS/scalable/accounts.svg create mode 100644 application/resources/iOS/scalable/bug.svg create mode 100644 application/resources/iOS/scalable/centralmods.svg create mode 100644 application/resources/iOS/scalable/checkupdate.svg create mode 100644 application/resources/iOS/scalable/copy.svg create mode 100644 application/resources/iOS/scalable/coremods.svg create mode 100644 application/resources/iOS/scalable/externaltools.svg create mode 100644 application/resources/iOS/scalable/instance-settings.svg create mode 100644 application/resources/iOS/scalable/jarmods.svg create mode 100644 application/resources/iOS/scalable/java.svg create mode 100644 application/resources/iOS/scalable/loadermods.svg create mode 100644 application/resources/iOS/scalable/log.svg create mode 100644 application/resources/iOS/scalable/minecraft.svg create mode 100644 application/resources/iOS/scalable/multimc.svg create mode 100644 application/resources/iOS/scalable/new.svg create mode 100644 application/resources/iOS/scalable/news.svg create mode 100644 application/resources/iOS/scalable/notes.svg create mode 100644 application/resources/iOS/scalable/patreon.svg create mode 100644 application/resources/iOS/scalable/proxy.svg create mode 100644 application/resources/iOS/scalable/quickmods.svg create mode 100644 application/resources/iOS/scalable/refresh.svg create mode 100644 application/resources/iOS/scalable/resourcepacks.svg create mode 100644 application/resources/iOS/scalable/screenshots.svg create mode 100644 application/resources/iOS/scalable/settings.svg create mode 100644 application/resources/iOS/scalable/status-bad.svg create mode 100644 application/resources/iOS/scalable/status-good.svg create mode 100644 application/resources/iOS/scalable/status-yellow.svg create mode 100644 application/resources/iOS/scalable/viewfolder.svg create mode 100644 application/resources/instances/brick.png create mode 100644 application/resources/instances/broken.png create mode 100644 application/resources/instances/chicken.png create mode 100644 application/resources/instances/chicken128.png create mode 100644 application/resources/instances/creeper.png create mode 100644 application/resources/instances/creeper128.png create mode 100644 application/resources/instances/derp.png create mode 100644 application/resources/instances/diamond.png create mode 100644 application/resources/instances/dirt.png create mode 100644 application/resources/instances/enderman.png create mode 100644 application/resources/instances/enderpearl.png create mode 100644 application/resources/instances/enderpearl128.png create mode 100644 application/resources/instances/ftb_glow.png create mode 100644 application/resources/instances/ftb_glow128.png create mode 100644 application/resources/instances/ftb_logo.png create mode 100644 application/resources/instances/ftb_logo128.png create mode 100644 application/resources/instances/gear.png create mode 100644 application/resources/instances/gear128.png create mode 100644 application/resources/instances/gold.png create mode 100644 application/resources/instances/grass.png create mode 100644 application/resources/instances/herobrine.png create mode 100644 application/resources/instances/herobrine128.png create mode 100644 application/resources/instances/infinity.png create mode 100644 application/resources/instances/infinity128.png create mode 100644 application/resources/instances/instances.qrc create mode 100644 application/resources/instances/iron.png create mode 100644 application/resources/instances/kitten.png create mode 100644 application/resources/instances/magitech.png create mode 100644 application/resources/instances/magitech128.png create mode 100644 application/resources/instances/meat.png create mode 100644 application/resources/instances/meat128.png create mode 100644 application/resources/instances/netherstar.png create mode 100644 application/resources/instances/netherstar128.png create mode 100644 application/resources/instances/planks.png create mode 100644 application/resources/instances/skeleton.png create mode 100644 application/resources/instances/skeleton128.png create mode 100644 application/resources/instances/squarecreeper.png create mode 100644 application/resources/instances/squarecreeper128.png create mode 100644 application/resources/instances/steve.png create mode 100644 application/resources/instances/steve128.png create mode 100644 application/resources/instances/stone.png create mode 100644 application/resources/instances/tnt.png create mode 100644 application/resources/instances/updateavailable.png create mode 100644 application/resources/multimc.rc create mode 100644 application/resources/multimc/16x16/about.png create mode 100644 application/resources/multimc/16x16/bug.png create mode 100644 application/resources/multimc/16x16/cat.png create mode 100644 application/resources/multimc/16x16/centralmods.png create mode 100644 application/resources/multimc/16x16/checkupdate.png create mode 100644 application/resources/multimc/16x16/copy.png create mode 100644 application/resources/multimc/16x16/coremods.png create mode 100644 application/resources/multimc/16x16/help.png create mode 100644 application/resources/multimc/16x16/instance-settings.png create mode 100644 application/resources/multimc/16x16/jarmods.png create mode 100644 application/resources/multimc/16x16/loadermods.png create mode 100644 application/resources/multimc/16x16/log.png create mode 100644 application/resources/multimc/16x16/minecraft.png create mode 100644 application/resources/multimc/16x16/new.png create mode 100644 application/resources/multimc/16x16/news.png create mode 100644 application/resources/multimc/16x16/noaccount.png create mode 100644 application/resources/multimc/16x16/patreon.png create mode 100644 application/resources/multimc/16x16/refresh.png create mode 100644 application/resources/multimc/16x16/resourcepacks.png create mode 100644 application/resources/multimc/16x16/screenshots.png create mode 100644 application/resources/multimc/16x16/settings.png create mode 100644 application/resources/multimc/16x16/status-bad.png create mode 100644 application/resources/multimc/16x16/status-good.png create mode 100644 application/resources/multimc/16x16/status-yellow.png create mode 100644 application/resources/multimc/16x16/viewfolder.png create mode 100644 application/resources/multimc/22x22/about.png create mode 100644 application/resources/multimc/22x22/bug.png create mode 100644 application/resources/multimc/22x22/cat.png create mode 100644 application/resources/multimc/22x22/centralmods.png create mode 100644 application/resources/multimc/22x22/checkupdate.png create mode 100644 application/resources/multimc/22x22/copy.png create mode 100644 application/resources/multimc/22x22/help.png create mode 100644 application/resources/multimc/22x22/instance-settings.png create mode 100644 application/resources/multimc/22x22/new.png create mode 100644 application/resources/multimc/22x22/news.png create mode 100644 application/resources/multimc/22x22/patreon.png create mode 100644 application/resources/multimc/22x22/refresh.png create mode 100644 application/resources/multimc/22x22/screenshots.png create mode 100644 application/resources/multimc/22x22/settings.png create mode 100644 application/resources/multimc/22x22/status-bad.png create mode 100644 application/resources/multimc/22x22/status-good.png create mode 100644 application/resources/multimc/22x22/status-yellow.png create mode 100644 application/resources/multimc/22x22/viewfolder.png create mode 100644 application/resources/multimc/24x24/cat.png create mode 100644 application/resources/multimc/24x24/coremods.png create mode 100644 application/resources/multimc/24x24/jarmods.png create mode 100644 application/resources/multimc/24x24/loadermods.png create mode 100644 application/resources/multimc/24x24/log.png create mode 100644 application/resources/multimc/24x24/minecraft.png create mode 100644 application/resources/multimc/24x24/noaccount.png create mode 100644 application/resources/multimc/24x24/patreon.png create mode 100644 application/resources/multimc/24x24/resourcepacks.png create mode 100644 application/resources/multimc/24x24/status-bad.png create mode 100644 application/resources/multimc/24x24/status-good.png create mode 100644 application/resources/multimc/24x24/status-yellow.png create mode 100644 application/resources/multimc/256x256/minecraft.png create mode 100644 application/resources/multimc/32x32/about.png create mode 100644 application/resources/multimc/32x32/bug.png create mode 100644 application/resources/multimc/32x32/cat.png create mode 100644 application/resources/multimc/32x32/centralmods.png create mode 100644 application/resources/multimc/32x32/checkupdate.png create mode 100644 application/resources/multimc/32x32/copy.png create mode 100644 application/resources/multimc/32x32/coremods.png create mode 100644 application/resources/multimc/32x32/help.png create mode 100644 application/resources/multimc/32x32/instance-settings.png create mode 100644 application/resources/multimc/32x32/jarmods.png create mode 100644 application/resources/multimc/32x32/loadermods.png create mode 100644 application/resources/multimc/32x32/log.png create mode 100644 application/resources/multimc/32x32/minecraft.png create mode 100644 application/resources/multimc/32x32/new.png create mode 100644 application/resources/multimc/32x32/news.png create mode 100644 application/resources/multimc/32x32/noaccount.png create mode 100644 application/resources/multimc/32x32/patreon.png create mode 100644 application/resources/multimc/32x32/refresh.png create mode 100644 application/resources/multimc/32x32/resourcepacks.png create mode 100644 application/resources/multimc/32x32/screenshots.png create mode 100644 application/resources/multimc/32x32/settings.png create mode 100644 application/resources/multimc/32x32/status-bad.png create mode 100644 application/resources/multimc/32x32/status-good.png create mode 100644 application/resources/multimc/32x32/status-yellow.png create mode 100644 application/resources/multimc/32x32/viewfolder.png create mode 100644 application/resources/multimc/48x48/about.png create mode 100644 application/resources/multimc/48x48/bug.png create mode 100644 application/resources/multimc/48x48/cat.png create mode 100644 application/resources/multimc/48x48/centralmods.png create mode 100644 application/resources/multimc/48x48/checkupdate.png create mode 100644 application/resources/multimc/48x48/copy.png create mode 100644 application/resources/multimc/48x48/help.png create mode 100644 application/resources/multimc/48x48/instance-settings.png create mode 100644 application/resources/multimc/48x48/log.png create mode 100644 application/resources/multimc/48x48/minecraft.png create mode 100644 application/resources/multimc/48x48/new.png create mode 100644 application/resources/multimc/48x48/news.png create mode 100644 application/resources/multimc/48x48/noaccount.png create mode 100644 application/resources/multimc/48x48/patreon.png create mode 100644 application/resources/multimc/48x48/refresh.png create mode 100644 application/resources/multimc/48x48/screenshots.png create mode 100644 application/resources/multimc/48x48/settings.png create mode 100644 application/resources/multimc/48x48/status-bad.png create mode 100644 application/resources/multimc/48x48/status-good.png create mode 100644 application/resources/multimc/48x48/status-yellow.png create mode 100644 application/resources/multimc/48x48/viewfolder.png create mode 100644 application/resources/multimc/64x64/about.png create mode 100644 application/resources/multimc/64x64/bug.png create mode 100644 application/resources/multimc/64x64/cat.png create mode 100644 application/resources/multimc/64x64/centralmods.png create mode 100644 application/resources/multimc/64x64/checkupdate.png create mode 100644 application/resources/multimc/64x64/copy.png create mode 100644 application/resources/multimc/64x64/coremods.png create mode 100644 application/resources/multimc/64x64/help.png create mode 100644 application/resources/multimc/64x64/instance-settings.png create mode 100644 application/resources/multimc/64x64/jarmods.png create mode 100644 application/resources/multimc/64x64/loadermods.png create mode 100644 application/resources/multimc/64x64/log.png create mode 100644 application/resources/multimc/64x64/new.png create mode 100644 application/resources/multimc/64x64/news.png create mode 100644 application/resources/multimc/64x64/patreon.png create mode 100644 application/resources/multimc/64x64/refresh.png create mode 100644 application/resources/multimc/64x64/resourcepacks.png create mode 100644 application/resources/multimc/64x64/screenshots.png create mode 100644 application/resources/multimc/64x64/settings.png create mode 100644 application/resources/multimc/64x64/status-bad.png create mode 100644 application/resources/multimc/64x64/status-good.png create mode 100644 application/resources/multimc/64x64/status-yellow.png create mode 100644 application/resources/multimc/64x64/viewfolder.png create mode 100644 application/resources/multimc/8x8/noaccount.png create mode 100644 application/resources/multimc/index.theme create mode 100644 application/resources/multimc/multimc.qrc create mode 100644 application/resources/multimc/scalable/bug.svg create mode 100644 application/resources/multimc/scalable/centralmods.svg create mode 100644 application/resources/multimc/scalable/checkupdate.svg create mode 100644 application/resources/multimc/scalable/console.svg create mode 100644 application/resources/multimc/scalable/console_error.svg create mode 100644 application/resources/multimc/scalable/java.svg create mode 100644 application/resources/multimc/scalable/multimc.svg create mode 100644 application/resources/multimc/scalable/new.svg create mode 100644 application/resources/multimc/scalable/news.svg create mode 100644 application/resources/multimc/scalable/proxy.svg create mode 100644 application/resources/multimc/scalable/screenshot-placeholder.svg create mode 100644 application/resources/multimc/scalable/screenshots.svg create mode 100644 application/resources/multimc/scalable/status-bad.svg create mode 100644 application/resources/multimc/scalable/status-good.svg create mode 100644 application/resources/multimc/scalable/status-yellow.svg create mode 100644 application/resources/multimc/scalable/viewfolder.svg create mode 100644 application/resources/pe_blue/index.theme create mode 100644 application/resources/pe_blue/pe_blue.qrc create mode 100644 application/resources/pe_blue/scalable/about.svg create mode 100644 application/resources/pe_blue/scalable/accounts.svg create mode 100644 application/resources/pe_blue/scalable/bug.svg create mode 100644 application/resources/pe_blue/scalable/centralmods.svg create mode 100644 application/resources/pe_blue/scalable/checkupdate.svg create mode 100644 application/resources/pe_blue/scalable/copy.svg create mode 100644 application/resources/pe_blue/scalable/coremods.svg create mode 100644 application/resources/pe_blue/scalable/externaltools.svg create mode 100644 application/resources/pe_blue/scalable/instance-settings.svg create mode 100644 application/resources/pe_blue/scalable/jarmods.svg create mode 100644 application/resources/pe_blue/scalable/java.svg create mode 100644 application/resources/pe_blue/scalable/loadermods.svg create mode 100644 application/resources/pe_blue/scalable/log.svg create mode 100644 application/resources/pe_blue/scalable/minecraft.svg create mode 100644 application/resources/pe_blue/scalable/multimc.svg create mode 100644 application/resources/pe_blue/scalable/new.svg create mode 100644 application/resources/pe_blue/scalable/news.svg create mode 100644 application/resources/pe_blue/scalable/notes.svg create mode 100644 application/resources/pe_blue/scalable/patreon.svg create mode 100644 application/resources/pe_blue/scalable/proxy.svg create mode 100644 application/resources/pe_blue/scalable/quickmods.svg create mode 100644 application/resources/pe_blue/scalable/refresh.svg create mode 100644 application/resources/pe_blue/scalable/resourcepacks.svg create mode 100644 application/resources/pe_blue/scalable/screenshots.svg create mode 100644 application/resources/pe_blue/scalable/settings.svg create mode 100644 application/resources/pe_blue/scalable/status-bad.svg create mode 100644 application/resources/pe_blue/scalable/status-good.svg create mode 100644 application/resources/pe_blue/scalable/status-yellow.svg create mode 100644 application/resources/pe_blue/scalable/viewfolder.svg create mode 100644 application/resources/pe_colored/index.theme create mode 100644 application/resources/pe_colored/pe_colored.qrc create mode 100644 application/resources/pe_colored/scalable/about.svg create mode 100644 application/resources/pe_colored/scalable/accounts.svg create mode 100644 application/resources/pe_colored/scalable/bug.svg create mode 100644 application/resources/pe_colored/scalable/centralmods.svg create mode 100644 application/resources/pe_colored/scalable/checkupdate.svg create mode 100644 application/resources/pe_colored/scalable/copy.svg create mode 100644 application/resources/pe_colored/scalable/coremods.svg create mode 100644 application/resources/pe_colored/scalable/externaltools.svg create mode 100644 application/resources/pe_colored/scalable/instance-settings.svg create mode 100644 application/resources/pe_colored/scalable/jarmods.svg create mode 100644 application/resources/pe_colored/scalable/java.svg create mode 100644 application/resources/pe_colored/scalable/loadermods.svg create mode 100644 application/resources/pe_colored/scalable/log.svg create mode 100644 application/resources/pe_colored/scalable/minecraft.svg create mode 100644 application/resources/pe_colored/scalable/multimc.svg create mode 100644 application/resources/pe_colored/scalable/new.svg create mode 100644 application/resources/pe_colored/scalable/news.svg create mode 100644 application/resources/pe_colored/scalable/notes.svg create mode 100644 application/resources/pe_colored/scalable/patreon.svg create mode 100644 application/resources/pe_colored/scalable/proxy.svg create mode 100644 application/resources/pe_colored/scalable/quickmods.svg create mode 100644 application/resources/pe_colored/scalable/refresh.svg create mode 100644 application/resources/pe_colored/scalable/resourcepacks.svg create mode 100644 application/resources/pe_colored/scalable/screenshots.svg create mode 100644 application/resources/pe_colored/scalable/settings.svg create mode 100644 application/resources/pe_colored/scalable/status-bad.svg create mode 100644 application/resources/pe_colored/scalable/status-good.svg create mode 100644 application/resources/pe_colored/scalable/status-yellow.svg create mode 100644 application/resources/pe_colored/scalable/viewfolder.svg create mode 100644 application/resources/pe_dark/index.theme create mode 100644 application/resources/pe_dark/pe_dark.qrc create mode 100644 application/resources/pe_dark/scalable/about.svg create mode 100644 application/resources/pe_dark/scalable/accounts.svg create mode 100644 application/resources/pe_dark/scalable/bug.svg create mode 100644 application/resources/pe_dark/scalable/centralmods.svg create mode 100644 application/resources/pe_dark/scalable/checkupdate.svg create mode 100644 application/resources/pe_dark/scalable/copy.svg create mode 100644 application/resources/pe_dark/scalable/coremods.svg create mode 100644 application/resources/pe_dark/scalable/externaltools.svg create mode 100644 application/resources/pe_dark/scalable/instance-settings.svg create mode 100644 application/resources/pe_dark/scalable/jarmods.svg create mode 100644 application/resources/pe_dark/scalable/java.svg create mode 100644 application/resources/pe_dark/scalable/loadermods.svg create mode 100644 application/resources/pe_dark/scalable/log.svg create mode 100644 application/resources/pe_dark/scalable/minecraft.svg create mode 100644 application/resources/pe_dark/scalable/multimc.svg create mode 100644 application/resources/pe_dark/scalable/new.svg create mode 100644 application/resources/pe_dark/scalable/news.svg create mode 100644 application/resources/pe_dark/scalable/notes.svg create mode 100644 application/resources/pe_dark/scalable/patreon.svg create mode 100644 application/resources/pe_dark/scalable/proxy.svg create mode 100644 application/resources/pe_dark/scalable/quickmods.svg create mode 100644 application/resources/pe_dark/scalable/refresh.svg create mode 100644 application/resources/pe_dark/scalable/resourcepacks.svg create mode 100644 application/resources/pe_dark/scalable/screenshots.svg create mode 100644 application/resources/pe_dark/scalable/settings.svg create mode 100644 application/resources/pe_dark/scalable/status-bad.svg create mode 100644 application/resources/pe_dark/scalable/status-good.svg create mode 100644 application/resources/pe_dark/scalable/status-yellow.svg create mode 100644 application/resources/pe_dark/scalable/viewfolder.svg create mode 100644 application/resources/pe_light/index.theme create mode 100644 application/resources/pe_light/pe_light.qrc create mode 100644 application/resources/pe_light/scalable/about.svg create mode 100644 application/resources/pe_light/scalable/accounts.svg create mode 100644 application/resources/pe_light/scalable/bug.svg create mode 100644 application/resources/pe_light/scalable/centralmods.svg create mode 100644 application/resources/pe_light/scalable/checkupdate.svg create mode 100644 application/resources/pe_light/scalable/copy.svg create mode 100644 application/resources/pe_light/scalable/coremods.svg create mode 100644 application/resources/pe_light/scalable/externaltools.svg create mode 100644 application/resources/pe_light/scalable/instance-settings.svg create mode 100644 application/resources/pe_light/scalable/jarmods.svg create mode 100644 application/resources/pe_light/scalable/java.svg create mode 100644 application/resources/pe_light/scalable/loadermods.svg create mode 100644 application/resources/pe_light/scalable/log.svg create mode 100644 application/resources/pe_light/scalable/minecraft.svg create mode 100644 application/resources/pe_light/scalable/multimc.svg create mode 100644 application/resources/pe_light/scalable/new.svg create mode 100644 application/resources/pe_light/scalable/news.svg create mode 100644 application/resources/pe_light/scalable/notes.svg create mode 100644 application/resources/pe_light/scalable/patreon.svg create mode 100644 application/resources/pe_light/scalable/proxy.svg create mode 100644 application/resources/pe_light/scalable/quickmods.svg create mode 100644 application/resources/pe_light/scalable/refresh.svg create mode 100644 application/resources/pe_light/scalable/resourcepacks.svg create mode 100644 application/resources/pe_light/scalable/screenshots.svg create mode 100644 application/resources/pe_light/scalable/settings.svg create mode 100644 application/resources/pe_light/scalable/status-bad.svg create mode 100644 application/resources/pe_light/scalable/status-good.svg create mode 100644 application/resources/pe_light/scalable/status-yellow.svg create mode 100644 application/resources/pe_light/scalable/viewfolder.svg create mode 100644 application/resources/sources/clucker.svg create mode 100644 application/resources/sources/creeper.svg create mode 100644 application/resources/sources/enderpearl.svg create mode 100644 application/resources/sources/ftb-glow.svg create mode 100644 application/resources/sources/ftb-logo.svg create mode 100644 application/resources/sources/gear.svg create mode 100644 application/resources/sources/herobrine.svg create mode 100644 application/resources/sources/magitech.svg create mode 100644 application/resources/sources/meat.svg create mode 100644 application/resources/sources/netherstar.svg create mode 100644 application/resources/sources/pskeleton.svg create mode 100644 application/resources/sources/skeleton.svg create mode 100644 application/resources/sources/squarecreeper.svg create mode 100644 application/resources/sources/steve.svg create mode 100644 application/resources/versions/LWJGL/2.9.0.json create mode 100644 application/resources/versions/LWJGL/2.9.1-nightly-20130708-debug3.json create mode 100644 application/resources/versions/LWJGL/2.9.1.json create mode 100644 application/resources/versions/LWJGL/2.9.2-nightly-20140822.json create mode 100644 application/resources/versions/minecraft.json create mode 100644 application/resources/versions/versions.qrc create mode 100644 application/widgets/Common.cpp create mode 100644 application/widgets/Common.h create mode 100644 application/widgets/IconLabel.cpp create mode 100644 application/widgets/IconLabel.h create mode 100644 application/widgets/LabeledToolButton.cpp create mode 100644 application/widgets/LabeledToolButton.h create mode 100644 application/widgets/LineSeparator.cpp create mode 100644 application/widgets/LineSeparator.h create mode 100644 application/widgets/MCModInfoFrame.cpp create mode 100644 application/widgets/MCModInfoFrame.h create mode 100644 application/widgets/MCModInfoFrame.ui create mode 100644 application/widgets/ModListView.cpp create mode 100644 application/widgets/ModListView.h create mode 100644 application/widgets/PageContainer.cpp create mode 100644 application/widgets/PageContainer.h create mode 100644 application/widgets/PageContainer_p.h create mode 100644 application/widgets/ServerStatus.cpp create mode 100644 application/widgets/ServerStatus.h create mode 100644 application/widgets/VersionListView.cpp create mode 100644 application/widgets/VersionListView.h (limited to 'application') diff --git a/application/BuildConfig.cpp.in b/application/BuildConfig.cpp.in new file mode 100644 index 00000000..04cfbf05 --- /dev/null +++ b/application/BuildConfig.cpp.in @@ -0,0 +1,56 @@ +#include "BuildConfig.h" +#include + +Config BuildConfig; + +Config::Config() +{ + // Version information + VERSION_MAJOR = @MultiMC_VERSION_MAJOR@; + VERSION_MINOR = @MultiMC_VERSION_MINOR@; + VERSION_HOTFIX = @MultiMC_VERSION_HOTFIX@; + VERSION_BUILD = @MultiMC_VERSION_BUILD@; + + VERSION_CHANNEL = "@MultiMC_VERSION_CHANNEL@"; + BUILD_PLATFORM = "@MultiMC_BUILD_PLATFORM@"; + CHANLIST_URL = "@MultiMC_CHANLIST_URL@"; + NOTIFICATION_URL = "@MultiMC_NOTIFICATION_URL@"; + FULL_VERSION_STR = "@MultiMC_VERSION_MAJOR@.@MultiMC_VERSION_MINOR@.@MultiMC_VERSION_BUILD@"; + + UPDATER_DRY_RUN = @MultiMC_UPDATER_DRY_RUN_value@; + UPDATER_FORCE_LOCAL = @MultiMC_UPDATER_FORCE_LOCAL_value@; + + GIT_COMMIT = "@MultiMC_GIT_COMMIT@"; + VERSION_STR = "@MultiMC_VERSION_STRING@"; + NEWS_RSS_URL = "@MultiMC_NEWS_RSS_URL@"; +} + +QString Config::printableVersionString() const +{ + QString vstr = QString("%1.%2").arg(QString::number(VERSION_MAJOR), QString::number(VERSION_MINOR)); + + if (VERSION_HOTFIX > 0) vstr += "." + QString::number(VERSION_HOTFIX); + + // If the build is a development build or release candidate, add that info to the end. + if(VERSION_CHANNEL == "stable") + { + return vstr; + } + else if(VERSION_CHANNEL == "develop") + { + vstr += "-dev-" + QString::number(VERSION_BUILD); + } + else if(VERSION_CHANNEL == "unstable") + { + vstr += "-nuke-" + QString::number(VERSION_BUILD); + } + else if(VERSION_CHANNEL == "custom") + { + vstr += "-local"; + } + else + { + vstr += "-" + VERSION_CHANNEL + "-" + QString::number(VERSION_BUILD); + } + return vstr; +} diff --git a/application/BuildConfig.h b/application/BuildConfig.h new file mode 100644 index 00000000..60aefeb4 --- /dev/null +++ b/application/BuildConfig.h @@ -0,0 +1,63 @@ +#pragma once +#include + +/** + * \brief The Config class holds all the build-time information passed from the build system. + */ +class Config +{ +public: + Config(); + /// The major version number. + int VERSION_MAJOR; + /// The minor version number. + int VERSION_MINOR; + /// The hotfix number. + int VERSION_HOTFIX; + /// The build number. + int VERSION_BUILD; + + /** + * The version channel + * This is used by the updater to determine what channel the current version came from. + */ + QString VERSION_CHANNEL; + + /// A short string identifying this build's platform. For example, "lin64" or "win32". + QString BUILD_PLATFORM; + + /// URL for the updater's channel + QString CHANLIST_URL; + + /// URL for notifications + QString NOTIFICATION_URL; + + /// Used for matching notifications + QString FULL_VERSION_STR; + + /// enabled for updater dry run + bool UPDATER_DRY_RUN; + + /// enabled for updater dry run + bool UPDATER_FORCE_LOCAL; + + /// The commit hash of this build + QString GIT_COMMIT; + + /// This is printed on start to standard output + QString VERSION_STR; + + /** + * This is used to fetch the news RSS feed. + * It defaults in CMakeLists.txt to "http://multimc.org/rss.xml" + */ + QString NEWS_RSS_URL; + + /** + * \brief Converts the Version to a string. + * \return The version number in string format (major.minor.revision.build). + */ + QString printableVersionString() const; +}; + +extern Config BuildConfig; diff --git a/application/CMakeLists.txt b/application/CMakeLists.txt new file mode 100644 index 00000000..58a90efa --- /dev/null +++ b/application/CMakeLists.txt @@ -0,0 +1,473 @@ +project(MultiMC-Application) + +######## Set URLs ######## +set(MultiMC_NEWS_RSS_URL "http://multimc.org/rss.xml" CACHE STRING "URL to fetch MultiMC's news RSS feed from.") + +######## Set version numbers ######## +set(MultiMC_VERSION_MAJOR 0) +set(MultiMC_VERSION_MINOR 4) +set(MultiMC_VERSION_HOTFIX 5) + +# Build number +set(MultiMC_VERSION_BUILD -1 CACHE STRING "Build number. -1 for no build number.") + +# Version type +set(MultiMC_VERSION_TYPE "Custom" CACHE STRING "MultiMC's version type. This should be one of 'Custom', 'Release', 'ReleaseCandidate', or 'Development', depending on what type of version this is.") + +# Build platform. +set(MultiMC_BUILD_PLATFORM "" CACHE STRING "A short string identifying the platform that this build was built for. Only used by the notification system and to display in the about dialog.") + +# Version channel +set(MultiMC_VERSION_CHANNEL "" CACHE STRING "The current build's channel. Included in the version string.") + +# Channel list URL +set(MultiMC_CHANLIST_URL "" CACHE STRING "URL for the channel list.") + +# Updater enabled? +set(MultiMC_UPDATER false CACHE BOOL "Whether or not the update system is enabled. If this is enabled, you must also set MultiMC_CHANLIST_URL and MultiMC_VERSION_CHANNEL in order for it to work properly.") + +# Notification URL +set(MultiMC_NOTIFICATION_URL "" CACHE STRING "URL for checking for notifications.") + +set(MultiMC_RELEASE_VERSION_NAME "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}") +if(MultiMC_VERSION_HOTFIX GREATER 0) + set(MultiMC_RELEASE_VERSION_NAME "${MultiMC_RELEASE_VERSION_NAME}.${MultiMC_VERSION_HOTFIX}") +endif() + +# Build a version string to display in the configure logs. +if(MultiMC_VERSION_TYPE STREQUAL "Custom") + message(STATUS "Version Type: Custom") + set(MultiMC_VERSION_STRING "${MultiMC_RELEASE_VERSION_NAME}") +elseif(MultiMC_VERSION_TYPE STREQUAL "Release") + message(STATUS "Version Type: Stable Release") + set(MultiMC_VERSION_STRING "${MultiMC_RELEASE_VERSION_NAME}") +elseif(MultiMC_VERSION_TYPE STREQUAL "Development") + message(STATUS "Version Type: Development") + set(MultiMC_VERSION_STRING "${MultiMC_RELEASE_VERSION_NAME}-dev${MultiMC_VERSION_BUILD}") +else() + message(ERROR "Invalid build type.") +endif() + +message(STATUS "MultiMC 5 Version: ${MultiMC_VERSION_STRING}") + +# If the update system is enabled, make sure MultiMC_CHANLIST_URL and MultiMC_VERSION_CHANNEL are set. +if(MultiMC_UPDATER) + if(MultiMC_VERSION_CHANNEL STREQUAL "") + message(FATAL_ERROR "Update system is enabled, but MultiMC_VERSION_CHANNEL is not set.\n" + "Please ensure the CMake variables MultiMC_VERSION_CHANNEL, MultiMC_CHANLIST_URL, and MultiMC_VERSION_BUILD are set.") + endif() + if(MultiMC_CHANLIST_URL STREQUAL "") + message(FATAL_ERROR "Update system is enabled, but MultiMC_CHANLIST_URL is not set.\n" + "Please ensure the CMake variables MultiMC_VERSION_CHANNEL, MultiMC_CHANLIST_URL, and MultiMC_VERSION_BUILD are set.") + endif() + if(MultiMC_VERSION_BUILD LESS 0) + message(FATAL_ERROR "Update system is enabled, but MultiMC_VERSION_BUILD is not set.\n" + "Please ensure the CMake variables MultiMC_VERSION_CHANNEL, MultiMC_CHANLIST_URL, and MultiMC_VERSION_BUILD are set.") + endif() + message(STATUS "Updater is enabled. Channel list URL: ${MultiMC_CHANLIST_URL}") +endif() + +#### Updater-related build config options #### +option(MultiMC_UPDATER_DRY_RUN "Enable updater dry-run mode -- for updater development." OFF) +option(MultiMC_UPDATER_FORCE_LOCAL "Do not download updated updater -- for updater development." OFF) + +if(MultiMC_UPDATER_DRY_RUN) + set(MultiMC_UPDATER_DRY_RUN_value "true") +else() + set(MultiMC_UPDATER_DRY_RUN_value "false") +endif() + +if(MultiMC_UPDATER_FORCE_LOCAL) + set(MultiMC_UPDATER_FORCE_LOCAL_value "true") +else() + set(MultiMC_UPDATER_FORCE_LOCAL_value "false") +endif() + +######## Configure header ######## +configure_file("${PROJECT_SOURCE_DIR}/BuildConfig.cpp.in" "${PROJECT_BINARY_DIR}/BuildConfig.cpp") + +######## Packaging/install paths setup ######## + +if(UNIX AND APPLE) + set(BINARY_DEST_DIR MultiMC.app/Contents/MacOS) + set(PLUGIN_DEST_DIR MultiMC.app/Contents/MacOS) + set(QTCONF_DEST_DIR MultiMC.app/Contents/Resources) + set(APPS "\${CMAKE_INSTALL_PREFIX}/MultiMC.app") + + set(MACOSX_BUNDLE_BUNDLE_NAME "MultiMC") + set(MACOSX_BUNDLE_INFO_STRING "MultiMC Minecraft launcher and management utility.") + set(MACOSX_BUNDLE_GUI_IDENTIFIER "org.multimc.MultiMC5") + set(MACOSX_BUNDLE_BUNDLE_VERSION "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}.${MultiMC_VERSION_HOTFIX}.${MultiMC_VERSION_BUILD}") + set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}.${MultiMC_VERSION_HOTFIX}.${MultiMC_VERSION_BUILD}") + set(MACOSX_BUNDLE_LONG_VERSION_STRING "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}.${MultiMC_VERSION_HOTFIX}.${MultiMC_VERSION_BUILD}") + set(MACOSX_BUNDLE_ICON_FILE MultiMC.icns) + set(MACOSX_BUNDLE_COPYRIGHT "Copyright 2014 MultiMC Contributors") +elseif(UNIX) + set(BINARY_DEST_DIR bin) + set(PLUGIN_DEST_DIR plugins) + set(QTCONF_DEST_DIR .) + set(APPS "\${CMAKE_INSTALL_PREFIX}/bin/MultiMC") +elseif(WIN32) + set(BINARY_DEST_DIR .) + set(PLUGIN_DEST_DIR .) + set(QTCONF_DEST_DIR .) + set(APPS "\${CMAKE_INSTALL_PREFIX}/MultiMC.exe") +endif() + +# directories to look for dependencies +set(DIRS ${QT_LIBS_DIR} ${QT_LIBEXECS_DIR}) + +################################ FILES ################################ + +######## Sources and headers ######## +SET(MULTIMC_SOURCES + # Application base + main.cpp + MultiMC.h + MultiMC.cpp + BuildConfig.h + ${PROJECT_BINARY_DIR}/BuildConfig.cpp + + # GUI - general utilities + GuiUtil.h + GuiUtil.cpp + ColumnResizer.h + ColumnResizer.cpp + InstanceProxyModel.h + InstanceProxyModel.cpp + + # GUI - windows + MainWindow.h + MainWindow.cpp + ConsoleWindow.h + ConsoleWindow.cpp + + # page provider for instances + InstancePageProvider.h + InstancePageProvider.cpp + + # Annoying nag screen logic + NagUtils.h + NagUtils.cpp + + + # GUI - page dialog pages + pages/BasePage.h + pages/VersionPage.cpp + pages/VersionPage.h + pages/TexturePackPage.h + pages/ResourcePackPage.h + pages/ModFolderPage.cpp + pages/ModFolderPage.h + pages/NotesPage.cpp + pages/NotesPage.h + pages/LogPage.cpp + pages/LogPage.h + pages/InstanceSettingsPage.cpp + pages/InstanceSettingsPage.h + pages/ScreenshotsPage.cpp + pages/ScreenshotsPage.h + pages/OtherLogsPage.cpp + pages/OtherLogsPage.h + + # GUI - global settings pages + pages/global/AccountListPage.cpp + pages/global/AccountListPage.h + pages/global/ExternalToolsPage.cpp + pages/global/ExternalToolsPage.h + pages/global/JavaPage.cpp + pages/global/JavaPage.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 + + # GUI - dialogs + dialogs/AboutDialog.cpp + dialogs/AboutDialog.h + dialogs/AccountSelectDialog.cpp + dialogs/AccountSelectDialog.h + dialogs/CopyInstanceDialog.cpp + dialogs/CopyInstanceDialog.h + dialogs/CustomMessageBox.cpp + dialogs/CustomMessageBox.h + dialogs/EditAccountDialog.cpp + dialogs/EditAccountDialog.h + dialogs/IconPickerDialog.cpp + dialogs/IconPickerDialog.h + dialogs/LoginDialog.cpp + dialogs/LoginDialog.h + dialogs/ModEditDialogCommon.cpp + dialogs/ModEditDialogCommon.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 + + + # GUI - widgets + widgets/Common.cpp + widgets/Common.h + widgets/IconLabel.cpp + widgets/IconLabel.h + widgets/LabeledToolButton.cpp + widgets/LabeledToolButton.h + widgets/LineSeparator.cpp + widgets/LineSeparator.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 + + + # GUI - instance group view + groupview/GroupedProxyModel.cpp + groupview/GroupedProxyModel.h + groupview/GroupView.cpp + groupview/GroupView.h + groupview/InstanceDelegate.cpp + groupview/InstanceDelegate.h + groupview/VisualGroup.cpp + groupview/VisualGroup.h +) + +######## UIs ######## +SET(MULTIMC_UIS + # Option pages + pages/VersionPage.ui + pages/ModFolderPage.ui + pages/LogPage.ui + pages/InstanceSettingsPage.ui + pages/NotesPage.ui + pages/ScreenshotsPage.ui + pages/OtherLogsPage.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 + + # Dialogs + dialogs/CopyInstanceDialog.ui + dialogs/NewInstanceDialog.ui + dialogs/AboutDialog.ui + dialogs/VersionSelectDialog.ui + dialogs/ProgressDialog.ui + dialogs/IconPickerDialog.ui + dialogs/AccountSelectDialog.ui + dialogs/EditAccountDialog.ui + dialogs/LoginDialog.ui + dialogs/UpdateDialog.ui + dialogs/NotificationDialog.ui + + # Widgets/other + 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/instances/instances.qrc + resources/versions/versions.qrc +) + +######## Windows resource files ######## +if(WIN32) + set(MULTIMC_RCS resources/multimc.rc) +endif() + +####### X11 Stuff ####### +if(UNIX AND NOT APPLE) + find_package(Qt5X11Extras REQUIRED) + set(MultiMC_LINK_ADDITIONAL_LIBS ${MultiMC_LINK_ADDITIONAL_LIBS} xcb Qt5::X11Extras) + list(APPEND MULTIMC_SOURCES Platform_X11.cpp) +else() + list(APPEND MULTIMC_SOURCES Platform_Other.cpp) +endif() + + +# Link additional libraries +if(WIN32) + set(MultiMC_LINK_ADDITIONAL_LIBS ${MultiMC_LINK_ADDITIONAL_LIBS} Qt5::WinMain) +endif(WIN32) + +include_directories(../logic) + +# 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_logic xz-embedded unpack200 iconfix libUtil LogicalGui + ${QUAZIP_LIBRARIES} Qt5::Core Qt5::Xml Qt5::Widgets Qt5::Network Qt5::Concurrent Qt5::WebKitWidgets + ${MultiMC_LINK_ADDITIONAL_LIBS}) + +################################ INSTALLATION AND PACKAGING ################################ + +######## Install ######## + +#### Executable #### +if(APPLE AND UNIX) ## OSX + install(TARGETS MultiMC + BUNDLE DESTINATION . COMPONENT Runtime + RUNTIME DESTINATION MultiMC.app/Contents/MacOS COMPONENT Runtime + ) + +elseif(UNIX) ## LINUX and similar + install(TARGETS MultiMC + BUNDLE DESTINATION . COMPONENT Runtime + RUNTIME DESTINATION bin COMPONENT Runtime + ) + install(PROGRAMS package/linux/MultiMC DESTINATION .) + +elseif(WIN32) ## WINDOWS + install(TARGETS MultiMC + BUNDLE DESTINATION . COMPONENT Runtime + LIBRARY DESTINATION . COMPONENT Runtime + RUNTIME DESTINATION . COMPONENT Runtime + ) +endif() + +#### Java bits #### +install_jar(JavaCheck "${BINARY_DEST_DIR}/jars") +install_jar(NewLaunch "${BINARY_DEST_DIR}/jars") + +#### Dist package logic #### + +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" 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" EXCLUDE + REGEX "d\\." EXCLUDE + REGEX "_debug\\." EXCLUDE + ) + # Icon engines + install( + DIRECTORY "${QT_PLUGINS_DIR}/iconengines" + DESTINATION ${PLUGIN_DEST_DIR} + COMPONENT Runtime + REGEX "fontawesome" EXCLUDE + REGEX "d\\." EXCLUDE + REGEX "_debug\\." 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 + ) + if(APPLE) + # Accessible plugin to make buttons look decent on osx + install( + DIRECTORY "${QT_PLUGINS_DIR}/accessible" + DESTINATION ${PLUGIN_DEST_DIR} + COMPONENT Runtime + REGEX "quick" EXCLUDE + REGEX "d\\." EXCLUDE + REGEX "_debug\\." EXCLUDE + ) + endif() +endif() + +# qtconf +install( + CODE " +file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${QTCONF_DEST_DIR}/qt.conf\" \"\") +" + COMPONENT Runtime +) + +# ICNS file for OS X +if(APPLE) + install(FILES resources/MultiMC.icns DESTINATION MultiMC.app/Contents/Resources) +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) + + + +######## Package ######## + +# Package with CPack +if(UNIX) + if(APPLE) + set(CPACK_GENERATOR "ZIP") + else() + set(CPACK_GENERATOR "TGZ") + endif() +elseif(WIN32) + set(CPACK_GENERATOR "ZIP") +endif() +set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0) + +set(CPACK_PACKAGE_NAME "MultiMC 5") +set(CPACK_PACKAGE_VENDOR "") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MultiMC - Minecraft launcher and management tool.") +set(CPACK_PACKAGE_VERSION "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}.${MultiMC_VERSION_REV}.${MultiMC_VERSION_BUILD}") +set(CPACK_PACKAGE_VERSION_MAJOR ${MultiMC_VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${MultiMC_VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH ${MultiMC_VERSION_REV}) + +set(CPACK_PACKAGE_FILE_NAME "MultiMC") + +include(CPack) diff --git a/application/ColumnResizer.cpp b/application/ColumnResizer.cpp new file mode 100644 index 00000000..1c5597aa --- /dev/null +++ b/application/ColumnResizer.cpp @@ -0,0 +1,202 @@ +/* + * Copyright 2011 Aurélien Gâteau + * License: LGPL v2.1 or later (see COPYING) + */ +#include "ColumnResizer.h" + +#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; + } +} + +#include +// vi: ts=4 sw=4 et diff --git a/application/ColumnResizer.h b/application/ColumnResizer.h new file mode 100644 index 00000000..4bbac383 --- /dev/null +++ b/application/ColumnResizer.h @@ -0,0 +1,38 @@ +/* + * Copyright 2011 Aurélien Gâteau + * License: LGPL v2.1 or later (see COPYING) + */ +#pragma once + +#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; +}; diff --git a/application/ConsoleWindow.cpp b/application/ConsoleWindow.cpp new file mode 100644 index 00000000..52c68299 --- /dev/null +++ b/application/ConsoleWindow.cpp @@ -0,0 +1,260 @@ +/* Copyright 2013-2015 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 "ConsoleWindow.h" +#include "MultiMC.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include "widgets/PageContainer.h" +#include "pages/LogPage.h" +#include "InstancePageProvider.h" + +#include "icons/IconList.h" + +class LogPageProvider : public BasePageProvider +{ +public: + LogPageProvider(BasePageProviderPtr parent, BasePage * log_page) + { + m_parent = parent; + m_log_page = log_page; + } + virtual QString dialogTitle() {return "Fake";}; + virtual QList getPages() + { + auto pages = m_parent->getPages(); + pages.prepend(m_log_page); + return pages; + } +private: + BasePageProviderPtr m_parent; + BasePage * m_log_page; +}; + +ConsoleWindow::ConsoleWindow(BaseProcess *process, QWidget *parent) + : QMainWindow(parent), m_proc(process) +{ + MultiMCPlatform::fixWM_CLASS(this); + setAttribute(Qt::WA_DeleteOnClose); + + auto instance = m_proc->instance(); + auto icon = ENV.icons()->getIcon(instance->iconKey()); + QString windowTitle = tr("Console window for ") + instance->name(); + + // Set window properties + { + setWindowIcon(icon); + setWindowTitle(windowTitle); + } + + // Add page container + { + auto mainLayout = new QVBoxLayout; + auto provider = std::make_shared(m_proc->instance()); + auto baseprovider = std::dynamic_pointer_cast(provider); + auto proxy_provider = std::make_shared(baseprovider, new LogPage(m_proc)); + m_container = new PageContainer(proxy_provider, "console", this); + mainLayout->addWidget(m_container); + mainLayout->setSpacing(0); + mainLayout->setContentsMargins(0,0,0,0); + setLayout(mainLayout); + setCentralWidget(m_container); + } + + // 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(); + m_killButton->setText(tr("Kill Minecraft")); + horizontalLayout->addWidget(m_killButton); + connect(m_killButton, SIGNAL(clicked(bool)), SLOT(on_btnKillMinecraft_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 tray icon + { + m_trayIcon = new QSystemTrayIcon(icon, this); + m_trayIcon->setToolTip(windowTitle); + + connect(m_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), + SLOT(iconActivated(QSystemTrayIcon::ActivationReason))); + m_trayIcon->show(); + } + + // Set up signal connections + connect(m_proc, SIGNAL(ended(InstancePtr, int, QProcess::ExitStatus)), this, + SLOT(onEnded(InstancePtr, int, QProcess::ExitStatus))); + connect(m_proc, SIGNAL(prelaunch_failed(InstancePtr, int, QProcess::ExitStatus)), this, + SLOT(onEnded(InstancePtr, int, QProcess::ExitStatus))); + connect(m_proc, SIGNAL(launch_failed(InstancePtr)), this, + SLOT(onLaunchFailed(InstancePtr))); + + setMayClose(false); + + if (m_proc->instance()->settings().get("ShowConsole").toBool()) + { + show(); + } +} + +void ConsoleWindow::iconActivated(QSystemTrayIcon::ActivationReason reason) +{ + switch (reason) + { + case QSystemTrayIcon::Trigger: + { + toggleConsole(); + } + default: + return; + } +} + +void ConsoleWindow::on_closeButton_clicked() +{ + close(); +} + +void ConsoleWindow::setMayClose(bool mayclose) +{ + if(mayclose) + m_closeButton->setText(tr("Close")); + else + m_closeButton->setText(tr("Hide")); + m_mayclose = mayclose; +} + +void ConsoleWindow::toggleConsole() +{ + if (isVisible()) + { + if(!isActiveWindow()) + { + activateWindow(); + return; + } + hide(); + } + else + { + show(); + } +} + +void ConsoleWindow::closeEvent(QCloseEvent *event) +{ + if (!m_mayclose) + { + toggleConsole(); + event->ignore(); + } + else if(m_container->requestClose(event)) + { + MMC->settings()->set("ConsoleWindowState", saveState().toBase64()); + MMC->settings()->set("ConsoleWindowGeometry", saveGeometry().toBase64()); + + emit isClosing(); + m_trayIcon->hide(); + event->accept(); + } +} + +void ConsoleWindow::on_btnKillMinecraft_clicked() +{ + m_killButton->setEnabled(false); + auto response = CustomMessageBox::selectable( + this, 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) + m_proc->killProcess(); + else + m_killButton->setEnabled(true); +} + +void ConsoleWindow::onEnded(InstancePtr instance, int code, QProcess::ExitStatus status) +{ + bool peacefulExit = code == 0 && status != QProcess::CrashExit; + m_killButton->setEnabled(false); + setMayClose(true); + if (instance->settings().get("AutoCloseConsole").toBool()) + { + if (peacefulExit) + { + this->close(); + return; + } + } + if (!isVisible()) + { + show(); + } + // Raise Window + if (MMC->settings()->get("RaiseConsole").toBool()) + { + raise(); + activateWindow(); + } +} + +void ConsoleWindow::onLaunchFailed(InstancePtr instance) +{ + m_killButton->setEnabled(false); + + setMayClose(true); + + if (!isVisible()) + show(); +} +ConsoleWindow::~ConsoleWindow() +{ + +} diff --git a/application/ConsoleWindow.h b/application/ConsoleWindow.h new file mode 100644 index 00000000..6e3849c5 --- /dev/null +++ b/application/ConsoleWindow.h @@ -0,0 +1,65 @@ +/* Copyright 2013-2015 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 "BaseProcess.h" + +class QPushButton; +class PageContainer; +class ConsoleWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit ConsoleWindow(BaseProcess *proc, QWidget *parent = 0); + virtual ~ConsoleWindow(); + + /** + * @brief specify if the window is allowed to close + * @param mayclose + * used to keep it alive while MC runs + */ + void setMayClose(bool mayclose); + +signals: + void isClosing(); + +private +slots: + void on_closeButton_clicked(); + void on_btnKillMinecraft_clicked(); + + void onEnded(InstancePtr instance, int code, QProcess::ExitStatus status); + void onLaunchFailed(InstancePtr instance); + + // FIXME: add handlers for the other MinecraftProcess signals (pre/post launch command + // failures) + + void iconActivated(QSystemTrayIcon::ActivationReason); + void toggleConsole(); +protected: + void closeEvent(QCloseEvent *); + +private: + BaseProcess *m_proc = nullptr; + bool m_mayclose = true; + QSystemTrayIcon *m_trayIcon = nullptr; + PageContainer *m_container = nullptr; + QPushButton *m_closeButton = nullptr; + QPushButton *m_killButton = nullptr; +}; diff --git a/application/GuiUtil.cpp b/application/GuiUtil.cpp new file mode 100644 index 00000000..fb42b9bc --- /dev/null +++ b/application/GuiUtil.cpp @@ -0,0 +1,48 @@ +#include "GuiUtil.h" + +#include +#include +#include + +#include "dialogs/ProgressDialog.h" +#include "net/PasteUpload.h" +#include "dialogs/CustomMessageBox.h" + +void GuiUtil::uploadPaste(const QString &text, QWidget *parentWidget) +{ + ProgressDialog dialog(parentWidget); + std::unique_ptr paste(new PasteUpload(parentWidget, text)); + + 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; + } + + dialog.exec(paste.get()); + if (!paste->successful()) + { + CustomMessageBox::selectable(parentWidget, QObject::tr("Upload failed"), + paste->failReason(), QMessageBox::Critical)->exec(); + } + else + { + const QString link = paste->pasteLink(); + setClipboardText(link); + QDesktopServices::openUrl(link); + CustomMessageBox::selectable( + parentWidget, QObject::tr("Upload finished"), + QObject::tr("The link to the uploaded log has been opened in " + "the default " + "browser and placed in your clipboard.").arg(link), + QMessageBox::Information)->exec(); + } +} + +void GuiUtil::setClipboardText(const QString &text) +{ + QApplication::clipboard()->setText(text); +} diff --git a/application/GuiUtil.h b/application/GuiUtil.h new file mode 100644 index 00000000..9f872f75 --- /dev/null +++ b/application/GuiUtil.h @@ -0,0 +1,9 @@ +#pragma once + +#include + +namespace GuiUtil +{ +void uploadPaste(const QString &text, QWidget *parentWidget); +void setClipboardText(const QString &text); +} diff --git a/application/InstancePageProvider.cpp b/application/InstancePageProvider.cpp new file mode 100644 index 00000000..e69de29b diff --git a/application/InstancePageProvider.h b/application/InstancePageProvider.h new file mode 100644 index 00000000..a19e21c8 --- /dev/null +++ b/application/InstancePageProvider.h @@ -0,0 +1,52 @@ +#pragma once +#include "minecraft/OneSixInstance.h" +#include "pages/BasePage.h" +#include "pages/VersionPage.h" +#include "pages/ModFolderPage.h" +#include "pages/ResourcePackPage.h" +#include "pages/TexturePackPage.h" +#include "pages/NotesPage.h" +#include "pages/ScreenshotsPage.h" +#include "pages/InstanceSettingsPage.h" +#include "pages/OtherLogsPage.h" +#include "pages/BasePageProvider.h" +#include + +class InstancePageProvider : public QObject, public BasePageProvider +{ + Q_OBJECT +public: + explicit InstancePageProvider(InstancePtr parent) + { + inst = parent; + } + + virtual ~InstancePageProvider() {}; + virtual QList getPages() override + { + QList values; + std::shared_ptr onesix = std::dynamic_pointer_cast(inst); + if(onesix) + { + values.append(new VersionPage(onesix.get())); + values.append(new ModFolderPage(onesix.get(), onesix->loaderModList(), "mods", "loadermods", + tr("Loader mods"), "Loader-mods")); + 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 ScreenshotsPage(PathCombine(onesix->minecraftRoot(), "screenshots"))); + values.append(new InstanceSettingsPage(onesix.get())); + values.append(new OtherLogsPage(onesix->minecraftRoot())); + } + 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 new file mode 100644 index 00000000..2048252c --- /dev/null +++ b/application/InstanceProxyModel.cpp @@ -0,0 +1,23 @@ +#include "InstanceProxyModel.h" +#include "MultiMC.h" +#include + +InstanceProxyModel::InstanceProxyModel(QObject *parent) : GroupedProxyModel(parent) +{ +} + +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 new file mode 100644 index 00000000..e558efc4 --- /dev/null +++ b/application/InstanceProxyModel.h @@ -0,0 +1,13 @@ +#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); + +protected: + virtual bool subSortLessThan(const QModelIndex &left, const QModelIndex &right) const; +}; diff --git a/application/MainWindow.cpp b/application/MainWindow.cpp new file mode 100644 index 00000000..8e235e19 --- /dev/null +++ b/application/MainWindow.cpp @@ -0,0 +1,2069 @@ +/* Copyright 2013-2015 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 + +class Ui_MainWindow +{ +public: + QAction *actionAddInstance; + QAction *actionViewInstanceFolder; + QAction *actionRefresh; + QAction *actionViewCentralModsFolder; + QAction *actionCheckUpdate; + QAction *actionSettings; + QAction *actionReportBug; + QAction *actionPatreon; + QAction *actionMoreNews; + QAction *actionAbout; + QAction *actionLaunchInstance; + QAction *actionRenameInstance; + QAction *actionChangeInstGroup; + QAction *actionChangeInstIcon; + QAction *actionEditInstNotes; + QAction *actionEditInstance; + QAction *actionViewSelectedInstFolder; + QAction *actionDeleteInstance; + QAction *actionConfig_Folder; + QAction *actionCAT; + QAction *actionCopyInstance; + QAction *actionManageAccounts; + QAction *actionLaunchInstanceOffline; + QAction *actionScreenshots; + QAction *actionInstanceSettings; + QAction *actionExportInstance; + QWidget *centralWidget; + QHBoxLayout *horizontalLayout; + QToolBar *mainToolBar; + QStatusBar *statusBar; + QToolBar *instanceToolBar; + QToolBar *newsToolBar; + + void setupUi(QMainWindow *MainWindow) + { + if (MainWindow->objectName().isEmpty()) + { + MainWindow->setObjectName(QStringLiteral("MainWindow")); + } + MainWindow->resize(694, 563); + MainWindow->setWindowIcon(MMC->getThemedIcon("multimc")); + actionAddInstance = new QAction(MainWindow); + actionAddInstance->setObjectName(QStringLiteral("actionAddInstance")); + actionAddInstance->setIcon(MMC->getThemedIcon("new")); + actionViewInstanceFolder = new QAction(MainWindow); + actionViewInstanceFolder->setObjectName(QStringLiteral("actionViewInstanceFolder")); + actionViewInstanceFolder->setIcon(MMC->getThemedIcon("viewfolder")); + actionRefresh = new QAction(MainWindow); + actionRefresh->setObjectName(QStringLiteral("actionRefresh")); + actionRefresh->setIcon(MMC->getThemedIcon("refresh")); + actionViewCentralModsFolder = new QAction(MainWindow); + actionViewCentralModsFolder->setObjectName(QStringLiteral("actionViewCentralModsFolder")); + actionViewCentralModsFolder->setIcon(MMC->getThemedIcon("centralmods")); + actionCheckUpdate = new QAction(MainWindow); + actionCheckUpdate->setObjectName(QStringLiteral("actionCheckUpdate")); + actionCheckUpdate->setIcon(MMC->getThemedIcon("checkupdate")); + actionSettings = new QAction(MainWindow); + actionSettings->setObjectName(QStringLiteral("actionSettings")); + actionSettings->setIcon(MMC->getThemedIcon("settings")); + actionSettings->setMenuRole(QAction::PreferencesRole); + actionReportBug = new QAction(MainWindow); + actionReportBug->setObjectName(QStringLiteral("actionReportBug")); + actionReportBug->setIcon(MMC->getThemedIcon("bug")); + actionPatreon = new QAction(MainWindow); + actionPatreon->setObjectName(QStringLiteral("actionPatreon")); + actionPatreon->setIcon(MMC->getThemedIcon("patreon")); + actionMoreNews = new QAction(MainWindow); + actionMoreNews->setObjectName(QStringLiteral("actionMoreNews")); + actionMoreNews->setIcon(MMC->getThemedIcon("news")); + actionAbout = new QAction(MainWindow); + actionAbout->setObjectName(QStringLiteral("actionAbout")); + actionAbout->setIcon(MMC->getThemedIcon("about")); + actionAbout->setMenuRole(QAction::AboutRole); + actionLaunchInstance = new QAction(MainWindow); + actionLaunchInstance->setObjectName(QStringLiteral("actionLaunchInstance")); + actionRenameInstance = new QAction(MainWindow); + actionRenameInstance->setObjectName(QStringLiteral("actionRenameInstance")); + actionChangeInstGroup = new QAction(MainWindow); + actionChangeInstGroup->setObjectName(QStringLiteral("actionChangeInstGroup")); + actionChangeInstIcon = new QAction(MainWindow); + actionChangeInstIcon->setObjectName(QStringLiteral("actionChangeInstIcon")); + actionChangeInstIcon->setEnabled(true); + actionChangeInstIcon->setIcon(QIcon(":/icons/instances/infinity")); + actionChangeInstIcon->setIconVisibleInMenu(true); + actionEditInstNotes = new QAction(MainWindow); + actionEditInstNotes->setObjectName(QStringLiteral("actionEditInstNotes")); + actionEditInstance = new QAction(MainWindow); + actionEditInstance->setObjectName(QStringLiteral("actionEditInstance")); + actionViewSelectedInstFolder = new QAction(MainWindow); + actionViewSelectedInstFolder->setObjectName(QStringLiteral("actionViewSelectedInstFolder")); + actionDeleteInstance = new QAction(MainWindow); + actionDeleteInstance->setObjectName(QStringLiteral("actionDeleteInstance")); + actionConfig_Folder = new QAction(MainWindow); + actionConfig_Folder->setObjectName(QStringLiteral("actionConfig_Folder")); + actionCAT = new QAction(MainWindow); + actionCAT->setObjectName(QStringLiteral("actionCAT")); + actionCAT->setCheckable(true); + actionCAT->setIcon(MMC->getThemedIcon("cat")); + actionCopyInstance = new QAction(MainWindow); + actionCopyInstance->setObjectName(QStringLiteral("actionCopyInstance")); + actionCopyInstance->setIcon(MMC->getThemedIcon("copy")); + actionManageAccounts = new QAction(MainWindow); + actionManageAccounts->setObjectName(QStringLiteral("actionManageAccounts")); + actionLaunchInstanceOffline = new QAction(MainWindow); + actionLaunchInstanceOffline->setObjectName(QStringLiteral("actionLaunchInstanceOffline")); + actionScreenshots = new QAction(MainWindow); + actionScreenshots->setObjectName(QStringLiteral("actionScreenshots")); + actionInstanceSettings = new QAction(MainWindow); + actionInstanceSettings->setObjectName(QStringLiteral("actionInstanceSettings")); + actionExportInstance = new QAction(MainWindow); + actionExportInstance->setObjectName(QStringLiteral("actionExportInstance")); + centralWidget = new QWidget(MainWindow); + centralWidget->setObjectName(QStringLiteral("centralWidget")); + horizontalLayout = new QHBoxLayout(centralWidget); + horizontalLayout->setSpacing(0); + horizontalLayout->setContentsMargins(11, 11, 11, 11); + horizontalLayout->setObjectName(QStringLiteral("horizontalLayout")); + horizontalLayout->setSizeConstraint(QLayout::SetDefaultConstraint); + horizontalLayout->setContentsMargins(0, 0, 0, 0); + MainWindow->setCentralWidget(centralWidget); + mainToolBar = new QToolBar(MainWindow); + mainToolBar->setObjectName(QStringLiteral("mainToolBar")); + mainToolBar->setMovable(false); + mainToolBar->setAllowedAreas(Qt::TopToolBarArea); + mainToolBar->setToolButtonStyle(Qt::ToolButtonIconOnly); + mainToolBar->setFloatable(false); + MainWindow->addToolBar(Qt::TopToolBarArea, mainToolBar); + statusBar = new QStatusBar(MainWindow); + statusBar->setObjectName(QStringLiteral("statusBar")); + MainWindow->setStatusBar(statusBar); + instanceToolBar = new QToolBar(MainWindow); + instanceToolBar->setObjectName(QStringLiteral("instanceToolBar")); + instanceToolBar->setEnabled(true); + instanceToolBar->setAllowedAreas(Qt::LeftToolBarArea|Qt::RightToolBarArea); + instanceToolBar->setIconSize(QSize(80, 80)); + instanceToolBar->setToolButtonStyle(Qt::ToolButtonIconOnly); + instanceToolBar->setFloatable(false); + MainWindow->addToolBar(Qt::RightToolBarArea, instanceToolBar); + newsToolBar = new QToolBar(MainWindow); + newsToolBar->setObjectName(QStringLiteral("newsToolBar")); + newsToolBar->setMovable(false); + newsToolBar->setAllowedAreas(Qt::BottomToolBarArea); + newsToolBar->setIconSize(QSize(16, 16)); + newsToolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); + newsToolBar->setFloatable(false); + MainWindow->addToolBar(Qt::BottomToolBarArea, newsToolBar); + + mainToolBar->addAction(actionAddInstance); + mainToolBar->addAction(actionCopyInstance); + mainToolBar->addSeparator(); + mainToolBar->addAction(actionViewInstanceFolder); + mainToolBar->addAction(actionViewCentralModsFolder); + mainToolBar->addAction(actionRefresh); + mainToolBar->addSeparator(); + mainToolBar->addAction(actionCheckUpdate); + mainToolBar->addAction(actionSettings); + mainToolBar->addSeparator(); + mainToolBar->addAction(actionReportBug); + mainToolBar->addAction(actionAbout); + mainToolBar->addSeparator(); + mainToolBar->addAction(actionPatreon); + mainToolBar->addAction(actionCAT); + instanceToolBar->addAction(actionChangeInstIcon); + instanceToolBar->addAction(actionLaunchInstance); + instanceToolBar->addAction(actionLaunchInstanceOffline); + instanceToolBar->addAction(actionChangeInstGroup); + instanceToolBar->addSeparator(); + instanceToolBar->addAction(actionEditInstance); + instanceToolBar->addAction(actionInstanceSettings); + instanceToolBar->addAction(actionEditInstNotes); + instanceToolBar->addAction(actionScreenshots); + instanceToolBar->addSeparator(); + instanceToolBar->addAction(actionViewSelectedInstFolder); + instanceToolBar->addAction(actionConfig_Folder); + instanceToolBar->addSeparator(); + instanceToolBar->addAction(actionExportInstance); + instanceToolBar->addAction(actionDeleteInstance); + newsToolBar->addAction(actionMoreNews); + + retranslateUi(MainWindow); + + QMetaObject::connectSlotsByName(MainWindow); + } // setupUi + + void retranslateUi(QMainWindow *MainWindow) + { + MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MultiMC 5", 0)); + actionAddInstance->setText(QApplication::translate("MainWindow", "Add Instance", 0)); + actionAddInstance->setToolTip(QApplication::translate("MainWindow", "Add a new instance.", 0)); + actionAddInstance->setStatusTip(QApplication::translate("MainWindow", "Add a new instance.", 0)); + actionViewInstanceFolder->setText(QApplication::translate("MainWindow", "View Instance Folder", 0)); + actionViewInstanceFolder->setToolTip(QApplication::translate("MainWindow", "Open the instance folder in a file browser.", 0)); + actionViewInstanceFolder->setStatusTip(QApplication::translate("MainWindow", "Open the instance folder in a file browser.", 0)); + actionRefresh->setText(QApplication::translate("MainWindow", "Refresh", 0)); + actionRefresh->setToolTip(QApplication::translate("MainWindow", "Reload the instance list.", 0)); + actionRefresh->setStatusTip(QApplication::translate("MainWindow", "Reload the instance list.", 0)); + actionViewCentralModsFolder->setText(QApplication::translate("MainWindow", "View Central Mods Folder", 0)); + actionViewCentralModsFolder->setToolTip(QApplication::translate("MainWindow", "Open the central mods folder in a file browser.", 0)); + actionViewCentralModsFolder->setStatusTip(QApplication::translate("MainWindow", "Open the central mods folder in a file browser.", 0)); + actionCheckUpdate->setText(QApplication::translate("MainWindow", "Check for Updates", 0)); + actionCheckUpdate->setToolTip(QApplication::translate("MainWindow", "Check for new updates for MultiMC", 0)); + actionCheckUpdate->setStatusTip(QApplication::translate("MainWindow", "Check for new updates for MultiMC", 0)); + actionSettings->setText(QApplication::translate("MainWindow", "Settings", 0)); + actionSettings->setToolTip(QApplication::translate("MainWindow", "Change settings.", 0)); + actionSettings->setStatusTip(QApplication::translate("MainWindow", "Change settings.", 0)); + actionReportBug->setText(QApplication::translate("MainWindow", "Report a Bug", 0)); + actionReportBug->setToolTip(QApplication::translate("MainWindow", "Open the bug tracker to report a bug with MultiMC.", 0)); + actionReportBug->setStatusTip(QApplication::translate("MainWindow", "Open the bug tracker to report a bug with MultiMC.", 0)); + actionPatreon->setText(QApplication::translate("MainWindow", "Support us on Patreon!", 0)); + actionPatreon->setToolTip(QApplication::translate("MainWindow", "Open the MultiMC Patreon page.", 0)); + actionPatreon->setStatusTip(QApplication::translate("MainWindow", "Open the MultiMC Patreon page.", 0)); + actionMoreNews->setText(QApplication::translate("MainWindow", "More News", 0)); + actionMoreNews->setIconText(QApplication::translate("MainWindow", "More news...", 0)); + actionMoreNews->setToolTip(QApplication::translate("MainWindow", "Open the MultiMC development blog to read more news about MultiMC.", 0)); + actionMoreNews->setStatusTip(QApplication::translate("MainWindow", "Open the MultiMC development blog to read more news about MultiMC.", 0)); + actionAbout->setText(QApplication::translate("MainWindow", "About MultiMC", 0)); + actionAbout->setToolTip(QApplication::translate("MainWindow", "View information about MultiMC.", 0)); + actionAbout->setStatusTip(QApplication::translate("MainWindow", "About MultiMC", 0)); + actionLaunchInstance->setText(QApplication::translate("MainWindow", "Play", 0)); + actionLaunchInstance->setToolTip(QApplication::translate("MainWindow", "Launch the selected instance.", 0)); + actionLaunchInstance->setStatusTip(QApplication::translate("MainWindow", "Launch the selected instance.", 0)); + actionRenameInstance->setText(QApplication::translate("MainWindow", "Instance Name", 0)); + actionRenameInstance->setToolTip(QApplication::translate("MainWindow", "Rename the selected instance.", 0)); + actionRenameInstance->setStatusTip(QApplication::translate("MainWindow", "Rename the selected instance.", 0)); + actionChangeInstGroup->setText(QApplication::translate("MainWindow", "Change Group", 0)); + actionChangeInstGroup->setToolTip(QApplication::translate("MainWindow", "Change the selected instance's group.", 0)); + actionChangeInstGroup->setStatusTip(QApplication::translate("MainWindow", "Change the selected instance's group.", 0)); + actionChangeInstIcon->setText(QApplication::translate("MainWindow", "Change Icon", 0)); + actionChangeInstIcon->setToolTip(QApplication::translate("MainWindow", "Change the selected instance's icon.", 0)); + actionChangeInstIcon->setStatusTip(QApplication::translate("MainWindow", "Change the selected instance's icon.", 0)); + actionEditInstNotes->setText(QApplication::translate("MainWindow", "Edit Notes", 0)); + actionEditInstNotes->setToolTip(QApplication::translate("MainWindow", "Edit the notes for the selected instance.", 0)); + actionEditInstNotes->setStatusTip(QApplication::translate("MainWindow", "Edit the notes for the selected instance.", 0)); + actionEditInstance->setText(QApplication::translate("MainWindow", "Edit Instance", 0)); + actionEditInstance->setIconText(QApplication::translate("MainWindow", "Edit Instance", 0)); + actionEditInstance->setToolTip(QApplication::translate("MainWindow", "Change the instance settings, mods and versions.", 0)); + actionEditInstance->setStatusTip(QApplication::translate("MainWindow", "Change the instance settings, mods and versions.", 0)); + actionViewSelectedInstFolder->setText(QApplication::translate("MainWindow", "Instance Folder", 0)); + actionViewSelectedInstFolder->setToolTip(QApplication::translate("MainWindow", "Open the selected instance's root folder in a file browser.", 0)); + actionViewSelectedInstFolder->setStatusTip(QApplication::translate("MainWindow", "Open the selected instance's root folder in a file browser.", 0)); + actionDeleteInstance->setText(QApplication::translate("MainWindow", "Delete", 0)); + actionDeleteInstance->setToolTip(QApplication::translate("MainWindow", "Delete the selected instance.", 0)); + actionDeleteInstance->setStatusTip(QApplication::translate("MainWindow", "Delete the selected instance.", 0)); + actionConfig_Folder->setText(QApplication::translate("MainWindow", "Config Folder", 0)); + actionConfig_Folder->setToolTip(QApplication::translate("MainWindow", "Open the instance's config folder", 0)); + actionCAT->setText(QApplication::translate("MainWindow", "Meow", 0)); + actionCAT->setToolTip(QApplication::translate("MainWindow", "

It's a fluffy kitty :3

", 0)); + actionCopyInstance->setText(QApplication::translate("MainWindow", "Copy Instance", 0)); + actionCopyInstance->setToolTip(QApplication::translate("MainWindow", "Copy the selected instance.", 0)); + actionCopyInstance->setStatusTip(QApplication::translate("MainWindow", "Add a new instance.", 0)); + actionManageAccounts->setText(QApplication::translate("MainWindow", "Manage Accounts", 0)); + actionManageAccounts->setToolTip(QApplication::translate("MainWindow", "Manage your Mojang or Minecraft accounts.", 0)); + actionLaunchInstanceOffline->setText(QApplication::translate("MainWindow", "Play Offline", 0)); + actionLaunchInstanceOffline->setToolTip(QApplication::translate("MainWindow", "Launch the selected instance in offline mode.", 0)); + actionLaunchInstanceOffline->setStatusTip(QApplication::translate("MainWindow", "Launch the selected instance.", 0)); + actionScreenshots->setText(QApplication::translate("MainWindow", "Manage Screenshots", 0)); + actionScreenshots->setToolTip(QApplication::translate("MainWindow", "

View and upload screenshots for this instance

", 0)); + actionInstanceSettings->setText(QApplication::translate("MainWindow", "Instance Settings", 0)); + actionInstanceSettings->setToolTip(QApplication::translate("MainWindow", "Change the settings specific to the instance", 0)); + actionExportInstance->setText(QApplication::translate("MainWindow", "Export Instance", 0)); + mainToolBar->setWindowTitle(QApplication::translate("MainWindow", "Main Toolbar", 0)); + instanceToolBar->setWindowTitle(QApplication::translate("MainWindow", "Instance Toolbar", 0)); + newsToolBar->setWindowTitle(QApplication::translate("MainWindow", "News Toolbar", 0)); + } // retranslateUi + +}; + +namespace Ui { + class MainWindow: public Ui_MainWindow {}; +} // namespace Ui + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "osutils.h" +#include "userutils.h" +#include "pathutils.h" + +#include "groupview/GroupView.h" +#include "groupview/InstanceDelegate.h" +#include "InstanceProxyModel.h" + +#include "Platform.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/AccountSelectDialog.h" +#include "dialogs/UpdateDialog.h" +#include "dialogs/EditAccountDialog.h" +#include "dialogs/NotificationDialog.h" + +#include "pages/global/MultiMCPage.h" +#include "pages/global/ExternalToolsPage.h" +#include "pages/global/AccountListPage.h" +#include "pages/global/ProxyPage.h" +#include "pages/global/JavaPage.h" +#include "pages/global/MinecraftPage.h" + +#include "ConsoleWindow.h" +#include "pagedialog/PageDialog.h" + +#include "InstanceList.h" +#include "minecraft/MinecraftVersionList.h" +#include "minecraft/LwjglVersionList.h" +#include "icons/IconList.h" +#include "java/JavaVersionList.h" + +#include "auth/flows/AuthenticateTask.h" +#include "auth/flows/RefreshTask.h" + +#include "updater/DownloadTask.h" + +#include "news/NewsChecker.h" + +#include "net/URLConstants.h" +#include "net/NetJob.h" +#include "Env.h" + +#include "BaseInstance.h" +#include "BaseProcess.h" +#include "java/JavaUtils.h" +#include "NagUtils.h" +#include "InstancePageProvider.h" +#include "minecraft/SkinUtils.h" + +//#include "minecraft/LegacyInstance.h" + +#include +#include +#include +#include + +#include "tools/BaseProfiler.h" + +MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) +{ + MultiMCPlatform::fixWM_CLASS(this); + ui->setupUi(this); + + // initialize the news checker + m_newsChecker.reset(new NewsChecker(BuildConfig.NEWS_RSS_URL)); + + QString winTitle = + QString("MultiMC 5 - Version %1").arg(BuildConfig.printableVersionString()); + if (!BuildConfig.BUILD_PLATFORM.isEmpty()) + winTitle += " on " + BuildConfig.BUILD_PLATFORM; + setWindowTitle(winTitle); + + // 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())); + } + + // The instance action toolbar customizations + { + // disabled until we have an instance selected + ui->instanceToolBar->setEnabled(false); + + // the rename label is inside the rename tool button + renameButton = new LabeledToolButton(); + renameButton->setText("Instance Name"); + renameButton->setToolTip(ui->actionRenameInstance->toolTip()); + connect(renameButton, SIGNAL(clicked(bool)), SLOT(on_actionRenameInstance_triggered())); + ui->instanceToolBar->insertWidget(ui->actionLaunchInstance, renameButton); + ui->instanceToolBar->insertSeparator(ui->actionLaunchInstance); + renameButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + } + + // Add the news label to the news toolbar. + { + newsLabel = new QToolButton(); + newsLabel->setIcon(MMC->getThemedIcon("news")); + newsLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + newsLabel->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); + 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); + // view->setCategoryDrawer(drawer); + // view->setCollapsibleBlocks(true); + // view->setViewMode(QListView::IconMode); + // view->setFlow(QListView::LeftToRight); + // view->setWordWrap(true); + // view->setMouseTracking(true); + // view->viewport()->setAttribute(Qt::WA_Hover); + auto delegate = new ListViewDelegate(); + view->setItemDelegate(delegate); + // view->setSpacing(10); + // view->setUniformItemWidths(true); + + // do not show ugly blue border on the mac + view->setAttribute(Qt::WA_MacShowFocusRect, false); + + view->installEventFilter(this); + + proxymodel = new InstanceProxyModel(this); + // proxymodel->setSortRole(KCategorizedSortFilterProxyModel::CategorySortRole); + // proxymodel->setFilterRole(KCategorizedSortFilterProxyModel::CategorySortRole); + // proxymodel->setDynamicSortFilter ( true ); + + // FIXME: instList should be global-ish, or at least not tied to the main window... + // maybe the application itself? + proxymodel->setSourceModel(MMC->instances().get()); + proxymodel->sort(0); + view->setFrameShape(QFrame::NoFrame); + view->setModel(proxymodel); + + view->setContextMenuPolicy(Qt::CustomContextMenu); + connect(view, SIGNAL(customContextMenuRequested(const QPoint &)), this, + SLOT(showInstanceContextMenu(const QPoint &))); + + ui->horizontalLayout->addWidget(view); + } + // The cat background + { + bool cat_enable = MMC->settings()->get("TheCat").toBool(); + ui->actionCAT->setChecked(cat_enable); + connect(ui->actionCAT, SIGNAL(toggled(bool)), SLOT(onCatToggled(bool))); + setCatBackground(cat_enable); + } + // start instance when double-clicked + connect(view, SIGNAL(doubleClicked(const QModelIndex &)), this, + SLOT(instanceActivated(const QModelIndex &))); + // track the selection -- update the instance toolbar + connect(view->selectionModel(), + SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), this, + SLOT(instanceChanged(const QModelIndex &, const QModelIndex &))); + + // track icon changes and update the toolbar! + connect(ENV.icons().get(), SIGNAL(iconUpdated(QString)), SLOT(iconUpdated(QString))); + + // model reset -> selection is invalid. All the instance pointers are wrong. + // FIXME: stop using POINTERS everywhere + connect(MMC->instances().get(), SIGNAL(dataIsInvalid()), SLOT(selectionBad())); + + m_statusLeft = new QLabel(tr("No instance selected"), this); + m_statusRight = new ServerStatus(this); + statusBar()->addPermanentWidget(m_statusLeft, 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); + manageAccountsAction = new QAction(tr("Manage Accounts"), this); + manageAccountsAction->setCheckable(false); + connect(manageAccountsAction, SIGNAL(triggered(bool)), this, + SLOT(on_actionManageAccounts_triggered())); + + repopulateAccountsMenu(); + + accountMenuButton = new QToolButton(this); + accountMenuButton->setText(tr("Accounts")); + 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); + + // set up global pages dialog + { + 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(); + } + + // 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 != nullptr) + { + for (auto profile : account->profiles()) + { + auto meta = Env::getInstance().metacache()->resolveEntry("skins", profile.name + ".png"); + auto action = CacheDownload::make( + QUrl("http://" + URLConstants::SKINS_BASE + profile.name + ".png"), meta); + skin_dls.append(action); + meta->stale = true; + } + } + } + if (!skin_dls.isEmpty()) + { + auto job = new NetJob("Startup player skins download"); + connect(job, SIGNAL(succeeded()), SLOT(skinJobFinished())); + connect(job, SIGNAL(failed()), SLOT(skinJobFinished())); + for (auto action : skin_dls) + { + job->addNetAction(action); + } + skin_download_job.reset(job); + job->start(); + } + + // run the things that load and download other things... FIXME: this is NOT the place + // FIXME: invisible actions in the background = NOPE. + { + if (!MMC->minecraftlist()->isLoaded()) + { + m_versionLoadTask = MMC->minecraftlist()->getLoadTask(); + startTask(m_versionLoadTask); + } + if (!MMC->lwjgllist()->isLoaded()) + { + MMC->lwjgllist()->loadList(); + } + + m_newsChecker->reloadNews(); + updateNewsLabel(); + + // 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()) + { + auto updater = MMC->updateChecker(); + 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(); +} + +MainWindow::~MainWindow() +{ + delete ui; + delete proxymodel; +} + +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(); + + QAction *actionVoid = new QAction(m_selectedInstance->name(), this); + actionVoid->setEnabled(false); + + QAction *actionRename = new QAction(tr("Rename"), this); + actionRename->setToolTip(ui->actionRenameInstance->toolTip()); + + QAction *actionCopyInstance = new QAction(tr("Copy instance"), this); + actionCopyInstance->setToolTip(ui->actionCopyInstance->toolTip()); + + connect(actionRename, SIGNAL(triggered(bool)), + SLOT(on_actionRenameInstance_triggered())); + connect(actionCopyInstance, SIGNAL(triggered(bool)), + SLOT(on_actionCopyInstance_triggered())); + + actions.replace(1, actionRename); + actions.prepend(actionSep); + actions.prepend(actionVoid); + actions.append(actionCopyInstance); + } + else + { + QAction *actionVoid = new QAction(tr("MultiMC"), this); + actionVoid->setEnabled(false); + + QAction *actionCreateInstance = new QAction(tr("Create instance"), this); + actionCreateInstance->setToolTip(ui->actionAddInstance->toolTip()); + + connect(actionCreateInstance, SIGNAL(triggered(bool)), + SLOT(on_actionAddInstance_triggered())); + + actions.prepend(actionSep); + actions.prepend(actionVoid); + actions.append(actionCreateInstance); + } + QMenu myMenu; + myMenu.addActions(actions); + if (onInstance) + myMenu.setEnabled(m_selectedInstance->canLaunch()); + myMenu.exec(view->mapToGlobal(pos)); +} + +void MainWindow::updateToolsMenu() +{ + if (ui->actionLaunchInstance->menu()) + { + ui->actionLaunchInstance->menu()->deleteLater(); + } + QMenu *launchMenu = new QMenu(this); + QAction *normalLaunch = launchMenu->addAction(tr("Launch")); + connect(normalLaunch, &QAction::triggered, [this]() + { doLaunch(); }); + launchMenu->addSeparator()->setText(tr("Profilers")); + for (auto profiler : MMC->profilers().values()) + { + QAction *profilerAction = launchMenu->addAction(profiler->name()); + QString error; + if (!profiler->check(&error)) + { + profilerAction->setDisabled(true); + profilerAction->setToolTip( + tr("Profiler not setup correctly. Go into settings, \"External Tools\".")); + } + else + { + connect(profilerAction, &QAction::triggered, [this, profiler]() + { doLaunch(true, profiler.get()); }); + } + } + launchMenu->addSeparator()->setText(tr("Tools")); + for (auto tool : MMC->tools().values()) + { + QAction *toolAction = launchMenu->addAction(tool->name()); + QString error; + if (!tool->check(&error)) + { + toolAction->setDisabled(true); + toolAction->setToolTip( + tr("Tool not setup correctly. Go into settings, \"External Tools\".")); + } + else + { + connect(toolAction, &QAction::triggered, [this, tool]() + { tool->createDetachedTool(m_selectedInstance, this)->run(); }); + } + } + ui->actionLaunchInstance->setMenu(launchMenu); +} + +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 = accounts->activeAccount()->username(); + } + + if (accounts->count() <= 0) + { + QAction *action = new QAction(tr("No accounts added!"), this); + action->setEnabled(false); + accountMenu->addAction(action); + + accountMenu->addSeparator(); + } + else + { + // TODO: Nicer way to iterate? + for (int i = 0; i < accounts->count(); i++) + { + MojangAccountPtr account = accounts->at(i); + + // Styling hack + QAction *section = new QAction(account->username(), this); + section->setEnabled(false); + accountMenu->addAction(section); + + for (auto profile : account->profiles()) + { + QAction *action = new QAction(profile.name, this); + action->setData(account->username()); + action->setCheckable(true); + if (active_username == account->username()) + { + action->setChecked(true); + } + + action->setIcon(SkinUtils::getFaceFromCache(profile.name)); + 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(manageAccountsAction); +} + +/* + * 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) + { + accountMenuButton->setIcon(SkinUtils::getFaceFromCache(profile->name)); + return; + } + } + + // Set the icon to the "no account" icon. + accountMenuButton->setIcon(MMC->getThemedIcon("noaccount")); +} + +bool MainWindow::eventFilter(QObject *obj, QEvent *ev) +{ + if (obj == view) + { + if (ev->type() == QEvent::KeyPress) + { + QKeyEvent *keyEvent = static_cast(ev); + switch (keyEvent->key()) + { + case Qt::Key_Enter: + case Qt::Key_Return: + on_actionLaunchInstance_triggered(); + return true; + case Qt::Key_Delete: + on_actionDeleteInstance_triggered(); + return true; + case Qt::Key_F5: + on_actionRefresh_triggered(); + 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) +{ + UpdateDialog dlg; + UpdateAction action = (UpdateAction)dlg.exec(); + switch (action) + { + case UPDATE_LATER: + qDebug() << "Update will be installed later."; + break; + case UPDATE_NOW: + downloadUpdates(status); + break; + case UPDATE_ONEXIT: + downloadUpdates(status, true); + break; + } +} + +void MainWindow::updateNotAvailable() +{ + UpdateDialog dlg(false); + 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, bool installOnExit) +{ + qDebug() << "Downloading updates."; + // TODO: If the user chooses to update on exit, we should download updates in the + // background. + // Doing so is a bit complicated, because we'd have to make sure it finished downloading + // before actually exiting MultiMC. + ProgressDialog updateDlg(this); + status.rootPath = MMC->rootPath; + + GoUpdate::DownloadTask updateTask(status, &updateDlg); + // If the task succeeds, install the updates. + if (updateDlg.exec(&updateTask)) + { + UpdateFlags baseFlags = None; + if (BuildConfig.UPDATER_DRY_RUN) + baseFlags |= DryRun; + if (installOnExit) + MMC->installUpdates(updateTask.updateFilesDir(), baseFlags | OnExit); + else + MMC->installUpdates(updateTask.updateFilesDir(), baseFlags | RestartOnFinish); + } +} + +void MainWindow::onCatToggled(bool state) +{ + setCatBackground(state); + MMC->settings()->set("TheCat", state); +} + +void MainWindow::setCatBackground(bool enabled) +{ + if (enabled) + { + view->setStyleSheet("GroupView" + "{" + "background-image: url(:/backgrounds/kitteh);" + "background-attachment: fixed;" + "background-clip: padding;" + "background-position: top right;" + "background-repeat: none;" + "background-color:palette(base);" + "}"); + } + else + { + view->setStyleSheet(QString()); + } +} + +static QFileInfo findRecursive(const QString &dir, const QString &name) +{ + for (const auto info : QDir(dir).entryInfoList(QDir::NoDotAndDotDot | QDir::Dirs | QDir::Files, QDir::DirsLast)) + { + if (info.isFile() && info.fileName() == name) + { + return info; + } + else if (info.isDir()) + { + const QFileInfo res = findRecursive(info.absoluteFilePath(), name); + if (res.isFile() && res.exists()) + { + return res; + } + } + } + return QFileInfo(); +} + +// FIXME: eliminate, should not be needed +void MainWindow::waitForMinecraftVersions() +{ + if (!MMC->minecraftlist()->isLoaded() && m_versionLoadTask && + m_versionLoadTask->isRunning()) + { + QEventLoop waitLoop; + waitLoop.connect(m_versionLoadTask, SIGNAL(failed(QString)), SLOT(quit())); + waitLoop.connect(m_versionLoadTask, SIGNAL(succeeded()), SLOT(quit())); + waitLoop.exec(); + } +} + +void MainWindow::instanceFromZipPack(QString instName, QString instGroup, QString instIcon, QUrl url) +{ + InstancePtr newInstance; + + QString instancesDir = MMC->settings()->get("InstanceDir").toString(); + QString instDirName = DirNameFromString(instName, instancesDir); + QString instDir = PathCombine(instancesDir, instDirName); + + QString archivePath; + if (url.isLocalFile()) + { + archivePath = url.toLocalFile(); + } + else + { + const QString path = url.host() + '/' + url.path(); + auto entry = ENV.metacache()->resolveEntry("general", path); + CacheDownloadPtr dl = CacheDownload::make(url, entry); + NetJob job(tr("Modpack download")); + job.addNetAction(dl); + + // FIXME: possibly causes endless loop problems + ProgressDialog dlDialog(this); + if (dlDialog.exec(&job) != QDialog::Accepted) + { + return; + } + archivePath = entry->getFullPath(); + } + + QTemporaryDir extractTmpDir; + QDir extractDir(extractTmpDir.path()); + qDebug() << "Attempting to create instance from" << archivePath; + if (JlCompress::extractDir(archivePath, extractDir.absolutePath()).isEmpty()) + { + CustomMessageBox::selectable(this, tr("Error"), + tr("Failed to extract modpack"), QMessageBox::Warning)->show(); + return; + } + const QFileInfo instanceCfgFile = findRecursive(extractDir.absolutePath(), "instance.cfg"); + if (!instanceCfgFile.isFile() || !instanceCfgFile.exists()) + { + CustomMessageBox::selectable(this, tr("Error"), tr("Archive does not contain instance.cfg"))->show(); + return; + } + if (!copyPath(instanceCfgFile.absoluteDir().absolutePath(), instDir)) + { + CustomMessageBox::selectable(this, tr("Error"), tr("Unable to copy instance"))->show(); + return; + } + + auto error = MMC->instances()->loadInstance(newInstance, instDir); + QString errorMsg = tr("Failed to load instance %1: ").arg(instDirName); + switch (error) + { + case InstanceList::UnknownLoadError: + errorMsg += tr("Unkown error"); + CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show(); + return; + case InstanceList::NotAnInstance: + errorMsg += tr("Not an instance"); + CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show(); + return; + } + + newInstance->setName(instName); + newInstance->setIconKey(instIcon); + newInstance->setGroupInitial(instGroup); + MMC->instances()->add(InstancePtr(newInstance)); + MMC->instances()->saveGroupList(); + + finalizeInstance(newInstance); +} + +void MainWindow::instanceFromVersion(QString instName, QString instGroup, QString instIcon, BaseVersionPtr version) +{ + InstancePtr newInstance; + + QString instancesDir = MMC->settings()->get("InstanceDir").toString(); + QString instDirName = DirNameFromString(instName, instancesDir); + QString instDir = PathCombine(instancesDir, instDirName); + auto error = MMC->instances()->createInstance(newInstance, version, instDir); + QString errorMsg = tr("Failed to create instance %1: ").arg(instDirName); + switch (error) + { + case InstanceList::NoCreateError: + break; + + case InstanceList::InstExists: + { + errorMsg += tr("An instance with the given directory name already exists."); + CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show(); + return; + } + + case InstanceList::CantCreateDir: + { + errorMsg += tr("Failed to create the instance directory."); + CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show(); + return; + } + + default: + { + errorMsg += tr("Unknown instance loader error %1").arg(error); + CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show(); + return; + } + } + newInstance->setName(instName); + newInstance->setIconKey(instIcon); + newInstance->setGroupInitial(instGroup); + MMC->instances()->add(InstancePtr(newInstance)); + MMC->instances()->saveGroupList(); + finalizeInstance(newInstance); +} + +void MainWindow::finalizeInstance(InstancePtr inst) +{ + if (MMC->accounts()->anyAccountIsValid()) + { + ProgressDialog loadDialog(this); + auto update = inst->doUpdate(); + 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(); + }); + loadDialog.exec(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::on_actionAddInstance_triggered() +{ + waitForMinecraftVersions(); + + NewInstanceDialog newInstDlg(this); + if (!newInstDlg.exec()) + return; + + MMC->settings()->set("LastUsedGroupForNewInstance", newInstDlg.instGroup()); + + const QUrl modpackUrl = newInstDlg.modpackUrl(); + + + if (modpackUrl.isValid()) + { + instanceFromZipPack(newInstDlg.instName(), newInstDlg.instGroup(), newInstDlg.iconKey(), modpackUrl); + } + else + { + instanceFromVersion(newInstDlg.instName(), newInstDlg.instGroup(), newInstDlg.iconKey(), newInstDlg.selectedVersion()); + } +} + +void MainWindow::on_actionCopyInstance_triggered() +{ + if (!m_selectedInstance) + return; + + CopyInstanceDialog copyInstDlg(m_selectedInstance, this); + if (!copyInstDlg.exec()) + return; + + QString instancesDir = MMC->settings()->get("InstanceDir").toString(); + QString instDirName = DirNameFromString(copyInstDlg.instName(), instancesDir); + QString instDir = PathCombine(instancesDir, instDirName); + + InstancePtr newInstance; + auto error = MMC->instances()->copyInstance(newInstance, m_selectedInstance, instDir); + + QString errorMsg = tr("Failed to create instance %1: ").arg(instDirName); + switch (error) + { + case InstanceList::NoCreateError: + newInstance->setName(copyInstDlg.instName()); + newInstance->setGroupInitial(copyInstDlg.instGroup()); + newInstance->setIconKey(copyInstDlg.iconKey()); + MMC->instances()->add(newInstance); + return; + + case InstanceList::InstExists: + { + errorMsg += tr("An instance with the given directory name already exists."); + CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show(); + break; + } + + case InstanceList::CantCreateDir: + { + errorMsg += tr("Failed to create the instance directory."); + CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show(); + break; + } + + default: + { + errorMsg += tr("Unknown instance loader error %1").arg(error); + CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show(); + break; + } + } +} + +void MainWindow::on_actionChangeInstIcon_triggered() +{ + if (!m_selectedInstance) + return; + + IconPickerDialog dlg(this); + dlg.exec(m_selectedInstance->iconKey()); + if (dlg.result() == QDialog::Accepted) + { + m_selectedInstance->setIconKey(dlg.selectedIconKey); + auto ico = ENV.icons()->getBigIcon(dlg.selectedIconKey); + ui->actionChangeInstIcon->setIcon(ico); + } +} + +void MainWindow::iconUpdated(QString icon) +{ + if (icon == m_currentInstIcon) + { + ui->actionChangeInstIcon->setIcon(ENV.icons()->getBigIcon(m_currentInstIcon)); + } +} + +void MainWindow::updateInstanceToolIcon(QString new_icon) +{ + m_currentInstIcon = new_icon; + ui->actionChangeInstIcon->setIcon(ENV.icons()->getBigIcon(m_currentInstIcon)); +} + +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); + } +} + +void MainWindow::on_actionChangeInstGroup_triggered() +{ + if (!m_selectedInstance) + return; + + bool ok = false; + QString name(m_selectedInstance->group()); + 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) + m_selectedInstance->setGroupPost(name); +} + +void MainWindow::on_actionViewInstanceFolder_triggered() +{ + QString str = MMC->settings()->get("InstanceDir").toString(); + openDirInDefaultProgram(str); +} + +void MainWindow::on_actionRefresh_triggered() +{ + MMC->instances()->loadList(); +} + +void MainWindow::on_actionViewCentralModsFolder_triggered() +{ + openDirInDefaultProgram(MMC->settings()->get("CentralModsDir").toString(), true); +} + +void MainWindow::on_actionConfig_Folder_triggered() +{ + if (m_selectedInstance) + { + QString str = m_selectedInstance->instanceConfigFolder(); + openDirInDefaultProgram(QDir(str).absolutePath()); + } +} + +void MainWindow::on_actionCheckUpdate_triggered() +{ + auto updater = MMC->updateChecker(); + updater->checkForUpdate(MMC->settings()->get("UpdateChannel").toString(), true); +} + +template +void ShowPageDialog(T raw_provider, QWidget * parent, QString open_page = QString()) +{ + auto provider = std::dynamic_pointer_cast(raw_provider); + if(!provider) + return; + PageDialog dlg(provider, open_page, parent); + dlg.exec(); +} + +void ShowInstancePageDialog(InstancePtr instance, QWidget * parent, QString open_page = QString()) +{ + auto provider = std::make_shared(instance); + ShowPageDialog(provider, parent, open_page); +} + +void MainWindow::on_actionSettings_triggered() +{ + ShowPageDialog(m_globalSettingsProvider, this, "global-settings"); + // FIXME: quick HACK to make this work. improve, optimize. + proxymodel->invalidate(); + proxymodel->sort(0); + updateToolsMenu(); + update(); +} + +void MainWindow::on_actionInstanceSettings_triggered() +{ + ShowInstancePageDialog(m_selectedInstance, this, "settings"); +} + +void MainWindow::on_actionEditInstNotes_triggered() +{ + ShowInstancePageDialog(m_selectedInstance, this, "notes"); +} + +void MainWindow::on_actionEditInstance_triggered() +{ + ShowInstancePageDialog(m_selectedInstance, this); +} + +void MainWindow::on_actionScreenshots_triggered() +{ + ShowInstancePageDialog(m_selectedInstance, this, "screenshots"); +} + + +void MainWindow::on_actionManageAccounts_triggered() +{ + ShowPageDialog(m_globalSettingsProvider, this, "accounts"); +} + +void MainWindow::on_actionReportBug_triggered() +{ + openWebPage(QUrl("https://github.com/MultiMC/MultiMC5/issues")); +} + +void MainWindow::on_actionPatreon_triggered() +{ + openWebPage(QUrl("http://www.patreon.com/multimc")); +} + +void MainWindow::on_actionMoreNews_triggered() +{ + openWebPage(QUrl("http://multimc.org/posts.html")); +} + +void MainWindow::newsButtonClicked() +{ + QList entries = m_newsChecker->getNewsEntries(); + if (entries.count() > 0) + openWebPage(QUrl(entries[0]->link)); + else + openWebPage(QUrl("http://multimc.org/posts.html")); +} + +void MainWindow::on_actionAbout_triggered() +{ + AboutDialog dialog(this); + dialog.exec(); +} + +void MainWindow::on_mainToolBar_visibilityChanged(bool) +{ + // Don't allow hiding the main toolbar. + // This is the only way I could find to prevent it... :/ + ui->mainToolBar->setVisible(true); +} + +void MainWindow::on_actionDeleteInstance_triggered() +{ + if (m_selectedInstance) + { + auto response = CustomMessageBox::selectable( + this, tr("CAREFUL"), tr("This is permanent! Are you sure?\nAbout to delete: ") + + m_selectedInstance->name(), + QMessageBox::Question, QMessageBox::Yes | QMessageBox::No)->exec(); + if (response == QMessageBox::Yes) + { + m_selectedInstance->nuke(); + } + } +} + +#include + +bool compressSubDir(QuaZip* zip, QString dir, QString origDir, QString prefix) +{ + if (!zip) return false; + if (zip->getMode()!=QuaZip::mdCreate && zip->getMode()!=QuaZip::mdAppend && zip->getMode()!=QuaZip::mdAdd) + { + return false; + } + + QDir directory(dir); + if (!directory.exists()) return false; + + QDir origDirectory(origDir); + if (dir != origDir) + { + QuaZipFile dirZipFile(zip); + auto dirPrefix = PathCombine(prefix, origDirectory.relativeFilePath(dir)) + "/"; + if (!dirZipFile.open(QIODevice::WriteOnly, QuaZipNewInfo(dirPrefix, dir), 0, 0, 0)) + { + return false; + } + dirZipFile.close(); + } + + QFileInfoList files = directory.entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot | QDir::Hidden); + for (auto file: files) + { + if(!compressSubDir(zip,file.absoluteFilePath(),origDir, prefix)) + { + return false; + } + } + + files = directory.entryInfoList(QDir::Files); + for (auto file: files) + { + if(!file.isFile()) + { + continue; + } + + if(file.absoluteFilePath()==zip->getZipName()) + { + continue; + } + + QString filename = origDirectory.relativeFilePath(file.absoluteFilePath()); + if(prefix.size()) + { + filename = PathCombine(prefix, filename); + } + if (!JlCompress::compressFile(zip,file.absoluteFilePath(),filename)) + { + return false; + } + } + + return true; +} + +bool compressDir(QString zipFile, QString dir, QString prefix = QString()) +{ + QuaZip zip(zipFile); + QDir().mkpath(QFileInfo(zipFile).absolutePath()); + if(!zip.open(QuaZip::mdCreate)) + { + QFile::remove(zipFile); + return false; + } + + QSet added; + if (!compressSubDir(&zip,dir,dir,prefix)) + { + QFile::remove(zipFile); + return false; + } + zip.close(); + if(zip.getZipError()!=0) + { + QFile::remove(zipFile); + return false; + } + return true; +} + +void MainWindow::on_actionExportInstance_triggered() +{ + if (m_selectedInstance) + { + auto name = RemoveInvalidFilenameChars(m_selectedInstance->name()); + + const QString output = QFileDialog::getSaveFileName(this, tr("Export %1") + .arg(m_selectedInstance->name()), + PathCombine(QDir::homePath(), name + ".zip") , "Zip (*.zip)"); + if (output.isNull()) + { + return; + } + 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; + } + } + + if (!compressDir(output, m_selectedInstance->instanceRoot(), name)) + { + QMessageBox::warning(this, tr("Error"), tr("Unable to export instance")); + } + } +} + +void MainWindow::on_actionRenameInstance_triggered() +{ + if (m_selectedInstance) + { + bool ok = false; + QString name(m_selectedInstance->name()); + name = + QInputDialog::getText(this, tr("Instance name"), tr("Enter a new instance name."), + QLineEdit::Normal, name, &ok); + + if (name.length() > 0) + { + if (ok && name.length()) + { + m_selectedInstance->setName(name); + renameButton->setText(name); + } + } + } +} + +void MainWindow::on_actionViewSelectedInstFolder_triggered() +{ + if (m_selectedInstance) + { + QString str = m_selectedInstance->instanceRoot(); + openDirInDefaultProgram(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()); + + QMainWindow::closeEvent(event); + QApplication::exit(); +} +/* +void MainWindow::on_instanceView_customContextMenuRequested(const QPoint &pos) +{ + QMenu *instContextMenu = new QMenu("Instance", this); + + // Add the actions from the toolbar to the context menu. + instContextMenu->addActions(ui->instanceToolBar->actions()); + + instContextMenu->exec(view->mapToGlobal(pos)); +} +*/ +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; + + NagUtils::checkJVMArgs(inst->settings().get("JvmArgs").toString(), this); + + doLaunch(); +} + +void MainWindow::on_actionLaunchInstance_triggered() +{ + if (m_selectedInstance) + { + NagUtils::checkJVMArgs(m_selectedInstance->settings().get("JvmArgs").toString(), this); + doLaunch(); + } +} + +void MainWindow::on_actionLaunchInstanceOffline_triggered() +{ + if (m_selectedInstance) + { + NagUtils::checkJVMArgs(m_selectedInstance->settings().get("JvmArgs").toString(), this); + doLaunch(false); + } +} + +void MainWindow::doLaunch(bool online, BaseProfilerFactory *profiler) +{ + if (!m_selectedInstance) + return; + + // 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( + this, 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. + on_actionManageAccounts_triggered(); + } + } + else if (account.get() == nullptr) + { + // If no default account is set, ask the user which one to use. + AccountSelectDialog selectDialog(tr("Which account would you like to use?"), + AccountSelectDialog::GlobalDefaultCheckbox, this); + + 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()) + 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. + QString failReason = tr("Your account is currently not logged in. Please enter " + "your password to log in again."); + + while (tryagain) + { + AuthSessionPtr session(new AuthSession()); + session->wants_online = online; + auto task = account->login(session, password); + if (task) + { + // We'll need to validate the access token to make sure the account + // is still logged in. + ProgressDialog progDialog(this); + if (online) + progDialog.setSkipButton(true, tr("Play Offline")); + progDialog.exec(task.get()); + if (!task->successful()) + { + failReason = task->failReason(); + } + } + switch (session->status) + { + case AuthSession::Undetermined: + { + qCritical() << "Received undetermined session status during login. Bye."; + tryagain = false; + break; + } + case AuthSession::RequiresPassword: + { + EditAccountDialog passDialog(failReason, this, EditAccountDialog::PasswordField); + 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 = session->player_name; + QString name = QInputDialog::getText(this, tr("Player name"), + tr("Choose your offline mode player name."), + QLineEdit::Normal, session->player_name, &ok); + if (!ok) + { + tryagain = false; + break; + } + if (name.length()) + { + usedname = name; + } + session->MakeOffline(usedname); + // offline flavored game from here :3 + } + case AuthSession::PlayableOnline: + { + // update first if the server actually responded + if (session->auth_server_online) + { + updateInstance(m_selectedInstance, session, profiler); + } + else + { + launchInstance(m_selectedInstance, session, profiler); + } + tryagain = false; + } + } + } +} + +void MainWindow::updateInstance(InstancePtr instance, AuthSessionPtr session, + BaseProfilerFactory *profiler) +{ + auto updateTask = instance->doUpdate(); + if (!updateTask) + { + launchInstance(instance, session, profiler); + return; + } + ProgressDialog tDialog(this); + connect(updateTask.get(), &Task::succeeded, [this, instance, session, profiler] + { launchInstance(instance, session, profiler); }); + connect(updateTask.get(), SIGNAL(failed(QString)), SLOT(onGameUpdateError(QString))); + tDialog.exec(updateTask.get()); +} + +void MainWindow::launchInstance(InstancePtr instance, AuthSessionPtr session, + BaseProfilerFactory *profiler) +{ + Q_ASSERT_X(instance != NULL, "launchInstance", "instance is NULL"); + Q_ASSERT_X(session.get() != nullptr, "launchInstance", "session is NULL"); + + QString launchScript; + + BaseProcess *proc = instance->prepareForLaunch(session); + if (!proc) + return; + + this->hide(); + + console = new ConsoleWindow(proc); + connect(console, SIGNAL(isClosing()), this, SLOT(instanceEnded())); + + proc->setHeader("MultiMC version: " + BuildConfig.printableVersionString() + "\n\n"); + proc->arm(); + + if (profiler) + { + QString error; + if (!profiler->check(&error)) + { + QMessageBox::critical(this, tr("Error"), + tr("Couldn't start profiler: %1").arg(error)); + proc->abort(); + return; + } + BaseProfiler *profilerInstance = profiler->createProfiler(instance, this); + QProgressDialog dialog; + dialog.setMinimum(0); + dialog.setMaximum(0); + dialog.setValue(0); + dialog.setLabelText(tr("Waiting for profiler...")); + connect(&dialog, &QProgressDialog::canceled, profilerInstance, + &BaseProfiler::abortProfiling); + dialog.show(); + connect(profilerInstance, &BaseProfiler::readyToLaunch, + [&dialog, this, proc](const QString & message) + { + dialog.accept(); + 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.exec(); + proc->launch(); + }); + connect(profilerInstance, &BaseProfiler::abortLaunch, + [&dialog, this, proc](const QString & message) + { + dialog.accept(); + 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.exec(); + proc->abort(); + }); + profilerInstance->beginProfiling(proc); + dialog.exec(); + } + else + { + proc->launch(); + } +} + +void MainWindow::onGameUpdateError(QString error) +{ + CustomMessageBox::selectable(this, tr("Error updating instance"), error, + QMessageBox::Warning)->show(); +} + +void MainWindow::taskStart() +{ + // Nothing to do here yet. +} + +void MainWindow::taskEnd() +{ + QObject *sender = QObject::sender(); + if (sender == m_versionLoadTask) + m_versionLoadTask = NULL; + + sender->deleteLater(); +} + +void MainWindow::startTask(Task *task) +{ + connect(task, SIGNAL(started()), SLOT(taskStart())); + connect(task, SIGNAL(succeeded()), SLOT(taskEnd())); + connect(task, SIGNAL(failed(QString)), SLOT(taskEnd())); + task->start(); +} + +// BrowserDialog +void MainWindow::openWebPage(QUrl url) +{ + QDesktopServices::openUrl(url); +} + +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(m_selectedInstance->canLaunch()); + renameButton->setText(m_selectedInstance->name()); + m_statusLeft->setText(m_selectedInstance->getStatusbarDescription()); + updateInstanceToolIcon(m_selectedInstance->iconKey()); + + updateToolsMenu(); + + MMC->settings()->set("SelectedInstance", m_selectedInstance->id()); + } + else + { + MMC->settings()->set("SelectedInstance", QString()); + selectionBad(); + return; + } +} + +void MainWindow::selectionBad() +{ + // start by reseting everything... + m_selectedInstance = nullptr; + + statusBar()->clearMessage(); + ui->instanceToolBar->setEnabled(false); + 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::instanceEnded() +{ + this->show(); +} + +void MainWindow::checkSetDefaultJava() +{ + const QString javaHack = "IntelHack"; + bool askForJava = false; + do + { + QString currentHostName = QHostInfo::localHostName(); + QString oldHostName = MMC->settings()->get("LastHostname").toString(); + if (currentHostName != oldHostName) + { + MMC->settings()->set("LastHostname", currentHostName); + askForJava = true; + break; + } + QString currentJavaPath = MMC->settings()->get("JavaPath").toString(); + if (currentJavaPath.isEmpty()) + { + askForJava = true; + break; + } + if(!currentJavaPath.contains('/')) + { + currentJavaPath = QStandardPaths::findExecutable(currentJavaPath); + } + QFile currentJavaBin(currentJavaPath); + if(!currentJavaBin.exists()) + { + askForJava = true; + break; + } + #if defined Q_OS_WIN32 + QString currentHack = MMC->settings()->get("JavaDetectionHack").toString(); + if (currentHack != javaHack) + { + CustomMessageBox::selectable( + this, tr("Java detection forced"), + tr("Because of graphics performance issues caused by Intel drivers on Windows, " + "MultiMC java detection was forced. Please select a Java " + "version.

If you have custom java versions set for your instances, " + "make sure you use the 'javaw.exe' executable."), + QMessageBox::Warning)->exec(); + askForJava = true; + break; + } + #endif + } while (0); + + if (askForJava) + { + qDebug() << "Java path needs resetting, showing Java selection dialog..."; + + JavaVersionPtr java; + + VersionSelectDialog vselect(MMC->javalist().get(), tr("Select a Java version"), this, + false); + vselect.setResizeOn(2); + vselect.exec(); + + if (vselect.selectedVersion()) + java = std::dynamic_pointer_cast(vselect.selectedVersion()); + else + { + CustomMessageBox::selectable( + this, tr("Invalid version selected"), + tr("You didn't select a valid Java version, so MultiMC will " + "select the default. " + "You can change this in the settings dialog."), + QMessageBox::Warning)->show(); + + JavaUtils ju; + java = ju.GetDefaultJava(); + } + if (java) + { + MMC->settings()->set("JavaPath", java->path); + MMC->settings()->set("JavaDetectionHack", javaHack); + } + else + MMC->settings()->set("JavaPath", QString("java")); + } +} + +void MainWindow::checkInstancePathForProblems() +{ + QString instanceFolder = MMC->settings()->get("InstanceDir").toString(); + if (checkProblemticPathJava(QDir(instanceFolder))) + { + QMessageBox warning; + warning.setText(tr( + "Your instance folder contains \'!\' and this is known to cause Java problems!")); + warning.setInformativeText( + tr("You have now three options:
" + " - ignore this warning
" + " - change the instance dir in the settings
" + " - move this installation of MultiMC5 to a different folder")); + warning.setDefaultButton(QMessageBox::Ok); + warning.exec(); + } +} diff --git a/application/MainWindow.h b/application/MainWindow.h new file mode 100644 index 00000000..96d9c7bb --- /dev/null +++ b/application/MainWindow.h @@ -0,0 +1,218 @@ +/* Copyright 2013-2015 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 "BaseInstance.h" +#include "auth/MojangAccount.h" +#include "net/NetJob.h" +#include "updater/GoUpdate.h" + +class NewsChecker; +class NotificationChecker; +class QToolButton; +class InstanceProxyModel; +class LabeledToolButton; +class QLabel; +class MinecraftProcess; +class ConsoleWindow; +class BaseProfilerFactory; +class GenericPageProvider; + +namespace Ui +{ +class MainWindow; +} + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit MainWindow(QWidget *parent = 0); + ~MainWindow(); + + void closeEvent(QCloseEvent *event); + + // Browser Dialog + void openWebPage(QUrl url); + + void checkSetDefaultJava(); + void checkInstancePathForProblems(); + +private +slots: + void onCatToggled(bool); + + void on_actionAbout_triggered(); + + void on_actionAddInstance_triggered(); + + void on_actionCopyInstance_triggered(); + + void on_actionChangeInstGroup_triggered(); + + void on_actionChangeInstIcon_triggered(); + + void on_actionViewInstanceFolder_triggered(); + + void on_actionConfig_Folder_triggered(); + + void on_actionViewSelectedInstFolder_triggered(); + + void on_actionRefresh_triggered(); + + void on_actionViewCentralModsFolder_triggered(); + + void on_actionCheckUpdate_triggered(); + + 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_mainToolBar_visibilityChanged(bool); + + // void on_instanceView_customContextMenuRequested(const QPoint &pos); + + void on_actionLaunchInstance_triggered(); + + void on_actionLaunchInstanceOffline_triggered(); + + void on_actionDeleteInstance_triggered(); + + void on_actionExportInstance_triggered(); + + void on_actionRenameInstance_triggered(); + + void on_actionEditInstance_triggered(); + + void on_actionEditInstNotes_triggered(); + + void on_actionScreenshots_triggered(); + + /*! + * Launches the currently selected instance with the default account. + * If no default account is selected, prompts the user to pick an account. + */ + void doLaunch(bool online = true, BaseProfilerFactory *profiler = 0); + + /*! + * Launches the given instance with the given account. + * This function assumes that the given account has a valid, usable access token. + */ + void launchInstance(InstancePtr instance, AuthSessionPtr session, BaseProfilerFactory *profiler = 0); + + /*! + * Prepares the given instance for launch with the given account. + */ + void updateInstance(InstancePtr instance, AuthSessionPtr account, BaseProfilerFactory *profiler = 0); + + void onGameUpdateError(QString error); + + void taskStart(); + void taskEnd(); + + void instanceEnded(); + + // called when an icon is changed in the icon model. + void iconUpdated(QString); + + void showInstanceContextMenu(const QPoint &); + + void updateToolsMenu(); + + void skinJobFinished(); +public +slots: + void instanceActivated(QModelIndex); + + void instanceChanged(const QModelIndex ¤t, const QModelIndex &previous); + + 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, bool installOnExit = false); + +protected: + bool eventFilter(QObject *obj, QEvent *ev); + void setCatBackground(bool enabled); + void updateInstanceToolIcon(QString new_icon); + + void setSelectedInstanceById(const QString &id); + + void waitForMinecraftVersions(); + void instanceFromVersion(QString instName, QString instGroup, QString instIcon, BaseVersionPtr version); + void instanceFromZipPack(QString instName, QString instGroup, QString instIcon, QUrl url); + void finalizeInstance(InstancePtr inst); + +private: + Ui::MainWindow *ui; + class GroupView *view; + InstanceProxyModel *proxymodel; + NetJobPtr skin_download_job; + MinecraftProcess *proc; + ConsoleWindow *console; + LabeledToolButton *renameButton; + QToolButton *changeIconButton; + QToolButton *newsLabel; + + std::shared_ptr m_globalSettingsProvider; + std::shared_ptr m_newsChecker; + std::shared_ptr m_notificationChecker; + + InstancePtr m_selectedInstance; + QString m_currentInstIcon; + + Task *m_versionLoadTask; + + QLabel *m_statusLeft; + class ServerStatus *m_statusRight; + + QMenu *accountMenu; + QToolButton *accountMenuButton; + QAction *manageAccountsAction; +}; diff --git a/application/MultiMC.cpp b/application/MultiMC.cpp new file mode 100644 index 00000000..ba6d7880 --- /dev/null +++ b/application/MultiMC.cpp @@ -0,0 +1,632 @@ +#include "MultiMC.h" +#include "BuildConfig.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "dialogs/VersionSelectDialog.h" +#include "InstanceList.h" +#include "auth/MojangAccountList.h" +#include "icons/IconList.h" +#include "minecraft/LwjglVersionList.h" +#include "minecraft/MinecraftVersionList.h" +#include "liteloader/LiteLoaderVersionList.h" + +#include "forge/ForgeVersionList.h" + +#include "net/HttpMetaCache.h" +#include "net/URLConstants.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 "pathutils.h" +#include "cmdutils.h" +#include +#include "settings/INISettingsObject.h" +#include "settings/Setting.h" + +#include "trans/TranslationDownloader.h" + +#include "ftb/FTBPlugin.h" + +using namespace Util::Commandline; + +MultiMC::MultiMC(int &argc, char **argv, bool test_mode) : QApplication(argc, argv) +{ + setOrganizationName("MultiMC"); + setApplicationName("MultiMC5"); + + startTime = QDateTime::currentDateTime(); + + setAttribute(Qt::AA_UseHighDpiPixmaps); + // 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", applicationDirPath()); + parser.addShortOpt("dir", 'd'); + parser.addDocumentation("dir", "use the supplied directory as MultiMC root instead of " + "the binary location (use '.' for current)"); + + // parse the arguments + try + { + args = parser.parse(arguments()); + } + catch (ParsingError e) + { + std::cerr << "CommandLineError: " << e.what() << std::endl; + std::cerr << "Try '%1 -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.VERSION_STR.toStdString() << std::endl; + std::cout << "Git " << BuildConfig.GIT_COMMIT.toStdString() << std::endl; + m_status = MultiMC::Succeeded; + return; + } + } + + QString origcwdPath = QDir::currentPath(); + QString binPath = applicationDirPath(); + QString adjustedBy; + // change directory + 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 + { + dataPath = applicationDirPath(); + adjustedBy += "Fallback to binary path " + dataPath; + } + + if (!ensureFolderPathExists(dataPath) || !QDir::setCurrent(dataPath)) + { + // BAD STUFF. WHAT DO? + initLogger(); + qCritical() << "Failed to set work path. Will exit. NOW."; + m_status = MultiMC::Failed; + return; + } + + // in test mode, root path is the same as the binary path. + if (test_mode) + { + rootPath = binPath; + } + else + { +#ifdef Q_OS_LINUX + QDir foo(PathCombine(binPath, "..")); + rootPath = foo.absolutePath(); +#elif defined(Q_OS_WIN32) + rootPath = binPath; +#elif defined(Q_OS_MAC) + QDir foo(PathCombine(binPath, "../..")); + rootPath = foo.absolutePath(); +#endif + } + +// static data paths... mostly just for translations +#ifdef Q_OS_LINUX + QDir foo(PathCombine(binPath, "..")); + staticDataPath = foo.absolutePath(); +#elif defined(Q_OS_WIN32) + staticDataPath = binPath; +#elif defined(Q_OS_MAC) + QDir foo(PathCombine(rootPath, "Contents/Resources")); + staticDataPath = foo.absolutePath(); +#endif + + // init the logger + initLogger(); + + qDebug() << "MultiMC 5, (c) 2013-2015 MultiMC Contributors"; + qDebug() << "Version : " << BuildConfig.VERSION_STR; + qDebug() << "Git commit : " << BuildConfig.GIT_COMMIT; + 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 : " << rootPath; + qDebug() << "Static data path : " << staticDataPath; + + // load settings + initGlobalSettings(test_mode); + + // load translations + initTranslations(); + + // initialize the updater + m_updateChecker.reset(new UpdateChecker(BuildConfig.CHANLIST_URL, BuildConfig.VERSION_CHANNEL, BuildConfig.VERSION_BUILD)); + + m_translationChecker.reset(new TranslationDownloader()); + + // load icons + initIcons(); + + // and instances + auto InstDirSetting = m_settings->getSetting("InstanceDir"); + // instance path: check for problems with '!' in instance path and warn the user in the log + // and rememer that we have to show him a dialog when the gui starts (if it does so) + QString instDir = m_settings->get("InstanceDir").toString(); + qDebug() << "Instance path : " << instDir; + if (checkProblemticPathJava(QDir(instDir))) + { + qWarning() + << "Your instance path contains \'!\' and this is known to cause java problems"; + } + m_instances.reset(new InstanceList(m_settings, InstDirSetting->get().toString(), this)); + qDebug() << "Loading Instances..."; + m_instances->loadList(); + connect(InstDirSetting.get(), SIGNAL(SettingChanged(const Setting &, QVariant)), + m_instances.get(), SLOT(on_InstFolderChanged(const Setting &, QVariant))); + + // and accounts + m_accounts.reset(new MojangAccountList(this)); + qDebug() << "Loading accounts..."; + m_accounts->setListFilePath("accounts.json", true); + m_accounts->loadList(); + + // init the http meta cache + ENV.initHttpMetaCache(rootPath, staticDataPath); + + // create the global network manager + ENV.m_qnam.reset(new QNetworkAccessManager(this)); + + // 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); + } + + m_translationChecker->downloadTranslations(); + + //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); + } + + //FIXME: what to do with these? + m_tools.insert("mcedit", std::shared_ptr(new MCEditFactory())); + for (auto tool : m_tools.values()) + { + tool->registerSettings(m_settings); + } + + connect(this, SIGNAL(aboutToQuit()), SLOT(onExit())); + m_status = MultiMC::Initialized; +} + +MultiMC::~MultiMC() +{ + if (m_mmc_translator) + { + removeTranslator(m_mmc_translator.get()); + } + if (m_qt_translator) + { + removeTranslator(m_qt_translator.get()); + } +} + +void MultiMC::initTranslations() +{ + QLocale locale(m_settings->get("Language").toString()); + QLocale::setDefault(locale); + qDebug() << "Your language is" << locale.bcp47Name(); + m_qt_translator.reset(new QTranslator()); + if (m_qt_translator->load("qt_" + locale.bcp47Name(), + QLibraryInfo::location(QLibraryInfo::TranslationsPath))) + { + qDebug() << "Loading Qt Language File for" + << locale.bcp47Name().toLocal8Bit().constData() << "..."; + if (!installTranslator(m_qt_translator.get())) + { + qCritical() << "Loading Qt Language File failed."; + m_qt_translator.reset(); + } + } + else + { + m_qt_translator.reset(); + } + + m_mmc_translator.reset(new QTranslator()); + if (m_mmc_translator->load("mmc_" + locale.bcp47Name(), staticDataPath + "/translations")) + { + qDebug() << "Loading MMC Language File for" + << locale.bcp47Name().toLocal8Bit().constData() << "..."; + if (!installTranslator(m_mmc_translator.get())) + { + qCritical() << "Loading MMC Language File failed."; + m_mmc_translator.reset(); + } + } + else + { + m_mmc_translator.reset(); + } +} + +void MultiMC::initIcons() +{ + auto setting = MMC->settings()->getSetting("IconsDir"); + ENV.m_icons.reset(new IconList(QString(":/icons/instances/"), setting->get().toString())); + connect(setting.get(), &Setting::SettingChanged,[&](const Setting &, QVariant value) + { + ENV.m_icons->directoryChanged(value.toString()); + }); +} + + +void moveFile(const QString &oldName, const QString &newName) +{ + QFile::remove(newName); + QFile::copy(oldName, newName); + QFile::remove(oldName); +} + + +void appDebugOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) +{ + const char *levels = "DWCF"; + 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); +} + +void MultiMC::initLogger() +{ + static const QString logBase = "MultiMC-%0.log"; + + 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)); + + qInstallMessageHandler(appDebugOutput); + + logFile = std::make_shared(logBase.arg(0)); + logFile->open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate); +} + +void MultiMC::initGlobalSettings(bool test_mode) +{ + m_settings.reset(new INISettingsObject("multimc.cfg", this)); + // Updates + m_settings->registerSetting("UpdateChannel", BuildConfig.VERSION_CHANNEL); + m_settings->registerSetting("AutoUpdate", true); + m_settings->registerSetting("IconTheme", QString("multimc")); + + // 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 + if(!test_mode) + { + // 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); + } + else + { + // in test mode, we don't have UI, so we don't do any font resolving + m_settings->registerSetting("ConsoleFont", defaultMonospace); + } + m_settings->registerSetting("ConsoleFontSize", defaultSize); + + FTBPlugin::initialize(m_settings); + + // Folders + m_settings->registerSetting("InstanceDir", "instances"); + m_settings->registerSetting({"CentralModsDir", "ModsDir"}, "mods"); + m_settings->registerSetting({"LWJGLDir", "LwjglDir"}, "lwjgl"); + m_settings->registerSetting("IconsDir", "icons"); + + // Editors + m_settings->registerSetting("JsonEditor", QString()); + + // Language + m_settings->registerSetting("Language", QLocale(QLocale::system().language()).bcp47Name()); + + // Console + m_settings->registerSetting("ShowConsole", true); + m_settings->registerSetting("RaiseConsole", true); + m_settings->registerSetting("AutoCloseConsole", true); + m_settings->registerSetting("LogPrePostOutput", true); + + // Console Colors + // m_settings->registerSetting("SysMessageColor", QColor(Qt::blue)); + // m_settings->registerSetting("StdOutColor", QColor(Qt::black)); + // m_settings->registerSetting("StdErrColor", QColor(Qt::red)); + + // 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("LastHostname", ""); + m_settings->registerSetting("JavaDetectionHack", ""); + m_settings->registerSetting("JvmArgs", ""); + + // 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", ""); +} + +std::shared_ptr MultiMC::lwjgllist() +{ + if (!m_lwjgllist) + { + m_lwjgllist.reset(new LWJGLVersionList()); + ENV.registerVersionList("org.lwjgl.legacy", m_lwjgllist); + } + return m_lwjgllist; +} + +std::shared_ptr MultiMC::forgelist() +{ + if (!m_forgelist) + { + m_forgelist.reset(new ForgeVersionList()); + ENV.registerVersionList("net.minecraftforge", m_forgelist); + } + return m_forgelist; +} + +std::shared_ptr MultiMC::liteloaderlist() +{ + if (!m_liteloaderlist) + { + m_liteloaderlist.reset(new LiteLoaderVersionList()); + ENV.registerVersionList("com.mumfrey.liteloader", m_liteloaderlist); + } + return m_liteloaderlist; +} + +std::shared_ptr MultiMC::minecraftlist() +{ + if (!m_minecraftlist) + { + m_minecraftlist.reset(new MinecraftVersionList()); + ENV.registerVersionList("net.minecraft", m_minecraftlist); + } + return m_minecraftlist; +} + +std::shared_ptr MultiMC::javalist() +{ + if (!m_javalist) + { + m_javalist.reset(new JavaVersionList()); + ENV.registerVersionList("com.java", m_javalist); + } + return m_javalist; +} + +void MultiMC::installUpdates(const QString updateFilesDir, UpdateFlags flags) +{ + // if we are going to update on exit, save the params now + if (flags & OnExit) + { + m_updateOnExitPath = updateFilesDir; + m_updateOnExitFlags = flags & ~OnExit; + return; + } + // otherwise if there already were some params for on exit update, clear them and continue + else if (m_updateOnExitPath.size()) + { + m_updateOnExitFlags = None; + m_updateOnExitPath.clear(); + } + qDebug() << "Installing updates."; +#ifdef WINDOWS + QString finishCmd = applicationFilePath(); + QString updaterBinary = PathCombine(applicationDirPath(), "updater.exe"); +#elif LINUX + QString finishCmd = PathCombine(root(), "MultiMC"); + QString updaterBinary = PathCombine(applicationDirPath(), "updater"); +#elif OSX + QString finishCmd = applicationFilePath(); + QString updaterBinary = PathCombine(applicationDirPath(), "updater"); +#else +#error Unsupported operating system. +#endif + + QStringList args; + // ./updater --install-dir $INSTALL_DIR --package-dir $UPDATEFILES_DIR --script + // $UPDATEFILES_DIR/file_list.xml --wait $PID --mode main + args << "--install-dir" << root(); + args << "--package-dir" << updateFilesDir; + args << "--script" << PathCombine(updateFilesDir, "file_list.xml"); + args << "--wait" << QString::number(applicationPid()); + if (flags & DryRun) + args << "--dry-run"; + if (flags & RestartOnFinish) + { + args << "--finish-cmd" << finishCmd; + args << "--finish-dir" << dataPath; + } + qDebug() << "Running updater with command" << updaterBinary << args.join(" "); + QFile::setPermissions(updaterBinary, (QFileDevice::Permission)0x7755); + + if (!QProcess::startDetached(updaterBinary, args /*, root()*/)) + { + qCritical() << "Failed to start the updater process!"; + return; + } + + ENV.destroy(); + // Now that we've started the updater, quit MultiMC. + quit(); +} + +void MultiMC::setIconTheme(const QString& name) +{ + XdgIcon::setThemeName(name); +} + +QIcon MultiMC::getThemedIcon(const QString& name) +{ + return XdgIcon::fromTheme(name); +} + +void MultiMC::onExit() +{ + if(m_instances) + { + m_instances->saveGroupList(); + } + if (m_updateOnExitPath.size()) + { + installUpdates(m_updateOnExitPath, m_updateOnExitFlags); + } + ENV.destroy(); + if(logFile) + { + logFile->flush(); + logFile->close(); + } +} + +bool MultiMC::openJsonEditor(const QString &filename) +{ + const QString file = QDir::current().absoluteFilePath(filename); + if (m_settings->get("JsonEditor").toString().isEmpty()) + { + return QDesktopServices::openUrl(QUrl::fromLocalFile(file)); + } + else + { + return QProcess::startDetached(m_settings->get("JsonEditor").toString(), QStringList() + << file); + } +} + +#include "MultiMC.moc" diff --git a/application/MultiMC.h b/application/MultiMC.h new file mode 100644 index 00000000..b78bbbd2 --- /dev/null +++ b/application/MultiMC.h @@ -0,0 +1,188 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +class QFile; +class MinecraftVersionList; +class LWJGLVersionList; +class HttpMetaCache; +class SettingsObject; +class InstanceList; +class MojangAccountList; +class IconList; +class QNetworkAccessManager; +class ForgeVersionList; +class LiteLoaderVersionList; +class JavaVersionList; +class UpdateChecker; +class BaseProfilerFactory; +class BaseDetachedToolFactory; +class TranslationDownloader; + +#if defined(MMC) +#undef MMC +#endif +#define MMC (static_cast(QCoreApplication::instance())) + +enum UpdateFlag +{ + None = 0x0, + RestartOnFinish = 0x1, + DryRun = 0x2, + OnExit = 0x4 +}; +Q_DECLARE_FLAGS(UpdateFlags, UpdateFlag); +Q_DECLARE_OPERATORS_FOR_FLAGS(UpdateFlags); + +class MultiMC : public QApplication +{ + // friends for the purpose of limiting access to deprecated stuff + friend class MultiMCPage; + friend class MainWindow; + Q_OBJECT +public: + enum Status + { + Failed, + Succeeded, + Initialized + }; + +public: + MultiMC(int &argc, char **argv, bool test_mode = false); + virtual ~MultiMC(); + + // InstanceList, IconList, OneSixFTBInstance, LegacyUpdate, LegacyInstance, MCEditTool, JVisualVM, MinecraftInstance, JProfiler, BaseInstance + std::shared_ptr settings() + { + return m_settings; + } + + qint64 timeSinceStart() const + { + return startTime.msecsTo(QDateTime::currentDateTime()); + } + + QIcon getThemedIcon(const QString& name); + + void setIconTheme(const QString& name); + + // DownloadUpdateTask + std::shared_ptr updateChecker() + { + return m_updateChecker; + } + + std::shared_ptr minecraftlist(); + std::shared_ptr lwjgllist(); + std::shared_ptr forgelist(); + std::shared_ptr liteloaderlist(); + std::shared_ptr javalist(); + + // APPLICATION ONLY + std::shared_ptr instances() + { + return m_instances; + } + + // APPLICATION ONLY + std::shared_ptr accounts() + { + return m_accounts; + } + + // APPLICATION ONLY + Status status() + { + return m_status; + } + + // APPLICATION ONLY + QMap> profilers() + { + return m_profilers; + } + + // APPLICATION ONLY + QMap> tools() + { + return m_tools; + } + + // APPLICATION ONLY + void installUpdates(const QString updateFilesDir, UpdateFlags flags = None); + + /*! + * Opens a json file using either a system default editor, or, if note empty, the editor + * specified in the settings + */ + bool openJsonEditor(const QString &filename); + +protected: /* to be removed! */ + // FIXME: remove. used by MultiMCPage to enumerate translations. + /// this is the static data. it stores things that don't move. + const QString &staticData() + { + return staticDataPath; + } + + // FIXME: remove. used by MainWindow to create application update tasks + /// this is the root of the 'installation'. Used for automatic updates + const QString &root() + { + return rootPath; + } + +private slots: + /** + * Do all the things that should be done before we exit + */ + void onExit(); + +private: + void initLogger(); + + void initIcons(); + + void initGlobalSettings(bool test_mode); + + void initTranslations(); + +private: + friend class UpdateCheckerTest; + friend class DownloadTaskTest; + + QDateTime startTime; + + std::shared_ptr m_qt_translator; + std::shared_ptr m_mmc_translator; + std::shared_ptr m_settings; + std::shared_ptr m_instances; + std::shared_ptr m_updateChecker; + std::shared_ptr m_accounts; + std::shared_ptr m_lwjgllist; + std::shared_ptr m_forgelist; + std::shared_ptr m_liteloaderlist; + std::shared_ptr m_minecraftlist; + std::shared_ptr m_javalist; + std::shared_ptr m_translationChecker; + + QMap> m_profilers; + QMap> m_tools; + + QString m_updateOnExitPath; + UpdateFlags m_updateOnExitFlags = None; + + QString rootPath; + QString staticDataPath; + QString dataPath; + + Status m_status = MultiMC::Failed; +public: + std::shared_ptr logFile; +}; diff --git a/application/NagUtils.cpp b/application/NagUtils.cpp new file mode 100644 index 00000000..41e2f63e --- /dev/null +++ b/application/NagUtils.cpp @@ -0,0 +1,38 @@ +/* Copyright 2013-2015 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 "NagUtils.h" +#include "dialogs/CustomMessageBox.h" + +namespace NagUtils +{ +void checkJVMArgs(QString jvmargs, QWidget *parent) +{ + if (jvmargs.contains("-XX:PermSize=") || jvmargs.contains(QRegExp("-Xm[sx]"))) + { + CustomMessageBox::selectable( + parent, QObject::tr("JVM arguments warning"), + QObject::tr("You tried to manually set a JVM memory option (using " + " \"-XX:PermSize\", \"-Xmx\" or \"-Xms\") - there" + " are dedicated boxes for these in the settings (Java" + " tab, in the Memory group at the top).\n" + "Your manual settings will be overridden by the" + " dedicated options.\n" + "This message will be displayed until you remove them" + " from the JVM arguments."), + QMessageBox::Warning)->exec(); + } +} +} diff --git a/application/NagUtils.h b/application/NagUtils.h new file mode 100644 index 00000000..d757703a --- /dev/null +++ b/application/NagUtils.h @@ -0,0 +1,23 @@ +/* Copyright 2013-2015 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 NagUtils +{ +void checkJVMArgs(QString args, QWidget *parent); +} diff --git a/application/Platform.h b/application/Platform.h new file mode 100644 index 00000000..349e5ecc --- /dev/null +++ b/application/Platform.h @@ -0,0 +1,32 @@ +/* Copyright 2013-2015 MultiMC Contributors + * + * Authors: 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. + */ + +#pragma once + +/** + * @file Platform.h + * This file contains platform-specific functions, tweaks and fixes. + */ + +#include + +class MultiMCPlatform +{ +public: + // X11 WM_CLASS + static void fixWM_CLASS(QWidget *widget); +}; diff --git a/application/Platform_Other.cpp b/application/Platform_Other.cpp new file mode 100644 index 00000000..7eaf91d4 --- /dev/null +++ b/application/Platform_Other.cpp @@ -0,0 +1,27 @@ +/* Copyright 2013-2015 MultiMC Contributors + * + * Authors: 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 +/** + * Stub for non-X11 platforms + * @brief MultiMCPlatform::fixWM_CLASS + * @param widget + */ +void MultiMCPlatform::fixWM_CLASS(QWidget *widget) +{ + Q_UNUSED(widget); +} diff --git a/application/Platform_X11.cpp b/application/Platform_X11.cpp new file mode 100644 index 00000000..baca15dd --- /dev/null +++ b/application/Platform_X11.cpp @@ -0,0 +1,62 @@ +/* Copyright 2013-2015 MultiMC Contributors + * + * Authors: 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 +#include +#include + +static QByteArray WM_CLASS = "MultiMC5\0MultiMC5"; + +template +static inline unsigned int XcbCallVoid(xcb_void_cookie_t (*func)(xcb_connection_t *, ArgTypes...), ArgTypes2... args...) +{ + return func(QX11Info::connection(), args...).sequence; +} + +static void getAtoms(size_t n, xcb_atom_t *atoms, const char *const names[], bool create) +{ + xcb_connection_t *conn = QX11Info::connection(); + xcb_intern_atom_cookie_t *cookies = (xcb_intern_atom_cookie_t *)malloc(sizeof(xcb_intern_atom_cookie_t) * 2); + for (size_t i = 0; i < n; ++i) + cookies[i] = xcb_intern_atom(conn, create, strlen(names[i]), names[i]); + memset(atoms, 0, sizeof(xcb_atom_t) * n); + for (size_t i = 0; i < n; ++i) + { + xcb_intern_atom_reply_t *r = xcb_intern_atom_reply(conn, cookies[i], 0); + if (r) + { + atoms[i] = r->atom; + free(r); + } + } + free(cookies); +} + +static inline xcb_atom_t getAtom(const char *name, bool create=false) +{ + xcb_atom_t atom; + getAtoms(1, &atom, &name, create); + return atom; +} + +void MultiMCPlatform::fixWM_CLASS(QWidget *widget) +{ + static const xcb_atom_t atom = getAtom("WM_CLASS"); + XcbCallVoid(xcb_change_property, XCB_PROP_MODE_REPLACE, + widget->winId(), atom, XCB_ATOM_STRING, 8, WM_CLASS.count(), + WM_CLASS.constData()); +} diff --git a/application/dialogs/AboutDialog.cpp b/application/dialogs/AboutDialog.cpp new file mode 100644 index 00000000..abcc76f2 --- /dev/null +++ b/application/dialogs/AboutDialog.cpp @@ -0,0 +1,127 @@ +/* Copyright 2013-2015 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 "Platform.h" +#include "BuildConfig.h" + +#include + +// 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 creditsHtml = QObject::tr( + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "

MultiMC Developers

" + "

Andrew Okin <forkk@forkk.net>

" + "

Petr Mrázek <peterix@gmail.com>

" + "

Sky Welch <multimc@bunnies.io>

" + "

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

" + "" + "

With thanks to

" + "

Orochimarufan <orochimarufan.x3@gmail.com>

" + "

TakSuyu <taksuyu@gmail.com>

" + "

Kilobyte <stiepen22@gmx.de>

" + "

Robotbrain <@skylordelros>

" + "

Rootbear75 <@rootbear75> (build server)

" + "" + "

Patreon Patrons

" + "%1" + "" + "" + ""); + if (patrons.isEmpty()) + return creditsHtml.arg(QObject::tr("

Loading...

")); + else + { + QString patronsStr; + for (QString patron : patrons) + { + patronsStr.append(QString("

%1

").arg(patron)); + } + + return creditsHtml.arg(patronsStr); + } +} + +AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AboutDialog) +{ + MultiMCPlatform::fixWM_CLASS(this); + ui->setupUi(this); + + QString chtml = getCreditsHtml(QStringList()); + ui->creditsText->setHtml(chtml); + + ui->urlLabel->setOpenExternalLinks(true); + + ui->icon->setPixmap(MMC->getThemedIcon("multimc").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); + + connect(ui->closeButton, SIGNAL(clicked()), SLOT(close())); + + connect(ui->aboutQt, &QPushButton::clicked, &QApplication::aboutQt); + + loadPatronList(); +} + +AboutDialog::~AboutDialog() +{ + delete ui; +} + +void AboutDialog::loadPatronList() +{ + NetJob* job = new NetJob("Patreon Patron List"); + patronListDownload = ByteArrayDownload::make(QUrl("http://files.multimc.org/patrons.txt")); + job->addNetAction(patronListDownload); + connect(job, &NetJob::succeeded, this, &AboutDialog::patronListLoaded); + job->start(); +} + +void AboutDialog::patronListLoaded() +{ + QString patronListStr(patronListDownload->m_data); + QString html = getCreditsHtml(patronListStr.split("\n", QString::SkipEmptyParts)); + ui->creditsText->setHtml(html); +} + diff --git a/application/dialogs/AboutDialog.h b/application/dialogs/AboutDialog.h new file mode 100644 index 00000000..1885e9c0 --- /dev/null +++ b/application/dialogs/AboutDialog.h @@ -0,0 +1,47 @@ +/* Copyright 2013-2015 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; + + ByteArrayDownloadPtr patronListDownload; +}; diff --git a/application/dialogs/AboutDialog.ui b/application/dialogs/AboutDialog.ui new file mode 100644 index 00000000..2b5f8b78 --- /dev/null +++ b/application/dialogs/AboutDialog.ui @@ -0,0 +1,544 @@ + + + AboutDialog + + + + 0 + 0 + 707 + 593 + + + + + 450 + 400 + + + + About MultiMC + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 64 + 64 + + + + + 64 + 64 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 15 + + + + MultiMC 5 + + + Qt::AlignCenter + + + + + + + 0 + + + + + 0 + 0 + 695 + 297 + + + + 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 + + + + © 2013-2015 MultiMC Contributors + + + Qt::AlignCenter + + + + + + + + 10 + + + + <html><head/><body><p><a href="http://github.com/MultiMC/MultiMC5"><span style=" text-decoration: underline; color:#0000ff;">http://github.com/MultiMC/MultiMC5</span></a></p></body></html> + + + Qt::AlignCenter + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + 0 + 0 + 695 + 297 + + + + Credits + + + + + + true + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Oxygen-Sans'; font-size:11pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"><br /></p></body></html> + + + Qt::TextBrowserInteraction + + + + + + + No Language file loaded. + + + true + + + + + + + + + 0 + 0 + 695 + 297 + + + + License + + + + + + + 0 + 0 + + + + + DejaVu Sans Mono + + + + true + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'DejaVu Sans Mono'; font-size:11pt; font-weight:400; font-style:normal;"> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Bitstream Vera Sans'; font-size:18pt; font-weight:600;">MultiMC</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Copyright 2012-2014 MultiMC Contributors</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">you may not use this file except in compliance with the License.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">You may obtain a copy of the License at</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;"> http://www.apache.org/licenses/LICENSE-2.0</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Unless required by applicable law or agreed to in writing, software</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">See the License for the specific language governing permissions and</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">limitations under the License.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;"><br /></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Bitstream Vera Sans'; font-size:18pt; font-weight:600;">QSLog</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Copyright (c) 2010, Razvan Petru</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">All rights reserved.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Redistribution and use in source and binary forms, with or without modification,</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">are permitted provided that the following conditions are met:</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">* Redistributions of source code must retain the above copyright notice, this</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> list of conditions and the following disclaimer.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">* Redistributions in binary form must reproduce the above copyright notice, this</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> list of conditions and the following disclaimer in the documentation and/or other</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> materials provided with the distribution.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">* The name of the contributors may not be used to endorse or promote products</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> derived from this software without specific prior written permission.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot; AND</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">OF THE POSSIBILITY OF SUCH DAMAGE.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Bitstream Vera Sans'; font-size:18pt; font-weight:600;">Group View (instance view)</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> /*</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> * Copyright (C) 2007 Rafael Fernández López &lt;ereslibre@kde.org&gt;</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> * Copyright (C) 2007 John Tapsell &lt;tapsell@kde.org&gt;</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> *</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> * This library is free software; you can redistribute it and/or</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> * modify it under the terms of the GNU Library General Public</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> * License as published by the Free Software Foundation; either</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> * version 2 of the License, or (at your option) any later version.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> *</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> * This library is distributed in the hope that it will be useful,</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> * Library General Public License for more details.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> *</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> * You should have received a copy of the GNU Library General Public License</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> * along with this library; see the file COPYING.LIB. If not, write to</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> * Boston, MA 02110-1301, USA.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> */</span></p> +<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Bitstream Vera Sans'; font-size:18pt; font-weight:600;">Batch icon set</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">You are free to use Batch (the &quot;icon set&quot;) or any part thereof (the &quot;icons&quot;)</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">in any personal, open-source or commercial work without obligation of payment</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">(monetary or otherwise) or attribution. Do not sell the icon set, host</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">the icon set or rent the icon set (either in existing or modified form).</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">While attribution is optional, it is always appreciated.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Intellectual property rights are not transferred with the download of the icons.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL ADAM WHITCROFT</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL,</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THE USE OF THE ICONS,</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://adamwhitcroft.com/batch/"><span style=" text-decoration: underline; color:#68a0df;">http://adamwhitcroft.com/batch/</span></a></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;"><br /></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Bitstream Vera Sans'; font-size:18pt; font-weight:600;">Pack200</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">The GNU General Public License (GPL)</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Version 2, June 1991</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">+ &quot;CLASSPATH&quot; EXCEPTION TO THE GPL</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Certain source files distributed by Oracle America and/or its affiliates are</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">subject to the following clarification and special exception to the GPL, but</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">only where Oracle has expressly included in the particular source file's header</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">the words &quot;Oracle designates this particular file as subject to the &quot;Classpath&quot;</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">exception as provided by Oracle in the LICENSE file that accompanied this code.&quot;</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> Linking this library statically or dynamically with other modules is making</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> a combined work based on this library. Thus, the terms and conditions of</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> the GNU General Public License cover the whole combination.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> As a special exception, the copyright holders of this library give you</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> permission to link this library with independent modules to produce an</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> executable, regardless of the license terms of these independent modules,</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> and to copy and distribute the resulting executable under terms of your</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> choice, provided that you also meet, for each linked independent module,</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> the terms and conditions of the license of that module. An independent</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> module is a module which is not derived from or based on this library. If</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> you modify this library, you may extend this exception to your version of</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> the library, but you are not obligated to do so. If you do not wish to do</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> so, delete this exception statement from your version.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Bitstream Vera Sans'; font-size:18pt; font-weight:600;">Quazip</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Copyright (C) 2005-2011 Sergey A. Tachenov</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">This program is free software; you can redistribute it and/or modify it</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">under the terms of the GNU Lesser General Public License as published by</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">the Free Software Foundation; either version 2 of the License, or (at</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">your option) any later version.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">This program is distributed in the hope that it will be useful, but</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">WITHOUT ANY WARRANTY; without even the implied warranty of</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">General Public License for more details.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">You should have received a copy of the GNU Lesser General Public License</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">along with this program; if not, write to the Free Software Foundation,</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">See COPYING file for the full LGPL text.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Original ZIP package is copyrighted by Gilles Vollant, see</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">quazip/(un)zip.h files for details, basically it's zlib license.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Bitstream Vera Sans'; font-size:18pt; font-weight:600;">xz-minidec</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">/*</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> * XZ decompressor</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> *</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> * Authors: Lasse Collin &lt;lasse.collin@tukaani.org&gt;</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> * Igor Pavlov &lt;http://7-zip.org/&gt;</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> *</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> * This file has been put into the public domain.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> * You can do whatever you want with this file.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> */</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Bitstream Vera Sans'; font-size:18pt; font-weight:600;">Java IconLoader class</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Copyright (c) 2011, Chris Molini</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">All rights reserved.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Redistribution and use in source and binary forms, with or without</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">modification, are permitted provided that the following conditions are met:</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> * Redistributions of source code must retain the above copyright</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> notice, this list of conditions and the following disclaimer.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> * Redistributions in binary form must reproduce the above copyright</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> notice, this list of conditions and the following disclaimer in the</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> documentation and/or other materials provided with the distribution.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> * Neither the name of the &lt;organization&gt; nor the</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> names of its contributors may be used to endorse or promote products</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> derived from this software without specific prior written permission.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot; AND</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">DISCLAIMED. IN NO EVENT SHALL &lt;COPYRIGHT HOLDER&gt; BE LIABLE FOR ANY</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></p> +<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Bitstream Vera Sans'; font-size:18pt; font-weight:600;">ColumnResizer</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">/*</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> * Copyright 2011 Aurélien Gâteau &lt;agateau@kde.org&gt;</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> * License: LGPL v2.1 or later (see COPYING)</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;"> */</span></p></body></html> + + + Qt::TextBrowserInteraction + + + + + + + + + 0 + 0 + 695 + 297 + + + + Forking/Redistribution + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Oxygen-Sans'; font-size:11pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Bitstream Vera Sans';">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.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Bitstream Vera Sans';"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Bitstream Vera Sans';">Part of the reason for using the Apache license is we don't want people using the &quot;MultiMC&quot; name when redistributing the project. This means people must take the time to go through the source code and remove all references to &quot;MultiMC&quot;, including but not limited to the project icon and the title of windows, (no *MultiMC-fork* in the title).</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Bitstream Vera Sans';"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Bitstream Vera Sans';">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 </span><span style=" font-family:'Bitstream Vera Sans'; font-weight:600;">without</span><span style=" font-family:'Bitstream Vera Sans';"> implying that you have our blessing.</span></p></body></html> + + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + + + + + + false + + + About Qt + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Close + + + + + + + + + + + + diff --git a/application/dialogs/AccountSelectDialog.cpp b/application/dialogs/AccountSelectDialog.cpp new file mode 100644 index 00000000..3bf83d62 --- /dev/null +++ b/application/dialogs/AccountSelectDialog.cpp @@ -0,0 +1,85 @@ +/* Copyright 2013-2015 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 "AccountSelectDialog.h" +#include "ui_AccountSelectDialog.h" + +#include + +#include + +#include + +#include + +AccountSelectDialog::AccountSelectDialog(const QString &message, int flags, QWidget *parent) + : QDialog(parent), ui(new Ui::AccountSelectDialog) +{ + ui->setupUi(this); + + m_accounts = MMC->accounts(); + ui->listView->setModel(m_accounts.get()); + ui->listView->hideColumn(MojangAccountList::ActiveColumn); + + // 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())); +} + +AccountSelectDialog::~AccountSelectDialog() +{ + delete ui; +} + +MojangAccountPtr AccountSelectDialog::selectedAccount() const +{ + return m_selected; +} + +bool AccountSelectDialog::useAsGlobalDefault() const +{ + return ui->globalDefaultCheck->isChecked(); +} + +bool AccountSelectDialog::useAsInstDefaullt() const +{ + return ui->instDefaultCheck->isChecked(); +} + +void AccountSelectDialog::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 AccountSelectDialog::on_buttonBox_rejected() +{ + close(); +} diff --git a/application/dialogs/AccountSelectDialog.h b/application/dialogs/AccountSelectDialog.h new file mode 100644 index 00000000..21784032 --- /dev/null +++ b/application/dialogs/AccountSelectDialog.h @@ -0,0 +1,90 @@ +/* Copyright 2013-2015 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 "auth/MojangAccountList.h" + +namespace Ui +{ +class AccountSelectDialog; +} + +class AccountSelectDialog : 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 AccountSelectDialog(const QString& message="", int flags=0, QWidget *parent = 0); + ~AccountSelectDialog(); + + /*! + * 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::AccountSelectDialog *ui; +}; diff --git a/application/dialogs/AccountSelectDialog.ui b/application/dialogs/AccountSelectDialog.ui new file mode 100644 index 00000000..7af1512a --- /dev/null +++ b/application/dialogs/AccountSelectDialog.ui @@ -0,0 +1,56 @@ + + + AccountSelectDialog + + + + 0 + 0 + 413 + 300 + + + + Select an Account + + + + + + Select an account. + + + + + + + + + + + + Use as default? + + + + + + + Use as default for this instance only? + + + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + diff --git a/application/dialogs/CopyInstanceDialog.cpp b/application/dialogs/CopyInstanceDialog.cpp new file mode 100644 index 00000000..7c98978b --- /dev/null +++ b/application/dialogs/CopyInstanceDialog.cpp @@ -0,0 +1,101 @@ +/* Copyright 2013-2015 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 "Platform.h" +#include "dialogs/VersionSelectDialog.h" +#include "dialogs/ProgressDialog.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) +{ + MultiMCPlatform::fixWM_CLASS(this); + ui->setupUi(this); + resize(minimumSizeHint()); + layout()->setSizeConstraint(QLayout::SetFixedSize); + + InstIconKey = original->iconKey(); + ui->iconButton->setIcon(ENV.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(m_original->group()); + if(index == -1) + { + index = 0; + } + ui->groupBox->setCurrentIndex(index); + ui->groupBox->lineEdit()->setPlaceholderText(tr("No group")); +} + +CopyInstanceDialog::~CopyInstanceDialog() +{ + delete ui; +} + +void CopyInstanceDialog::updateDialogState() +{ + ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!instName().isEmpty()); +} + +QString CopyInstanceDialog::instName() const +{ + return ui->instNameTextBox->text(); +} + +QString CopyInstanceDialog::iconKey() const +{ + return InstIconKey; +} + +QString CopyInstanceDialog::instGroup() const +{ + return ui->groupBox->currentText(); +} + +void CopyInstanceDialog::on_iconButton_clicked() +{ + IconPickerDialog dlg(this); + dlg.exec(InstIconKey); + + if (dlg.result() == QDialog::Accepted) + { + InstIconKey = dlg.selectedIconKey; + ui->iconButton->setIcon(ENV.icons()->getIcon(InstIconKey)); + } +} + +void CopyInstanceDialog::on_instNameTextBox_textChanged(const QString &arg1) +{ + updateDialogState(); +} diff --git a/application/dialogs/CopyInstanceDialog.h b/application/dialogs/CopyInstanceDialog.h new file mode 100644 index 00000000..faa20615 --- /dev/null +++ b/application/dialogs/CopyInstanceDialog.h @@ -0,0 +1,52 @@ +/* Copyright 2013-2015 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; + +private +slots: + void on_iconButton_clicked(); + void on_instNameTextBox_textChanged(const QString &arg1); + +private: + Ui::CopyInstanceDialog *ui; + QString InstIconKey; + InstancePtr m_original; +}; diff --git a/application/dialogs/CopyInstanceDialog.ui b/application/dialogs/CopyInstanceDialog.ui new file mode 100644 index 00000000..2615168c --- /dev/null +++ b/application/dialogs/CopyInstanceDialog.ui @@ -0,0 +1,161 @@ + + + CopyInstanceDialog + + + Qt::ApplicationModal + + + + 0 + 0 + 345 + 205 + + + + 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 + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + + + 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 new file mode 100644 index 00000000..0fb5bd19 --- /dev/null +++ b/application/dialogs/CustomMessageBox.cpp @@ -0,0 +1,35 @@ +/* Copyright 2013-2015 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 new file mode 100644 index 00000000..0a7202d7 --- /dev/null +++ b/application/dialogs/CustomMessageBox.h @@ -0,0 +1,26 @@ +/* Copyright 2013-2015 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 new file mode 100644 index 00000000..b78cebee --- /dev/null +++ b/application/dialogs/EditAccountDialog.cpp @@ -0,0 +1,51 @@ +/* Copyright 2013-2015 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->setVisible(flags & UsernameField); + ui->passTextBox->setVisible(flags & PasswordField); +} + +EditAccountDialog::~EditAccountDialog() +{ + delete ui; +} + +void EditAccountDialog::on_label_linkActivated(const QString &link) +{ + QDesktopServices::openUrl(QUrl(link)); +} + +QString EditAccountDialog::username() const +{ + return ui->userTextBox->text(); +} + +QString EditAccountDialog::password() const +{ + return ui->passTextBox->text(); +} diff --git a/application/dialogs/EditAccountDialog.h b/application/dialogs/EditAccountDialog.h new file mode 100644 index 00000000..df8b21bf --- /dev/null +++ b/application/dialogs/EditAccountDialog.h @@ -0,0 +1,60 @@ +/* Copyright 2013-2015 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(); + + /*! + * Gets the text entered in the dialog's username field. + */ + QString username() const; + + /*! + * Gets the text entered in the dialog's password field. + */ + 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 new file mode 100644 index 00000000..5f727bd4 --- /dev/null +++ b/application/dialogs/EditAccountDialog.ui @@ -0,0 +1,94 @@ + + + EditAccountDialog + + + + 0 + 0 + 400 + 148 + + + + Edit Account + + + + + + Message label placeholder. + + + Qt::RichText + + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + Email / Username + + + + + + + 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/IconPickerDialog.cpp b/application/dialogs/IconPickerDialog.cpp new file mode 100644 index 00000000..cafd47b7 --- /dev/null +++ b/application/dialogs/IconPickerDialog.cpp @@ -0,0 +1,156 @@ +/* Copyright 2013-2015 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 "Platform.h" +#include "groupview/InstanceDelegate.h" + +#include "icons/IconList.h" + +IconPickerDialog::IconPickerDialog(QWidget *parent) + : QDialog(parent), ui(new Ui::IconPickerDialog) +{ + MultiMCPlatform::fixWM_CLASS(this); + 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(ENV.icons().get()); + + 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))); +} +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 + QStringList fileNames = QFileDialog::getOpenFileNames(this, selectIcons, QString(), + tr("Icons") + "(*.png *.jpg *.jpeg *.ico)"); + ENV.icons()->installIcons(fileNames); +} + +void IconPickerDialog::removeSelectedIcon() +{ + ENV.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::exec(QString selection) +{ + auto list = ENV.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; +} diff --git a/application/dialogs/IconPickerDialog.h b/application/dialogs/IconPickerDialog.h new file mode 100644 index 00000000..610d9306 --- /dev/null +++ b/application/dialogs/IconPickerDialog.h @@ -0,0 +1,48 @@ +/* Copyright 2013-2015 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 exec(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(); +}; diff --git a/application/dialogs/IconPickerDialog.ui b/application/dialogs/IconPickerDialog.ui new file mode 100644 index 00000000..c548edfb --- /dev/null +++ b/application/dialogs/IconPickerDialog.ui @@ -0,0 +1,67 @@ + + + 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 new file mode 100644 index 00000000..3af5c702 --- /dev/null +++ b/application/dialogs/LoginDialog.cpp @@ -0,0 +1,110 @@ +/* Copyright 2013-2015 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 "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(), &ProgressProvider::failed, this, &LoginDialog::onTaskFailed); + connect(m_loginTask.get(), &ProgressProvider::succeeded, this, + &LoginDialog::onTaskSucceeded); + connect(m_loginTask.get(), &ProgressProvider::status, this, &LoginDialog::onTaskStatus); + connect(m_loginTask.get(), &ProgressProvider::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 new file mode 100644 index 00000000..63c95fb8 --- /dev/null +++ b/application/dialogs/LoginDialog.h @@ -0,0 +1,58 @@ +/* Copyright 2013-2015 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 "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 new file mode 100644 index 00000000..b24b1c0c --- /dev/null +++ b/application/dialogs/LoginDialog.ui @@ -0,0 +1,77 @@ + + + LoginDialog + + + + 0 + 0 + 400 + 162 + + + + + 0 + 0 + + + + Add Account + + + + + + Message label placeholder. + + + Qt::RichText + + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + Email / Username + + + + + + + QLineEdit::Password + + + Password + + + + + + + 24 + + + false + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + diff --git a/application/dialogs/ModEditDialogCommon.cpp b/application/dialogs/ModEditDialogCommon.cpp new file mode 100644 index 00000000..4a2115d8 --- /dev/null +++ b/application/dialogs/ModEditDialogCommon.cpp @@ -0,0 +1,40 @@ +#include "ModEditDialogCommon.h" +#include "CustomMessageBox.h" +#include + +bool lastfirst(QModelIndexList &list, int &first, int &last) +{ + if (list.isEmpty()) + return false; + first = last = list[0].row(); + for (auto item : list) + { + int row = item.row(); + if (row < first) + first = row; + if (row > last) + last = row; + } + return true; +} + +void showWebsiteForMod(QWidget *parentDlg, Mod &m) +{ + QString url = m.homeurl(); + if (url.size()) + { + // catch the cases where the protocol is missing + if (!url.startsWith("http")) + { + url = "http://" + url; + } + QDesktopServices::openUrl(url); + } + else + { + CustomMessageBox::selectable( + parentDlg, QObject::tr("How sad!"), + QObject::tr("The mod author didn't provide a website link for this mod."), + QMessageBox::Warning); + } +} diff --git a/application/dialogs/ModEditDialogCommon.h b/application/dialogs/ModEditDialogCommon.h new file mode 100644 index 00000000..e2afb98a --- /dev/null +++ b/application/dialogs/ModEditDialogCommon.h @@ -0,0 +1,9 @@ +#pragma once +#include +#include +#include +#include + +bool lastfirst(QModelIndexList &list, int &first, int &last); + +void showWebsiteForMod(QWidget *parentDlg, Mod &m); diff --git a/application/dialogs/NewInstanceDialog.cpp b/application/dialogs/NewInstanceDialog.cpp new file mode 100644 index 00000000..b3aa805b --- /dev/null +++ b/application/dialogs/NewInstanceDialog.cpp @@ -0,0 +1,207 @@ +/* Copyright 2013-2015 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 + +#include "Platform.h" +#include "VersionSelectDialog.h" +#include "ProgressDialog.h" +#include "IconPickerDialog.h" + +#include +#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; + } + } +}; + +NewInstanceDialog::NewInstanceDialog(QWidget *parent) + : QDialog(parent), ui(new Ui::NewInstanceDialog) +{ + MultiMCPlatform::fixWM_CLASS(this); + ui->setupUi(this); + resize(minimumSizeHint()); + layout()->setSizeConstraint(QLayout::SetFixedSize); + + setSelectedVersion(MMC->minecraftlist()->getLatestStable(), true); + InstIconKey = "infinity"; + ui->iconButton->setIcon(ENV.icons()->getIcon(InstIconKey)); + + ui->modpackEdit->setValidator(new UrlValidator(ui->modpackEdit)); + connect(ui->modpackEdit, &QLineEdit::textChanged, this, &NewInstanceDialog::updateDialogState); + connect(ui->modpackBox, &QRadioButton::clicked, this, &NewInstanceDialog::updateDialogState); + connect(ui->versionBox, &QRadioButton::clicked, this, &NewInstanceDialog::updateDialogState); + + auto groups = MMC->instances()->getGroups().toSet(); + auto groupList = QStringList(groups.toList()); + groupList.sort(Qt::CaseInsensitive); + groupList.removeOne(""); + QString oldValue = MMC->settings()->get("LastUsedGroupForNewInstance").toString(); + groupList.push_front(oldValue); + groupList.push_front(""); + ui->groupBox->addItems(groupList); + int index = groupList.indexOf(oldValue); + if(index == -1) + { + index = 0; + } + ui->groupBox->setCurrentIndex(index); + ui->groupBox->lineEdit()->setPlaceholderText(tr("No group")); +} + +NewInstanceDialog::~NewInstanceDialog() +{ + delete ui; +} + +void NewInstanceDialog::updateDialogState() +{ + bool allowOK = !instName().isEmpty() && + (ui->versionBox->isChecked() && m_selectedVersion || + (ui->modpackBox->isChecked() && ui->modpackEdit->hasAcceptableInput())); + ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(allowOK); +} + +void NewInstanceDialog::setSelectedVersion(BaseVersionPtr version, bool initial) +{ + m_selectedVersion = version; + + if (m_selectedVersion) + { + ui->versionTextBox->setText(version->name()); + if(ui->instNameTextBox->text().isEmpty() && !initial) + { + ui->instNameTextBox->setText(version->name()); + } + } + else + { + ui->versionTextBox->setText(""); + } + + updateDialogState(); +} + +QString NewInstanceDialog::instName() const +{ + return ui->instNameTextBox->text(); +} +QString NewInstanceDialog::instGroup() const +{ + return ui->groupBox->currentText(); +} +QString NewInstanceDialog::iconKey() const +{ + return InstIconKey; +} +QUrl NewInstanceDialog::modpackUrl() const +{ + if (ui->modpackBox->isChecked()) + { + const QUrl url(ui->modpackEdit->text()); + if (url.isValid() && !url.isRelative() && !url.host().isEmpty()) + { + return url; + } + else + { + return QUrl::fromLocalFile(ui->modpackEdit->text()); + } + } + else + { + return QUrl(); + } +} + +BaseVersionPtr NewInstanceDialog::selectedVersion() const +{ + return m_selectedVersion; +} + +void NewInstanceDialog::on_btnChangeVersion_clicked() +{ + VersionSelectDialog vselect(MMC->minecraftlist().get(), tr("Change Minecraft version"), + this); + vselect.exec(); + if (vselect.result() == QDialog::Accepted) + { + BaseVersionPtr version = vselect.selectedVersion(); + if (version) + setSelectedVersion(version); + } +} + +void NewInstanceDialog::on_iconButton_clicked() +{ + IconPickerDialog dlg(this); + dlg.exec(InstIconKey); + + if (dlg.result() == QDialog::Accepted) + { + InstIconKey = dlg.selectedIconKey; + ui->iconButton->setIcon(ENV.icons()->getIcon(InstIconKey)); + } +} + +void NewInstanceDialog::on_instNameTextBox_textChanged(const QString &arg1) +{ + updateDialogState(); +} + +void NewInstanceDialog::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()); + } + } +} diff --git a/application/dialogs/NewInstanceDialog.h b/application/dialogs/NewInstanceDialog.h new file mode 100644 index 00000000..bc3152b9 --- /dev/null +++ b/application/dialogs/NewInstanceDialog.h @@ -0,0 +1,59 @@ +/* Copyright 2013-2015 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" + +namespace Ui +{ +class NewInstanceDialog; +} + +class NewInstanceDialog : public QDialog +{ + Q_OBJECT + +public: + explicit NewInstanceDialog(QWidget *parent = 0); + ~NewInstanceDialog(); + + void updateDialogState(); + + void setSelectedVersion(BaseVersionPtr version, bool initial = false); + + void loadVersionList(); + + QString instName() const; + QString instGroup() const; + QString iconKey() const; + QUrl modpackUrl() const; + BaseVersionPtr selectedVersion() const; + +private +slots: + void on_btnChangeVersion_clicked(); + void on_iconButton_clicked(); + void on_modpackBtn_clicked(); + void on_instNameTextBox_textChanged(const QString &arg1); + +private: + Ui::NewInstanceDialog *ui; + + BaseVersionPtr m_selectedVersion; + QString InstIconKey; +}; diff --git a/application/dialogs/NewInstanceDialog.ui b/application/dialogs/NewInstanceDialog.ui new file mode 100644 index 00000000..6cb0c97c --- /dev/null +++ b/application/dialogs/NewInstanceDialog.ui @@ -0,0 +1,309 @@ + + + NewInstanceDialog + + + Qt::ApplicationModal + + + + 0 + 0 + 277 + 404 + + + + New Instance + + + + :/icons/toolbar/new:/icons/toolbar/new + + + 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 + + + + + + + + + + + false + + + ... + + + + + + + false + + + http:// + + + + + + + true + + + + + + + ... + + + + + + + Impor&t Modpack (local file or link): + + + + + + + Vani&lla Minecraft (select version): + + + true + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Horizontal + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + instNameTextBox + groupBox + versionBox + versionTextBox + btnChangeVersion + modpackBox + modpackEdit + modpackBtn + iconButton + + + + + buttonBox + accepted() + NewInstanceDialog + accept() + + + 257 + 333 + + + 157 + 274 + + + + + buttonBox + rejected() + NewInstanceDialog + reject() + + + 325 + 333 + + + 286 + 274 + + + + + modpackBox + toggled(bool) + modpackEdit + setEnabled(bool) + + + 81 + 229 + + + 236 + 221 + + + + + modpackBox + toggled(bool) + modpackBtn + setEnabled(bool) + + + 129 + 225 + + + 328 + 229 + + + + + versionBox + toggled(bool) + versionTextBox + setEnabled(bool) + + + 93 + 195 + + + 213 + 191 + + + + + versionBox + toggled(bool) + btnChangeVersion + setEnabled(bool) + + + 104 + 198 + + + 322 + 192 + + + + + diff --git a/application/dialogs/NotificationDialog.cpp b/application/dialogs/NotificationDialog.cpp new file mode 100644 index 00000000..8f920371 --- /dev/null +++ b/application/dialogs/NotificationDialog.cpp @@ -0,0 +1,84 @@ +#include "NotificationDialog.h" +#include "ui_NotificationDialog.h" + +#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; + 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 new file mode 100644 index 00000000..27b9e853 --- /dev/null +++ b/application/dialogs/NotificationDialog.h @@ -0,0 +1,44 @@ +#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 new file mode 100644 index 00000000..a2a276e9 --- /dev/null +++ b/application/dialogs/NotificationDialog.ui @@ -0,0 +1,85 @@ + + + NotificationDialog + + + + 0 + 0 + 320 + 240 + + + + Dialog + + + + + + + + TextLabel + + + + + + + TextLabel + + + true + + + true + + + Qt::TextBrowserInteraction + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + false + + + Don't show again + + + + + + + false + + + Close + + + + + + + + + + diff --git a/application/dialogs/ProgressDialog.cpp b/application/dialogs/ProgressDialog.cpp new file mode 100644 index 00000000..61ebaa28 --- /dev/null +++ b/application/dialogs/ProgressDialog.cpp @@ -0,0 +1,125 @@ +/* Copyright 2013-2015 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 "tasks/Task.h" +#include "Platform.h" + +ProgressDialog::ProgressDialog(QWidget *parent) : QDialog(parent), ui(new Ui::ProgressDialog) +{ + MultiMCPlatform::fixWM_CLASS(this); + ui->setupUi(this); + this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint); + setSkipButton(false); + changeProgress(0, 100); +} + +void ProgressDialog::setSkipButton(bool present, QString label) +{ + 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() +{ + resize(QSize(480, minimumSizeHint().height())); +} + +int ProgressDialog::exec(ProgressProvider *task) +{ + this->task = task; + + // 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()) + return QDialog::exec(); + else + return QDialog::Accepted; +} + +ProgressProvider *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 (e->key() == Qt::Key_Escape) + 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 new file mode 100644 index 00000000..d5153680 --- /dev/null +++ b/application/dialogs/ProgressDialog.h @@ -0,0 +1,65 @@ +/* Copyright 2013-2015 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 ProgressProvider; + +namespace Ui +{ +class ProgressDialog; +} + +class ProgressDialog : public QDialog +{ + Q_OBJECT + +public: + explicit ProgressDialog(QWidget *parent = 0); + ~ProgressDialog(); + + void updateSize(); + + int exec(ProgressProvider *task); + + void setSkipButton(bool present, QString label = QString()); + + ProgressProvider *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: + Ui::ProgressDialog *ui; + + ProgressProvider *task; +}; diff --git a/application/dialogs/ProgressDialog.ui b/application/dialogs/ProgressDialog.ui new file mode 100644 index 00000000..04b8fef3 --- /dev/null +++ b/application/dialogs/ProgressDialog.ui @@ -0,0 +1,66 @@ + + + ProgressDialog + + + + 0 + 0 + 400 + 100 + + + + + 400 + 0 + + + + + 600 + 16777215 + + + + Please wait... + + + + + + Task Status... + + + true + + + + + + + 24 + + + false + + + + + + + + 0 + 0 + + + + Skip + + + + + + + + diff --git a/application/dialogs/UpdateDialog.cpp b/application/dialogs/UpdateDialog.cpp new file mode 100644 index 00000000..f7e0bcd6 --- /dev/null +++ b/application/dialogs/UpdateDialog.cpp @@ -0,0 +1,186 @@ +#include "UpdateDialog.h" +#include "ui_UpdateDialog.h" +#include "Platform.h" +#include +#include "MultiMC.h" +#include + +UpdateDialog::UpdateDialog(bool hasUpdate, QWidget *parent) : QDialog(parent), ui(new Ui::UpdateDialog) +{ + MultiMCPlatform::fixWM_CLASS(this); + 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->setDisabled(true); + ui->btnUpdateOnExit->setDisabled(true); + } + loadChangelog(); +} + +UpdateDialog::~UpdateDialog() +{ +} + +void UpdateDialog::loadChangelog() +{ + auto channel = MMC->settings()->get("UpdateChannel").toString(); + dljob.reset(new NetJob("Changelog")); + auto url = QString("https://raw.githubusercontent.com/MultiMC/MultiMC5/%1/changelog.md").arg(channel); + changelogDownload = ByteArrayDownload::make(QUrl(url)); + dljob->addNetAction(changelogDownload); + connect(dljob.get(), &NetJob::succeeded, this, &UpdateDialog::changelogLoaded); + connect(dljob.get(), &NetJob::failed, this, &UpdateDialog::changelogFailed); + dljob->start(); +} + +// TODO: this will be replaced. +QString reprocessMarkdown(QString markdown) +{ + QString htmlData; + QTextStream html(&htmlData); + auto lines = markdown.split(QRegExp("[\r]?[\n]"),QString::KeepEmptyParts); + enum + { + BASE, + LIST1, + LIST2 + }state = BASE; + html << ""; + int i = 0; + auto procLine = [&](QString line) -> QString + { + // [GitHub issues](https://github.com/MultiMC/MultiMC5/issues) + line.replace(QRegExp("\\[([^\\]]+)\\]\\(([^\\)]+)\\)"), "\\1"); + return line; + }; + for(auto line: lines) + { + if(line.isEmpty()) + { + // html << "
\n"; + } + else switch (state) + { + case BASE: + if(line.startsWith("##")) + { + html << "

" << procLine(line.mid(2)) << "

\n"; + } + else if(line.startsWith("#")) + { + html << "

" << procLine(line.mid(1)) << "

\n"; + } + else if(line.startsWith("- ")) + { + state = LIST1; + html << "
    \n"; + html << "
  • " << procLine(line.mid(2)) << "
  • \n"; + } + else qCritical() << "Invalid input on line " << i << ": " << line; + break; + case LIST1: + if(line.startsWith("##")) + { + state = BASE; + html << "
\n"; + html << "

" << procLine(line.mid(2)) << "

\n"; + } + else if(line.startsWith("#")) + { + state = BASE; + html << "\n"; + html << "

" << procLine(line.mid(1)) << "

\n"; + } + else if(line.startsWith("- ")) + { + html << "
  • " << procLine(line.mid(2)) << "
  • \n"; + } + else if(line.startsWith(" - ")) + { + state = LIST2; + html << "
      \n"; + html << "
    • " << procLine(line.mid(4)) << "
    • \n"; + } + else qCritical() << "Invalid input on line " << i << ": " << line; + break; + case LIST2: + if(line.startsWith("##")) + { + state = BASE; + html << "
    \n"; + html << "\n"; + html << "

    " << procLine(line.mid(2)) << "

    \n"; + } + else if(line.startsWith("#")) + { + state = BASE; + html << "\n"; + html << "\n"; + html << "

    " << procLine(line.mid(1)) << "

    \n"; + } + else if(line.startsWith("- ")) + { + state = LIST1; + html << "\n"; + html << "
  • " << procLine(line.mid(2)) << "
  • \n"; + } + else if(line.startsWith(" - ")) + { + html << "
  • " << procLine(line.mid(4)) << "
  • \n"; + } + else qCritical() << "Invalid input on line " << i << ": " << line; + break; + } + i++; + } + if(state == LIST2) + { + html << "\n"; + state = LIST1; + } + if(state == LIST1) + { + html << "\n"; + state = BASE; + } + if (state != BASE) + { + qCritical() << "Reprocessing markdown didn't end in a final state!"; + } + html << "\n"; + qDebug() << htmlData; + return htmlData; +} + +void UpdateDialog::changelogLoaded() +{ + auto rawMarkdown = QString::fromUtf8(changelogDownload->m_data); + auto html = reprocessMarkdown(rawMarkdown); + ui->changelogBrowser->setHtml(html); +} + +void UpdateDialog::changelogFailed() +{ + ui->changelogBrowser->setHtml(tr("

    Failed to fetch changelog...

    ")); +} + +void UpdateDialog::on_btnUpdateLater_clicked() +{ + reject(); +} + +void UpdateDialog::on_btnUpdateNow_clicked() +{ + done(UPDATE_NOW); +} + +void UpdateDialog::on_btnUpdateOnExit_clicked() +{ + done(UPDATE_ONEXIT); +} diff --git a/application/dialogs/UpdateDialog.h b/application/dialogs/UpdateDialog.h new file mode 100644 index 00000000..2ab2ff7c --- /dev/null +++ b/application/dialogs/UpdateDialog.h @@ -0,0 +1,61 @@ +/* Copyright 2013-2015 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/ByteArrayDownload.h" +#include "net/NetJob.h" + +namespace Ui +{ +class UpdateDialog; +} + +enum UpdateAction +{ + UPDATE_LATER = QDialog::Rejected, + UPDATE_NOW = QDialog::Accepted, + UPDATE_ONEXIT = 2 +}; + +class UpdateDialog : public QDialog +{ + Q_OBJECT + +public: + explicit UpdateDialog(bool hasUpdate = true, QWidget *parent = 0); + ~UpdateDialog(); + +private: + Ui::UpdateDialog *ui; +public slots: + void on_btnUpdateNow_clicked(); + void on_btnUpdateOnExit_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(); + +private: + ByteArrayDownloadPtr changelogDownload; + NetJobPtr dljob; +}; diff --git a/application/dialogs/UpdateDialog.ui b/application/dialogs/UpdateDialog.ui new file mode 100644 index 00000000..06f4f086 --- /dev/null +++ b/application/dialogs/UpdateDialog.ui @@ -0,0 +1,106 @@ + + + UpdateDialog + + + + 0 + 0 + 657 + 673 + + + + MultiMC Update + + + + :/icons/toolbar/checkupdate:/icons/toolbar/checkupdate + + + + + + + + + 14 + + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + changelogBrowser + + + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Bitstream Vera Sans'; font-size:11pt; font-weight:400; font-style:normal;"> +<p align="center" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:22pt;">Loading changelog...</span></p></body></html> + + + true + + + + + + + + + + 0 + 0 + + + + Update now + + + + + + + Update after MultiMC closes + + + + + + + + 0 + 0 + + + + Don't update yet + + + + + + + + + changelogBrowser + btnUpdateNow + btnUpdateOnExit + btnUpdateLater + + + + + + diff --git a/application/dialogs/VersionSelectDialog.cpp b/application/dialogs/VersionSelectDialog.cpp new file mode 100644 index 00000000..d1be4ad0 --- /dev/null +++ b/application/dialogs/VersionSelectDialog.cpp @@ -0,0 +1,177 @@ +/* Copyright 2013-2015 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 "ui_VersionSelectDialog.h" + +#include + +#include +#include "Platform.h" + +#include +#include +#include +#include +#include + +class VersionSelectProxyModel : public QSortFilterProxyModel +{ + Q_OBJECT +public: + VersionSelectProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent) + { + } + + struct Filter + { + QString string; + bool exact = false; + }; + + QHash filters() const + { + return m_filters; + } + void setFilter(const int column, const QString &filter, const bool exact) + { + Filter f; + f.string = filter; + f.exact = exact; + m_filters[column] = f; + invalidateFilter(); + } + void clearFilters() + { + m_filters.clear(); + invalidateFilter(); + } + +protected: + bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const + { + for (auto it = m_filters.begin(); it != m_filters.end(); ++it) + { + const QString version = + sourceModel()->index(source_row, it.key()).data().toString(); + + if (it.value().exact) + { + if (version != it.value().string) + { + return false; + } + continue; + } + + if (!Util::versionIsInInterval(version, it.value().string)) + { + return false; + } + } + return true; + } + + QHash m_filters; +}; + +VersionSelectDialog::VersionSelectDialog(BaseVersionList *vlist, QString title, QWidget *parent, + bool cancelable) + : QDialog(parent), ui(new Ui::VersionSelectDialog) +{ + MultiMCPlatform::fixWM_CLASS(this); + ui->setupUi(this); + setWindowModality(Qt::WindowModal); + setWindowTitle(title); + + m_vlist = vlist; + + m_proxyModel = new VersionSelectProxyModel(this); + m_proxyModel->setSourceModel(vlist); + + ui->listView->setModel(m_proxyModel); + ui->listView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); + ui->listView->header()->setSectionResizeMode(resizeOnColumn, QHeaderView::Stretch); + + if (!cancelable) + { + ui->buttonBox->button(QDialogButtonBox::Cancel)->setEnabled(false); + } +} + +void VersionSelectDialog::setEmptyString(QString emptyString) +{ + ui->listView->setEmptyString(emptyString); +} + +VersionSelectDialog::~VersionSelectDialog() +{ + delete ui; +} + +void VersionSelectDialog::setResizeOn(int column) +{ + ui->listView->header()->setSectionResizeMode(resizeOnColumn, QHeaderView::ResizeToContents); + resizeOnColumn = column; + ui->listView->header()->setSectionResizeMode(resizeOnColumn, QHeaderView::Stretch); +} + +int VersionSelectDialog::exec() +{ + QDialog::open(); + if (!m_vlist->isLoaded()) + { + loadList(); + } + m_proxyModel->invalidate(); + return QDialog::exec(); +} + +void VersionSelectDialog::loadList() +{ + Task *loadTask = m_vlist->getLoadTask(); + if (!loadTask) + { + return; + } + ProgressDialog *taskDlg = new ProgressDialog(this); + loadTask->setParent(taskDlg); + taskDlg->exec(loadTask); + delete taskDlg; +} + +BaseVersionPtr VersionSelectDialog::selectedVersion() const +{ + auto currentIndex = ui->listView->selectionModel()->currentIndex(); + auto variant = m_proxyModel->data(currentIndex, BaseVersionList::VersionPointerRole); + return variant.value(); +} + +void VersionSelectDialog::on_refreshButton_clicked() +{ + loadList(); +} + +void VersionSelectDialog::setExactFilter(int column, QString filter) +{ + m_proxyModel->setFilter(column, filter, true); +} + +void VersionSelectDialog::setFuzzyFilter(int column, QString filter) +{ + m_proxyModel->setFilter(column, filter, false); +} + +#include "VersionSelectDialog.moc" diff --git a/application/dialogs/VersionSelectDialog.h b/application/dialogs/VersionSelectDialog.h new file mode 100644 index 00000000..69e52fe6 --- /dev/null +++ b/application/dialogs/VersionSelectDialog.h @@ -0,0 +1,66 @@ +/* Copyright 2013-2015 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 "BaseVersion.h" + +class BaseVersionList; + +namespace Ui +{ +class VersionSelectDialog; +} + +class VersionSelectProxyModel; + +class VersionSelectDialog : public QDialog +{ + Q_OBJECT + +public: + explicit VersionSelectDialog(BaseVersionList *vlist, QString title, QWidget *parent = 0, + bool cancelable = true); + ~VersionSelectDialog(); + + virtual int exec(); + + //! Starts a task that loads the list. + void loadList(); + + BaseVersionPtr selectedVersion() const; + + void setFuzzyFilter(int column, QString filter); + void setExactFilter(int column, QString filter); + void setEmptyString(QString emptyString); + void setResizeOn(int column); + void setUseLatest(const bool useLatest); + +private +slots: + void on_refreshButton_clicked(); + +private: + Ui::VersionSelectDialog *ui; + + BaseVersionList *m_vlist; + + VersionSelectProxyModel *m_proxyModel; + + int resizeOnColumn = 0; +}; diff --git a/application/dialogs/VersionSelectDialog.ui b/application/dialogs/VersionSelectDialog.ui new file mode 100644 index 00000000..e4014e11 --- /dev/null +++ b/application/dialogs/VersionSelectDialog.ui @@ -0,0 +1,110 @@ + + + VersionSelectDialog + + + + 0 + 0 + 400 + 347 + + + + Choose Version + + + + + + Qt::ScrollBarAlwaysOff + + + true + + + false + + + false + + + true + + + true + + + false + + + + + + + + + Reloads the version list. + + + &Refresh + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + + VersionListView + QTreeView +
    widgets/VersionListView.h
    +
    +
    + + + + buttonBox + accepted() + VersionSelectDialog + accept() + + + 257 + 290 + + + 157 + 274 + + + + + buttonBox + rejected() + VersionSelectDialog + reject() + + + 325 + 290 + + + 286 + 274 + + + + +
    diff --git a/application/groupview/GroupView.cpp b/application/groupview/GroupView.cpp new file mode 100644 index 00000000..89694b87 --- /dev/null +++ b/application/groupview/GroupView.cpp @@ -0,0 +1,1003 @@ +#include "GroupView.h" + +#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); +} + +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(); +} + +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::updateGeometries() +{ + geometryCache.clear(); + int previousScroll = verticalScrollBar()->value(); + + 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) + { + cats.insert(groupName, new VisualGroup(old)); + } + else + { + cats.insert(groupName, new VisualGroup(groupName, this)); + } + } + } + + /*if (m_editedCategory) + { + m_editedCategory = cats[m_editedCategory->text]; + }*/ + + qDeleteAll(m_groups); + m_groups = cats.values(); + + for (auto cat : m_groups) + { + cat->update(); + } + + 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())); + + viewport()->update(); +} + +void GroupView::modelReset() +{ + scheduleDelayedItemsLayout(); + executeDelayedItemsLayout(); +} + +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) const +{ + for (auto group : m_groups) + { + if(group->hitScan(pos) & VisualGroup::CheckboxHit) + { + return group; + } + } + return nullptr; +} + +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) +{ + // endCategoryEditor(); + + 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; + + m_pressedCategory = categoryAt(geometryPos); + if (m_pressedCategory) + { + 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) +{ + 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) +{ + QPoint visualPos = event->pos(); + QPoint geometryPos = event->pos() + offset(); + QPersistentModelIndex index = indexAt(visualPos); + + bool click = (index == m_pressedIndex && index.isValid()) || + (m_pressedCategory && m_pressedCategory == categoryAt(geometryPos)); + + if (click && m_pressedCategory) + { + if (state() == ExpandingState) + { + m_pressedCategory->collapsed = false; + updateGeometries(); + viewport()->update(); + event->accept(); + return; + } + else if (state() == CollapsingState) + { + m_pressedCategory->collapsed = true; + updateGeometries(); + viewport()->update(); + event->accept(); + 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) +{ + 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); +} + +void GroupView::paintEvent(QPaintEvent *event) +{ + executeDelayedItemsLayout(); + + QPainter painter(this->viewport()); + + QStyleOptionViewItemV4 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 |= + QStyleOptionViewItemV2::WrapText; // FIXME: what is the meaning of this anyway? + 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(); + } +} + +void GroupView::dragEnterEvent(QDragEnterEvent *event) +{ + if (!isDragEventAccepted(event)) + { + return; + } + m_lastDragPosition = event->pos() + offset(); + viewport()->update(); + event->accept(); +} + +void GroupView::dragMoveEvent(QDragMoveEvent *event) +{ + if (!isDragEventAccepted(event)) + { + return; + } + m_lastDragPosition = event->pos() + offset(); + viewport()->update(); + event->accept(); +} + +void GroupView::dragLeaveEvent(QDragLeaveEvent *event) +{ + m_lastDragPosition = QPoint(); + viewport()->update(); +} + +void GroupView::dropEvent(QDropEvent *event) +{ + m_lastDragPosition = QPoint(); + + stopAutoScroll(); + setState(NoState); + + if (event->source() != this || !(event->possibleActions() & Qt::MoveAction)) + { + return; + } + + 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(); +} + +void GroupView::startDrag(Qt::DropActions supportedActions) +{ + 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 +{ + return geometryRect(index).translated(-offset()); +} + +QRect GroupView::geometryRect(const QModelIndex &index) const +{ + 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 +{ + 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) +{ + 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 false; +} + +QPair GroupView::rowDropPos(const QPoint &pos) +{ + return qMakePair(nullptr, -1); + // FIXME: PIXIE DUST. + /* + // check that we aren't on a category header and calculate which category we're in + VisualGroup *category = 0; + { + int y = 0; + for (auto cat : m_groups) + { + if (pos.y() > y && pos.y() < (y + cat->headerHeight())) + { + return qMakePair(nullptr, -1); + } + y += cat->totalHeight() + m_categoryMargin; + if (pos.y() < y) + { + category = cat; + break; + } + } + if (category == 0) + { + return qMakePair(nullptr, -1); + } + } + + QList indices = category->items(); + + // calculate the internal column + int internalColumn = -1; + { + const int itemWidth = this->itemWidth(); + if (pos.x() >= (itemWidth * itemsPerRow())) + { + internalColumn = itemsPerRow(); + } + else + { + for (int i = 0, c = 0; i < contentWidth(); i += itemWidth + 10 , ++c) + { + if (pos.x() > (i - itemWidth / 2) && pos.x() <= (i + itemWidth / 2)) + { + internalColumn = c; + break; + } + } + } + if (internalColumn == -1) + { + return qMakePair(nullptr, -1); + } + } + + // calculate the internal row + int internalRow = -1; + { + // FIXME rework the drag and drop code + const int top = category->verticalPosition(); + for (int r = 0, h = top; r < category->numRows(); + h += itemHeightForCategoryRow(category, r), ++r) + { + if (pos.y() > h && pos.y() < (h + itemHeightForCategoryRow(category, r))) + { + internalRow = r; + break; + } + } + if (internalRow == -1) + { + return qMakePair(nullptr, -1); + } + // this happens if we're in the margin between a one category and another + // categories header + if (internalRow > (indices.size() / itemsPerRow())) + { + return qMakePair(nullptr, -1); + } + } + + // flaten the internalColumn/internalRow to one row + int categoryRow = internalRow * itemsPerRow() + internalColumn; + + // this is used if we're past the last item + if (categoryRow >= indices.size()) + { + return qMakePair(category, indices.last().row() + 1); + } + + return qMakePair(category, indices.at(categoryRow).row()); + */ +} + +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 new file mode 100644 index 00000000..93e45ed7 --- /dev/null +++ b/application/groupview/GroupView.h @@ -0,0 +1,125 @@ +#pragma once + +#include +#include +#include +#include + +struct GroupViewRoles +{ + enum + { + GroupRole = Qt::UserRole, + ProgressValueRole, + ProgressMaximumRole + }; +}; + +struct VisualGroup; + +class GroupView : public QAbstractItemView +{ + Q_OBJECT + +public: + GroupView(QWidget *parent = 0); + ~GroupView(); + + void setModel(QAbstractItemModel *model) override; + + /// 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; + 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; + }; +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; + virtual void updateGeometries() override; + void modelReset(); + +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; + +private: + friend struct VisualGroup; + QList m_groups; + + // 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) 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 new file mode 100644 index 00000000..a45c5ae9 --- /dev/null +++ b/application/groupview/GroupedProxyModel.cpp @@ -0,0 +1,42 @@ +#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) + { + qDebug() << leftCategory << "<" << rightCategory; + } + if(result == 0) + { + qDebug() << leftCategory << "=" << rightCategory; + return subSortLessThan(left, right); + } + if(result > 0) + { + qDebug() << leftCategory << ">" << rightCategory; + } + 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 new file mode 100644 index 00000000..12edee0f --- /dev/null +++ b/application/groupview/GroupedProxyModel.h @@ -0,0 +1,15 @@ +#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 new file mode 100644 index 00000000..b9ad353c --- /dev/null +++ b/application/groupview/InstanceDelegate.cpp @@ -0,0 +1,362 @@ +/* Copyright 2013-2015 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 "GroupView.h" +#include "BaseInstance.h" +#include "InstanceList.h" + +QCache ListViewDelegate::m_pixmapCache; + +// 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 QStyleOptionViewItemV4 &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 QStyleOptionViewItemV4 &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 QStyleOptionViewItemV4 &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 QStyleOptionViewItemV4 &option, BaseInstance *instance) +{ + QList pixmaps; + const BaseInstance::InstanceFlags flags = instance->flags(); + if (flags & BaseInstance::VersionBrokenFlag) + { + pixmaps.append("broken"); + } + if (flags & BaseInstance::UpdateAvailable) + { + pixmaps.append("updateavailable"); + } + + // begin easter eggs + if (instance->name().contains("btw", Qt::CaseInsensitive) || + instance->name().contains("better then wolves", Qt::CaseInsensitive) || + instance->name().contains("better than wolves", Qt::CaseInsensitive)) + { + pixmaps.append("herobrine"); + } + if (instance->name().contains("direwolf", Qt::CaseInsensitive)) + { + pixmaps.append("enderman"); + } + if (instance->name().contains("kitten", Qt::CaseInsensitive)) + { + pixmaps.append("kitten"); + } + if (instance->name().contains("derp", Qt::CaseInsensitive)) + { + pixmaps.append("derp"); + } + // end easter eggs + + 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; + } + const QPixmap pixmap = ListViewDelegate::requestBadgePixmap(it.next()).scaled( + itemSide, itemSide, Qt::KeepAspectRatio, Qt::FastTransformation); + painter->drawPixmap(option.rect.width() - x * itemSide + qMax(x - 1, 0) * spacing - itemSide, + y * itemSide + qMax(y - 1, 0) * spacing, itemSide, itemSide, + pixmap); + } + } + painter->translate(-option.rect.topLeft()); +} + +static QSize viewItemTextSize(const QStyleOptionViewItemV4 *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 +{ + QStyleOptionViewItemV4 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 ); + QPalette::ColorGroup cg; + QStyleOptionViewItemV4 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); + } + } + */ + } + + // draw the icon + { + 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; + + 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); + } + + 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 +{ + QStyleOptionViewItemV4 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; +} + +QPixmap ListViewDelegate::requestBadgePixmap(const QString &key) +{ + if (!m_pixmapCache.contains(key)) + { + m_pixmapCache.insert(key, new QPixmap(":/icons/badges/" + key + ".png")); + } + return *m_pixmapCache.object(key); +} diff --git a/application/groupview/InstanceDelegate.h b/application/groupview/InstanceDelegate.h new file mode 100644 index 00000000..2b5439cb --- /dev/null +++ b/application/groupview/InstanceDelegate.h @@ -0,0 +1,35 @@ +/* Copyright 2013-2015 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 +{ +public: + explicit ListViewDelegate(QObject *parent = 0); + + static QPixmap requestBadgePixmap(const QString &key); + +protected: + void paint(QPainter *painter, const QStyleOptionViewItem &option, + const QModelIndex &index) const; + QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; + +private: + static QCache m_pixmapCache; +}; diff --git a/application/groupview/VisualGroup.cpp b/application/groupview/VisualGroup.cpp new file mode 100644 index 00000000..560fc9ca --- /dev/null +++ b/application/groupview/VisualGroup.cpp @@ -0,0 +1,301 @@ +#include "VisualGroup.h" + +#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 x = 0; + 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++; + } + return qMakePair(x, y); +} + +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 new file mode 100644 index 00000000..d8d1f145 --- /dev/null +++ b/application/groupview/VisualGroup.h @@ -0,0 +1,91 @@ +#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 new file mode 100644 index 00000000..b8fa3177 --- /dev/null +++ b/application/install_prereqs.cmake.in @@ -0,0 +1,24 @@ +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") + message("resolving ${resolved_file} as other") + set(${type_var} other PARENT_SCOPE) + elseif(resolved_file MATCHES "^/usr/lib(.+)?/libxcb") + message("resolving ${resolved_file} as other") + set(${type_var} other PARENT_SCOPE) + elseif(resolved_file MATCHES "^/usr/lib(.+)?/libicu") + message("resolving ${resolved_file} as other") + 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 new file mode 100644 index 00000000..111a61ac --- /dev/null +++ b/application/main.cpp @@ -0,0 +1,43 @@ +#include "MultiMC.h" +#include "MainWindow.h" + +int main_gui(MultiMC &app) +{ + // show main window + app.setIconTheme(MMC->settings()->get("IconTheme").toString()); + MainWindow mainWin; + mainWin.restoreState(QByteArray::fromBase64(MMC->settings()->get("MainWindowState").toByteArray())); + mainWin.restoreGeometry(QByteArray::fromBase64(MMC->settings()->get("MainWindowGeometry").toByteArray())); + mainWin.show(); + mainWin.checkSetDefaultJava(); + mainWin.checkInstancePathForProblems(); + return app.exec(); +} + +int main(int argc, char *argv[]) +{ + // initialize Qt + MultiMC app(argc, argv); + + Q_INIT_RESOURCE(instances); + Q_INIT_RESOURCE(multimc); + Q_INIT_RESOURCE(backgrounds); + Q_INIT_RESOURCE(versions); + + 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); + + switch (app.status()) + { + case MultiMC::Initialized: + return main_gui(app); + case MultiMC::Failed: + return 1; + case MultiMC::Succeeded: + return 0; + } +} diff --git a/application/package/linux/MultiMC b/application/package/linux/MultiMC new file mode 100755 index 00000000..80225e53 --- /dev/null +++ b/application/package/linux/MultiMC @@ -0,0 +1,80 @@ +#!/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 +export LD_LIBRARY_PATH="${MMC_DIR}/bin":$LD_LIBRARY_PATH +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" | 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}" $@ + + # Exit with MultiMC's exit code. + exit $? +else + # apt + if which apt-file &>/dev/null; then + LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*"` + COMMAND_LIBS=`for LIBRARY in $LIBRARIES; do apt-file -l search $LIBRARY; done` + COMMAND_LIBS=`echo "$COMMAND_LIBS" | 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 "[^, ]*"` + COMMAND_LIBS=`for LIBRARY in $LIBRARIES; do pkgfile $LIBRARY; done` + COMMAND_LIBS=`echo "$COMMAND_LIBS" | awk -vORS=" " '{ print $1 }'` + INSTALL_CMD="sudo pacman -S $COMMAND_LIBS" + # yum + elif which yum &>/dev/null; then + LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*"` + COMMAND_LIBS=`for LIBRARY in $LIBRARIES; do yum whatprovides $LIBRARY; done` + COMMAND_LIBS=`echo "$COMMAND_LIBS" | awk -vORS=" " '{ print $1 }'` + INSTALL_CMD="sudo yum install $COMMAND_LIBS" + # zypper + elif which zypper &>/dev/null; then + LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*"` + COMMAND_LIBS=`for LIBRARY in $LIBRARIES; do zypper wp $LIBRARY; done` + COMMAND_LIBS=`echo "$COMMAND_LIBS" | awk -vORS=" " '{ print $1 }'` + INSTALL_CMD="sudo zypper install $COMMAND_LIBS" + # emerge + elif which pfl &>/dev/null; then + LIBRARIES=`echo "$DEPS_LIST" | grep -oP "[^, ]*"` + COMMAND_LIBS=`for LIBRARY in $LIBRARIES; do pfl $LIBRARY; done` + COMMAND_LIBS=`echo "$COMMAND_LIBS" | 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: $INSTALL_CMD\n" + + printerror "$MESSAGE" + exit 1 +fi diff --git a/application/pagedialog/PageDialog.cpp b/application/pagedialog/PageDialog.cpp new file mode 100644 index 00000000..a930789e --- /dev/null +++ b/application/pagedialog/PageDialog.cpp @@ -0,0 +1,62 @@ +/* Copyright 2013-2015 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 "Platform.h" +#include "widgets/IconLabel.h" +#include "widgets/PageContainer.h" + +PageDialog::PageDialog(BasePageProviderPtr pageProvider, QString defaultId, QWidget *parent) + : QDialog(parent) +{ + MultiMCPlatform::fixWM_CLASS(this); + 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); + 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) +{ + if (m_container->requestClose(event)) + { + MMC->settings()->set("PagedGeometry", saveGeometry().toBase64()); + QDialog::closeEvent(event); + } +} diff --git a/application/pagedialog/PageDialog.h b/application/pagedialog/PageDialog.h new file mode 100644 index 00000000..8a31cd0a --- /dev/null +++ b/application/pagedialog/PageDialog.h @@ -0,0 +1,36 @@ +/* Copyright 2013-2015 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(BasePageProviderPtr 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 new file mode 100644 index 00000000..ecf0692c --- /dev/null +++ b/application/pages/BasePage.h @@ -0,0 +1,38 @@ +/* Copyright 2013-2015 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 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(); } + virtual void opened() {} + virtual void closed() {} + int stackIndex = -1; + int listIndex = -1; +}; + +typedef std::shared_ptr BasePagePtr; diff --git a/application/pages/BasePageProvider.h b/application/pages/BasePageProvider.h new file mode 100644 index 00000000..c55683e0 --- /dev/null +++ b/application/pages/BasePageProvider.h @@ -0,0 +1,69 @@ +/* Copyright 2013-2015 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 "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) + { + } + + 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; +}; + +typedef std::shared_ptr BasePageProviderPtr; diff --git a/application/pages/InstanceSettingsPage.cpp b/application/pages/InstanceSettingsPage.cpp new file mode 100644 index 00000000..1e571eff --- /dev/null +++ b/application/pages/InstanceSettingsPage.cpp @@ -0,0 +1,216 @@ +#include "InstanceSettingsPage.h" +#include "ui_InstanceSettingsPage.h" + +#include +#include +#include + +#include "dialogs/VersionSelectDialog.h" +#include "NagUtils.h" +#include "java/JavaVersionList.h" +#include "MultiMC.h" + +InstanceSettingsPage::InstanceSettingsPage(BaseInstance *inst, QWidget *parent) + : QWidget(parent), ui(new Ui::InstanceSettingsPage), m_instance(inst) +{ + m_settings = &(inst->settings()); + ui->setupUi(this); + loadSettings(); +} + +bool InstanceSettingsPage::shouldDisplay() const +{ + return !m_instance->isRunning(); +} + +InstanceSettingsPage::~InstanceSettingsPage() +{ + delete ui; +} + +bool InstanceSettingsPage::apply() +{ + applySettings(); + return true; +} + +void InstanceSettingsPage::applySettings() +{ + // 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()); + } + else + { + m_settings->reset("ShowConsole"); + m_settings->reset("AutoCloseConsole"); + } + + // 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) + { + m_settings->set("MinMemAlloc", ui->minMemSpinBox->value()); + m_settings->set("MaxMemAlloc", ui->maxMemSpinBox->value()); + 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", " ")); + NagUtils::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->customCommandsGroupBox->isChecked(); + m_settings->set("OverrideCommands", custcmd); + if (custcmd) + { + m_settings->set("PreLaunchCommand", ui->preLaunchCmdTextBox->text()); + m_settings->set("PostExitCommand", ui->postExitCmdTextBox->text()); + } + else + { + m_settings->reset("PreLaunchCommand"); + m_settings->reset("PostExitCommand"); + } +} + +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()); + + // 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()); + ui->minMemSpinBox->setValue(m_settings->get("MinMemAlloc").toInt()); + ui->maxMemSpinBox->setValue(m_settings->get("MaxMemAlloc").toInt()); + ui->permGenSpinBox->setValue(m_settings->get("PermGen").toInt()); + + // 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->customCommandsGroupBox->setChecked(m_settings->get("OverrideCommands").toBool()); + ui->preLaunchCmdTextBox->setText(m_settings->get("PreLaunchCommand").toString()); + ui->postExitCmdTextBox->setText(m_settings->get("PostExitCommand").toString()); +} + +void InstanceSettingsPage::on_javaDetectBtn_clicked() +{ + JavaVersionPtr 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 InstanceSettingsPage::on_javaBrowseBtn_clicked() +{ + QString dir = QFileDialog::getOpenFileName(this, tr("Find Java executable")); + if (!dir.isNull()) + { + ui->javaPathTextBox->setText(dir); + } +} + +void InstanceSettingsPage::on_javaTestBtn_clicked() +{ + checker.reset(new JavaChecker()); + connect(checker.get(), SIGNAL(checkFinished(JavaCheckResult)), this, + SLOT(checkFinished(JavaCheckResult))); + checker->path = ui->javaPathTextBox->text(); + checker->performCheck(); +} + +void InstanceSettingsPage::checkFinished(JavaCheckResult result) +{ + if (result.valid) + { + QString text; + text += "Java test succeeded!\n"; + if (result.is_64bit) + text += "Using 64bit java.\n"; + text += "\n"; + text += "Platform reported: " + result.realPlatform; + QMessageBox::information(this, tr("Java test success"), text); + } + else + { + QMessageBox::warning( + this, tr("Java test failure"), + tr("The specified java binary didn't work. You should use the auto-detect feature, " + "or set the path to the java executable.")); + } +} diff --git a/application/pages/InstanceSettingsPage.h b/application/pages/InstanceSettingsPage.h new file mode 100644 index 00000000..85df5880 --- /dev/null +++ b/application/pages/InstanceSettingsPage.h @@ -0,0 +1,74 @@ +/* Copyright 2013-2015 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" +#include "java/JavaChecker.h" +#include "BaseInstance.h" +#include "BasePage.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(); + virtual QString helpPage() const override + { + return "Instance-settings"; + } + virtual bool shouldDisplay() const; +private slots: + void on_javaDetectBtn_clicked(); + + void on_javaTestBtn_clicked(); + + void on_javaBrowseBtn_clicked(); + + void checkFinished(JavaCheckResult result); + + void applySettings(); + void loadSettings(); + +private: + Ui::InstanceSettingsPage *ui; + BaseInstance *m_instance; + SettingsObject *m_settings; + std::shared_ptr checker; +}; diff --git a/application/pages/InstanceSettingsPage.ui b/application/pages/InstanceSettingsPage.ui new file mode 100644 index 00000000..64109378 --- /dev/null +++ b/application/pages/InstanceSettingsPage.ui @@ -0,0 +1,453 @@ + + + InstanceSettingsPage + + + + 0 + 0 + 458 + 426 + + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + QTabWidget::Rounded + + + 0 + + + + Java + + + + + + true + + + Java installation + + + true + + + false + + + + + + + + + Auto-detect... + + + + + + + Browse... + + + + + + + Test + + + + + + + + + + true + + + Memory + + + true + + + false + + + + + + The maximum amount of memory Minecraft is allowed to use. + + + MB + + + 512 + + + 65536 + + + 128 + + + 1024 + + + + + + + Minimum memory allocation: + + + + + + + Maximum memory allocation: + + + + + + + The amount of memory Minecraft is started with. + + + MB + + + 256 + + + 65536 + + + 128 + + + 256 + + + + + + + The amount of memory available to store loaded Java classes. + + + MB + + + 64 + + + 999999999 + + + 8 + + + 64 + + + + + + + PermGen: + + + + + + + + + + true + + + Java arguments + + + true + + + false + + + + + + + + + + + + Qt::Vertical + + + + 0 + 0 + + + + + + + + + Game windows + + + + + + true + + + Game Window + + + true + + + false + + + + + + Start Minecraft maximized? + + + + + + + + + Window height: + + + + + + + Window width: + + + + + + + 1 + + + 65536 + + + 1 + + + 854 + + + + + + + 1 + + + 65536 + + + 480 + + + + + + + + + + + + true + + + Console Settings + + + true + + + false + + + + + + Show console while the game is running? + + + + + + + Automatically close console when the game quits? + + + + + + + + + + Qt::Vertical + + + + 88 + 125 + + + + + + + + + Custom commands + + + + + + true + + + Custom Commands + + + true + + + false + + + + + + + + + Post-exit command: + + + + + + + Pre-launch 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 directory with extra environment variables:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">INST_NAME - Name of the instance</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">INST_ID - ID of the instance</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">INST_DIR - absolute path of the instance</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">INST_MC_DIR - absolute path of minecraft</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">INST_JAVA - java binary used for launch</li><li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">INST_JAVA_ARGS - command-line parameters used for launch</li></ul></body></html> + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + Qt::Vertical + + + + 88 + 186 + + + + + + + + + + + + settingsTabs + javaSettingsGroupBox + javaPathTextBox + javaDetectBtn + javaBrowseBtn + javaTestBtn + memoryGroupBox + minMemSpinBox + maxMemSpinBox + permGenSpinBox + javaArgumentsGroupBox + jvmArgsTextBox + windowSizeGroupBox + maximizedCheckBox + windowWidthSpinBox + windowHeightSpinBox + consoleSettingsBox + showConsoleCheck + autoCloseConsoleCheck + customCommandsGroupBox + preLaunchCmdTextBox + postExitCmdTextBox + + + + diff --git a/application/pages/LogPage.cpp b/application/pages/LogPage.cpp new file mode 100644 index 00000000..8f9edb96 --- /dev/null +++ b/application/pages/LogPage.cpp @@ -0,0 +1,222 @@ +#include "LogPage.h" +#include "ui_LogPage.h" + +#include "MultiMC.h" + +#include +#include +#include + +#include "BaseProcess.h" +#include "GuiUtil.h" + +LogPage::LogPage(BaseProcess *proc, QWidget *parent) + : QWidget(parent), ui(new Ui::LogPage), m_process(proc) +{ + ui->setupUi(this); + ui->tabWidget->tabBar()->hide(); + connect(m_process, SIGNAL(log(QString, MessageLevel::Enum)), this, + SLOT(write(QString, MessageLevel::Enum))); + + // create the format and set its font + defaultFormat = new QTextCharFormat(ui->text->currentCharFormat()); + QString fontFamily = MMC->settings()->get("ConsoleFont").toString(); + bool conversionOk = false; + int fontSize = MMC->settings()->get("ConsoleFontSize").toInt(&conversionOk); + if(!conversionOk) + { + fontSize = 11; + } + defaultFormat->setFont(QFont(fontFamily, fontSize)); + + 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; + delete defaultFormat; +} + +bool LogPage::apply() +{ + return true; +} + +bool LogPage::shouldDisplay() const +{ + return m_process->instance()->isRunning(); +} + +void LogPage::on_btnPaste_clicked() +{ + GuiUtil::uploadPaste(ui->text->toPlainText(), this); +} + +void LogPage::on_btnCopy_clicked() +{ + GuiUtil::setClipboardText(ui->text->toPlainText()); +} + +void LogPage::on_btnClear_clicked() +{ + ui->text->clear(); +} + +void LogPage::on_trackLogCheckbox_clicked(bool checked) +{ + m_write_active = checked; +} + +void LogPage::on_findButton_clicked() +{ + auto modifiers = QApplication::keyboardModifiers(); + if (modifiers & Qt::ShiftModifier) + { + findPreviousActivated(); + } + else + { + findNextActivated(); + } +} + +void LogPage::findActivated() +{ + // focus the search bar if it doesn't have focus + if (!ui->searchBar->hasFocus()) + { + auto searchForCursor = ui->text->textCursor(); + auto searchForString = searchForCursor.selectedText(); + if (searchForString.size()) + { + ui->searchBar->setText(searchForString); + } + ui->searchBar->setFocus(); + ui->searchBar->selectAll(); + } +} + +void LogPage::findNextActivated() +{ + auto toSearch = ui->searchBar->text(); + if (toSearch.size()) + { + ui->text->find(toSearch); + } +} + +void LogPage::findPreviousActivated() +{ + auto toSearch = ui->searchBar->text(); + if (toSearch.size()) + { + ui->text->find(toSearch, QTextDocument::FindBackward); + } +} + +void LogPage::write(QString data, MessageLevel::Enum mode) +{ + if (!m_write_active) + { + if (mode != MessageLevel::PrePost && mode != MessageLevel::MultiMC) + { + return; + } + } + + // save the cursor so it can be restored. + auto savedCursor = ui->text->cursor(); + + QScrollBar *bar = ui->text->verticalScrollBar(); + int max_bar = bar->maximum(); + int val_bar = bar->value(); + if (isVisible()) + { + if (m_scroll_active) + { + m_scroll_active = (max_bar - val_bar) <= 1; + } + else + { + m_scroll_active = val_bar == max_bar; + } + } + if (data.endsWith('\n')) + data = data.left(data.length() - 1); + QStringList paragraphs = data.split('\n'); + QStringList filtered; + for (QString ¶graph : paragraphs) + { + //TODO: implement filtering here. + filtered.append(paragraph); + } + QListIterator iter(filtered); + QTextCharFormat format(*defaultFormat); + + switch(mode) + { + case MessageLevel::MultiMC: + { + format.setForeground(QColor("blue")); + break; + } + case MessageLevel::Debug: + { + format.setForeground(QColor("green")); + break; + } + case MessageLevel::Warning: + { + format.setForeground(QColor("orange")); + break; + } + case MessageLevel::Error: + { + format.setForeground(QColor("red")); + break; + } + case MessageLevel::Fatal: + { + format.setForeground(QColor("red")); + format.setBackground(QColor("black")); + break; + } + case MessageLevel::PrePost: + { + format.setForeground(QColor("grey")); + break; + } + case MessageLevel::Info: + case MessageLevel::Message: + default: + { + // do nothing, keep original + } + } + + while (iter.hasNext()) + { + // append a paragraph/line + auto workCursor = ui->text->textCursor(); + workCursor.movePosition(QTextCursor::End); + workCursor.insertText(iter.next(), format); + workCursor.insertBlock(); + } + + if (isVisible()) + { + if (m_scroll_active) + { + bar->setValue(bar->maximum()); + } + m_last_scroll_value = bar->value(); + } + ui->text->setCursor(savedCursor); +} diff --git a/application/pages/LogPage.h b/application/pages/LogPage.h new file mode 100644 index 00000000..fe7bbecb --- /dev/null +++ b/application/pages/LogPage.h @@ -0,0 +1,86 @@ +/* Copyright 2013-2015 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 "net/NetJob.h" +#include "BaseProcess.h" +#include "BasePage.h" +#include + +namespace Ui +{ +class LogPage; +} +class QTextCharFormat; + +class LogPage : public QWidget, public BasePage +{ + Q_OBJECT + +public: + explicit LogPage(BaseProcess *proc, 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(); + virtual QString helpPage() const override + { + return "Minecraft-Logs"; + } + virtual bool shouldDisplay() const; + +private slots: + /** + * @brief write a string + * @param data the string + * @param mode the WriteMode + * lines have to be put through this as a whole! + */ + void write(QString data, MessageLevel::Enum level = MessageLevel::MultiMC); + void on_btnPaste_clicked(); + void on_btnCopy_clicked(); + void on_btnClear_clicked(); + + void on_trackLogCheckbox_clicked(bool checked); + + void on_findButton_clicked(); + void findActivated(); + void findNextActivated(); + void findPreviousActivated(); + +private: + Ui::LogPage *ui; + BaseProcess *m_process; + int m_last_scroll_value = 0; + bool m_scroll_active = true; + int m_saved_offset = 0; + bool m_write_active = true; + + QTextCharFormat * defaultFormat; +}; diff --git a/application/pages/LogPage.ui b/application/pages/LogPage.ui new file mode 100644 index 00000000..089bc906 --- /dev/null +++ b/application/pages/LogPage.ui @@ -0,0 +1,140 @@ + + + LogPage + + + + 0 + 0 + 825 + 782 + + + + Log + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 0 + + + + Tab 1 + + + + + + Search: + + + + + + + Find + + + + + + + false + + + true + + + + + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + false + + + + + + + + + Keep updating + + + 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 + + + + + + + + + + + + + + + + + diff --git a/application/pages/ModFolderPage.cpp b/application/pages/ModFolderPage.cpp new file mode 100644 index 00000000..3c55aefc --- /dev/null +++ b/application/pages/ModFolderPage.cpp @@ -0,0 +1,160 @@ +/* Copyright 2013-2015 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 + +#include + +#include "MultiMC.h" +#include "dialogs/CustomMessageBox.h" +#include "dialogs/ModEditDialogCommon.h" +#include "minecraft/ModList.h" +#include "minecraft/Mod.h" +#include "minecraft/VersionFilterData.h" + +ModFolderPage::ModFolderPage(BaseInstance *inst, std::shared_ptr mods, QString id, + QString iconName, QString displayName, QString helpPage, + QWidget *parent) + : QWidget(parent), ui(new Ui::ModFolderPage) +{ + ui->setupUi(this); + ui->tabWidget->tabBar()->hide(); + m_inst = inst; + m_mods = mods; + m_id = id; + m_displayName = displayName; + m_iconName = iconName; + m_helpName = helpPage; + ui->modTreeView->setModel(m_mods.get()); + ui->modTreeView->installEventFilter(this); + m_mods->startWatching(); + auto smodel = ui->modTreeView->selectionModel(); + connect(smodel, SIGNAL(currentChanged(QModelIndex, QModelIndex)), + SLOT(modCurrent(QModelIndex, QModelIndex))); +} + +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; +} + +bool ModFolderPage::shouldDisplay() const +{ + if (m_inst) + return !m_inst->isRunning(); + return true; +} + +bool CoreModFolderPage::shouldDisplay() const +{ + if (ModFolderPage::shouldDisplay()) + { + auto inst = dynamic_cast(m_inst); + if (!inst) + return true; + auto version = inst->getMinecraftProfile(); + if (!version) + return true; + if (version->m_releaseTime < g_VersionFilterData.legacyCutoffDate) + { + return true; + } + } + return false; +} + +bool ModFolderPage::modListFilter(QKeyEvent *keyEvent) +{ + switch (keyEvent->key()) + { + case Qt::Key_Delete: + on_rmModBtn_clicked(); + return true; + case Qt::Key_Plus: + on_addModBtn_clicked(); + 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_addModBtn_clicked() +{ + QStringList fileNames = QFileDialog::getOpenFileNames( + this, QApplication::translate("ModFolderPage", "Select Loader Mods")); + for (auto filename : fileNames) + { + m_mods->stopWatching(); + m_mods->installMod(QFileInfo(filename)); + m_mods->startWatching(); + } +} +void ModFolderPage::on_rmModBtn_clicked() +{ + int first, last; + auto list = ui->modTreeView->selectionModel()->selectedRows(); + + if (!lastfirst(list, first, last)) + return; + m_mods->stopWatching(); + m_mods->deleteMods(first, last); + m_mods->startWatching(); +} + +void ModFolderPage::on_viewModBtn_clicked() +{ + openDirInDefaultProgram(m_mods->dir().absolutePath(), true); +} + +void ModFolderPage::modCurrent(const QModelIndex ¤t, const QModelIndex &previous) +{ + if (!current.isValid()) + { + ui->frame->clear(); + return; + } + int row = current.row(); + Mod &m = m_mods->operator[](row); + ui->frame->updateWithMod(m); +} diff --git a/application/pages/ModFolderPage.h b/application/pages/ModFolderPage.h new file mode 100644 index 00000000..4e89f85f --- /dev/null +++ b/application/pages/ModFolderPage.h @@ -0,0 +1,94 @@ +/* Copyright 2013-2015 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/OneSixInstance.h" +#include "net/NetJob.h" +#include "BasePage.h" +#include + +class ModList; +namespace Ui +{ +class ModFolderPage; +} + +class ModFolderPage : public QWidget, 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(); + 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; + +protected: + bool eventFilter(QObject *obj, QEvent *ev); + bool modListFilter(QKeyEvent *ev); + +protected: + BaseInstance *m_inst; + +private: + Ui::ModFolderPage *ui; + std::shared_ptr m_mods; + QString m_iconName; + QString m_id; + QString m_displayName; + QString m_helpName; + +public +slots: + void modCurrent(const QModelIndex ¤t, const QModelIndex &previous); + +private +slots: + void on_addModBtn_clicked(); + void on_rmModBtn_clicked(); + void on_viewModBtn_clicked(); +}; + +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/ModFolderPage.ui b/application/pages/ModFolderPage.ui new file mode 100644 index 00000000..353b62c5 --- /dev/null +++ b/application/pages/ModFolderPage.ui @@ -0,0 +1,124 @@ + + + ModFolderPage + + + + 0 + 0 + 723 + 532 + + + + Mods + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 0 + + + + Tab 1 + + + + + + + 0 + 0 + + + + true + + + QAbstractItemView::DropOnly + + + + + + + + + &Add + + + + + + + &Remove + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + &View Folder + + + + + + + + + + 0 + 0 + + + + + + + + + + + + + ModListView + QTreeView +
    widgets/ModListView.h
    +
    + + MCModInfoFrame + QFrame +
    widgets/MCModInfoFrame.h
    + 1 +
    +
    + + +
    diff --git a/application/pages/NotesPage.cpp b/application/pages/NotesPage.cpp new file mode 100644 index 00000000..48bb468c --- /dev/null +++ b/application/pages/NotesPage.cpp @@ -0,0 +1,21 @@ +#include "NotesPage.h" +#include "ui_NotesPage.h" + +NotesPage::NotesPage(BaseInstance *inst, QWidget *parent) + : QWidget(parent), ui(new Ui::NotesPage), m_inst(inst) +{ + ui->setupUi(this); + ui->tabWidget->tabBar()->hide(); + 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/NotesPage.h b/application/pages/NotesPage.h new file mode 100644 index 00000000..62e0c692 --- /dev/null +++ b/application/pages/NotesPage.h @@ -0,0 +1,61 @@ +/* Copyright 2013-2015 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 "net/NetJob.h" +#include "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(); + virtual QString helpPage() const override + { + return "Notes"; + } + +private: + Ui::NotesPage *ui; + BaseInstance *m_inst; +}; diff --git a/application/pages/NotesPage.ui b/application/pages/NotesPage.ui new file mode 100644 index 00000000..8da01c8b --- /dev/null +++ b/application/pages/NotesPage.ui @@ -0,0 +1,60 @@ + + + NotesPage + + + + 0 + 0 + 731 + 538 + + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 0 + + + + Tab 1 + + + + + + Qt::ScrollBarAlwaysOn + + + false + + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextEditable|Qt::TextEditorInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + + + + + diff --git a/application/pages/OtherLogsPage.cpp b/application/pages/OtherLogsPage.cpp new file mode 100644 index 00000000..b037a6c7 --- /dev/null +++ b/application/pages/OtherLogsPage.cpp @@ -0,0 +1,150 @@ +/* Copyright 2013-2015 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 + +#include "GuiUtil.h" +#include "RecursiveFileSystemWatcher.h" +#include + +OtherLogsPage::OtherLogsPage(QString path, QWidget *parent) + : QWidget(parent), ui(new Ui::OtherLogsPage), m_path(path), + m_watcher(new RecursiveFileSystemWatcher(this)) +{ + ui->setupUi(this); + ui->tabWidget->tabBar()->hide(); + + m_watcher->setFileExpression("(.*\\.log(\\.[0-9]*)?$)|(crash-.*\\.txt)"); + m_watcher->setRootDir(QDir::current().absoluteFilePath(m_path)); + + connect(m_watcher, &RecursiveFileSystemWatcher::filesChanged, this, + &OtherLogsPage::populateSelectLogBox); + populateSelectLogBox(); +} + +OtherLogsPage::~OtherLogsPage() +{ + delete ui; +} + +void OtherLogsPage::opened() +{ + m_watcher->enable(); +} +void OtherLogsPage::closed() +{ + m_watcher->disable(); +} + +void OtherLogsPage::populateSelectLogBox() +{ + ui->selectLogBox->clear(); + ui->selectLogBox->addItems(m_watcher->files()); + if (m_currentFile.isNull()) + { + ui->selectLogBox->setCurrentIndex(-1); + } + else + { + const int index = ui->selectLogBox->findText(m_currentFile); + if (index != -1) + ui->selectLogBox->setCurrentIndex(index); + } +} + +void OtherLogsPage::on_selectLogBox_currentIndexChanged(const int index) +{ + QString file; + if (index != -1) + { + file = ui->selectLogBox->itemText(index); + } + + if (file.isEmpty() || !QFile::exists(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() +{ + QFile file(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 + { + if (file.size() < 10000000ll) + { + ui->text->setPlainText(QString::fromUtf8(file.readAll())); + } + else + { + ui->text->setPlainText( + tr("The file (%1) is too big. You may want to open it in a viewer optimized " + "for large files.").arg(file.fileName())); + } + } +} + +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 (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(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::setControlsEnabled(const bool enabled) +{ + ui->btnReload->setEnabled(enabled); + ui->btnDelete->setEnabled(enabled); + ui->btnCopy->setEnabled(enabled); + ui->btnPaste->setEnabled(enabled); + ui->text->setEnabled(enabled); +} diff --git a/application/pages/OtherLogsPage.h b/application/pages/OtherLogsPage.h new file mode 100644 index 00000000..d6e4ec9f --- /dev/null +++ b/application/pages/OtherLogsPage.h @@ -0,0 +1,72 @@ +/* Copyright 2013-2015 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 "BasePage.h" +#include + +namespace Ui +{ +class OtherLogsPage; +} + +class RecursiveFileSystemWatcher; + +class OtherLogsPage : public QWidget, public BasePage +{ + Q_OBJECT + +public: + explicit OtherLogsPage(QString path, 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 opened() override; + void closed() 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(); + +private: + Ui::OtherLogsPage *ui; + QString m_path; + RecursiveFileSystemWatcher *m_watcher; + QString m_currentFile; + + void setControlsEnabled(const bool enabled); +}; diff --git a/application/pages/OtherLogsPage.ui b/application/pages/OtherLogsPage.ui new file mode 100644 index 00000000..08200684 --- /dev/null +++ b/application/pages/OtherLogsPage.ui @@ -0,0 +1,117 @@ + + + OtherLogsPage + + + + 0 + 0 + 657 + 538 + + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 0 + + + + Tab 1 + + + + + + + + + 0 + 0 + + + + + + + + Reload + + + + + + + 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 + + + Delete + + + + + + + + + false + + + Qt::ScrollBarAlwaysOn + + + true + + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + + + + text + + + + diff --git a/application/pages/ResourcePackPage.h b/application/pages/ResourcePackPage.h new file mode 100644 index 00000000..d79590df --- /dev/null +++ b/application/pages/ResourcePackPage.h @@ -0,0 +1,19 @@ +#pragma once +#include "ModFolderPage.h" + +class ResourcePackPage : public ModFolderPage +{ +public: + explicit ResourcePackPage(MinecraftInstance *instance, QWidget *parent = 0) + : ModFolderPage(instance, instance->resourcePackList(), "resourcepacks", + "resourcepacks", tr("Resource packs"), "Resource-packs", parent) + { + } + + virtual ~ResourcePackPage() {} + virtual bool shouldDisplay() const override + { + return !m_inst->traits().contains("no-texturepacks") && + !m_inst->traits().contains("texturepacks"); + } +}; diff --git a/application/pages/ScreenshotsPage.cpp b/application/pages/ScreenshotsPage.cpp new file mode 100644 index 00000000..c81de407 --- /dev/null +++ b/application/pages/ScreenshotsPage.cpp @@ -0,0 +1,362 @@ +#include "ScreenshotsPage.h" +#include "ui_ScreenshotsPage.h" + +#include +#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" + +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); + auto smallSize = small.size(); + 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) + : QWidget(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 = ensureFolderPathExists(m_folder); + + ui->setupUi(this); + ui->tabWidget->tabBar()->hide(); + ui->listView->setModel(m_filterModel.get()); + 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)); + 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_deleteBtn_clicked(); + return true; + case Qt::Key_F2: + on_renameBtn_clicked(); + return true; + default: + break; + } + return QWidget::eventFilter(obj, evt); +} + +ScreenshotsPage::~ScreenshotsPage() +{ + delete ui; +} + +void ScreenshotsPage::onItemActivated(QModelIndex index) +{ + if (!index.isValid()) + return; + auto info = m_model->fileInfo(index); + QString fileName = info.absoluteFilePath(); + openFileInDefaultProgram(info.absoluteFilePath()); +} + +void ScreenshotsPage::on_viewFolderBtn_clicked() +{ + openDirInDefaultProgram(m_folder, true); +} + +void ScreenshotsPage::on_uploadBtn_clicked() +{ + auto selection = ui->listView->selectionModel()->selectedIndexes(); + if (selection.isEmpty()) + return; + + QList uploaded; + auto job = std::make_shared("Screenshot Upload"); + 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 = std::make_shared("Imgur Album Creation"); + auto imgurAlbum = ImgurAlbumCreation::make(uploaded); + albumTask->addNetAction(imgurAlbum); + task.addTask(job); + task.addTask(albumTask); + ProgressDialog prog(this); + if (prog.exec(&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); + QDesktopServices::openUrl(link); + CustomMessageBox::selectable( + this, tr("Upload finished"), + tr("The link to the uploaded album has been opened in the " + "default browser and placed in your clipboard.
    Delete hash: %2 (save " + "this if you want to be able to edit/delete the album)") + .arg(link, imgurAlbum->deleteHash()), + QMessageBox::Information)->exec(); + } +} + +void ScreenshotsPage::on_deleteBtn_clicked() +{ + 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_renameBtn_clicked() +{ + auto selection = ui->listView->selectionModel()->selectedIndexes(); + if (selection.isEmpty()) + return; + ui->listView->edit(selection[0]); + // TODO: mass renaming +} + +void ScreenshotsPage::opened() +{ + if (m_valid) + { + QString path = QDir(m_folder).absolutePath(); + m_model->setRootPath(path); + ui->listView->setRootIndex(m_filterModel->mapFromSource(m_model->index(path))); + } +} + +#include "ScreenshotsPage.moc" diff --git a/application/pages/ScreenshotsPage.h b/application/pages/ScreenshotsPage.h new file mode 100644 index 00000000..f5700ba8 --- /dev/null +++ b/application/pages/ScreenshotsPage.h @@ -0,0 +1,79 @@ +/* Copyright 2013-2015 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 "BasePage.h" +#include + +class QFileSystemModel; +class QIdentityProxyModel; +namespace Ui +{ +class ScreenshotsPage; +} + +struct ScreenShot; +class ScreenshotList; +class ImgurAlbumCreation; + +class ScreenshotsPage : public QWidget, public BasePage +{ + Q_OBJECT + +public: + explicit ScreenshotsPage(QString path, QWidget *parent = 0); + virtual ~ScreenshotsPage(); + + virtual void opened() override; + + enum + { + NothingDone = 0x42 + }; + + virtual bool eventFilter(QObject *, QEvent *); + 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"; + } +private slots: + void on_uploadBtn_clicked(); + void on_deleteBtn_clicked(); + void on_renameBtn_clicked(); + void on_viewFolderBtn_clicked(); + void onItemActivated(QModelIndex); + +private: + Ui::ScreenshotsPage *ui; + std::shared_ptr m_model; + std::shared_ptr m_filterModel; + QString m_folder; + bool m_valid = false; +}; diff --git a/application/pages/ScreenshotsPage.ui b/application/pages/ScreenshotsPage.ui new file mode 100644 index 00000000..30b55092 --- /dev/null +++ b/application/pages/ScreenshotsPage.ui @@ -0,0 +1,109 @@ + + + ScreenshotsPage + + + + 0 + 0 + 723 + 532 + + + + Mods + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 0 + + + + Tab 1 + + + + + + QAbstractItemView::ExtendedSelection + + + QAbstractItemView::SelectItems + + + + + + + + + &Upload + + + + + + + &Delete + + + + + + + &Rename + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + &View Folder + + + + + + + + + + + + + listView + uploadBtn + deleteBtn + renameBtn + viewFolderBtn + + + + diff --git a/application/pages/TexturePackPage.h b/application/pages/TexturePackPage.h new file mode 100644 index 00000000..3c5c27d7 --- /dev/null +++ b/application/pages/TexturePackPage.h @@ -0,0 +1,17 @@ +#pragma once +#include "ModFolderPage.h" + +class TexturePackPage : public ModFolderPage +{ +public: + explicit TexturePackPage(MinecraftInstance *instance, QWidget *parent = 0) + : ModFolderPage(instance, instance->texturePackList(), "texturepacks", "resourcepacks", + tr("Texture packs"), "Texture-packs", parent) + { + } + virtual ~TexturePackPage() {} + virtual bool shouldDisplay() const override + { + return m_inst->traits().contains("texturepacks"); + } +}; diff --git a/application/pages/VersionPage.cpp b/application/pages/VersionPage.cpp new file mode 100644 index 00000000..9b656220 --- /dev/null +++ b/application/pages/VersionPage.cpp @@ -0,0 +1,321 @@ +/* Copyright 2013-2015 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 "Platform.h" +#include "dialogs/CustomMessageBox.h" +#include "dialogs/VersionSelectDialog.h" +#include "dialogs/ModEditDialogCommon.h" + +#include "dialogs/ProgressDialog.h" + +#include +#include +#include +#include +#include + +#include "minecraft/MinecraftProfile.h" +#include "forge/ForgeVersionList.h" +#include "forge/ForgeInstaller.h" +#include "liteloader/LiteLoaderVersionList.h" +#include "liteloader/LiteLoaderInstaller.h" +#include "minecraft/VersionBuilder.h" +#include "auth/MojangAccountList.h" +#include "minecraft/Mod.h" +#include "icons/IconList.h" + + +QIcon VersionPage::icon() const +{ + return ENV.icons()->getIcon(m_inst->iconKey()); +} +bool VersionPage::shouldDisplay() const +{ + return !m_inst->isRunning(); +} + +VersionPage::VersionPage(OneSixInstance *inst, QWidget *parent) + : QWidget(parent), ui(new Ui::VersionPage), m_inst(inst) +{ + ui->setupUi(this); + ui->tabWidget->tabBar()->hide(); + + m_version = m_inst->getMinecraftProfile(); + if (m_version) + { + ui->libraryTreeView->setModel(m_version.get()); + ui->libraryTreeView->installEventFilter(this); + ui->libraryTreeView->setSelectionMode(QAbstractItemView::SingleSelection); + connect(ui->libraryTreeView->selectionModel(), &QItemSelectionModel::currentChanged, + this, &VersionPage::versionCurrent); + updateVersionControls(); + // select first item. + auto index = ui->libraryTreeView->model()->index(0,0); + if(index.isValid()) + ui->libraryTreeView->setCurrentIndex(index); + } + else + { + disableVersionControls(); + } + connect(m_inst, &OneSixInstance::versionReloaded, this, + &VersionPage::updateVersionControls); +} + +VersionPage::~VersionPage() +{ + delete ui; +} + +void VersionPage::updateVersionControls() +{ + ui->forgeBtn->setEnabled(true); + ui->liteloaderBtn->setEnabled(true); +} + +void VersionPage::disableVersionControls() +{ + ui->forgeBtn->setEnabled(false); + ui->liteloaderBtn->setEnabled(false); + ui->reloadLibrariesBtn->setEnabled(false); + ui->removeLibraryBtn->setEnabled(false); +} + +bool VersionPage::reloadMinecraftProfile() +{ + try + { + m_inst->reloadProfile(); + return true; + } + catch (MMCError &e) + { + QMessageBox::critical(this, tr("Error"), e.cause()); + return false; + } + catch (...) + { + QMessageBox::critical( + this, tr("Error"), + tr("Failed to load the version description file for reasons unknown.")); + return false; + } +} + +void VersionPage::on_reloadLibrariesBtn_clicked() +{ + reloadMinecraftProfile(); +} + +void VersionPage::on_removeLibraryBtn_clicked() +{ + if (ui->libraryTreeView->currentIndex().isValid()) + { + // FIXME: use actual model, not reloading. + if (!m_version->remove(ui->libraryTreeView->currentIndex().row())) + { + QMessageBox::critical(this, tr("Error"), tr("Couldn't remove file")); + } + } +} + +void VersionPage::on_jarmodBtn_clicked() +{ + QFileDialog w; + QSet locations; + QString modsFolder = MMC->settings()->get("CentralModsDir").toString(); + 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(modsFolder)); + + w.setFileMode(QFileDialog::ExistingFiles); + w.setAcceptMode(QFileDialog::AcceptOpen); + w.setNameFilter(tr("Minecraft jar mods (*.zip *.jar)")); + w.setDirectory(modsFolder); + w.setSidebarUrls(urls); + + if (w.exec()) + m_version->installJarMods(w.selectedFiles()); +} + +void VersionPage::on_resetLibraryOrderBtn_clicked() +{ + try + { + m_version->resetOrder(); + } + catch (MMCError &e) + { + QMessageBox::critical(this, tr("Error"), e.cause()); + } +} + +void VersionPage::on_moveLibraryUpBtn_clicked() +{ + if (ui->libraryTreeView->selectionModel()->selectedRows().isEmpty()) + { + return; + } + try + { + const int row = ui->libraryTreeView->selectionModel()->selectedRows().first().row(); + m_version->move(row, MinecraftProfile::MoveUp); + } + catch (MMCError &e) + { + QMessageBox::critical(this, tr("Error"), e.cause()); + } +} + +void VersionPage::on_moveLibraryDownBtn_clicked() +{ + if (ui->libraryTreeView->selectionModel()->selectedRows().isEmpty()) + { + return; + } + try + { + const int row = ui->libraryTreeView->selectionModel()->selectedRows().first().row(); + m_version->move(row, MinecraftProfile::MoveDown); + } + catch (MMCError &e) + { + QMessageBox::critical(this, tr("Error"), e.cause()); + } +} + +void VersionPage::on_changeMCVersionBtn_clicked() +{ + VersionSelectDialog vselect(m_inst->versionList().get(), tr("Change Minecraft version"), + this); + if (!vselect.exec() || !vselect.selectedVersion()) + return; + + 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; + } + + if (!m_version->isVanilla()) + { + auto result = CustomMessageBox::selectable( + this, tr("Are you sure?"), + tr("This will remove any library/version customization you did previously. " + "This includes things like Forge install and similar."), + QMessageBox::Warning, QMessageBox::Ok | QMessageBox::Abort, + QMessageBox::Abort)->exec(); + + if (result != QMessageBox::Ok) + return; + m_version->revertToVanilla(); + reloadMinecraftProfile(); + } + m_inst->setIntendedVersionId(vselect.selectedVersion()->descriptor()); + + auto updateTask = m_inst->doUpdate(); + if (!updateTask) + { + return; + } + ProgressDialog tDialog(this); + connect(updateTask.get(), SIGNAL(failed(QString)), SLOT(onGameUpdateError(QString))); + tDialog.exec(updateTask.get()); +} + +void VersionPage::on_forgeBtn_clicked() +{ + VersionSelectDialog vselect(MMC->forgelist().get(), tr("Select Forge version"), this); + vselect.setExactFilter(1, m_inst->currentVersionId()); + vselect.setEmptyString(tr("No Forge versions are currently available for Minecraft ") + + m_inst->currentVersionId()); + if (vselect.exec() && vselect.selectedVersion()) + { + ProgressDialog dialog(this); + dialog.exec( + ForgeInstaller().createInstallTask(m_inst, vselect.selectedVersion(), this)); + } +} + +void VersionPage::on_liteloaderBtn_clicked() +{ + VersionSelectDialog vselect(MMC->liteloaderlist().get(), tr("Select LiteLoader version"), + this); + vselect.setExactFilter(1, m_inst->currentVersionId()); + vselect.setEmptyString(tr("No LiteLoader versions are currently available for Minecraft ") + + m_inst->currentVersionId()); + if (vselect.exec() && vselect.selectedVersion()) + { + ProgressDialog dialog(this); + dialog.exec( + LiteLoaderInstaller().createInstallTask(m_inst, vselect.selectedVersion(), this)); + } +} + +void VersionPage::versionCurrent(const QModelIndex ¤t, const QModelIndex &previous) +{ + if (!current.isValid()) + { + ui->removeLibraryBtn->setDisabled(true); + ui->moveLibraryDownBtn->setDisabled(true); + ui->moveLibraryUpBtn->setDisabled(true); + } + else + { + bool enabled = m_version->canRemove(current.row()); + ui->removeLibraryBtn->setEnabled(enabled); + ui->moveLibraryDownBtn->setEnabled(enabled); + ui->moveLibraryUpBtn->setEnabled(enabled); + } + QString selectedId = m_version->versionFileId(current.row()); + if (selectedId == "net.minecraft") + { + ui->changeMCVersionBtn->setEnabled(true); + } + else + { + ui->changeMCVersionBtn->setEnabled(false); + } +} diff --git a/application/pages/VersionPage.h b/application/pages/VersionPage.h new file mode 100644 index 00000000..587fcf07 --- /dev/null +++ b/application/pages/VersionPage.h @@ -0,0 +1,80 @@ +/* Copyright 2013-2015 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/OneSixInstance.h" +#include "net/NetJob.h" +#include "BasePage.h" + +namespace Ui +{ +class VersionPage; +} + +class VersionPage : public QWidget, public BasePage +{ + Q_OBJECT + +public: + explicit VersionPage(OneSixInstance *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; +private +slots: + + // version tab + void on_forgeBtn_clicked(); + void on_liteloaderBtn_clicked(); + void on_reloadLibrariesBtn_clicked(); + void on_removeLibraryBtn_clicked(); + void on_resetLibraryOrderBtn_clicked(); + void on_moveLibraryUpBtn_clicked(); + void on_moveLibraryDownBtn_clicked(); + void on_jarmodBtn_clicked(); + + void updateVersionControls(); + void disableVersionControls(); + void on_changeMCVersionBtn_clicked(); + +protected: + /// FIXME: this shouldn't be necessary! + bool reloadMinecraftProfile(); + +private: + Ui::VersionPage *ui; + std::shared_ptr m_version; + OneSixInstance *m_inst; + NetJobPtr forgeJob; + +public +slots: + void versionCurrent(const QModelIndex ¤t, const QModelIndex &previous); +}; diff --git a/application/pages/VersionPage.ui b/application/pages/VersionPage.ui new file mode 100644 index 00000000..67a556c8 --- /dev/null +++ b/application/pages/VersionPage.ui @@ -0,0 +1,204 @@ + + + VersionPage + + + + 0 + 0 + 693 + 575 + + + + Version + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 0 + + + + Tab 1 + + + + + + Qt::ScrollBarAlwaysOn + + + Qt::ScrollBarAlwaysOff + + + false + + + true + + + + + + + + + Selection + + + Qt::AlignCenter + + + + + + + Change version + + + + + + + This isn't implemented yet. + + + Move up + + + + + + + This isn't implemented yet. + + + Move down + + + + + + + Remove + + + + + + + + + + Install + + + Qt::AlignCenter + + + + + + + Replace any current custom version with Minecraft Forge + + + Install Forge + + + + + + + Install LiteLoader + + + + + + + Add jar mod + + + + + + + + + + List + + + Qt::AlignCenter + + + + + + + This isn't implemented yet. + + + Reset order + + + + + + + Reload + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + + ModListView + QTreeView +
    widgets/ModListView.h
    +
    + + LineSeparator + QWidget +
    widgets/LineSeparator.h
    + 1 +
    +
    + + +
    diff --git a/application/pages/global/AccountListPage.cpp b/application/pages/global/AccountListPage.cpp new file mode 100644 index 00000000..7be72aaa --- /dev/null +++ b/application/pages/global/AccountListPage.cpp @@ -0,0 +1,142 @@ +/* Copyright 2013-2015 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 "net/NetJob.h" +#include "net/URLConstants.h" +#include "Env.h" + +#include "dialogs/EditAccountDialog.h" +#include "dialogs/ProgressDialog.h" +#include "dialogs/AccountSelectDialog.h" +#include "dialogs/LoginDialog.h" +#include "dialogs/CustomMessageBox.h" +#include "tasks/Task.h" +#include "auth/YggdrasilTask.h" + +#include "MultiMC.h" + +AccountListPage::AccountListPage(QWidget *parent) + : QWidget(parent), ui(new Ui::AccountListPage) +{ + ui->setupUi(this); + ui->tabWidget->tabBar()->hide(); + + m_accounts = MMC->accounts(); + + ui->listView->setModel(m_accounts.get()); + ui->listView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); + + // 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(m_accounts.get(), SIGNAL(listChanged()), SLOT(listChanged())); + connect(m_accounts.get(), SIGNAL(activeAccountChanged()), SLOT(listChanged())); + + updateButtonStates(); +} + +AccountListPage::~AccountListPage() +{ + delete ui; +} + +void AccountListPage::listChanged() +{ + updateButtonStates(); +} + +void AccountListPage::on_addAccountBtn_clicked() +{ + addAccount(tr("Please enter your Mojang or Minecraft account username and password to add " + "your account.")); +} + +void AccountListPage::on_rmAccountBtn_clicked() +{ + QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes(); + if (selection.size() > 0) + { + QModelIndex selected = selection.first(); + m_accounts->removeAccount(selected); + } +} + +void AccountListPage::on_setDefaultBtn_clicked() +{ + 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_noDefaultBtn_clicked() +{ + m_accounts->setActiveAccount(""); +} + +void AccountListPage::updateButtonStates() +{ + // If there is no selection, disable buttons that require something selected. + QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes(); + + ui->rmAccountBtn->setEnabled(selection.size() > 0); + ui->setDefaultBtn->setEnabled(selection.size() > 0); + + ui->noDefaultBtn->setDown(m_accounts->activeAccount().get() == nullptr); +} + +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.name + ".png"); + auto action = CacheDownload::make( + QUrl("http://" + URLConstants::SKINS_BASE + profile.name + ".png"), meta); + job->addNetAction(action); + meta->stale = true; + } + + job->start(); + } +} diff --git a/application/pages/global/AccountListPage.h b/application/pages/global/AccountListPage.h new file mode 100644 index 00000000..dad68b0c --- /dev/null +++ b/application/pages/global/AccountListPage.h @@ -0,0 +1,86 @@ +/* Copyright 2013-2015 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 "auth/MojangAccountList.h" +#include + +namespace Ui +{ +class AccountListPage; +} + +class AuthenticateTask; + +class AccountListPage : public QWidget, 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 "Accounts"; + } + +public +slots: + void on_addAccountBtn_clicked(); + + void on_rmAccountBtn_clicked(); + + void on_setDefaultBtn_clicked(); + + void on_noDefaultBtn_clicked(); + + void listChanged(); + + //! Updates the states of the dialog's buttons. + void updateButtonStates(); + +protected: + std::shared_ptr m_accounts; + +protected +slots: + void addAccount(const QString& errMsg=""); + +private: + Ui::AccountListPage *ui; +}; diff --git a/application/pages/global/AccountListPage.ui b/application/pages/global/AccountListPage.ui new file mode 100644 index 00000000..8ad78cf4 --- /dev/null +++ b/application/pages/global/AccountListPage.ui @@ -0,0 +1,115 @@ + + + AccountListPage + + + + 0 + 0 + 694 + 609 + + + + Manage Accounts + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 0 + + + + Tab 1 + + + + + + <html><head/><body><p>Welcome! If you're new here, you can click the &quot;Add&quot; button to add your Mojang or Minecraft account.</p></body></html> + + + true + + + + + + + + + + + + + + &Add + + + + + + + &Remove + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + <html><head/><body><p>Set the currently selected account as the active account. The active account is the account that is used to log in (unless it is overridden in an instance-specific setting).</p></body></html> + + + &Set Default + + + + + + + Set no default account. This will cause MultiMC to prompt you to select an account every time you launch an instance that doesn't have its own default set. + + + &No Default + + + + + + + + + + + + + + + + diff --git a/application/pages/global/ExternalToolsPage.cpp b/application/pages/global/ExternalToolsPage.cpp new file mode 100644 index 00000000..426432a0 --- /dev/null +++ b/application/pages/global/ExternalToolsPage.cpp @@ -0,0 +1,238 @@ +/* Copyright 2013-2015 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 "MultiMC.h" + +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 Directory"), raw_dir); + if (raw_dir.isEmpty()) + { + break; + } + QString cooked_dir = 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 = 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 +#warning stuff + raw_dir = QFileDialog::getOpenFileName(this, tr("MCEdit Application"), raw_dir); +#else + raw_dir = QFileDialog::getExistingDirectory(this, tr("MCEdit Directory"), raw_dir); +#endif + if (raw_dir.isEmpty()) + { + break; + } + QString cooked_dir = NormalizePath(raw_dir); + if (!MMC->tools()["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->tools()["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()); + QString cooked_file = NormalizePath(raw_file); + + if (cooked_file.isEmpty()) + { + return; + } + + // 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 new file mode 100644 index 00000000..43e72dcd --- /dev/null +++ b/application/pages/global/ExternalToolsPage.h @@ -0,0 +1,74 @@ +/* Copyright 2013-2015 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 "External-tools"; + } + virtual bool apply(); + +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 new file mode 100644 index 00000000..ba1b6f01 --- /dev/null +++ b/application/pages/global/ExternalToolsPage.ui @@ -0,0 +1,197 @@ + + + ExternalToolsPage + + + + 0 + 0 + 673 + 751 + + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 0 + + + + Tab 1 + + + + + + JProfiler + + + + + + + + + + + ... + + + + + + + + + Check + + + + + + + <html><head/><body><p><a href="http://www.ej-technologies.com/products/jprofiler/overview.html"><span style=" text-decoration: underline; color:#0000ff;">http://www.ej-technologies.com/products/jprofiler/overview.html</span></a></p></body></html> + + + + + + + + + + JVisualVM + + + + + + + + + + + ... + + + + + + + + + Check + + + + + + + <html><head/><body><p><a href="http://visualvm.java.net/"><span style=" text-decoration: underline; color:#0000ff;">http://visualvm.java.net/</span></a></p></body></html> + + + + + + + + + + MCEdit + + + + + + + + + + + ... + + + + + + + + + Check + + + + + + + <html><head/><body><p><a href="http://www.mcedit.net/"><span style=" text-decoration: underline; color:#0000ff;">http://www.mcedit.net/</span></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 new file mode 100644 index 00000000..ab02b3a3 --- /dev/null +++ b/application/pages/global/JavaPage.cpp @@ -0,0 +1,146 @@ +/* Copyright 2013-2015 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 "ui_JavaPage.h" + +#include +#include +#include + +#include + +#include "NagUtils.h" + +#include "Platform.h" +#include "dialogs/VersionSelectDialog.h" +#include + +#include "java/JavaUtils.h" +#include "java/JavaVersionList.h" +#include "java/JavaChecker.h" + +#include "settings/SettingsObject.h" +#include "MultiMC.h" + +JavaPage::JavaPage(QWidget *parent) : QWidget(parent), ui(new Ui::JavaPage) +{ + ui->setupUi(this); + ui->tabWidget->tabBar()->hide(); + + auto resizer = new ColumnResizer(this); + resizer->addWidgetsFromLayout(ui->javaSettingsGroupBox->layout(), 0); + resizer->addWidgetsFromLayout(ui->customCommandsGroupBox->layout(), 0); + + loadSettings(); +} + +JavaPage::~JavaPage() +{ + delete ui; +} + +bool JavaPage::apply() +{ + applySettings(); + return true; +} + +void JavaPage::applySettings() +{ + auto s = MMC->settings(); + // Memory + s->set("MinMemAlloc", ui->minMemSpinBox->value()); + s->set("MaxMemAlloc", ui->maxMemSpinBox->value()); + s->set("PermGen", ui->permGenSpinBox->value()); + + // Java Settings + s->set("JavaPath", ui->javaPathTextBox->text()); + s->set("JvmArgs", ui->jvmArgsTextBox->text()); + NagUtils::checkJVMArgs(s->get("JvmArgs").toString(), this->parentWidget()); + + // Custom Commands + s->set("PreLaunchCommand", ui->preLaunchCmdTextBox->text()); + s->set("PostExitCommand", ui->postExitCmdTextBox->text()); +} +void JavaPage::loadSettings() +{ + auto s = MMC->settings(); + // Memory + ui->minMemSpinBox->setValue(s->get("MinMemAlloc").toInt()); + ui->maxMemSpinBox->setValue(s->get("MaxMemAlloc").toInt()); + ui->permGenSpinBox->setValue(s->get("PermGen").toInt()); + + // Java Settings + ui->javaPathTextBox->setText(s->get("JavaPath").toString()); + ui->jvmArgsTextBox->setText(s->get("JvmArgs").toString()); + + // Custom Commands + ui->preLaunchCmdTextBox->setText(s->get("PreLaunchCommand").toString()); + ui->postExitCmdTextBox->setText(s->get("PostExitCommand").toString()); +} + +void JavaPage::on_javaDetectBtn_clicked() +{ + JavaVersionPtr 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 dir = QFileDialog::getOpenFileName(this, tr("Find Java executable")); + if (!dir.isNull()) + { + ui->javaPathTextBox->setText(dir); + } +} +void JavaPage::on_javaTestBtn_clicked() +{ + checker.reset(new JavaChecker()); + connect(checker.get(), SIGNAL(checkFinished(JavaCheckResult)), this, + SLOT(checkFinished(JavaCheckResult))); + checker->path = ui->javaPathTextBox->text(); + checker->performCheck(); +} + +void JavaPage::checkFinished(JavaCheckResult result) +{ + if (result.valid) + { + QString text; + text += "Java test succeeded!\n"; + if (result.is_64bit) + text += "Using 64bit java.\n"; + text += "\n"; + text += "Platform reported: " + result.realPlatform + "\n"; + text += "Java version reported: " + result.javaVersion; + QMessageBox::information(this, tr("Java test success"), text); + } + else + { + QMessageBox::warning( + this, tr("Java test failure"), + tr("The specified java binary didn't work. You should use the auto-detect feature, " + "or set the path to the java executable.")); + } +} diff --git a/application/pages/global/JavaPage.h b/application/pages/global/JavaPage.h new file mode 100644 index 00000000..2af85280 --- /dev/null +++ b/application/pages/global/JavaPage.h @@ -0,0 +1,73 @@ +/* Copyright 2013-2015 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 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 checkFinished(JavaCheckResult result); + +private: + Ui::JavaPage *ui; + std::shared_ptr checker; +}; diff --git a/application/pages/global/JavaPage.ui b/application/pages/global/JavaPage.ui new file mode 100644 index 00000000..6ae41a49 --- /dev/null +++ b/application/pages/global/JavaPage.ui @@ -0,0 +1,303 @@ + + + JavaPage + + + + 0 + 0 + 545 + 609 + + + + + 0 + 0 + + + + Settings + + + + :/icons/toolbar/settings:/icons/toolbar/settings + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 0 + + + + Tab 1 + + + + + + Memory + + + + + + The maximum amount of memory Minecraft is allowed to use. + + + MB + + + 512 + + + 65536 + + + 128 + + + 1024 + + + + + + + Minimum memory allocation: + + + + + + + Maximum memory allocation: + + + + + + + The amount of memory Minecraft is started with. + + + MB + + + 256 + + + 65536 + + + 128 + + + 256 + + + + + + + PermGen: + + + + + + + The amount of memory available to store loaded Java classes. + + + MB + + + 64 + + + 999999999 + + + 8 + + + 64 + + + + + + + + + + Java Runtime + + + + + + + 0 + 0 + + + + Java path: + + + + + + + + 0 + 0 + + + + Auto-detect... + + + + + + + + 0 + 0 + + + + Test + + + + + + + + 0 + 0 + + + + JVM arguments: + + + + + + + + + + + + + 0 + 0 + + + + + 28 + 16777215 + + + + ... + + + + + + + + + + + + + + + Custom Commands + + + + + + Post-exit command: + + + + + + + Pre-launch command: + + + + + + + + + + + + + + + + + 0 + 0 + + + + Pre-launch command runs before the instance launches and post-exit command runs after it exits. Both will be run in MultiMC's working directory with INST_ID, INST_DIR, and INST_NAME as environment variables. + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + + + + + + + + minMemSpinBox + maxMemSpinBox + permGenSpinBox + javaPathTextBox + javaBrowseBtn + javaDetectBtn + javaTestBtn + jvmArgsTextBox + preLaunchCmdTextBox + postExitCmdTextBox + + + + diff --git a/application/pages/global/MinecraftPage.cpp b/application/pages/global/MinecraftPage.cpp new file mode 100644 index 00000000..f5e7e57f --- /dev/null +++ b/application/pages/global/MinecraftPage.cpp @@ -0,0 +1,92 @@ +/* Copyright 2013-2015 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 + +#include "Platform.h" +#include "dialogs/VersionSelectDialog.h" +#include "dialogs/CustomMessageBox.h" + +#include "NagUtils.h" + +#include "java/JavaUtils.h" +#include "java/JavaVersionList.h" +#include "java/JavaChecker.h" + +#include "updater/UpdateChecker.h" + +#include "tools/BaseProfiler.h" + +#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()); +} + +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()); +} diff --git a/application/pages/global/MinecraftPage.h b/application/pages/global/MinecraftPage.h new file mode 100644 index 00000000..6355b507 --- /dev/null +++ b/application/pages/global/MinecraftPage.h @@ -0,0 +1,70 @@ +/* Copyright 2013-2015 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 new file mode 100644 index 00000000..825f6a56 --- /dev/null +++ b/application/pages/global/MinecraftPage.ui @@ -0,0 +1,148 @@ + + + MinecraftPage + + + + 0 + 0 + 545 + 195 + + + + + 0 + 0 + + + + Settings + + + + :/icons/toolbar/settings:/icons/toolbar/settings + + + + 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 + + + + + + + + + + + + Qt::Vertical + + + + 0 + 0 + + + + + + + + + + + + tabWidget + maximizedCheckBox + windowWidthSpinBox + windowHeightSpinBox + + + + diff --git a/application/pages/global/MultiMCPage.cpp b/application/pages/global/MultiMCPage.cpp new file mode 100644 index 00000000..5f56fb89 --- /dev/null +++ b/application/pages/global/MultiMCPage.cpp @@ -0,0 +1,459 @@ +/* Copyright 2013-2015 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 + +#include "Platform.h" +#include "dialogs/VersionSelectDialog.h" +#include "dialogs/CustomMessageBox.h" +#include + +#include "NagUtils.h" + +#include "java/JavaUtils.h" +#include "java/JavaVersionList.h" +#include "java/JavaChecker.h" + +#include "updater/UpdateChecker.h" + +#include "tools/BaseProfiler.h" + +#include "settings/SettingsObject.h" +#include "MultiMC.h" + +// 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); + ui->sortingModeGroup->setId(ui->sortByNameBtn, Sort_Name); + ui->sortingModeGroup->setId(ui->sortLastLaunchedBtn, Sort_LastLaunch); + + auto resizer = new ColumnResizer(this); + resizer->addWidgetsFromLayout(ui->groupBox->layout(), 1); + resizer->addWidgetsFromLayout(ui->foldersBox->layout(), 1); + + defaultFormat = new QTextCharFormat(ui->fontPreview->currentCharFormat()); + + loadSettings(); + + QObject::connect(MMC->updateChecker().get(), &UpdateChecker::channelListLoaded, this, + &MultiMCPage::refreshUpdateChannelList); + + if (MMC->updateChecker()->hasChannels()) + { + refreshUpdateChannelList(); + } + else + { + MMC->updateChecker()->updateChanList(false); + } + connect(ui->fontSizeBox, SIGNAL(valueChanged(int)), SLOT(refreshFontPreview())); + connect(ui->consoleFont, SIGNAL(currentFontChanged(QFont)), SLOT(refreshFontPreview())); +} + +MultiMCPage::~MultiMCPage() +{ + delete ui; +} + +bool MultiMCPage::apply() +{ + applySettings(); + return true; +} + +void MultiMCPage::on_ftbLauncherBrowseBtn_clicked() +{ + QString raw_dir = QFileDialog::getExistingDirectory(this, tr("FTB Launcher Directory"), + ui->ftbLauncherBox->text()); + QString cooked_dir = NormalizePath(raw_dir); + + // do not allow current dir - it's dirty. Do not allow dirs that don't exist + if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists()) + { + ui->ftbLauncherBox->setText(cooked_dir); + } +} +void MultiMCPage::on_ftbBrowseBtn_clicked() +{ + QString raw_dir = + QFileDialog::getExistingDirectory(this, tr("FTB Directory"), ui->ftbBox->text()); + QString cooked_dir = NormalizePath(raw_dir); + + // do not allow current dir - it's dirty. Do not allow dirs that don't exist + if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists()) + { + ui->ftbBox->setText(cooked_dir); + } +} + +void MultiMCPage::on_instDirBrowseBtn_clicked() +{ + QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Instance Directory"), + ui->instDirTextBox->text()); + QString cooked_dir = NormalizePath(raw_dir); + + // do not allow current dir - it's dirty. Do not allow dirs that don't exist + if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists()) + { + if (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 Directory"), + ui->iconsDirTextBox->text()); + QString cooked_dir = NormalizePath(raw_dir); + + // do not allow current dir - it's dirty. Do not allow dirs that don't exist + if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists()) + { + ui->iconsDirTextBox->setText(cooked_dir); + } +} +void MultiMCPage::on_modsDirBrowseBtn_clicked() +{ + QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Mods Directory"), + ui->modsDirTextBox->text()); + QString cooked_dir = NormalizePath(raw_dir); + + // do not allow current dir - it's dirty. Do not allow dirs that don't exist + if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists()) + { + ui->modsDirTextBox->setText(cooked_dir); + } +} +void MultiMCPage::on_lwjglDirBrowseBtn_clicked() +{ + QString raw_dir = QFileDialog::getExistingDirectory(this, tr("LWJGL Directory"), + ui->lwjglDirTextBox->text()); + QString cooked_dir = NormalizePath(raw_dir); + + // do not allow current dir - it's dirty. Do not allow dirs that don't exist + if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists()) + { + ui->lwjglDirTextBox->setText(cooked_dir); + } +} + +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(); + // Language + s->set("Language", + ui->languageBox->itemData(ui->languageBox->currentIndex()).toLocale().bcp47Name()); + + 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 0: + default: + s->set("IconTheme", "multimc"); + break; + } + + if(original != s->get("IconTheme")) + { + MMC->setIconTheme(s->get("IconTheme").toString()); + } + + // Console settings + s->set("ShowConsole", ui->showConsoleCheck->isChecked()); + s->set("AutoCloseConsole", ui->autoCloseConsoleCheck->isChecked()); + QString consoleFontFamily = ui->consoleFont->currentFont().family(); + s->set("ConsoleFont", consoleFontFamily); + s->set("ConsoleFontSize", ui->fontSizeBox->value()); + + // FTB + s->set("TrackFTBInstances", ui->trackFtbBox->isChecked()); + s->set("FTBLauncherRoot", ui->ftbLauncherBox->text()); + s->set("FTBRoot", ui->ftbBox->text()); + + // Folders + // TODO: Offer to move instances to new instance folder. + s->set("InstanceDir", ui->instDirTextBox->text()); + s->set("CentralModsDir", ui->modsDirTextBox->text()); + s->set("LWJGLDir", ui->lwjglDirTextBox->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; + } +} +void MultiMCPage::loadSettings() +{ + auto s = MMC->settings(); + // Language + ui->languageBox->clear(); + ui->languageBox->addItem(tr("English"), QLocale(QLocale::English)); + foreach(const QString & lang, QDir(MMC->staticData() + "/translations") + .entryList(QStringList() << "*.qm", QDir::Files)) + { + QLocale locale(lang.section(QRegExp("[_\\.]"), 1)); + ui->languageBox->addItem(QLocale::languageToString(locale.language()), locale); + } + ui->languageBox->setCurrentIndex( + ui->languageBox->findData(QLocale(s->get("Language").toString()))); + + // 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 + { + ui->themeComboBox->setCurrentIndex(0); + } + + // Console settings + ui->showConsoleCheck->setChecked(s->get("ShowConsole").toBool()); + ui->autoCloseConsoleCheck->setChecked(s->get("AutoCloseConsole").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(); + + // FTB + ui->trackFtbBox->setChecked(s->get("TrackFTBInstances").toBool()); + ui->ftbLauncherBox->setText(s->get("FTBLauncherRoot").toString()); + ui->ftbBox->setText(s->get("FTBRoot").toString()); + + // Folders + ui->instDirTextBox->setText(s->get("InstanceDir").toString()); + ui->modsDirTextBox->setText(s->get("CentralModsDir").toString()); + ui->lwjglDirTextBox->setText(s->get("LWJGLDir").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); + } +} + +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(QColor("red")); + // 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); + // 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(QColor("orange")); + // 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(); + } +} \ No newline at end of file diff --git a/application/pages/global/MultiMCPage.h b/application/pages/global/MultiMCPage.h new file mode 100644 index 00000000..d90acc13 --- /dev/null +++ b/application/pages/global/MultiMCPage.h @@ -0,0 +1,100 @@ +/* Copyright 2013-2015 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 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 tr("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_ftbLauncherBrowseBtn_clicked(); + void on_ftbBrowseBtn_clicked(); + + void on_instDirBrowseBtn_clicked(); + void on_modsDirBrowseBtn_clicked(); + void on_lwjglDirBrowseBtn_clicked(); + void on_iconsDirBrowseBtn_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; +}; diff --git a/application/pages/global/MultiMCPage.ui b/application/pages/global/MultiMCPage.ui new file mode 100644 index 00000000..38d1bb1d --- /dev/null +++ b/application/pages/global/MultiMCPage.ui @@ -0,0 +1,532 @@ + + + MultiMCPage + + + + 0 + 0 + 487 + 519 + + + + + 0 + 0 + + + + Settings + + + + :/icons/toolbar/settings:/icons/toolbar/settings + + + + 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 + + + + + + + + + + FTB + + + + + + &Launcher: + + + ftbLauncherBox + + + + + + + false + + + + + + + + + + Files: + + + ftbBox + + + + + + + true + + + ... + + + + + + + false + + + Qt::TabFocus + + + ... + + + + + + + Track FTB instances + + + + + + + + + + Folders + + + + + + I&nstances: + + + instDirTextBox + + + + + + + + + + ... + + + + + + + &Mods: + + + modsDirTextBox + + + + + + + + + + + + + ... + + + + + + + LW&JGL: + + + lwjglDirTextBox + + + + + + + ... + + + + + + + + + + &Icons: + + + iconsDirTextBox + + + + + + + ... + + + + + + + + + + Qt::Vertical + + + + 0 + 0 + + + + + + + + + User Interface + + + + + + MultiMC notifications + + + + + + Reset hidden notifications + + + true + + + + + + + + + + true + + + Instance view sorting mode + + + + + + By &last launched + + + sortingModeGroup + + + + + + + By &name + + + sortingModeGroup + + + + + + + + + + Language (needs restart): + + + + + + + + + + + + Icon Theme (needs restart, work in progress) + + + + + + + 0 + 0 + + + + Qt::StrongFocus + + + + Default + + + + + Simple (Dark Icons) + + + + + Simple (Light Icons) + + + + + Simple (Blue Icons) + + + + + Simple (Colored Icons) + + + + + OSX + + + + + iOS + + + + + + + + + + + Qt::Vertical + + + + 0 + 0 + + + + + + + + + Console + + + + + + Console Settings + + + + + + Show console while the game is running? + + + + + + + Automatically close console when the game quits? + + + + + + + + + + + 0 + 0 + + + + Console font + + + + + + + 0 + 0 + + + + Qt::ScrollBarAlwaysOff + + + false + + + Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + 0 + 0 + + + + + + + + 5 + + + 16 + + + 11 + + + + + + + + + + + + + + tabWidget + autoUpdateCheckBox + updateChannelComboBox + trackFtbBox + ftbLauncherBox + ftbLauncherBrowseBtn + ftbBox + ftbBrowseBtn + instDirTextBox + instDirBrowseBtn + modsDirTextBox + modsDirBrowseBtn + lwjglDirTextBox + lwjglDirBrowseBtn + iconsDirTextBox + iconsDirBrowseBtn + resetNotificationsBtn + sortLastLaunchedBtn + sortByNameBtn + languageBox + themeComboBox + showConsoleCheck + autoCloseConsoleCheck + consoleFont + fontSizeBox + fontPreview + + + + + + + diff --git a/application/pages/global/ProxyPage.cpp b/application/pages/global/ProxyPage.cpp new file mode 100644 index 00000000..f18f7049 --- /dev/null +++ b/application/pages/global/ProxyPage.cpp @@ -0,0 +1,95 @@ +/* Copyright 2013-2015 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 "settings/SettingsObject.h" +#include "MultiMC.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()); +} +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 new file mode 100644 index 00000000..362e67a0 --- /dev/null +++ b/application/pages/global/ProxyPage.h @@ -0,0 +1,66 @@ +/* Copyright 2013-2015 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 new file mode 100644 index 00000000..7cddd66d --- /dev/null +++ b/application/pages/global/ProxyPage.ui @@ -0,0 +1,197 @@ + + + ProxyPage + + + + 0 + 0 + 607 + 632 + + + + + 0 + 0 + + + + Settings + + + + :/icons/toolbar/settings:/icons/toolbar/settings + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + + + + Type + + + + + + Uses your system's default proxy settings. + + + Default + + + proxyGroup + + + + + + + None + + + proxyGroup + + + + + + + SOCKS5 + + + proxyGroup + + + + + + + HTTP + + + 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/resources/MultiMC.icns b/application/resources/MultiMC.icns new file mode 100644 index 00000000..05ce9207 Binary files /dev/null and b/application/resources/MultiMC.icns differ diff --git a/application/resources/MultiMC.ico b/application/resources/MultiMC.ico new file mode 100644 index 00000000..734af0fb Binary files /dev/null and b/application/resources/MultiMC.ico differ diff --git a/application/resources/MultiMC.manifest b/application/resources/MultiMC.manifest new file mode 100644 index 00000000..3acf8f7f --- /dev/null +++ b/application/resources/MultiMC.manifest @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + 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 new file mode 100644 index 00000000..20c71eb8 --- /dev/null +++ b/application/resources/OSX/OSX.qrc @@ -0,0 +1,35 @@ + + + + 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/instance-settings.svg + scalable/jarmods.svg + scalable/java.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 + + diff --git a/application/resources/OSX/index.theme b/application/resources/OSX/index.theme new file mode 100644 index 00000000..7f90a32e --- /dev/null +++ b/application/resources/OSX/index.theme @@ -0,0 +1,11 @@ +[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 new file mode 100644 index 00000000..eb87ccf1 --- /dev/null +++ b/application/resources/OSX/scalable/about.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + diff --git a/application/resources/OSX/scalable/accounts.svg b/application/resources/OSX/scalable/accounts.svg new file mode 100644 index 00000000..163bcee0 --- /dev/null +++ b/application/resources/OSX/scalable/accounts.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff --git a/application/resources/OSX/scalable/bug.svg b/application/resources/OSX/scalable/bug.svg new file mode 100644 index 00000000..00565bb6 --- /dev/null +++ b/application/resources/OSX/scalable/bug.svg @@ -0,0 +1,25 @@ + + + + + + + + + diff --git a/application/resources/OSX/scalable/centralmods.svg b/application/resources/OSX/scalable/centralmods.svg new file mode 100644 index 00000000..37b821e4 --- /dev/null +++ b/application/resources/OSX/scalable/centralmods.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/application/resources/OSX/scalable/checkupdate.svg b/application/resources/OSX/scalable/checkupdate.svg new file mode 100644 index 00000000..30cec51f --- /dev/null +++ b/application/resources/OSX/scalable/checkupdate.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + diff --git a/application/resources/OSX/scalable/copy.svg b/application/resources/OSX/scalable/copy.svg new file mode 100644 index 00000000..7382d6e2 --- /dev/null +++ b/application/resources/OSX/scalable/copy.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + diff --git a/application/resources/OSX/scalable/coremods.svg b/application/resources/OSX/scalable/coremods.svg new file mode 100644 index 00000000..b0df6052 --- /dev/null +++ b/application/resources/OSX/scalable/coremods.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + diff --git a/application/resources/OSX/scalable/externaltools.svg b/application/resources/OSX/scalable/externaltools.svg new file mode 100644 index 00000000..a2b7488e --- /dev/null +++ b/application/resources/OSX/scalable/externaltools.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/application/resources/OSX/scalable/instance-settings.svg b/application/resources/OSX/scalable/instance-settings.svg new file mode 100644 index 00000000..394877f8 --- /dev/null +++ b/application/resources/OSX/scalable/instance-settings.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + diff --git a/application/resources/OSX/scalable/jarmods.svg b/application/resources/OSX/scalable/jarmods.svg new file mode 100644 index 00000000..213ec833 --- /dev/null +++ b/application/resources/OSX/scalable/jarmods.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/OSX/scalable/java.svg b/application/resources/OSX/scalable/java.svg new file mode 100644 index 00000000..e1aee159 --- /dev/null +++ b/application/resources/OSX/scalable/java.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/OSX/scalable/loadermods.svg b/application/resources/OSX/scalable/loadermods.svg new file mode 100644 index 00000000..76951ebd --- /dev/null +++ b/application/resources/OSX/scalable/loadermods.svg @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/application/resources/OSX/scalable/log.svg b/application/resources/OSX/scalable/log.svg new file mode 100644 index 00000000..0ac45d54 --- /dev/null +++ b/application/resources/OSX/scalable/log.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + diff --git a/application/resources/OSX/scalable/minecraft.svg b/application/resources/OSX/scalable/minecraft.svg new file mode 100644 index 00000000..86c915bc --- /dev/null +++ b/application/resources/OSX/scalable/minecraft.svg @@ -0,0 +1,12 @@ + + + + + + + + + + diff --git a/application/resources/OSX/scalable/multimc.svg b/application/resources/OSX/scalable/multimc.svg new file mode 100644 index 00000000..caad21b5 --- /dev/null +++ b/application/resources/OSX/scalable/multimc.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + diff --git a/application/resources/OSX/scalable/new.svg b/application/resources/OSX/scalable/new.svg new file mode 100644 index 00000000..79ee87ba --- /dev/null +++ b/application/resources/OSX/scalable/new.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + diff --git a/application/resources/OSX/scalable/news.svg b/application/resources/OSX/scalable/news.svg new file mode 100644 index 00000000..b8ce3cd1 --- /dev/null +++ b/application/resources/OSX/scalable/news.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/application/resources/OSX/scalable/notes.svg b/application/resources/OSX/scalable/notes.svg new file mode 100644 index 00000000..c2e95cfd --- /dev/null +++ b/application/resources/OSX/scalable/notes.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + diff --git a/application/resources/OSX/scalable/patreon.svg b/application/resources/OSX/scalable/patreon.svg new file mode 100644 index 00000000..4f0da3e5 --- /dev/null +++ b/application/resources/OSX/scalable/patreon.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + diff --git a/application/resources/OSX/scalable/proxy.svg b/application/resources/OSX/scalable/proxy.svg new file mode 100644 index 00000000..99acaa2b --- /dev/null +++ b/application/resources/OSX/scalable/proxy.svg @@ -0,0 +1,16 @@ + + + + + + + + + + diff --git a/application/resources/OSX/scalable/quickmods.svg b/application/resources/OSX/scalable/quickmods.svg new file mode 100644 index 00000000..e0aaad87 --- /dev/null +++ b/application/resources/OSX/scalable/quickmods.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + diff --git a/application/resources/OSX/scalable/refresh.svg b/application/resources/OSX/scalable/refresh.svg new file mode 100644 index 00000000..c97489c1 --- /dev/null +++ b/application/resources/OSX/scalable/refresh.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff --git a/application/resources/OSX/scalable/resourcepacks.svg b/application/resources/OSX/scalable/resourcepacks.svg new file mode 100644 index 00000000..c85d4e3c --- /dev/null +++ b/application/resources/OSX/scalable/resourcepacks.svg @@ -0,0 +1,17 @@ + + + + + + + + + + diff --git a/application/resources/OSX/scalable/screenshots.svg b/application/resources/OSX/scalable/screenshots.svg new file mode 100644 index 00000000..12df0c88 --- /dev/null +++ b/application/resources/OSX/scalable/screenshots.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + diff --git a/application/resources/OSX/scalable/settings.svg b/application/resources/OSX/scalable/settings.svg new file mode 100644 index 00000000..dcdd9f1c --- /dev/null +++ b/application/resources/OSX/scalable/settings.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + + diff --git a/application/resources/OSX/scalable/status-bad.svg b/application/resources/OSX/scalable/status-bad.svg new file mode 100644 index 00000000..add7a6f7 --- /dev/null +++ b/application/resources/OSX/scalable/status-bad.svg @@ -0,0 +1,11 @@ + + + + + + + diff --git a/application/resources/OSX/scalable/status-good.svg b/application/resources/OSX/scalable/status-good.svg new file mode 100644 index 00000000..f10da757 --- /dev/null +++ b/application/resources/OSX/scalable/status-good.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + diff --git a/application/resources/OSX/scalable/status-yellow.svg b/application/resources/OSX/scalable/status-yellow.svg new file mode 100644 index 00000000..fba697bc --- /dev/null +++ b/application/resources/OSX/scalable/status-yellow.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff --git a/application/resources/OSX/scalable/viewfolder.svg b/application/resources/OSX/scalable/viewfolder.svg new file mode 100644 index 00000000..682c72c7 --- /dev/null +++ b/application/resources/OSX/scalable/viewfolder.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff --git a/application/resources/backgrounds/backgrounds.qrc b/application/resources/backgrounds/backgrounds.qrc new file mode 100644 index 00000000..55de139e --- /dev/null +++ b/application/resources/backgrounds/backgrounds.qrc @@ -0,0 +1,6 @@ + + + + catbgrnd2.png + + diff --git a/application/resources/backgrounds/catbgrnd2.png b/application/resources/backgrounds/catbgrnd2.png new file mode 100644 index 00000000..2b949e0b Binary files /dev/null and b/application/resources/backgrounds/catbgrnd2.png differ diff --git a/application/resources/iOS/iOS.qrc b/application/resources/iOS/iOS.qrc new file mode 100644 index 00000000..eb625d0b --- /dev/null +++ b/application/resources/iOS/iOS.qrc @@ -0,0 +1,35 @@ + + + + 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/instance-settings.svg + scalable/jarmods.svg + scalable/java.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 + + diff --git a/application/resources/iOS/index.theme b/application/resources/iOS/index.theme new file mode 100644 index 00000000..b0f2f6ba --- /dev/null +++ b/application/resources/iOS/index.theme @@ -0,0 +1,11 @@ +[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 new file mode 100644 index 00000000..c4d35471 --- /dev/null +++ b/application/resources/iOS/scalable/about.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + diff --git a/application/resources/iOS/scalable/accounts.svg b/application/resources/iOS/scalable/accounts.svg new file mode 100644 index 00000000..65f76c3f --- /dev/null +++ b/application/resources/iOS/scalable/accounts.svg @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/application/resources/iOS/scalable/bug.svg b/application/resources/iOS/scalable/bug.svg new file mode 100644 index 00000000..fc4a3d69 --- /dev/null +++ b/application/resources/iOS/scalable/bug.svg @@ -0,0 +1,22 @@ + + + + + + diff --git a/application/resources/iOS/scalable/centralmods.svg b/application/resources/iOS/scalable/centralmods.svg new file mode 100644 index 00000000..1b4c4741 --- /dev/null +++ b/application/resources/iOS/scalable/centralmods.svg @@ -0,0 +1,13 @@ + + + + + + + + + diff --git a/application/resources/iOS/scalable/checkupdate.svg b/application/resources/iOS/scalable/checkupdate.svg new file mode 100644 index 00000000..9fc983d1 --- /dev/null +++ b/application/resources/iOS/scalable/checkupdate.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + diff --git a/application/resources/iOS/scalable/copy.svg b/application/resources/iOS/scalable/copy.svg new file mode 100644 index 00000000..3ccc2f06 --- /dev/null +++ b/application/resources/iOS/scalable/copy.svg @@ -0,0 +1,13 @@ + + + + + + + + + + diff --git a/application/resources/iOS/scalable/coremods.svg b/application/resources/iOS/scalable/coremods.svg new file mode 100644 index 00000000..ea47872c --- /dev/null +++ b/application/resources/iOS/scalable/coremods.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + diff --git a/application/resources/iOS/scalable/externaltools.svg b/application/resources/iOS/scalable/externaltools.svg new file mode 100644 index 00000000..16e9fa48 --- /dev/null +++ b/application/resources/iOS/scalable/externaltools.svg @@ -0,0 +1,13 @@ + + + + + + + + + + diff --git a/application/resources/iOS/scalable/instance-settings.svg b/application/resources/iOS/scalable/instance-settings.svg new file mode 100644 index 00000000..95b8a508 --- /dev/null +++ b/application/resources/iOS/scalable/instance-settings.svg @@ -0,0 +1,19 @@ + + + + + + + + + + diff --git a/application/resources/iOS/scalable/jarmods.svg b/application/resources/iOS/scalable/jarmods.svg new file mode 100644 index 00000000..c4c5ca8c --- /dev/null +++ b/application/resources/iOS/scalable/jarmods.svg @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/iOS/scalable/java.svg b/application/resources/iOS/scalable/java.svg new file mode 100644 index 00000000..8d7c2798 --- /dev/null +++ b/application/resources/iOS/scalable/java.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/iOS/scalable/loadermods.svg b/application/resources/iOS/scalable/loadermods.svg new file mode 100644 index 00000000..010efa11 --- /dev/null +++ b/application/resources/iOS/scalable/loadermods.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/application/resources/iOS/scalable/log.svg b/application/resources/iOS/scalable/log.svg new file mode 100644 index 00000000..5d1c7f06 --- /dev/null +++ b/application/resources/iOS/scalable/log.svg @@ -0,0 +1,13 @@ + + + + + + + + + + diff --git a/application/resources/iOS/scalable/minecraft.svg b/application/resources/iOS/scalable/minecraft.svg new file mode 100644 index 00000000..069b4e71 --- /dev/null +++ b/application/resources/iOS/scalable/minecraft.svg @@ -0,0 +1,8 @@ + + + + + + diff --git a/application/resources/iOS/scalable/multimc.svg b/application/resources/iOS/scalable/multimc.svg new file mode 100644 index 00000000..bc819433 --- /dev/null +++ b/application/resources/iOS/scalable/multimc.svg @@ -0,0 +1,13 @@ + + + + + + + + + diff --git a/application/resources/iOS/scalable/new.svg b/application/resources/iOS/scalable/new.svg new file mode 100644 index 00000000..9f221580 --- /dev/null +++ b/application/resources/iOS/scalable/new.svg @@ -0,0 +1,13 @@ + + + + + + + + + + diff --git a/application/resources/iOS/scalable/news.svg b/application/resources/iOS/scalable/news.svg new file mode 100644 index 00000000..d3c010bb --- /dev/null +++ b/application/resources/iOS/scalable/news.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/application/resources/iOS/scalable/notes.svg b/application/resources/iOS/scalable/notes.svg new file mode 100644 index 00000000..b42ebeef --- /dev/null +++ b/application/resources/iOS/scalable/notes.svg @@ -0,0 +1,15 @@ + + + + + + + + + + diff --git a/application/resources/iOS/scalable/patreon.svg b/application/resources/iOS/scalable/patreon.svg new file mode 100644 index 00000000..1bd06f4a --- /dev/null +++ b/application/resources/iOS/scalable/patreon.svg @@ -0,0 +1,12 @@ + + + + + + + + + diff --git a/application/resources/iOS/scalable/proxy.svg b/application/resources/iOS/scalable/proxy.svg new file mode 100644 index 00000000..f6552281 --- /dev/null +++ b/application/resources/iOS/scalable/proxy.svg @@ -0,0 +1,11 @@ + + + + + + diff --git a/application/resources/iOS/scalable/quickmods.svg b/application/resources/iOS/scalable/quickmods.svg new file mode 100644 index 00000000..cd63ba71 --- /dev/null +++ b/application/resources/iOS/scalable/quickmods.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/application/resources/iOS/scalable/refresh.svg b/application/resources/iOS/scalable/refresh.svg new file mode 100644 index 00000000..297b79c9 --- /dev/null +++ b/application/resources/iOS/scalable/refresh.svg @@ -0,0 +1,13 @@ + + + + + + + + + + diff --git a/application/resources/iOS/scalable/resourcepacks.svg b/application/resources/iOS/scalable/resourcepacks.svg new file mode 100644 index 00000000..5b359d63 --- /dev/null +++ b/application/resources/iOS/scalable/resourcepacks.svg @@ -0,0 +1,15 @@ + + + + + + + + + + diff --git a/application/resources/iOS/scalable/screenshots.svg b/application/resources/iOS/scalable/screenshots.svg new file mode 100644 index 00000000..39ce7b82 --- /dev/null +++ b/application/resources/iOS/scalable/screenshots.svg @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/application/resources/iOS/scalable/settings.svg b/application/resources/iOS/scalable/settings.svg new file mode 100644 index 00000000..95b8a508 --- /dev/null +++ b/application/resources/iOS/scalable/settings.svg @@ -0,0 +1,19 @@ + + + + + + + + + + diff --git a/application/resources/iOS/scalable/status-bad.svg b/application/resources/iOS/scalable/status-bad.svg new file mode 100644 index 00000000..4019c8da --- /dev/null +++ b/application/resources/iOS/scalable/status-bad.svg @@ -0,0 +1,10 @@ + + + + + + diff --git a/application/resources/iOS/scalable/status-good.svg b/application/resources/iOS/scalable/status-good.svg new file mode 100644 index 00000000..e1859113 --- /dev/null +++ b/application/resources/iOS/scalable/status-good.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + diff --git a/application/resources/iOS/scalable/status-yellow.svg b/application/resources/iOS/scalable/status-yellow.svg new file mode 100644 index 00000000..d8a28e23 --- /dev/null +++ b/application/resources/iOS/scalable/status-yellow.svg @@ -0,0 +1,56 @@ + + + +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 new file mode 100644 index 00000000..0ae0c0b5 --- /dev/null +++ b/application/resources/iOS/scalable/viewfolder.svg @@ -0,0 +1,12 @@ + + + + + + + + + + diff --git a/application/resources/instances/brick.png b/application/resources/instances/brick.png new file mode 100644 index 00000000..0b534366 Binary files /dev/null and b/application/resources/instances/brick.png differ diff --git a/application/resources/instances/broken.png b/application/resources/instances/broken.png new file mode 100644 index 00000000..7a80a76e Binary files /dev/null and b/application/resources/instances/broken.png differ diff --git a/application/resources/instances/chicken.png b/application/resources/instances/chicken.png new file mode 100644 index 00000000..f870467a Binary files /dev/null and b/application/resources/instances/chicken.png differ diff --git a/application/resources/instances/chicken128.png b/application/resources/instances/chicken128.png new file mode 100644 index 00000000..71f6dedc Binary files /dev/null and b/application/resources/instances/chicken128.png differ diff --git a/application/resources/instances/creeper.png b/application/resources/instances/creeper.png new file mode 100644 index 00000000..a67ecfc3 Binary files /dev/null and b/application/resources/instances/creeper.png differ diff --git a/application/resources/instances/creeper128.png b/application/resources/instances/creeper128.png new file mode 100644 index 00000000..41b7d07d Binary files /dev/null and b/application/resources/instances/creeper128.png differ diff --git a/application/resources/instances/derp.png b/application/resources/instances/derp.png new file mode 100644 index 00000000..4c361942 Binary files /dev/null and b/application/resources/instances/derp.png differ diff --git a/application/resources/instances/diamond.png b/application/resources/instances/diamond.png new file mode 100644 index 00000000..376ab901 Binary files /dev/null and b/application/resources/instances/diamond.png differ diff --git a/application/resources/instances/dirt.png b/application/resources/instances/dirt.png new file mode 100644 index 00000000..9e19eb8f Binary files /dev/null and b/application/resources/instances/dirt.png differ diff --git a/application/resources/instances/enderman.png b/application/resources/instances/enderman.png new file mode 100644 index 00000000..9f3a72b3 Binary files /dev/null and b/application/resources/instances/enderman.png differ diff --git a/application/resources/instances/enderpearl.png b/application/resources/instances/enderpearl.png new file mode 100644 index 00000000..a818eb8e Binary files /dev/null and b/application/resources/instances/enderpearl.png differ diff --git a/application/resources/instances/enderpearl128.png b/application/resources/instances/enderpearl128.png new file mode 100644 index 00000000..0a5bf91a Binary files /dev/null and b/application/resources/instances/enderpearl128.png differ diff --git a/application/resources/instances/ftb_glow.png b/application/resources/instances/ftb_glow.png new file mode 100644 index 00000000..c4e6fd5d Binary files /dev/null and b/application/resources/instances/ftb_glow.png differ diff --git a/application/resources/instances/ftb_glow128.png b/application/resources/instances/ftb_glow128.png new file mode 100644 index 00000000..86632b21 Binary files /dev/null and b/application/resources/instances/ftb_glow128.png differ diff --git a/application/resources/instances/ftb_logo.png b/application/resources/instances/ftb_logo.png new file mode 100644 index 00000000..20df7171 Binary files /dev/null and b/application/resources/instances/ftb_logo.png differ diff --git a/application/resources/instances/ftb_logo128.png b/application/resources/instances/ftb_logo128.png new file mode 100644 index 00000000..e725b7fe Binary files /dev/null and b/application/resources/instances/ftb_logo128.png differ diff --git a/application/resources/instances/gear.png b/application/resources/instances/gear.png new file mode 100644 index 00000000..da9ba2f9 Binary files /dev/null and b/application/resources/instances/gear.png differ diff --git a/application/resources/instances/gear128.png b/application/resources/instances/gear128.png new file mode 100644 index 00000000..75c68a66 Binary files /dev/null and b/application/resources/instances/gear128.png differ diff --git a/application/resources/instances/gold.png b/application/resources/instances/gold.png new file mode 100644 index 00000000..9bedda16 Binary files /dev/null and b/application/resources/instances/gold.png differ diff --git a/application/resources/instances/grass.png b/application/resources/instances/grass.png new file mode 100644 index 00000000..f1694547 Binary files /dev/null and b/application/resources/instances/grass.png differ diff --git a/application/resources/instances/herobrine.png b/application/resources/instances/herobrine.png new file mode 100644 index 00000000..e5460da3 Binary files /dev/null and b/application/resources/instances/herobrine.png differ diff --git a/application/resources/instances/herobrine128.png b/application/resources/instances/herobrine128.png new file mode 100644 index 00000000..13f1494c Binary files /dev/null and b/application/resources/instances/herobrine128.png differ diff --git a/application/resources/instances/infinity.png b/application/resources/instances/infinity.png new file mode 100644 index 00000000..bd94a3dc Binary files /dev/null and b/application/resources/instances/infinity.png differ diff --git a/application/resources/instances/infinity128.png b/application/resources/instances/infinity128.png new file mode 100644 index 00000000..226847fb Binary files /dev/null and b/application/resources/instances/infinity128.png differ diff --git a/application/resources/instances/instances.qrc b/application/resources/instances/instances.qrc new file mode 100644 index 00000000..09ae25d0 --- /dev/null +++ b/application/resources/instances/instances.qrc @@ -0,0 +1,49 @@ + + + + + brick.png + diamond.png + dirt.png + gold.png + grass.png + stone.png + tnt.png + iron.png + planks.png + + + derp.png + enderman.png + + + chicken128.png + creeper128.png + enderpearl128.png + ftb_glow128.png + ftb_logo128.png + gear128.png + herobrine128.png + infinity128.png + magitech128.png + meat128.png + netherstar128.png + skeleton128.png + squarecreeper128.png + steve128.png + + + + enderman.png + herobrine.png + derp.png + + + updateavailable.png + + + kitten.png + + broken.png + + diff --git a/application/resources/instances/iron.png b/application/resources/instances/iron.png new file mode 100644 index 00000000..28960782 Binary files /dev/null and b/application/resources/instances/iron.png differ diff --git a/application/resources/instances/kitten.png b/application/resources/instances/kitten.png new file mode 100644 index 00000000..d17661ce Binary files /dev/null and b/application/resources/instances/kitten.png differ diff --git a/application/resources/instances/magitech.png b/application/resources/instances/magitech.png new file mode 100644 index 00000000..6fd8ff60 Binary files /dev/null and b/application/resources/instances/magitech.png differ diff --git a/application/resources/instances/magitech128.png b/application/resources/instances/magitech128.png new file mode 100644 index 00000000..0f81a199 Binary files /dev/null and b/application/resources/instances/magitech128.png differ diff --git a/application/resources/instances/meat.png b/application/resources/instances/meat.png new file mode 100644 index 00000000..6694859d Binary files /dev/null and b/application/resources/instances/meat.png differ diff --git a/application/resources/instances/meat128.png b/application/resources/instances/meat128.png new file mode 100644 index 00000000..fefc9bf1 Binary files /dev/null and b/application/resources/instances/meat128.png differ diff --git a/application/resources/instances/netherstar.png b/application/resources/instances/netherstar.png new file mode 100644 index 00000000..43cb5113 Binary files /dev/null and b/application/resources/instances/netherstar.png differ diff --git a/application/resources/instances/netherstar128.png b/application/resources/instances/netherstar128.png new file mode 100644 index 00000000..132085f0 Binary files /dev/null and b/application/resources/instances/netherstar128.png differ diff --git a/application/resources/instances/planks.png b/application/resources/instances/planks.png new file mode 100644 index 00000000..7fcf8467 Binary files /dev/null and b/application/resources/instances/planks.png differ diff --git a/application/resources/instances/skeleton.png b/application/resources/instances/skeleton.png new file mode 100644 index 00000000..0c8d3505 Binary files /dev/null and b/application/resources/instances/skeleton.png differ diff --git a/application/resources/instances/skeleton128.png b/application/resources/instances/skeleton128.png new file mode 100644 index 00000000..55fcf5a9 Binary files /dev/null and b/application/resources/instances/skeleton128.png differ diff --git a/application/resources/instances/squarecreeper.png b/application/resources/instances/squarecreeper.png new file mode 100644 index 00000000..b78c4ae0 Binary files /dev/null and b/application/resources/instances/squarecreeper.png differ diff --git a/application/resources/instances/squarecreeper128.png b/application/resources/instances/squarecreeper128.png new file mode 100644 index 00000000..c82d8406 Binary files /dev/null and b/application/resources/instances/squarecreeper128.png differ diff --git a/application/resources/instances/steve.png b/application/resources/instances/steve.png new file mode 100644 index 00000000..07c6acde Binary files /dev/null and b/application/resources/instances/steve.png differ diff --git a/application/resources/instances/steve128.png b/application/resources/instances/steve128.png new file mode 100644 index 00000000..a07cbd2f Binary files /dev/null and b/application/resources/instances/steve128.png differ diff --git a/application/resources/instances/stone.png b/application/resources/instances/stone.png new file mode 100644 index 00000000..34f9a751 Binary files /dev/null and b/application/resources/instances/stone.png differ diff --git a/application/resources/instances/tnt.png b/application/resources/instances/tnt.png new file mode 100644 index 00000000..e40d404d Binary files /dev/null and b/application/resources/instances/tnt.png differ diff --git a/application/resources/instances/updateavailable.png b/application/resources/instances/updateavailable.png new file mode 100644 index 00000000..754005f9 Binary files /dev/null and b/application/resources/instances/updateavailable.png differ diff --git a/application/resources/multimc.rc b/application/resources/multimc.rc new file mode 100644 index 00000000..e7340f2a --- /dev/null +++ b/application/resources/multimc.rc @@ -0,0 +1,29 @@ +#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/16x16/about.png b/application/resources/multimc/16x16/about.png new file mode 100644 index 00000000..a6a986e1 Binary files /dev/null and b/application/resources/multimc/16x16/about.png differ diff --git a/application/resources/multimc/16x16/bug.png b/application/resources/multimc/16x16/bug.png new file mode 100644 index 00000000..0c5b78b4 Binary files /dev/null and b/application/resources/multimc/16x16/bug.png differ diff --git a/application/resources/multimc/16x16/cat.png b/application/resources/multimc/16x16/cat.png new file mode 100644 index 00000000..e6e31b44 Binary files /dev/null and b/application/resources/multimc/16x16/cat.png differ diff --git a/application/resources/multimc/16x16/centralmods.png b/application/resources/multimc/16x16/centralmods.png new file mode 100644 index 00000000..c1b91c76 Binary files /dev/null and b/application/resources/multimc/16x16/centralmods.png differ diff --git a/application/resources/multimc/16x16/checkupdate.png b/application/resources/multimc/16x16/checkupdate.png new file mode 100644 index 00000000..f3742058 Binary files /dev/null and b/application/resources/multimc/16x16/checkupdate.png differ diff --git a/application/resources/multimc/16x16/copy.png b/application/resources/multimc/16x16/copy.png new file mode 100644 index 00000000..ccaed9e1 Binary files /dev/null and b/application/resources/multimc/16x16/copy.png differ diff --git a/application/resources/multimc/16x16/coremods.png b/application/resources/multimc/16x16/coremods.png new file mode 100644 index 00000000..af0f1166 Binary files /dev/null and b/application/resources/multimc/16x16/coremods.png differ diff --git a/application/resources/multimc/16x16/help.png b/application/resources/multimc/16x16/help.png new file mode 100644 index 00000000..e6edf6ba Binary files /dev/null and b/application/resources/multimc/16x16/help.png differ diff --git a/application/resources/multimc/16x16/instance-settings.png b/application/resources/multimc/16x16/instance-settings.png new file mode 100644 index 00000000..b916cd24 Binary files /dev/null and b/application/resources/multimc/16x16/instance-settings.png differ diff --git a/application/resources/multimc/16x16/jarmods.png b/application/resources/multimc/16x16/jarmods.png new file mode 100644 index 00000000..1a97c9c0 Binary files /dev/null and b/application/resources/multimc/16x16/jarmods.png differ diff --git a/application/resources/multimc/16x16/loadermods.png b/application/resources/multimc/16x16/loadermods.png new file mode 100644 index 00000000..b5ab3fce Binary files /dev/null and b/application/resources/multimc/16x16/loadermods.png differ diff --git a/application/resources/multimc/16x16/log.png b/application/resources/multimc/16x16/log.png new file mode 100644 index 00000000..efa2a0b5 Binary files /dev/null and b/application/resources/multimc/16x16/log.png differ diff --git a/application/resources/multimc/16x16/minecraft.png b/application/resources/multimc/16x16/minecraft.png new file mode 100644 index 00000000..e9f2f2a5 Binary files /dev/null and b/application/resources/multimc/16x16/minecraft.png differ diff --git a/application/resources/multimc/16x16/new.png b/application/resources/multimc/16x16/new.png new file mode 100644 index 00000000..2e56f589 Binary files /dev/null and b/application/resources/multimc/16x16/new.png differ diff --git a/application/resources/multimc/16x16/news.png b/application/resources/multimc/16x16/news.png new file mode 100644 index 00000000..872e85db Binary files /dev/null and b/application/resources/multimc/16x16/news.png differ diff --git a/application/resources/multimc/16x16/noaccount.png b/application/resources/multimc/16x16/noaccount.png new file mode 100644 index 00000000..b49bcf36 Binary files /dev/null and b/application/resources/multimc/16x16/noaccount.png differ diff --git a/application/resources/multimc/16x16/patreon.png b/application/resources/multimc/16x16/patreon.png new file mode 100644 index 00000000..cde2b326 Binary files /dev/null and b/application/resources/multimc/16x16/patreon.png differ diff --git a/application/resources/multimc/16x16/refresh.png b/application/resources/multimc/16x16/refresh.png new file mode 100644 index 00000000..86b6f82c Binary files /dev/null and b/application/resources/multimc/16x16/refresh.png differ diff --git a/application/resources/multimc/16x16/resourcepacks.png b/application/resources/multimc/16x16/resourcepacks.png new file mode 100644 index 00000000..d862f5ca Binary files /dev/null and b/application/resources/multimc/16x16/resourcepacks.png differ diff --git a/application/resources/multimc/16x16/screenshots.png b/application/resources/multimc/16x16/screenshots.png new file mode 100644 index 00000000..460000d4 Binary files /dev/null and b/application/resources/multimc/16x16/screenshots.png differ diff --git a/application/resources/multimc/16x16/settings.png b/application/resources/multimc/16x16/settings.png new file mode 100644 index 00000000..b916cd24 Binary files /dev/null and b/application/resources/multimc/16x16/settings.png differ diff --git a/application/resources/multimc/16x16/status-bad.png b/application/resources/multimc/16x16/status-bad.png new file mode 100644 index 00000000..5b3f2051 Binary files /dev/null and b/application/resources/multimc/16x16/status-bad.png differ diff --git a/application/resources/multimc/16x16/status-good.png b/application/resources/multimc/16x16/status-good.png new file mode 100644 index 00000000..5cbdee81 Binary files /dev/null and b/application/resources/multimc/16x16/status-good.png differ diff --git a/application/resources/multimc/16x16/status-yellow.png b/application/resources/multimc/16x16/status-yellow.png new file mode 100644 index 00000000..b25375d1 Binary files /dev/null and b/application/resources/multimc/16x16/status-yellow.png differ diff --git a/application/resources/multimc/16x16/viewfolder.png b/application/resources/multimc/16x16/viewfolder.png new file mode 100644 index 00000000..98b8a944 Binary files /dev/null and b/application/resources/multimc/16x16/viewfolder.png differ diff --git a/application/resources/multimc/22x22/about.png b/application/resources/multimc/22x22/about.png new file mode 100644 index 00000000..57775e25 Binary files /dev/null and b/application/resources/multimc/22x22/about.png differ diff --git a/application/resources/multimc/22x22/bug.png b/application/resources/multimc/22x22/bug.png new file mode 100644 index 00000000..90481bba Binary files /dev/null and b/application/resources/multimc/22x22/bug.png differ diff --git a/application/resources/multimc/22x22/cat.png b/application/resources/multimc/22x22/cat.png new file mode 100644 index 00000000..3ea7ba69 Binary files /dev/null and b/application/resources/multimc/22x22/cat.png differ diff --git a/application/resources/multimc/22x22/centralmods.png b/application/resources/multimc/22x22/centralmods.png new file mode 100644 index 00000000..a10f9a2b Binary files /dev/null and b/application/resources/multimc/22x22/centralmods.png differ diff --git a/application/resources/multimc/22x22/checkupdate.png b/application/resources/multimc/22x22/checkupdate.png new file mode 100644 index 00000000..badb200c Binary files /dev/null and b/application/resources/multimc/22x22/checkupdate.png differ diff --git a/application/resources/multimc/22x22/copy.png b/application/resources/multimc/22x22/copy.png new file mode 100644 index 00000000..ea236a24 Binary files /dev/null and b/application/resources/multimc/22x22/copy.png differ diff --git a/application/resources/multimc/22x22/help.png b/application/resources/multimc/22x22/help.png new file mode 100644 index 00000000..da79b3e3 Binary files /dev/null and b/application/resources/multimc/22x22/help.png differ diff --git a/application/resources/multimc/22x22/instance-settings.png b/application/resources/multimc/22x22/instance-settings.png new file mode 100644 index 00000000..daf56aad Binary files /dev/null and b/application/resources/multimc/22x22/instance-settings.png differ diff --git a/application/resources/multimc/22x22/new.png b/application/resources/multimc/22x22/new.png new file mode 100644 index 00000000..c707fbbf Binary files /dev/null and b/application/resources/multimc/22x22/new.png differ diff --git a/application/resources/multimc/22x22/news.png b/application/resources/multimc/22x22/news.png new file mode 100644 index 00000000..1953bf7b Binary files /dev/null and b/application/resources/multimc/22x22/news.png differ diff --git a/application/resources/multimc/22x22/patreon.png b/application/resources/multimc/22x22/patreon.png new file mode 100644 index 00000000..b6235ad2 Binary files /dev/null and b/application/resources/multimc/22x22/patreon.png differ diff --git a/application/resources/multimc/22x22/refresh.png b/application/resources/multimc/22x22/refresh.png new file mode 100644 index 00000000..45b5535c Binary files /dev/null and b/application/resources/multimc/22x22/refresh.png differ diff --git a/application/resources/multimc/22x22/screenshots.png b/application/resources/multimc/22x22/screenshots.png new file mode 100644 index 00000000..6fb42bbd Binary files /dev/null and b/application/resources/multimc/22x22/screenshots.png differ diff --git a/application/resources/multimc/22x22/settings.png b/application/resources/multimc/22x22/settings.png new file mode 100644 index 00000000..daf56aad Binary files /dev/null and b/application/resources/multimc/22x22/settings.png differ diff --git a/application/resources/multimc/22x22/status-bad.png b/application/resources/multimc/22x22/status-bad.png new file mode 100644 index 00000000..2707539e Binary files /dev/null and b/application/resources/multimc/22x22/status-bad.png differ diff --git a/application/resources/multimc/22x22/status-good.png b/application/resources/multimc/22x22/status-good.png new file mode 100644 index 00000000..f55debc3 Binary files /dev/null and b/application/resources/multimc/22x22/status-good.png differ diff --git a/application/resources/multimc/22x22/status-yellow.png b/application/resources/multimc/22x22/status-yellow.png new file mode 100644 index 00000000..481eb7f3 Binary files /dev/null and b/application/resources/multimc/22x22/status-yellow.png differ diff --git a/application/resources/multimc/22x22/viewfolder.png b/application/resources/multimc/22x22/viewfolder.png new file mode 100644 index 00000000..b645167f Binary files /dev/null and b/application/resources/multimc/22x22/viewfolder.png differ diff --git a/application/resources/multimc/24x24/cat.png b/application/resources/multimc/24x24/cat.png new file mode 100644 index 00000000..c93245f6 Binary files /dev/null and b/application/resources/multimc/24x24/cat.png differ diff --git a/application/resources/multimc/24x24/coremods.png b/application/resources/multimc/24x24/coremods.png new file mode 100644 index 00000000..90603d24 Binary files /dev/null and b/application/resources/multimc/24x24/coremods.png differ diff --git a/application/resources/multimc/24x24/jarmods.png b/application/resources/multimc/24x24/jarmods.png new file mode 100644 index 00000000..68cb8e9d Binary files /dev/null and b/application/resources/multimc/24x24/jarmods.png differ diff --git a/application/resources/multimc/24x24/loadermods.png b/application/resources/multimc/24x24/loadermods.png new file mode 100644 index 00000000..250a6260 Binary files /dev/null and b/application/resources/multimc/24x24/loadermods.png differ diff --git a/application/resources/multimc/24x24/log.png b/application/resources/multimc/24x24/log.png new file mode 100644 index 00000000..fe302053 Binary files /dev/null and b/application/resources/multimc/24x24/log.png differ diff --git a/application/resources/multimc/24x24/minecraft.png b/application/resources/multimc/24x24/minecraft.png new file mode 100644 index 00000000..b31177c9 Binary files /dev/null and b/application/resources/multimc/24x24/minecraft.png differ diff --git a/application/resources/multimc/24x24/noaccount.png b/application/resources/multimc/24x24/noaccount.png new file mode 100644 index 00000000..ac12437c Binary files /dev/null and b/application/resources/multimc/24x24/noaccount.png differ diff --git a/application/resources/multimc/24x24/patreon.png b/application/resources/multimc/24x24/patreon.png new file mode 100644 index 00000000..c1da080f Binary files /dev/null and b/application/resources/multimc/24x24/patreon.png differ diff --git a/application/resources/multimc/24x24/resourcepacks.png b/application/resources/multimc/24x24/resourcepacks.png new file mode 100644 index 00000000..68359d39 Binary files /dev/null and b/application/resources/multimc/24x24/resourcepacks.png differ diff --git a/application/resources/multimc/24x24/status-bad.png b/application/resources/multimc/24x24/status-bad.png new file mode 100644 index 00000000..d1547a47 Binary files /dev/null and b/application/resources/multimc/24x24/status-bad.png differ diff --git a/application/resources/multimc/24x24/status-good.png b/application/resources/multimc/24x24/status-good.png new file mode 100644 index 00000000..3545bc4c Binary files /dev/null and b/application/resources/multimc/24x24/status-good.png differ diff --git a/application/resources/multimc/24x24/status-yellow.png b/application/resources/multimc/24x24/status-yellow.png new file mode 100644 index 00000000..dd5fde67 Binary files /dev/null and b/application/resources/multimc/24x24/status-yellow.png differ diff --git a/application/resources/multimc/256x256/minecraft.png b/application/resources/multimc/256x256/minecraft.png new file mode 100644 index 00000000..77e3f03e Binary files /dev/null and b/application/resources/multimc/256x256/minecraft.png differ diff --git a/application/resources/multimc/32x32/about.png b/application/resources/multimc/32x32/about.png new file mode 100644 index 00000000..5174c4f1 Binary files /dev/null and b/application/resources/multimc/32x32/about.png differ diff --git a/application/resources/multimc/32x32/bug.png b/application/resources/multimc/32x32/bug.png new file mode 100644 index 00000000..ada46653 Binary files /dev/null and b/application/resources/multimc/32x32/bug.png differ diff --git a/application/resources/multimc/32x32/cat.png b/application/resources/multimc/32x32/cat.png new file mode 100644 index 00000000..78ff98e9 Binary files /dev/null and b/application/resources/multimc/32x32/cat.png differ diff --git a/application/resources/multimc/32x32/centralmods.png b/application/resources/multimc/32x32/centralmods.png new file mode 100644 index 00000000..cd2b8208 Binary files /dev/null and b/application/resources/multimc/32x32/centralmods.png differ diff --git a/application/resources/multimc/32x32/checkupdate.png b/application/resources/multimc/32x32/checkupdate.png new file mode 100644 index 00000000..754005f9 Binary files /dev/null and b/application/resources/multimc/32x32/checkupdate.png differ diff --git a/application/resources/multimc/32x32/copy.png b/application/resources/multimc/32x32/copy.png new file mode 100644 index 00000000..c137b0f1 Binary files /dev/null and b/application/resources/multimc/32x32/copy.png differ diff --git a/application/resources/multimc/32x32/coremods.png b/application/resources/multimc/32x32/coremods.png new file mode 100644 index 00000000..770d695e Binary files /dev/null and b/application/resources/multimc/32x32/coremods.png differ diff --git a/application/resources/multimc/32x32/help.png b/application/resources/multimc/32x32/help.png new file mode 100644 index 00000000..b3854278 Binary files /dev/null and b/application/resources/multimc/32x32/help.png differ diff --git a/application/resources/multimc/32x32/instance-settings.png b/application/resources/multimc/32x32/instance-settings.png new file mode 100644 index 00000000..a9c0817c Binary files /dev/null and b/application/resources/multimc/32x32/instance-settings.png differ diff --git a/application/resources/multimc/32x32/jarmods.png b/application/resources/multimc/32x32/jarmods.png new file mode 100644 index 00000000..5cda173a Binary files /dev/null and b/application/resources/multimc/32x32/jarmods.png differ diff --git a/application/resources/multimc/32x32/loadermods.png b/application/resources/multimc/32x32/loadermods.png new file mode 100644 index 00000000..c4ca12e2 Binary files /dev/null and b/application/resources/multimc/32x32/loadermods.png differ diff --git a/application/resources/multimc/32x32/log.png b/application/resources/multimc/32x32/log.png new file mode 100644 index 00000000..d620da12 Binary files /dev/null and b/application/resources/multimc/32x32/log.png differ diff --git a/application/resources/multimc/32x32/minecraft.png b/application/resources/multimc/32x32/minecraft.png new file mode 100644 index 00000000..816bec98 Binary files /dev/null and b/application/resources/multimc/32x32/minecraft.png differ diff --git a/application/resources/multimc/32x32/new.png b/application/resources/multimc/32x32/new.png new file mode 100644 index 00000000..a3555ba4 Binary files /dev/null and b/application/resources/multimc/32x32/new.png differ diff --git a/application/resources/multimc/32x32/news.png b/application/resources/multimc/32x32/news.png new file mode 100644 index 00000000..c579fd44 Binary files /dev/null and b/application/resources/multimc/32x32/news.png differ diff --git a/application/resources/multimc/32x32/noaccount.png b/application/resources/multimc/32x32/noaccount.png new file mode 100644 index 00000000..a73afc94 Binary files /dev/null and b/application/resources/multimc/32x32/noaccount.png differ diff --git a/application/resources/multimc/32x32/patreon.png b/application/resources/multimc/32x32/patreon.png new file mode 100644 index 00000000..f5ae8a5e Binary files /dev/null and b/application/resources/multimc/32x32/patreon.png differ diff --git a/application/resources/multimc/32x32/refresh.png b/application/resources/multimc/32x32/refresh.png new file mode 100644 index 00000000..afa2a9d7 Binary files /dev/null and b/application/resources/multimc/32x32/refresh.png differ diff --git a/application/resources/multimc/32x32/resourcepacks.png b/application/resources/multimc/32x32/resourcepacks.png new file mode 100644 index 00000000..c14759ef Binary files /dev/null and b/application/resources/multimc/32x32/resourcepacks.png differ diff --git a/application/resources/multimc/32x32/screenshots.png b/application/resources/multimc/32x32/screenshots.png new file mode 100644 index 00000000..4fcd6224 Binary files /dev/null and b/application/resources/multimc/32x32/screenshots.png differ diff --git a/application/resources/multimc/32x32/settings.png b/application/resources/multimc/32x32/settings.png new file mode 100644 index 00000000..a9c0817c Binary files /dev/null and b/application/resources/multimc/32x32/settings.png differ diff --git a/application/resources/multimc/32x32/status-bad.png b/application/resources/multimc/32x32/status-bad.png new file mode 100644 index 00000000..8c2c9d4f Binary files /dev/null and b/application/resources/multimc/32x32/status-bad.png differ diff --git a/application/resources/multimc/32x32/status-good.png b/application/resources/multimc/32x32/status-good.png new file mode 100644 index 00000000..1a805e68 Binary files /dev/null and b/application/resources/multimc/32x32/status-good.png differ diff --git a/application/resources/multimc/32x32/status-yellow.png b/application/resources/multimc/32x32/status-yellow.png new file mode 100644 index 00000000..42c68552 Binary files /dev/null and b/application/resources/multimc/32x32/status-yellow.png differ diff --git a/application/resources/multimc/32x32/viewfolder.png b/application/resources/multimc/32x32/viewfolder.png new file mode 100644 index 00000000..74ab8fa6 Binary files /dev/null and b/application/resources/multimc/32x32/viewfolder.png differ diff --git a/application/resources/multimc/48x48/about.png b/application/resources/multimc/48x48/about.png new file mode 100644 index 00000000..b4ac71b8 Binary files /dev/null and b/application/resources/multimc/48x48/about.png differ diff --git a/application/resources/multimc/48x48/bug.png b/application/resources/multimc/48x48/bug.png new file mode 100644 index 00000000..298f9397 Binary files /dev/null and b/application/resources/multimc/48x48/bug.png differ diff --git a/application/resources/multimc/48x48/cat.png b/application/resources/multimc/48x48/cat.png new file mode 100644 index 00000000..25912a3c Binary files /dev/null and b/application/resources/multimc/48x48/cat.png differ diff --git a/application/resources/multimc/48x48/centralmods.png b/application/resources/multimc/48x48/centralmods.png new file mode 100644 index 00000000..d927e39b Binary files /dev/null and b/application/resources/multimc/48x48/centralmods.png differ diff --git a/application/resources/multimc/48x48/checkupdate.png b/application/resources/multimc/48x48/checkupdate.png new file mode 100644 index 00000000..2e2c7d6b Binary files /dev/null and b/application/resources/multimc/48x48/checkupdate.png differ diff --git a/application/resources/multimc/48x48/copy.png b/application/resources/multimc/48x48/copy.png new file mode 100644 index 00000000..ea40e34b Binary files /dev/null and b/application/resources/multimc/48x48/copy.png differ diff --git a/application/resources/multimc/48x48/help.png b/application/resources/multimc/48x48/help.png new file mode 100644 index 00000000..82d828fa Binary files /dev/null and b/application/resources/multimc/48x48/help.png differ diff --git a/application/resources/multimc/48x48/instance-settings.png b/application/resources/multimc/48x48/instance-settings.png new file mode 100644 index 00000000..6674eb23 Binary files /dev/null and b/application/resources/multimc/48x48/instance-settings.png differ diff --git a/application/resources/multimc/48x48/log.png b/application/resources/multimc/48x48/log.png new file mode 100644 index 00000000..45f60e6b Binary files /dev/null and b/application/resources/multimc/48x48/log.png differ diff --git a/application/resources/multimc/48x48/minecraft.png b/application/resources/multimc/48x48/minecraft.png new file mode 100644 index 00000000..38fc9f6c Binary files /dev/null and b/application/resources/multimc/48x48/minecraft.png differ diff --git a/application/resources/multimc/48x48/new.png b/application/resources/multimc/48x48/new.png new file mode 100644 index 00000000..a81753b3 Binary files /dev/null and b/application/resources/multimc/48x48/new.png differ diff --git a/application/resources/multimc/48x48/news.png b/application/resources/multimc/48x48/news.png new file mode 100644 index 00000000..0f82d857 Binary files /dev/null and b/application/resources/multimc/48x48/news.png differ diff --git a/application/resources/multimc/48x48/noaccount.png b/application/resources/multimc/48x48/noaccount.png new file mode 100644 index 00000000..4703796c Binary files /dev/null and b/application/resources/multimc/48x48/noaccount.png differ diff --git a/application/resources/multimc/48x48/patreon.png b/application/resources/multimc/48x48/patreon.png new file mode 100644 index 00000000..2708a85a Binary files /dev/null and b/application/resources/multimc/48x48/patreon.png differ diff --git a/application/resources/multimc/48x48/refresh.png b/application/resources/multimc/48x48/refresh.png new file mode 100644 index 00000000..0b08b238 Binary files /dev/null and b/application/resources/multimc/48x48/refresh.png differ diff --git a/application/resources/multimc/48x48/screenshots.png b/application/resources/multimc/48x48/screenshots.png new file mode 100644 index 00000000..03c0059f Binary files /dev/null and b/application/resources/multimc/48x48/screenshots.png differ diff --git a/application/resources/multimc/48x48/settings.png b/application/resources/multimc/48x48/settings.png new file mode 100644 index 00000000..6674eb23 Binary files /dev/null and b/application/resources/multimc/48x48/settings.png differ diff --git a/application/resources/multimc/48x48/status-bad.png b/application/resources/multimc/48x48/status-bad.png new file mode 100644 index 00000000..41c9cf22 Binary files /dev/null and b/application/resources/multimc/48x48/status-bad.png differ diff --git a/application/resources/multimc/48x48/status-good.png b/application/resources/multimc/48x48/status-good.png new file mode 100644 index 00000000..df7cb59b Binary files /dev/null and b/application/resources/multimc/48x48/status-good.png differ diff --git a/application/resources/multimc/48x48/status-yellow.png b/application/resources/multimc/48x48/status-yellow.png new file mode 100644 index 00000000..4f3b11d6 Binary files /dev/null and b/application/resources/multimc/48x48/status-yellow.png differ diff --git a/application/resources/multimc/48x48/viewfolder.png b/application/resources/multimc/48x48/viewfolder.png new file mode 100644 index 00000000..0492a736 Binary files /dev/null and b/application/resources/multimc/48x48/viewfolder.png differ diff --git a/application/resources/multimc/64x64/about.png b/application/resources/multimc/64x64/about.png new file mode 100644 index 00000000..b83e9269 Binary files /dev/null and b/application/resources/multimc/64x64/about.png differ diff --git a/application/resources/multimc/64x64/bug.png b/application/resources/multimc/64x64/bug.png new file mode 100644 index 00000000..156b0315 Binary files /dev/null and b/application/resources/multimc/64x64/bug.png differ diff --git a/application/resources/multimc/64x64/cat.png b/application/resources/multimc/64x64/cat.png new file mode 100644 index 00000000..2cc21f80 Binary files /dev/null and b/application/resources/multimc/64x64/cat.png differ diff --git a/application/resources/multimc/64x64/centralmods.png b/application/resources/multimc/64x64/centralmods.png new file mode 100644 index 00000000..8831f437 Binary files /dev/null and b/application/resources/multimc/64x64/centralmods.png differ diff --git a/application/resources/multimc/64x64/checkupdate.png b/application/resources/multimc/64x64/checkupdate.png new file mode 100644 index 00000000..dd1e29ac Binary files /dev/null and b/application/resources/multimc/64x64/checkupdate.png differ diff --git a/application/resources/multimc/64x64/copy.png b/application/resources/multimc/64x64/copy.png new file mode 100644 index 00000000..d12cf9c8 Binary files /dev/null and b/application/resources/multimc/64x64/copy.png differ diff --git a/application/resources/multimc/64x64/coremods.png b/application/resources/multimc/64x64/coremods.png new file mode 100644 index 00000000..668be334 Binary files /dev/null and b/application/resources/multimc/64x64/coremods.png differ diff --git a/application/resources/multimc/64x64/help.png b/application/resources/multimc/64x64/help.png new file mode 100644 index 00000000..0f3948c2 Binary files /dev/null and b/application/resources/multimc/64x64/help.png differ diff --git a/application/resources/multimc/64x64/instance-settings.png b/application/resources/multimc/64x64/instance-settings.png new file mode 100644 index 00000000..e3ff58fa Binary files /dev/null and b/application/resources/multimc/64x64/instance-settings.png differ diff --git a/application/resources/multimc/64x64/jarmods.png b/application/resources/multimc/64x64/jarmods.png new file mode 100644 index 00000000..55d1a42a Binary files /dev/null and b/application/resources/multimc/64x64/jarmods.png differ diff --git a/application/resources/multimc/64x64/loadermods.png b/application/resources/multimc/64x64/loadermods.png new file mode 100644 index 00000000..24618fd0 Binary files /dev/null and b/application/resources/multimc/64x64/loadermods.png differ diff --git a/application/resources/multimc/64x64/log.png b/application/resources/multimc/64x64/log.png new file mode 100644 index 00000000..0f531cdf Binary files /dev/null and b/application/resources/multimc/64x64/log.png differ diff --git a/application/resources/multimc/64x64/new.png b/application/resources/multimc/64x64/new.png new file mode 100644 index 00000000..c3c6796c Binary files /dev/null and b/application/resources/multimc/64x64/new.png differ diff --git a/application/resources/multimc/64x64/news.png b/application/resources/multimc/64x64/news.png new file mode 100644 index 00000000..e306eed3 Binary files /dev/null and b/application/resources/multimc/64x64/news.png differ diff --git a/application/resources/multimc/64x64/patreon.png b/application/resources/multimc/64x64/patreon.png new file mode 100644 index 00000000..7b4814ec Binary files /dev/null and b/application/resources/multimc/64x64/patreon.png differ diff --git a/application/resources/multimc/64x64/refresh.png b/application/resources/multimc/64x64/refresh.png new file mode 100644 index 00000000..8373d819 Binary files /dev/null and b/application/resources/multimc/64x64/refresh.png differ diff --git a/application/resources/multimc/64x64/resourcepacks.png b/application/resources/multimc/64x64/resourcepacks.png new file mode 100644 index 00000000..fb874e7d Binary files /dev/null and b/application/resources/multimc/64x64/resourcepacks.png differ diff --git a/application/resources/multimc/64x64/screenshots.png b/application/resources/multimc/64x64/screenshots.png new file mode 100644 index 00000000..af18e39c Binary files /dev/null and b/application/resources/multimc/64x64/screenshots.png differ diff --git a/application/resources/multimc/64x64/settings.png b/application/resources/multimc/64x64/settings.png new file mode 100644 index 00000000..e3ff58fa Binary files /dev/null and b/application/resources/multimc/64x64/settings.png differ diff --git a/application/resources/multimc/64x64/status-bad.png b/application/resources/multimc/64x64/status-bad.png new file mode 100644 index 00000000..64060ba0 Binary files /dev/null and b/application/resources/multimc/64x64/status-bad.png differ diff --git a/application/resources/multimc/64x64/status-good.png b/application/resources/multimc/64x64/status-good.png new file mode 100644 index 00000000..e862ddcd Binary files /dev/null and b/application/resources/multimc/64x64/status-good.png differ diff --git a/application/resources/multimc/64x64/status-yellow.png b/application/resources/multimc/64x64/status-yellow.png new file mode 100644 index 00000000..3d54d320 Binary files /dev/null and b/application/resources/multimc/64x64/status-yellow.png differ diff --git a/application/resources/multimc/64x64/viewfolder.png b/application/resources/multimc/64x64/viewfolder.png new file mode 100644 index 00000000..7d531f9c Binary files /dev/null and b/application/resources/multimc/64x64/viewfolder.png differ diff --git a/application/resources/multimc/8x8/noaccount.png b/application/resources/multimc/8x8/noaccount.png new file mode 100644 index 00000000..466e4c07 Binary files /dev/null and b/application/resources/multimc/8x8/noaccount.png differ diff --git a/application/resources/multimc/index.theme b/application/resources/multimc/index.theme new file mode 100644 index 00000000..5f7d3f3f --- /dev/null +++ b/application/resources/multimc/index.theme @@ -0,0 +1,42 @@ +[Icon Theme] +Name=multimc +Comment=MultiMC Default Icons +Inherits=default +Directories=scalable/apps,8x8,16x16,22x22,24x24,32x32,48x48,scalable + +[scalable/apps] +Size=48 +Type=scalable +MinSize=1 +MaxSize=512 +Context=Applications + +[8x8] +Size=8 + +[16x16] +Size=16 + +[22x22] +Size=22 + +[24x24] +Size=24 + +[32x32] +Size=32 + +[48x48] +Size=48 + +[64x64] +Size=64 + +[256x256] +Size=256 + +[scalable] +Size=48 +Type=Scalable +MinSize=16 +MaxSize=256 diff --git a/application/resources/multimc/multimc.qrc b/application/resources/multimc/multimc.qrc new file mode 100644 index 00000000..d02d0e0e --- /dev/null +++ b/application/resources/multimc/multimc.qrc @@ -0,0 +1,206 @@ + + + + index.theme + + scalable/multimc.svg + + + scalable/console.svg + + + scalable/console_error.svg + + + scalable/proxy.svg + + + scalable/java.svg + + + 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 + + + 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/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 + + + 16x16/log.png + 24x24/log.png + 32x32/log.png + 48x48/log.png + 64x64/log.png + + + scalable/screenshot-placeholder.svg + + diff --git a/application/resources/multimc/scalable/bug.svg b/application/resources/multimc/scalable/bug.svg new file mode 100644 index 00000000..178e3c23 --- /dev/null +++ b/application/resources/multimc/scalable/bug.svg @@ -0,0 +1,387 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/multimc/scalable/centralmods.svg b/application/resources/multimc/scalable/centralmods.svg new file mode 100644 index 00000000..a8b123d0 --- /dev/null +++ b/application/resources/multimc/scalable/centralmods.svg @@ -0,0 +1,346 @@ + + + + + + + + + + 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 new file mode 100644 index 00000000..fc09cb4c --- /dev/null +++ b/application/resources/multimc/scalable/checkupdate.svg @@ -0,0 +1,167 @@ + + + + + + + + + + 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/console.svg b/application/resources/multimc/scalable/console.svg new file mode 100644 index 00000000..ec14ab68 --- /dev/null +++ b/application/resources/multimc/scalable/console.svg @@ -0,0 +1,228 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + MC + + + diff --git a/application/resources/multimc/scalable/console_error.svg b/application/resources/multimc/scalable/console_error.svg new file mode 100644 index 00000000..a71c6b35 --- /dev/null +++ b/application/resources/multimc/scalable/console_error.svg @@ -0,0 +1,247 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/multimc/scalable/java.svg b/application/resources/multimc/scalable/java.svg new file mode 100644 index 00000000..fd15e5c6 --- /dev/null +++ b/application/resources/multimc/scalable/java.svg @@ -0,0 +1,773 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/multimc/scalable/multimc.svg b/application/resources/multimc/scalable/multimc.svg new file mode 100644 index 00000000..178509ac --- /dev/null +++ b/application/resources/multimc/scalable/multimc.svg @@ -0,0 +1,1993 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/multimc/scalable/new.svg b/application/resources/multimc/scalable/new.svg new file mode 100644 index 00000000..c9cff358 --- /dev/null +++ b/application/resources/multimc/scalable/new.svg @@ -0,0 +1,127 @@ + + + + + + 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 new file mode 100644 index 00000000..67a370df --- /dev/null +++ b/application/resources/multimc/scalable/news.svg @@ -0,0 +1,296 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 new file mode 100644 index 00000000..55ee6f93 --- /dev/null +++ b/application/resources/multimc/scalable/proxy.svg @@ -0,0 +1,260 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/multimc/scalable/screenshot-placeholder.svg b/application/resources/multimc/scalable/screenshot-placeholder.svg new file mode 100644 index 00000000..a7a2a3d6 --- /dev/null +++ b/application/resources/multimc/scalable/screenshot-placeholder.svg @@ -0,0 +1,86 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/application/resources/multimc/scalable/screenshots.svg b/application/resources/multimc/scalable/screenshots.svg new file mode 100644 index 00000000..a3d4d8e2 --- /dev/null +++ b/application/resources/multimc/scalable/screenshots.svg @@ -0,0 +1,1231 @@ + + + + + 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 new file mode 100644 index 00000000..9f47307e --- /dev/null +++ b/application/resources/multimc/scalable/status-bad.svg @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/application/resources/multimc/scalable/status-good.svg b/application/resources/multimc/scalable/status-good.svg new file mode 100644 index 00000000..0a35c80f --- /dev/null +++ b/application/resources/multimc/scalable/status-good.svg @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/application/resources/multimc/scalable/status-yellow.svg b/application/resources/multimc/scalable/status-yellow.svg new file mode 100644 index 00000000..140e6082 --- /dev/null +++ b/application/resources/multimc/scalable/status-yellow.svg @@ -0,0 +1,155 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/multimc/scalable/viewfolder.svg b/application/resources/multimc/scalable/viewfolder.svg new file mode 100644 index 00000000..4ba0ed0a --- /dev/null +++ b/application/resources/multimc/scalable/viewfolder.svg @@ -0,0 +1,122 @@ + + + + + + + + + + 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 new file mode 100644 index 00000000..c9e0d93a --- /dev/null +++ b/application/resources/pe_blue/index.theme @@ -0,0 +1,11 @@ +[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 new file mode 100644 index 00000000..a4525d2e --- /dev/null +++ b/application/resources/pe_blue/pe_blue.qrc @@ -0,0 +1,35 @@ + + + + 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/instance-settings.svg + scalable/jarmods.svg + scalable/java.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 + + diff --git a/application/resources/pe_blue/scalable/about.svg b/application/resources/pe_blue/scalable/about.svg new file mode 100644 index 00000000..56e7fc9b --- /dev/null +++ b/application/resources/pe_blue/scalable/about.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff --git a/application/resources/pe_blue/scalable/accounts.svg b/application/resources/pe_blue/scalable/accounts.svg new file mode 100644 index 00000000..77e3f45a --- /dev/null +++ b/application/resources/pe_blue/scalable/accounts.svg @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_blue/scalable/bug.svg b/application/resources/pe_blue/scalable/bug.svg new file mode 100644 index 00000000..75a19e29 --- /dev/null +++ b/application/resources/pe_blue/scalable/bug.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_blue/scalable/centralmods.svg b/application/resources/pe_blue/scalable/centralmods.svg new file mode 100644 index 00000000..cda39b1f --- /dev/null +++ b/application/resources/pe_blue/scalable/centralmods.svg @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_blue/scalable/checkupdate.svg b/application/resources/pe_blue/scalable/checkupdate.svg new file mode 100644 index 00000000..a7d9ee81 --- /dev/null +++ b/application/resources/pe_blue/scalable/checkupdate.svg @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_blue/scalable/copy.svg b/application/resources/pe_blue/scalable/copy.svg new file mode 100644 index 00000000..7ce014ed --- /dev/null +++ b/application/resources/pe_blue/scalable/copy.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_blue/scalable/coremods.svg b/application/resources/pe_blue/scalable/coremods.svg new file mode 100644 index 00000000..4cc030d0 --- /dev/null +++ b/application/resources/pe_blue/scalable/coremods.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_blue/scalable/externaltools.svg b/application/resources/pe_blue/scalable/externaltools.svg new file mode 100644 index 00000000..45b73496 --- /dev/null +++ b/application/resources/pe_blue/scalable/externaltools.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_blue/scalable/instance-settings.svg b/application/resources/pe_blue/scalable/instance-settings.svg new file mode 100644 index 00000000..43f0b2f2 --- /dev/null +++ b/application/resources/pe_blue/scalable/instance-settings.svg @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_blue/scalable/jarmods.svg b/application/resources/pe_blue/scalable/jarmods.svg new file mode 100644 index 00000000..bb75f4b1 --- /dev/null +++ b/application/resources/pe_blue/scalable/jarmods.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + diff --git a/application/resources/pe_blue/scalable/java.svg b/application/resources/pe_blue/scalable/java.svg new file mode 100644 index 00000000..5e369203 --- /dev/null +++ b/application/resources/pe_blue/scalable/java.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_blue/scalable/loadermods.svg b/application/resources/pe_blue/scalable/loadermods.svg new file mode 100644 index 00000000..a54dc211 --- /dev/null +++ b/application/resources/pe_blue/scalable/loadermods.svg @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_blue/scalable/log.svg b/application/resources/pe_blue/scalable/log.svg new file mode 100644 index 00000000..89d373f4 --- /dev/null +++ b/application/resources/pe_blue/scalable/log.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_blue/scalable/minecraft.svg b/application/resources/pe_blue/scalable/minecraft.svg new file mode 100644 index 00000000..2fe6a028 --- /dev/null +++ b/application/resources/pe_blue/scalable/minecraft.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_blue/scalable/multimc.svg b/application/resources/pe_blue/scalable/multimc.svg new file mode 100644 index 00000000..820c0b53 --- /dev/null +++ b/application/resources/pe_blue/scalable/multimc.svg @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_blue/scalable/new.svg b/application/resources/pe_blue/scalable/new.svg new file mode 100644 index 00000000..dcc8579e --- /dev/null +++ b/application/resources/pe_blue/scalable/new.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_blue/scalable/news.svg b/application/resources/pe_blue/scalable/news.svg new file mode 100644 index 00000000..3ca3be37 --- /dev/null +++ b/application/resources/pe_blue/scalable/news.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/application/resources/pe_blue/scalable/notes.svg b/application/resources/pe_blue/scalable/notes.svg new file mode 100644 index 00000000..d0991259 --- /dev/null +++ b/application/resources/pe_blue/scalable/notes.svg @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_blue/scalable/patreon.svg b/application/resources/pe_blue/scalable/patreon.svg new file mode 100644 index 00000000..644b9b41 --- /dev/null +++ b/application/resources/pe_blue/scalable/patreon.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_blue/scalable/proxy.svg b/application/resources/pe_blue/scalable/proxy.svg new file mode 100644 index 00000000..8266f9b8 --- /dev/null +++ b/application/resources/pe_blue/scalable/proxy.svg @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_blue/scalable/quickmods.svg b/application/resources/pe_blue/scalable/quickmods.svg new file mode 100644 index 00000000..8b577376 --- /dev/null +++ b/application/resources/pe_blue/scalable/quickmods.svg @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_blue/scalable/refresh.svg b/application/resources/pe_blue/scalable/refresh.svg new file mode 100644 index 00000000..a3d2281d --- /dev/null +++ b/application/resources/pe_blue/scalable/refresh.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_blue/scalable/resourcepacks.svg b/application/resources/pe_blue/scalable/resourcepacks.svg new file mode 100644 index 00000000..a17e7e82 --- /dev/null +++ b/application/resources/pe_blue/scalable/resourcepacks.svg @@ -0,0 +1,13 @@ + + + + + + + diff --git a/application/resources/pe_blue/scalable/screenshots.svg b/application/resources/pe_blue/scalable/screenshots.svg new file mode 100644 index 00000000..1aa4e559 --- /dev/null +++ b/application/resources/pe_blue/scalable/screenshots.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_blue/scalable/settings.svg b/application/resources/pe_blue/scalable/settings.svg new file mode 100644 index 00000000..43f0b2f2 --- /dev/null +++ b/application/resources/pe_blue/scalable/settings.svg @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_blue/scalable/status-bad.svg b/application/resources/pe_blue/scalable/status-bad.svg new file mode 100644 index 00000000..4a48b5d8 --- /dev/null +++ b/application/resources/pe_blue/scalable/status-bad.svg @@ -0,0 +1,10 @@ + + + + + + + diff --git a/application/resources/pe_blue/scalable/status-good.svg b/application/resources/pe_blue/scalable/status-good.svg new file mode 100644 index 00000000..4cfa56f0 --- /dev/null +++ b/application/resources/pe_blue/scalable/status-good.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/application/resources/pe_blue/scalable/status-yellow.svg b/application/resources/pe_blue/scalable/status-yellow.svg new file mode 100644 index 00000000..0551fed2 --- /dev/null +++ b/application/resources/pe_blue/scalable/status-yellow.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff --git a/application/resources/pe_blue/scalable/viewfolder.svg b/application/resources/pe_blue/scalable/viewfolder.svg new file mode 100644 index 00000000..2634f8ff --- /dev/null +++ b/application/resources/pe_blue/scalable/viewfolder.svg @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_colored/index.theme b/application/resources/pe_colored/index.theme new file mode 100644 index 00000000..b757bbd7 --- /dev/null +++ b/application/resources/pe_colored/index.theme @@ -0,0 +1,11 @@ +[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 new file mode 100644 index 00000000..7de8d5ab --- /dev/null +++ b/application/resources/pe_colored/pe_colored.qrc @@ -0,0 +1,35 @@ + + + + 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/instance-settings.svg + scalable/jarmods.svg + scalable/java.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 + + diff --git a/application/resources/pe_colored/scalable/about.svg b/application/resources/pe_colored/scalable/about.svg new file mode 100644 index 00000000..95e99689 --- /dev/null +++ b/application/resources/pe_colored/scalable/about.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + diff --git a/application/resources/pe_colored/scalable/accounts.svg b/application/resources/pe_colored/scalable/accounts.svg new file mode 100644 index 00000000..301eb368 --- /dev/null +++ b/application/resources/pe_colored/scalable/accounts.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + diff --git a/application/resources/pe_colored/scalable/bug.svg b/application/resources/pe_colored/scalable/bug.svg new file mode 100644 index 00000000..8c92df0a --- /dev/null +++ b/application/resources/pe_colored/scalable/bug.svg @@ -0,0 +1,17 @@ + + + + + + + + + + diff --git a/application/resources/pe_colored/scalable/centralmods.svg b/application/resources/pe_colored/scalable/centralmods.svg new file mode 100644 index 00000000..57a97259 --- /dev/null +++ b/application/resources/pe_colored/scalable/centralmods.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + diff --git a/application/resources/pe_colored/scalable/checkupdate.svg b/application/resources/pe_colored/scalable/checkupdate.svg new file mode 100644 index 00000000..0adc8eeb --- /dev/null +++ b/application/resources/pe_colored/scalable/checkupdate.svg @@ -0,0 +1,13 @@ + + + + + + + + diff --git a/application/resources/pe_colored/scalable/copy.svg b/application/resources/pe_colored/scalable/copy.svg new file mode 100644 index 00000000..b9b0f1b1 --- /dev/null +++ b/application/resources/pe_colored/scalable/copy.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + diff --git a/application/resources/pe_colored/scalable/coremods.svg b/application/resources/pe_colored/scalable/coremods.svg new file mode 100644 index 00000000..ca7a22f0 --- /dev/null +++ b/application/resources/pe_colored/scalable/coremods.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/application/resources/pe_colored/scalable/externaltools.svg b/application/resources/pe_colored/scalable/externaltools.svg new file mode 100644 index 00000000..1469674f --- /dev/null +++ b/application/resources/pe_colored/scalable/externaltools.svg @@ -0,0 +1,13 @@ + + + + + + + + + + diff --git a/application/resources/pe_colored/scalable/instance-settings.svg b/application/resources/pe_colored/scalable/instance-settings.svg new file mode 100644 index 00000000..72032f8a --- /dev/null +++ b/application/resources/pe_colored/scalable/instance-settings.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_colored/scalable/jarmods.svg b/application/resources/pe_colored/scalable/jarmods.svg new file mode 100644 index 00000000..bb75f4b1 --- /dev/null +++ b/application/resources/pe_colored/scalable/jarmods.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + diff --git a/application/resources/pe_colored/scalable/java.svg b/application/resources/pe_colored/scalable/java.svg new file mode 100644 index 00000000..32c0225b --- /dev/null +++ b/application/resources/pe_colored/scalable/java.svg @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_colored/scalable/loadermods.svg b/application/resources/pe_colored/scalable/loadermods.svg new file mode 100644 index 00000000..2d80c7f3 --- /dev/null +++ b/application/resources/pe_colored/scalable/loadermods.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + diff --git a/application/resources/pe_colored/scalable/log.svg b/application/resources/pe_colored/scalable/log.svg new file mode 100644 index 00000000..42659b53 --- /dev/null +++ b/application/resources/pe_colored/scalable/log.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff --git a/application/resources/pe_colored/scalable/minecraft.svg b/application/resources/pe_colored/scalable/minecraft.svg new file mode 100644 index 00000000..52815487 --- /dev/null +++ b/application/resources/pe_colored/scalable/minecraft.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + diff --git a/application/resources/pe_colored/scalable/multimc.svg b/application/resources/pe_colored/scalable/multimc.svg new file mode 100644 index 00000000..a146c52e --- /dev/null +++ b/application/resources/pe_colored/scalable/multimc.svg @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_colored/scalable/new.svg b/application/resources/pe_colored/scalable/new.svg new file mode 100644 index 00000000..f18ed28a --- /dev/null +++ b/application/resources/pe_colored/scalable/new.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff --git a/application/resources/pe_colored/scalable/news.svg b/application/resources/pe_colored/scalable/news.svg new file mode 100644 index 00000000..4f924cd8 --- /dev/null +++ b/application/resources/pe_colored/scalable/news.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/application/resources/pe_colored/scalable/notes.svg b/application/resources/pe_colored/scalable/notes.svg new file mode 100644 index 00000000..55ece163 --- /dev/null +++ b/application/resources/pe_colored/scalable/notes.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_colored/scalable/patreon.svg b/application/resources/pe_colored/scalable/patreon.svg new file mode 100644 index 00000000..d3c6d2d5 --- /dev/null +++ b/application/resources/pe_colored/scalable/patreon.svg @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/application/resources/pe_colored/scalable/proxy.svg b/application/resources/pe_colored/scalable/proxy.svg new file mode 100644 index 00000000..0aee69b7 --- /dev/null +++ b/application/resources/pe_colored/scalable/proxy.svg @@ -0,0 +1,15 @@ + + + + + + + + + + diff --git a/application/resources/pe_colored/scalable/quickmods.svg b/application/resources/pe_colored/scalable/quickmods.svg new file mode 100644 index 00000000..199b2dae --- /dev/null +++ b/application/resources/pe_colored/scalable/quickmods.svg @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/application/resources/pe_colored/scalable/refresh.svg b/application/resources/pe_colored/scalable/refresh.svg new file mode 100644 index 00000000..c2e7e91f --- /dev/null +++ b/application/resources/pe_colored/scalable/refresh.svg @@ -0,0 +1,11 @@ + + + + + + + diff --git a/application/resources/pe_colored/scalable/resourcepacks.svg b/application/resources/pe_colored/scalable/resourcepacks.svg new file mode 100644 index 00000000..0318354c --- /dev/null +++ b/application/resources/pe_colored/scalable/resourcepacks.svg @@ -0,0 +1,15 @@ + + + + + + + + diff --git a/application/resources/pe_colored/scalable/screenshots.svg b/application/resources/pe_colored/scalable/screenshots.svg new file mode 100644 index 00000000..844fcbaa --- /dev/null +++ b/application/resources/pe_colored/scalable/screenshots.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/application/resources/pe_colored/scalable/settings.svg b/application/resources/pe_colored/scalable/settings.svg new file mode 100644 index 00000000..72032f8a --- /dev/null +++ b/application/resources/pe_colored/scalable/settings.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_colored/scalable/status-bad.svg b/application/resources/pe_colored/scalable/status-bad.svg new file mode 100644 index 00000000..bc42c248 --- /dev/null +++ b/application/resources/pe_colored/scalable/status-bad.svg @@ -0,0 +1,10 @@ + + + + + + + diff --git a/application/resources/pe_colored/scalable/status-good.svg b/application/resources/pe_colored/scalable/status-good.svg new file mode 100644 index 00000000..4cfa56f0 --- /dev/null +++ b/application/resources/pe_colored/scalable/status-good.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/application/resources/pe_colored/scalable/status-yellow.svg b/application/resources/pe_colored/scalable/status-yellow.svg new file mode 100644 index 00000000..0551fed2 --- /dev/null +++ b/application/resources/pe_colored/scalable/status-yellow.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff --git a/application/resources/pe_colored/scalable/viewfolder.svg b/application/resources/pe_colored/scalable/viewfolder.svg new file mode 100644 index 00000000..91832577 --- /dev/null +++ b/application/resources/pe_colored/scalable/viewfolder.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/application/resources/pe_dark/index.theme b/application/resources/pe_dark/index.theme new file mode 100644 index 00000000..b7d1ad01 --- /dev/null +++ b/application/resources/pe_dark/index.theme @@ -0,0 +1,11 @@ +[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 new file mode 100644 index 00000000..cafc2559 --- /dev/null +++ b/application/resources/pe_dark/pe_dark.qrc @@ -0,0 +1,35 @@ + + + + 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/instance-settings.svg + scalable/jarmods.svg + scalable/java.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 + + diff --git a/application/resources/pe_dark/scalable/about.svg b/application/resources/pe_dark/scalable/about.svg new file mode 100644 index 00000000..e75ea6ca --- /dev/null +++ b/application/resources/pe_dark/scalable/about.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + diff --git a/application/resources/pe_dark/scalable/accounts.svg b/application/resources/pe_dark/scalable/accounts.svg new file mode 100644 index 00000000..6d46b2df --- /dev/null +++ b/application/resources/pe_dark/scalable/accounts.svg @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_dark/scalable/bug.svg b/application/resources/pe_dark/scalable/bug.svg new file mode 100644 index 00000000..9da71adb --- /dev/null +++ b/application/resources/pe_dark/scalable/bug.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_dark/scalable/centralmods.svg b/application/resources/pe_dark/scalable/centralmods.svg new file mode 100644 index 00000000..f3b0c0e4 --- /dev/null +++ b/application/resources/pe_dark/scalable/centralmods.svg @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_dark/scalable/checkupdate.svg b/application/resources/pe_dark/scalable/checkupdate.svg new file mode 100644 index 00000000..97585447 --- /dev/null +++ b/application/resources/pe_dark/scalable/checkupdate.svg @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/application/resources/pe_dark/scalable/copy.svg b/application/resources/pe_dark/scalable/copy.svg new file mode 100644 index 00000000..8c30ac0b --- /dev/null +++ b/application/resources/pe_dark/scalable/copy.svg @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_dark/scalable/coremods.svg b/application/resources/pe_dark/scalable/coremods.svg new file mode 100644 index 00000000..1e2eb227 --- /dev/null +++ b/application/resources/pe_dark/scalable/coremods.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_dark/scalable/externaltools.svg b/application/resources/pe_dark/scalable/externaltools.svg new file mode 100644 index 00000000..29b45f26 --- /dev/null +++ b/application/resources/pe_dark/scalable/externaltools.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_dark/scalable/instance-settings.svg b/application/resources/pe_dark/scalable/instance-settings.svg new file mode 100644 index 00000000..c9f701e7 --- /dev/null +++ b/application/resources/pe_dark/scalable/instance-settings.svg @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_dark/scalable/jarmods.svg b/application/resources/pe_dark/scalable/jarmods.svg new file mode 100644 index 00000000..cb9a97ba --- /dev/null +++ b/application/resources/pe_dark/scalable/jarmods.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_dark/scalable/java.svg b/application/resources/pe_dark/scalable/java.svg new file mode 100644 index 00000000..9e1091fa --- /dev/null +++ b/application/resources/pe_dark/scalable/java.svg @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_dark/scalable/loadermods.svg b/application/resources/pe_dark/scalable/loadermods.svg new file mode 100644 index 00000000..24226a09 --- /dev/null +++ b/application/resources/pe_dark/scalable/loadermods.svg @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_dark/scalable/log.svg b/application/resources/pe_dark/scalable/log.svg new file mode 100644 index 00000000..68686a7d --- /dev/null +++ b/application/resources/pe_dark/scalable/log.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_dark/scalable/minecraft.svg b/application/resources/pe_dark/scalable/minecraft.svg new file mode 100644 index 00000000..01baf575 --- /dev/null +++ b/application/resources/pe_dark/scalable/minecraft.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_dark/scalable/multimc.svg b/application/resources/pe_dark/scalable/multimc.svg new file mode 100644 index 00000000..e4cf7b7f --- /dev/null +++ b/application/resources/pe_dark/scalable/multimc.svg @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_dark/scalable/new.svg b/application/resources/pe_dark/scalable/new.svg new file mode 100644 index 00000000..0377aceb --- /dev/null +++ b/application/resources/pe_dark/scalable/new.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_dark/scalable/news.svg b/application/resources/pe_dark/scalable/news.svg new file mode 100644 index 00000000..84979dcb --- /dev/null +++ b/application/resources/pe_dark/scalable/news.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/application/resources/pe_dark/scalable/notes.svg b/application/resources/pe_dark/scalable/notes.svg new file mode 100644 index 00000000..72649721 --- /dev/null +++ b/application/resources/pe_dark/scalable/notes.svg @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_dark/scalable/patreon.svg b/application/resources/pe_dark/scalable/patreon.svg new file mode 100644 index 00000000..01cb279a --- /dev/null +++ b/application/resources/pe_dark/scalable/patreon.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_dark/scalable/proxy.svg b/application/resources/pe_dark/scalable/proxy.svg new file mode 100644 index 00000000..98bcfac1 --- /dev/null +++ b/application/resources/pe_dark/scalable/proxy.svg @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_dark/scalable/quickmods.svg b/application/resources/pe_dark/scalable/quickmods.svg new file mode 100644 index 00000000..346729f1 --- /dev/null +++ b/application/resources/pe_dark/scalable/quickmods.svg @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_dark/scalable/refresh.svg b/application/resources/pe_dark/scalable/refresh.svg new file mode 100644 index 00000000..c227cd6c --- /dev/null +++ b/application/resources/pe_dark/scalable/refresh.svg @@ -0,0 +1,11 @@ + + + + + + + diff --git a/application/resources/pe_dark/scalable/resourcepacks.svg b/application/resources/pe_dark/scalable/resourcepacks.svg new file mode 100644 index 00000000..0db2beb1 --- /dev/null +++ b/application/resources/pe_dark/scalable/resourcepacks.svg @@ -0,0 +1,13 @@ + + + + + + + diff --git a/application/resources/pe_dark/scalable/screenshots.svg b/application/resources/pe_dark/scalable/screenshots.svg new file mode 100644 index 00000000..2803b9aa --- /dev/null +++ b/application/resources/pe_dark/scalable/screenshots.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_dark/scalable/settings.svg b/application/resources/pe_dark/scalable/settings.svg new file mode 100644 index 00000000..c9f701e7 --- /dev/null +++ b/application/resources/pe_dark/scalable/settings.svg @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_dark/scalable/status-bad.svg b/application/resources/pe_dark/scalable/status-bad.svg new file mode 100644 index 00000000..f455965a --- /dev/null +++ b/application/resources/pe_dark/scalable/status-bad.svg @@ -0,0 +1,10 @@ + + + + + + + diff --git a/application/resources/pe_dark/scalable/status-good.svg b/application/resources/pe_dark/scalable/status-good.svg new file mode 100644 index 00000000..4ba91f2d --- /dev/null +++ b/application/resources/pe_dark/scalable/status-good.svg @@ -0,0 +1,12 @@ + + + + + + + + + diff --git a/application/resources/pe_dark/scalable/status-yellow.svg b/application/resources/pe_dark/scalable/status-yellow.svg new file mode 100644 index 00000000..69133817 --- /dev/null +++ b/application/resources/pe_dark/scalable/status-yellow.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff --git a/application/resources/pe_dark/scalable/viewfolder.svg b/application/resources/pe_dark/scalable/viewfolder.svg new file mode 100644 index 00000000..3af36240 --- /dev/null +++ b/application/resources/pe_dark/scalable/viewfolder.svg @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_light/index.theme b/application/resources/pe_light/index.theme new file mode 100644 index 00000000..c106acc8 --- /dev/null +++ b/application/resources/pe_light/index.theme @@ -0,0 +1,11 @@ +[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 new file mode 100644 index 00000000..53d0890b --- /dev/null +++ b/application/resources/pe_light/pe_light.qrc @@ -0,0 +1,36 @@ + + + + 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/instance-settings.svg + scalable/jarmods.svg + scalable/java.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 + + + diff --git a/application/resources/pe_light/scalable/about.svg b/application/resources/pe_light/scalable/about.svg new file mode 100644 index 00000000..8d00c32e --- /dev/null +++ b/application/resources/pe_light/scalable/about.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + diff --git a/application/resources/pe_light/scalable/accounts.svg b/application/resources/pe_light/scalable/accounts.svg new file mode 100644 index 00000000..3a092d03 --- /dev/null +++ b/application/resources/pe_light/scalable/accounts.svg @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_light/scalable/bug.svg b/application/resources/pe_light/scalable/bug.svg new file mode 100644 index 00000000..ccb64bc5 --- /dev/null +++ b/application/resources/pe_light/scalable/bug.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_light/scalable/centralmods.svg b/application/resources/pe_light/scalable/centralmods.svg new file mode 100644 index 00000000..050fdc58 --- /dev/null +++ b/application/resources/pe_light/scalable/centralmods.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_light/scalable/checkupdate.svg b/application/resources/pe_light/scalable/checkupdate.svg new file mode 100644 index 00000000..08b8dcd5 --- /dev/null +++ b/application/resources/pe_light/scalable/checkupdate.svg @@ -0,0 +1,13 @@ + + + + + + + + diff --git a/application/resources/pe_light/scalable/copy.svg b/application/resources/pe_light/scalable/copy.svg new file mode 100644 index 00000000..abdcce09 --- /dev/null +++ b/application/resources/pe_light/scalable/copy.svg @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_light/scalable/coremods.svg b/application/resources/pe_light/scalable/coremods.svg new file mode 100644 index 00000000..c8fb0eb9 --- /dev/null +++ b/application/resources/pe_light/scalable/coremods.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_light/scalable/externaltools.svg b/application/resources/pe_light/scalable/externaltools.svg new file mode 100644 index 00000000..4d232bcf --- /dev/null +++ b/application/resources/pe_light/scalable/externaltools.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_light/scalable/instance-settings.svg b/application/resources/pe_light/scalable/instance-settings.svg new file mode 100644 index 00000000..83b92a52 --- /dev/null +++ b/application/resources/pe_light/scalable/instance-settings.svg @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_light/scalable/jarmods.svg b/application/resources/pe_light/scalable/jarmods.svg new file mode 100644 index 00000000..9852c805 --- /dev/null +++ b/application/resources/pe_light/scalable/jarmods.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_light/scalable/java.svg b/application/resources/pe_light/scalable/java.svg new file mode 100644 index 00000000..0584058a --- /dev/null +++ b/application/resources/pe_light/scalable/java.svg @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_light/scalable/loadermods.svg b/application/resources/pe_light/scalable/loadermods.svg new file mode 100644 index 00000000..913c1968 --- /dev/null +++ b/application/resources/pe_light/scalable/loadermods.svg @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_light/scalable/log.svg b/application/resources/pe_light/scalable/log.svg new file mode 100644 index 00000000..82282ca4 --- /dev/null +++ b/application/resources/pe_light/scalable/log.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_light/scalable/minecraft.svg b/application/resources/pe_light/scalable/minecraft.svg new file mode 100644 index 00000000..d772111f --- /dev/null +++ b/application/resources/pe_light/scalable/minecraft.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_light/scalable/multimc.svg b/application/resources/pe_light/scalable/multimc.svg new file mode 100644 index 00000000..8b2cb631 --- /dev/null +++ b/application/resources/pe_light/scalable/multimc.svg @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_light/scalable/new.svg b/application/resources/pe_light/scalable/new.svg new file mode 100644 index 00000000..96fd1f5b --- /dev/null +++ b/application/resources/pe_light/scalable/new.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_light/scalable/news.svg b/application/resources/pe_light/scalable/news.svg new file mode 100644 index 00000000..6f184afc --- /dev/null +++ b/application/resources/pe_light/scalable/news.svg @@ -0,0 +1,12 @@ + + + + + + + + + + diff --git a/application/resources/pe_light/scalable/notes.svg b/application/resources/pe_light/scalable/notes.svg new file mode 100644 index 00000000..02dc11ec --- /dev/null +++ b/application/resources/pe_light/scalable/notes.svg @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_light/scalable/patreon.svg b/application/resources/pe_light/scalable/patreon.svg new file mode 100644 index 00000000..0bd08826 --- /dev/null +++ b/application/resources/pe_light/scalable/patreon.svg @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_light/scalable/proxy.svg b/application/resources/pe_light/scalable/proxy.svg new file mode 100644 index 00000000..9de8d6d1 --- /dev/null +++ b/application/resources/pe_light/scalable/proxy.svg @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_light/scalable/quickmods.svg b/application/resources/pe_light/scalable/quickmods.svg new file mode 100644 index 00000000..6dbeab52 --- /dev/null +++ b/application/resources/pe_light/scalable/quickmods.svg @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_light/scalable/refresh.svg b/application/resources/pe_light/scalable/refresh.svg new file mode 100644 index 00000000..9a724d91 --- /dev/null +++ b/application/resources/pe_light/scalable/refresh.svg @@ -0,0 +1,11 @@ + + + + + + + diff --git a/application/resources/pe_light/scalable/resourcepacks.svg b/application/resources/pe_light/scalable/resourcepacks.svg new file mode 100644 index 00000000..7d6323f2 --- /dev/null +++ b/application/resources/pe_light/scalable/resourcepacks.svg @@ -0,0 +1,13 @@ + + + + + + + diff --git a/application/resources/pe_light/scalable/screenshots.svg b/application/resources/pe_light/scalable/screenshots.svg new file mode 100644 index 00000000..f2887be6 --- /dev/null +++ b/application/resources/pe_light/scalable/screenshots.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_light/scalable/settings.svg b/application/resources/pe_light/scalable/settings.svg new file mode 100644 index 00000000..83b92a52 --- /dev/null +++ b/application/resources/pe_light/scalable/settings.svg @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/pe_light/scalable/status-bad.svg b/application/resources/pe_light/scalable/status-bad.svg new file mode 100644 index 00000000..2c24970c --- /dev/null +++ b/application/resources/pe_light/scalable/status-bad.svg @@ -0,0 +1,10 @@ + + + + + + + diff --git a/application/resources/pe_light/scalable/status-good.svg b/application/resources/pe_light/scalable/status-good.svg new file mode 100644 index 00000000..bf9a4174 --- /dev/null +++ b/application/resources/pe_light/scalable/status-good.svg @@ -0,0 +1,12 @@ + + + + + + + + + diff --git a/application/resources/pe_light/scalable/status-yellow.svg b/application/resources/pe_light/scalable/status-yellow.svg new file mode 100644 index 00000000..f7d2236b --- /dev/null +++ b/application/resources/pe_light/scalable/status-yellow.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff --git a/application/resources/pe_light/scalable/viewfolder.svg b/application/resources/pe_light/scalable/viewfolder.svg new file mode 100644 index 00000000..b36343fe --- /dev/null +++ b/application/resources/pe_light/scalable/viewfolder.svg @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/sources/clucker.svg b/application/resources/sources/clucker.svg new file mode 100644 index 00000000..0c1727eb --- /dev/null +++ b/application/resources/sources/clucker.svg @@ -0,0 +1,404 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/sources/creeper.svg b/application/resources/sources/creeper.svg new file mode 100644 index 00000000..2a2e39b6 --- /dev/null +++ b/application/resources/sources/creeper.svg @@ -0,0 +1,775 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/sources/enderpearl.svg b/application/resources/sources/enderpearl.svg new file mode 100644 index 00000000..ac9378f5 --- /dev/null +++ b/application/resources/sources/enderpearl.svg @@ -0,0 +1,271 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/application/resources/sources/ftb-glow.svg b/application/resources/sources/ftb-glow.svg new file mode 100644 index 00000000..be78c78e --- /dev/null +++ b/application/resources/sources/ftb-glow.svg @@ -0,0 +1,606 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/sources/ftb-logo.svg b/application/resources/sources/ftb-logo.svg new file mode 100644 index 00000000..8cf73567 --- /dev/null +++ b/application/resources/sources/ftb-logo.svg @@ -0,0 +1,257 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/sources/gear.svg b/application/resources/sources/gear.svg new file mode 100644 index 00000000..c0169aec --- /dev/null +++ b/application/resources/sources/gear.svg @@ -0,0 +1,434 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/application/resources/sources/herobrine.svg b/application/resources/sources/herobrine.svg new file mode 100644 index 00000000..7392ba36 --- /dev/null +++ b/application/resources/sources/herobrine.svg @@ -0,0 +1,583 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/sources/magitech.svg b/application/resources/sources/magitech.svg new file mode 100644 index 00000000..c6dd6bc0 --- /dev/null +++ b/application/resources/sources/magitech.svg @@ -0,0 +1,886 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/sources/meat.svg b/application/resources/sources/meat.svg new file mode 100644 index 00000000..69a20073 --- /dev/null +++ b/application/resources/sources/meat.svg @@ -0,0 +1,371 @@ + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/sources/netherstar.svg b/application/resources/sources/netherstar.svg new file mode 100644 index 00000000..4046e4ec --- /dev/null +++ b/application/resources/sources/netherstar.svg @@ -0,0 +1,342 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/sources/pskeleton.svg b/application/resources/sources/pskeleton.svg new file mode 100644 index 00000000..c2783df8 --- /dev/null +++ b/application/resources/sources/pskeleton.svg @@ -0,0 +1,581 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/sources/skeleton.svg b/application/resources/sources/skeleton.svg new file mode 100644 index 00000000..5d55f272 --- /dev/null +++ b/application/resources/sources/skeleton.svg @@ -0,0 +1,610 @@ + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/sources/squarecreeper.svg b/application/resources/sources/squarecreeper.svg new file mode 100644 index 00000000..a1b0f4d1 --- /dev/null +++ b/application/resources/sources/squarecreeper.svg @@ -0,0 +1,828 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/sources/steve.svg b/application/resources/sources/steve.svg new file mode 100644 index 00000000..2233272c --- /dev/null +++ b/application/resources/sources/steve.svg @@ -0,0 +1,534 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/resources/versions/LWJGL/2.9.0.json b/application/resources/versions/LWJGL/2.9.0.json new file mode 100644 index 00000000..5dbd624e --- /dev/null +++ b/application/resources/versions/LWJGL/2.9.0.json @@ -0,0 +1,45 @@ + { + "fileId": "org.lwjgl", + "name": "LWJGL", + "version": "2.9.0", + "+libraries": [ + { + "name": "net.java.jinput:jinput:2.0.5" + }, + { + "name": "net.java.jinput:jinput-platform:2.0.5", + "natives": { + "linux": "natives-linux", + "windows": "natives-windows", + "osx": "natives-osx" + }, + "extract": { + "exclude": [ + "META-INF/" + ] + } + }, + { + "name": "net.java.jutils:jutils:1.0.0" + }, + { + "name": "org.lwjgl.lwjgl:lwjgl:2.9.0" + }, + { + "name": "org.lwjgl.lwjgl:lwjgl_util:2.9.0" + }, + { + "name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.0", + "natives": { + "linux": "natives-linux", + "windows": "natives-windows", + "osx": "natives-osx" + }, + "extract": { + "exclude": [ + "META-INF/" + ] + } + } + ] +} diff --git a/application/resources/versions/LWJGL/2.9.1-nightly-20130708-debug3.json b/application/resources/versions/LWJGL/2.9.1-nightly-20130708-debug3.json new file mode 100644 index 00000000..7265b3b0 --- /dev/null +++ b/application/resources/versions/LWJGL/2.9.1-nightly-20130708-debug3.json @@ -0,0 +1,45 @@ +{ + "fileId": "org.lwjgl", + "name": "LWJGL", + "version": "2.9.1-nightly-20130708-debug3", + "+libraries": [ + { + "name": "net.java.jinput:jinput:2.0.5" + }, + { + "name": "net.java.jinput:jinput-platform:2.0.5", + "natives": { + "linux": "natives-linux", + "windows": "natives-windows", + "osx": "natives-osx" + }, + "extract": { + "exclude": [ + "META-INF/" + ] + } + }, + { + "name": "net.java.jutils:jutils:1.0.0" + }, + { + "name": "org.lwjgl.lwjgl:lwjgl:2.9.1-nightly-20130708-debug3" + }, + { + "name": "org.lwjgl.lwjgl:lwjgl_util:2.9.1-nightly-20130708-debug3" + }, + { + "name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.1-nightly-20130708-debug3", + "natives": { + "linux": "natives-linux", + "windows": "natives-windows", + "osx": "natives-osx" + }, + "extract": { + "exclude": [ + "META-INF/" + ] + } + } + ] +} diff --git a/application/resources/versions/LWJGL/2.9.1.json b/application/resources/versions/LWJGL/2.9.1.json new file mode 100644 index 00000000..e7f5e947 --- /dev/null +++ b/application/resources/versions/LWJGL/2.9.1.json @@ -0,0 +1,45 @@ + { + "fileId": "org.lwjgl", + "name": "LWJGL", + "version": "2.9.1", + "+libraries": [ + { + "name": "net.java.jinput:jinput:2.0.5" + }, + { + "name": "net.java.jinput:jinput-platform:2.0.5", + "natives": { + "linux": "natives-linux", + "windows": "natives-windows", + "osx": "natives-osx" + }, + "extract": { + "exclude": [ + "META-INF/" + ] + } + }, + { + "name": "net.java.jutils:jutils:1.0.0" + }, + { + "name": "org.lwjgl.lwjgl:lwjgl:2.9.1" + }, + { + "name": "org.lwjgl.lwjgl:lwjgl_util:2.9.1" + }, + { + "name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.1", + "natives": { + "linux": "natives-linux", + "windows": "natives-windows", + "osx": "natives-osx" + }, + "extract": { + "exclude": [ + "META-INF/" + ] + } + } + ] +} diff --git a/application/resources/versions/LWJGL/2.9.2-nightly-20140822.json b/application/resources/versions/LWJGL/2.9.2-nightly-20140822.json new file mode 100644 index 00000000..25b22eb9 --- /dev/null +++ b/application/resources/versions/LWJGL/2.9.2-nightly-20140822.json @@ -0,0 +1,45 @@ +{ + "fileId": "org.lwjgl", + "name": "LWJGL", + "version": "2.9.2-nightly-20140822", + "+libraries": [ + { + "name": "net.java.jinput:jinput:2.0.5" + }, + { + "name": "net.java.jinput:jinput-platform:2.0.5", + "natives": { + "linux": "natives-linux", + "windows": "natives-windows", + "osx": "natives-osx" + }, + "extract": { + "exclude": [ + "META-INF/" + ] + } + }, + { + "name": "net.java.jutils:jutils:1.0.0" + }, + { + "name": "org.lwjgl.lwjgl:lwjgl:2.9.2-nightly-20140822" + }, + { + "name": "org.lwjgl.lwjgl:lwjgl_util:2.9.2-nightly-20140822" + }, + { + "name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.2-nightly-20140822", + "natives": { + "linux": "natives-linux", + "windows": "natives-windows", + "osx": "natives-osx" + }, + "extract": { + "exclude": [ + "META-INF/" + ] + } + } + ] +} diff --git a/application/resources/versions/minecraft.json b/application/resources/versions/minecraft.json new file mode 100644 index 00000000..58b153c2 --- /dev/null +++ b/application/resources/versions/minecraft.json @@ -0,0 +1,668 @@ +{ +"versions": [ + { + "id": "1.5.2", + "checksum": "6897c3287fb971c9f362eb3ab20f5ddd", + "releaseTime": "2013-04-25T17:45:00+02:00", + "type": "release", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "1.5.1", + "checksum": "5c1219d869b87d233de3033688ec7567", + "releaseTime": "2013-03-20T12:00:00+02:00", + "type": "release", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "1.5", + "checksum": "fd11cbc5b01aae1d62cff0145171f3d9", + "releaseTime": "2013-03-07T00:00:00+02:00", + "type": "snapshot", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "1.4.7", + "checksum": "8e80fb01b321c6b3c7efca397a3eea35", + "releaseTime": "2012-12-28T00:00:00+02:00", + "type": "release", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "1.4.6", + "checksum": "48677dc4c2b98c29918722b5ab27b4fd", + "releaseTime": "2012-12-20T00:00:00+02:00", + "type": "release", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "1.4.5", + "checksum": "b15e2b2b6b4629f0d99a95b6b44412a0", + "releaseTime": "2012-11-20T00:00:00+02:00", + "type": "release", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "1.4.4", + "checksum": "7aa46c8058cba2f38e9d2ddddcc77c72", + "releaseTime": "2012-11-14T00:00:00+02:00", + "type": "release", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "1.4.3", + "checksum": "9cc3295931edb6339f22989fe1b612a6", + "releaseTime": "2012-11-01T00:00:00+02:00", + "type": "snapshot", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "1.4.2", + "checksum": "771175c01778ea67395bc6919a5a9dc5", + "releaseTime": "2012-10-25T00:00:00+02:00", + "type": "release", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "1.4.1", + "checksum": "542621a5298659dc65f383f35170fc4c", + "releaseTime": "2012-10-23T00:00:00+02:00", + "type": "snapshot", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "1.4", + "checksum": "32a654388b54d3e4bb29c1a46e7d6a12", + "releaseTime": "2012-10-19T00:00:00+02:00", + "type": "snapshot", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "1.3.2", + "checksum": "969699f13e5bbe7f12e40ac4f32b7d9a", + "releaseTime": "2012-08-16T00:00:00+02:00", + "type": "release", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "1.3.1", + "checksum": "266ccbc9798afd2eadf3d6c01b4c562a", + "releaseTime": "2012-08-01T00:00:00+02:00", + "type": "release", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "1.3", + "checksum": "a6effac1eaccf5d429aae340cf95ed5d", + "releaseTime": "2012-07-26T00:00:00+02:00", + "type": "snapshot", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "1.2.5", + "checksum": "8e8778078a175a33603a585257f28563", + "releaseTime": "2012-03-30T00:00:00+02:00", + "type": "release", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "1.2.4", + "checksum": "25423eab6d8707f96cc6ad8a21a7250a", + "releaseTime": "2012-03-22T00:00:00+02:00", + "type": "release", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "1.2.3", + "checksum": "12f6c4b1bdcc63f029e3c088a364b8e4", + "releaseTime": "2012-03-02T00:00:00+02:00", + "type": "release", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "1.2.2", + "checksum": "6189e96efaea11e5164b4a4755574324", + "releaseTime": "2012-03-01T00:00:01+02:00", + "type": "release", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "1.2.1", + "checksum": "97067a603eba2b6eb75d3194f81f6bcd", + "releaseTime": "2012-03-01T00:00:00+02:00", + "type": "release", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "1.1", + "checksum": "e92302d2acdba7c97e0d8df1e10d2006", + "releaseTime": "2012-01-12T00:00:00+02:00", + "type": "release", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "1.0", + "checksum": "3820d222b95d0b8c520d9596a756a6e6", + "releaseTime": "2011-11-18T00:00:00+02:00", + "type": "release", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "b1.8.1", + "checksum": "f8c5a2ccd3bc996792bbe436d8cc08bc", + "releaseTime": "2011-09-19T00:00:00+02:00", + "type": "old_beta", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "b1.8", + "checksum": "a59a9fd4c726a573b0a2bdd10d857f59", + "releaseTime": "2011-09-15T00:00:00+02:00", + "type": "old_beta", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "b1.7.3", + "checksum": "eae3353fdaa7e10a59b4cb5b45bfa10d", + "releaseTime": "2011-07-08T00:00:00+02:00", + "type": "old_beta", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "b1.7.2", + "checksum": "dd9215ab1141170d4871f42bff4ab302", + "releaseTime": "2011-07-01T00:00:00+02:00", + "type": "old_beta", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "b1.7", + "checksum": "682419e9ed1a236c3067822d53cda1e4", + "releaseTime": "2011-06-30T00:00:00+02:00", + "type": "old_beta", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "b1.6.6", + "checksum": "ce80072464433cd5b05d505aa8ff29d1", + "releaseTime": "2011-05-31T00:00:00+02:00", + "type": "old_beta", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "b1.6.5", + "checksum": "2aba888864b32038c8d22ee5df71b7c8", + "releaseTime": "2011-05-28T00:00:00+02:00", + "type": "old_beta", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "b1.6.4", + "checksum": "5c4df6f120336f113180698613853dba", + "releaseTime": "2011-05-26T00:00:04+02:00", + "type": "old_beta", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "b1.6.3", + "checksum": "efc2becca965e4f8feb5b4210c6a4fd1", + "releaseTime": "2011-05-26T00:00:03+02:00", + "type": "old_beta", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "b1.6.2", + "checksum": "01330b1c930102a683a4dd8d792e632e", + "releaseTime": "2011-05-26T00:00:02+02:00", + "type": "old_beta", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "b1.6.1", + "checksum": "a7e82c441a57ef4068c533f4d777336a", + "releaseTime": "2011-05-26T00:00:01+02:00", + "type": "old_beta", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "b1.6", + "checksum": "d531e221227a65392259d3141893280d", + "releaseTime": "2011-05-26T00:00:00+02:00", + "type": "old_beta", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "b1.5_01", + "checksum": "d02fa9998e30693d8d989d5f88cf0040", + "releaseTime": "2011-04-20T00:00:00+02:00", + "type": "old_beta", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "b1.5", + "checksum": "24289130902822d73f8722b52bc07cdb", + "releaseTime": "2011-04-19T00:00:00+02:00", + "type": "old_beta", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "b1.4_01", + "checksum": "9379e54b581ba4ef3acc3e326e87db91", + "releaseTime": "2011-04-05T00:00:00+02:00", + "type": "old_beta", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "b1.4", + "checksum": "71e64b61175b371ed148b385f2d14ebf", + "releaseTime": "2011-03-31T00:00:00+02:00", + "type": "old_beta", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "b1.3_01", + "checksum": "4203826f35e1036f089919032c3d19d1", + "releaseTime": "2011-02-23T00:00:00+02:00", + "type": "old_beta", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "b1.3b", + "checksum": "de2164df461d028229ed2e101181bbd4", + "releaseTime": "2011-02-22T00:00:00+02:00", + "type": "old_beta", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "b1.2_02", + "checksum": "1736c5ba4f63a981220c2a18a4120180", + "releaseTime": "2011-01-21T00:00:00+02:00", + "type": "old_beta", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "b1.2_01", + "checksum": "486d83ec00554b45ffa21af2faa0116a", + "releaseTime": "2011-01-14T00:00:00+02:00", + "type": "old_beta", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "b1.2", + "checksum": "6426223efe23c3931a4ef89685be3349", + "releaseTime": "2011-01-13T00:00:00+02:00", + "type": "old_beta", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "b1.1_02", + "checksum": "7d547e495a770c62054ef136add43034", + "releaseTime": "2010-12-22T00:00:01+02:00", + "type": "old_beta", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "b1.1_01", + "checksum": "1f9331f2bfca81b6ce2acdfc1f105837", + "releaseTime": "2010-12-22T00:00:00+02:00", + "type": "old_beta", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "b1.0.2", + "checksum": "d200c465b8c167cc8df6537531fc9a48", + "releaseTime": "2010-12-21T00:00:00+02:00", + "type": "old_beta", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "b1.0_01", + "checksum": "03bd20b870dbbd121de5dca98af4e1ce", + "releaseTime": "2010-12-20T00:00:01+02:00", + "type": "old_beta", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "b1.0", + "checksum": "5f8733dbbf09b4e7c874661a3c29c239", + "releaseTime": "2010-12-20T00:00:00+02:00", + "type": "old_beta", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "a1.2.6", + "checksum": "ddd5e39467f28d1ea1a03b4d9e790867", + "releaseTime": "2010-12-03T00:00:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "a1.2.5", + "checksum": "7d3a43037190970ff2e11153b5718b74", + "releaseTime": "2010-12-01T00:00:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "a1.2.4_01", + "checksum": "0a1cc8c668faa6dc93fc418e8b4b097a", + "releaseTime": "2010-11-30T00:00:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "a1.2.3_04", + "checksum": "b2c25a753c82a1cd228ce71469829dc1", + "releaseTime": "2010-11-26T00:00:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "a1.2.3_02", + "checksum": "3ad4808ef2ac3b65d10305315260da03", + "releaseTime": "2010-11-25T00:00:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "a1.2.3_01", + "checksum": "70cbab762b17c5b11fefea9b12564119", + "releaseTime": "2010-11-24T00:00:01+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "a1.2.3", + "checksum": "25f053114e34b915e675f82d58f08711", + "releaseTime": "2010-11-24T00:00:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "a1.2.2b", + "checksum": "6250fb17f8898c4d970d6bd03c229177", + "releaseTime": "2010-11-10T00:00:01+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "a1.2.2a", + "checksum": "0f9fe018b344fd9dd849005f9bdca803", + "releaseTime": "2010-11-10T00:00:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "texturepacks"] + }, + { + "id": "a1.2.1_01", + "checksum": "0a496e44a7b4e2f493b5893d8e5845bd", + "releaseTime": "2010-11-05T00:00:01+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "no-texturepacks"] + }, + { + "id": "a1.2.1", + "checksum": "0a496e44a7b4e2f493b5893d8e5845bd", + "releaseTime": "2010-11-05T00:00:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "no-texturepacks"] + }, + { + "id": "a1.2.0_02", + "checksum": "f5bcb4d0c0e78bc220f164b89ae9bd60", + "releaseTime": "2010-11-04T00:00:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "no-texturepacks"] + }, + { + "id": "a1.2.0_01", + "checksum": "b2e9333e967cb89488884c2e5c715d4f", + "releaseTime": "2010-10-31T00:00:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "no-texturepacks"] + }, + { + "id": "a1.2.0", + "checksum": "44c384dae02390f700458b95d82c3e2a", + "releaseTime": "2010-10-30T00:00:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "no-texturepacks"] + }, + { + "id": "a1.1.2_01", + "checksum": "94346e1b8f6ad0e4a284314f0e29207b", + "releaseTime": "2010-09-23T00:00:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "no-texturepacks"] + }, + { + "id": "a1.1.2", + "checksum": "72ba1f834327805cb44164a42b331522", + "releaseTime": "2010-09-20T00:00:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "no-texturepacks"] + }, + { + "id": "a1.1.0", + "checksum": "891fd93e04f5daaf35d73c58e45c01b1", + "releaseTime": "2010-09-13T00:00:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "no-texturepacks"] + }, + { + "id": "a1.0.17_04", + "checksum": "16ed7dc58244772847991e504afcf02f", + "releaseTime": "2010-08-23T00:00:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "no-texturepacks"] + }, + { + "id": "a1.0.17_02", + "checksum": "d89760b0871ef61a55c9f336c0439d58", + "releaseTime": "2010-08-20T00:00:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "no-texturepacks"] + }, + { + "id": "a1.0.16", + "checksum": "6bbde02c13aed5766275f4398ede6aae", + "releaseTime": "2010-08-12T00:00:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "no-texturepacks"] + }, + { + "id": "a1.0.15", + "checksum": "ade257d2080d56fa983763f9c701fa14", + "releaseTime": "2010-08-04T00:00:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "no-texturepacks"] + }, + { + "id": "a1.0.14", + "checksum": "227d0c6fa896a231de6269a074c9a458", + "releaseTime": "2010-07-30T00:00:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "no-texturepacks"] + }, + { + "id": "a1.0.11", + "checksum": "6f1b1dd157fa0df39760f5be3eab01b0", + "releaseTime": "2010-07-23T00:00:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "+traits": ["legacyLaunch", "no-texturepacks"] + }, + { + "id": "a1.0.5_01", + "checksum": "ae5f606caa18222e7568819c910ee423", + "releaseTime": "2010-07-13T00:00:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "mainClass": "y", + "+traits": ["legacyLaunch", "no-texturepacks"] + }, + { + "id": "a1.0.4", + "checksum": "13ce7935c3670e7494e26b2704bfa3e9", + "releaseTime": "2010-07-09T00:00:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "mainClass": "ax", + "+traits": ["legacyLaunch", "no-texturepacks"] + }, + { + "id": "inf-20100618", + "checksum": "f5f5aa34760facc10486e906a7c60196", + "releaseTime": "2010-06-16T00:00:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "mainClass": "net.minecraft.client.d", + "appletClass": "net.minecraft.client.MinecraftApplet", + "+traits": ["legacyLaunch", "no-texturepacks"] + }, + { + "id": "c0.30_01c", + "checksum": "fcfd7f83a6b27503cf48202381a5adf2", + "releaseTime": "2009-12-22T00:00:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "mainClass": "com.mojang.minecraft.l", + "appletClass": "com.mojang.minecraft.MinecraftApplet", + "+traits": ["legacyLaunch", "no-texturepacks"] + }, + { + "id": "c0.0.13a_03", + "checksum": "a9527cb5aef198e0f53e235ebe13dc75", + "releaseTime": "2009-05-22T00:00:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "mainClass": "com.mojang.minecraft.c", + "appletClass": "com.mojang.minecraft.MinecraftApplet", + "+traits": ["legacyLaunch", "no-texturepacks"] + }, + { + "id": "c0.0.13a", + "checksum": "3617fbf5fbfd2b837ebf5ceb63584908", + "releaseTime": "2009-05-31T00:00:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "mainClass": "com.mojang.minecraft.Minecraft", + "appletClass": "com.mojang.minecraft.MinecraftApplet", + "+traits": ["legacyLaunch", "no-texturepacks"] + }, + { + "id": "c0.0.11a", + "checksum": "a6e03c2eaf74709facc0d2477648e999", + "releaseTime": "2009-05-17T00:00:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "mainClass": "com.mojang.minecraft.Minecraft", + "appletClass": "com.mojang.minecraft.MinecraftApplet", + "+traits": ["legacyLaunch", "no-texturepacks"] + }, + { + "id": "rd-161348", + "checksum": "80882b8936a5c8d91500838a6660b504", + "releaseTime": "2009-05-16T13:48:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "mainClass": "com.mojang.minecraft.RubyDung", + "+traits": ["no-texturepacks"] + }, + { + "id": "rd-160052", + "checksum": "24c5cc99a2a612697ed2f7d5d04242fe", + "releaseTime": "2009-05-16T00:52:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "mainClass": "com.mojang.rubydung.RubyDung", + "+traits": ["no-texturepacks"] + }, + { + "id": "rd-132328", + "checksum": "70e33a81c541b13a477e68c1207124eb", + "releaseTime": "2009-05-13T23:28:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "mainClass": "com.mojang.rubydung.RubyDung", + "+traits": ["no-texturepacks"] + }, + { + "id": "rd-132211", + "checksum": "99fdaea10c494b9c3c3254636b98b799", + "releaseTime": "2009-05-13T22:11:00+02:00", + "type": "old_alpha", + "processArguments": "legacy", + "mainClass": "com.mojang.rubydung.RubyDung", + "+traits": ["no-texturepacks"] + } +] +} diff --git a/application/resources/versions/versions.qrc b/application/resources/versions/versions.qrc new file mode 100644 index 00000000..e9621e97 --- /dev/null +++ b/application/resources/versions/versions.qrc @@ -0,0 +1,12 @@ + + + + + minecraft.json + + LWJGL/2.9.0.json + LWJGL/2.9.1-nightly-20130708-debug3.json + LWJGL/2.9.1.json + LWJGL/2.9.2-nightly-20140822.json + + diff --git a/application/widgets/Common.cpp b/application/widgets/Common.cpp new file mode 100644 index 00000000..9b730d6c --- /dev/null +++ b/application/widgets/Common.cpp @@ -0,0 +1,27 @@ +#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 new file mode 100644 index 00000000..fc46e08f --- /dev/null +++ b/application/widgets/Common.h @@ -0,0 +1,6 @@ +#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/IconLabel.cpp b/application/widgets/IconLabel.cpp new file mode 100644 index 00000000..86c8a431 --- /dev/null +++ b/application/widgets/IconLabel.cpp @@ -0,0 +1,43 @@ +#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 new file mode 100644 index 00000000..a2f1eef3 --- /dev/null +++ b/application/widgets/IconLabel.h @@ -0,0 +1,26 @@ +#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/LabeledToolButton.cpp b/application/widgets/LabeledToolButton.cpp new file mode 100644 index 00000000..dfdde1bc --- /dev/null +++ b/application/widgets/LabeledToolButton.cpp @@ -0,0 +1,86 @@ +/* Copyright 2013-2015 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 + +/* + * + * 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); +} + +/*! + \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)); + QWidget::resizeEvent(event); +} diff --git a/application/widgets/LabeledToolButton.h b/application/widgets/LabeledToolButton.h new file mode 100644 index 00000000..1b74c4ee --- /dev/null +++ b/application/widgets/LabeledToolButton.h @@ -0,0 +1,37 @@ +/* Copyright 2013-2015 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; + +public: + LabeledToolButton(QWidget * parent = 0); + + QString text() const; + void setText(const QString & text); + virtual QSize sizeHint() const; +protected: + void resizeEvent(QResizeEvent * event); +}; diff --git a/application/widgets/LineSeparator.cpp b/application/widgets/LineSeparator.cpp new file mode 100644 index 00000000..f4ee173d --- /dev/null +++ b/application/widgets/LineSeparator.cpp @@ -0,0 +1,37 @@ +#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 new file mode 100644 index 00000000..9546e747 --- /dev/null +++ b/application/widgets/LineSeparator.h @@ -0,0 +1,18 @@ +#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/MCModInfoFrame.cpp b/application/widgets/MCModInfoFrame.cpp new file mode 100644 index 00000000..2f859ed3 --- /dev/null +++ b/application/widgets/MCModInfoFrame.cpp @@ -0,0 +1,111 @@ +/* Copyright 2013-2015 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(); + + setModText(text); + + if(m.description().isEmpty()) + { + setModDescription(tr("No description provided in mcmod.info")); + } + else + { + setModDescription(m.description()); + } +} + +void MCModInfoFrame::clear() +{ + setModText(tr("Select a mod to view title and authors...")); + setModDescription(tr("Select a mod to view description...")); +} + +MCModInfoFrame::MCModInfoFrame(QWidget *parent) : + QFrame(parent), + ui(new Ui::MCModInfoFrame) +{ + ui->setupUi(this); +} + +MCModInfoFrame::~MCModInfoFrame() +{ + delete ui; +} + +void MCModInfoFrame::setModText(QString text) +{ + ui->label_ModText->setText(text); +} + +void MCModInfoFrame::setModDescription(QString text) +{ + 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; + 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) +{ + CustomMessageBox::selectable(this, tr(""), desc)->show(); +} diff --git a/application/widgets/MCModInfoFrame.h b/application/widgets/MCModInfoFrame.h new file mode 100644 index 00000000..3f75279c --- /dev/null +++ b/application/widgets/MCModInfoFrame.h @@ -0,0 +1,46 @@ +/* Copyright 2013-2015 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.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 ); + +private: + Ui::MCModInfoFrame *ui; + QString desc; +}; diff --git a/application/widgets/MCModInfoFrame.ui b/application/widgets/MCModInfoFrame.ui new file mode 100644 index 00000000..60e0a65c --- /dev/null +++ b/application/widgets/MCModInfoFrame.ui @@ -0,0 +1,68 @@ + + + MCModInfoFrame + + + + 0 + 0 + 527 + 113 + + + + + 0 + 0 + + + + + 16777215 + 120 + + + + Frame + + + + + + Select a mod to view title and authors... + + + Qt::RichText + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + true + + + + + + + Select a mod to view description... + + + Qt::PlainText + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + + + + + diff --git a/application/widgets/ModListView.cpp b/application/widgets/ModListView.cpp new file mode 100644 index 00000000..aa16ad05 --- /dev/null +++ b/application/widgets/ModListView.cpp @@ -0,0 +1,62 @@ +/* Copyright 2013-2015 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 ( false ); + setAlternatingRowColors ( true ); + setSelectionMode ( QAbstractItemView::ContiguousSelection ); + 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(!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 new file mode 100644 index 00000000..43de9811 --- /dev/null +++ b/application/widgets/ModListView.h @@ -0,0 +1,27 @@ +/* Copyright 2013-2015 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 Mod; + +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 new file mode 100644 index 00000000..679039a7 --- /dev/null +++ b/application/widgets/PageContainer.cpp @@ -0,0 +1,210 @@ +/* Copyright 2013-2015 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 + +#include "MultiMC.h" +#include "settings/SettingsObject.h" +#include "widgets/IconLabel.h" +#include "Platform.h" +#include "PageContainer_p.h" +#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(BasePageProviderPtr pageProvider, QString defaultId, + QWidget *parent) + : QWidget(parent) +{ + createUI(); + m_model = new PageModel(this); + m_proxyModel = new PageEntryFilterModel(this); + int firstIndex = -1; + int counter = 0; + auto pages = pageProvider->getPages(); + for (auto page : pages) + { + page->stackIndex = m_pageStack->addWidget(dynamic_cast(page)); + page->listIndex = counter; + counter++; + if (firstIndex == -1) + { + firstIndex = page->stackIndex; + } + } + 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->setModel(m_proxyModel); + connect(m_pageList->selectionModel(), SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), + this, SLOT(currentChanged(QModelIndex))); + m_pageStack->setStackingMode(QStackedLayout::StackOne); + m_pageList->setFocus(); + // now find what we want to have selected... + auto page = m_model->findPageEntryById(defaultId); + QModelIndex index; + if (page) + { + index = m_proxyModel->mapFromSource(m_model->index(page->listIndex)); + } + else + { + index = m_proxyModel->index(0, 0); + } + if (index.isValid()) + m_pageList->setCurrentIndex(index); +} + +void PageContainer::createUI() +{ + m_pageStack = new QStackedLayout; + m_filter = new QLineEdit; + 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)); + + 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); + 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; + QDesktopServices::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::requestClose(QCloseEvent *event) +{ + for (auto page : m_model->pages()) + { + if (!page->apply()) + return false; + } + if (m_currentPage) + { + m_currentPage->closed(); + } + return true; +} diff --git a/application/widgets/PageContainer.h b/application/widgets/PageContainer.h new file mode 100644 index 00000000..3027af36 --- /dev/null +++ b/application/widgets/PageContainer.h @@ -0,0 +1,63 @@ +/* Copyright 2013-2015 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" + +class QLayout; +class IconLabel; +class QSortFilterProxyModel; +class PageModel; +class QLabel; +class QListView; +class QLineEdit; +class QStackedLayout; +class QGridLayout; + +class PageContainer : public QWidget +{ + Q_OBJECT +public: + explicit PageContainer(BasePageProviderPtr pageProvider, QString defaultId = QString(), + QWidget *parent = 0); + virtual ~PageContainer() {} + + void addButtons(QWidget * buttons); + void addButtons(QLayout * buttons); + bool requestClose(QCloseEvent *event); + +private: + void createUI(); +private +slots: + void currentChanged(const QModelIndex ¤t); + void showPage(int row); + void help(); + +private: + BasePage * m_currentPage = 0; + QSortFilterProxyModel *m_proxyModel; + PageModel *m_model; + QStackedLayout *m_pageStack; + QLineEdit *m_filter; + 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 new file mode 100644 index 00000000..4c720e4c --- /dev/null +++ b/application/widgets/PageContainer_p.h @@ -0,0 +1,123 @@ +/* Copyright 2013-2015 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/ServerStatus.cpp b/application/widgets/ServerStatus.cpp new file mode 100644 index 00000000..0c11b9bf --- /dev/null +++ b/application/widgets/ServerStatus.cpp @@ -0,0 +1,129 @@ +#include "ServerStatus.h" +#include "LineSeparator.h" +#include "IconLabel.h" +#include "status/StatusChecker.h" + +#include "MultiMC.h" + +#include +#include +#include +#include +#include +#include + +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("minecraft.net", tr("Web")); + addLine(); + addStatus("account.mojang.com", tr("Account")); + addLine(); + addStatus("skins.minecraft.net", tr("Skins")); + addLine(); + addStatus("authserver.mojang.com", tr("Auth")); + addLine(); + addStatus("sessionserver.mojang.com", tr("Session")); + + 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 IconLabel(this, badIcon, QSize(16, 16)); + label->setToolTip(key); + serverLabels[key] = label; + layout->addWidget(label); + } + { + auto label = new QLabel(this); + label->setText(name); + label->setToolTip(key); + layout->addWidget(label); + } +} + +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); +} diff --git a/application/widgets/ServerStatus.h b/application/widgets/ServerStatus.h new file mode 100644 index 00000000..fdd43677 --- /dev/null +++ b/application/widgets/ServerStatus.h @@ -0,0 +1,37 @@ +#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: /* 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 new file mode 100644 index 00000000..fc0bcd0a --- /dev/null +++ b/application/widgets/VersionListView.cpp @@ -0,0 +1,147 @@ +/* Copyright 2013-2015 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) +{ + if(!m_itemCount) + viewport()->update(); + m_itemCount += end-start+1; + QTreeView::rowsInserted(parent, start, end); +} + + +void VersionListView::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) +{ + m_itemCount -= end-start+1; + if(!m_itemCount) + viewport()->update(); + QTreeView::rowsInserted(parent, start, end); +} + +void VersionListView::setModel(QAbstractItemModel *model) +{ + m_itemCount = model->rowCount(); + if(!m_itemCount) + viewport()->update(); + QTreeView::setModel(model); +} + +void VersionListView::reset() +{ + if(model()) + { + m_itemCount = model()->rowCount(); + } + viewport()->update(); + QTreeView::reset(); +} + +void VersionListView::setEmptyString(QString emptyString) +{ + m_emptyString = emptyString; + if(!m_itemCount) + { + viewport()->update(); + } +} + +void VersionListView::paintEvent(QPaintEvent *event) +{ + if(m_itemCount) + { + QTreeView::paintEvent(event); + } + else + { + paintInfoLabel(event); + } +} + +void VersionListView::paintInfoLabel(QPaintEvent *event) +{ + //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); + QTextLayout layout(m_emptyString, font); + qreal height = 0.0; + qreal widthUsed = 0.0; + QStringList lines = viewItemTextLayout(layout, bounds.width() - 20, height, widthUsed); + QRect rect (0,0, widthUsed, height); + rect.setWidth(rect.width()+20); + rect.setHeight(rect.height()+20); + rect.moveCenter(bounds.center()); + //check if we are allowed to draw in our area + if (!event->rect().intersects(rect)) { + return; + } + //draw the letter of the topmost item semitransparent in the middle + QColor background = QApplication::palette().color(QPalette::Foreground); + QColor foreground = QApplication::palette().color(QPalette::Base); + /* + background.setAlpha(128 - scrollFade); + foreground.setAlpha(128 - scrollFade); + */ + painter.setBrush(QBrush(background)); + painter.setPen(foreground); + painter.drawRoundedRect(rect, 5.0, 5.0); + foreground.setAlpha(190); + painter.setPen(foreground); + painter.setFont(font); + painter.drawText(rect, Qt::AlignCenter, lines.join("\n")); + +} + +/* +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(!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/VersionListView.h b/application/widgets/VersionListView.h new file mode 100644 index 00000000..f33a6fdb --- /dev/null +++ b/application/widgets/VersionListView.h @@ -0,0 +1,43 @@ +/* Copyright 2013-2015 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 Mod; + +class VersionListView : public QTreeView +{ + Q_OBJECT +public: + explicit VersionListView(QWidget *parent = 0); + virtual void paintEvent(QPaintEvent *event) override; + void setEmptyString(QString emptyString); + virtual void setModel ( QAbstractItemModel* model ); + +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); + +private: /* variables */ + int m_itemCount = 0; + QString m_emptyString; +}; -- cgit v1.2.3