diff --git a/resources/customizations/fonts/ALPHONET.TTF b/resources/customizations/fonts/ALPHONET.TTF new file mode 100644 index 00000000..9917987f Binary files /dev/null and b/resources/customizations/fonts/ALPHONET.TTF differ diff --git a/resources/customizations/fonts/Andika-R.ttf b/resources/customizations/fonts/Andika-R.ttf new file mode 100644 index 00000000..b4320f6e Binary files /dev/null and b/resources/customizations/fonts/Andika-R.ttf differ diff --git a/resources/customizations/fonts/SCRIPTCA.TTF b/resources/customizations/fonts/SCRIPTCA.TTF new file mode 100644 index 00000000..b991f68f Binary files /dev/null and b/resources/customizations/fonts/SCRIPTCA.TTF differ diff --git a/resources/customizations/fonts/ScriptEcole2.ttf b/resources/customizations/fonts/ScriptEcole2.ttf new file mode 100644 index 00000000..196aea5f Binary files /dev/null and b/resources/customizations/fonts/ScriptEcole2.ttf differ diff --git a/resources/customizations/fonts/ec.TTF b/resources/customizations/fonts/ec.TTF new file mode 100644 index 00000000..51401f7f Binary files /dev/null and b/resources/customizations/fonts/ec.TTF differ diff --git a/resources/customizations/fonts/ec_co_pt.TTF b/resources/customizations/fonts/ec_co_pt.TTF new file mode 100644 index 00000000..209ff316 Binary files /dev/null and b/resources/customizations/fonts/ec_co_pt.TTF differ diff --git a/resources/customizations/fonts/ec_cour.TTF b/resources/customizations/fonts/ec_cour.TTF new file mode 100644 index 00000000..69844329 Binary files /dev/null and b/resources/customizations/fonts/ec_cour.TTF differ diff --git a/resources/customizations/fonts/ec_cp.TTF b/resources/customizations/fonts/ec_cp.TTF new file mode 100644 index 00000000..8bb6d267 Binary files /dev/null and b/resources/customizations/fonts/ec_cp.TTF differ diff --git a/resources/forms/preferences.ui b/resources/forms/preferences.ui index a82fd0b3..94bbc4bb 100644 --- a/resources/forms/preferences.ui +++ b/resources/forms/preferences.ui @@ -21,59 +21,10 @@ - - - - QFrame::NoFrame - - - QFrame::Raised - - - - 0 - - - - - Default Settings - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Close - - - true - - - - - - - - - 3 + 6 @@ -1034,7 +985,7 @@ p, li { white-space: pre-wrap; } - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> @@ -1050,7 +1001,7 @@ p, li { white-space: pre-wrap; } - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> @@ -1101,6 +1052,85 @@ p, li { white-space: pre-wrap; } + + + Credits + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:12pt; font-weight:600;">Fonts</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Thanks to Henri ROGELET for Script-École 2, ScriptCase-École, Alphonetic (</span><a href="http://pointecole.free.fr/polices.html"><span style=" font-family:'Arial'; text-decoration: underline; color:#0000ff;">http://pointecole.free.fr/polices.html</span></a><span style=" font-family:'Arial';">).</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial';">- Andika Copyright (c) 2004-2011, SIL International (http://www.sil.org/). Licensed under the SIL Open Font License, Version 1.1 (http://scripts.sil.org/OFL), with Reserved Font Names &quot;Andika&quot; and &quot;SIL&quot;.</span></p> +<p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; color:#000000;">- Ecolier CC BY-NC-ND 2.0 (JM Douteau)</span></p></body></html> + + + Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + true + + + false + + + + + + + + + + + QFrame::NoFrame + + + QFrame::Raised + + + + 0 + + + + + Default Settings + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Close + + + true + + + + + + diff --git a/src/core/UBApplication.cpp b/src/core/UBApplication.cpp index be5d8571..faab24bf 100644 --- a/src/core/UBApplication.cpp +++ b/src/core/UBApplication.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #if defined(Q_WS_MACX) #include @@ -351,8 +352,6 @@ int UBApplication::exec(const QString& pFileToImport) } } - - return QApplication::exec(); } diff --git a/src/core/UBApplication.h b/src/core/UBApplication.h index ee85ea0b..2950005f 100644 --- a/src/core/UBApplication.h +++ b/src/core/UBApplication.h @@ -118,8 +118,8 @@ class UBApplication : public QtSingleApplication void showMinimized(); #endif void importUniboardFiles(); - private: + private: void updateProtoActionsState(); QList mProtoMenus; bool mIsVerbose; diff --git a/src/core/UBSettings.cpp b/src/core/UBSettings.cpp index efea1136..28a2a8d5 100644 --- a/src/core/UBSettings.cpp +++ b/src/core/UBSettings.cpp @@ -895,6 +895,19 @@ QString UBSettings::applicationShapeLibraryDirectory() } } +QString UBSettings::applicationCustomizationDirectory() +{ + QString defaultRelativePath = QString("/customizations"); + return UBPlatformUtils::applicationResourcesDirectory() + defaultRelativePath; + +} + +QString UBSettings::applicationCustomFontDirectory() +{ + QString defaultFontDirectory = "/fonts"; + return applicationCustomizationDirectory() + defaultFontDirectory; +} + QString UBSettings::applicationGipLibraryDirectory() { static QString dirPath = ""; diff --git a/src/core/UBSettings.h b/src/core/UBSettings.h index caf05033..2bb7262b 100644 --- a/src/core/UBSettings.h +++ b/src/core/UBSettings.h @@ -118,6 +118,8 @@ class UBSettings : public QObject QString applicationImageLibraryDirectory(); QString applicationApplicationsLibraryDirectory(); QString applicationInteractivesDirectory(); + QString applicationCustomizationDirectory(); + QString applicationCustomFontDirectory(); QNetworkProxy* httpProxy(); diff --git a/src/domain/UBGraphicsTextItemDelegate.cpp b/src/domain/UBGraphicsTextItemDelegate.cpp index 6c6ea66e..c567ef43 100644 --- a/src/domain/UBGraphicsTextItemDelegate.cpp +++ b/src/domain/UBGraphicsTextItemDelegate.cpp @@ -18,14 +18,12 @@ #include "UBGraphicsTextItemDelegate.h" #include "UBGraphicsScene.h" +#include "gui/UBResources.h" + #include "domain/UBGraphicsTextItem.h" #include "domain/UBGraphicsDelegateFrame.h" #include "core/UBSettings.h" -#include "core/UBApplication.h" // TODO UB 4.x clean that dependency -#include "core/UBApplicationController.h" // TODO UB 4.x clean that dependency -#include "core/UBDisplayManager.h" // TODO UB 4.x clean that dependency - #include "core/memcheck.h" #include "board/UBBoardController.h" @@ -146,17 +144,17 @@ void UBGraphicsTextItemDelegate::customize(QFontDialog &fontDialog) safeWebFontNames.append("Arial"); safeWebFontNames.append("Arial Black"); safeWebFontNames.append("Comic Sans MS"); - //safeWebFontNames.append("Century Gothic"); Not available on OSX safeWebFontNames.append("Courier New"); safeWebFontNames.append("Georgia"); safeWebFontNames.append("Impact"); safeWebFontNames.append("Times New Roman"); safeWebFontNames.append("Trebuchet MS"); safeWebFontNames.append("Verdana"); + + QStringList customFontList = UBResources::resources()->customFontList(); int index = 0; - foreach (QString dialogFontName, dialogFontNames) - { - if (safeWebFontNames.contains(dialogFontName, Qt::CaseInsensitive)) + foreach (QString dialogFontName, dialogFontNames){ + if (safeWebFontNames.contains(dialogFontName, Qt::CaseInsensitive) || customFontList.contains(dialogFontName, Qt::CaseSensitive)) index++; else stringListModel->removeRow(index); diff --git a/src/gui/UBResources.cpp b/src/gui/UBResources.cpp index f1eb64ab..1cb63742 100644 --- a/src/gui/UBResources.cpp +++ b/src/gui/UBResources.cpp @@ -18,9 +18,11 @@ #include #include "core/UBApplication.h" - +#include "core/UBSettings.h" +#include "frameworks/UBFileSystemUtils.h" #include "core/memcheck.h" + UBResources* UBResources::sSingleton = 0; UBResources::UBResources(QObject* pParent) @@ -40,6 +42,7 @@ UBResources* UBResources::resources() { sSingleton = new UBResources(UBApplication::staticMemoryCleaner); sSingleton->init(); + sSingleton->buildFontList(); } return sSingleton; @@ -61,3 +64,13 @@ void UBResources::init() rotateCursor = QCursor(QPixmap(":/images/cursors/rotate.png"), 16, 16); drawLineRulerCursor = QCursor(QPixmap(":/images/cursors/drawRulerLine.png"), 3, 12); } + +void UBResources::buildFontList() +{ + QString customFontDirectory = UBSettings::settings()->applicationCustomFontDirectory(); + QStringList fontFiles = UBFileSystemUtils::allFiles(customFontDirectory); + foreach(QString fontFile, fontFiles){ + int fontId = QFontDatabase::addApplicationFont(fontFile); + mCustomFontList << QFontDatabase::applicationFontFamilies(fontId); + } +} diff --git a/src/gui/UBResources.h b/src/gui/UBResources.h index bae4eee6..34e692b4 100644 --- a/src/gui/UBResources.h +++ b/src/gui/UBResources.h @@ -24,6 +24,8 @@ class UBResources : public QObject public: static UBResources* resources(); + QStringList customFontList() { return mCustomFontList; } + private: UBResources(QObject* pParent = 0); @@ -32,6 +34,8 @@ class UBResources : public QObject void init(); static UBResources* sSingleton; + void buildFontList(); + QStringList mCustomFontList; public: