Show status bar setting working (feature #854). Turns out signals were not needed, may need to clean up later.

pull/276/head
cc9cii 10 years ago
parent 86636bd960
commit d9b0c81299

@ -55,6 +55,8 @@ CS::Editor::Editor (OgreInit::OgreInit& ogreInit)
connect (&mStartup, SIGNAL (loadDocument()), this, SLOT (loadDocument ()));
connect (&mStartup, SIGNAL (editConfig()), this, SLOT (showSettings ()));
connect (&mSettings, SIGNAL (toggleStatusBar(bool)), &mViewManager, SLOT (toggleStatusBar(bool)));
connect (&mFileDialog, SIGNAL(signalOpenFiles (const boost::filesystem::path&)),
this, SLOT(openFiles (const boost::filesystem::path&)));

@ -40,6 +40,7 @@ void CSVDoc::View::closeEvent (QCloseEvent *event)
"Window Size/Height",
QStringList(QString::number(frameGeometry().height())));
CSMSettings::UserSettings::instance().saveDefinitions();
// closeRequest() returns true if last document
mViewManager.removeDocAndView(mDocument);
}
@ -442,6 +443,14 @@ void CSVDoc::View::addSubView (const CSMWorld::UniversalId& id, const std::strin
view->useHint (hint);
view->setStatusBar (mShowStatusBar->isChecked());
// NOTE: only required if show status bar setting should be applied to existing
// window
#if 0
std::string showStatusBar =
CSMSettings::UserSettings::instance().settingValue("Display/show statusbar").toStdString();
view->setStatusBar (showStatusBar == "true");
#endif
mSubViewWindow.addDockWidget (Qt::TopDockWidgetArea, view);
@ -662,6 +671,11 @@ void CSVDoc::View::toggleShowStatusBar (bool show)
}
}
void CSVDoc::View::toggleStatusBar(bool checked)
{
mShowStatusBar->setChecked(checked);
}
void CSVDoc::View::loadErrorLog()
{
addSubView (CSMWorld::UniversalId (CSMWorld::UniversalId::Type_LoadErrorLog, 0));

@ -106,6 +106,8 @@ namespace CSVDoc
void updateProgress (int current, int max, int type, int threads);
void toggleStatusBar(bool checked);
Operations *getOperations() const;
/// Function called by view manager when user preferences are updated

@ -140,6 +140,10 @@ CSVDoc::View *CSVDoc::ViewManager::addView (CSMDoc::Document *document)
mViews.push_back (view);
std::string showStatusBar =
CSMSettings::UserSettings::instance().settingValue("Display/show statusbar").toStdString();
view->toggleStatusBar (showStatusBar == "true");
view->show();
connect (view, SIGNAL (newGameRequest ()), this, SIGNAL (newGameRequest()));
@ -388,6 +392,13 @@ bool CSVDoc::ViewManager::removeDocument (CSVDoc::View *view)
return true;
}
void CSVDoc::ViewManager::toggleStatusBar(bool checked)
{
// NOTE: below only required if status bar change is to be applied to existing
//for (std::vector<View *>::const_iterator iter (mViews.begin()); iter!=mViews.end(); ++iter)
//(*iter)->toggleStatusBar(checked);
}
void CSVDoc::ViewManager::exitApplication (CSVDoc::View *view)
{
if(!removeDocument(view)) // close the current document first

@ -74,6 +74,8 @@ namespace CSVDoc
void exitApplication (CSVDoc::View *view);
void toggleStatusBar(bool checked);
private slots:
void documentStateChanged (int state, CSMDoc::Document *document);

@ -155,6 +155,9 @@ CSVSettings::SettingsDialog::SettingsDialog(QTabWidget *parent)
connect(cbOverride, SIGNAL(toggled(bool)), this, SLOT(slotOverrideToggled(bool)));
connect(cmbRenderSys, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(slotRendererChanged(const QString&)));
connect(rbStdWinSize, SIGNAL(toggled(bool)), this, SLOT(slotStandardToggled(bool)));
// to update the checkbox on the view menu
connect(cbStatusBar, SIGNAL(toggled(bool)), this, SIGNAL (toggleStatusBar(bool)));
}
bool CSVSettings::SettingsDialog::eventFilter(QObject *target, QEvent *event)
@ -295,13 +298,17 @@ void CSVSettings::SettingsDialog::setViewValues()
else
{
// show what's in Ogre instead
index = cmbStdWinSize->findData(getCurrentOgreResolution(), Qt::DisplayRole, Qt::MatchStartsWith);
index = cmbStdWinSize->findData(getCurrentOgreResolution(),
Qt::DisplayRole, Qt::MatchStartsWith);
if(index != -1)
cmbStdWinSize->setCurrentIndex(index);
rbCustWinSize->setChecked(true);
slotStandardToggled(false);
}
// status bar
cbStatusBar->setChecked(mModel->settingValue("Display/show statusbar") == "true");
}
void CSVSettings::SettingsDialog::saveSettings()
@ -368,6 +375,12 @@ void CSVSettings::SettingsDialog::saveSettings()
QStringList(QString::number(sbHeight->value())));
}
// status bar
if(cbStatusBar->isChecked())
mModel->setDefinitions("Display/show statusbar", QStringList("true"));
else
mModel->setDefinitions("Display/show statusbar", QStringList("false"));
mModel->saveDefinitions();
}

@ -55,6 +55,10 @@ namespace CSVSettings {
void slotRendererChanged(const QString &renderer);
void slotOverrideToggled(bool checked);
void slotStandardToggled(bool checked);
signals:
void toggleStatusBar(bool checked);
};
}
#endif // CSVSETTINGS_SETTINGSDIALOG_H

@ -285,7 +285,7 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBox">
<widget class="QCheckBox" name="cbStatusBar">
<property name="text">
<string>Show Status Bar</string>
</property>

Loading…
Cancel
Save