1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-04 20:45:34 +00:00

GUI added, but not yet functional.

This commit is contained in:
cc9cii 2014-09-16 07:44:07 +10:00
parent ecb4154ac0
commit ffaca7a875
9 changed files with 535 additions and 7 deletions

View file

@ -99,7 +99,7 @@ opencs_units_noqt (view/tools
opencs_units (view/settings
settingwindow
dialog
settingsdialog
page
view
booleanview
@ -142,6 +142,7 @@ set (OPENCS_RES ${CMAKE_SOURCE_DIR}/files/opencs/resources.qrc
set (OPENCS_UI
${CMAKE_SOURCE_DIR}/files/ui/contentselector.ui
${CMAKE_SOURCE_DIR}/files/ui/filedialog.ui
${CMAKE_SOURCE_DIR}/files/ui/settingstab.ui
)
source_group (opencs FILES ${OPENCS_SRC} ${OPENCS_HDR})

View file

@ -28,7 +28,7 @@ CS::Editor::Editor (OgreInit::OgreInit& ogreInit)
setupDataFiles (config.first);
CSMSettings::UserSettings::instance().loadSettings ("opencs.ini");
mSettings.setModel (CSMSettings::UserSettings::instance());
//mSettings.setModel (CSMSettings::UserSettings::instance());
ogreInit.init ((mCfgMgr.getUserConfigPath() / "opencsOgre.log").string());
@ -189,7 +189,7 @@ void CS::Editor::createNewFile (const boost::filesystem::path &savePath)
files.push_back(path.toUtf8().constData());
}
files.push_back(mFileDialog.filename().toUtf8().constData());
files.push_back (savePath);
mDocumentManager.addDocument (files, savePath, true);

View file

@ -26,7 +26,7 @@
#include "view/doc/filedialog.hpp"
#include "view/doc/newgame.hpp"
#include "view/settings/dialog.hpp"
#include "view/settings/settingsdialog.hpp"
namespace OgreInit
{
@ -46,7 +46,7 @@ namespace CS
CSVDoc::ViewManager mViewManager;
CSVDoc::StartupDialogue mStartup;
CSVDoc::NewGameDialogue mNewGame;
CSVSettings::Dialog mSettings;
CSVSettings::SettingsDialog mSettings;
CSVDoc::FileDialog mFileDialog;
boost::filesystem::path mLocal;
boost::filesystem::path mResources;

View file

@ -40,6 +40,8 @@ CSMSettings::UserSettings::UserSettings (const Files::ConfigurationManager& conf
mUserSettingsInstance = this;
buildSettingModelDefaults();
// for overriding opencs.ini settings with those from settings.cfg
mSettingCfgDefinitions = new QSettings(QSettings::IniFormat, QSettings::UserScope, "", QString(), this);
}

View file

@ -0,0 +1,126 @@
#include "settingsdialog.hpp"
#include <QListWidgetItem>
#include <QApplication>
#include <QWidget>
#include <QStackedWidget>
#include <QtGui>
#include "../../model/settings/usersettings.hpp"
#include "page.hpp"
#include <QApplication>
#include <QSplitter>
#include <QTreeView>
#include <QListView>
#include <QTableView>
#include <QStandardItemModel>
#include <QStandardItem>
CSVSettings::SettingsDialog::SettingsDialog(QMainWindow *parent)
: /*mStackedWidget (0),*/ mDebugMode (false), SettingWindow (parent)
{
setWindowTitle(QString::fromUtf8 ("User Settings"));
setupUi(this);
//setupDialog();
//connect (mPageListWidget,
//SIGNAL (currentItemChanged(QListWidgetItem*, QListWidgetItem*)),
//this,
//SLOT (slotChangePage (QListWidgetItem*, QListWidgetItem*)));
}
void CSVSettings::SettingsDialog::slotChangePage
(QListWidgetItem *cur, QListWidgetItem *prev)
{
//mStackedWidget->changePage
//(mPageListWidget->row (cur), mPageListWidget->row (prev));
layout()->activate();
setFixedSize(minimumSizeHint());
}
void CSVSettings::SettingsDialog::setupDialog()
{
//create central widget with it's layout and immediate children
QWidget *centralWidget = new QGroupBox (this);
centralWidget->setLayout (new QHBoxLayout());
centralWidget->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Preferred);
//setCentralWidget (centralWidget);
//setDockOptions (QMainWindow::AllowNestedDocks);
buildPageListWidget (centralWidget);
buildStackedWidget (centralWidget);
}
void CSVSettings::SettingsDialog::buildPages()
{
SettingWindow::createPages ();
#if 0
QFontMetrics fm (QApplication::font());
foreach (Page *page, SettingWindow::pages())
{
QString pageName = page->objectName();
//int textWidth = fm.width(pageName);
//new QListWidgetItem (pageName, mPageListWidget);
//mPageListWidget->setFixedWidth (textWidth + 50);
//mStackedWidget->addWidget (&dynamic_cast<QWidget &>(*(page)));
}
//resize (mStackedWidget->sizeHint());
#endif
}
void CSVSettings::SettingsDialog::buildPageListWidget (QWidget *centralWidget)
{
//mPageListWidget = new QListWidget (centralWidget);
//mPageListWidget->setMinimumWidth(50);
//mPageListWidget->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Expanding);
//mPageListWidget->setSelectionBehavior (QAbstractItemView::SelectItems);
//centralWidget->layout()->addWidget(mPageListWidget);
}
void CSVSettings::SettingsDialog::buildStackedWidget (QWidget *centralWidget)
{
//mStackedWidget = new ResizeableStackedWidget (centralWidget);
//centralWidget->layout()->addWidget (mStackedWidget);
}
void CSVSettings::SettingsDialog::closeEvent (QCloseEvent *event)
{
//SettingWindow::closeEvent() must be called first to ensure
//model is updated
//SettingWindow::closeEvent (event);
//saveSettings();
}
void CSVSettings::SettingsDialog::show()
{
//if (pages().isEmpty())
{
//buildPages();
//setViewValues();
}
//if(
QPoint screenCenter = QApplication::desktop()->screenGeometry().center();
move (screenCenter - geometry().center());
QWidget::show();
}

View file

@ -0,0 +1,56 @@
#ifndef CSVSETTINGS_SETTINGSDIALOG_H
#define CSVSETTINGS_SETTINGSDIALOG_H
#include "settingwindow.hpp"
//#include "resizeablestackedwidget.hpp"
#include <QStandardItem>
#include "ui_settingstab.h"
//class QStackedWidget;
//class QListWidget;
class QListWidgetItem;
namespace CSVSettings {
//class Page;
class SettingsDialog : public SettingWindow, private Ui::TabWidget
{
Q_OBJECT
//QListWidget *mPageListWidget;
//ResizeableStackedWidget *mStackedWidget;
bool mDebugMode;
public:
/*explicit*/ SettingsDialog (QMainWindow *parent = 0);
///Enables setting debug mode. When the dialog opens, a page is created
///which displays the SettingModel's contents in a Tree view.
void enableDebugMode (bool state, QStandardItemModel *model = 0);
protected:
/// Settings are written on close
void closeEvent (QCloseEvent *event);
void setupDialog();
private:
void buildPages();
void buildPageListWidget (QWidget *centralWidget);
void buildStackedWidget (QWidget *centralWidget);
public slots:
void show();
private slots:
void slotChangePage (QListWidgetItem *, QListWidgetItem *);
};
}
#endif // CSVSETTINGS_SETTINGSDIALOG_H

View file

@ -9,7 +9,7 @@
#include "view.hpp"
CSVSettings::SettingWindow::SettingWindow(QWidget *parent)
: QMainWindow(parent)
: QTabWidget(parent)
{}
void CSVSettings::SettingWindow::createPages()

View file

@ -18,7 +18,7 @@ namespace CSVSettings {
typedef QList <Page *> PageList;
class SettingWindow : public QMainWindow
class SettingWindow : public QTabWidget
{
Q_OBJECT

343
files/ui/settingstab.ui Normal file
View file

@ -0,0 +1,343 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TabWidget</class>
<widget class="QTabWidget" name="TabWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>User Settings</string>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="VideoSettings">
<attribute name="title">
<string>Video Settings</string>
</attribute>
<widget class="QWidget" name="layoutWidget_Screen">
<property name="geometry">
<rect>
<x>20</x>
<y>181</y>
<width>351</width>
<height>71</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_Screen">
<item row="1" column="1">
<widget class="QRadioButton" name="radioButton_standard_res">
<property name="text">
<string>Standard:</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_Resolution">
<property name="text">
<string>Resolution</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="checkBox_fullscreen">
<property name="text">
<string>Full Screen</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QRadioButton" name="radioButton_custom_res">
<property name="text">
<string>Custom;</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
<item row="1" column="2" colspan="2">
<widget class="QComboBox" name="comboBox_std_window_size">
<property name="minimumSize">
<size>
<width>180</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QSpinBox" name="spinBox_x">
<property name="maximumSize">
<size>
<width>186</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QSpinBox" name="spinBox_y"/>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="renderGroup">
<property name="geometry">
<rect>
<x>10</x>
<y>8</y>
<width>371</width>
<height>153</height>
</rect>
</property>
<property name="title">
<string>Render System</string>
</property>
</widget>
<widget class="QGroupBox" name="displayGroup">
<property name="geometry">
<rect>
<x>10</x>
<y>165</y>
<width>371</width>
<height>99</height>
</rect>
</property>
<property name="title">
<string>Display</string>
</property>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>21</x>
<y>26</y>
<width>351</width>
<height>125</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="checkBox_override">
<property name="minimumSize">
<size>
<width>0</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>Use Render System Settings from OpenMW</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_RenderingSubsystem">
<property name="text">
<string>Rendering Subsystem</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBox_rendersystem">
<property name="editable">
<bool>false</bool>
</property>
<item>
<property name="text">
<string>OpenGL Rendering Subsystem</string>
</property>
</item>
<item>
<property name="text">
<string>Direct3D9 Rendering Subsystem</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkBox_vsync">
<property name="text">
<string>Vertical Sync</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_Antialiasing">
<property name="text">
<string>Antialiasing</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="comboBox_antialiasing">
<item>
<property name="text">
<string>Off</string>
</property>
</item>
<item>
<property name="text">
<string>MSAA 2</string>
</property>
</item>
<item>
<property name="text">
<string>MSAA 4</string>
</property>
</item>
<item>
<property name="text">
<string>MSAA 8</string>
</property>
</item>
<item>
<property name="text">
<string>MSAA 8 (Quality)</string>
</property>
</item>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_ShaderLanguage">
<property name="text">
<string>Shader Language</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="comboBox_shaderlanguage">
<item>
<property name="text">
<string>HLSL</string>
</property>
</item>
<item>
<property name="text">
<string>CG</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
<zorder>renderGroup</zorder>
<zorder>layoutWidget</zorder>
<zorder>displayGroup</zorder>
<zorder>layoutWidget_Screen</zorder>
</widget>
<widget class="QWidget" name="DisplaySetttings">
<attribute name="title">
<string>Display Settings</string>
</attribute>
<widget class="QWidget" name="layoutWidget2">
<property name="geometry">
<rect>
<x>20</x>
<y>30</y>
<width>351</width>
<height>116</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_Subview">
<item row="1" column="0">
<widget class="QLabel" name="label_MaxSubviews">
<property name="text">
<string>Max Number of Subviews</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_MinSubviewWidth">
<property name="text">
<string>Min Subview Width</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="checkBox_reuse_subview">
<property name="text">
<string>Reuse Subviews</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBox_show_icon">
<item>
<property name="text">
<string>Text Only</string>
</property>
</item>
<item>
<property name="text">
<string>Text + Icon</string>
</property>
</item>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spinBox_max_subviews"/>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="spinBox_min_subview_width">
<property name="minimum">
<number>325</number>
</property>
<property name="maximum">
<number>20000</number>
</property>
<property name="singleStep">
<number>5</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_ShowIcon">
<property name="text">
<string>Show Icon</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>371</width>
<height>151</height>
</rect>
</property>
<property name="title">
<string>GroupBox</string>
</property>
</widget>
<zorder>groupBox</zorder>
<zorder>layoutWidget2</zorder>
</widget>
<widget class="QWidget" name="MiscSettings">
<attribute name="title">
<string>Misc Settings</string>
</attribute>
</widget>
</widget>
<resources/>
<connections/>
<buttongroups>
<buttongroup name="buttonGroup"/>
</buttongroups>
</ui>