diff --git a/src/core/UBSettings.cpp b/src/core/UBSettings.cpp index e8992d21..30b697a4 100644 --- a/src/core/UBSettings.cpp +++ b/src/core/UBSettings.cpp @@ -78,6 +78,7 @@ QPointer UBSettings::sAppSettings = 0; const int UBSettings::maxThumbnailWidth = 400; const int UBSettings::defaultThumbnailWidth = 150; +const int UBSettings::defaultLibraryIconSize = 80; const int UBSettings::defaultGipWidth = 150; const int UBSettings::defaultSoundWidth = 50; @@ -394,6 +395,8 @@ void UBSettings::init() teacherGuidePageZeroActivated = new UBSetting(this,"DockPalette","TeacherGuideActivatePageZero",true); teacherGuideLessonPagesActivated = new UBSetting(this,"DockPalette","TeacherGuideActivateLessonPages",true); + libIconSize = new UBSetting(this, "Library", "LibIconSize", defaultLibraryIconSize); + actionGroupText = "Group items"; actionUngroupText = "Ungroup items"; } @@ -1184,6 +1187,13 @@ void UBSettings::setCommunityPassword(const QString &password) communityPsw->set(QVariant(password)); } +int UBSettings::libraryIconSize(){ + return libIconSize->get().toInt(); +} + +void UBSettings::setLibraryIconsize(const int& size){ + libIconSize->set(QVariant(size)); +} bool UBSettings::checkDirectory(QString& dirPath) { diff --git a/src/core/UBSettings.h b/src/core/UBSettings.h index 72e05c79..8ed1c2f0 100644 --- a/src/core/UBSettings.h +++ b/src/core/UBSettings.h @@ -96,6 +96,9 @@ class UBSettings : public QObject QString communityPassword(); void setCommunityPassword(const QString& password); + int libraryIconSize(); + void setLibraryIconsize(const int& size); + void init(); //user directories @@ -177,6 +180,7 @@ class UBSettings : public QObject static const int maxThumbnailWidth; static const int defaultThumbnailWidth; + static const int defaultLibraryIconSize; static const int defaultImageWidth; static const int defaultShapeWidth; @@ -205,6 +209,8 @@ class UBSettings : public QObject static QString defaultDocumentGroupName; static QString documentTrashGroupName; + //static int libIconSize; + UBSetting* productWebUrl; QString softwareHomeUrl; @@ -349,6 +355,8 @@ class UBSettings : public QObject UBSetting* teacherGuidePageZeroActivated; UBSetting* teacherGuideLessonPagesActivated; + UBSetting* libIconSize; + public slots: void setPenWidthIndex(int index); diff --git a/src/gui/UBFeaturesWidget.cpp b/src/gui/UBFeaturesWidget.cpp index cad07bbb..7a0a09a1 100644 --- a/src/gui/UBFeaturesWidget.cpp +++ b/src/gui/UBFeaturesWidget.cpp @@ -17,6 +17,7 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name) setObjectName(name); mName = "FeaturesWidget"; mVisibleState = true; + int currentIconSize = UBSettings::settings()->libraryIconSize(); SET_STYLE_SHEET(); //setAttribute(Qt::WA_StyledBackground, true); @@ -63,8 +64,8 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name) featuresListView->setItemDelegate( itemDelegate ); //featuresListView->setSelectionRectVisible(false); - featuresListView->setIconSize( QSize(defaultThumbnailSize, defaultThumbnailSize) ); - featuresListView->setGridSize( QSize(defaultThumbnailSize * 1.75, defaultThumbnailSize * 1.75) ); + featuresListView->setIconSize( QSize(currentIconSize, currentIconSize) ); + featuresListView->setGridSize( QSize(currentIconSize * 1.75, currentIconSize * 1.75) ); //pathListView->setStyleSheet( QString("background: #EEEEEE; border-radius : 10px; border : 2px solid #999999;") ); pathListView->setModel( featuresPathModel ); @@ -104,7 +105,8 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name) thumbSlider = new QSlider( Qt::Horizontal, featuresListView ); thumbSlider->setMinimum( minThumbnailSize ); thumbSlider->setMaximum( maxThumbnailSize ); - thumbSlider->setValue( defaultThumbnailSize ); + thumbSlider->setValue(currentIconSize); + //qDebug() << "init" << featuresListView->height(); thumbSlider->move( 0, featuresListView->height() ); thumbSlider->resize( thumbSlider->width(), thumbSlider->height() + 4 ); @@ -353,6 +355,7 @@ void UBFeaturesWidget::thumbnailSizeChanged( int value ) { featuresListView->setIconSize( QSize( value, value ) ); featuresListView->setGridSize( QSize( value * 1.75, value * 1.75 ) ); + UBSettings::settings()->setLibraryIconsize(value); } void UBFeaturesWidget::onDisplayMetadata( QMap metadata ) diff --git a/src/gui/UBLibNavigatorWidget.cpp b/src/gui/UBLibNavigatorWidget.cpp index 445c5fe1..5e7d5c89 100644 --- a/src/gui/UBLibNavigatorWidget.cpp +++ b/src/gui/UBLibNavigatorWidget.cpp @@ -52,8 +52,10 @@ UBLibNavigatorWidget::UBLibNavigatorWidget(QWidget *parent, const char *name):QW mSlider = new QSlider(Qt::Horizontal, this); mSlider->setMinimumHeight(20); mSlider->setRange(lowBoundForSlider, topBoundForSlider); - mSliderWidthSetting = new UBSetting(UBSettings::settings(), "Library", "LibWidgetWidth", topBoundForSlider); - int defaultWidth = mSliderWidthSetting->get().toInt(); + //mSliderWidthSetting = new UBSetting(UBSettings::settings(), "Library", "LibWidgetWidth", topBoundForSlider); + //int defaultWidth = mSliderWidthSetting->get().toInt(); + int defaultWidth = UBSettings::settings()->libraryIconSize(); + qDebug() << defaultWidth; mSlider->setValue(defaultWidth); mSlider->setTickInterval(tickIntervalForSlider); mLayout->addWidget(mSlider, 0); @@ -181,6 +183,7 @@ void UBLibNavigatorWidget::onDisplaySearchEngine(UBLibElement *elem) */ void UBLibNavigatorWidget::updateThumbnailsSize(int newSize) { - mSliderWidthSetting->set(newSize); + //mSliderWidthSetting->set(newSize); + UBSettings::settings()->setLibraryIconsize(newSize); mLibWidget->updateThumbnailsSize(newSize); }