forked from teamnwah/openmw-tes3coop
Reusing subviews implemented.
This commit is contained in:
parent
3f9b73812b
commit
fdf375fb4d
3 changed files with 36 additions and 5 deletions
|
@ -454,6 +454,33 @@ void CSVDoc::View::addSubView (const CSMWorld::UniversalId& id, const std::strin
|
|||
{
|
||||
CSMSettings::UserSettings &userSettings = CSMSettings::UserSettings::instance();
|
||||
|
||||
const std::vector<CSMWorld::UniversalId::Type> referenceables(CSMWorld::UniversalId::listReferenceableTypes());
|
||||
bool isReferenceable = std::find(referenceables.begin(), referenceables.end(), id.getType()) != referenceables.end();
|
||||
|
||||
// User setting to reuse sub views (on a per top level view basis)
|
||||
bool reuse = true;
|
||||
if(userSettings.hasSettingDefinitions("SubView/reuse"))
|
||||
reuse = userSettings.settingValue("SubView/reuse").toStdString() == "true" ? true : false;
|
||||
else
|
||||
userSettings.setDefinitions("SubView/reuse", (QStringList() << QString(reuse ? "true" : "false")));
|
||||
if(reuse)
|
||||
{
|
||||
foreach(SubView *sb, mSubViews)
|
||||
{
|
||||
if((isReferenceable && (CSMWorld::UniversalId(CSMWorld::UniversalId::Type_Referenceable, id.getId()) == CSMWorld::UniversalId(CSMWorld::UniversalId::Type_Referenceable, sb->getUniversalId().getId())))
|
||||
|| (!isReferenceable && (id == sb->getUniversalId())))
|
||||
{
|
||||
sb->setFocus(Qt::OtherFocusReason); // FIXME: focus not quite working
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// User setting for limiting the number of sub views per top level view.
|
||||
// Automatically open a new top level view if this number is exceeded
|
||||
//
|
||||
// If the sub view limit setting is one, the sub view title bar is hidden and the
|
||||
// text in the main title bar is adjusted accordingly
|
||||
int maxSubView = 3;
|
||||
if(userSettings.hasSettingDefinitions("SubView/max subviews"))
|
||||
maxSubView = userSettings.settingValue("SubView/max subviews").toInt();
|
||||
|
@ -467,9 +494,6 @@ void CSVDoc::View::addSubView (const CSMWorld::UniversalId& id, const std::strin
|
|||
return;
|
||||
}
|
||||
|
||||
/// \todo add an user setting to reuse sub views (on a per document basis or on a per top level view basis)
|
||||
|
||||
const std::vector<CSMWorld::UniversalId::Type> referenceables(CSMWorld::UniversalId::listReferenceableTypes());
|
||||
SubView *view = NULL;
|
||||
if(std::find(referenceables.begin(), referenceables.end(), id.getType()) != referenceables.end())
|
||||
{
|
||||
|
|
|
@ -310,6 +310,8 @@ void CSVSettings::Dialog::buildPages()
|
|||
else
|
||||
sbMaxSubViews->setValue(3);
|
||||
|
||||
cbReuseSubView->setChecked(model()->settingValue("SubView/reuse") == "true");
|
||||
|
||||
SettingWindow::createPages ();
|
||||
|
||||
foreach (Page *page, SettingWindow::pages())
|
||||
|
@ -393,6 +395,11 @@ void CSVSettings::Dialog::closeEvent (QCloseEvent *event)
|
|||
model()->setDefinitions("SubView/max subviews",
|
||||
QStringList(QString::number(sbMaxSubViews->value())));
|
||||
|
||||
if(cbReuseSubView->isChecked())
|
||||
model()->setDefinitions("SubView/reuse", QStringList("true"));
|
||||
else
|
||||
model()->setDefinitions("SubView/reuse", QStringList("false"));
|
||||
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="checkBox_reuse_subview">
|
||||
<widget class="QCheckBox" name="cbReuseSubView">
|
||||
<property name="text">
|
||||
<string>Reuse Subviews</string>
|
||||
</property>
|
||||
|
@ -391,7 +391,7 @@
|
|||
<tabstop>cbStatusBar</tabstop>
|
||||
<tabstop>sbMaxSubViews</tabstop>
|
||||
<tabstop>sbMinSubViewWidth</tabstop>
|
||||
<tabstop>checkBox_reuse_subview</tabstop>
|
||||
<tabstop>cbReuseSubView</tabstop>
|
||||
<tabstop>cbOverride</tabstop>
|
||||
<tabstop>cmbRenderSys</tabstop>
|
||||
<tabstop>cbVsync</tabstop>
|
||||
|
|
Loading…
Reference in a new issue