Fix for non-commercial version and markdown style changes

This commit is contained in:
Rick Blommers 2019-09-07 13:15:11 +02:00
parent 787c8f1226
commit caf78c4429
4 changed files with 76 additions and 95 deletions

View File

@ -1,7 +1,7 @@
MIT License MIT License
=========== ===========
Copyright 2013-2015 [Reliable Bits Software by Blommers IT](http://blommersit.nl). All Rights Reserved. Copyright 2013-2019 [Reliable Bits Software by Blommers IT](http://blommersit.nl). All Rights Reserved.
Author [Rick Blommers](mailto:rick@blommersit.nl) Author [Rick Blommers](mailto:rick@blommersit.nl)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@ -17,7 +17,7 @@ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHE
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Font Awesome License Font Awesome License
==================== ====================
[https://github.com/FortAwesome/Font-Awesome](https://github.com/FortAwesome/Font-Awesome) [https://github.com/FortAwesome/Font-Awesome](https://github.com/FortAwesome/Font-Awesome)

View File

@ -252,11 +252,11 @@ QtAwesome::~QtAwesome()
if(_namedCodepoints.contains(style::stfas)) if(_namedCodepoints.contains(style::stfas))
delete _namedCodepoints[style::stfas]; delete _namedCodepoints[style::stfas];
#else #else
if(_namedCodepoints.contains(style::fas)) if(_namedCodepoints.contains(style::stfas))
delete _namedCodepoints[style::fas]; delete _namedCodepoints[style::stfas];
if(_namedCodepoints.contains(style::far)) if(_namedCodepoints.contains(style::stfar))
delete _namedCodepoints[style::far]; delete _namedCodepoints[style::stfar];
#endif #endif
} }
@ -2425,13 +2425,13 @@ bool QtAwesome::initFontAwesome( )
for (unsigned i = 0; i < sizeof(faCommonIconArray)/sizeof(FANameIcon) && i < FREE_REGULAR_ICON_SIZE; ++i) { for (unsigned i = 0; i < sizeof(faCommonIconArray)/sizeof(FANameIcon) && i < FREE_REGULAR_ICON_SIZE; ++i) {
farMap->insert(faCommonIconArray[i].name, faCommonIconArray[i].icon); farMap->insert(faCommonIconArray[i].name, faCommonIconArray[i].icon);
} }
_namedCodepoints.insert(style::far, farMap); _namedCodepoints.insert(style::stfar, farMap);
QHash<QString, int> *fasMap = new QHash<QString, int>(); QHash<QString, int> *fasMap = new QHash<QString, int>();
for (unsigned i = 0; i < sizeof(faCommonIconArray)/sizeof(FANameIcon); ++i) { for (unsigned i = 0; i < sizeof(faCommonIconArray)/sizeof(FANameIcon); ++i) {
fasMap->insert(faCommonIconArray[i].name, faCommonIconArray[i].icon); fasMap->insert(faCommonIconArray[i].name, faCommonIconArray[i].icon);
} }
_namedCodepoints.insert(style::fas, fasMap); _namedCodepoints.insert(style::stfas, fasMap);
#endif #endif
return errors; return errors;

View File

@ -19,8 +19,8 @@ HEADERS += \
# only one option must be enabled # only one option must be enabled
CONFIG += fontAwesomePro #CONFIG += fontAwesomePro
#CONFIG += fontAwesomeFree CONFIG += fontAwesomeFree
include(../QtAwesome/QtAwesome.pri) include(../QtAwesome/QtAwesome.pri)
FORMS += \ FORMS += \

151
README.md
View File

