NOISSUE first step towards having game options management
This commit is contained in:
@ -84,6 +84,8 @@ SET(MULTIMC_SOURCES
|
||||
pages/BasePageProvider.h
|
||||
|
||||
# GUI - instance pages
|
||||
pages/instance/GameOptionsPage.cpp
|
||||
pages/instance/GameOptionsPage.h
|
||||
pages/instance/VersionPage.cpp
|
||||
pages/instance/VersionPage.h
|
||||
pages/instance/TexturePackPage.h
|
||||
@ -229,6 +231,7 @@ SET(MULTIMC_SOURCES
|
||||
######## UIs ########
|
||||
SET(MULTIMC_UIS
|
||||
# Instance pages
|
||||
pages/instance/GameOptionsPage.ui
|
||||
pages/instance/VersionPage.ui
|
||||
pages/instance/ModFolderPage.ui
|
||||
pages/instance/LogPage.ui
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "pages/instance/LegacyUpgradePage.h"
|
||||
#include "pages/instance/WorldListPage.h"
|
||||
#include "pages/instance/ServersPage.h"
|
||||
#include "pages/instance/GameOptionsPage.h"
|
||||
|
||||
#include "Env.h"
|
||||
|
||||
@ -46,6 +47,7 @@ public:
|
||||
values.append(new NotesPage(onesix.get()));
|
||||
values.append(new WorldListPage(onesix.get(), onesix->worldList(), "worlds", "worlds", tr("Worlds"), "Worlds"));
|
||||
values.append(new ServersPage(onesix.get()));
|
||||
values.append(new GameOptionsPage(onesix.get()));
|
||||
values.append(new ScreenshotsPage(FS::PathCombine(onesix->gameRoot(), "screenshots")));
|
||||
values.append(new InstanceSettingsPage(onesix.get()));
|
||||
}
|
||||
|
40
application/pages/instance/GameOptionsPage.cpp
Normal file
40
application/pages/instance/GameOptionsPage.cpp
Normal file
@ -0,0 +1,40 @@
|
||||
#include "GameOptionsPage.h"
|
||||
#include "ui_GameOptionsPage.h"
|
||||
#include "minecraft/MinecraftInstance.h"
|
||||
#include "minecraft/gameoptions/GameOptions.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();
|
||||
}
|
||||
|
||||
#include "GameOptionsPage.moc"
|
||||
|
63
application/pages/instance/GameOptionsPage.h
Normal file
63
application/pages/instance/GameOptionsPage.h
Normal file
@ -0,0 +1,63 @@
|
||||
/* Copyright 2013-2019 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 <QWidget>
|
||||
#include <QString>
|
||||
|
||||
#include "pages/BasePage.h"
|
||||
#include <MultiMC.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class GameOptionsPage;
|
||||
}
|
||||
|
||||
class GameOptions;
|
||||
class MinecraftInstance;
|
||||
|
||||
class GameOptionsPage : public QWidget, public BasePage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit GameOptionsPage(MinecraftInstance *inst, QWidget *parent = 0);
|
||||
virtual ~GameOptionsPage();
|
||||
|
||||
void openedImpl() override;
|
||||
void closedImpl() override;
|
||||
|
||||
virtual QString displayName() const override
|
||||
{
|
||||
return tr("Game Options");
|
||||
}
|
||||
virtual QIcon icon() const override
|
||||
{
|
||||
return MMC->getThemedIcon("settings");
|
||||
}
|
||||
virtual QString id() const override
|
||||
{
|
||||
return "gameoptions";
|
||||
}
|
||||
virtual QString helpPage() const override
|
||||
{
|
||||
return "Game-Options-management";
|
||||
}
|
||||
|
||||
private: // data
|
||||
Ui::GameOptionsPage *ui = nullptr;
|
||||
std::shared_ptr<GameOptions> m_model;
|
||||
};
|
88
application/pages/instance/GameOptionsPage.ui
Normal file
88
application/pages/instance/GameOptionsPage.ui
Normal file
@ -0,0 +1,88 @@
|
||||
<?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>
|
Reference in New Issue
Block a user