splitter sizes can now be configured and in-app changes are persisted

preferencesAboutTextFull
Clément Fauconnier 6 years ago
parent d6ca0f6ed4
commit 691ee09eb3
  1. 2
      resources/etc/OpenBoard.config
  2. 10
      src/core/UBSettings.cpp
  3. 4
      src/core/UBSettings.h
  4. 18
      src/document/UBDocumentController.cpp
  5. 1
      src/document/UBDocumentController.h

@ -90,6 +90,8 @@ EmptyGroupNames=@Invalid()
ThumbnailWidth=150
SortKind=0
SortOrder=0
SplitterLeftSize=200
SplitterRightSize=800
[IntranetPodcast]
Author=

@ -106,6 +106,8 @@ const int UBSettings::maxThumbnailWidth = 400;
const int UBSettings::defaultThumbnailWidth = 150;
const int UBSettings::defaultSortKind = 0;
const int UBSettings::defaultSortOrder = 0;
const int UBSettings::defaultSplitterLeftSize = 200;
const int UBSettings::defaultSplitterRightSize = 800;
const int UBSettings::defaultLibraryIconSize = 80;
@ -428,9 +430,11 @@ void UBSettings::init()
// removed in version 4.4.b.2
mUserSettings->remove("Podcast/RecordMicrophone");
documentThumbnailWidth = new UBSetting(this, "Document", "ThumbnailWidth", UBSettings::defaultThumbnailWidth);
documentSortKind = new UBSetting(this, "Document", "SortKind", UBSettings::defaultSortKind);
documentSortOrder = new UBSetting(this, "Document", "SortOrder", UBSettings::defaultSortOrder);
documentThumbnailWidth = new UBSetting(this, "Document", "ThumbnailWidth", UBSettings::defaultThumbnailWidth);
documentSortKind = new UBSetting(this, "Document", "SortKind", UBSettings::defaultSortKind);
documentSortOrder = new UBSetting(this, "Document", "SortOrder", UBSettings::defaultSortOrder);
documentSplitterLeftSize = new UBSetting(this, "Document", "SplitterLeftSize", UBSettings::defaultSplitterLeftSize);
documentSplitterRightSize = new UBSetting(this, "Document", "SplitterRightSize", UBSettings::defaultSplitterRightSize);
libraryShowDetailsForLocalItems = new UBSetting(this, "Library", "ShowDetailsForLocalItems", false);

@ -217,6 +217,8 @@ class UBSettings : public QObject
static const int defaultThumbnailWidth;
static const int defaultSortKind;
static const int defaultSortOrder;
static const int defaultSplitterLeftSize;
static const int defaultSplitterRightSize;
static const int defaultLibraryIconSize;
static const int defaultImageWidth;
@ -376,6 +378,8 @@ class UBSettings : public QObject
UBSetting* documentThumbnailWidth;
UBSetting* documentSortKind;
UBSetting* documentSortOrder;
UBSetting* documentSplitterLeftSize;
UBSetting* documentSplitterRightSize;
UBSetting* imageThumbnailWidth;
UBSetting* videoThumbnailWidth;
UBSetting* shapeThumbnailWidth;

@ -1965,12 +1965,11 @@ void UBDocumentController::setupViews()
mDocumentUI->documentTreeView->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
mDocumentUI->documentTreeView->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents);
//set sizes (left and right sides of the splitter) for the splitter here because it cannot be done in the form editor.
const int leftSplitterSize = 100;
const int rightSplitterSize = 1200;
const int splitterLeftSize = UBSettings::settings()->documentSplitterLeftSize->get().toInt();
const int splitterRightSize = UBSettings::settings()->documentSplitterRightSize->get().toInt();
QList<int> splitterSizes;
splitterSizes.append(leftSplitterSize);
splitterSizes.append(rightSplitterSize);
splitterSizes.append(splitterLeftSize);
splitterSizes.append(splitterRightSize);
mDocumentUI->splitter->setSizes(splitterSizes);
//mDocumentUI->documentTreeView->hideColumn(1);
@ -1979,6 +1978,8 @@ void UBDocumentController::setupViews()
connect(mDocumentUI->sortKind, SIGNAL(activated(int)), this, SLOT(onSortKindChanged(int)));
connect(mDocumentUI->sortOrder, SIGNAL(toggled(bool)), this, SLOT(onSortOrderChanged(bool)));
connect(mDocumentUI->splitter, SIGNAL(splitterMoved(int,int)), this, SLOT(onSplitterMoved(int, int)));
connect(mDocumentUI->documentTreeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(TreeViewSelectionChanged(QItemSelection,QItemSelection)));
connect(UBPersistenceManager::persistenceManager()->mDocumentTreeStructureModel, SIGNAL(indexChanged(QModelIndex,QModelIndex))
,mDocumentUI->documentTreeView, SLOT(onModelIndexChanged(QModelIndex,QModelIndex)));
@ -2051,6 +2052,13 @@ void UBDocumentController::onSortKindChanged(int index)
UBSettings::settings()->documentSortKind->setInt(index);
}
void UBDocumentController::onSplitterMoved(int size, int index)
{
Q_UNUSED(index);
UBSettings::settings()->documentSplitterLeftSize->setInt(size);
UBSettings::settings()->documentSplitterRightSize->setInt(controlView()->size().width()-size);
}
QWidget* UBDocumentController::controlView()
{
return mDocumentWidget;

@ -460,6 +460,7 @@ class UBDocumentController : public UBDocumentContainer
//N/C - NNE - 20140403
void onSortKindChanged(int index);
void onSortOrderChanged(bool order);
void onSplitterMoved(int size, int index);
void collapseAll();
void expandAll();

Loading…
Cancel
Save