new parameters SortKind and SortOrder in config (WIP)

preferencesAboutTextFull
Clément Fauconnier 6 years ago
parent b608118fad
commit 568b95594d
  1. 2
      resources/etc/OpenBoard.config
  2. 6
      resources/forms/documents.ui
  3. 7
      src/core/UBSettings.cpp
  4. 4
      src/core/UBSettings.h
  5. 10
      src/document/UBDocumentController.cpp

@ -88,6 +88,8 @@ Username=
[Document] [Document]
EmptyGroupNames=@Invalid() EmptyGroupNames=@Invalid()
ThumbnailWidth=150 ThumbnailWidth=150
SortKind=0
SortOrder=0
[IntranetPodcast] [IntranetPodcast]
Author= Author=

@ -92,17 +92,17 @@
</property> </property>
<item> <item>
<property name="text"> <property name="text">
<string>Alphabetical order</string> <string>Creation date</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Creation date</string> <string>Update date</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Update date</string> <string>Alphabetical order</string>
</property> </property>
</item> </item>
</widget> </widget>

@ -104,6 +104,9 @@ QPointer<QSettings> UBSettings::sAppSettings = 0;
const int UBSettings::maxThumbnailWidth = 400; const int UBSettings::maxThumbnailWidth = 400;
const int UBSettings::defaultThumbnailWidth = 150; const int UBSettings::defaultThumbnailWidth = 150;
const int UBSettings::defaultSortKind = 0;
const int UBSettings::defaultSortOrder = 0;
const int UBSettings::defaultLibraryIconSize = 80; const int UBSettings::defaultLibraryIconSize = 80;
const int UBSettings::defaultGipWidth = 150; const int UBSettings::defaultGipWidth = 150;
@ -425,7 +428,9 @@ void UBSettings::init()
// removed in version 4.4.b.2 // removed in version 4.4.b.2
mUserSettings->remove("Podcast/RecordMicrophone"); mUserSettings->remove("Podcast/RecordMicrophone");
documentThumbnailWidth = new UBSetting(this, "Document", "ThumbnailWidth", UBSettings::defaultThumbnailWidth); documentThumbnailWidth = new UBSetting(this, "Document", "ThumbnailWidth", UBSettings::defaultThumbnailWidth);
documentSortKind = new UBSetting(this, "Document", "SortKind", UBSettings::defaultSortKind);
documentSortOrder = new UBSetting(this, "Document", "SortOrder", UBSettings::defaultSortOrder);
libraryShowDetailsForLocalItems = new UBSetting(this, "Library", "ShowDetailsForLocalItems", false); libraryShowDetailsForLocalItems = new UBSetting(this, "Library", "ShowDetailsForLocalItems", false);

@ -215,6 +215,8 @@ class UBSettings : public QObject
static const int maxThumbnailWidth; static const int maxThumbnailWidth;
static const int defaultThumbnailWidth; static const int defaultThumbnailWidth;
static const int defaultSortKind;
static const int defaultSortOrder;
static const int defaultLibraryIconSize; static const int defaultLibraryIconSize;
static const int defaultImageWidth; static const int defaultImageWidth;
@ -372,6 +374,8 @@ class UBSettings : public QObject
UBSetting* favoritesNativeToolUris; UBSetting* favoritesNativeToolUris;
UBSetting* documentThumbnailWidth; UBSetting* documentThumbnailWidth;
UBSetting* documentSortKind;
UBSetting* documentSortOrder;
UBSetting* imageThumbnailWidth; UBSetting* imageThumbnailWidth;
UBSetting* videoThumbnailWidth; UBSetting* videoThumbnailWidth;
UBSetting* shapeThumbnailWidth; UBSetting* shapeThumbnailWidth;

@ -1979,7 +1979,13 @@ void UBDocumentController::setupViews()
mSortFilterProxyModel->setSourceModel(model); mSortFilterProxyModel->setSourceModel(model);
sortDocuments(UBDocumentController::Alphabetical, UBDocumentController::ASC); int sortKind = UBSettings::settings()->documentSortKind->get().toInt();
int sortOrder = UBSettings::settings()->documentSortOrder->get().toInt();
mUserHasChangedSortOrder = true;
sortDocuments(sortKind, sortOrder);
mDocumentUI->sortKind->setCurrentIndex(sortKind);
mDocumentUI->sortOrder->setCurrentIndex(sortOrder);
mDocumentUI->documentTreeView->setModel(mSortFilterProxyModel); mDocumentUI->documentTreeView->setModel(mSortFilterProxyModel);
@ -1995,7 +2001,7 @@ void UBDocumentController::setupViews()
//set sizes (left and right sides of the splitter) for the splitter here because it cannot be done in the form editor. //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 leftSplitterSize = 100;
const int rightSplitterSize = 1600; const int rightSplitterSize = 900;
QList<int> splitterSizes = { leftSplitterSize, rightSplitterSize }; QList<int> splitterSizes = { leftSplitterSize, rightSplitterSize };
mDocumentUI->splitter->setSizes(splitterSizes); mDocumentUI->splitter->setSizes(splitterSizes);

Loading…
Cancel
Save