diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index 85ca816ff..41af515ed 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -1015,21 +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 + ui/widgets/GameOptions/GameOptionWidget.h + ui/widgets/GameOptions/GameOptionWidgetSlider.h + ui/widgets/GameOptions/GameOptionWidgetSlider.cpp + ui/widgets/GameOptions/GameOptionWidgetComboBox.h + ui/widgets/GameOptions/GameOptionWidgetComboBox.cpp + ui/widgets/GameOptions/GameOptionWidgetCheckBox.h + ui/widgets/GameOptions/GameOptionWidgetCheckBox.cpp + ui/widgets/GameOptions/GameOptionWidgetSpinnerFloat.h + ui/widgets/GameOptions/GameOptionWidgetSpinnerFloat.cpp + ui/widgets/GameOptions/GameOptionWidgetSpinnerInt.h + ui/widgets/GameOptions/GameOptionWidgetSpinnerInt.cpp + ui/widgets/GameOptions/GameOptionWidgetText.h + ui/widgets/GameOptions/GameOptionWidgetText.cpp + ui/widgets/GameOptions/GameOptionWidgetKeyBind.h + ui/widgets/GameOptions/GameOptionWidgetKeyBind.cpp # GUI - instance group view ui/instanceview/InstanceProxyModel.cpp @@ -1083,13 +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/widgets/GameOptions/GameOptionWidgetSlider.ui + ui/widgets/GameOptions/GameOptionWidgetComboBox.ui + ui/widgets/GameOptions/GameOptionWidgetCheckBox.ui + ui/widgets/GameOptions/GameOptionWidgetSpinnerFloat.ui + ui/widgets/GameOptions/GameOptionWidgetSpinnerInt.ui + ui/widgets/GameOptions/GameOptionWidgetText.ui + ui/widgets/GameOptions/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 d65285e4c..dcf89a9cd 100644 --- a/launcher/minecraft/gameoptions/GameOptionDelegate.cpp +++ b/launcher/minecraft/gameoptions/GameOptionDelegate.cpp @@ -16,14 +16,14 @@ * 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 "ui/widgets/GameOptions/GameOptionWidget.h" +#include "ui/widgets/GameOptions/GameOptionWidgetCheckBox.h" +#include "ui/widgets/GameOptions/GameOptionWidgetComboBox.h" +#include "ui/widgets/GameOptions/GameOptionWidgetKeyBind.h" +#include "ui/widgets/GameOptions/GameOptionWidgetSlider.h" +#include "ui/widgets/GameOptions/GameOptionWidgetSpinnerFloat.h" +#include "ui/widgets/GameOptions/GameOptionWidgetSpinnerInt.h" +#include "ui/widgets/GameOptions/GameOptionWidgetText.h" #include @@ -94,4 +94,8 @@ void GameOptionDelegate::setModelData(QWidget* editor, QAbstractItemModel* model } else { qDebug() << "[GameOptions] Saving widget data to Model failed because widget was null"; } -} \ No newline at end of file +} +QSize GameOptionDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const +{ + return QSize(option.widget->height(), option.widget->width()); +} diff --git a/launcher/minecraft/gameoptions/GameOptionDelegate.h b/launcher/minecraft/gameoptions/GameOptionDelegate.h index 5993ba603..2b67fc78d 100644 --- a/launcher/minecraft/gameoptions/GameOptionDelegate.h +++ b/launcher/minecraft/gameoptions/GameOptionDelegate.h @@ -37,6 +37,7 @@ class GameOptionDelegate : public QStyledItemDelegate { const QStyleOptionViewItem& option, const QModelIndex& index) const override; void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const override; + QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override; enum GameOptionWidgetType { slider, text, keybind, number, comboBox }; diff --git a/launcher/ui/widgets/GameOptionWidget.h b/launcher/ui/widgets/GameOptions/GameOptionWidget.h similarity index 100% rename from launcher/ui/widgets/GameOptionWidget.h rename to launcher/ui/widgets/GameOptions/GameOptionWidget.h diff --git a/launcher/ui/widgets/GameOptionWidgetCheckBox.cpp b/launcher/ui/widgets/GameOptions/GameOptionWidgetCheckBox.cpp similarity index 100% rename from launcher/ui/widgets/GameOptionWidgetCheckBox.cpp rename to launcher/ui/widgets/GameOptions/GameOptionWidgetCheckBox.cpp diff --git a/launcher/ui/widgets/GameOptionWidgetCheckBox.h b/launcher/ui/widgets/GameOptions/GameOptionWidgetCheckBox.h similarity index 100% rename from launcher/ui/widgets/GameOptionWidgetCheckBox.h rename to launcher/ui/widgets/GameOptions/GameOptionWidgetCheckBox.h diff --git a/launcher/ui/widgets/GameOptionWidgetCheckBox.ui b/launcher/ui/widgets/GameOptions/GameOptionWidgetCheckBox.ui similarity index 100% rename from launcher/ui/widgets/GameOptionWidgetCheckBox.ui rename to launcher/ui/widgets/GameOptions/GameOptionWidgetCheckBox.ui diff --git a/launcher/ui/widgets/GameOptionWidgetComboBox.cpp b/launcher/ui/widgets/GameOptions/GameOptionWidgetComboBox.cpp similarity index 100% rename from launcher/ui/widgets/GameOptionWidgetComboBox.cpp rename to launcher/ui/widgets/GameOptions/GameOptionWidgetComboBox.cpp diff --git a/launcher/ui/widgets/GameOptionWidgetComboBox.h b/launcher/ui/widgets/GameOptions/GameOptionWidgetComboBox.h similarity index 100% rename from launcher/ui/widgets/GameOptionWidgetComboBox.h rename to launcher/ui/widgets/GameOptions/GameOptionWidgetComboBox.h diff --git a/launcher/ui/widgets/GameOptionWidgetComboBox.ui b/launcher/ui/widgets/GameOptions/GameOptionWidgetComboBox.ui similarity index 100% rename from launcher/ui/widgets/GameOptionWidgetComboBox.ui rename to launcher/ui/widgets/GameOptions/GameOptionWidgetComboBox.ui diff --git a/launcher/ui/widgets/GameOptionWidgetKeyBind.cpp b/launcher/ui/widgets/GameOptions/GameOptionWidgetKeyBind.cpp similarity index 100% rename from launcher/ui/widgets/GameOptionWidgetKeyBind.cpp rename to launcher/ui/widgets/GameOptions/GameOptionWidgetKeyBind.cpp diff --git a/launcher/ui/widgets/GameOptionWidgetKeyBind.h b/launcher/ui/widgets/GameOptions/GameOptionWidgetKeyBind.h similarity index 100% rename from launcher/ui/widgets/GameOptionWidgetKeyBind.h rename to launcher/ui/widgets/GameOptions/GameOptionWidgetKeyBind.h diff --git a/launcher/ui/widgets/GameOptionWidgetKeyBind.ui b/launcher/ui/widgets/GameOptions/GameOptionWidgetKeyBind.ui similarity index 100% rename from launcher/ui/widgets/GameOptionWidgetKeyBind.ui rename to launcher/ui/widgets/GameOptions/GameOptionWidgetKeyBind.ui diff --git a/launcher/ui/widgets/GameOptionWidgetSlider.cpp b/launcher/ui/widgets/GameOptions/GameOptionWidgetSlider.cpp similarity index 95% rename from launcher/ui/widgets/GameOptionWidgetSlider.cpp rename to launcher/ui/widgets/GameOptions/GameOptionWidgetSlider.cpp index 47d323ff5..24533ad0d 100644 --- a/launcher/ui/widgets/GameOptionWidgetSlider.cpp +++ b/launcher/ui/widgets/GameOptions/GameOptionWidgetSlider.cpp @@ -89,3 +89,11 @@ void GameOptionWidgetSlider::saveEditorData(GameOptionItem optionItem) { break; } } + +QSize GameOptionWidgetSlider::sizeHint() const +{ + QSize size = GameOptionWidget::sizeHint(); + size.setHeight(size.height() * 2); + return size; +} + diff --git a/launcher/ui/widgets/GameOptionWidgetSlider.h b/launcher/ui/widgets/GameOptions/GameOptionWidgetSlider.h similarity index 96% rename from launcher/ui/widgets/GameOptionWidgetSlider.h rename to launcher/ui/widgets/GameOptions/GameOptionWidgetSlider.h index ce9a6fcb1..81cc4833e 100644 --- a/launcher/ui/widgets/GameOptionWidgetSlider.h +++ b/launcher/ui/widgets/GameOptions/GameOptionWidgetSlider.h @@ -32,6 +32,7 @@ class GameOptionWidgetSlider : public GameOptionWidget { ~GameOptionWidgetSlider() override; void setEditorData(GameOptionItem optionItem); void saveEditorData(GameOptionItem optionItem) override; + QSize sizeHint() const override; private: Ui::GameOptionWidgetSlider* ui; diff --git a/launcher/ui/widgets/GameOptionWidgetSlider.ui b/launcher/ui/widgets/GameOptions/GameOptionWidgetSlider.ui similarity index 100% rename from launcher/ui/widgets/GameOptionWidgetSlider.ui rename to launcher/ui/widgets/GameOptions/GameOptionWidgetSlider.ui diff --git a/launcher/ui/widgets/GameOptionWidgetSpinnerFloat.cpp b/launcher/ui/widgets/GameOptions/GameOptionWidgetSpinnerFloat.cpp similarity index 100% rename from launcher/ui/widgets/GameOptionWidgetSpinnerFloat.cpp rename to launcher/ui/widgets/GameOptions/GameOptionWidgetSpinnerFloat.cpp diff --git a/launcher/ui/widgets/GameOptionWidgetSpinnerFloat.h b/launcher/ui/widgets/GameOptions/GameOptionWidgetSpinnerFloat.h similarity index 100% rename from launcher/ui/widgets/GameOptionWidgetSpinnerFloat.h rename to launcher/ui/widgets/GameOptions/GameOptionWidgetSpinnerFloat.h diff --git a/launcher/ui/widgets/GameOptionWidgetSpinnerFloat.ui b/launcher/ui/widgets/GameOptions/GameOptionWidgetSpinnerFloat.ui similarity index 100% rename from launcher/ui/widgets/GameOptionWidgetSpinnerFloat.ui rename to launcher/ui/widgets/GameOptions/GameOptionWidgetSpinnerFloat.ui diff --git a/launcher/ui/widgets/GameOptionWidgetSpinnerInt.cpp b/launcher/ui/widgets/GameOptions/GameOptionWidgetSpinnerInt.cpp similarity index 100% rename from launcher/ui/widgets/GameOptionWidgetSpinnerInt.cpp rename to launcher/ui/widgets/GameOptions/GameOptionWidgetSpinnerInt.cpp diff --git a/launcher/ui/widgets/GameOptionWidgetSpinnerInt.h b/launcher/ui/widgets/GameOptions/GameOptionWidgetSpinnerInt.h similarity index 100% rename from launcher/ui/widgets/GameOptionWidgetSpinnerInt.h rename to launcher/ui/widgets/GameOptions/GameOptionWidgetSpinnerInt.h diff --git a/launcher/ui/widgets/GameOptionWidgetSpinnerInt.ui b/launcher/ui/widgets/GameOptions/GameOptionWidgetSpinnerInt.ui similarity index 100% rename from launcher/ui/widgets/GameOptionWidgetSpinnerInt.ui rename to launcher/ui/widgets/GameOptions/GameOptionWidgetSpinnerInt.ui diff --git a/launcher/ui/widgets/GameOptionWidgetText.cpp b/launcher/ui/widgets/GameOptions/GameOptionWidgetText.cpp similarity index 100% rename from launcher/ui/widgets/GameOptionWidgetText.cpp rename to launcher/ui/widgets/GameOptions/GameOptionWidgetText.cpp diff --git a/launcher/ui/widgets/GameOptionWidgetText.h b/launcher/ui/widgets/GameOptions/GameOptionWidgetText.h similarity index 100% rename from launcher/ui/widgets/GameOptionWidgetText.h rename to launcher/ui/widgets/GameOptions/GameOptionWidgetText.h diff --git a/launcher/ui/widgets/GameOptionWidgetText.ui b/launcher/ui/widgets/GameOptions/GameOptionWidgetText.ui similarity index 100% rename from launcher/ui/widgets/GameOptionWidgetText.ui rename to launcher/ui/widgets/GameOptions/GameOptionWidgetText.ui