mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-01 21:45:38 +00:00
Cleaned up comments and dead code.
This commit is contained in:
parent
dbd1ab05d3
commit
17a74da650
5 changed files with 0 additions and 379 deletions
|
@ -51,133 +51,6 @@ UserSettings::UserSettings (const Files::ConfigurationManager& configurationMana
|
|||
mSettingCfgDefinitions = new QSettings(QSettings::IniFormat, QSettings::UserScope, "", QString(), this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Original Design:
|
||||
*
|
||||
*
|
||||
* QGridLayout QGroupBox
|
||||
* ^ ^
|
||||
* | |
|
||||
* | 1 |
|
||||
* SettingLayout......Frame
|
||||
* ^ ^ QMainWindow
|
||||
* | | ^ QObject
|
||||
* / \ | ^
|
||||
* / \ | |
|
||||
* / \ 0..n | | 0..n
|
||||
* View......Page........SettingWindow......UserSettings......Setting
|
||||
* ^ 0..n ^
|
||||
* | |
|
||||
* | |
|
||||
* ListView, |
|
||||
* TextView, etc |
|
||||
* |
|
||||
* |
|
||||
* QStackedWidget QListWidget.....Dialog
|
||||
* ^ :
|
||||
* | :
|
||||
* | :
|
||||
* ResizeableStackedWidget.....
|
||||
*
|
||||
*
|
||||
* When a Page is created with a list of Views, the Views are added to the Frame.
|
||||
*
|
||||
* Editor ctor
|
||||
* -> Dialog ctor
|
||||
* -> SettingWindow ctor
|
||||
* -> SettingWindow::setModel()
|
||||
* -> Dialog::setupDialog()
|
||||
* -> buildPageListWidget
|
||||
* -> buildStackedWidget
|
||||
*
|
||||
* Editor::showSettings()
|
||||
* -> Dialog::show()
|
||||
* -> Dialog::buildPages() <-- [first time only]
|
||||
* -> SettingWindow::createPages()
|
||||
* -> Page ctor
|
||||
* -> Page::setupViews()
|
||||
* -> Page::addView()
|
||||
* -> Frame::addWidget()
|
||||
* -> SettingLayout::addWidget()
|
||||
* -> [add page widgets to the stack]
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Modified Design:
|
||||
*
|
||||
* +----------------------------------------+
|
||||
* |+---------+---------+---------+ |
|
||||
* || | | | |
|
||||
* || +----------------------------+|
|
||||
* || ||
|
||||
* || +--------------------------------+ ||
|
||||
* || | | ||
|
||||
* || | View View | ||
|
||||
* || | View View | ||
|
||||
* || | | ||
|
||||
* || +---- Section -------------------+ ||
|
||||
* || ||
|
||||
* || +--------------------------------+ ||
|
||||
* || | | ||
|
||||
* || | +-------------+ | ||
|
||||
* || | | View/Frame | | ||
|
||||
* || | +-------------+ | ||
|
||||
* || | | ||
|
||||
* || +---- Section -------------------+ ||
|
||||
* || ||
|
||||
* || ||
|
||||
* |+-------------- Page ------------------+|
|
||||
* +---------- SettingWindow ---------------+
|
||||
*
|
||||
*
|
||||
*
|
||||
* QGridLayout QGroupBox
|
||||
* ^ ^
|
||||
* | |
|
||||
* | 1 |
|
||||
* SettingLayout......Frame
|
||||
* ^ ^ QTabWidget
|
||||
* | | ^ QObject
|
||||
* / \ | ^
|
||||
* / \ | |
|
||||
* / \ 0..n | | 0..n
|
||||
* View......Page........SettingWindow......UserSettings......Setting
|
||||
* ^ 0..n ^
|
||||
* | |
|
||||
* | Ui::TabWidget |
|
||||
* ListView, ^ |
|
||||
* TextView, etc | |
|
||||
* \ |
|
||||
* \ |
|
||||
* \ |
|
||||
* Dialog
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* View/Page is still used to uniquely identify a setting (i.e. Section is for
|
||||
* visual presentation only). This means all views on a page should be unique
|
||||
* (as before)
|
||||
*
|
||||
*
|
||||
* Editor ctor
|
||||
* -> Dialog ctor
|
||||
* -> SettingWindow ctor
|
||||
* -> SettingWindow::setModel()
|
||||
* -> Dialog::setupDialog() <-- [no longer required]
|
||||
*
|
||||
* Editor::showSettings()
|
||||
* -> Dialog::show()
|
||||
* -> Dialog::buildPages() <-- [first time only]
|
||||
* -> SettingWindow::createPages()
|
||||
* -> Page ctor
|
||||
* -> Page::setupViews()
|
||||
* -> Page::addView()
|
||||
* -> Frame::addWidget()
|
||||
* -> SettingLayout::addWidget()
|
||||
* -> [add pages to tabs then call showWidgets()]
|
||||
*/
|
||||
void UserSettings::buildSettingModelDefaults()
|
||||
{
|
||||
QString section;
|
||||
|
|
|
@ -1,27 +1,12 @@
|
|||
#include "dialog.hpp"
|
||||
|
||||
//#include <QListWidgetItem>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#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>
|
||||
|
||||
#include <OgreRoot.h>
|
||||
#include <boost/math/common_factor.hpp>
|
||||
|
||||
|
@ -170,14 +155,6 @@ CSVSettings::Dialog::Dialog(QTabWidget *parent)
|
|||
connect(cbStatusBar, SIGNAL(toggled(bool)), this, SIGNAL (toggleStatusBar(bool)));
|
||||
|
||||
setupDialog();
|
||||
|
||||
#if 0
|
||||
// FIXME: delete - don't need this for tabs
|
||||
connect (mPageListWidget,
|
||||
SIGNAL (currentItemChanged(QListWidgetItem*, QListWidgetItem*)),
|
||||
this,
|
||||
SLOT (slotChangePage (QListWidgetItem*, QListWidgetItem*)));
|
||||
#endif
|
||||
}
|
||||
|
||||
void CSVSettings::Dialog::slotRendererChanged(const QString &renderer)
|
||||
|
@ -226,33 +203,8 @@ void CSVSettings::Dialog::slotOverrideToggled(bool checked)
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
// FIXME: delete - not required for tabs
|
||||
void CSVSettings::Dialog::slotChangePage
|
||||
(QListWidgetItem *cur, QListWidgetItem *prev)
|
||||
{
|
||||
mStackedWidget->changePage
|
||||
(mPageListWidget->row (cur), mPageListWidget->row (prev));
|
||||
|
||||
layout()->activate();
|
||||
setFixedSize(minimumSizeHint());
|
||||
}
|
||||
#endif
|
||||
|
||||
void CSVSettings::Dialog::setupDialog()
|
||||
{
|
||||
#if 0
|
||||
//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);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CSVSettings::Dialog::buildPages()
|
||||
|
@ -332,51 +284,17 @@ void CSVSettings::Dialog::buildPages()
|
|||
|
||||
SettingWindow::createPages ();
|
||||
|
||||
//QFontMetrics fm (QApplication::font());
|
||||
|
||||
foreach (Page *page, SettingWindow::pages())
|
||||
{
|
||||
QString pageName = page->objectName();
|
||||
|
||||
//int textWidth = fm.width(pageName);
|
||||
|
||||
// each page is added as a tab to Ui::TabWiget
|
||||
addTab(page, page->objectName());
|
||||
|
||||
// add section and views to the page
|
||||
buildTabPage(page);
|
||||
page->showWidgets();
|
||||
|
||||
//new QListWidgetItem (pageName, mPageListWidget);
|
||||
//mPageListWidget->setFixedWidth (textWidth + 50);
|
||||
|
||||
//mStackedWidget->addWidget (&dynamic_cast<QWidget &>(*(page)));
|
||||
}
|
||||
|
||||
//resize (mStackedWidget->sizeHint());
|
||||
}
|
||||
|
||||
#if 0
|
||||
// FIXME: delete - not required, using tabs instead
|
||||
void CSVSettings::Dialog::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::Dialog::buildStackedWidget (QWidget *centralWidget)
|
||||
{
|
||||
mStackedWidget = new ResizeableStackedWidget (centralWidget);
|
||||
|
||||
centralWidget->layout()->addWidget (mStackedWidget);
|
||||
}
|
||||
#endif
|
||||
|
||||
void CSVSettings::Dialog::closeEvent (QCloseEvent *event)
|
||||
{
|
||||
//SettingWindow::closeEvent() must be called first to ensure
|
||||
|
@ -442,8 +360,6 @@ void CSVSettings::Dialog::closeEvent (QCloseEvent *event)
|
|||
model()->setDefinitions("Display Format/Referenceable ID Type Display",
|
||||
QStringList(cmbRefIdType->currentText()));
|
||||
|
||||
std::cout << "closeEvent" << std::endl;
|
||||
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
|
|
|
@ -2,13 +2,8 @@
|
|||
#define CSVSETTINGS_DIALOG_H
|
||||
|
||||
#include "settingwindow.hpp"
|
||||
//#include "resizeablestackedwidget.hpp"
|
||||
#include <QStandardItem>
|
||||
|
||||
//class QStackedWidget;
|
||||
//class QListWidget;
|
||||
//class QListWidgetItem;
|
||||
|
||||
#include "ui_settingstab.h"
|
||||
|
||||
namespace CSVSettings {
|
||||
|
@ -41,8 +36,6 @@ namespace CSVSettings {
|
|||
private:
|
||||
|
||||
void buildPages();
|
||||
//void buildPageListWidget (QWidget *centralWidget);
|
||||
//void buildStackedWidget (QWidget *centralWidget);
|
||||
|
||||
public slots:
|
||||
|
||||
|
@ -50,7 +43,6 @@ namespace CSVSettings {
|
|||
|
||||
private slots:
|
||||
|
||||
//void slotChangePage (QListWidgetItem *, QListWidgetItem *); // FIXME: delete
|
||||
void slotOverrideToggled(bool checked);
|
||||
void slotRendererChanged(const QString &renderer);
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
#include "settingwindow.hpp"
|
||||
|
||||
#include <QApplication>
|
||||
//#include <QDesktopWidget>
|
||||
//#include <QLineEdit>
|
||||
//#include <QRadioButton>
|
||||
#include <QDebug>
|
||||
|
||||
#include "../../model/settings/setting.hpp"
|
||||
|
@ -41,162 +38,6 @@ void CSVSettings::SettingWindow::createPages()
|
|||
createConnections(connectedSettings);
|
||||
}
|
||||
|
||||
void CSVSettings::SettingWindow::buildTabPage(Page* tab)
|
||||
{
|
||||
CSMSettings::SettingPageMap pageMap = mModel->settingPageMap();
|
||||
QList <CSMSettings::Setting *> pageSettings = pageMap.value (tab->objectName());
|
||||
//tab->setupViews(pageSettings);
|
||||
#if 0
|
||||
QFontMetrics fm (QApplication::font());
|
||||
//int textWidth = fm.width(pageName); // FIXME:
|
||||
QString pageName = tab->objectName();
|
||||
|
||||
std::cout << "pageName: " + pageName.toStdString() << std::endl; // FIXME:
|
||||
QList<CSMSettings::Setting*> settingList = mModel->settingPageMap.value(pageName);
|
||||
//foreach (View *view, page->views())
|
||||
//{
|
||||
//std::cout << "view key: " + view->viewKey().toStdString() << std::endl;
|
||||
//if(!settingList.empty())
|
||||
//{
|
||||
QGroupBox *section = new QGroupBox(tab);
|
||||
section->setGeometry(5, 5, this->width()-15, this->height()-15); // FIXME: frame thickness calculation
|
||||
// FIXME: assume a single grid for now
|
||||
QGridLayout *gridLayout = new QGridLayout(section);
|
||||
gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
|
||||
gridLayout->setContentsMargins(5, 5, 5, 5);
|
||||
|
||||
foreach(CSMSettings::Setting * setting, settingList)
|
||||
{
|
||||
// enum ViewType {ViewType_Boolean = 0,
|
||||
// ViewType_List = 1,
|
||||
// ViewType_Range = 2,
|
||||
// ViewType_Text = 3,
|
||||
// ViewType_Undefined = 4 };
|
||||
// enum SettingType {* 0 - 9 - Boolean widgets
|
||||
// * 10-19 - List widgets
|
||||
// * 21-29 - Range widgets
|
||||
// * 31-39 - Text widgets
|
||||
// *
|
||||
// * Each range corresponds to a View_Type enum by a factor of 10.
|
||||
// *
|
||||
// * Even-numbered values are single-value widgets
|
||||
// * Odd-numbered values are multi-valued widgets
|
||||
//
|
||||
// Type_CheckBox = 0,
|
||||
// Type_RadioButton = 1,
|
||||
// Type_ListView = 10,
|
||||
// Type_ComboBox = 11,
|
||||
// Type_SpinBox = 21,
|
||||
// Type_DoubleSpinBox = 23,
|
||||
// Type_Slider = 25,
|
||||
// Type_Dial = 27,
|
||||
// Type_TextArea = 30,
|
||||
// Type_LineEdit = 31,
|
||||
// Type_Undefined = 40 };
|
||||
//
|
||||
std::cout << "view type: " + std::to_string(setting->viewType()) << std::endl;
|
||||
std::cout << "setting type: " + std::to_string(setting->type()) << std::endl;
|
||||
switch(setting->viewType())
|
||||
{
|
||||
case ViewType_Boolean:
|
||||
break;
|
||||
case ViewType_List:
|
||||
break;
|
||||
case ViewType_Range:
|
||||
break;
|
||||
case ViewType_Text:
|
||||
break;
|
||||
default:
|
||||
std::cerr << "ViewType_Undefined" << std::endl;
|
||||
}
|
||||
QLabel *lab = 0;
|
||||
if(!gridLayout->itemAtPosition(setting->viewRow(), 0))
|
||||
{
|
||||
lab = new QLabel(section);
|
||||
lab->setText(setting->name());
|
||||
int textWidth = fm.width(setting->name()); // FIXME:
|
||||
lab->setMinimumWidth(std::max(textWidth, this->width()/3));
|
||||
}
|
||||
else
|
||||
{
|
||||
lab = dynamic_cast<QLabel*> (gridLayout->itemAtPosition(setting->viewRow(), 0)->widget());
|
||||
QString oldLabel = lab->text();
|
||||
lab->setText(oldLabel + ", " + setting->name());
|
||||
}
|
||||
switch(setting->type())
|
||||
{
|
||||
case CSMSettings::SettingType::Type_RadioButton:
|
||||
{
|
||||
int rowNum = gridLayout->rowCount();
|
||||
if(!gridLayout->itemAtPosition(setting->viewRow(), 0))
|
||||
if(lab) gridLayout->addWidget(lab, rowNum, 0);
|
||||
//lab->setStyleSheet("background-color:yellow;"); // FIXME:
|
||||
int colNum = 1;
|
||||
if(setting->declaredValues().size() > 1) // button group FIXME: try isMultiValue()
|
||||
{
|
||||
QButtonGroup * buttonGroup = new QButtonGroup(section);
|
||||
//buttonGroup->setStyleSheet("background-color:red;"); // FIXME:
|
||||
//gridLayout->addWidget(buttonGroup, rowNum, 1);
|
||||
foreach(QString string, setting->declaredValues())
|
||||
{
|
||||
QRadioButton *rb = new QRadioButton(string, section);
|
||||
//rb->setStyleSheet("background-color:blue;"); // FIXME:
|
||||
gridLayout->addWidget(rb, rowNum, colNum++);
|
||||
buttonGroup->addButton(rb);
|
||||
}
|
||||
}
|
||||
else // single radio button
|
||||
{
|
||||
std::cout << "default values size: " + std::to_string(setting->declaredValues().size()) << std::endl;
|
||||
QRadioButton *rb = new QRadioButton(section);
|
||||
if(rb) rb->setText(setting->declaredValues().at(0));
|
||||
gridLayout->addWidget(rb, gridLayout->rowCount(), 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CSMSettings::SettingType::Type_LineEdit:
|
||||
{
|
||||
if(!gridLayout->itemAtPosition(setting->viewRow(), 0))
|
||||
if(lab) gridLayout->addWidget(lab, setting->viewRow(), 0);
|
||||
QLineEdit *item = new QLineEdit(section);
|
||||
//QLabel *lab = new QLabel(section);
|
||||
//lab->setText(setting->name()); // FIXME: how to put lables in proper place if many items in the same row
|
||||
gridLayout->addWidget(item, setting->viewRow(), setting->viewColumn()+1,
|
||||
setting->rowSpan(), setting->columnSpan());
|
||||
item->setText(setting->defaultValues().at(0)); //FIXME: check if empty first?
|
||||
break;
|
||||
}
|
||||
case CSMSettings::SettingType::Type_ComboBox:
|
||||
{
|
||||
QComboBox *item = new QComboBox(section);
|
||||
//QLabel *lab = new QLabel(section);
|
||||
if(!gridLayout->itemAtPosition(setting->viewRow(), 0))
|
||||
if(lab) gridLayout->addWidget(lab, setting->viewRow(), 0);
|
||||
//lab->setText(setting->name());
|
||||
gridLayout->addWidget(item, setting->viewRow(), setting->viewColumn()+1,
|
||||
setting->rowSpan(), setting->columnSpan());
|
||||
item->clear();
|
||||
item->addItems(setting->declaredValues()); //FIXME: check if empty first?
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
section->resize(section->width(), gridLayout->rowCount() * (fm.lineSpacing() + 10)); // 10 is extra line space
|
||||
//tab->adjustSize();
|
||||
//}
|
||||
//QWidget *item = new QWidget(tab);
|
||||
//item->setObjectName(QString::fromUtf8("cmbAntiAlias"));
|
||||
//}
|
||||
|
||||
//new QListWidgetItem (pageName, mPageListWidget);
|
||||
//mPageListWidget->setFixedWidth (textWidth + 50);
|
||||
|
||||
//mStackedWidget->addWidget (&dynamic_cast<QWidget &>(*(page)));
|
||||
#endif
|
||||
}
|
||||
|
||||
void CSVSettings::SettingWindow::createConnections
|
||||
(const QList <CSMSettings::Setting *> &list)
|
||||
{
|
||||
|
|
|
@ -50,7 +50,6 @@ namespace CSVSettings {
|
|||
///sets the defined values for the views that have been created
|
||||
void setViewValues();
|
||||
|
||||
void buildTabPage(Page* tab);
|
||||
CSMSettings::UserSettings *model() { return mModel; }
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue