Small Refactor (move all related widgets to subfolder)

Signed-off-by: Tayou <tayou@gmx.net>
This commit is contained in:
Tayou 2023-05-19 20:36:49 +02:00 committed by Tayou
parent 3949f52f1d
commit 8a6c0e7314
No known key found for this signature in database
GPG Key ID: 02CA43C1CB6E9887
25 changed files with 45 additions and 31 deletions

View File

@ -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

View File

@ -16,14 +16,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#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 <QDebug>
@ -94,4 +94,8 @@ void GameOptionDelegate::setModelData(QWidget* editor, QAbstractItemModel* model
} else {
qDebug() << "[GameOptions] Saving widget data to Model failed because widget was null";
}
}
}
QSize GameOptionDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const
{
return QSize(option.widget->height(), option.widget->width());
}

View File

@ -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 };

View File

@ -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;
}

View File

@ -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;