added custom fonts

preferencesAboutTextFull
Claudio Valerio 13 years ago
parent f0d153fedf
commit c87ec61e4a
  1. BIN
      resources/customizations/fonts/ALPHONET.TTF
  2. BIN
      resources/customizations/fonts/Andika-R.ttf
  3. BIN
      resources/customizations/fonts/SCRIPTCA.TTF
  4. BIN
      resources/customizations/fonts/ScriptEcole2.ttf
  5. BIN
      resources/customizations/fonts/ec.TTF
  6. BIN
      resources/customizations/fonts/ec_co_pt.TTF
  7. BIN
      resources/customizations/fonts/ec_cour.TTF
  8. BIN
      resources/customizations/fonts/ec_cp.TTF
  9. 134
      resources/forms/preferences.ui
  10. 3
      src/core/UBApplication.cpp
  11. 2
      src/core/UBApplication.h
  12. 13
      src/core/UBSettings.cpp
  13. 2
      src/core/UBSettings.h
  14. 14
      src/domain/UBGraphicsTextItemDelegate.cpp
  15. 15
      src/gui/UBResources.cpp
  16. 4
      src/gui/UBResources.h

@ -21,59 +21,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0">
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="defaultSettingsButton">
<property name="text">
<string>Default Settings</string>
</property>
</widget>
</item>
<item>
<spacer name="bottomHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="closeButton">
<property name="text">
<string>Close</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QTabWidget" name="mainTabWidget"> <widget class="QTabWidget" name="mainTabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>3</number> <number>6</number>
</property> </property>
<widget class="QWidget" name="displayTab"> <widget class="QWidget" name="displayTab">
<attribute name="title"> <attribute name="title">
@ -1034,7 +985,7 @@ p, li { white-space: pre-wrap; }
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<widget class="QTextBrowser" name="textBrowser"> <widget class="QTextBrowser" name="copyrightTextBrowser">
<property name="html"> <property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
@ -1050,7 +1001,7 @@ p, li { white-space: pre-wrap; }
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QTextBrowser" name="textBrowser_2"> <widget class="QTextBrowser" name="ownerTextBrowser">
<property name="html"> <property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
@ -1101,6 +1052,85 @@ p, li { white-space: pre-wrap; }
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="creditsTab">
<attribute name="title">
<string>Credits</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QTextBrowser" name="credentialTextBrowser">
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Arial'; font-size:12pt; font-weight:600;&quot;&gt;Fonts&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Arial';&quot;&gt;- Thanks to Henri ROGELET for Script-École 2, ScriptCase-École, Alphonetic (&lt;/span&gt;&lt;a href=&quot;http://pointecole.free.fr/polices.html&quot;&gt;&lt;span style=&quot; font-family:'Arial'; text-decoration: underline; color:#0000ff;&quot;&gt;http://pointecole.free.fr/polices.html&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Arial';&quot;&gt;).&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Arial';&quot;&gt;- 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 &amp;quot;Andika&amp;quot; and &amp;quot;SIL&amp;quot;.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Arial'; color:#000000;&quot;&gt;- Ecolier CC BY-NC-ND 2.0 (JM Douteau)&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textInteractionFlags">
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="openLinks">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="3" column="0">
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="defaultSettingsButton">
<property name="text">
<string>Default Settings</string>
</property>
</widget>
</item>
<item>
<spacer name="bottomHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="closeButton">
<property name="text">
<string>Close</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget> </widget>
</item> </item>
</layout> </layout>

@ -18,6 +18,7 @@
#include <QtGui> #include <QtGui>
#include <QtWebKit> #include <QtWebKit>
#include <QtXml> #include <QtXml>
#include <QFontDatabase>
#if defined(Q_WS_MACX) #if defined(Q_WS_MACX)
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
@ -351,8 +352,6 @@ int UBApplication::exec(const QString& pFileToImport)
} }
} }
return QApplication::exec(); return QApplication::exec();
} }

@ -118,8 +118,8 @@ class UBApplication : public QtSingleApplication
void showMinimized(); void showMinimized();
#endif #endif
void importUniboardFiles(); void importUniboardFiles();
private:
private:
void updateProtoActionsState(); void updateProtoActionsState();
QList<QMenu*> mProtoMenus; QList<QMenu*> mProtoMenus;
bool mIsVerbose; bool mIsVerbose;

