forked from mirror/openmw-tes3mp
Jump to the added/cloned record (or undeleted record in case of undo). Should resolve Feature #2541. Controlled by radio buttons on user preferences settings.
This commit is contained in:
parent
c9d519f36c
commit
f92d801faf
3 changed files with 63 additions and 3 deletions
|
@ -206,6 +206,14 @@ void CSMSettings::UserSettings::buildSettingModelDefaults()
|
||||||
shiftCtrlDoubleClick->setDeclaredValues (values);
|
shiftCtrlDoubleClick->setDeclaredValues (values);
|
||||||
shiftCtrlDoubleClick->setDefaultValue (editRecordAndClose);
|
shiftCtrlDoubleClick->setDefaultValue (editRecordAndClose);
|
||||||
shiftCtrlDoubleClick->setToolTip ("Action on shift control double click in table:<p>" + toolTip);
|
shiftCtrlDoubleClick->setToolTip ("Action on shift control double click in table:<p>" + toolTip);
|
||||||
|
|
||||||
|
QString defaultValue = "Jump and Select";
|
||||||
|
QStringList jumpValues = QStringList() << defaultValue << "Jump Only" << "No Jump";
|
||||||
|
|
||||||
|
Setting *jumpToAdded = createSetting (Type_RadioButton, "jump-to-added",
|
||||||
|
"Jump to the added or cloned record.");
|
||||||
|
jumpToAdded->setDefaultValue (defaultValue);
|
||||||
|
jumpToAdded->setDeclaredValues (jumpValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
declareSection ("search", "Search & Replace");
|
declareSection ("search", "Search & Replace");
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "../../model/world/tablemimedata.hpp"
|
#include "../../model/world/tablemimedata.hpp"
|
||||||
#include "../../model/world/tablemimedata.hpp"
|
#include "../../model/world/tablemimedata.hpp"
|
||||||
#include "../../model/world/commanddispatcher.hpp"
|
#include "../../model/world/commanddispatcher.hpp"
|
||||||
|
#include "../../model/settings/usersettings.hpp"
|
||||||
|
|
||||||
#include "recordstatusdelegate.hpp"
|
#include "recordstatusdelegate.hpp"
|
||||||
#include "util.hpp"
|
#include "util.hpp"
|
||||||
|
@ -255,6 +256,24 @@ CSVWorld::Table::Table (const CSMWorld::UniversalId& id,
|
||||||
: mCreateAction (0), mCloneAction(0), mRecordStatusDisplay (0),
|
: mCreateAction (0), mCloneAction(0), mRecordStatusDisplay (0),
|
||||||
DragRecordTable(document)
|
DragRecordTable(document)
|
||||||
{
|
{
|
||||||
|
CSMSettings::UserSettings &settings = CSMSettings::UserSettings::instance();
|
||||||
|
QString jumpSetting = settings.settingValue ("table-input/jump-to-added");
|
||||||
|
if (jumpSetting.isEmpty() || jumpSetting == "Jump and Select") // default
|
||||||
|
{
|
||||||
|
mJumpToAddedRecord = true;
|
||||||
|
mUnselectAfterJump = false;
|
||||||
|
}
|
||||||
|
else if(jumpSetting == "Jump Only")
|
||||||
|
{
|
||||||
|
mJumpToAddedRecord = true;
|
||||||
|
mUnselectAfterJump = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mJumpToAddedRecord = false;
|
||||||
|
mUnselectAfterJump = false;
|
||||||
|
}
|
||||||
|
|
||||||
mModel = &dynamic_cast<CSMWorld::IdTableBase&> (*mDocument.getData().getTableModel (id));
|
mModel = &dynamic_cast<CSMWorld::IdTableBase&> (*mDocument.getData().getTableModel (id));
|
||||||
|
|
||||||
mProxyModel = new CSMWorld::IdTableProxyModel (this);
|
mProxyModel = new CSMWorld::IdTableProxyModel (this);
|
||||||
|
@ -346,7 +365,7 @@ CSVWorld::Table::Table (const CSMWorld::UniversalId& id,
|
||||||
addAction (mExtendedRevertAction);
|
addAction (mExtendedRevertAction);
|
||||||
|
|
||||||
connect (mProxyModel, SIGNAL (rowsInserted (const QModelIndex&, int, int)),
|
connect (mProxyModel, SIGNAL (rowsInserted (const QModelIndex&, int, int)),
|
||||||
this, SLOT (tableSizeUpdate()));
|
this, SLOT (rowsInsertedEvent(const QModelIndex&, int, int)));
|
||||||
|
|
||||||
/// \note This signal could instead be connected to a slot that filters out changes not affecting
|
/// \note This signal could instead be connected to a slot that filters out changes not affecting
|
||||||
/// the records status column (for permanence reasons)
|
/// the records status column (for permanence reasons)
|
||||||
|
@ -517,9 +536,27 @@ void CSVWorld::Table::previewRecord()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::Table::updateUserSetting
|
void CSVWorld::Table::updateUserSetting (const QString &name, const QStringList &list)
|
||||||
(const QString &name, const QStringList &list)
|
|
||||||
{
|
{
|
||||||
|
if (name=="table-input/jump-to-added")
|
||||||
|
{
|
||||||
|
if(list.isEmpty() || list.at(0) == "Jump and Select") // default
|
||||||
|
{
|
||||||
|
mJumpToAddedRecord = true;
|
||||||
|
mUnselectAfterJump = false;
|
||||||
|
}
|
||||||
|
else if(list.at(0) == "Jump Only")
|
||||||
|
{
|
||||||
|
mJumpToAddedRecord = true;
|
||||||
|
mUnselectAfterJump = true;
|
||||||
|
}
|
||||||
|
else // No Jump
|
||||||
|
{
|
||||||
|
mJumpToAddedRecord = false;
|
||||||
|
mUnselectAfterJump = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (name=="records/type-format" || name=="records/status-format")
|
if (name=="records/type-format" || name=="records/status-format")
|
||||||
{
|
{
|
||||||
int columns = mModel->columnCount();
|
int columns = mModel->columnCount();
|
||||||
|
@ -700,3 +737,14 @@ std::vector< CSMWorld::UniversalId > CSVWorld::Table::getDraggedRecords() const
|
||||||
return idToDrag;
|
return idToDrag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVWorld::Table::rowsInsertedEvent(const QModelIndex& parent, int start, int end)
|
||||||
|
{
|
||||||
|
tableSizeUpdate();
|
||||||
|
if(mJumpToAddedRecord)
|
||||||
|
{
|
||||||
|
selectRow(end);
|
||||||
|
|
||||||
|
if(mUnselectAfterJump)
|
||||||
|
clearSelection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -67,6 +67,8 @@ namespace CSVWorld
|
||||||
CSMWorld::CommandDispatcher *mDispatcher;
|
CSMWorld::CommandDispatcher *mDispatcher;
|
||||||
CSMWorld::UniversalId mEditCellId;
|
CSMWorld::UniversalId mEditCellId;
|
||||||
std::map<Qt::KeyboardModifiers, DoubleClickAction> mDoubleClickActions;
|
std::map<Qt::KeyboardModifiers, DoubleClickAction> mDoubleClickActions;
|
||||||
|
bool mJumpToAddedRecord;
|
||||||
|
bool mUnselectAfterJump;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -139,6 +141,8 @@ namespace CSVWorld
|
||||||
void recordFilterChanged (boost::shared_ptr<CSMFilter::Node> filter);
|
void recordFilterChanged (boost::shared_ptr<CSMFilter::Node> filter);
|
||||||
|
|
||||||
void updateUserSetting (const QString &name, const QStringList &list);
|
void updateUserSetting (const QString &name, const QStringList &list);
|
||||||
|
|
||||||
|
void rowsInsertedEvent(const QModelIndex& parent, int start, int end);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue