diff --git a/gui.pro b/gui.pro index f9e6030f..c1c8b880 100644 --- a/gui.pro +++ b/gui.pro @@ -6,6 +6,8 @@ TARGET = MoolticuteApp CONFIG += c++11 +include(src/QtAwesome/QtAwesome.pri) + SOURCES += src/main_gui.cpp \ src/MainWindow.cpp \ src/Common.cpp \ @@ -17,3 +19,10 @@ HEADERS += src/MainWindow.h \ src/WSClient.h FORMS += src/MainWindow.ui + +RESOURCES += \ + img/images.qrc + +win32 { + RC_FILE = win/windows_res.rc +} diff --git a/img/AppIcon_128.png b/img/AppIcon_128.png new file mode 100644 index 00000000..68170c1e Binary files /dev/null and b/img/AppIcon_128.png differ diff --git a/img/AppIcon_19.png b/img/AppIcon_19.png new file mode 100644 index 00000000..ccba8d07 Binary files /dev/null and b/img/AppIcon_19.png differ diff --git a/img/AppIcon_32.png b/img/AppIcon_32.png new file mode 100644 index 00000000..557e5f9a Binary files /dev/null and b/img/AppIcon_32.png differ diff --git a/img/Plain_128.png b/img/Plain_128.png new file mode 100644 index 00000000..c6e7a679 Binary files /dev/null and b/img/Plain_128.png differ diff --git a/img/images.qrc b/img/images.qrc new file mode 100644 index 00000000..f52af7a9 --- /dev/null +++ b/img/images.qrc @@ -0,0 +1,20 @@ + + + AppIcon_19.png + AppIcon_32.png + AppIcon_128.png + images.qrc + integrity-check.png + management-mode.png + message_alert.png + message_error.png + message_success.png + mp-logo.png + new-card.png + no-card.png + no-connection.png + noun_18878_cc.png + Plain_128.png + unlock.png + + diff --git a/img/integrity-check.png b/img/integrity-check.png new file mode 100644 index 00000000..5db4d1aa Binary files /dev/null and b/img/integrity-check.png differ diff --git a/img/management-mode.png b/img/management-mode.png new file mode 100644 index 00000000..ccfe7d6e Binary files /dev/null and b/img/management-mode.png differ diff --git a/img/message_alert.png b/img/message_alert.png new file mode 100644 index 00000000..49d16365 Binary files /dev/null and b/img/message_alert.png differ diff --git a/img/message_error.png b/img/message_error.png new file mode 100644 index 00000000..6ec5fac5 Binary files /dev/null and b/img/message_error.png differ diff --git a/img/message_success.png b/img/message_success.png new file mode 100644 index 00000000..b17322ba Binary files /dev/null and b/img/message_success.png differ diff --git a/img/mp-logo.png b/img/mp-logo.png new file mode 100644 index 00000000..e11eb60b Binary files /dev/null and b/img/mp-logo.png differ diff --git a/img/new-card.png b/img/new-card.png new file mode 100644 index 00000000..93b90c22 Binary files /dev/null and b/img/new-card.png differ diff --git a/img/no-card.png b/img/no-card.png new file mode 100644 index 00000000..42cf9806 Binary files /dev/null and b/img/no-card.png differ diff --git a/img/no-connection.png b/img/no-connection.png new file mode 100644 index 00000000..facfe60f Binary files /dev/null and b/img/no-connection.png differ diff --git a/img/noun_18878_cc.png b/img/noun_18878_cc.png new file mode 100644 index 00000000..f45ce728 Binary files /dev/null and b/img/noun_18878_cc.png differ diff --git a/img/unlock.png b/img/unlock.png new file mode 100644 index 00000000..2c71dec8 Binary files /dev/null and b/img/unlock.png differ diff --git a/mac/Info.plist b/mac/Info.plist new file mode 100644 index 00000000..da0ad729 --- /dev/null +++ b/mac/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleIconFile + icon.icns + CFBundlePackageType + APPL + CFBundleGetInfoString + Created by Qt/QMake + CFBundleSignature + ???? + CFBundleExecutable + MoolticuteApp + CFBundleIdentifier + org.raoulh.moolticute + NOTE + This file was generated by Qt/QMake. + NSPrincipalClass + NSApplication + NSHighResolutionCapable + + + diff --git a/mac/create_dmg.sh b/mac/create_dmg.sh new file mode 100755 index 00000000..201471fb --- /dev/null +++ b/mac/create_dmg.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +if [ $# -ne 1 ] +then + echo "Usage: $0 " + exit 1 +fi + +VERSION=$1 + +echo "Copy files..." +cp Info.plist ../../build/Moolticute.app/Contents/ +cp icon.icns ../../build/Moolticute.app/Contents/Resources/ + +echo "Creating dmg package..." +macdeployqt ../../build/Moolticute.app -dmg +mv ../../build/calaos_installer.dmg ../../Moolticute_macosx_$VERSION.dmg + +echo "Done." +echo "Package: ../../Moolticute_macosx_$VERSION.dmg" diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index bbd5c24c..920e7568 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -19,27 +19,67 @@ #include "MainWindow.h" #include "ui_MainWindow.h" +#define CSS_BLUE_BUTTON "QPushButton {" \ + "color: #fff;" \ + "background-color: #60B1C7;" \ + "padding: 15px;" \ + "border: none;" \ + "}" \ + "QPushButton:hover {" \ + "background-color: #3d96af;" \ + "}" + MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { + awesome = new QtAwesome(this); + awesome->initFontAwesome(); + ui->setupUi(this); + ui->pushButtonDevSettings->setIcon(awesome->icon(fa::wrench)); + ui->pushButtonCred->setIcon(awesome->icon(fa::key)); + ui->pushButtonSync->setIcon(awesome->icon(fa::refresh)); + + ui->labelLogo->setPixmap(QPixmap(":/mp-logo.png").scaled(500, ui->widgetHeader->sizeHint().height() - 8, Qt::KeepAspectRatio)); + wsClient = new WSClient(this); - connect(wsClient, &WSClient::connectedChanged, [=]() - { - if (wsClient->get_connected()) - ui->plainTextEdit->appendPlainText("Mooltipass connected"); - else - ui->plainTextEdit->appendPlainText("Mooltipass disconnected"); - }); - connect(wsClient, &WSClient::statusChanged, [=]() - { - ui->plainTextEdit->appendPlainText(QString("Status: %1").arg(Common::MPStatusString[wsClient->get_status()])); - }); +// connect(wsClient, &WSClient::connectedChanged, [=]() +// { +// if (wsClient->get_connected()) +// ui->plainTextEdit->appendPlainText("Mooltipass connected"); +// else +// ui->plainTextEdit->appendPlainText("Mooltipass disconnected"); +// }); +// connect(wsClient, &WSClient::statusChanged, [=]() +// { +// ui->plainTextEdit->appendPlainText(QString("Status: %1").arg(Common::MPStatusString[wsClient->get_status()])); +// }); + + ui->pushButtonMemMode->setStyleSheet(CSS_BLUE_BUTTON); + ui->pushButtonExportFile->setStyleSheet(CSS_BLUE_BUTTON); + ui->pushButtonImportFile->setStyleSheet(CSS_BLUE_BUTTON); + + connect(ui->pushButtonDevSettings, SIGNAL(clicked(bool)), this, SLOT(updatedPage())); + connect(ui->pushButtonCred, SIGNAL(clicked(bool)), this, SLOT(updatedPage())); + connect(ui->pushButtonSync, SIGNAL(clicked(bool)), this, SLOT(updatedPage())); + + ui->pushButtonDevSettings->setChecked(true); + ui->stackedWidget->setCurrentIndex(0); } MainWindow::~MainWindow() { delete ui; } + +void MainWindow::updatedPage() +{ + if (ui->pushButtonDevSettings->isChecked()) + ui->stackedWidget->setCurrentIndex(0); + else if (ui->pushButtonCred->isChecked()) + ui->stackedWidget->setCurrentIndex(1); + else if (ui->pushButtonSync->isChecked()) + ui->stackedWidget->setCurrentIndex(2); +} diff --git a/src/MainWindow.h b/src/MainWindow.h index e76f805e..ab0ae9ad 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -21,6 +21,7 @@ #include #include "WSClient.h" +#include namespace Ui { class MainWindow; @@ -35,11 +36,15 @@ class MainWindow : public QMainWindow ~MainWindow(); private slots: + void updatedPage(); + + // void mpAdded(MPDevice *device); // void mpRemoved(MPDevice *); private: Ui::MainWindow *ui; + QtAwesome* awesome; WSClient *wsClient; }; diff --git a/src/MainWindow.ui b/src/MainWindow.ui index 94c159d7..74ccbe7b 100644 --- a/src/MainWindow.ui +++ b/src/MainWindow.ui @@ -6,22 +6,554 @@ 0 0 - 611 - 379 + 780 + 457 - MainWindow + Moolticute + + + + :/AppIcon_32.png:/AppIcon_32.png + + + QMainWindow { +background-color: #fff; +color: #222222; +} + +QLabel { +color: #222222; +} + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + QPushButton { +color: #333333; +background-color: #EFEFEF; +padding: 15px; +border: none; +} + +QPushButton:hover { +background-color: #d5d5d5; +} + +QPushButton:checked { +background-color: #d5d5d5; +} + +QWidget {background-color: #EFEFEF;} + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Device Settings + + + true + + + true + + + true + + + + + + + Credentials + + + true + + + true + + + + + + + Synchronisation + + + true + + + true + + + + + + + Qt::Horizontal + + + + 413 + 20 + + + + + + + + + + - + + + + 0 + 1 + + + + 2 + + + + + 15 + + + 30 + + + 30 + + + 100 + + + + + + 12 + 75 + true + + + + Device settings + + + + + + + These Settings change parameters on your Mooltipass device. For browser-specific settings, go to the options page of the extension. + + + true + + + + + + + 50 + + + + + Keyboard layout + + + + + + + + + + Inactivity + + + + + + + + + Lock after + + + + + + + + + + minutes inactivity + + + + + + + + + Input timeout + + + + + + + + + Cancel credentials request after + + + + + + + + + + seconds + + + + + + + + + Use screen saver + + + + + + + Miscellaneous + + + + + + + Flash screen when input is required + + + + + + + Allow boot without host (e.g. USB battery / Charger) + + + + + + + Enable device tutorial + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + 20 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + :/management-mode.png + + + + + + + 30 + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 12 + 75 + true + + + + Memory management mode + + + + + + + Accessing your credentials requires your device to be in management mode. + + + true + + + + + + + + 400 + 0 + + + + color: rgb(136, 136, 136); + + + This enables your computer to access and modify your stored websites and usernames without additional permission. Do not activate this mode, if you do not trust this computer. + + + true + + + + + + + + + Enter memory management mode + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + 30 + + + 30 + + + 50 + + + + + 30 + + + + + + + + 12 + 75 + true + + + + File Storage + + + + + + + + 0 + 0 + + + + Store your credentials in a file on your local computer. + + + true + + + + + + + + + + 150 + 0 + + + + Export to file + + + + + + + + 150 + 0 + + + + Import from file + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + - + + + diff --git a/src/QtAwesome/LICENSE.md b/src/QtAwesome/LICENSE.md new file mode 100644 index 00000000..73dc8189 --- /dev/null +++ b/src/QtAwesome/LICENSE.md @@ -0,0 +1,29 @@ +MIT License +=========== + +Copyright 2013-2015 [Reliable Bits Software by Blommers IT](http://blommersit.nl). All Rights Reserved. +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 +documentation files (the "Software"), to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, +and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS +OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +Font Awesome License +==================== + +[https://github.com/FortAwesome/Font-Awesome](https://github.com/FortAwesome/Font-Awesome) + +The Font Awesome font is licensed under the SIL Open Font License - [http://scripts.sil.org/OFL](http://scripts.sil.org/OFL) +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" + + diff --git a/src/QtAwesome/QtAwesome.cpp b/src/QtAwesome/QtAwesome.cpp new file mode 100644 index 00000000..e586d695 --- /dev/null +++ b/src/QtAwesome/QtAwesome.cpp @@ -0,0 +1,982 @@ +/** + * QtAwesome - use font-awesome (or other font icons) in your c++ / Qt Application + * + * MIT Licensed + * + * Copyright 2013-2015 - Reliable Bits Software by Blommers IT. All Rights Reserved. + * Author Rick Blommers + */ + +#include "QtAwesome.h" + +#include +#include +#include + + + +/// The font-awesome icon painter +class QtAwesomeCharIconPainter: public QtAwesomeIconPainter +{ +public: + virtual void paint( QtAwesome* awesome, QPainter* painter, const QRect& rect, QIcon::Mode mode, QIcon::State state, const QVariantMap& options ) + { + Q_UNUSED(mode); + Q_UNUSED(state); + Q_UNUSED(options); + + painter->save(); + + // set the correct color + QColor color = options.value("color").value(); + QString text = options.value("text").toString(); + + if( mode == QIcon::Disabled ) { + color = options.value("color-disabled").value(); + QVariant alt = options.value("text-disabled"); + if( alt.isValid() ) { + text = alt.toString(); + } + } else if( mode == QIcon::Active ) { + color = options.value("color-active").value(); + QVariant alt = options.value("text-active"); + if( alt.isValid() ) { + text = alt.toString(); + } + } else if( mode == QIcon::Selected ) { + color = options.value("color-selected").value(); + QVariant alt = options.value("text-selected"); + if( alt.isValid() ) { + text = alt.toString(); + } + } + painter->setPen(color); + + // add some 'padding' around the icon + int drawSize = qRound(rect.height()*options.value("scale-factor").toFloat()); + + painter->setFont( awesome->font(drawSize) ); + painter->drawText( rect, text, QTextOption( Qt::AlignCenter|Qt::AlignVCenter ) ); + painter->restore(); + } + +}; + + +//--------------------------------------------------------------------------------------- + + +/// The painter icon engine. +class QtAwesomeIconPainterIconEngine : public QIconEngine +{ + +public: + + QtAwesomeIconPainterIconEngine( QtAwesome* awesome, QtAwesomeIconPainter* painter, const QVariantMap& options ) + : awesomeRef_(awesome) + , iconPainterRef_(painter) + , options_(options) + { + } + + virtual ~QtAwesomeIconPainterIconEngine() {} + + QtAwesomeIconPainterIconEngine* clone() const + { + return new QtAwesomeIconPainterIconEngine( awesomeRef_, iconPainterRef_, options_ ); + } + + virtual void paint(QPainter* painter, const QRect& rect, QIcon::Mode mode, QIcon::State state) + { + Q_UNUSED( mode ); + Q_UNUSED( state ); + iconPainterRef_->paint( awesomeRef_, painter, rect, mode, state, options_ ); + } + + virtual QPixmap pixmap(const QSize& size, QIcon::Mode mode, QIcon::State state) + { + QPixmap pm(size); + pm.fill( Qt::transparent ); // we need transparency + { + QPainter p(&pm); + paint(&p, QRect(QPoint(0,0),size), mode, state); + } + return pm; + } + +private: + + QtAwesome* awesomeRef_; ///< a reference to the QtAwesome instance + QtAwesomeIconPainter* iconPainterRef_; ///< a reference to the icon painter + QVariantMap options_; ///< the options for this icon painter +}; + + +//--------------------------------------------------------------------------------------- + +/// The default icon colors +QtAwesome::QtAwesome( QObject* parent ) + : QObject( parent ) + , namedCodepoints_() +{ + // initialize the default options + setDefaultOption( "color", QColor(50,50,50) ); + setDefaultOption( "color-disabled", QColor(70,70,70,60)); + setDefaultOption( "color-active", QColor(10,10,10)); + setDefaultOption( "color-selected", QColor(10,10,10)); + setDefaultOption( "scale-factor", 0.9 ); + + setDefaultOption( "text", QVariant() ); + setDefaultOption( "text-disabled", QVariant() ); + setDefaultOption( "text-active", QVariant() ); + setDefaultOption( "text-selected", QVariant() ); + + fontIconPainter_ = new QtAwesomeCharIconPainter(); + +} + + +QtAwesome::~QtAwesome() +{ + delete fontIconPainter_; +// delete errorIconPainter_; + qDeleteAll(painterMap_); +} + +/// initializes the QtAwesome icon factory with the given fontname +void QtAwesome::init(const QString& fontname) +{ + fontName_ = fontname; +} + + +/// a specialized init function so font-awesome is loaded and initialized +/// this method return true on success, it will return false if the fnot cannot be initialized +/// To initialize QtAwesome with font-awesome you need to call this method +bool QtAwesome::initFontAwesome( ) +{ + static int fontAwesomeFontId = -1; + + // only load font-awesome once + if( fontAwesomeFontId < 0 ) { + + // The macro below internally calls "qInitResources_QtAwesome()". this initializes + // the resource system. For a .pri project this isn't required, but when building and using a + // static library the resource need to initialized first. + /// + // I've checked th qInitResource_* code and calling this method mutliple times shouldn't be any problem + // (More info about this subject: http://qt-project.org/wiki/QtResources) + Q_INIT_RESOURCE(QtAwesome); + + // load the font file + QFile res(":/fonts/fontawesome-4.4.0.ttf"); + if(!res.open(QIODevice::ReadOnly)) { + qDebug() << "Font awesome font could not be loaded!"; + return false; + } + QByteArray fontData( res.readAll() ); + res.close(); + + // fetch the given font + fontAwesomeFontId = QFontDatabase::addApplicationFontFromData(fontData); + } + + QStringList loadedFontFamilies = QFontDatabase::applicationFontFamilies(fontAwesomeFontId); + if( !loadedFontFamilies.empty() ) { + fontName_= loadedFontFamilies.at(0); + } else { + qDebug() << "Font awesome font is empty?!"; + fontAwesomeFontId = -1; // restore the font-awesome id + return false; + } + + // intialize the map + QHash& m = namedCodepoints_; + m.insert("fa_500px", fa::fa_500px ); + m.insert("adjust", fa::adjust ); + m.insert("adn", fa::adn ); + m.insert("aligncenter", fa::aligncenter ); + m.insert("alignjustify", fa::alignjustify ); + m.insert("alignleft", fa::alignleft ); + m.insert("alignright", fa::alignright ); + m.insert("amazon", fa::amazon ); + m.insert("ambulance", fa::ambulance ); + m.insert("anchor", fa::anchor ); + m.insert("android", fa::android ); + m.insert("angellist", fa::angellist ); + m.insert("angledoubledown", fa::angledoubledown ); + m.insert("angledoubleleft", fa::angledoubleleft ); + m.insert("angledoubleright", fa::angledoubleright ); + m.insert("angledoubleup", fa::angledoubleup ); + m.insert("angledown", fa::angledown ); + m.insert("angleleft", fa::angleleft ); + m.insert("angleright", fa::angleright ); + m.insert("angleup", fa::angleup ); + m.insert("apple", fa::apple ); + m.insert("archive", fa::archive ); + m.insert("areachart", fa::areachart ); + m.insert("arrowcircledown", fa::arrowcircledown ); + m.insert("arrowcircleleft", fa::arrowcircleleft ); + m.insert("arrowcircleodown", fa::arrowcircleodown ); + m.insert("arrowcircleoleft", fa::arrowcircleoleft ); + m.insert("arrowcircleoright", fa::arrowcircleoright ); + m.insert("arrowcircleoup", fa::arrowcircleoup ); + m.insert("arrowcircleright", fa::arrowcircleright ); + m.insert("arrowcircleup", fa::arrowcircleup ); + m.insert("arrowdown", fa::arrowdown ); + m.insert("arrowleft", fa::arrowleft ); + m.insert("arrowright", fa::arrowright ); + m.insert("arrowup", fa::arrowup ); + m.insert("arrows", fa::arrows ); + m.insert("arrowsalt", fa::arrowsalt ); + m.insert("arrowsh", fa::arrowsh ); + m.insert("arrowsv", fa::arrowsv ); + m.insert("asterisk", fa::asterisk ); + m.insert("at", fa::at ); + m.insert("automobile", fa::automobile ); + m.insert("backward", fa::backward ); + m.insert("balancescale", fa::balancescale ); + m.insert("ban", fa::ban ); + m.insert("bank", fa::bank ); + m.insert("barchart", fa::barchart ); + m.insert("barcharto", fa::barcharto ); + m.insert("barcode", fa::barcode ); + m.insert("bars", fa::bars ); + m.insert("battery0", fa::battery0 ); + m.insert("battery1", fa::battery1 ); + m.insert("battery2", fa::battery2 ); + m.insert("battery3", fa::battery3 ); + m.insert("battery4", fa::battery4 ); + m.insert("batteryempty", fa::batteryempty ); + m.insert("batteryfull", fa::batteryfull ); + m.insert("batteryhalf", fa::batteryhalf ); + m.insert("batteryquarter", fa::batteryquarter ); + m.insert("batterythreequarters", fa::batterythreequarters ); + m.insert("bed", fa::bed ); + m.insert("beer", fa::beer ); + m.insert("behance", fa::behance ); + m.insert("behancesquare", fa::behancesquare ); + m.insert("bell", fa::bell ); + m.insert("bello", fa::bello ); + m.insert("bellslash", fa::bellslash ); + m.insert("bellslasho", fa::bellslasho ); + m.insert("bicycle", fa::bicycle ); + m.insert("binoculars", fa::binoculars ); + m.insert("birthdaycake", fa::birthdaycake ); + m.insert("bitbucket", fa::bitbucket ); + m.insert("bitbucketsquare", fa::bitbucketsquare ); + m.insert("bitcoin", fa::bitcoin ); + m.insert("blacktie", fa::blacktie ); + m.insert("bold", fa::bold ); + m.insert("bolt", fa::bolt ); + m.insert("bomb", fa::bomb ); + m.insert("book", fa::book ); + m.insert("bookmark", fa::bookmark ); + m.insert("bookmarko", fa::bookmarko ); + m.insert("briefcase", fa::briefcase ); + m.insert("btc", fa::btc ); + m.insert("bug", fa::bug ); + m.insert("building", fa::building ); + m.insert("buildingo", fa::buildingo ); + m.insert("bullhorn", fa::bullhorn ); + m.insert("bullseye", fa::bullseye ); + m.insert("bus", fa::bus ); + m.insert("buysellads", fa::buysellads ); + m.insert("cab", fa::cab ); + m.insert("calculator", fa::calculator ); + m.insert("calendar", fa::calendar ); + m.insert("calendarchecko", fa::calendarchecko ); + m.insert("calendarminuso", fa::calendarminuso ); + m.insert("calendaro", fa::calendaro ); + m.insert("calendarpluso", fa::calendarpluso ); + m.insert("calendartimeso", fa::calendartimeso ); + m.insert("camera", fa::camera ); + m.insert("cameraretro", fa::cameraretro ); + m.insert("car", fa::car ); + m.insert("caretdown", fa::caretdown ); + m.insert("caretleft", fa::caretleft ); + m.insert("caretright", fa::caretright ); + m.insert("caretsquareodown", fa::caretsquareodown ); + m.insert("caretsquareoleft", fa::caretsquareoleft ); + m.insert("caretsquareoright", fa::caretsquareoright ); + m.insert("caretsquareoup", fa::caretsquareoup ); + m.insert("caretup", fa::caretup ); + m.insert("cartarrowdown", fa::cartarrowdown ); + m.insert("cartplus", fa::cartplus ); + m.insert("cc", fa::cc ); + m.insert("ccamex", fa::ccamex ); + m.insert("ccdinersclub", fa::ccdinersclub ); + m.insert("ccdiscover", fa::ccdiscover ); + m.insert("ccjcb", fa::ccjcb ); + m.insert("ccmastercard", fa::ccmastercard ); + m.insert("ccpaypal", fa::ccpaypal ); + m.insert("ccstripe", fa::ccstripe ); + m.insert("ccvisa", fa::ccvisa ); + m.insert("certificate", fa::certificate ); + m.insert("chain", fa::chain ); + m.insert("chainbroken", fa::chainbroken ); + m.insert("check", fa::check ); + m.insert("checkcircle", fa::checkcircle ); + m.insert("checkcircleo", fa::checkcircleo ); + m.insert("checksquare", fa::checksquare ); + m.insert("checksquareo", fa::checksquareo ); + m.insert("chevroncircledown", fa::chevroncircledown ); + m.insert("chevroncircleleft", fa::chevroncircleleft ); + m.insert("chevroncircleright", fa::chevroncircleright ); + m.insert("chevroncircleup", fa::chevroncircleup ); + m.insert("chevrondown", fa::chevrondown ); + m.insert("chevronleft", fa::chevronleft ); + m.insert("chevronright", fa::chevronright ); + m.insert("chevronup", fa::chevronup ); + m.insert("child", fa::child ); + m.insert("chrome", fa::chrome ); + m.insert("circle", fa::circle ); + m.insert("circleo", fa::circleo ); + m.insert("circleonotch", fa::circleonotch ); + m.insert("circlethin", fa::circlethin ); + m.insert("clipboard", fa::clipboard ); + m.insert("clocko", fa::clocko ); + m.insert("clone", fa::clone ); + m.insert("close", fa::close ); + m.insert("cloud", fa::cloud ); + m.insert("clouddownload", fa::clouddownload ); + m.insert("cloudupload", fa::cloudupload ); + m.insert("cny", fa::cny ); + m.insert("code", fa::code ); + m.insert("codefork", fa::codefork ); + m.insert("codepen", fa::codepen ); + m.insert("coffee", fa::coffee ); + m.insert("cog", fa::cog ); + m.insert("cogs", fa::cogs ); + m.insert("columns", fa::columns ); + m.insert("comment", fa::comment ); + m.insert("commento", fa::commento ); + m.insert("commenting", fa::commenting ); + m.insert("commentingo", fa::commentingo ); + m.insert("comments", fa::comments ); + m.insert("commentso", fa::commentso ); + m.insert("compass", fa::compass ); + m.insert("compress", fa::compress ); + m.insert("connectdevelop", fa::connectdevelop ); + m.insert("contao", fa::contao ); + m.insert("copy", fa::copy ); + m.insert("copyright", fa::copyright ); + m.insert("creativecommons", fa::creativecommons ); + m.insert("creditcard", fa::creditcard ); + m.insert("crop", fa::crop ); + m.insert("crosshairs", fa::crosshairs ); + m.insert("css3", fa::css3 ); + m.insert("cube", fa::cube ); + m.insert("cubes", fa::cubes ); + m.insert("cut", fa::cut ); + m.insert("cutlery", fa::cutlery ); + m.insert("dashboard", fa::dashboard ); + m.insert("dashcube", fa::dashcube ); + m.insert("database", fa::database ); + m.insert("dedent", fa::dedent ); + m.insert("delicious", fa::delicious ); + m.insert("desktop", fa::desktop ); + m.insert("deviantart", fa::deviantart ); + m.insert("diamond", fa::diamond ); + m.insert("digg", fa::digg ); + m.insert("dollar", fa::dollar ); + m.insert("dotcircleo", fa::dotcircleo ); + m.insert("download", fa::download ); + m.insert("dribbble", fa::dribbble ); + m.insert("dropbox", fa::dropbox ); + m.insert("drupal", fa::drupal ); + m.insert("edit", fa::edit ); + m.insert("eject", fa::eject ); + m.insert("ellipsish", fa::ellipsish ); + m.insert("ellipsisv", fa::ellipsisv ); + m.insert("empire", fa::empire ); + m.insert("envelope", fa::envelope ); + m.insert("envelopeo", fa::envelopeo ); + m.insert("envelopesquare", fa::envelopesquare ); + m.insert("eraser", fa::eraser ); + m.insert("eur", fa::eur ); + m.insert("euro", fa::euro ); + m.insert("exchange", fa::exchange ); + m.insert("exclamation", fa::exclamation ); + m.insert("exclamationcircle", fa::exclamationcircle ); + m.insert("exclamationtriangle", fa::exclamationtriangle ); + m.insert("expand", fa::expand ); + m.insert("expeditedssl", fa::expeditedssl ); + m.insert("externallink", fa::externallink ); + m.insert("externallinksquare", fa::externallinksquare ); + m.insert("eye", fa::eye ); + m.insert("eyeslash", fa::eyeslash ); + m.insert("eyedropper", fa::eyedropper ); + m.insert("facebook", fa::facebook ); + m.insert("facebookf", fa::facebookf ); + m.insert("facebookofficial", fa::facebookofficial ); + m.insert("facebooksquare", fa::facebooksquare ); + m.insert("fastbackward", fa::fastbackward ); + m.insert("fastforward", fa::fastforward ); + m.insert("fax", fa::fax ); + m.insert("feed", fa::feed ); + m.insert("female", fa::female ); + m.insert("fighterjet", fa::fighterjet ); + m.insert("file", fa::file ); + m.insert("filearchiveo", fa::filearchiveo ); + m.insert("fileaudioo", fa::fileaudioo ); + m.insert("filecodeo", fa::filecodeo ); + m.insert("fileexcelo", fa::fileexcelo ); + m.insert("fileimageo", fa::fileimageo ); + m.insert("filemovieo", fa::filemovieo ); + m.insert("fileo", fa::fileo ); + m.insert("filepdfo", fa::filepdfo ); + m.insert("filephotoo", fa::filephotoo ); + m.insert("filepictureo", fa::filepictureo ); + m.insert("filepowerpointo", fa::filepowerpointo ); + m.insert("filesoundo", fa::filesoundo ); + m.insert("filetext", fa::filetext ); + m.insert("filetexto", fa::filetexto ); + m.insert("filevideoo", fa::filevideoo ); + m.insert("filewordo", fa::filewordo ); + m.insert("filezipo", fa::filezipo ); + m.insert("fileso", fa::fileso ); + m.insert("film", fa::film ); + m.insert("filter", fa::filter ); + m.insert("fire", fa::fire ); + m.insert("fireextinguisher", fa::fireextinguisher ); + m.insert("firefox", fa::firefox ); + m.insert("flag", fa::flag ); + m.insert("flagcheckered", fa::flagcheckered ); + m.insert("flago", fa::flago ); + m.insert("flash", fa::flash ); + m.insert("flask", fa::flask ); + m.insert("flickr", fa::flickr ); + m.insert("floppyo", fa::floppyo ); + m.insert("folder", fa::folder ); + m.insert("foldero", fa::foldero ); + m.insert("folderopen", fa::folderopen ); + m.insert("folderopeno", fa::folderopeno ); + m.insert("font", fa::font ); + m.insert("fonticons", fa::fonticons ); + m.insert("forumbee", fa::forumbee ); + m.insert("forward", fa::forward ); + m.insert("foursquare", fa::foursquare ); + m.insert("frowno", fa::frowno ); + m.insert("futbolo", fa::futbolo ); + m.insert("gamepad", fa::gamepad ); + m.insert("gavel", fa::gavel ); + m.insert("gbp", fa::gbp ); + m.insert("ge", fa::ge ); + m.insert("gear", fa::gear ); + m.insert("gears", fa::gears ); + m.insert("genderless", fa::genderless ); + m.insert("getpocket", fa::getpocket ); + m.insert("gg", fa::gg ); + m.insert("ggcircle", fa::ggcircle ); + m.insert("gift", fa::gift ); + m.insert("git", fa::git ); + m.insert("gitsquare", fa::gitsquare ); + m.insert("github", fa::github ); + m.insert("githubalt", fa::githubalt ); + m.insert("githubsquare", fa::githubsquare ); + m.insert("gittip", fa::gittip ); + m.insert("glass", fa::glass ); + m.insert("globe", fa::globe ); + m.insert("google", fa::google ); + m.insert("googleplus", fa::googleplus ); + m.insert("googleplussquare", fa::googleplussquare ); + m.insert("googlewallet", fa::googlewallet ); + m.insert("graduationcap", fa::graduationcap ); + m.insert("gratipay", fa::gratipay ); + m.insert("group", fa::group ); + m.insert("hsquare", fa::hsquare ); + m.insert("hackernews", fa::hackernews ); + m.insert("handgrabo", fa::handgrabo ); + m.insert("handlizardo", fa::handlizardo ); + m.insert("handodown", fa::handodown ); + m.insert("handoleft", fa::handoleft ); + m.insert("handoright", fa::handoright ); + m.insert("handoup", fa::handoup ); + m.insert("handpapero", fa::handpapero ); + m.insert("handpeaceo", fa::handpeaceo ); + m.insert("handpointero", fa::handpointero ); + m.insert("handrocko", fa::handrocko ); + m.insert("handscissorso", fa::handscissorso ); + m.insert("handspocko", fa::handspocko ); + m.insert("handstopo", fa::handstopo ); + m.insert("hddo", fa::hddo ); + m.insert("header", fa::header ); + m.insert("headphones", fa::headphones ); + m.insert("heart", fa::heart ); + m.insert("hearto", fa::hearto ); + m.insert("heartbeat", fa::heartbeat ); + m.insert("history", fa::history ); + m.insert("home", fa::home ); + m.insert("hospitalo", fa::hospitalo ); + m.insert("hotel", fa::hotel ); + m.insert("hourglass", fa::hourglass ); + m.insert("hourglass1", fa::hourglass1 ); + m.insert("hourglass2", fa::hourglass2 ); + m.insert("hourglass3", fa::hourglass3 ); + m.insert("hourglassend", fa::hourglassend ); + m.insert("hourglasshalf", fa::hourglasshalf ); + m.insert("hourglasso", fa::hourglasso ); + m.insert("hourglassstart", fa::hourglassstart ); + m.insert("houzz", fa::houzz ); + m.insert("html5", fa::html5 ); + m.insert("icursor", fa::icursor ); + m.insert("ils", fa::ils ); + m.insert("image", fa::image ); + m.insert("inbox", fa::inbox ); + m.insert("indent", fa::indent ); + m.insert("industry", fa::industry ); + m.insert("info", fa::info ); + m.insert("infocircle", fa::infocircle ); + m.insert("inr", fa::inr ); + m.insert("instagram", fa::instagram ); + m.insert("institution", fa::institution ); + m.insert("internetexplorer", fa::internetexplorer ); + m.insert("intersex", fa::intersex ); + m.insert("ioxhost", fa::ioxhost ); + m.insert("italic", fa::italic ); + m.insert("joomla", fa::joomla ); + m.insert("jpy", fa::jpy ); + m.insert("jsfiddle", fa::jsfiddle ); + m.insert("key", fa::key ); + m.insert("keyboardo", fa::keyboardo ); + m.insert("krw", fa::krw ); + m.insert("language", fa::language ); + m.insert("laptop", fa::laptop ); + m.insert("lastfm", fa::lastfm ); + m.insert("lastfmsquare", fa::lastfmsquare ); + m.insert("leaf", fa::leaf ); + m.insert("leanpub", fa::leanpub ); + m.insert("legal", fa::legal ); + m.insert("lemono", fa::lemono ); + m.insert("leveldown", fa::leveldown ); + m.insert("levelup", fa::levelup ); + m.insert("lifebouy", fa::lifebouy ); + m.insert("lifebuoy", fa::lifebuoy ); + m.insert("lifering", fa::lifering ); + m.insert("lifesaver", fa::lifesaver ); + m.insert("lightbulbo", fa::lightbulbo ); + m.insert("linechart", fa::linechart ); + m.insert("link", fa::link ); + m.insert("linkedin", fa::linkedin ); + m.insert("linkedinsquare", fa::linkedinsquare ); + m.insert("linux", fa::linux ); + m.insert("list", fa::list ); + m.insert("listalt", fa::listalt ); + m.insert("listol", fa::listol ); + m.insert("listul", fa::listul ); + m.insert("locationarrow", fa::locationarrow ); + m.insert("lock", fa::lock ); + m.insert("longarrowdown", fa::longarrowdown ); + m.insert("longarrowleft", fa::longarrowleft ); + m.insert("longarrowright", fa::longarrowright ); + m.insert("longarrowup", fa::longarrowup ); + m.insert("magic", fa::magic ); + m.insert("magnet", fa::magnet ); + m.insert("mailforward", fa::mailforward ); + m.insert("mailreply", fa::mailreply ); + m.insert("mailreplyall", fa::mailreplyall ); + m.insert("male", fa::male ); + m.insert("map", fa::map ); + m.insert("mapmarker", fa::mapmarker ); + m.insert("mapo", fa::mapo ); + m.insert("mappin", fa::mappin ); + m.insert("mapsigns", fa::mapsigns ); + m.insert("mars", fa::mars ); + m.insert("marsdouble", fa::marsdouble ); + m.insert("marsstroke", fa::marsstroke ); + m.insert("marsstrokeh", fa::marsstrokeh ); + m.insert("marsstrokev", fa::marsstrokev ); + m.insert("maxcdn", fa::maxcdn ); + m.insert("meanpath", fa::meanpath ); + m.insert("medium", fa::medium ); + m.insert("medkit", fa::medkit ); + m.insert("meho", fa::meho ); + m.insert("mercury", fa::mercury ); + m.insert("microphone", fa::microphone ); + m.insert("microphoneslash", fa::microphoneslash ); + m.insert("minus", fa::minus ); + m.insert("minuscircle", fa::minuscircle ); + m.insert("minussquare", fa::minussquare ); + m.insert("minussquareo", fa::minussquareo ); + m.insert("mobile", fa::mobile ); + m.insert("mobilephone", fa::mobilephone ); + m.insert("money", fa::money ); + m.insert("moono", fa::moono ); + m.insert("mortarboard", fa::mortarboard ); + m.insert("motorcycle", fa::motorcycle ); + m.insert("mousepointer", fa::mousepointer ); + m.insert("music", fa::music ); + m.insert("navicon", fa::navicon ); + m.insert("neuter", fa::neuter ); + m.insert("newspapero", fa::newspapero ); + m.insert("objectgroup", fa::objectgroup ); + m.insert("objectungroup", fa::objectungroup ); + m.insert("odnoklassniki", fa::odnoklassniki ); + m.insert("odnoklassnikisquare", fa::odnoklassnikisquare ); + m.insert("opencart", fa::opencart ); + m.insert("openid", fa::openid ); + m.insert("opera", fa::opera ); + m.insert("optinmonster", fa::optinmonster ); + m.insert("outdent", fa::outdent ); + m.insert("pagelines", fa::pagelines ); + m.insert("paintbrush", fa::paintbrush ); + m.insert("paperplane", fa::paperplane ); + m.insert("paperplaneo", fa::paperplaneo ); + m.insert("paperclip", fa::paperclip ); + m.insert("paragraph", fa::paragraph ); + m.insert("paste", fa::paste ); + m.insert("pause", fa::pause ); + m.insert("paw", fa::paw ); + m.insert("paypal", fa::paypal ); + m.insert("pencil", fa::pencil ); + m.insert("pencilsquare", fa::pencilsquare ); + m.insert("pencilsquareo", fa::pencilsquareo ); + m.insert("phone", fa::phone ); + m.insert("phonesquare", fa::phonesquare ); + m.insert("photo", fa::photo ); + m.insert("pictureo", fa::pictureo ); + m.insert("piechart", fa::piechart ); + m.insert("piedpiper", fa::piedpiper ); + m.insert("piedpiperalt", fa::piedpiperalt ); + m.insert("pinterest", fa::pinterest ); + m.insert("pinterestp", fa::pinterestp ); + m.insert("pinterestsquare", fa::pinterestsquare ); + m.insert("plane", fa::plane ); + m.insert("play", fa::play ); + m.insert("playcircle", fa::playcircle ); + m.insert("playcircleo", fa::playcircleo ); + m.insert("plug", fa::plug ); + m.insert("plus", fa::plus ); + m.insert("pluscircle", fa::pluscircle ); + m.insert("plussquare", fa::plussquare ); + m.insert("plussquareo", fa::plussquareo ); + m.insert("poweroff", fa::poweroff ); + m.insert("print", fa::print ); + m.insert("puzzlepiece", fa::puzzlepiece ); + m.insert("qq", fa::qq ); + m.insert("qrcode", fa::qrcode ); + m.insert("question", fa::question ); + m.insert("questioncircle", fa::questioncircle ); + m.insert("quoteleft", fa::quoteleft ); + m.insert("quoteright", fa::quoteright ); + m.insert("ra", fa::ra ); + m.insert("random", fa::random ); + m.insert("rebel", fa::rebel ); + m.insert("recycle", fa::recycle ); + m.insert("reddit", fa::reddit ); + m.insert("redditsquare", fa::redditsquare ); + m.insert("refresh", fa::refresh ); + m.insert("registered", fa::registered ); + m.insert("remove", fa::remove ); + m.insert("renren", fa::renren ); + m.insert("reorder", fa::reorder ); + m.insert("repeat", fa::repeat ); + m.insert("reply", fa::reply ); + m.insert("replyall", fa::replyall ); + m.insert("retweet", fa::retweet ); + m.insert("rmb", fa::rmb ); + m.insert("road", fa::road ); + m.insert("rocket", fa::rocket ); + m.insert("rotateleft", fa::rotateleft ); + m.insert("rotateright", fa::rotateright ); + m.insert("rouble", fa::rouble ); + m.insert("rss", fa::rss ); + m.insert("rsssquare", fa::rsssquare ); + m.insert("rub", fa::rub ); + m.insert("ruble", fa::ruble ); + m.insert("rupee", fa::rupee ); + m.insert("safari", fa::safari ); + m.insert("save", fa::save ); + m.insert("scissors", fa::scissors ); + m.insert("search", fa::search ); + m.insert("searchminus", fa::searchminus ); + m.insert("searchplus", fa::searchplus ); + m.insert("sellsy", fa::sellsy ); + m.insert("send", fa::send ); + m.insert("sendo", fa::sendo ); + m.insert("server", fa::server ); + m.insert("share", fa::share ); + m.insert("sharealt", fa::sharealt ); + m.insert("sharealtsquare", fa::sharealtsquare ); + m.insert("sharesquare", fa::sharesquare ); + m.insert("sharesquareo", fa::sharesquareo ); + m.insert("shekel", fa::shekel ); + m.insert("sheqel", fa::sheqel ); + m.insert("shield", fa::shield ); + m.insert("ship", fa::ship ); + m.insert("shirtsinbulk", fa::shirtsinbulk ); + m.insert("shoppingcart", fa::shoppingcart ); + m.insert("signin", fa::signin ); + m.insert("signout", fa::signout ); + m.insert("signal", fa::signal ); + m.insert("simplybuilt", fa::simplybuilt ); + m.insert("sitemap", fa::sitemap ); + m.insert("skyatlas", fa::skyatlas ); + m.insert("skype", fa::skype ); + m.insert("slack", fa::slack ); + m.insert("sliders", fa::sliders ); + m.insert("slideshare", fa::slideshare ); + m.insert("smileo", fa::smileo ); + m.insert("soccerballo", fa::soccerballo ); + m.insert("sort", fa::sort ); + m.insert("sortalphaasc", fa::sortalphaasc ); + m.insert("sortalphadesc", fa::sortalphadesc ); + m.insert("sortamountasc", fa::sortamountasc ); + m.insert("sortamountdesc", fa::sortamountdesc ); + m.insert("sortasc", fa::sortasc ); + m.insert("sortdesc", fa::sortdesc ); + m.insert("sortdown", fa::sortdown ); + m.insert("sortnumericasc", fa::sortnumericasc ); + m.insert("sortnumericdesc", fa::sortnumericdesc ); + m.insert("sortup", fa::sortup ); + m.insert("soundcloud", fa::soundcloud ); + m.insert("spaceshuttle", fa::spaceshuttle ); + m.insert("spinner", fa::spinner ); + m.insert("spoon", fa::spoon ); + m.insert("spotify", fa::spotify ); + m.insert("square", fa::square ); + m.insert("squareo", fa::squareo ); + m.insert("stackexchange", fa::stackexchange ); + m.insert("stackoverflow", fa::stackoverflow ); + m.insert("star", fa::star ); + m.insert("starhalf", fa::starhalf ); + m.insert("starhalfempty", fa::starhalfempty ); + m.insert("starhalffull", fa::starhalffull ); + m.insert("starhalfo", fa::starhalfo ); + m.insert("staro", fa::staro ); + m.insert("steam", fa::steam ); + m.insert("steamsquare", fa::steamsquare ); + m.insert("stepbackward", fa::stepbackward ); + m.insert("stepforward", fa::stepforward ); + m.insert("stethoscope", fa::stethoscope ); + m.insert("stickynote", fa::stickynote ); + m.insert("stickynoteo", fa::stickynoteo ); + m.insert("stop", fa::stop ); + m.insert("streetview", fa::streetview ); + m.insert("strikethrough", fa::strikethrough ); + m.insert("stumbleupon", fa::stumbleupon ); + m.insert("stumbleuponcircle", fa::stumbleuponcircle ); + m.insert("subscript", fa::subscript ); + m.insert("subway", fa::subway ); + m.insert("suitcase", fa::suitcase ); + m.insert("suno", fa::suno ); + m.insert("superscript", fa::superscript ); + m.insert("support", fa::support ); + m.insert("table", fa::table ); + m.insert("tablet", fa::tablet ); + m.insert("tachometer", fa::tachometer ); + m.insert("tag", fa::tag ); + m.insert("tags", fa::tags ); + m.insert("tasks", fa::tasks ); + m.insert("taxi", fa::taxi ); + m.insert("television", fa::television ); + m.insert("tencentweibo", fa::tencentweibo ); + m.insert("terminal", fa::terminal ); + m.insert("textheight", fa::textheight ); + m.insert("textwidth", fa::textwidth ); + m.insert("th", fa::th ); + m.insert("thlarge", fa::thlarge ); + m.insert("thlist", fa::thlist ); + m.insert("thumbtack", fa::thumbtack ); + m.insert("thumbsdown", fa::thumbsdown ); + m.insert("thumbsodown", fa::thumbsodown ); + m.insert("thumbsoup", fa::thumbsoup ); + m.insert("thumbsup", fa::thumbsup ); + m.insert("ticket", fa::ticket ); + m.insert("times", fa::times ); + m.insert("timescircle", fa::timescircle ); + m.insert("timescircleo", fa::timescircleo ); + m.insert("tint", fa::tint ); + m.insert("toggledown", fa::toggledown ); + m.insert("toggleleft", fa::toggleleft ); + m.insert("toggleoff", fa::toggleoff ); + m.insert("toggleon", fa::toggleon ); + m.insert("toggleright", fa::toggleright ); + m.insert("toggleup", fa::toggleup ); + m.insert("trademark", fa::trademark ); + m.insert("train", fa::train ); + m.insert("transgender", fa::transgender ); + m.insert("transgenderalt", fa::transgenderalt ); + m.insert("trash", fa::trash ); + m.insert("trasho", fa::trasho ); + m.insert("tree", fa::tree ); + m.insert("trello", fa::trello ); + m.insert("tripadvisor", fa::tripadvisor ); + m.insert("trophy", fa::trophy ); + m.insert("truck", fa::truck ); + m.insert("fa_try", fa::fa_try ); + m.insert("tty", fa::tty ); + m.insert("tumblr", fa::tumblr ); + m.insert("tumblrsquare", fa::tumblrsquare ); + m.insert("turkishlira", fa::turkishlira ); + m.insert("tv", fa::tv ); + m.insert("twitch", fa::twitch ); + m.insert("twitter", fa::twitter ); + m.insert("twittersquare", fa::twittersquare ); + m.insert("umbrella", fa::umbrella ); + m.insert("underline", fa::underline ); + m.insert("undo", fa::undo ); + m.insert("university", fa::university ); + m.insert("unlink", fa::unlink ); + m.insert("unlock", fa::unlock ); + m.insert("unlockalt", fa::unlockalt ); + m.insert("unsorted", fa::unsorted ); + m.insert("upload", fa::upload ); + m.insert("usd", fa::usd ); + m.insert("user", fa::user ); + m.insert("usermd", fa::usermd ); + m.insert("userplus", fa::userplus ); + m.insert("usersecret", fa::usersecret ); + m.insert("usertimes", fa::usertimes ); + m.insert("users", fa::users ); + m.insert("venus", fa::venus ); + m.insert("venusdouble", fa::venusdouble ); + m.insert("venusmars", fa::venusmars ); + m.insert("viacoin", fa::viacoin ); + m.insert("videocamera", fa::videocamera ); + m.insert("vimeo", fa::vimeo ); + m.insert("vimeosquare", fa::vimeosquare ); + m.insert("vine", fa::vine ); + m.insert("vk", fa::vk ); + m.insert("volumedown", fa::volumedown ); + m.insert("volumeoff", fa::volumeoff ); + m.insert("volumeup", fa::volumeup ); + m.insert("warning", fa::warning ); + m.insert("wechat", fa::wechat ); + m.insert("weibo", fa::weibo ); + m.insert("weixin", fa::weixin ); + m.insert("whatsapp", fa::whatsapp ); + m.insert("wheelchair", fa::wheelchair ); + m.insert("wifi", fa::wifi ); + m.insert("wikipediaw", fa::wikipediaw ); + m.insert("windows", fa::windows ); + m.insert("won", fa::won ); + m.insert("wordpress", fa::wordpress ); + m.insert("wrench", fa::wrench ); + m.insert("xing", fa::xing ); + m.insert("xingsquare", fa::xingsquare ); + m.insert("ycombinator", fa::ycombinator ); + m.insert("ycombinatorsquare", fa::ycombinatorsquare ); + m.insert("yahoo", fa::yahoo ); + m.insert("yc", fa::yc ); + m.insert("ycsquare", fa::ycsquare ); + m.insert("yelp", fa::yelp ); + m.insert("yen", fa::yen ); + m.insert("youtube", fa::youtube ); + m.insert("youtubeplay", fa::youtubeplay ); + m.insert("youtubesquare", fa::youtubesquare ); + + return true; +} + +void QtAwesome::addNamedCodepoint( const QString& name, int codePoint) +{ + namedCodepoints_.insert( name, codePoint); +} + + +/// Sets a default option. These options are passed on to the icon painters +void QtAwesome::setDefaultOption(const QString& name, const QVariant& value) +{ + defaultOptions_.insert( name, value ); +} + + +/// Returns the default option for the given name +QVariant QtAwesome::defaultOption(const QString& name) +{ + return defaultOptions_.value( name ); +} + + +// internal helper method to merge to option amps +static QVariantMap mergeOptions( const QVariantMap& defaults, const QVariantMap& override ) +{ + QVariantMap result= defaults; + if( !override.isEmpty() ) { + QMapIterator itr(override); + while( itr.hasNext() ) { + itr.next(); + result.insert( itr.key(), itr.value() ); + } + } + return result; +} + + +/// Creates an icon with the given code-point +/// +/// awesome->icon( icon_group ) +/// +QIcon QtAwesome::icon(int character, const QVariantMap &options) +{ + // create a merged QVariantMap to have default options and icon-specific options + QVariantMap optionMap = mergeOptions( defaultOptions_, options ); + optionMap.insert("text", QString( QChar(static_cast(character)) ) ); + + return icon( fontIconPainter_, optionMap ); +} + + + +/// Creates an icon with the given name +/// +/// You can use the icon names as defined on http://fortawesome.github.io/Font-Awesome/design.html withour the 'icon-' prefix +/// @param name the name of the icon +/// @param options extra option to pass to the icon renderer +QIcon QtAwesome::icon(const QString& name, const QVariantMap& options) +{ + // when it's a named codepoint + if( namedCodepoints_.count(name) ) { + return icon( namedCodepoints_.value(name), options ); + } + + + // create a merged QVariantMap to have default options and icon-specific options + QVariantMap optionMap = mergeOptions( defaultOptions_, options ); + + // this method first tries to retrieve the icon + QtAwesomeIconPainter* painter = painterMap_.value(name); + if( !painter ) { + return QIcon(); + } + + return icon( painter, optionMap ); +} + +/// Create a dynamic icon by simlpy supplying a painter object +/// The ownership of the painter is NOT transfered. +/// @param painter a dynamic painter that is going to paint the icon +/// @param optionmap the options to pass to the painter +QIcon QtAwesome::icon(QtAwesomeIconPainter* painter, const QVariantMap& optionMap ) +{ + // Warning, when you use memoryleak detection. You should turn it of for the next call + // QIcon's placed in gui items are often cached and not deleted when my memory-leak detection checks for leaks. + // I'm not sure if it's a Qt bug or something I do wrong + QtAwesomeIconPainterIconEngine* engine = new QtAwesomeIconPainterIconEngine( this, painter, optionMap ); + return QIcon( engine ); +} + +/// Adds a named icon-painter to the QtAwesome icon map +/// As the name applies the ownership is passed over to QtAwesome +/// +/// @param name the name of the icon +/// @param painter the icon painter to add for this name +void QtAwesome::give(const QString& name, QtAwesomeIconPainter* painter) +{ + delete painterMap_.value( name ); // delete the old one + painterMap_.insert( name, painter ); +} + +/// Creates/Gets the icon font with a given size in pixels. This can be usefull to use a label for displaying icons +/// Example: +/// +/// QLabel* label = new QLabel( QChar( icon_group ) ); +/// label->setFont( awesome->font(16) ) +QFont QtAwesome::font( int size ) +{ + QFont font( fontName_); + font.setPixelSize(size); + return font; +} diff --git a/src/QtAwesome/QtAwesome.h b/src/QtAwesome/QtAwesome.h new file mode 100644 index 00000000..0aea5749 --- /dev/null +++ b/src/QtAwesome/QtAwesome.h @@ -0,0 +1,762 @@ +/** + * QtAwesome - use font-awesome (or other font icons) in your c++ / Qt Application + * + * MIT Licensed + * + * Copyright 2013-2015 - Reliable Bits Software by Blommers IT. All Rights Reserved. + * Author Rick Blommers + */ + +#ifndef QTAWESOME_H +#define QTAWESOME_H + +#include +#include +#include +#include +#include + + +/// A list of all icon-names with the codepoint (unicode-value) on the right +/// You can use the names on the page http://fortawesome.github.io/Font-Awesome/design.html +namespace fa { + enum icon { + fa_500px = 0xf26e, + adjust = 0xf042, + adn = 0xf170, + aligncenter = 0xf037, + alignjustify = 0xf039, + alignleft = 0xf036, + alignright = 0xf038, + amazon = 0xf270, + ambulance = 0xf0f9, + anchor = 0xf13d, + android = 0xf17b, + angellist = 0xf209, + angledoubledown = 0xf103, + angledoubleleft = 0xf100, + angledoubleright = 0xf101, + angledoubleup = 0xf102, + angledown = 0xf107, + angleleft = 0xf104, + angleright = 0xf105, + angleup = 0xf106, + apple = 0xf179, + archive = 0xf187, + areachart = 0xf1fe, + arrowcircledown = 0xf0ab, + arrowcircleleft = 0xf0a8, + arrowcircleodown = 0xf01a, + arrowcircleoleft = 0xf190, + arrowcircleoright = 0xf18e, + arrowcircleoup = 0xf01b, + arrowcircleright = 0xf0a9, + arrowcircleup = 0xf0aa, + arrowdown = 0xf063, + arrowleft = 0xf060, + arrowright = 0xf061, + arrowup = 0xf062, + arrows = 0xf047, + arrowsalt = 0xf0b2, + arrowsh = 0xf07e, + arrowsv = 0xf07d, + asterisk = 0xf069, + at = 0xf1fa, + automobile = 0xf1b9, + backward = 0xf04a, + balancescale = 0xf24e, + ban = 0xf05e, + bank = 0xf19c, + barchart = 0xf080, + barcharto = 0xf080, + barcode = 0xf02a, + bars = 0xf0c9, + battery0 = 0xf244, + battery1 = 0xf243, + battery2 = 0xf242, + battery3 = 0xf241, + battery4 = 0xf240, + batteryempty = 0xf244, + batteryfull = 0xf240, + batteryhalf = 0xf242, + batteryquarter = 0xf243, + batterythreequarters = 0xf241, + bed = 0xf236, + beer = 0xf0fc, + behance = 0xf1b4, + behancesquare = 0xf1b5, + bell = 0xf0f3, + bello = 0xf0a2, + bellslash = 0xf1f6, + bellslasho = 0xf1f7, + bicycle = 0xf206, + binoculars = 0xf1e5, + birthdaycake = 0xf1fd, + bitbucket = 0xf171, + bitbucketsquare = 0xf172, + bitcoin = 0xf15a, + blacktie = 0xf27e, + bold = 0xf032, + bolt = 0xf0e7, + bomb = 0xf1e2, + book = 0xf02d, + bookmark = 0xf02e, + bookmarko = 0xf097, + briefcase = 0xf0b1, + btc = 0xf15a, + bug = 0xf188, + building = 0xf1ad, + buildingo = 0xf0f7, + bullhorn = 0xf0a1, + bullseye = 0xf140, + bus = 0xf207, + buysellads = 0xf20d, + cab = 0xf1ba, + calculator = 0xf1ec, + calendar = 0xf073, + calendarchecko = 0xf274, + calendarminuso = 0xf272, + calendaro = 0xf133, + calendarpluso = 0xf271, + calendartimeso = 0xf273, + camera = 0xf030, + cameraretro = 0xf083, + car = 0xf1b9, + caretdown = 0xf0d7, + caretleft = 0xf0d9, + caretright = 0xf0da, + caretsquareodown = 0xf150, + caretsquareoleft = 0xf191, + caretsquareoright = 0xf152, + caretsquareoup = 0xf151, + caretup = 0xf0d8, + cartarrowdown = 0xf218, + cartplus = 0xf217, + cc = 0xf20a, + ccamex = 0xf1f3, + ccdinersclub = 0xf24c, + ccdiscover = 0xf1f2, + ccjcb = 0xf24b, + ccmastercard = 0xf1f1, + ccpaypal = 0xf1f4, + ccstripe = 0xf1f5, + ccvisa = 0xf1f0, + certificate = 0xf0a3, + chain = 0xf0c1, + chainbroken = 0xf127, + check = 0xf00c, + checkcircle = 0xf058, + checkcircleo = 0xf05d, + checksquare = 0xf14a, + checksquareo = 0xf046, + chevroncircledown = 0xf13a, + chevroncircleleft = 0xf137, + chevroncircleright = 0xf138, + chevroncircleup = 0xf139, + chevrondown = 0xf078, + chevronleft = 0xf053, + chevronright = 0xf054, + chevronup = 0xf077, + child = 0xf1ae, + chrome = 0xf268, + circle = 0xf111, + circleo = 0xf10c, + circleonotch = 0xf1ce, + circlethin = 0xf1db, + clipboard = 0xf0ea, + clocko = 0xf017, + clone = 0xf24d, + close = 0xf00d, + cloud = 0xf0c2, + clouddownload = 0xf0ed, + cloudupload = 0xf0ee, + cny = 0xf157, + code = 0xf121, + codefork = 0xf126, + codepen = 0xf1cb, + coffee = 0xf0f4, + cog = 0xf013, + cogs = 0xf085, + columns = 0xf0db, + comment = 0xf075, + commento = 0xf0e5, + commenting = 0xf27a, + commentingo = 0xf27b, + comments = 0xf086, + commentso = 0xf0e6, + compass = 0xf14e, + compress = 0xf066, + connectdevelop = 0xf20e, + contao = 0xf26d, + copy = 0xf0c5, + copyright = 0xf1f9, + creativecommons = 0xf25e, + creditcard = 0xf09d, + crop = 0xf125, + crosshairs = 0xf05b, + css3 = 0xf13c, + cube = 0xf1b2, + cubes = 0xf1b3, + cut = 0xf0c4, + cutlery = 0xf0f5, + dashboard = 0xf0e4, + dashcube = 0xf210, + database = 0xf1c0, + dedent = 0xf03b, + delicious = 0xf1a5, + desktop = 0xf108, + deviantart = 0xf1bd, + diamond = 0xf219, + digg = 0xf1a6, + dollar = 0xf155, + dotcircleo = 0xf192, + download = 0xf019, + dribbble = 0xf17d, + dropbox = 0xf16b, + drupal = 0xf1a9, + edit = 0xf044, + eject = 0xf052, + ellipsish = 0xf141, + ellipsisv = 0xf142, + empire = 0xf1d1, + envelope = 0xf0e0, + envelopeo = 0xf003, + envelopesquare = 0xf199, + eraser = 0xf12d, + eur = 0xf153, + euro = 0xf153, + exchange = 0xf0ec, + exclamation = 0xf12a, + exclamationcircle = 0xf06a, + exclamationtriangle = 0xf071, + expand = 0xf065, + expeditedssl = 0xf23e, + externallink = 0xf08e, + externallinksquare = 0xf14c, + eye = 0xf06e, + eyeslash = 0xf070, + eyedropper = 0xf1fb, + facebook = 0xf09a, + facebookf = 0xf09a, + facebookofficial = 0xf230, + facebooksquare = 0xf082, + fastbackward = 0xf049, + fastforward = 0xf050, + fax = 0xf1ac, + feed = 0xf09e, + female = 0xf182, + fighterjet = 0xf0fb, + file = 0xf15b, + filearchiveo = 0xf1c6, + fileaudioo = 0xf1c7, + filecodeo = 0xf1c9, + fileexcelo = 0xf1c3, + fileimageo = 0xf1c5, + filemovieo = 0xf1c8, + fileo = 0xf016, + filepdfo = 0xf1c1, + filephotoo = 0xf1c5, + filepictureo = 0xf1c5, + filepowerpointo = 0xf1c4, + filesoundo = 0xf1c7, + filetext = 0xf15c, + filetexto = 0xf0f6, + filevideoo = 0xf1c8, + filewordo = 0xf1c2, + filezipo = 0xf1c6, + fileso = 0xf0c5, + film = 0xf008, + filter = 0xf0b0, + fire = 0xf06d, + fireextinguisher = 0xf134, + firefox = 0xf269, + flag = 0xf024, + flagcheckered = 0xf11e, + flago = 0xf11d, + flash = 0xf0e7, + flask = 0xf0c3, + flickr = 0xf16e, + floppyo = 0xf0c7, + folder = 0xf07b, + foldero = 0xf114, + folderopen = 0xf07c, + folderopeno = 0xf115, + font = 0xf031, + fonticons = 0xf280, + forumbee = 0xf211, + forward = 0xf04e, + foursquare = 0xf180, + frowno = 0xf119, + futbolo = 0xf1e3, + gamepad = 0xf11b, + gavel = 0xf0e3, + gbp = 0xf154, + ge = 0xf1d1, + gear = 0xf013, + gears = 0xf085, + genderless = 0xf22d, + getpocket = 0xf265, + gg = 0xf260, + ggcircle = 0xf261, + gift = 0xf06b, + git = 0xf1d3, + gitsquare = 0xf1d2, + github = 0xf09b, + githubalt = 0xf113, + githubsquare = 0xf092, + gittip = 0xf184, + glass = 0xf000, + globe = 0xf0ac, + google = 0xf1a0, + googleplus = 0xf0d5, + googleplussquare = 0xf0d4, + googlewallet = 0xf1ee, + graduationcap = 0xf19d, + gratipay = 0xf184, + group = 0xf0c0, + hsquare = 0xf0fd, + hackernews = 0xf1d4, + handgrabo = 0xf255, + handlizardo = 0xf258, + handodown = 0xf0a7, + handoleft = 0xf0a5, + handoright = 0xf0a4, + handoup = 0xf0a6, + handpapero = 0xf256, + handpeaceo = 0xf25b, + handpointero = 0xf25a, + handrocko = 0xf255, + handscissorso = 0xf257, + handspocko = 0xf259, + handstopo = 0xf256, + hddo = 0xf0a0, + header = 0xf1dc, + headphones = 0xf025, + heart = 0xf004, + hearto = 0xf08a, + heartbeat = 0xf21e, + history = 0xf1da, + home = 0xf015, + hospitalo = 0xf0f8, + hotel = 0xf236, + hourglass = 0xf254, + hourglass1 = 0xf251, + hourglass2 = 0xf252, + hourglass3 = 0xf253, + hourglassend = 0xf253, + hourglasshalf = 0xf252, + hourglasso = 0xf250, + hourglassstart = 0xf251, + houzz = 0xf27c, + html5 = 0xf13b, + icursor = 0xf246, + ils = 0xf20b, + image = 0xf03e, + inbox = 0xf01c, + indent = 0xf03c, + industry = 0xf275, + info = 0xf129, + infocircle = 0xf05a, + inr = 0xf156, + instagram = 0xf16d, + institution = 0xf19c, + internetexplorer = 0xf26b, + intersex = 0xf224, + ioxhost = 0xf208, + italic = 0xf033, + joomla = 0xf1aa, + jpy = 0xf157, + jsfiddle = 0xf1cc, + key = 0xf084, + keyboardo = 0xf11c, + krw = 0xf159, + language = 0xf1ab, + laptop = 0xf109, + lastfm = 0xf202, + lastfmsquare = 0xf203, + leaf = 0xf06c, + leanpub = 0xf212, + legal = 0xf0e3, + lemono = 0xf094, + leveldown = 0xf149, + levelup = 0xf148, + lifebouy = 0xf1cd, + lifebuoy = 0xf1cd, + lifering = 0xf1cd, + lifesaver = 0xf1cd, + lightbulbo = 0xf0eb, + linechart = 0xf201, + link = 0xf0c1, + linkedin = 0xf0e1, + linkedinsquare = 0xf08c, + linux = 0xf17c, + list = 0xf03a, + listalt = 0xf022, + listol = 0xf0cb, + listul = 0xf0ca, + locationarrow = 0xf124, + lock = 0xf023, + longarrowdown = 0xf175, + longarrowleft = 0xf177, + longarrowright = 0xf178, + longarrowup = 0xf176, + magic = 0xf0d0, + magnet = 0xf076, + mailforward = 0xf064, + mailreply = 0xf112, + mailreplyall = 0xf122, + male = 0xf183, + map = 0xf279, + mapmarker = 0xf041, + mapo = 0xf278, + mappin = 0xf276, + mapsigns = 0xf277, + mars = 0xf222, + marsdouble = 0xf227, + marsstroke = 0xf229, + marsstrokeh = 0xf22b, + marsstrokev = 0xf22a, + maxcdn = 0xf136, + meanpath = 0xf20c, + medium = 0xf23a, + medkit = 0xf0fa, + meho = 0xf11a, + mercury = 0xf223, + microphone = 0xf130, + microphoneslash = 0xf131, + minus = 0xf068, + minuscircle = 0xf056, + minussquare = 0xf146, + minussquareo = 0xf147, + mobile = 0xf10b, + mobilephone = 0xf10b, + money = 0xf0d6, + moono = 0xf186, + mortarboard = 0xf19d, + motorcycle = 0xf21c, + mousepointer = 0xf245, + music = 0xf001, + navicon = 0xf0c9, + neuter = 0xf22c, + newspapero = 0xf1ea, + objectgroup = 0xf247, + objectungroup = 0xf248, + odnoklassniki = 0xf263, + odnoklassnikisquare = 0xf264, + opencart = 0xf23d, + openid = 0xf19b, + opera = 0xf26a, + optinmonster = 0xf23c, + outdent = 0xf03b, + pagelines = 0xf18c, + paintbrush = 0xf1fc, + paperplane = 0xf1d8, + paperplaneo = 0xf1d9, + paperclip = 0xf0c6, + paragraph = 0xf1dd, + paste = 0xf0ea, + pause = 0xf04c, + paw = 0xf1b0, + paypal = 0xf1ed, + pencil = 0xf040, + pencilsquare = 0xf14b, + pencilsquareo = 0xf044, + phone = 0xf095, + phonesquare = 0xf098, + photo = 0xf03e, + pictureo = 0xf03e, + piechart = 0xf200, + piedpiper = 0xf1a7, + piedpiperalt = 0xf1a8, + pinterest = 0xf0d2, + pinterestp = 0xf231, + pinterestsquare = 0xf0d3, + plane = 0xf072, + play = 0xf04b, + playcircle = 0xf144, + playcircleo = 0xf01d, + plug = 0xf1e6, + plus = 0xf067, + pluscircle = 0xf055, + plussquare = 0xf0fe, + plussquareo = 0xf196, + poweroff = 0xf011, + print = 0xf02f, + puzzlepiece = 0xf12e, + qq = 0xf1d6, + qrcode = 0xf029, + question = 0xf128, + questioncircle = 0xf059, + quoteleft = 0xf10d, + quoteright = 0xf10e, + ra = 0xf1d0, + random = 0xf074, + rebel = 0xf1d0, + recycle = 0xf1b8, + reddit = 0xf1a1, + redditsquare = 0xf1a2, + refresh = 0xf021, + registered = 0xf25d, + remove = 0xf00d, + renren = 0xf18b, + reorder = 0xf0c9, + repeat = 0xf01e, + reply = 0xf112, + replyall = 0xf122, + retweet = 0xf079, + rmb = 0xf157, + road = 0xf018, + rocket = 0xf135, + rotateleft = 0xf0e2, + rotateright = 0xf01e, + rouble = 0xf158, + rss = 0xf09e, + rsssquare = 0xf143, + rub = 0xf158, + ruble = 0xf158, + rupee = 0xf156, + safari = 0xf267, + save = 0xf0c7, + scissors = 0xf0c4, + search = 0xf002, + searchminus = 0xf010, + searchplus = 0xf00e, + sellsy = 0xf213, + send = 0xf1d8, + sendo = 0xf1d9, + server = 0xf233, + share = 0xf064, + sharealt = 0xf1e0, + sharealtsquare = 0xf1e1, + sharesquare = 0xf14d, + sharesquareo = 0xf045, + shekel = 0xf20b, + sheqel = 0xf20b, + shield = 0xf132, + ship = 0xf21a, + shirtsinbulk = 0xf214, + shoppingcart = 0xf07a, + signin = 0xf090, + signout = 0xf08b, + signal = 0xf012, + simplybuilt = 0xf215, + sitemap = 0xf0e8, + skyatlas = 0xf216, + skype = 0xf17e, + slack = 0xf198, + sliders = 0xf1de, + slideshare = 0xf1e7, + smileo = 0xf118, + soccerballo = 0xf1e3, + sort = 0xf0dc, + sortalphaasc = 0xf15d, + sortalphadesc = 0xf15e, + sortamountasc = 0xf160, + sortamountdesc = 0xf161, + sortasc = 0xf0de, + sortdesc = 0xf0dd, + sortdown = 0xf0dd, + sortnumericasc = 0xf162, + sortnumericdesc = 0xf163, + sortup = 0xf0de, + soundcloud = 0xf1be, + spaceshuttle = 0xf197, + spinner = 0xf110, + spoon = 0xf1b1, + spotify = 0xf1bc, + square = 0xf0c8, + squareo = 0xf096, + stackexchange = 0xf18d, + stackoverflow = 0xf16c, + star = 0xf005, + starhalf = 0xf089, + starhalfempty = 0xf123, + starhalffull = 0xf123, + starhalfo = 0xf123, + staro = 0xf006, + steam = 0xf1b6, + steamsquare = 0xf1b7, + stepbackward = 0xf048, + stepforward = 0xf051, + stethoscope = 0xf0f1, + stickynote = 0xf249, + stickynoteo = 0xf24a, + stop = 0xf04d, + streetview = 0xf21d, + strikethrough = 0xf0cc, + stumbleupon = 0xf1a4, + stumbleuponcircle = 0xf1a3, + subscript = 0xf12c, + subway = 0xf239, + suitcase = 0xf0f2, + suno = 0xf185, + superscript = 0xf12b, + support = 0xf1cd, + table = 0xf0ce, + tablet = 0xf10a, + tachometer = 0xf0e4, + tag = 0xf02b, + tags = 0xf02c, + tasks = 0xf0ae, + taxi = 0xf1ba, + television = 0xf26c, + tencentweibo = 0xf1d5, + terminal = 0xf120, + textheight = 0xf034, + textwidth = 0xf035, + th = 0xf00a, + thlarge = 0xf009, + thlist = 0xf00b, + thumbtack = 0xf08d, + thumbsdown = 0xf165, + thumbsodown = 0xf088, + thumbsoup = 0xf087, + thumbsup = 0xf164, + ticket = 0xf145, + times = 0xf00d, + timescircle = 0xf057, + timescircleo = 0xf05c, + tint = 0xf043, + toggledown = 0xf150, + toggleleft = 0xf191, + toggleoff = 0xf204, + toggleon = 0xf205, + toggleright = 0xf152, + toggleup = 0xf151, + trademark = 0xf25c, + train = 0xf238, + transgender = 0xf224, + transgenderalt = 0xf225, + trash = 0xf1f8, + trasho = 0xf014, + tree = 0xf1bb, + trello = 0xf181, + tripadvisor = 0xf262, + trophy = 0xf091, + truck = 0xf0d1, + fa_try = 0xf195, + tty = 0xf1e4, + tumblr = 0xf173, + tumblrsquare = 0xf174, + turkishlira = 0xf195, + tv = 0xf26c, + twitch = 0xf1e8, + twitter = 0xf099, + twittersquare = 0xf081, + umbrella = 0xf0e9, + underline = 0xf0cd, + undo = 0xf0e2, + university = 0xf19c, + unlink = 0xf127, + unlock = 0xf09c, + unlockalt = 0xf13e, + unsorted = 0xf0dc, + upload = 0xf093, + usd = 0xf155, + user = 0xf007, + usermd = 0xf0f0, + userplus = 0xf234, + usersecret = 0xf21b, + usertimes = 0xf235, + users = 0xf0c0, + venus = 0xf221, + venusdouble = 0xf226, + venusmars = 0xf228, + viacoin = 0xf237, + videocamera = 0xf03d, + vimeo = 0xf27d, + vimeosquare = 0xf194, + vine = 0xf1ca, + vk = 0xf189, + volumedown = 0xf027, + volumeoff = 0xf026, + volumeup = 0xf028, + warning = 0xf071, + wechat = 0xf1d7, + weibo = 0xf18a, + weixin = 0xf1d7, + whatsapp = 0xf232, + wheelchair = 0xf193, + wifi = 0xf1eb, + wikipediaw = 0xf266, + windows = 0xf17a, + won = 0xf159, + wordpress = 0xf19a, + wrench = 0xf0ad, + xing = 0xf168, + xingsquare = 0xf169, + ycombinator = 0xf23b, + ycombinatorsquare = 0xf1d4, + yahoo = 0xf19e, + yc = 0xf23b, + ycsquare = 0xf1d4, + yelp = 0xf1e9, + yen = 0xf157, + youtube = 0xf167, + youtubeplay = 0xf16a, + youtubesquare = 0xf166 + }; +} + + + +//--------------------------------------------------------------------------------------- + +class QtAwesomeIconPainter; + +/// The main class for managing icons +/// This class requires a 2-phase construction. You must first create the class and then initialize it via an init* method +class QtAwesome : public QObject +{ +Q_OBJECT + +public: + + QtAwesome(QObject *parent = 0); + virtual ~QtAwesome(); + + void init( const QString& fontname ); + bool initFontAwesome(); + + void addNamedCodepoint( const QString& name, int codePoint ); + QHash namedCodePoints() { return namedCodepoints_; } + + void setDefaultOption( const QString& name, const QVariant& value ); + QVariant defaultOption( const QString& name ); + + QIcon icon( int character, const QVariantMap& options = QVariantMap() ); + QIcon icon( const QString& name, const QVariantMap& options = QVariantMap() ); + QIcon icon(QtAwesomeIconPainter* painter, const QVariantMap& optionMap = QVariantMap() ); + + void give( const QString& name, QtAwesomeIconPainter* painter ); + + QFont font( int size ); + + /// Returns the font-name that is used as icon-map + QString fontName() { return fontName_ ; } + +private: + QString fontName_; ///< The font name used for this map + QHash namedCodepoints_; ///< A map with names mapped to code-points + + QHash painterMap_; ///< A map of custom painters + QVariantMap defaultOptions_; ///< The default icon options + QtAwesomeIconPainter* fontIconPainter_; ///< A special painter fo painting codepoints +}; + + +//--------------------------------------------------------------------------------------- + + +/// The QtAwesomeIconPainter is a specialized painter for painting icons +/// your can implement an iconpainter to create custom font-icon code +class QtAwesomeIconPainter +{ +public: + virtual ~QtAwesomeIconPainter() {} + virtual void paint( QtAwesome* awesome, QPainter* painter, const QRect& rect, QIcon::Mode mode, QIcon::State state, const QVariantMap& options ) = 0; +}; + + + +#endif // QTAWESOME_H diff --git a/src/QtAwesome/QtAwesome.pri b/src/QtAwesome/QtAwesome.pri new file mode 100644 index 00000000..5e4002df --- /dev/null +++ b/src/QtAwesome/QtAwesome.pri @@ -0,0 +1,10 @@ + +INCLUDEPATH += $$PWD + +SOURCES += $$PWD/QtAwesome.cpp + +HEADERS += $$PWD/QtAwesome.h + +RESOURCES += $$PWD/QtAwesome.qrc + + diff --git a/src/QtAwesome/QtAwesome.pro b/src/QtAwesome/QtAwesome.pro new file mode 100644 index 00000000..173ebc08 --- /dev/null +++ b/src/QtAwesome/QtAwesome.pro @@ -0,0 +1,28 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2013-04-18T13:28:42 +# +#------------------------------------------------- + +TARGET = QtAwesome +TEMPLATE = lib +CONFIG += staticlib c++11 + +SOURCES += QtAwesome.cpp +HEADERS += QtAwesome.h + +isEmpty(PREFIX) { + unix { + PREFIX = /usr + } else { + PREFIX = $$[QT_INSTALL_PREFIX] + } +} + +install_headers.files = QtAwesome.h +install_headers.path = $$PREFIX/include +target.path = $$PREFIX/lib +INSTALLS += install_headers target + +RESOURCES += \ + QtAwesome.qrc diff --git a/src/QtAwesome/QtAwesome.qrc b/src/QtAwesome/QtAwesome.qrc new file mode 100644 index 00000000..9c1536d2 --- /dev/null +++ b/src/QtAwesome/QtAwesome.qrc @@ -0,0 +1,5 @@ + + + fonts/fontawesome-4.4.0.ttf + + diff --git a/src/QtAwesome/README.md b/src/QtAwesome/README.md new file mode 100644 index 00000000..c2f2d999 --- /dev/null +++ b/src/QtAwesome/README.md @@ -0,0 +1,205 @@ +QtAwesome - Font Awesome support for Qt applications +==================================================== + +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/). + +NOTE: Though the name is QtAwesome and currently it's very Font Awesome based, you can use every other icon/glyph font you want. + +The class can also be used to manage your own dynamic code-drawn icons, by adding named icon-painters. + + +Updated to FontAwesome 4 +------------------------ + +This library has been updated to Font Awesome version 4. + +The current Font Awesome version is **4.4.0**. + +* 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). + + +**Note about previous c++11** + +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. +Just integers it is. Simpler is better. + + + + +Installation +------------ + +The easiest way to include QtAweome in your project is to copy the QtAwesome directory to your +project tree and add the following `include()` to your Qt project file: + + include(QtAwesome/QtAwesome.pri) + +Now you are good to go! + + +Usage +----- + +You probably want to create a single QtAwesome object for your whole application: + +```` + QtAwesome* awesome = new QtAwesome( qApp ) + 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). +* Use an icon name from the [Font Awesome Cheatsheet](http://fortawesome.github.io/Font-Awesome/cheatsheet/). + + +Example +-------- + +```c++ +// You should create a single object of QtAwesome. +QtAwesome* awesome = new QtAwesome( qApp ); +awesome->initFontAwesome(); + +// Next create your icon with the help of the icon-enumeration (no dashes): +QPushButton* beerButton new QPushButton( awesome->icon( fa::beer ), "Cheers!" ); + +// You can also use 'string' names to access the icons. (The string version omits the 'fa-' or 'icon-' prefix and has no dashes ) +QPushButton* coffeeButton new QPushButton( awesome->icon( "coffee" ), "Black please!" ); + +// When you create an icon you can supply some options for your icons: +// The available options can be found at the "Default options"-section + +QVariantMap options; +options.insert( "color" , QColor(255,0,0) ); +QPushButton* musicButton = new QPushButton( awesome->icon( fa::music, options ), "Music" ); + +// You can also change the default options. +// for example if you always would like to have green icons you could call) +awesome->setDefaultOption( "color-disabled", QColor(0,255,0) ); + +// You can also directly render a label with this font +QLabel* label = new QLabel( QChar( fa::group ) ); +label->setFont( awesome->font(16) ); + +``` + +Example custom painter +---------------------- + +This example registers a custom painter for supporting a duplicate icon (it draws 2 "plus marks"): + +```c++ +class DuplicateIconPainter : public QtAwesomeIconPainter +{ +public: + virtual void paint( QtAwesome* awesome, QPainter* painter, const QRect& rectIn, QIcon::Mode mode, QIcon::State state, const QVariantMap& options ) + { + int drawSize = qRound(rectIn.height()*0.5); + int offset = rectIn.height() / 4; + QChar chr = QChar( static_cast(fa::plus) ); + + painter->setFont( awesome->font( drawSize ) ); + + painter->setPen( QColor(100,100,100) ); + painter->drawText( QRect( QPoint(offset*2, offset*2), QSize(drawSize, drawSize) ), chr , QTextOption( Qt::AlignCenter|Qt::AlignVCenter ) ); + + painter->setPen( QColor(50,50,50) ); + painter->drawText( QRect( QPoint(rectIn.width()-drawSize-offset, rectIn.height()-drawSize-offset), QSize(drawSize, drawSize) ), chr , QTextOption( Qt::AlignCenter|Qt::AlignVCenter ) ); + + } +}; + +awesome->give("duplicate", new DuplicateIconPainter() ); +``` + + +Default options: +---------------- + + The following options are default in the QtAwesome class. + +```c++ +setDefaultOption( "color", QColor(50,50,50) ); +setDefaultOption( "color-disabled", QColor(70,70,70,60)); +setDefaultOption( "color-active", QColor(10,10,10)); +setDefaultOption( "color-selected", QColor(10,10,10)); + +setDefaultOption( "text", QString() ); // internal option +setDefaultOption( "text-disabled", QString() ); +setDefaultOption( "text-active", QString() ); +setDefaultOption( "text-selected", QString() ); + +setDefaultOption( "scale-factor", 0.9 ); +``` + + 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. + + 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: + +```c++ + options.insert("text-selected", QString( fa::lock ) ); +``` + +License +------- + +MIT License. Copyright 2013 - Reliable Bits Software by Blommers IT. [http://blommersit.nl/](http://blommersit.nl) + +The Font Awesome font is licensed under the SIL Open Font License - [http://scripts.sil.org/OFL](http://scripts.sil.org/OFL) +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" + +Contact +------- + +* email: +* twitter: [https://twitter.com/gamecreature](https://twitter.com/gamecreature) +* website: [http://blommersit.nl](http://blommersit.nl) (warning Dutch content ahead) +* github: [https://github.com/gamecreature/QtAwesome](https://github.com/gamecreature/QtAwesome) + + +Known issues and workarounds +---------------------------- + +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] + +A workaround for this problem is converting it to a Pixmap icon like this: + +```c++ +QAction* menuAction = new QAction("test"); +menuAction->setIcon( awesome->icon(fa::beer).pixmap(32,32)) ); +``` + + +Remarks +------- + +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, +I thought it would be nice to be able to use these icons for my Qt project. + +I've slightly changed the code from the original, added some more documentation, but it's still +a work in progress. So feel free to drop me an e-mail for your suggestions and improvements! + +There are still some things todo, like: + + * document the usage of another icon font + * add some tests + * do some code cleanup + +Thanks go to the contributors of this project! + +And of course last but not least, + +Many thanks go to Dave Gandy an the other Font Awesome contributors!! [http://fortawesome.github.com/Font-Awesome](http://fortawesome.github.com/Font-Awesome) +And of course to the Qt team/contributors for supplying this great cross-platform c++ library. + +Contributions are welcome! Feel free to fork and send a pull request through Github. diff --git a/src/QtAwesome/fonts/fontawesome-4.4.0.ttf b/src/QtAwesome/fonts/fontawesome-4.4.0.ttf new file mode 100644 index 00000000..d7994e13 Binary files /dev/null and b/src/QtAwesome/fonts/fontawesome-4.4.0.ttf differ diff --git a/win/icon.ico b/win/icon.ico new file mode 100644 index 00000000..dd37c000 Binary files /dev/null and b/win/icon.ico differ diff --git a/win/windows_res.rc b/win/windows_res.rc new file mode 100644 index 00000000..23bbeaf7 --- /dev/null +++ b/win/windows_res.rc @@ -0,0 +1,3 @@ +#include + +IDI_ICON1 ICON DISCARDABLE "icon.ico"