@ -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() QString UBSettings::applicationGipLibraryDirectory()
{ {
static QString dirPath = ""; static QString dirPath = "";

@ -118,6 +118,8 @@ class UBSettings : public QObject
QString applicationImageLibraryDirectory(); QString applicationImageLibraryDirectory();
QString applicationApplicationsLibraryDirectory(); QString applicationApplicationsLibraryDirectory();
QString applicationInteractivesDirectory(); QString applicationInteractivesDirectory();
QString applicationCustomizationDirectory();
QString applicationCustomFontDirectory();
QNetworkProxy* httpProxy(); QNetworkProxy* httpProxy();

@ -18,14 +18,12 @@
#include "UBGraphicsTextItemDelegate.h" #include "UBGraphicsTextItemDelegate.h"
#include "UBGraphicsScene.h" #include "UBGraphicsScene.h"
#include "gui/UBResources.h"
#include "domain/UBGraphicsTextItem.h" #include "domain/UBGraphicsTextItem.h"
#include "domain/UBGraphicsDelegateFrame.h" #include "domain/UBGraphicsDelegateFrame.h"
#include "core/UBSettings.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 "core/memcheck.h"
#include "board/UBBoardController.h" #include "board/UBBoardController.h"
@ -146,17 +144,17 @@ void UBGraphicsTextItemDelegate::customize(QFontDialog &fontDialog)
safeWebFontNames.append("Arial"); safeWebFontNames.append("Arial");
safeWebFontNames.append("Arial Black"); safeWebFontNames.append("Arial Black");
safeWebFontNames.append("Comic Sans MS"); safeWebFontNames.append("Comic Sans MS");
//safeWebFontNames.append("Century Gothic"); Not available on OSX
safeWebFontNames.append("Courier New"); safeWebFontNames.append("Courier New");
safeWebFontNames.append("Georgia"); safeWebFontNames.append("Georgia");
safeWebFontNames.append("Impact"); safeWebFontNames.append("Impact");
safeWebFontNames.append("Times New Roman"); safeWebFontNames.append("Times New Roman");
safeWebFontNames.append("Trebuchet MS"); safeWebFontNames.append("Trebuchet MS");
safeWebFontNames.append("Verdana"); safeWebFontNames.append("Verdana");
QStringList customFontList = UBResources::resources()->customFontList();
int index = 0; int index = 0;
foreach (QString dialogFontName, dialogFontNames) foreach (QString dialogFontName, dialogFontNames){
{ if (safeWebFontNames.contains(dialogFontName, Qt::CaseInsensitive) || customFontList.contains(dialogFontName, Qt::CaseSensitive))
if (safeWebFontNames.contains(dialogFontName, Qt::CaseInsensitive))
index++; index++;
else else
stringListModel->removeRow(index); stringListModel->removeRow(index);

@ -18,9 +18,11 @@
#include <QtGui> #include <QtGui>
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/UBSettings.h"
#include "frameworks/UBFileSystemUtils.h"
#include "core/memcheck.h" #include "core/memcheck.h"
UBResources* UBResources::sSingleton = 0; UBResources* UBResources::sSingleton = 0;
UBResources::UBResources(QObject* pParent) UBResources::UBResources(QObject* pParent)
@ -40,6 +42,7 @@ UBResources* UBResources::resources()
{ {
sSingleton = new UBResources(UBApplication::staticMemoryCleaner); sSingleton = new UBResources(UBApplication::staticMemoryCleaner);
sSingleton->init(); sSingleton->init();
sSingleton->buildFontList();
} }
return sSingleton; return sSingleton;
@ -61,3 +64,13 @@ void UBResources::init()
rotateCursor = QCursor(QPixmap(":/images/cursors/rotate.png"), 16, 16); rotateCursor = QCursor(QPixmap(":/images/cursors/rotate.png"), 16, 16);
drawLineRulerCursor = QCursor(QPixmap(":/images/cursors/drawRulerLine.png"), 3, 12); 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);
}
}

@ -24,6 +24,8 @@ class UBResources : public QObject
public: public:
static UBResources* resources(); static UBResources* resources();
QStringList customFontList() { return mCustomFontList; }
private: private:
UBResources(QObject* pParent = 0); UBResources(QObject* pParent = 0);
@ -32,6 +34,8 @@ class UBResources : public QObject
void init(); void init();
static UBResources* sSingleton; static UBResources* sSingleton;
void buildFontList();
QStringList mCustomFontList;
public: public:

Loading…
Cancel
Save