Disabled view resize for open views when user setting changes. Fixed

new view size issue to match existing user settings.
actorid
graffy76 11 years ago
parent ce56669339
commit 3f2ae950f5

@ -328,3 +328,15 @@ CSMSettings::SettingPageMap CSMSettings::SettingManager::settingPageMap() const
return pageMap; return pageMap;
} }
void CSMSettings::SettingManager::updateUserSetting(const QString &settingKey,
const QStringList &list)
{
QStringList names = settingKey.split('.');
Setting *setting = findSetting (names.at(0), names.at(1));
setting->setDefinedValues (list);
emit userSettingUpdated (names.at(1), list);
}

@ -75,8 +75,11 @@ namespace CSMSettings
signals: signals:
void userSettingUpdated (const QString &, const QStringList &);
public slots: public slots:
void updateUserSetting (const QString &, const QStringList &);
}; };
} }
#endif // CSMSETTINGS_SETTINGMANAGER_HPP #endif // CSMSETTINGS_SETTINGMANAGER_HPP

@ -58,10 +58,6 @@ namespace CSMSettings {
private: private:
void buildSettingModelDefaults(); void buildSettingModelDefaults();
signals:
void userSettingUpdated(const QString &, const QStringList &);
}; };
} }
#endif // USERSETTINGS_HPP #endif // USERSETTINGS_HPP

@ -492,18 +492,7 @@ void CSVDoc::View::resizeViewHeight (int height)
void CSVDoc::View::updateUserSetting void CSVDoc::View::updateUserSetting
(const QString &name, const QStringList &list) (const QString &name, const QStringList &list)
{ {}
if (list.isEmpty())
return;
int value = list.at(0).toInt();
if (name == "Width")
resizeViewWidth (value);
else if (name == "Height")
resizeViewHeight (value);
}
void CSVDoc::View::toggleShowStatusBar (bool show) void CSVDoc::View::toggleShowStatusBar (bool show)
{ {

@ -49,7 +49,7 @@ void CSVSettings::ListView::buildAbstractItemViewModel()
void CSVSettings::ListView::emitItemViewUpdate (int idx) void CSVSettings::ListView::emitItemViewUpdate (int idx)
{ {
emit viewUpdated (objectName(), selectedValues()); updateView();
} }
QWidget *CSVSettings::ListView::buildWidget(bool isMultiLine, int width) QWidget *CSVSettings::ListView::buildWidget(bool isMultiLine, int width)

@ -52,7 +52,7 @@ void CSVSettings::Page::addView (CSMSettings::Setting *setting)
if (setting->isEditorSetting()) { if (setting->isEditorSetting()) {
connect (view, SIGNAL (viewUpdated(const QString&, const QStringList&)), connect (view, SIGNAL (viewUpdated(const QString&, const QStringList&)),
&CSMSettings::UserSettings::instance(), &CSMSettings::UserSettings::instance(),
SIGNAL (userSettingUpdated (const QString &, const QStringList &))); SLOT (updateUserSetting (const QString &, const QStringList &)));
} }
} }

@ -151,6 +151,11 @@ void CSVSettings::View::setSelectedValues (const QStringList &list,
} }
select (selection); select (selection);
//push changes to model side
//update the view if the selection was set from the model side, not by the
//user
if (doViewUpdate) if (doViewUpdate)
updateView (signalUpdate); updateView (signalUpdate);
} }
@ -198,7 +203,7 @@ QList <QStandardItem *> CSVSettings::View::toStandardItemList
void CSVSettings::View::updateView (bool signalUpdate) const void CSVSettings::View::updateView (bool signalUpdate) const
{ {
if (signalUpdate) if (signalUpdate)
emit viewUpdated(objectName(), selectedValues()); emit viewUpdated(viewKey(), selectedValues());
} }
QString CSVSettings::View::value (int row) const QString CSVSettings::View::value (int row) const

@ -456,12 +456,14 @@ void CSVWorld::Table::updateUserSetting
for (int i=0; i<columns; ++i) for (int i=0; i<columns; ++i)
if (QAbstractItemDelegate *delegate = itemDelegateForColumn (i)) if (QAbstractItemDelegate *delegate = itemDelegateForColumn (i))
if (dynamic_cast<CommandDelegate&> {
(*delegate).updateUserSetting (name, list)) dynamic_cast<CommandDelegate&>
(*delegate).updateUserSetting (name, list);
{ {
emit dataChanged (mModel->index (0, i), emit dataChanged (mModel->index (0, i),
mModel->index (mModel->rowCount()-1, i)); mModel->index (mModel->rowCount()-1, i));
} }
}
} }
void CSVWorld::Table::tableSizeUpdate() void CSVWorld::Table::tableSizeUpdate()

@ -78,8 +78,6 @@ namespace CSVWorld
CSMWorld::UniversalId getUniversalId (int row) const; CSMWorld::UniversalId getUniversalId (int row) const;
void updateUserSetting (const QString &name, const QStringList &list);
std::vector<std::string> getColumnsWithDisplay(CSMWorld::ColumnBase::Display display) const; std::vector<std::string> getColumnsWithDisplay(CSMWorld::ColumnBase::Display display) const;
signals: signals:
@ -123,6 +121,8 @@ namespace CSVWorld
void requestFocus (const std::string& id); void requestFocus (const std::string& id);
void recordFilterChanged (boost::shared_ptr<CSMFilter::Node> filter); void recordFilterChanged (boost::shared_ptr<CSMFilter::Node> filter);
void updateUserSetting (const QString &name, const QStringList &list);
}; };
} }

@ -196,12 +196,6 @@ bool CSVWorld::CommandDelegate::isEditLocked() const
return mEditLock; return mEditLock;
} }
bool CSVWorld::CommandDelegate::updateUserSetting (const QString &name,
const QStringList &list)
{
return false;
}
void CSVWorld::CommandDelegate::setEditorData (QWidget *editor, const QModelIndex& index, bool tryDisplay) const void CSVWorld::CommandDelegate::setEditorData (QWidget *editor, const QModelIndex& index, bool tryDisplay) const
{ {
QVariant v = index.data(Qt::EditRole); QVariant v = index.data(Qt::EditRole);

@ -136,17 +136,15 @@ namespace CSVWorld
bool isEditLocked() const; bool isEditLocked() const;
virtual bool updateUserSetting
(const QString &name, const QStringList &list);
///< \return Does column require update? ///< \return Does column require update?
virtual void setEditorData (QWidget *editor, const QModelIndex& index, bool tryDisplay = false) const; virtual void setEditorData (QWidget *editor, const QModelIndex& index, bool tryDisplay = false) const;
private slots: public slots:
virtual void slotUpdateEditorSetting (const QString &settingName, const QString &settingValue) {} virtual void updateUserSetting
(const QString &name, const QStringList &list) {}
}; };
} }

Loading…
Cancel
Save