mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-24 06:53: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.");
|
||||
jumpToAdded->setDefaultValue (defaultValue);
|
||||
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");
|
||||
|
|
|
@ -254,7 +254,7 @@ void CSVWorld::Table::mouseDoubleClickEvent (QMouseEvent *event)
|
|||
CSVWorld::Table::Table (const CSMWorld::UniversalId& id,
|
||||
bool createAndDelete, bool sorting, CSMDoc::Document& document)
|
||||
: DragRecordTable(document), mCreateAction (0),
|
||||
mCloneAction(0),mRecordStatusDisplay (0)
|
||||
mCloneAction(0),mRecordStatusDisplay (0), mAutoJump (false)
|
||||
{
|
||||
CSMSettings::UserSettings &settings = CSMSettings::UserSettings::instance();
|
||||
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)),
|
||||
this, SLOT (rowsInsertedEvent(const QModelIndex&, int, int)));
|
||||
|
||||
if (id == CSMWorld::UniversalId::Type_References)
|
||||
connect (mProxyModel, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)),
|
||||
this, SLOT (dataChangedEvent(const QModelIndex&, const QModelIndex&)));
|
||||
else
|
||||
/// \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()));
|
||||
/// \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 (dataChangedEvent(const QModelIndex&, const QModelIndex&)));
|
||||
|
||||
connect (selectionModel(), SIGNAL (selectionChanged (const QItemSelection&, const QItemSelection&)),
|
||||
this, SLOT (selectionSizeUpdate ()));
|
||||
|
@ -765,8 +761,14 @@ void CSVWorld::Table::dataChangedEvent(const QModelIndex &topLeft, const QModelI
|
|||
{
|
||||
tableSizeUpdate();
|
||||
|
||||
// this event is assumed to be infreqent, don't bother keeping a member variable
|
||||
CSMSettings::UserSettings &settings = CSMSettings::UserSettings::instance();
|
||||
if (settings.setting("table-input/jump-to-modified", "true") == "true")
|
||||
if (mAutoJump)
|
||||
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;
|
||||
bool mJumpToAddedRecord;
|
||||
bool mUnselectAfterJump;
|
||||
bool mAutoJump;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -145,6 +146,8 @@ namespace CSVWorld
|
|||
void rowsInsertedEvent(const QModelIndex &parent, int start, int end);
|
||||
|
||||
void dataChangedEvent(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
||||
|
||||
void jumpAfterModChanged(int state);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
#include "tablesubview.hpp"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QPushButton>
|
||||
#include <QCheckBox>
|
||||
#include <QVBoxLayout>
|
||||
#include <QEvent>
|
||||
#include <QHeaderView>
|
||||
|
@ -18,7 +20,7 @@
|
|||
|
||||
CSVWorld::TableSubView::TableSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document,
|
||||
const CreatorFactoryBase& creatorFactory, bool sorting)
|
||||
: SubView (id)
|
||||
: SubView (id), mShowOptions(false), mOptions(0)
|
||||
{
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
|
||||
|
@ -32,7 +34,37 @@ CSVWorld::TableSubView::TableSubView (const CSMWorld::UniversalId& id, CSMDoc::D
|
|||
|
||||
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;
|
||||
|
||||
|
@ -95,8 +127,7 @@ void CSVWorld::TableSubView::editRequest (const CSMWorld::UniversalId& id, const
|
|||
focusId (id, hint);
|
||||
}
|
||||
|
||||
void CSVWorld::TableSubView::updateUserSetting
|
||||
(const QString &name, const QStringList &list)
|
||||
void CSVWorld::TableSubView::updateUserSetting (const QString &name, const QStringList &list)
|
||||
{
|
||||
mTable->updateUserSetting(name, list);
|
||||
}
|
||||
|
@ -166,3 +197,16 @@ bool CSVWorld::TableSubView::eventFilter (QObject* object, QEvent* event)
|
|||
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>
|
||||
|
||||
class QModelIndex;
|
||||
class QWidget;
|
||||
|
||||
namespace CSMWorld
|
||||
{
|
||||
|
@ -35,6 +36,8 @@ namespace CSVWorld
|
|||
Table *mTable;
|
||||
TableBottomBox *mBottom;
|
||||
CSVFilter::FilterBox *mFilterBox;
|
||||
bool mShowOptions;
|
||||
QWidget *mOptions;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -63,6 +66,7 @@ namespace CSVWorld
|
|||
void cloneRequest (const CSMWorld::UniversalId& toClone);
|
||||
void createFilterRequest(std::vector< CSMWorld::UniversalId >& types,
|
||||
Qt::DropAction action);
|
||||
void toggleOptions ();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue