diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt
index 1998addf0..85ca816ff 100644
--- a/launcher/CMakeLists.txt
+++ b/launcher/CMakeLists.txt
@@ -1015,6 +1015,21 @@ SET(LAUNCHER_SOURCES
ui/widgets/WideBar.cpp
ui/widgets/ThemeCustomizationWidget.h
ui/widgets/ThemeCustomizationWidget.cpp
+ ui/widgets/GameOptionWidget.h
+ ui/widgets/GameOptionWidgetSlider.h
+ ui/widgets/GameOptionWidgetSlider.cpp
+ ui/widgets/GameOptionWidgetComboBox.h
+ ui/widgets/GameOptionWidgetComboBox.cpp
+ ui/widgets/GameOptionWidgetCheckBox.h
+ ui/widgets/GameOptionWidgetCheckBox.cpp
+ ui/widgets/GameOptionWidgetSpinnerFloat.h
+ ui/widgets/GameOptionWidgetSpinnerFloat.cpp
+ ui/widgets/GameOptionWidgetSpinnerInt.h
+ ui/widgets/GameOptionWidgetSpinnerInt.cpp
+ ui/widgets/GameOptionWidgetText.h
+ ui/widgets/GameOptionWidgetText.cpp
+ ui/widgets/GameOptionWidgetKeyBind.h
+ ui/widgets/GameOptionWidgetKeyBind.cpp
# GUI - instance group view
ui/instanceview/InstanceProxyModel.cpp
@@ -1068,6 +1083,13 @@ qt_wrap_ui(LAUNCHER_UI
ui/widgets/ModFilterWidget.ui
ui/widgets/SubTaskProgressBar.ui
ui/widgets/ThemeCustomizationWidget.ui
+ ui/widgets/GameOptionWidgetSlider.ui
+ ui/widgets/GameOptionWidgetComboBox.ui
+ ui/widgets/GameOptionWidgetCheckBox.ui
+ ui/widgets/GameOptionWidgetSpinnerFloat.ui
+ ui/widgets/GameOptionWidgetSpinnerInt.ui
+ ui/widgets/GameOptionWidgetText.ui
+ ui/widgets/GameOptionWidgetKeyBind.ui
ui/dialogs/CopyInstanceDialog.ui
ui/dialogs/ProfileSetupDialog.ui
ui/dialogs/ProgressDialog.ui
diff --git a/launcher/minecraft/gameoptions/GameOptionDelegate.cpp b/launcher/minecraft/gameoptions/GameOptionDelegate.cpp
index 033aed321..d65285e4c 100644
--- a/launcher/minecraft/gameoptions/GameOptionDelegate.cpp
+++ b/launcher/minecraft/gameoptions/GameOptionDelegate.cpp
@@ -16,184 +16,82 @@
* along with this program. If not, see .
*/
#include "GameOptionDelegate.h"
+#include "ui/widgets/GameOptionWidget.h"
+#include "ui/widgets/GameOptionWidgetCheckBox.h"
+#include "ui/widgets/GameOptionWidgetComboBox.h"
+#include "ui/widgets/GameOptionWidgetKeyBind.h"
+#include "ui/widgets/GameOptionWidgetSlider.h"
+#include "ui/widgets/GameOptionWidgetSpinnerFloat.h"
+#include "ui/widgets/GameOptionWidgetSpinnerInt.h"
+#include "ui/widgets/GameOptionWidgetText.h"
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
+#include
-QWidget* GameOptionDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const {
- std::shared_ptr knownOption = contents->at(index.row()).knownOption;
-
- switch (contents->at(index.row()).type) {
- case OptionType::String: {
- if (knownOption != nullptr && !knownOption->validValues.isEmpty()) {
- QComboBox* comboBox = new QComboBox(parent);
- for (auto value : knownOption->validValues) {
- comboBox->addItem(value);
- }
- comboBox->setGeometry(option.rect);
- return comboBox;
- } else {
- QLineEdit* textField = new QLineEdit(parent);
- textField->setGeometry(option.rect);
- return textField;
- }
- }
- case OptionType::Int: {
- if (knownOption != nullptr && (knownOption->getIntRange().max != 0 || knownOption->getIntRange().min != 0)) {
- QSlider* slider = new QSlider(parent);
- slider->setMinimum(knownOption->getIntRange().min);
- slider->setMaximum(knownOption->getIntRange().max);
- slider->setOrientation(Qt::Horizontal);
- slider->setGeometry(option.rect);
- return slider;
- } else {
- QSpinBox* intInput = new QSpinBox(parent);
- intInput->setGeometry(option.rect);
- return intInput;
- }
- }
- case OptionType::Bool: {
- QCheckBox* checkBox = new QCheckBox(parent);
- checkBox->setGeometry(option.rect);
- return checkBox;
- }
- case OptionType::Float: {
- if (knownOption != nullptr && (knownOption->getFloatRange().max != 0 || knownOption->getFloatRange().min != 0)) {
- QSlider* slider = new QSlider(parent);
- slider->setMinimum(knownOption->getFloatRange().min*100);
- slider->setMaximum(knownOption->getFloatRange().max*100);
- slider->setOrientation(Qt::Horizontal);
- slider->setGeometry(option.rect);
- return slider;
- } else {
- QDoubleSpinBox* floatInput = new QDoubleSpinBox(parent);
- floatInput->setGeometry(option.rect);
- return floatInput;
- }
- }
- case OptionType::KeyBind: {
- QKeySequenceEdit* keySequenceEdit = new QKeySequenceEdit(parent);
- keySequenceEdit->setGeometry(option.rect);
- return keySequenceEdit;
- }
- default:
- break;
- }
-};
-void GameOptionDelegate::setEditorData(QWidget* editor, const QModelIndex& index) const
+QWidget* GameOptionDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
std::shared_ptr knownOption = contents->at(index.row()).knownOption;
switch (contents->at(index.row()).type) {
case OptionType::String: {
- QComboBox* comboBox;
- if ((comboBox = dynamic_cast(editor)) != nullptr) {
- comboBox->setCurrentIndex(comboBox->findText(contents->at(index.row()).value));
+ if (knownOption != nullptr && !knownOption->validValues.isEmpty()) {
+ return new GameOptionWidgetComboBox(parent, knownOption);
} else {
- ((QLineEdit*)editor)->setText(contents->at(index.row()).value);
+ return new GameOptionWidgetText(parent, knownOption);
}
- return;
}
case OptionType::Int: {
- QSlider* slider;
- if ((slider = dynamic_cast(editor)) != nullptr) {
- slider->setValue(contents->at(index.row()).intValue);
+ if (knownOption != nullptr && (knownOption->getIntRange().max != 0 || knownOption->getIntRange().min != 0)) {
+ return new GameOptionWidgetSlider(parent, knownOption);
} else {
- ((QSpinBox*)editor)->setValue(contents->at(index.row()).intValue);
+ return new GameOptionWidgetSpinnerInt(parent, knownOption);
}
- return;
}
case OptionType::Bool: {
- ((QCheckBox*)editor)->setText(contents->at(index.row()).value);
- ((QCheckBox*)editor)->setChecked(contents->at(index.row()).boolValue);
- return;
+ return new GameOptionWidgetCheckBox(parent, knownOption);
}
case OptionType::Float: {
- QSlider* slider;
- if ((slider = dynamic_cast(editor)) != nullptr) {
- slider->setValue(contents->at(index.row()).floatValue*100);
+ if (knownOption != nullptr && (knownOption->getFloatRange().max != 0 || knownOption->getFloatRange().min != 0)) {
+ return new GameOptionWidgetSlider(parent, knownOption);
} else {
- ((QDoubleSpinBox*)editor)->setValue(contents->at(index.row()).floatValue);
+ return new GameOptionWidgetSpinnerFloat(parent, knownOption);
}
- return;
}
case OptionType::KeyBind: {
- // TODO: fall back to QLineEdit if keybind can't be represented, like some mods do (by using another key input API)
- // TODO: mouse binding? If not possible, fall back as well maybe?
- Qt::Key key;
- for (auto& keyBinding : *keybindingOptions) {
- // this could become a std::find_if eventually, if someone wants to bother making it that.
- if (keyBinding->minecraftKeyCode == contents->at(index.row()).value) {
- key = keyBinding->qtKeyCode.keyboardKey;
- }
- }
- ((QKeySequenceEdit*)editor)->setKeySequence(QKeySequence(key));
- return;
+ return new GameOptionWidgetKeyBind(parent, knownOption);
}
default:
- return;
+ return nullptr;
+ }
+}
+
+void GameOptionDelegate::setEditorData(QWidget* editor, const QModelIndex& index) const
+{
+ GameOptionWidget* widget = dynamic_cast(editor);
+
+ GameOptionItem optionItem = contents->at(index.row());
+
+ if (widget != nullptr) {
+ widget->setEditorData(optionItem);
+ } else {
+ qDebug() << "[GameOptions] Setting widget data failed because widget was still null";
}
};
-void GameOptionDelegate::updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index) const {
- editor->setGeometry(option.rect);
+
+void GameOptionDelegate::updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index) const
+{
+ GameOptionWidget* widget = dynamic_cast(editor);
+ widget->setSize(option.rect);
};
-void GameOptionDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const {
- std::shared_ptr knownOption = contents->at(index.row()).knownOption;
- switch (contents->at(index.row()).type) {
- case OptionType::String: {
- QComboBox* comboBox;
- if ((comboBox = dynamic_cast(editor)) != nullptr) {
- contents->at(index.row()).value = comboBox->currentText();
- } else {
- contents->at(index.row()).value = ((QLineEdit*)editor)->text();
- }
- return;
- }
- case OptionType::Int: {
- QSlider* slider;
- if ((slider = dynamic_cast(editor)) != nullptr) {
- contents->at(index.row()).intValue = slider->value();
- } else {
- contents->at(index.row()).intValue = ((QSpinBox*)editor)->value();
- }
- return;
- }
- case OptionType::Bool: {
- ((QCheckBox*)editor)->setText(contents->at(index.row()).value);
- contents->at(index.row()).boolValue = ((QCheckBox*)editor)->isChecked();
- return;
- }
- case OptionType::Float: {
- QSlider* slider;
- if ((slider = dynamic_cast(editor)) != nullptr) {
- contents->at(index.row()).floatValue = slider->value()/100.0f;
- } else {
- contents->at(index.row()).floatValue = ((QDoubleSpinBox*)editor)->value();
- }
- return;
- }
- case OptionType::KeyBind: {
- QKeySequenceEdit* keySequenceEdit = (QKeySequenceEdit*)editor;
+void GameOptionDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const
+{
+ GameOptionWidget* widget = dynamic_cast(editor);
- QString minecraftKeyCode;
- for (auto& keyBinding : *keybindingOptions) {
- // this could become a std::find_if eventually, if someone wants to bother making it that.
- if (keyBinding->qtKeyCode.keyboardKey == keySequenceEdit->keySequence()[0].key() ||
- keyBinding->qtKeyCode.mouseButton == keySequenceEdit->keySequence()[0].key()) {
- minecraftKeyCode = keyBinding->minecraftKeyCode;
- }
- }
- contents->at(index.row()).value = minecraftKeyCode;
- return;
- }
- default:
- return;
+ GameOptionItem optionItem = contents->at(index.row());
+
+ if (widget != nullptr) {
+ widget->saveEditorData(optionItem);
+ } else {
+ qDebug() << "[GameOptions] Saving widget data to Model failed because widget was null";
}
-};
+}
\ No newline at end of file
diff --git a/launcher/minecraft/gameoptions/GameOptionDelegate.h b/launcher/minecraft/gameoptions/GameOptionDelegate.h
index 61e59fe34..5993ba603 100644
--- a/launcher/minecraft/gameoptions/GameOptionDelegate.h
+++ b/launcher/minecraft/gameoptions/GameOptionDelegate.h
@@ -38,6 +38,8 @@ class GameOptionDelegate : public QStyledItemDelegate {
const QModelIndex& index) const override;
void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const override;
+ enum GameOptionWidgetType { slider, text, keybind, number, comboBox };
+
private:
std::vector* contents;
QList>* keybindingOptions;
diff --git a/launcher/minecraft/gameoptions/GameOptions.cpp b/launcher/minecraft/gameoptions/GameOptions.cpp
index d11fbbd27..c98a964f6 100644
--- a/launcher/minecraft/gameoptions/GameOptions.cpp
+++ b/launcher/minecraft/gameoptions/GameOptions.cpp
@@ -98,12 +98,12 @@ bool load(const QString& path,
item.type = OptionType::Float;
// qDebug() << "The value" << value << "is a float";
} else if (item.value == "true" || item.value == "false") {
- item.boolValue = item.value == "true" ? true : false;
+ item.boolValue = item.value == "true";
item.type = OptionType::Bool;
qDebug() << "The value" << item.value << "is a bool";
} else if (item.value.endsWith("]") && item.value.startsWith("[")) {
qDebug() << "The value" << item.value << "is an array";
- for (QString part : item.value.mid(1, item.value.size() - 2).split(",")) {
+ for (const QString& part : item.value.mid(1, item.value.size() - 2).split(",")) {
GameOptionChildItem child{ part, static_cast(contents.size()) };
qDebug() << "Array has entry" << part;
item.children.append(child);
@@ -154,17 +154,15 @@ QVariant GameOptions::headerData(int section, Qt::Orientation orientation, int r
if (role != Qt::DisplayRole) {
return QAbstractItemModel::headerData(section, orientation, role);
}
- switch (section) {
- case 0:
- return tr("Key");
- case 1:
- return tr("Description");
- case 2:
- return tr("Value");
- case 3:
- return tr("Default Value");
+ switch ((Column)section) {
default:
return QVariant();
+ case Column::Key:
+ return tr("Key");
+ case Column::Description:
+ return tr("Description");
+ case Column::Value:
+ return tr("Value");
}
}
bool GameOptions::setData(const QModelIndex& index, const QVariant& value, int role)
@@ -175,16 +173,22 @@ bool GameOptions::setData(const QModelIndex& index, const QVariant& value, int r
switch (contents[row].type) {
case OptionType::String: {
contents[row].value = value.toString();
+ return true;
}
case OptionType::Int: {
contents[row].intValue = value.toInt();
+ return true;
}
case OptionType::Bool: {
contents[row].boolValue = value.toBool();
+ return true;
}
case OptionType::Float: {
contents[row].floatValue = value.toFloat();
+ return true;
}
+ case OptionType::KeyBind:
+ break;
}
}
@@ -193,34 +197,7 @@ bool GameOptions::setData(const QModelIndex& index, const QVariant& value, int r
Qt::ItemFlags GameOptions::flags(const QModelIndex& index) const
{
- Qt::ItemFlags flags = QAbstractItemModel::flags(index);
-
- if (!index.isValid())
- return flags;
-
- Column column = (Column)index.column();
-
- if (column == Column::Key) {
- return flags;
- }
-
- if (index.parent().isValid()) {
- return flags;
- }
-
- if (contents[index.row()].children.count() > 0) {
- return flags;
- }
-
- flags = flags | Qt::ItemFlag::ItemIsEditable;
- /*if (column == Column::Value || column == Column::DefaultValue) {
- flags = flags | Qt::ItemFlag::ItemIsUserCheckable;
- }*/
- if (column == Column::DefaultValue) {
- flags = flags & ~Qt::ItemFlag::ItemIsEnabled;
- }
-
- return flags;
+ return QAbstractItemModel::flags(index);
}
QVariant GameOptions::data(const QModelIndex& index, int role) const
@@ -263,90 +240,6 @@ QVariant GameOptions::data(const QModelIndex& index, int role) const
return QVariant();
}
}
- case Column::Value: {
- switch (contents[row].type) {
- case OptionType::String: {
- return contents[row].value;
- }
- case OptionType::Int: {
- return contents[row].intValue;
- }
- case OptionType::Bool: {
- return contents[row].boolValue;
- }
- case OptionType::Float: {
- return contents[row].floatValue;
- }
- case OptionType::KeyBind: {
- for (auto& keyBinding : *keybindingOptions) {
- // this could become a std::find_if eventually, if someone wants to bother making it that.
- if (keyBinding->minecraftKeyCode == contents[row].value) {
- return keyBinding->displayName; // + " (" + contents[row].value + ")";
- }
- }
-
- return contents[row].value;
- }
- default: {
- return QVariant();
- }
- }
- }
- case Column::DefaultValue: {
- if (contents[row].knownOption != nullptr) {
- switch (contents[row].type) {
- case OptionType::String: {
- return contents[row].knownOption->getDefaultString();
- }
- case OptionType::Int: {
- return contents[row].knownOption->getDefaultInt();
- }
- case OptionType::Bool: {
- return contents[row].knownOption->getDefaultBool();
- }
- case OptionType::Float: {
- return contents[row].knownOption->getDefaultFloat();
- }
- case OptionType::KeyBind: {
- for (auto& keyBinding : *keybindingOptions) {
- // this could become a std::find_if eventually, if someone wants to bother making it that.
- if (keyBinding->minecraftKeyCode == contents[row].knownOption->getDefaultString()) {
- return keyBinding->displayName; // + " (" + contents[row].knownOption->getDefaultString() + ")";
- }
- }
-
- return contents[row].knownOption->getDefaultString();
- }
- default: {
- return QVariant();
- }
- }
- } else {
- return QVariant();
- }
- }
- default: {
- return QVariant();
- }
- }
- }
- case Qt::CheckStateRole: {
- switch (column) {
- case Column::Value: {
- if (contents[row].type == OptionType::Bool) {
- return boolToState(contents[row].boolValue);
- } else {
- return QVariant();
- }
- }
- case Column::DefaultValue: {
- if (contents[row].knownOption != nullptr && contents[row].type == OptionType::Bool) {
- // checkboxes are tristate, this 1(true) needs to be 2 for fully checked
- return contents[row].knownOption->getDefaultBool() * 2;
- } else {
- return QVariant();
- }
- }
default: {
return QVariant();
}
@@ -371,7 +264,7 @@ QModelIndex GameOptions::index(int row, int column, const QModelIndex& parent) c
GameOptionItem* item = static_cast(parent.internalPointer());
return createIndex(row, column, &item->children[row]);
} else {
- return createIndex(row, column, &contents[row]);
+ return createIndex(row, column, reinterpret_cast(&contents[row]));
}
}
@@ -388,7 +281,7 @@ QModelIndex GameOptions::parent(const QModelIndex& index) const
return QModelIndex();
} else {
GameOptionChildItem* child = static_cast(index.internalPointer());
- return createIndex(child->parentRow, 0, &contents[child->parentRow]);
+ return createIndex(child->parentRow, 0, reinterpret_cast(&contents[child->parentRow]));
}
}
@@ -417,7 +310,7 @@ int GameOptions::columnCount(const QModelIndex& parent) const
if (parent.parent().isValid())
return 0;
- return 4;
+ return 3;
}
bool GameOptions::isLoaded() const
diff --git a/launcher/minecraft/gameoptions/GameOptions.h b/launcher/minecraft/gameoptions/GameOptions.h
index a4c8e56dc..4de2a7c88 100644
--- a/launcher/minecraft/gameoptions/GameOptions.h
+++ b/launcher/minecraft/gameoptions/GameOptions.h
@@ -60,7 +60,7 @@ struct GameOptionItem {
class GameOptions : public QAbstractItemModel {
Q_OBJECT
public:
- enum class Column { Key, Description, Value, DefaultValue };
+ enum class Column { Key, Description, Value };
explicit GameOptions(const QString& path);
virtual ~GameOptions() = default;
@@ -86,6 +86,6 @@ class GameOptions : public QAbstractItemModel {
QString path;
int version = 0;
- QMap>* knownOptions;
- QList>* keybindingOptions;
+ QMap>* knownOptions{};
+ QList>* keybindingOptions{};
};
diff --git a/launcher/minecraft/gameoptions/GameOptionsSchema.cpp b/launcher/minecraft/gameoptions/GameOptionsSchema.cpp
index 22daaa28e..60bf53663 100644
--- a/launcher/minecraft/gameoptions/GameOptionsSchema.cpp
+++ b/launcher/minecraft/gameoptions/GameOptionsSchema.cpp
@@ -17,6 +17,7 @@
*/
#include "GameOptionsSchema.h"
#include
+#include
QMap> GameOptionsSchema::knownOptions;
QList> GameOptionsSchema::keyboardButtons;
@@ -46,154 +47,154 @@ void GameOptionsSchema::populateInternalOptionList()
// clang-format off
// data version
- knownOptions["version"] = std::shared_ptr(new GameOption(0, "Data version of the client version this file was last saved in; used for upgrading default settings. (numeric)", true));
+ knownOptions["version"] = std::make_shared(0, "Data version of the client version this file was last saved in; used for upgrading default settings. (numeric)", true);
// general options
- knownOptions["autoJump"] = std::shared_ptr(new GameOption(false, "Whether auto-jump is enabled"));
- knownOptions["autoSuggestions"] = std::shared_ptr(new GameOption(true, "True if brigadier's command suggestion UI should always be shown, instead of just when pressing tab"));
- knownOptions["chatColors"] = std::shared_ptr(new GameOption(true, "Whether colored chat is allowed"));
- knownOptions["chatLinks"] = std::shared_ptr(new GameOption(true, "Whether links show as links or just text in the chat"));
- knownOptions["chatLinksPrompt"] = std::shared_ptr(new GameOption(true, "Whether clicking on links in chat needs confirmation before opening them"));
- knownOptions["enableVsync"] = std::shared_ptr(new GameOption(true, "Whether v-sync (vertical synchronization) is enabled"));
- knownOptions["entityShadows"] = std::shared_ptr(new GameOption(true, "Whether to display entity shadows"));
- knownOptions["forceUnicodeFont"] = std::shared_ptr(new GameOption(false, "Whether Unicode font should be used"));
- knownOptions["discrete_mouse_scroll"] = std::shared_ptr(new GameOption(false, "Ignores scrolling set by operating system"));
- knownOptions["invertYMouse"] = std::shared_ptr(new GameOption(false, "Whether mouse is inverted or not"));
- knownOptions["realmsNotifications"] = std::shared_ptr(new GameOption(true, "Whether Realms invites are alerted on the main menu"));
- knownOptions["reducedDebugInfo"] = std::shared_ptr(new GameOption(false, "Whether to show reduced information on the Debug screen"));
- knownOptions["showSubtitles"] = std::shared_ptr(new GameOption(false, "If subtitles are shown"));
- knownOptions["directionalAudio"] = std::shared_ptr(new GameOption(false, "If Directional Audio is enabled"));
- knownOptions["touchscreen"] = std::shared_ptr(new GameOption(false, "Whether touchscreen controls are used"));
- knownOptions["fullscreen"] = std::shared_ptr(new GameOption(false, "Whether the game attempts to go fullscreen at startup"));
- knownOptions["bobView"] = std::shared_ptr(new GameOption(true, "Whether or not the camera bobs up and down as the player walks"));
- knownOptions["toggleCrouch"] = std::shared_ptr(new GameOption(false, "Whether the sneak key must be pressed or held to activate sneaking"));
- knownOptions["toggleSprint"] = std::shared_ptr(new GameOption(false, "Whether the sprint key must be pressed or held to activate sprinting"));
- knownOptions["darkMojangStudiosBackground"] = std::shared_ptr(new GameOption(false, "Whether the Mojang Studios loading screen will appear monochrome"));
- knownOptions["hideLightningFlashes"] = std::shared_ptr(new GameOption(false, "Hide lightning flashes (visual effect)"));
+ knownOptions["autoJump"] = std::make_shared(false, "Whether auto-jump is enabled");
+ knownOptions["autoSuggestions"] = std::make_shared(true, "True if brigadier's command suggestion UI should always be shown, instead of just when pressing tab");
+ knownOptions["chatColors"] = std::make_shared(true, "Whether colored chat is allowed");
+ knownOptions["chatLinks"] = std::make_shared(true, "Whether links show as links or just text in the chat");
+ knownOptions["chatLinksPrompt"] = std::make_shared(true, "Whether clicking on links in chat needs confirmation before opening them");
+ knownOptions["enableVsync"] = std::make_shared(true, "Whether v-sync (vertical synchronization) is enabled");
+ knownOptions["entityShadows"] = std::make_shared(true, "Whether to display entity shadows");
+ knownOptions["forceUnicodeFont"] = std::make_shared(false, "Whether Unicode font should be used");
+ knownOptions["discrete_mouse_scroll"] = std::make_shared(false, "Ignores scrolling set by operating system");
+ knownOptions["invertYMouse"] = std::make_shared(false, "Whether mouse is inverted or not");
+ knownOptions["realmsNotifications"] = std::make_shared(true, "Whether Realms invites are alerted on the main menu");
+ knownOptions["reducedDebugInfo"] = std::make_shared(false, "Whether to show reduced information on the Debug screen");
+ knownOptions["showSubtitles"] = std::make_shared(false, "If subtitles are shown");
+ knownOptions["directionalAudio"] = std::make_shared(false, "If Directional Audio is enabled");
+ knownOptions["touchscreen"] = std::make_shared(false, "Whether touchscreen controls are used");
+ knownOptions["fullscreen"] = std::make_shared(false, "Whether the game attempts to go fullscreen at startup");
+ knownOptions["bobView"] = std::make_shared(true, "Whether or not the camera bobs up and down as the player walks");
+ knownOptions["toggleCrouch"] = std::make_shared(false, "Whether the sneak key must be pressed or held to activate sneaking");
+ knownOptions["toggleSprint"] = std::make_shared(false, "Whether the sprint key must be pressed or held to activate sprinting");
+ knownOptions["darkMojangStudiosBackground"] = std::make_shared(false, "Whether the Mojang Studios loading screen will appear monochrome");
+ knownOptions["hideLightningFlashes"] = std::make_shared(false, "Hide lightning flashes (visual effect)");
- knownOptions["mouseSensitivity"] = std::shared_ptr(new GameOption(0.5, "How much a mouse movement changes the position of the camera", Range{ 0.0, 1.0 }));
+ knownOptions["mouseSensitivity"] = std::make_shared(0.5, "How much a mouse movement changes the position of the camera", Range{ 0.0, 1.0 });
// FOV: The in-game value is counted in degrees, however, the options.txt isn't. The value is converted into degrees with the following formula: degrees = 40 * value + 70
- knownOptions["fov"] = std::shared_ptr(new GameOption(0.0, "How large the field of view is", Range{ -1.0, 1.0 }));
- knownOptions["screenEffectScale"] = std::shared_ptr(new GameOption(1.0, "Distortion Effects (how intense the effects of Nausea and nether portals are)", Range{ 0.0, 1.0 }));
- knownOptions["fovEffectScale"] = std::shared_ptr(new GameOption(1.0, "FOV Effects (how much the field of view changes when sprinting, having Speed or Slowness etc.)", Range{ 0.0, 1.0 }));
- knownOptions["darknessEffectScale"] = std::shared_ptr(new GameOption(1.0, "Darkness Pulsing (how much the Darkness effect pulses)", Range{ 0.0, 1.0 }));
- knownOptions["gamma"] = std::shared_ptr(new GameOption(0.5, "Brightness", Range{ 0.0, 1.0 }));
- knownOptions["renderDistance"] = std::shared_ptr(new GameOption(12, "The render distance in the chunk radius from the player - Note: The Maximum and default in vanilla is 32 and 12, 16 and 8 on 32bit machines", Range{ 2, 64 }));
- knownOptions["simulationDistance"] = std::shared_ptr(new GameOption(12, "The simulation distance in the chunk radius from the player - Note: The Maximum and default in vanilla is 32 and 12, 16 and 8 on 32bit machines", Range{ 5, 32 }));
- knownOptions["entityDistanceScaling"] = std::shared_ptr(new GameOption(1.0, "The maximum distance from the player that entities render", Range{ 0.5, 5.0 }));
- knownOptions["guiScale"] = std::shared_ptr(new GameOption(0, "Size of interfaces - Note: 0 (Auto) or 1+ for size. Upper limit based on window resolution"));
- knownOptions["particles"] = std::shared_ptr(new GameOption(0, "Amount of particles (such as rain, potion effects, etc.)", Range{ 0, 2 }));
- knownOptions["maxFps"] = std::shared_ptr(new GameOption(120, "The maximum framerate", Range{ 10, 260 }));
- knownOptions["difficulty"] = std::shared_ptr(new GameOption(2, "Has no effect after 1.7.2", Range{ 0, 3 }));
- knownOptions["graphicsMode"] = std::shared_ptr(new GameOption(1, "Whether Fast (less detailed), Fancy (more detailed), or Fabulous! (most detailed) graphics are turned on", Range{ 0, 2 }));
- knownOptions["ao"] = std::shared_ptr(new GameOption(true, "Smooth lighting (Ambient Occlusion)"));
- knownOptions["prioritizeChunkUpdates"] = std::shared_ptr(new GameOption(0, "Chunk section update strategy", Range{ 0, 2 }));
- knownOptions["biomeBlendRadius"] = std::shared_ptr(new GameOption(2, "Radius for which biome blending should happen", Range{ 0, 7 }));
- knownOptions["renderClouds"] = std::shared_ptr(new GameOption("true", "Whether to display clouds", QStringList{ "true", "false", "fast" }));
+ knownOptions["fov"] = std::make_shared(0.0, "How large the field of view is", Range{ -1.0, 1.0 });
+ knownOptions["screenEffectScale"] = std::make_shared(1.0, "Distortion Effects (how intense the effects of Nausea and nether portals are)", Range{ 0.0, 1.0 });
+ knownOptions["fovEffectScale"] = std::make_shared(1.0, "FOV Effects (how much the field of view changes when sprinting, having Speed or Slowness etc.)", Range{ 0.0, 1.0 });
+ knownOptions["darknessEffectScale"] = std::make_shared(1.0, "Darkness Pulsing (how much the Darkness effect pulses)", Range{ 0.0, 1.0 });
+ knownOptions["gamma"] = std::make_shared(0.5, "Brightness", Range{ 0.0, 1.0 });
+ knownOptions["renderDistance"] = std::make_shared(12, "The render distance in the chunk radius from the player - Note: The Maximum and default in vanilla is 32 and 12, 16 and 8 on 32bit machines", Range{ 2, 64 });
+ knownOptions["simulationDistance"] = std::make_shared(12, "The simulation distance in the chunk radius from the player - Note: The Maximum and default in vanilla is 32 and 12, 16 and 8 on 32bit machines", Range{ 5, 32 });
+ knownOptions["entityDistanceScaling"] = std::make_shared(1.0, "The maximum distance from the player that entities render", Range{ 0.5, 5.0 });
+ knownOptions["guiScale"] = std::make_shared(0, "Size of interfaces - Note: 0 (Auto) or 1+ for size. Upper limit based on window resolution");
+ knownOptions["particles"] = std::make_shared(0, "Amount of particles (such as rain, potion effects, etc.)", Range{ 0, 2 });
+ knownOptions["maxFps"] = std::make_shared(120, "The maximum framerate", Range{ 10, 260 });
+ knownOptions["difficulty"] = std::make_shared(2, "Has no effect after 1.7.2", Range{ 0, 3 });
+ knownOptions["graphicsMode"] = std::make_shared(1, "Whether Fast (less detailed), Fancy (more detailed), or Fabulous! (most detailed) graphics are turned on", Range{ 0, 2 });
+ knownOptions["ao"] = std::make_shared(true, "Smooth lighting (Ambient Occlusion)");
+ knownOptions["prioritizeChunkUpdates"] = std::make_shared(0, "Chunk section update strategy", Range{ 0, 2 });
+ knownOptions["biomeBlendRadius"] = std::make_shared(2, "Radius for which biome blending should happen", Range{ 0, 7 });
+ knownOptions["renderClouds"] = std::make_shared("true", "Whether to display clouds", QStringList{ "true", "false", "fast" });
- knownOptions["resourcePacks"] = std::shared_ptr(new GameOption("[]", "A list of active resource packs", QStringList(), false));
- knownOptions["incompatibleResourcePacks"] = std::shared_ptr(new GameOption("[]", "A list of active resource packs that are marked as incompatible with the current Minecraft version.", QStringList(), false));
+ knownOptions["resourcePacks"] = std::make_shared("[]", "A list of active resource packs", QStringList(), false);
+ knownOptions["incompatibleResourcePacks"] = std::make_shared("[]", "A list of active resource packs that are marked as incompatible with the current Minecraft version.", QStringList(), false);
- knownOptions["lastServer"] = std::shared_ptr(new GameOption("", "Address of last server used with Direct Connection"));
- knownOptions["lang"] = std::shared_ptr(new GameOption("en_us", "Language to be used"));
- knownOptions["soundDevice"] = std::shared_ptr(new GameOption("", "Sound device to be used"));
- knownOptions["chatVisibility"] = std::shared_ptr(new GameOption(0, "What is seen in chat", Range{ 0, 2 }));
- knownOptions["chatOpacity"] = std::shared_ptr(new GameOption(1.0, "Opacity of the chat", Range{ 0, 1 }));
- knownOptions["chatLineSpacing"] = std::shared_ptr(new GameOption(0.0, "Spacing between text in chat", Range{ 0, 1 }));
- knownOptions["textBackgroundOpacity"] = std::shared_ptr(new GameOption(0.5, "Opacity of text background", Range{ 0, 1 }));
- knownOptions["backgroundForChatOnly"] = std::shared_ptr(new GameOption(true, "Toggles if the background is only in chat or if it's everywhere"));
- knownOptions["hideServerAddress"] = std::shared_ptr(new GameOption(false, "Has no effect in modern versions"));
- knownOptions["advancedItemTooltips"] = std::shared_ptr(new GameOption(false, "Whether hovering over items in the inventory shows its ID and durability; toggled by pressing F3 + H"));
- knownOptions["pauseOnLostFocus"] = std::shared_ptr(new GameOption(true, "Whether switching out of Minecraft without pressing Esc or opening an in-game interface automatically pauses the game; toggled by pressing F3 + P"));
- knownOptions["overrideWidth"] = std::shared_ptr(new GameOption(0, "Width to open Minecraft with in pixels (0 means default to the Minecraft settings); no in-game control"));
- knownOptions["overrideHeight"] = std::shared_ptr(new GameOption(0, "Height to open Minecraft with in pixels (0 means default to the Minecraft settings); no in-game control"));
- knownOptions["heldItemTooltips"] = std::shared_ptr(new GameOption(true, "Whether switching between items shows the name of the item; no in-game control"));
- knownOptions["chatHeightFocused"] = std::shared_ptr(new GameOption(1.0, "How tall the chat span is", Range{ 0, 1 }));
- knownOptions["chatDelay"] = std::shared_ptr(new GameOption(0.0, "How much delay there is between text", Range{ 0, 6 }));
- knownOptions["chatHeightUnfocused"] = std::shared_ptr(new GameOption(0.4375, "How tall the maximum chat span is, when the chat button is not pressed", Range{ 0, 1 }));
- knownOptions["chatScale"] = std::shared_ptr(new GameOption(1.0, "The scale/size of the text in the chat", Range{ 0, 1 }));
- knownOptions["chatWidth"] = std::shared_ptr(new GameOption(1.0, "The span width of the chat", Range{ 0, 1 }));
- knownOptions["mipmapLevels"] = std::shared_ptr(new GameOption(4, "Amount by which distant textures are smoothed", Range{0, 4}));
- knownOptions["useNativeTransport"] = std::shared_ptr(new GameOption(true, "Whether to use a Netty EpollSocketChannel for connections to servers instead of a NioSocketChannel (only applies if EPOLL is available on the user's system)"));
- knownOptions["mainHand"] = std::shared_ptr(new GameOption("right", "Whether the main hand appears as left or right", QStringList{ "left", "right" }));
- knownOptions["attackIndicator"] = std::shared_ptr(new GameOption(1, "When hitting, how the attack indicator is shown on screen", Range{ 0, 2 }));
- knownOptions["narrator"] = std::shared_ptr(new GameOption(0, "Setting of the Narrator", Range{ 0, 3 }));
- knownOptions["tutorialStep"] = std::shared_ptr(new GameOption("movement", "Next stage of tutorial hints to display",
- QStringList{ "movement", "find_tree", "punch_tree", "open_inventory", "craft_planks", "none" }));
- knownOptions["mouseWheelSensitivity"] = std::shared_ptr(new GameOption(1.0f, "Allows making the mouse wheel more sensitive (see MC-123773)", Range{ 1.0f, 10.0f }));
- knownOptions["rawMouseInput"] = std::shared_ptr(new GameOption(true, "Ignores acceleration set by the operating system"));
- knownOptions["glDebugVerbosity"] = std::shared_ptr(new GameOption(1, "LWJGL log info level (only on some machines)", Range{ 0, 4 }));
- knownOptions["skipMultiplayerWarning"] = std::shared_ptr(new GameOption(true, "Whether to skip the legal disclaimer when entering the multiplayer screen"));
- knownOptions["skipRealms32bitWarning"] = std::shared_ptr(new GameOption(true, "Whether to skip the 32-bit environment warning when entering the Realms screen"));
- knownOptions["hideMatchedNames"] = std::shared_ptr(new GameOption(true, "Some servers send chat messages in non-standard formats. With this option on, the game will attempt to apply chat hiding anyway by matching the text in messages."));
- knownOptions["joinedFirstServer"] = std::shared_ptr(new GameOption(true, "Whether the player has joined a server before. If false, the Social Interactions tutorial hint will appear when joining a server."));
- knownOptions["hideBundleTutorial"] = std::shared_ptr(new GameOption(true, "Whether the player has seen the bundle tutorial hint when trying to use a bundle."));
- knownOptions["syncChunkWrites"] = std::shared_ptr(new GameOption(true, "Whether to open region files in synchronous mode"));
- knownOptions["showAutosaveIndicator"] = std::shared_ptr(new GameOption(true, "Whether to show autosave indicator on the right-bottom of the screen"));
- knownOptions["allowServerListing"] = std::shared_ptr(new GameOption(true, "Whether to allow player's ID to be shown in the player list shown on the multiplayer screen"));
+ knownOptions["lastServer"] = std::make_shared("", "Address of last server used with Direct Connection");
+ knownOptions["lang"] = std::make_shared("en_us", "Language to be used");
+ knownOptions["soundDevice"] = std::make_shared("", "Sound device to be used");
+ knownOptions["chatVisibility"] = std::make_shared(0, "What is seen in chat", Range{ 0, 2 });
+ knownOptions["chatOpacity"] = std::make_shared(1.0, "Opacity of the chat", Range{ 0, 1 });
+ knownOptions["chatLineSpacing"] = std::make_shared(0.0, "Spacing between text in chat", Range{ 0, 1 });
+ knownOptions["textBackgroundOpacity"] = std::make_shared(0.5, "Opacity of text background", Range{ 0, 1 });
+ knownOptions["backgroundForChatOnly"] = std::make_shared(true, "Toggles if the background is only in chat or if it's everywhere");
+ knownOptions["hideServerAddress"] = std::make_shared(false, "Has no effect in modern versions");
+ knownOptions["advancedItemTooltips"] = std::make_shared(false, "Whether hovering over items in the inventory shows its ID and durability; toggled by pressing F3 + H");
+ knownOptions["pauseOnLostFocus"] = std::make_shared(true, "Whether switching out of Minecraft without pressing Esc or opening an in-game interface automatically pauses the game; toggled by pressing F3 + P");
+ knownOptions["overrideWidth"] = std::make_shared(0, "Width to open Minecraft with in pixels (0 means default to the Minecraft settings); no in-game control");
+ knownOptions["overrideHeight"] = std::make_shared(0, "Height to open Minecraft with in pixels (0 means default to the Minecraft settings); no in-game control");
+ knownOptions["heldItemTooltips"] = std::make_shared(true, "Whether switching between items shows the name of the item; no in-game control");
+ knownOptions["chatHeightFocused"] = std::make_shared(1.0, "How tall the chat span is", Range{ 0, 1 });
+ knownOptions["chatDelay"] = std::make_shared(0.0, "How much delay there is between text", Range{ 0, 6 });
+ knownOptions["chatHeightUnfocused"] = std::make_shared(0.4375, "How tall the maximum chat span is, when the chat button is not pressed", Range{ 0, 1 });
+ knownOptions["chatScale"] = std::make_shared(1.0, "The scale/size of the text in the chat", Range{ 0, 1 });
+ knownOptions["chatWidth"] = std::make_shared(1.0, "The span width of the chat", Range{ 0, 1 });
+ knownOptions["mipmapLevels"] = std::make_shared(4, "Amount by which distant textures are smoothed", Range{0, 4});
+ knownOptions["useNativeTransport"] = std::make_shared(true, "Whether to use a Netty EpollSocketChannel for connections to servers instead of a NioSocketChannel (only applies if EPOLL is available on the user's system)");
+ knownOptions["mainHand"] = std::make_shared("right", "Whether the main hand appears as left or right", QStringList{ "left", "right" });
+ knownOptions["attackIndicator"] = std::make_shared(1, "When hitting, how the attack indicator is shown on screen", Range{ 0, 2 });
+ knownOptions["narrator"] = std::make_shared(0, "Setting of the Narrator", Range{ 0, 3 });
+ knownOptions["tutorialStep"] = std::make_shared("movement", "Next stage of tutorial hints to display",
+ QStringList{ "movement", "find_tree", "punch_tree", "open_inventory", "craft_planks", "none" });
+ knownOptions["mouseWheelSensitivity"] = std::make_shared(1.0f, "Allows making the mouse wheel more sensitive (see MC-123773)", Range{ 1.0f, 10.0f });
+ knownOptions["rawMouseInput"] = std::make_shared(true, "Ignores acceleration set by the operating system");
+ knownOptions["glDebugVerbosity"] = std::make_shared(1, "LWJGL log info level (only on some machines)", Range{ 0, 4 });
+ knownOptions["skipMultiplayerWarning"] = std::make_shared(true, "Whether to skip the legal disclaimer when entering the multiplayer screen");
+ knownOptions["skipRealms32bitWarning"] = std::make_shared(true, "Whether to skip the 32-bit environment warning when entering the Realms screen");
+ knownOptions["hideMatchedNames"] = std::make_shared(true, "Some servers send chat messages in non-standard formats. With this option on, the game will attempt to apply chat hiding anyway by matching the text in messages.");
+ knownOptions["joinedFirstServer"] = std::make_shared(true, "Whether the player has joined a server before. If false, the Social Interactions tutorial hint will appear when joining a server.");
+ knownOptions["hideBundleTutorial"] = std::make_shared(true, "Whether the player has seen the bundle tutorial hint when trying to use a bundle.");
+ knownOptions["syncChunkWrites"] = std::make_shared(true, "Whether to open region files in synchronous mode");
+ knownOptions["showAutosaveIndicator"] = std::make_shared(true, "Whether to show autosave indicator on the right-bottom of the screen");
+ knownOptions["allowServerListing"] = std::make_shared(true, "Whether to allow player's ID to be shown in the player list shown on the multiplayer screen");
// Keys Binds
- knownOptions["key_key.attack"] = std::shared_ptr(new GameOption("key.mouse.left", "Attack control", OptionType::KeyBind));
- knownOptions["key_key.use"] = std::shared_ptr(new GameOption("key.mouse.right", "Use Item control", OptionType::KeyBind));
- knownOptions["key_key.forward"] = std::shared_ptr(new GameOption("key.keyboard.w", "Forward control ", OptionType::KeyBind));
- knownOptions["key_key.left"] = std::shared_ptr(new GameOption("key.keyboard.a", "Left control", OptionType::KeyBind));
- knownOptions["key_key.back"] = std::shared_ptr