@ -1,8 +1,6 @@
QtAwesome - Font Awesome support for Qt applications # QtAwesome - Font Awesome support for Qt applications
====================================================
Description ## Description
-----------
QtAwesome is a simple library that can be used to add [Font Awesome](http://fortawesome.github.io/Font-Awesome/) icons to your [Qt application](http://qt-project.org/). QtAwesome is a simple library that can be used to add [Font Awesome](http://fortawesome.github.io/Font-Awesome/) icons to your [Qt application](http://qt-project.org/).
@ -10,23 +8,21 @@ NOTE: Though the name is QtAwesome and currently it's very Font Awesome based, y
The class can also be used to manage your own dynamic code-drawn icons, by adding named icon-painters. The class can also be used to manage your own dynamic code-drawn icons, by adding named icon-painters.
Changes in FontAwesome 5.10.2 ## Changes in FontAwesome 5.10.2
----------------------------
New version of this library added support to Font Awesome version **5.10.2**. New version of this library added support to Font Awesome version **5.10.2**.
* This library supports Free and Pro versions of Font Awesome, however only the pro font files are included in this repository, but if you have a pro license of the icons you can use it. * This library supports Free and Pro versions of Font Awesome, however only the pro font files are included in this repository, but if you have a pro license of the icons you can use it.
* It support all icons styles (solid, regular, brand, light, duotone), including the duotone icons in pro version. * It support all icons styles (solid, regular, brand, light, duotone), including the duotone icons in pro version.
Changes in FontAwesome 4.7.0 ## Changes in FontAwesome 4.7.0
----------------------------
Previous version of this library added support to Font Awesome version **4.7.0**. Previous version of this library added support to Font Awesome version **4.7.0**.
You can find the font-aweomse 4 version in the branch. (https://github.com/gamecreature/QtAwesome/tree/fontawesome-4)
* In the 4.5.0 version the _linux name has been changed to fa_linux. (Makes the naming of conflicting/invalid names more consistent, like fa_try and fa_500px) * In the 4.5.0 version the _linux name has been changed to fa_linux. (Makes the naming of conflicting/invalid names more consistent, like fa_try and fa_500px)
* You can find the previous FontAwesome 4 c++11 library in the [c++11 branch](https://github.com/gamecreature/QtAwesome/tree/c++11). * You can find the previous FontAwesome 4 c++11 library in the [c++11 branch](https://github.com/gamecreature/QtAwesome/tree/c++11).
* You can find the previous FontAwesome 3 library in the [fontawesome-3 branch](https://github.com/gamecreature/QtAwesome/tree/fontawesome-3). * You can find the previous FontAwesome 3 library in the [fontawesome-3 branch](https://github.com/gamecreature/QtAwesome/tree/fontawesome-3).
**Note about previous c++11** **Note about previous c++11**
@ -34,38 +30,31 @@ I removed the C++11 requirement. And moved the c++11 code to a c++11 branch.
It's not that I don't like c++11, but the typed enum made the code less flexible then it is now. It's not that I don't like c++11, but the typed enum made the code less flexible then it is now.
Just integers it is. Simpler is better. Just integers it is. Simpler is better.
## Installation
Installation
------------
The easiest way to include QtAweome **5.10.2** in your project is to copy the QtAwesome directory to your The easiest way to include QtAweome **5.10.2** in your project is to copy the QtAwesome directory to your
project tree and add the following `include()` to your Qt project file: project tree and add the following `include()` to your Qt project file:
CONFIG+=fontAwesomeFree #or CONFIG+=fontAwesomePro for pro version ```bash
include(QtAwesome/QtAwesome.pri) CONFIG+=fontAwesomeFree #or CONFIG+=fontAwesomePro for pro version
include(QtAwesome/QtAwesome.pri)
```
Now you are good to go! Now you are good to go!
## Usage
Usage
-----
You probably want to create a single QtAwesome object for your whole application: You probably want to create a single QtAwesome object for your whole application:
```` ```c++
QtAwesome* awesome = new QtAwesome( qApp ) QtAwesome* awesome = new QtAwesome( qApp )
awesome->initFontAwesome(); // This line is important as it loads the font and initializes the named icon map awesome->initFontAwesome(); // This line is important as it loads the font and initializes the named icon map
```
````
* Add an accessor to this object (i.e. a global function, member of your application object, or whatever you like). * Add an accessor to this object (i.e. a global function, member of your application object, or whatever you like).
* Use an icon name from the [Font Awesome Cheatsheet](http://fortawesome.github.io/Font-Awesome/cheatsheet/). * Use an icon name from the [Font Awesome Cheatsheet](http://fortawesome.github.io/Font-Awesome/cheatsheet/).
## Example
Example
--------
```c++ ```c++
// You should create a single object of QtAwesome. // You should create a single object of QtAwesome.
@ -95,8 +84,7 @@ label->setFont( awesome->font(style::fab, 16) );
``` ```
Example custom painter ## Example custom painter
----------------------
This example registers a custom painter for supporting a duplicate icon (it draws 2 "plus marks"): This example registers a custom painter for supporting a duplicate icon (it draws 2 "plus marks"):
@ -125,9 +113,7 @@ public:
awesome->give("duplicate", new DuplicateIconPainter() ); awesome->give("duplicate", new DuplicateIconPainter() );
``` ```
## Default options
Default options:
----------------
The following options are default in the QtAwesome class. The following options are default in the QtAwesome class.
@ -145,7 +131,8 @@ setDefaultOption( "text-selected", QString() );
setDefaultOption( "scale-factor", 0.9 ); setDefaultOption( "scale-factor", 0.9 );
``` ```
In pro version In pro version
```c++ ```c++
setDefaultOption( "duotone-color", QColor(50,50,50,127) ); setDefaultOption( "duotone-color", QColor(50,50,50,127) );
setDefaultOption( "duotone-color-disabled", QColor(70,70,70,50)); setDefaultOption( "duotone-color-disabled", QColor(70,70,70,50));
@ -153,14 +140,14 @@ setDefaultOption( "duotone-color-active", QColor(10,10,10, 00));
setDefaultOption( "duotone-color-selected", QColor(10,10,10,210)); setDefaultOption( "duotone-color-selected", QColor(10,10,10,210));
``` ```
When creating an icon, it first populates the options-map with the default options from the QtAwesome object. When creating an icon, it first populates the options-map with the default options from the QtAwesome object.
After that the options are expanded/overwritten by the options supplied to the icon. After that the options are expanded/overwritten by the options supplied to the icon.
It is possible to use another glyph per icon-state. For example to make an icon-unlock symbol switch to locked when selected, It is possible to use another glyph per icon-state. For example to make an icon-unlock symbol switch to locked when selected,
you could supply the following option: you could supply the following option:
```c++ ```c++
options.insert("text-selected", QString( fa::lock ) ); options.insert("text-selected", QString( fa::lock ) );
``` ```
Color and text options have the following structure: Color and text options have the following structure:
@ -171,42 +158,41 @@ And iconstate On is off.
So the list of items used is: So the list of items used is:
- color * color
- color-disabled * color-disabled
- color-active * color-active
- color-selected * color-selected
- color-off * color-off
- color-disabled-off * color-disabled-off
- color-active-off * color-active-off
- color-selected-off * color-selected-off
- duotone-color (only in pro mode) * duotone-color (only in pro mode)
- duotone-color-disabled (only in pro mode) * duotone-color-disabled (only in pro mode)
- duotone-color-active (only in pro mode) * duotone-color-active (only in pro mode)
- duotone-color-selected (only in pro mode) * duotone-color-selected (only in pro mode)
- duotone-color-off (only in pro mode) * duotone-color-off (only in pro mode)
- duotone-color-disabled-off (only in pro mode) * duotone-color-disabled-off (only in pro mode)
- duotone-color-active-off (only in pro mode) * duotone-color-active-off (only in pro mode)
- duotone-color-selected-off (only in pro mode) * duotone-color-selected-off (only in pro mode)
- text * text
- text-disabled * text-disabled
- text-active * text-active
- text-selected * text-selected
- text-off * text-off
- text-disabled-off * text-disabled-off
- text-active-off * text-active-off
- text-selected-off * text-selected-off
- style * style
- style-disabled * style-disabled
- style-active * style-active
- style-selected * style-selected
- style-off * style-off
- style-disabled-off * style-disabled-off
- style-active-off * style-active-off
- style-selected-off * style-selected-off
## License
License
-------
MIT License. Copyright 2013 - Reliable Bits Software by Blommers IT. [http://blommersit.nl/](http://blommersit.nl) MIT License. Copyright 2013 - Reliable Bits Software by Blommers IT. [http://blommersit.nl/](http://blommersit.nl)
@ -214,17 +200,14 @@ The Font Awesome font is licensed under the SIL Open Font License - [http://scri
The Font Awesome pictograms are licensed under the CC BY 3.0 License - [http://creativecommons.org/licenses/by/3.0/](http://creativecommons.org/licenses/by/3.0/) The Font Awesome pictograms are licensed under the CC BY 3.0 License - [http://creativecommons.org/licenses/by/3.0/](http://creativecommons.org/licenses/by/3.0/)
"Font Awesome by Dave Gandy - http://fortawesome.github.com/Font-Awesome" "Font Awesome by Dave Gandy - http://fortawesome.github.com/Font-Awesome"
Contact ## Contact
-------
* email: <rick@blommersit.nl> * email: <rick@blommersit.nl>
* twitter: [https://twitter.com/gamecreature](https://twitter.com/gamecreature) * twitter: [https://twitter.com/gamecreature](https://twitter.com/gamecreature)
* website: [http://blommersit.nl](http://blommersit.nl) (warning Dutch content ahead) * website: [http://blommersit.nl](http://blommersit.nl) (warning Dutch content ahead)
* github: [https://github.com/gamecreature/QtAwesome](https://github.com/gamecreature/QtAwesome) * github: [https://github.com/gamecreature/QtAwesome](https://github.com/gamecreature/QtAwesome)
## Known issues and workarounds
Known issues and workarounds
----------------------------
On Mac OS X, placing an qtAwesome icon in QMainWindow menu, doesn't work directly. On Mac OS X, placing an qtAwesome icon in QMainWindow menu, doesn't work directly.
See the following issue: [https://github.com/gamecreature/QtAwesome/issues/10] See the following issue: [https://github.com/gamecreature/QtAwesome/issues/10]
@ -236,9 +219,7 @@ QAction* menuAction = new QAction("test");
menuAction->setIcon( awesome->icon(fa::beer).pixmap(32,32) ); menuAction->setIcon( awesome->icon(fa::beer).pixmap(32,32) );
``` ```
## Remarks
Remarks
-------
I've created this project because I needed some nice icons for my own Qt project. After doing a lot of I've created this project because I needed some nice icons for my own Qt project. After doing a lot of
css/html5 work and being spoiled by the ease of twitter bootstrap with Font Awesome, css/html5 work and being spoiled by the ease of twitter bootstrap with Font Awesome,
@ -249,9 +230,9 @@ a work in progress. So feel free to drop me an e-mail for your suggestions and i
There are still some things todo, like: There are still some things todo, like:
* document the usage of another icon font * document the usage of another icon font
* add some tests * add some tests
* do some code cleanup * do some code cleanup
Thanks go to the contributors of this project! Thanks go to the contributors of this project!