mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-24 07:23:50 +00:00
Add a per table subview options section and a checkbox option to scroll the table to the modified record (from another subview).
- Always start disabled, needs to be manually set per table - There is no user preference setting, the options are active during the editing session only
This commit is contained in:
parent
76feca6974
commit
85a20be321
5 changed files with 70 additions and 22 deletions
|
@ -232,11 +232,6 @@ void CSMSettings::UserSettings::buildSettingModelDefaults()
|
||||||
"Jump to the added or cloned record.");
|
"Jump to the added or cloned record.");
|
||||||
jumpToAdded->setDefaultValue (defaultValue);
|
jumpToAdded->setDefaultValue (defaultValue);
|
||||||
jumpToAdded->setDeclaredValues (jumpValues);
|
jumpToAdded->setDeclaredValues (jumpValues);
|
||||||
|
|
||||||
Setting *jumpToModified = createSetting (Type_CheckBox, "jump-to-modified", "Jump to modified Record");
|
|
||||||
jumpToModified->setDefaultValue ("true");
|
|
||||||
jumpToModified->setToolTip ("Whether to jump to the modified record. This setting effects the instances table only."
|
|
||||||
"\nCan be useful in finding the moved or modified object instance while 3D editing.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
declareSection ("search", "Search & Replace");
|
declareSection ("search", "Search & Replace");
|
||||||
|
|
|
@ -254,7 +254,7 @@ void CSVWorld::Table::mouseDoubleClickEvent (QMouseEvent *event)
|
||||||
CSVWorld::Table::Table (const CSMWorld::UniversalId& id,
|
CSVWorld::Table::Table (const CSMWorld::UniversalId& id,
|
||||||
bool createAndDelete, bool sorting, CSMDoc::Document& document)
|
bool createAndDelete, bool sorting, CSMDoc::Document& document)
|
||||||
: DragRecordTable(document), mCreateAction (0),
|
: DragRecordTable(document), mCreateAction (0),
|
||||||
mCloneAction(0),mRecordStatusDisplay (0)
|
mCloneAction(0),mRecordStatusDisplay (0), mAutoJump (false)
|
||||||
{
|
{
|
||||||
CSMSettings::UserSettings &settings = CSMSettings::UserSettings::instance();
|
CSMSettings::UserSettings &settings = CSMSettings::UserSettings::instance();
|
||||||
QString jumpSetting = settings.settingValue ("table-input/jump-to-added");
|
QString jumpSetting = settings.settingValue ("table-input/jump-to-added");
|
||||||
|
@ -370,14 +370,10 @@ CSVWorld::Table::Table (const CSMWorld::UniversalId& id,
|
||||||
connect (mProxyModel, SIGNAL (rowsInserted (const QModelIndex&, int, int)),
|
connect (mProxyModel, SIGNAL (rowsInserted (const QModelIndex&, int, int)),
|
||||||
this, SLOT (rowsInsertedEvent(const QModelIndex&, int, int)));
|
this, SLOT (rowsInsertedEvent(const QModelIndex&, int, int)));
|
||||||
|
|
||||||
if (id == CSMWorld::UniversalId::Type_References)
|
/// \note This signal could instead be connected to a slot that filters out changes not affecting
|
||||||
connect (mProxyModel, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)),
|
/// the records status column (for permanence reasons)
|
||||||
this, SLOT (dataChangedEvent(const QModelIndex&, const QModelIndex&)));
|
connect (mProxyModel, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)),
|
||||||
else
|
this, SLOT (dataChangedEvent(const QModelIndex&, const QModelIndex&)));
|
||||||
/// \note This signal could instead be connected to a slot that filters out changes not affecting
|
|
||||||
/// the records status column (for permanence reasons)
|
|
||||||
connect (mProxyModel, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)),
|
|
||||||
this, SLOT (tableSizeUpdate()));
|
|
||||||
|
|
||||||
connect (selectionModel(), SIGNAL (selectionChanged (const QItemSelection&, const QItemSelection&)),
|
connect (selectionModel(), SIGNAL (selectionChanged (const QItemSelection&, const QItemSelection&)),
|
||||||
this, SLOT (selectionSizeUpdate ()));
|
this, SLOT (selectionSizeUpdate ()));
|
||||||
|
@ -765,8 +761,14 @@ void CSVWorld::Table::dataChangedEvent(const QModelIndex &topLeft, const QModelI
|
||||||
{
|
{
|
||||||
tableSizeUpdate();
|
tableSizeUpdate();
|
||||||
|
|
||||||
// this event is assumed to be infreqent, don't bother keeping a member variable
|
if (mAutoJump)
|
||||||
CSMSettings::UserSettings &settings = CSMSettings::UserSettings::instance();
|
|
||||||
if (settings.setting("table-input/jump-to-modified", "true") == "true")
|
|
||||||
selectRow(bottomRight.row());
|
selectRow(bottomRight.row());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVWorld::Table::jumpAfterModChanged(int state)
|
||||||
|
{
|
||||||
|
if(state == Qt::Checked)
|
||||||
|
mAutoJump = true;
|
||||||
|
else
|
||||||
|
mAutoJump = false;
|
||||||
|
}
|
||||||
|
|
|
@ -69,6 +69,7 @@ namespace CSVWorld
|
||||||
std::map<Qt::KeyboardModifiers, DoubleClickAction> mDoubleClickActions;
|
std::map<Qt::KeyboardModifiers, DoubleClickAction> mDoubleClickActions;
|
||||||
bool mJumpToAddedRecord;
|
bool mJumpToAddedRecord;
|
||||||
bool mUnselectAfterJump;
|
bool mUnselectAfterJump;
|
||||||
|
bool mAutoJump;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -145,6 +146,8 @@ namespace CSVWorld
|
||||||
void rowsInsertedEvent(const QModelIndex &parent, int start, int end);
|
void rowsInsertedEvent(const QModelIndex &parent, int start, int end);
|
||||||
|
|
||||||
void dataChangedEvent(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
void dataChangedEvent(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
||||||
|
|
||||||
|
void jumpAfterModChanged(int state);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
|
||||||
#include "tablesubview.hpp"
|
#include "tablesubview.hpp"
|
||||||
|
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QCheckBox>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
|
@ -18,7 +20,7 @@
|
||||||
|
|
||||||
CSVWorld::TableSubView::TableSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document,
|
CSVWorld::TableSubView::TableSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document,
|
||||||
const CreatorFactoryBase& creatorFactory, bool sorting)
|
const CreatorFactoryBase& creatorFactory, bool sorting)
|
||||||
: SubView (id)
|
: SubView (id), mShowOptions(false), mOptions(0)
|
||||||
{
|
{
|
||||||
QVBoxLayout *layout = new QVBoxLayout;
|
QVBoxLayout *layout = new QVBoxLayout;
|
||||||
|
|
||||||
|
@ -32,7 +34,37 @@ CSVWorld::TableSubView::TableSubView (const CSMWorld::UniversalId& id, CSMDoc::D
|
||||||
|
|
||||||
mFilterBox = new CSVFilter::FilterBox (document.getData(), this);
|
mFilterBox = new CSVFilter::FilterBox (document.getData(), this);
|
||||||
|
|
||||||
layout->insertWidget (0, mFilterBox);
|
QHBoxLayout *hLayout = new QHBoxLayout;
|
||||||
|
hLayout->insertWidget(0,mFilterBox);
|
||||||
|
|
||||||
|
mOptions = new QWidget;
|
||||||
|
|
||||||
|
QHBoxLayout *optHLayout = new QHBoxLayout;
|
||||||
|
QCheckBox *autoJump = new QCheckBox("Auto Jump");
|
||||||
|
autoJump->setToolTip ("Whether to jump to the modified record."
|
||||||
|
"\nCan be useful in finding the moved or modified"
|
||||||
|
"\nobject instance while 3D editing.");
|
||||||
|
autoJump->setCheckState(Qt::Unchecked);
|
||||||
|
connect(autoJump, SIGNAL (stateChanged(int)), mTable, SLOT (jumpAfterModChanged(int)));
|
||||||
|
optHLayout->insertWidget(0, autoJump);
|
||||||
|
optHLayout->setContentsMargins (QMargins (0, 3, 0, 0));
|
||||||
|
mOptions->setLayout(optHLayout);
|
||||||
|
mOptions->resize(mOptions->width(), mFilterBox->height());
|
||||||
|
mOptions->hide();
|
||||||
|
|
||||||
|
QPushButton *opt = new QPushButton ();
|
||||||
|
opt->setIcon (QIcon (":startup/configure"));
|
||||||
|
opt->setSizePolicy (QSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed));
|
||||||
|
opt->setToolTip ("Open additional options for this subview.");
|
||||||
|
connect (opt, SIGNAL (clicked()), this, SLOT (toggleOptions()));
|
||||||
|
|
||||||
|
QVBoxLayout *buttonLayout = new QVBoxLayout; // work around margin issues
|
||||||
|
buttonLayout->setContentsMargins (QMargins (0/*left*/, 3/*top*/, 3/*right*/, 0/*bottom*/));
|
||||||
|
buttonLayout->insertWidget(0, opt, 0, Qt::AlignVCenter|Qt::AlignRight);
|
||||||
|
hLayout->insertWidget(1, mOptions);
|
||||||
|
hLayout->insertLayout(2, buttonLayout);
|
||||||
|
|
||||||
|
layout->insertLayout (0, hLayout);
|
||||||
|
|
||||||
CSVDoc::SizeHintWidget *widget = new CSVDoc::SizeHintWidget;
|
CSVDoc::SizeHintWidget *widget = new CSVDoc::SizeHintWidget;
|
||||||
|
|
||||||
|
@ -95,8 +127,7 @@ void CSVWorld::TableSubView::editRequest (const CSMWorld::UniversalId& id, const
|
||||||
focusId (id, hint);
|
focusId (id, hint);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::TableSubView::updateUserSetting
|
void CSVWorld::TableSubView::updateUserSetting (const QString &name, const QStringList &list)
|
||||||
(const QString &name, const QStringList &list)
|
|
||||||
{
|
{
|
||||||
mTable->updateUserSetting(name, list);
|
mTable->updateUserSetting(name, list);
|
||||||
}
|
}
|
||||||
|
@ -166,3 +197,16 @@ bool CSVWorld::TableSubView::eventFilter (QObject* object, QEvent* event)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVWorld::TableSubView::toggleOptions()
|
||||||
|
{
|
||||||
|
if (mShowOptions)
|
||||||
|
{
|
||||||
|
mShowOptions = false;
|
||||||
|
mOptions->hide();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mShowOptions = true;
|
||||||
|
mOptions->show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <QtCore/qnamespace.h>
|
#include <QtCore/qnamespace.h>
|
||||||
|
|
||||||
class QModelIndex;
|
class QModelIndex;
|
||||||
|
class QWidget;
|
||||||
|
|
||||||
namespace CSMWorld
|
namespace CSMWorld
|
||||||
{
|
{
|
||||||
|
@ -35,6 +36,8 @@ namespace CSVWorld
|
||||||
Table *mTable;
|
Table *mTable;
|
||||||
TableBottomBox *mBottom;
|
TableBottomBox *mBottom;
|
||||||
CSVFilter::FilterBox *mFilterBox;
|
CSVFilter::FilterBox *mFilterBox;
|
||||||
|
bool mShowOptions;
|
||||||
|
QWidget *mOptions;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -63,6 +66,7 @@ namespace CSVWorld
|
||||||
void cloneRequest (const CSMWorld::UniversalId& toClone);
|
void cloneRequest (const CSMWorld::UniversalId& toClone);
|
||||||
void createFilterRequest(std::vector< CSMWorld::UniversalId >& types,
|
void createFilterRequest(std::vector< CSMWorld::UniversalId >& types,
|
||||||
Qt::DropAction action);
|
Qt::DropAction action);
|
||||||
|
void toggleOptions ();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue