|
|
|
@ -16,6 +16,7 @@
|
|
|
|
|
|
|
|
|
|
#include "../../model/doc/document.hpp"
|
|
|
|
|
#include "../../model/settings/usersettings.hpp"
|
|
|
|
|
#include "../../model/prefs/state.hpp"
|
|
|
|
|
|
|
|
|
|
#include "../../model/world/idtable.hpp"
|
|
|
|
|
|
|
|
|
@ -121,10 +122,9 @@ void CSVDoc::View::setupViewMenu()
|
|
|
|
|
mShowStatusBar = new QAction (tr ("Show Status Bar"), this);
|
|
|
|
|
mShowStatusBar->setCheckable (true);
|
|
|
|
|
connect (mShowStatusBar, SIGNAL (toggled (bool)), this, SLOT (toggleShowStatusBar (bool)));
|
|
|
|
|
std::string showStatusBar =
|
|
|
|
|
CSMSettings::UserSettings::instance().settingValue("window/show-statusbar").toStdString();
|
|
|
|
|
if(showStatusBar == "true")
|
|
|
|
|
mShowStatusBar->setChecked(true);
|
|
|
|
|
|
|
|
|
|
mShowStatusBar->setChecked (CSMPrefs::get()["Windows"]["show-statusbar"].isTrue());
|
|
|
|
|
|
|
|
|
|
view->addAction (mShowStatusBar);
|
|
|
|
|
|
|
|
|
|
QAction *filters = new QAction (tr ("Filters"), this);
|
|
|
|
@ -333,9 +333,9 @@ void CSVDoc::View::updateTitle()
|
|
|
|
|
if (mViewTotal>1)
|
|
|
|
|
stream << " [" << (mViewIndex+1) << "/" << mViewTotal << "]";
|
|
|
|
|
|
|
|
|
|
CSMSettings::UserSettings &userSettings = CSMSettings::UserSettings::instance();
|
|
|
|
|
CSMPrefs::Category& windows = CSMPrefs::State::get()["Windows"];
|
|
|
|
|
|
|
|
|
|
bool hideTitle = userSettings.setting ("window/hide-subview", QString ("false"))=="true" &&
|
|
|
|
|
bool hideTitle = windows["hide-subview"].isTrue() &&
|
|
|
|
|
mSubViews.size()==1 && !mSubViews.at (0)->isFloating();
|
|
|
|
|
|
|
|
|
|
if (hideTitle)
|
|
|
|
@ -346,19 +346,18 @@ void CSVDoc::View::updateTitle()
|
|
|
|
|
|
|
|
|
|
void CSVDoc::View::updateSubViewIndicies(SubView *view)
|
|
|
|
|
{
|
|
|
|
|
CSMPrefs::Category& windows = CSMPrefs::State::get()["Windows"];
|
|
|
|
|
|
|
|
|
|
if(view && mSubViews.contains(view))
|
|
|
|
|
{
|
|
|
|
|
mSubViews.removeOne(view);
|
|
|
|
|
|
|
|
|
|
// adjust (reduce) the scroll area (even floating), except when it is "Scrollbar Only"
|
|
|
|
|
CSMSettings::UserSettings &settings = CSMSettings::UserSettings::instance();
|
|
|
|
|
if(settings.settingValue ("window/mainwindow-scrollbar") == "Grow then Scroll")
|
|
|
|
|
if (windows["mainwindow-scrollbar"].toString() == "Grow then Scroll")
|
|
|
|
|
updateScrollbar();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CSMSettings::UserSettings &userSettings = CSMSettings::UserSettings::instance();
|
|
|
|
|
|
|
|
|
|
bool hideTitle = userSettings.setting ("window/hide-subview", QString ("false"))=="true" &&
|
|
|
|
|
bool hideTitle = windows["hide-subview"].isTrue() &&
|
|
|
|
|
mSubViews.size()==1 && !mSubViews.at (0)->isFloating();
|
|
|
|
|
|
|
|
|
|
updateTitle();
|
|
|
|
@ -406,21 +405,16 @@ CSVDoc::View::View (ViewManager& viewManager, CSMDoc::Document *document, int to
|
|
|
|
|
: mViewManager (viewManager), mDocument (document), mViewIndex (totalViews-1),
|
|
|
|
|
mViewTotal (totalViews), mScroll(0), mScrollbarOnly(false)
|
|
|
|
|
{
|
|
|
|
|
int width = CSMSettings::UserSettings::instance().settingValue
|
|
|
|
|
("window/default-width").toInt();
|
|
|
|
|
|
|
|
|
|
int height = CSMSettings::UserSettings::instance().settingValue
|
|
|
|
|
("window/default-height").toInt();
|
|
|
|
|
CSMPrefs::Category& windows = CSMPrefs::State::get()["Windows"];
|
|
|
|
|
|
|
|
|
|
width = std::max(width, 300);
|
|
|
|
|
height = std::max(height, 300);
|
|
|
|
|
int width = std::max (windows["default-width"].toInt(), 300);
|
|
|
|
|
int height = std::max (windows["default-height"].toInt(), 300);
|
|
|
|
|
|
|
|
|
|
resize (width, height);
|
|
|
|
|
|
|
|
|
|
mSubViewWindow.setDockOptions (QMainWindow::AllowNestedDocks);
|
|
|
|
|
|
|
|
|
|
CSMSettings::UserSettings &settings = CSMSettings::UserSettings::instance();
|
|
|
|
|
if(settings.settingValue ("window/mainwindow-scrollbar") == "Grow Only")
|
|
|
|
|
if (windows["mainwindow-scrollbar"].toString() == "Grow Only")
|
|
|
|
|
{
|
|
|
|
|
setCentralWidget (&mSubViewWindow);
|
|
|
|
|
}
|
|
|
|
@ -503,14 +497,12 @@ void CSVDoc::View::updateProgress (int current, int max, int type, int threads)
|
|
|
|
|
|
|
|
|
|
void CSVDoc::View::addSubView (const CSMWorld::UniversalId& id, const std::string& hint)
|
|
|
|
|
{
|
|
|
|
|
CSMSettings::UserSettings &userSettings = CSMSettings::UserSettings::instance();
|
|
|
|
|
CSMPrefs::Category& windows = CSMPrefs::State::get()["Windows"];
|
|
|
|
|
|
|
|
|
|
bool isReferenceable = id.getClass() == CSMWorld::UniversalId::Class_RefRecord;
|
|
|
|
|
|
|
|
|
|
// User setting to reuse sub views (on a per top level view basis)
|
|
|
|
|
bool reuse =
|
|
|
|
|
userSettings.setting ("window/reuse", QString("true")) == "true" ? true : false;
|
|
|
|
|
if(reuse)
|
|
|
|
|
if (windows["reuse"].isTrue())
|
|
|
|
|
{
|
|
|
|
|
foreach(SubView *sb, mSubViews)
|
|
|
|
|
{
|
|
|
|
@ -538,8 +530,7 @@ void CSVDoc::View::addSubView (const CSMWorld::UniversalId& id, const std::strin
|
|
|
|
|
//
|
|
|
|
|
// If the sub view limit setting is one, the sub view title bar is hidden and the
|
|
|
|
|
// text in the main title bar is adjusted accordingly
|
|
|
|
|
int maxSubView = userSettings.setting("window/max-subviews", QString("256")).toInt();
|
|
|
|
|
if(mSubViews.size() >= maxSubView) // create a new top level view
|
|
|
|
|
if(mSubViews.size() >= windows["max-subviews"].toInt()) // create a new top level view
|
|
|
|
|
{
|
|
|
|
|
mViewManager.addView(mDocument, id, hint);
|
|
|
|
|
|
|
|
|
@ -559,8 +550,8 @@ void CSVDoc::View::addSubView (const CSMWorld::UniversalId& id, const std::strin
|
|
|
|
|
view->setParent(this);
|
|
|
|
|
mSubViews.append(view); // only after assert
|
|
|
|
|
|
|
|
|
|
int minWidth = userSettings.setting ("window/minimum-width", QString("325")).toInt();
|
|
|
|
|
view->setMinimumWidth(minWidth);
|
|
|
|
|
int minWidth = windows["minimum-width"].toInt();
|
|
|
|
|
view->setMinimumWidth (minWidth);
|
|
|
|
|
|
|
|
|
|
view->setStatusBar (mShowStatusBar->isChecked());
|
|
|
|
|
|
|
|
|
@ -575,13 +566,11 @@ void CSVDoc::View::addSubView (const CSMWorld::UniversalId& id, const std::strin
|
|
|
|
|
// should become visible)
|
|
|
|
|
// - Move the scroll bar to the newly added subview
|
|
|
|
|
//
|
|
|
|
|
CSMSettings::UserSettings &settings = CSMSettings::UserSettings::instance();
|
|
|
|
|
QString mainwinScroll = settings.settingValue ("window/mainwindow-scrollbar");
|
|
|
|
|
mScrollbarOnly = mainwinScroll.isEmpty() || mainwinScroll == "Scrollbar Only";
|
|
|
|
|
mScrollbarOnly = windows["mainwindow-scrollbar"].toString() == "Scrollbar Only";
|
|
|
|
|
|
|
|
|
|
QDesktopWidget *dw = QApplication::desktop();
|
|
|
|
|
QRect rect;
|
|
|
|
|
if(settings.settingValue ("window/grow-limit") == "true")
|
|
|
|
|
if (windows["grow-limit"].isTrue())
|
|
|
|
|
rect = dw->screenGeometry(this);
|
|
|
|
|
else
|
|
|
|
|
rect = dw->screenGeometry(dw->screen(dw->screenNumber(this)));
|
|
|
|
@ -862,6 +851,7 @@ void CSVDoc::View::resizeViewHeight (int height)
|
|
|
|
|
|
|
|
|
|
void CSVDoc::View::updateUserSetting (const QString &name, const QStringList &list)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (name=="window/hide-subview")
|
|
|
|
|
updateSubViewIndicies (0);
|
|
|
|
|
|
|
|
|
@ -944,10 +934,9 @@ void CSVDoc::View::stop()
|
|
|
|
|
|
|
|
|
|
void CSVDoc::View::closeRequest (SubView *subView)
|
|
|
|
|
{
|
|
|
|
|
CSMSettings::UserSettings &userSettings = CSMSettings::UserSettings::instance();
|
|
|
|
|
CSMPrefs::Category& windows = CSMPrefs::State::get()["Windows"];
|
|
|
|
|
|
|
|
|
|
if (mSubViews.size()>1 || mViewTotal<=1 ||
|
|
|
|
|
userSettings.setting ("window/hide-subview", QString ("false"))!="true")
|
|
|
|
|
if (mSubViews.size()>1 || mViewTotal<=1 || !windows["hide-subview"].isTrue())
|
|
|
|
|
{
|
|
|
|
|
subView->deleteLater();
|
|
|
|
|
mSubViews.removeOne (subView);
|
|
|
|
|