1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 21:23:52 +00:00

Added minimum width setting for subviews - regionmap, table, scene, preview and dialogue. It should be noted that the setting is not the starting minimum width, i.e. it won't be possible to reduce the width of the subview after the creation. Also, one setting applies to all subviews. It may be desirable to have individual settings.

This commit is contained in:
cc9cii 2014-09-23 06:30:41 +10:00
parent c4f11785ec
commit c8ae8f4a6d
7 changed files with 55 additions and 8 deletions

View file

@ -299,6 +299,12 @@ void CSVSettings::Dialog::buildPages()
if(index != -1)
cmbRefIdType->setCurrentIndex(index);
// subview
if(model()->hasSettingDefinitions("SubView/minimum width"))
sbMinSubViewWidth->setValue(model()->settingValue("SubView/minimum width").toInt());
else
sbMinSubViewWidth->setValue(325);
SettingWindow::createPages ();
foreach (Page *page, SettingWindow::pages())
@ -376,6 +382,9 @@ void CSVSettings::Dialog::closeEvent (QCloseEvent *event)
QStringList(cmbRecStatus->currentText()));
model()->setDefinitions("Display Format/Referenceable ID Type Display",
QStringList(cmbRefIdType->currentText()));
// subview
model()->setDefinitions("SubView/minimum width",
QStringList(QString::number(sbMinSubViewWidth->value())));
saveSettings();
}

View file

@ -27,6 +27,7 @@
#include "../../model/world/tablemimedata.hpp"
#include "../../model/doc/document.hpp"
#include "../../model/world/commands.hpp"
#include "../../model/settings/usersettings.hpp"
#include "recordstatusdelegate.hpp"
#include "util.hpp"
@ -392,7 +393,12 @@ void CSVWorld::EditWidget::remake(int row)
mWidgetMapper->setCurrentModelIndex(mTable->index(row, 0));
this->setMinimumWidth(325); /// \todo replace hardcoded value with a user setting
int minWidth = 325;
if(CSMSettings::UserSettings::instance().hasSettingDefinitions("SubView/minimum width"))
minWidth = CSMSettings::UserSettings::instance().settingValue("SubView/minimum width").toInt();
else
CSMSettings::UserSettings::instance().setDefinitions("SubView/minimum width", (QStringList() << "minWidth"));
this->setMinimumWidth(minWidth);
this->setWidget(mMainWidget);
this->setWidgetResizable(true);
}

View file

@ -8,6 +8,8 @@
#include "../widget/scenetoolbar.hpp"
#include "../widget/scenetoolmode.hpp"
#include "../../model/settings/usersettings.hpp"
CSVWorld::PreviewSubView::PreviewSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document)
: SubView (id)
{
@ -41,6 +43,13 @@ CSVWorld::PreviewSubView::PreviewSubView (const CSMWorld::UniversalId& id, CSMDo
widget->setLayout (layout);
int minWidth = 325;
if(CSMSettings::UserSettings::instance().hasSettingDefinitions("SubView/minimum width"))
minWidth = CSMSettings::UserSettings::instance().settingValue("SubView/minimum width").toInt();
else
CSMSettings::UserSettings::instance().setDefinitions("SubView/minimum width", (QStringList() << "minWidth"));
widget->setMinimumWidth(minWidth);
setWidget (widget);
connect (mScene, SIGNAL (closeRequest()), this, SLOT (closeRequest()));

View file

@ -2,6 +2,7 @@
#include "regionmapsubview.hpp"
#include "regionmap.hpp"
#include "../../model/settings/usersettings.hpp"
CSVWorld::RegionMapSubView::RegionMapSubView (CSMWorld::UniversalId universalId,
CSMDoc::Document& document)
@ -9,6 +10,13 @@ CSVWorld::RegionMapSubView::RegionMapSubView (CSMWorld::UniversalId universalId,
{
mRegionMap = new RegionMap (universalId, document, this);
int minWidth = 325;
if(CSMSettings::UserSettings::instance().hasSettingDefinitions("SubView/minimum width"))
minWidth = CSMSettings::UserSettings::instance().settingValue("SubView/minimum width").toInt();
else
CSMSettings::UserSettings::instance().setDefinitions("SubView/minimum width", (QStringList() << "minWidth"));
mRegionMap->setMinimumWidth(minWidth);
setWidget (mRegionMap);
connect (mRegionMap, SIGNAL (editRequest (const CSMWorld::UniversalId&, const std::string&)),

View file

@ -9,7 +9,7 @@
#include <cassert>
#include "../../model/doc/document.hpp"
#include "../../model/settings/usersettings.hpp"
#include "../../model/world/cellselection.hpp"
#include "../filter/filterbox.hpp"
@ -74,6 +74,13 @@ CSVWorld::SceneSubView::SceneSubView (const CSMWorld::UniversalId& id, CSMDoc::D
widget->setLayout (layout);
int minWidth = 325;
if(CSMSettings::UserSettings::instance().hasSettingDefinitions("SubView/minimum width"))
minWidth = CSMSettings::UserSettings::instance().settingValue("SubView/minimum width").toInt();
else
CSMSettings::UserSettings::instance().setDefinitions("SubView/minimum width", (QStringList() << "minWidth"));
widget->setMinimumWidth(minWidth);
setWidget (widget);
}

View file

@ -6,6 +6,7 @@
#include "../../model/doc/document.hpp"
#include "../../model/world/tablemimedata.hpp"
#include "../../model/settings/usersettings.hpp"
#include "../filter/filterbox.hpp"
#include "table.hpp"
@ -34,6 +35,13 @@ CSVWorld::TableSubView::TableSubView (const CSMWorld::UniversalId& id, CSMDoc::D
widget->setLayout (layout);
int minWidth = 325;
if(CSMSettings::UserSettings::instance().hasSettingDefinitions("SubView/minimum width"))
minWidth = CSMSettings::UserSettings::instance().settingValue("SubView/minimum width").toInt();
else
CSMSettings::UserSettings::instance().setDefinitions("SubView/minimum width", (QStringList() << "minWidth"));
widget->setMinimumWidth(minWidth);
setWidget (widget);
connect (mTable, SIGNAL (editRequest (const CSMWorld::UniversalId&, const std::string&)),

View file

@ -142,7 +142,7 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spinBox_min_subview_width">
<widget class="QSpinBox" name="sbMinSubViewWidth">
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
@ -260,10 +260,10 @@
<string>Show Status Bar</string>
</property>
</widget>
<zorder>displayGroup_Subviews</zorder>
<zorder>layoutWidget_Subviews</zorder>
<zorder>displayGroup_Window</zorder>
<zorder>displayGroup_DisplayFormat</zorder>
<zorder>displayGroup_Subviews</zorder>
<zorder>cbStatusBar</zorder>
</widget>
<widget class="QWidget" name="VideoSettings">
@ -387,7 +387,7 @@
<tabstop>sbHeight</tabstop>
<tabstop>cbStatusBar</tabstop>
<tabstop>spinBox_max_subviews</tabstop>
<tabstop>spinBox_min_subview_width</tabstop>
<tabstop>sbMinSubViewWidth</tabstop>
<tabstop>checkBox_reuse_subview</tabstop>
<tabstop>cbOverride</tabstop>
<tabstop>cmbRenderSys</tabstop>