mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-12-28 06:34:27 +00:00
Remove unused code (#4158)
Some checks failed
CodeQL Code Scanning / CodeQL (push) Has been cancelled
Flatpak / Build (${{ matrix.arch }}) (aarch64, ubuntu-22.04-arm) (push) Has been cancelled
Flatpak / Build (${{ matrix.arch }}) (x86_64, ubuntu-22.04) (push) Has been cancelled
Nix / Build (${{ matrix.system }}) (macos-13, x86_64-darwin) (push) Has been cancelled
Nix / Build (${{ matrix.system }}) (macos-14, aarch64-darwin) (push) Has been cancelled
Nix / Build (${{ matrix.system }}) (ubuntu-22.04, x86_64-linux) (push) Has been cancelled
Nix / Build (${{ matrix.system }}) (ubuntu-22.04-arm, aarch64-linux) (push) Has been cancelled
Some checks failed
CodeQL Code Scanning / CodeQL (push) Has been cancelled
Flatpak / Build (${{ matrix.arch }}) (aarch64, ubuntu-22.04-arm) (push) Has been cancelled
Flatpak / Build (${{ matrix.arch }}) (x86_64, ubuntu-22.04) (push) Has been cancelled
Nix / Build (${{ matrix.system }}) (macos-13, x86_64-darwin) (push) Has been cancelled
Nix / Build (${{ matrix.system }}) (macos-14, aarch64-darwin) (push) Has been cancelled
Nix / Build (${{ matrix.system }}) (ubuntu-22.04, x86_64-linux) (push) Has been cancelled
Nix / Build (${{ matrix.system }}) (ubuntu-22.04-arm, aarch64-linux) (push) Has been cancelled
This commit is contained in:
commit
28b755cf04
@ -242,9 +242,6 @@ set(MINECRAFT_SOURCES
|
||||
minecraft/auth/steps/XboxUserStep.cpp
|
||||
minecraft/auth/steps/XboxUserStep.h
|
||||
|
||||
minecraft/gameoptions/GameOptions.h
|
||||
minecraft/gameoptions/GameOptions.cpp
|
||||
|
||||
minecraft/update/AssetUpdateTask.h
|
||||
minecraft/update/AssetUpdateTask.cpp
|
||||
minecraft/update/FMLLibrariesTask.cpp
|
||||
@ -901,8 +898,6 @@ SET(LAUNCHER_SOURCES
|
||||
# GUI - instance pages
|
||||
ui/pages/instance/ExternalResourcesPage.cpp
|
||||
ui/pages/instance/ExternalResourcesPage.h
|
||||
ui/pages/instance/GameOptionsPage.cpp
|
||||
ui/pages/instance/GameOptionsPage.h
|
||||
ui/pages/instance/VersionPage.cpp
|
||||
ui/pages/instance/VersionPage.h
|
||||
ui/pages/instance/ManagedPackPage.cpp
|
||||
@ -1201,7 +1196,6 @@ qt_wrap_ui(LAUNCHER_UI
|
||||
ui/pages/instance/NotesPage.ui
|
||||
ui/pages/instance/LogPage.ui
|
||||
ui/pages/instance/ServersPage.ui
|
||||
ui/pages/instance/GameOptionsPage.ui
|
||||
ui/pages/instance/OtherLogsPage.ui
|
||||
ui/pages/instance/VersionPage.ui
|
||||
ui/pages/instance/ManagedPackPage.ui
|
||||
|
||||
@ -43,7 +43,6 @@ class InstancePageProvider : protected QObject, public BasePageProvider {
|
||||
values.append(new NotesPage(onesix.get()));
|
||||
values.append(new WorldListPage(onesix, onesix->worldList()));
|
||||
values.append(new ServersPage(onesix));
|
||||
// values.append(new GameOptionsPage(onesix.get()));
|
||||
values.append(new ScreenshotsPage(FS::PathCombine(onesix->gameRoot(), "screenshots")));
|
||||
values.append(new InstanceSettingsPage(onesix));
|
||||
values.append(new OtherLogsPage("logs", tr("Other Logs"), "Other-Logs", inst));
|
||||
|
||||
@ -84,7 +84,6 @@
|
||||
#include "AssetsUtils.h"
|
||||
#include "MinecraftLoadAndCheck.h"
|
||||
#include "PackProfile.h"
|
||||
#include "minecraft/gameoptions/GameOptions.h"
|
||||
#include "minecraft/update/FoldersTask.h"
|
||||
|
||||
#include "tools/BaseProfiler.h"
|
||||
@ -1286,14 +1285,6 @@ std::shared_ptr<WorldList> MinecraftInstance::worldList()
|
||||
return m_world_list;
|
||||
}
|
||||
|
||||
std::shared_ptr<GameOptions> MinecraftInstance::gameOptionsModel()
|
||||
{
|
||||
if (!m_game_options) {
|
||||
m_game_options.reset(new GameOptions(FS::PathCombine(gameRoot(), "options.txt")));
|
||||
}
|
||||
return m_game_options;
|
||||
}
|
||||
|
||||
QList<Mod*> MinecraftInstance::getJarMods() const
|
||||
{
|
||||
auto profile = m_components->getProfile();
|
||||
|
||||
@ -49,7 +49,6 @@ class ResourcePackFolderModel;
|
||||
class ShaderPackFolderModel;
|
||||
class TexturePackFolderModel;
|
||||
class WorldList;
|
||||
class GameOptions;
|
||||
class LaunchStep;
|
||||
class PackProfile;
|
||||
|
||||
@ -121,7 +120,6 @@ class MinecraftInstance : public BaseInstance {
|
||||
std::shared_ptr<DataPackFolderModel> dataPackList();
|
||||
QList<std::shared_ptr<ResourceFolderModel>> resourceLists();
|
||||
std::shared_ptr<WorldList> worldList();
|
||||
std::shared_ptr<GameOptions> gameOptionsModel();
|
||||
|
||||
////// Launch stuff //////
|
||||
QList<Task::Ptr> createUpdateTask() override;
|
||||
@ -171,7 +169,6 @@ class MinecraftInstance : public BaseInstance {
|
||||
mutable std::shared_ptr<TexturePackFolderModel> m_texture_pack_list;
|
||||
mutable std::shared_ptr<DataPackFolderModel> m_data_pack_list;
|
||||
mutable std::shared_ptr<WorldList> m_world_list;
|
||||
mutable std::shared_ptr<GameOptions> m_game_options;
|
||||
};
|
||||
|
||||
using MinecraftInstancePtr = std::shared_ptr<MinecraftInstance>;
|
||||
|
||||
@ -1,124 +0,0 @@
|
||||
#include "GameOptions.h"
|
||||
#include <QDebug>
|
||||
#include <QSaveFile>
|
||||
#include "FileSystem.h"
|
||||
|
||||
namespace {
|
||||
bool load(const QString& path, std::vector<GameOptionItem>& contents, int& version)
|
||||
{
|
||||
contents.clear();
|
||||
QFile file(path);
|
||||
if (!file.open(QFile::ReadOnly)) {
|
||||
qWarning() << "Failed to read options file.";
|
||||
return false;
|
||||
}
|
||||
version = 0;
|
||||
while (!file.atEnd()) {
|
||||
auto line = file.readLine();
|
||||
if (line.endsWith('\n')) {
|
||||
line.chop(1);
|
||||
}
|
||||
auto separatorIndex = line.indexOf(':');
|
||||
if (separatorIndex == -1) {
|
||||
continue;
|
||||
}
|
||||
auto key = QString::fromUtf8(line.data(), separatorIndex);
|
||||
auto value = QString::fromUtf8(line.data() + separatorIndex + 1, line.size() - 1 - separatorIndex);
|
||||
qDebug() << "!!" << key << "!!";
|
||||
if (key == "version") {
|
||||
version = value.toInt();
|
||||
continue;
|
||||
}
|
||||
contents.emplace_back(GameOptionItem{ key, value });
|
||||
}
|
||||
qDebug() << "Loaded" << path << "with version:" << version;
|
||||
return true;
|
||||
}
|
||||
bool save(const QString& path, std::vector<GameOptionItem>& mapping, int version)
|
||||
{
|
||||
QSaveFile out(path);
|
||||
if (!out.open(QIODevice::WriteOnly)) {
|
||||
return false;
|
||||
}
|
||||
if (version != 0) {
|
||||
QString versionLine = QString("version:%1\n").arg(version);
|
||||
out.write(versionLine.toUtf8());
|
||||
}
|
||||
auto iter = mapping.begin();
|
||||
while (iter != mapping.end()) {
|
||||
out.write(iter->key.toUtf8());
|
||||
out.write(":");
|
||||
out.write(iter->value.toUtf8());
|
||||
out.write("\n");
|
||||
iter++;
|
||||
}
|
||||
return out.commit();
|
||||
}
|
||||
} // namespace
|
||||
|
||||
GameOptions::GameOptions(const QString& path) : path(path)
|
||||
{
|
||||
reload();
|
||||
}
|
||||
|
||||
QVariant GameOptions::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if (role != Qt::DisplayRole) {
|
||||
return QAbstractListModel::headerData(section, orientation, role);
|
||||
}
|
||||
switch (section) {
|
||||
case 0:
|
||||
return tr("Key");
|
||||
case 1:
|
||||
return tr("Value");
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
|
||||
QVariant GameOptions::data(const QModelIndex& index, int role) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
int row = index.row();
|
||||
int column = index.column();
|
||||
|
||||
if (row < 0 || row >= int(contents.size()))
|
||||
return QVariant();
|
||||
|
||||
if (role == Qt::DisplayRole) {
|
||||
if (column == 0)
|
||||
return contents[row].key;
|
||||
return contents[row].value;
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
int GameOptions::rowCount(const QModelIndex&) const
|
||||
{
|
||||
return static_cast<int>(contents.size());
|
||||
}
|
||||
|
||||
int GameOptions::columnCount(const QModelIndex&) const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
bool GameOptions::isLoaded() const
|
||||
{
|
||||
return loaded;
|
||||
}
|
||||
|
||||
bool GameOptions::reload()
|
||||
{
|
||||
beginResetModel();
|
||||
loaded = load(path, contents, version);
|
||||
endResetModel();
|
||||
return loaded;
|
||||
}
|
||||
|
||||
bool GameOptions::save()
|
||||
{
|
||||
return ::save(path, contents, version);
|
||||
}
|
||||
@ -1,32 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <QString>
|
||||
#include <map>
|
||||
|
||||
struct GameOptionItem {
|
||||
QString key;
|
||||
QString value;
|
||||
};
|
||||
|
||||
class GameOptions : public QAbstractListModel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GameOptions(const QString& path);
|
||||
virtual ~GameOptions() = default;
|
||||
|
||||
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex& parent) const override;
|
||||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
|
||||
bool isLoaded() const;
|
||||
bool reload();
|
||||
bool save();
|
||||
|
||||
private:
|
||||
std::vector<GameOptionItem> contents;
|
||||
bool loaded = false;
|
||||
QString path;
|
||||
int version = 0;
|
||||
};
|
||||
@ -1,74 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
/*
|
||||
* Prism Launcher - Minecraft Launcher
|
||||
* Copyright (c) 2022 Jamie Mansfield <jmansfield@cadixdev.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This file incorporates work covered by the following copyright and
|
||||
* permission notice:
|
||||
*
|
||||
* Copyright 2013-2021 MultiMC Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "GameOptionsPage.h"
|
||||
#include "minecraft/MinecraftInstance.h"
|
||||
#include "minecraft/gameoptions/GameOptions.h"
|
||||
#include "ui_GameOptionsPage.h"
|
||||
|
||||
GameOptionsPage::GameOptionsPage(MinecraftInstance* inst, QWidget* parent) : QWidget(parent), ui(new Ui::GameOptionsPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->tabWidget->tabBar()->hide();
|
||||
m_model = inst->gameOptionsModel();
|
||||
ui->optionsView->setModel(m_model.get());
|
||||
auto head = ui->optionsView->header();
|
||||
if (head->count()) {
|
||||
head->setSectionResizeMode(0, QHeaderView::ResizeToContents);
|
||||
for (int i = 1; i < head->count(); i++) {
|
||||
head->setSectionResizeMode(i, QHeaderView::Stretch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GameOptionsPage::~GameOptionsPage()
|
||||
{
|
||||
// m_model->save();
|
||||
}
|
||||
|
||||
void GameOptionsPage::openedImpl()
|
||||
{
|
||||
// m_model->observe();
|
||||
}
|
||||
|
||||
void GameOptionsPage::closedImpl()
|
||||
{
|
||||
// m_model->unobserve();
|
||||
}
|
||||
|
||||
void GameOptionsPage::retranslate()
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
@ -1,88 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>GameOptionsPage</class>
|
||||
<widget class="QWidget" name="GameOptionsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>706</width>
|
||||
<height>575</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string notr="true">Tab 1</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QTreeView" name="optionsView">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="acceptDrops">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>64</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="rootIsDecorated">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="headerStretchLastSection">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>tabWidget</tabstop>
|
||||
<tabstop>optionsView</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -1,39 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
/*
|
||||
* Prism Launcher - Minecraft Launcher
|
||||
* Copyright (C) 2022 Tayou <git@tayou.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "ThemeWizardPage.h"
|
||||
#include "ui_ThemeWizardPage.h"
|
||||
|
||||
#include "Application.h"
|
||||
#include "ui/themes/ITheme.h"
|
||||
#include "ui/themes/ThemeManager.h"
|
||||
#include "ui/widgets/ThemeCustomizationWidget.h"
|
||||
#include "ui_ThemeCustomizationWidget.h"
|
||||
|
||||
ThemeWizardPage::ThemeWizardPage(QWidget* parent) : BaseWizardPage(parent), ui(new Ui::ThemeWizardPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(ui->themeCustomizationWidget, &ThemeCustomizationWidget::currentIconThemeChanged, this, &ThemeWizardPage::updateIcons);
|
||||
connect(ui->themeCustomizationWidget, &ThemeCustomizationWidget::currentCatChanged, this, &ThemeWizardPage::updateCat);
|
||||
|
||||
updateIcons();
|
||||
updateCat();
|
||||
}
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user