diff --git a/openhantek/res/application.qrc b/openhantek/res/application.qrc index 2f53eff..22f9432 100644 --- a/openhantek/res/application.qrc +++ b/openhantek/res/application.qrc @@ -2,16 +2,9 @@ images/openhantek.png images/switch.png + images/fontawesome-4.7.0.ttf + images/openhantek.svg + images/digitalphosphor.svg - - images/actions/open.png - images/actions/save.png - images/actions/save-as.png - images/actions/print.png - images/actions/export-as.png - images/actions/start.png - images/actions/stop.png - images/actions/digitalphosphor.png - images/actions/zoom.png - + diff --git a/openhantek/res/images/actions/cursors.png b/openhantek/res/images/actions/cursors.png deleted file mode 100644 index 1bcaac8..0000000 --- a/openhantek/res/images/actions/cursors.png +++ /dev/null diff --git a/openhantek/res/images/actions/export-as.png b/openhantek/res/images/actions/export-as.png deleted file mode 100644 index 999a415..0000000 --- a/openhantek/res/images/actions/export-as.png +++ /dev/null diff --git a/openhantek/res/images/actions/open.png b/openhantek/res/images/actions/open.png deleted file mode 100644 index 7422ad3..0000000 --- a/openhantek/res/images/actions/open.png +++ /dev/null diff --git a/openhantek/res/images/actions/print.png b/openhantek/res/images/actions/print.png deleted file mode 100644 index d655504..0000000 --- a/openhantek/res/images/actions/print.png +++ /dev/null diff --git a/openhantek/res/images/actions/save-as.png b/openhantek/res/images/actions/save-as.png deleted file mode 100644 index 9695a56..0000000 --- a/openhantek/res/images/actions/save-as.png +++ /dev/null diff --git a/openhantek/res/images/actions/save.png b/openhantek/res/images/actions/save.png deleted file mode 100644 index 7fa489c..0000000 --- a/openhantek/res/images/actions/save.png +++ /dev/null diff --git a/openhantek/res/images/actions/start.png b/openhantek/res/images/actions/start.png deleted file mode 100644 index 7190685..0000000 --- a/openhantek/res/images/actions/start.png +++ /dev/null diff --git a/openhantek/res/images/actions/stop.png b/openhantek/res/images/actions/stop.png deleted file mode 100644 index 650874f..0000000 --- a/openhantek/res/images/actions/stop.png +++ /dev/null diff --git a/openhantek/res/images/actions/zoom.png b/openhantek/res/images/actions/zoom.png deleted file mode 100644 index c9860d4..0000000 --- a/openhantek/res/images/actions/zoom.png +++ /dev/null diff --git a/openhantek/res/images/actions/digitalphosphor.png b/openhantek/res/images/digitalphosphor.png index bf04c5f..bf04c5f 100644 --- a/openhantek/res/images/actions/digitalphosphor.png +++ b/openhantek/res/images/digitalphosphor.png diff --git a/openhantek/res/images/actions/digitalphosphor.svg b/openhantek/res/images/digitalphosphor.svg index a06679e..a06679e 100644 --- a/openhantek/res/images/actions/digitalphosphor.svg +++ b/openhantek/res/images/digitalphosphor.svg diff --git a/openhantek/res/images/fontawesome-4.7.0.ttf b/openhantek/res/images/fontawesome-4.7.0.ttf new file mode 100644 index 0000000..35acda2 --- /dev/null +++ b/openhantek/res/images/fontawesome-4.7.0.ttf diff --git a/openhantek/src/iconfont/QtAwesome.cpp b/openhantek/src/iconfont/QtAwesome.cpp new file mode 100644 index 0000000..78405e8 --- /dev/null +++ b/openhantek/src/iconfont/QtAwesome.cpp @@ -0,0 +1,1083 @@ +/** + * QtAwesome - use font-awesome (or other font icons) in your c++ / Qt Application + * + * MIT Licensed + * + * Copyright 2013-2016 - Reliable Bits Software by Blommers IT. All Rights Reserved. + * Author Rick Blommers + */ + +#include "QtAwesome.h" +#include "QtAwesomeAnim.h" + +#include +#include +#include + +QtAwesome *iconFont = new QtAwesome(); + +/// The font-awesome icon painter +class QtAwesomeCharIconPainter : public QtAwesomeIconPainter { + + protected: + QStringList optionKeysForModeAndState(const QString &key, QIcon::Mode mode, QIcon::State state) { + QString modePostfix; + switch (mode) { + case QIcon::Disabled: + modePostfix = "-disabled"; + break; + case QIcon::Active: + modePostfix = "-active"; + break; + case QIcon::Selected: + modePostfix = "-selected"; + break; + case QIcon::Normal: + break; + } + + QString statePostfix; + if (state == QIcon::Off) { statePostfix = "-off"; } + + // the keys that need to bet tested: key-mode-state | key-mode | key-state | key + QStringList result; + if (!modePostfix.isEmpty()) { + if (!statePostfix.isEmpty()) { result.push_back(key + modePostfix + statePostfix); } + result.push_back(key + modePostfix); + } + if (!statePostfix.isEmpty()) { result.push_back(key + statePostfix); } + + return result; + } + + QVariant optionValueForModeAndState(const QString &baseKey, QIcon::Mode mode, QIcon::State state, + const QVariantMap &options) { + foreach (QString key, optionKeysForModeAndState(baseKey, mode, state)) { + if (options.contains(key)) return options.value(key); + } + return options.value(baseKey); + } + + 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 default options + QColor color = optionValueForModeAndState("color", mode, state, options).value(); + QString text = optionValueForModeAndState("text", mode, state, options).toString(); + + if (text.isEmpty() || color.red()==0) { + qWarning() << "empty for" << mode << state << options; + } + + 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(); + + QVariant var = options.value("anim"); + QtAwesomeAnimation *anim = var.value(); + if (anim) { anim->setup(*painter, rect); } + + } +}; + +//--------------------------------------------------------------------------------------- + +/// 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 override { + return new QtAwesomeIconPainterIconEngine(awesomeRef_, iconPainterRef_, options_); + } + + virtual void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) override { + 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) override { + QPixmap pm(size); + pm.fill(Qt::transparent); // we need transparency + { + QPainter p(&pm); + paint(&p, QRect(QPoint(0, 0), size), mode, state); + } + return pm; + } + //#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) + // virtual QList availableSizes(QIcon::Mode mode, QIcon::State state) const override { + // Q_UNUSED(mode); + // Q_UNUSED(state); + // QList sizes = {QSize(16, 16), QSize(32, 32), QSize(64, 64), + // QSize(128, 128), QSize(256, 256), QSize(512, 512)}; + // return sizes; + // } + //#endif + 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-off", 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", 1.0); + + 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; } + +struct FANameIcon { + const char *name; + fa::icon icon; +}; + +static const FANameIcon faNameIconArray[] = {{"fa_500px", fa::fa_500px}, + {"addressbook", fa::addressbook}, + {"addressbooko", fa::addressbooko}, + {"addresscard", fa::addresscard}, + {"addresscardo", fa::addresscardo}, + {"adjust", fa::adjust}, + {"adn", fa::adn}, + {"aligncenter", fa::aligncenter}, + {"alignjustify", fa::alignjustify}, + {"alignleft", fa::alignleft}, + {"alignright", fa::alignright}, + {"amazon", fa::amazon}, + {"ambulance", fa::ambulance}, + {"americansignlanguageinterpreting", fa::americansignlanguageinterpreting}, + {"anchor", fa::anchor}, + {"android", fa::android}, + {"angellist", fa::angellist}, + {"angledoubledown", fa::angledoubledown}, + {"angledoubleleft", fa::angledoubleleft}, + {"angledoubleright", fa::angledoubleright}, + {"angledoubleup", fa::angledoubleup}, + {"angledown", fa::angledown}, + {"angleleft", fa::angleleft}, + {"angleright", fa::angleright}, + {"angleup", fa::angleup}, + {"apple", fa::apple}, + {"archive", fa::archive}, + {"areachart", fa::areachart}, + {"arrowcircledown", fa::arrowcircledown}, + {"arrowcircleleft", fa::arrowcircleleft}, + {"arrowcircleodown", fa::arrowcircleodown}, + {"arrowcircleoleft", fa::arrowcircleoleft}, + {"arrowcircleoright", fa::arrowcircleoright}, + {"arrowcircleoup", fa::arrowcircleoup}, + {"arrowcircleright", fa::arrowcircleright}, + {"arrowcircleup", fa::arrowcircleup}, + {"arrowdown", fa::arrowdown}, + {"arrowleft", fa::arrowleft}, + {"arrowright", fa::arrowright}, + {"arrowup", fa::arrowup}, + {"arrows", fa::arrows}, + {"arrowsalt", fa::arrowsalt}, + {"arrowsh", fa::arrowsh}, + {"arrowsv", fa::arrowsv}, + {"aslinterpreting", fa::aslinterpreting}, + {"assistivelisteningsystems", fa::assistivelisteningsystems}, + {"asterisk", fa::asterisk}, + {"at", fa::at}, + {"audiodescription", fa::audiodescription}, + {"automobile", fa::automobile}, + {"backward", fa::backward}, + {"balancescale", fa::balancescale}, + {"ban", fa::ban}, + {"bandcamp", fa::bandcamp}, + {"bank", fa::bank}, + {"barchart", fa::barchart}, + {"barcharto", fa::barcharto}, + {"barcode", fa::barcode}, + {"bars", fa::bars}, + {"bath", fa::bath}, + {"bathtub", fa::bathtub}, + {"battery", fa::battery}, + {"battery0", fa::battery0}, + {"battery1", fa::battery1}, + {"battery2", fa::battery2}, + {"battery3", fa::battery3}, + {"battery4", fa::battery4}, + {"batteryempty", fa::batteryempty}, + {"batteryfull", fa::batteryfull}, + {"batteryhalf", fa::batteryhalf}, + {"batteryquarter", fa::batteryquarter}, + {"batterythreequarters", fa::batterythreequarters}, + {"bed", fa::bed}, + {"beer", fa::beer}, + {"behance", fa::behance}, + {"behancesquare", fa::behancesquare}, + {"bell", fa::bell}, + {"bello", fa::bello}, + {"bellslash", fa::bellslash}, + {"bellslasho", fa::bellslasho}, + {"bicycle", fa::bicycle}, + {"binoculars", fa::binoculars}, + {"birthdaycake", fa::birthdaycake}, + {"bitbucket", fa::bitbucket}, + {"bitbucketsquare", fa::bitbucketsquare}, + {"bitcoin", fa::bitcoin}, + {"blacktie", fa::blacktie}, + {"blind", fa::blind}, + {"bluetooth", fa::bluetooth}, + {"bluetoothb", fa::bluetoothb}, + {"bold", fa::bold}, + {"bolt", fa::bolt}, + {"bomb", fa::bomb}, + {"book", fa::book}, + {"bookmark", fa::bookmark}, + {"bookmarko", fa::bookmarko}, + {"braille", fa::braille}, + {"briefcase", fa::briefcase}, + {"btc", fa::btc}, + {"bug", fa::bug}, + {"building", fa::building}, + {"buildingo", fa::buildingo}, + {"bullhorn", fa::bullhorn}, + {"bullseye", fa::bullseye}, + {"bus", fa::bus}, + {"buysellads", fa::buysellads}, + {"cab", fa::cab}, + {"calculator", fa::calculator}, + {"calendar", fa::calendar}, + {"calendarchecko", fa::calendarchecko}, + {"calendarminuso", fa::calendarminuso}, + {"calendaro", fa::calendaro}, + {"calendarpluso", fa::calendarpluso}, + {"calendartimeso", fa::calendartimeso}, + {"camera", fa::camera}, + {"cameraretro", fa::cameraretro}, + {"car", fa::car}, + {"caretdown", fa::caretdown}, + {"caretleft", fa::caretleft}, + {"caretright", fa::caretright}, + {"caretsquareodown", fa::caretsquareodown}, + {"caretsquareoleft", fa::caretsquareoleft}, + {"caretsquareoright", fa::caretsquareoright}, + {"caretsquareoup", fa::caretsquareoup}, + {"caretup", fa::caretup}, + {"cartarrowdown", fa::cartarrowdown}, + {"cartplus", fa::cartplus}, + {"cc", fa::cc}, + {"ccamex", fa::ccamex}, + {"ccdinersclub", fa::ccdinersclub}, + {"ccdiscover", fa::ccdiscover}, + {"ccjcb", fa::ccjcb}, + {"ccmastercard", fa::ccmastercard}, + {"ccpaypal", fa::ccpaypal}, + {"ccstripe", fa::ccstripe}, + {"ccvisa", fa::ccvisa}, + {"certificate", fa::certificate}, + {"chain", fa::chain}, + {"chainbroken", fa::chainbroken}, + {"check", fa::check}, + {"checkcircle", fa::checkcircle}, + {"checkcircleo", fa::checkcircleo}, + {"checksquare", fa::checksquare}, + {"checksquareo", fa::checksquareo}, + {"chevroncircledown", fa::chevroncircledown}, + {"chevroncircleleft", fa::chevroncircleleft}, + {"chevroncircleright", fa::chevroncircleright}, + {"chevroncircleup", fa::chevroncircleup}, + {"chevrondown", fa::chevrondown}, + {"chevronleft", fa::chevronleft}, + {"chevronright", fa::chevronright}, + {"chevronup", fa::chevronup}, + {"child", fa::child}, + {"chrome", fa::chrome}, + {"circle", fa::circle}, + {"circleo", fa::circleo}, + {"circleonotch", fa::circleonotch}, + {"circlethin", fa::circlethin}, + {"clipboard", fa::clipboard}, + {"clocko", fa::clocko}, + {"clone", fa::clone}, + {"close", fa::close}, + {"cloud", fa::cloud}, + {"clouddownload", fa::clouddownload}, + {"cloudupload", fa::cloudupload}, + {"cny", fa::cny}, + {"code", fa::code}, + {"codefork", fa::codefork}, + {"codepen", fa::codepen}, + {"codiepie", fa::codiepie}, + {"coffee", fa::coffee}, + {"cog", fa::cog}, + {"cogs", fa::cogs}, + {"columns", fa::columns}, + {"comment", fa::comment}, + {"commento", fa::commento}, + {"commenting", fa::commenting}, + {"commentingo", fa::commentingo}, + {"comments", fa::comments}, + {"commentso", fa::commentso}, + {"compass", fa::compass}, + {"compress", fa::compress}, + {"connectdevelop", fa::connectdevelop}, + {"contao", fa::contao}, + {"copy", fa::copy}, + {"copyright", fa::copyright}, + {"creativecommons", fa::creativecommons}, + {"creditcard", fa::creditcard}, + {"creditcardalt", fa::creditcardalt}, + {"crop", fa::crop}, + {"crosshairs", fa::crosshairs}, + {"css3", fa::css3}, + {"cube", fa::cube}, + {"cubes", fa::cubes}, + {"cut", fa::cut}, + {"cutlery", fa::cutlery}, + {"dashboard", fa::dashboard}, + {"dashcube", fa::dashcube}, + {"database", fa::database}, + {"deaf", fa::deaf}, + {"deafness", fa::deafness}, + {"dedent", fa::dedent}, + {"delicious", fa::delicious}, + {"desktop", fa::desktop}, + {"deviantart", fa::deviantart}, + {"diamond", fa::diamond}, + {"digg", fa::digg}, + {"dollar", fa::dollar}, + {"dotcircleo", fa::dotcircleo}, + {"download", fa::download}, + {"dribbble", fa::dribbble}, + {"driverslicense", fa::driverslicense}, + {"driverslicenseo", fa::driverslicenseo}, + {"dropbox", fa::dropbox}, + {"drupal", fa::drupal}, + {"edge", fa::edge}, + {"edit", fa::edit}, + {"eercast", fa::eercast}, + {"eject", fa::eject}, + {"ellipsish", fa::ellipsish}, + {"ellipsisv", fa::ellipsisv}, + {"empire", fa::empire}, + {"envelope", fa::envelope}, + {"envelopeo", fa::envelopeo}, + {"envelopeopen", fa::envelopeopen}, + {"envelopeopeno", fa::envelopeopeno}, + {"envelopesquare", fa::envelopesquare}, + {"envira", fa::envira}, + {"eraser", fa::eraser}, + {"etsy", fa::etsy}, + {"eur", fa::eur}, + {"euro", fa::euro}, + {"exchange", fa::exchange}, + {"exclamation", fa::exclamation}, + {"exclamationcircle", fa::exclamationcircle}, + {"exclamationtriangle", fa::exclamationtriangle}, + {"expand", fa::expand}, + {"expeditedssl", fa::expeditedssl}, + {"externallink", fa::externallink}, + {"externallinksquare", fa::externallinksquare}, + {"eye", fa::eye}, + {"eyeslash", fa::eyeslash}, + {"eyedropper", fa::eyedropper}, + {"fa", fa::fa}, + {"facebook", fa::facebook}, + {"facebookf", fa::facebookf}, + {"facebookofficial", fa::facebookofficial}, + {"facebooksquare", fa::facebooksquare}, + {"fastbackward", fa::fastbackward}, + {"fastforward", fa::fastforward}, + {"fax", fa::fax}, + {"feed", fa::feed}, + {"female", fa::female}, + {"fighterjet", fa::fighterjet}, + {"file", fa::file}, + {"filearchiveo", fa::filearchiveo}, + {"fileaudioo", fa::fileaudioo}, + {"filecodeo", fa::filecodeo}, + {"fileexcelo", fa::fileexcelo}, + {"fileimageo", fa::fileimageo}, + {"filemovieo", fa::filemovieo}, + {"fileo", fa::fileo}, + {"filepdfo", fa::filepdfo}, + {"filephotoo", fa::filephotoo}, + {"filepictureo", fa::filepictureo}, + {"filepowerpointo", fa::filepowerpointo}, + {"filesoundo", fa::filesoundo}, + {"filetext", fa::filetext}, + {"filetexto", fa::filetexto}, + {"filevideoo", fa::filevideoo}, + {"filewordo", fa::filewordo}, + {"filezipo", fa::filezipo}, + {"fileso", fa::fileso}, + {"film", fa::film}, + {"filter", fa::filter}, + {"fire", fa::fire}, + {"fireextinguisher", fa::fireextinguisher}, + {"firefox", fa::firefox}, + {"firstorder", fa::firstorder}, + {"flag", fa::flag}, + {"flagcheckered", fa::flagcheckered}, + {"flago", fa::flago}, + {"flash", fa::flash}, + {"flask", fa::flask}, + {"flickr", fa::flickr}, + {"floppyo", fa::floppyo}, + {"folder", fa::folder}, + {"foldero", fa::foldero}, + {"folderopen", fa::folderopen}, + {"folderopeno", fa::folderopeno}, + {"font", fa::font}, + {"fontawesome", fa::fontawesome}, + {"fonticons", fa::fonticons}, + {"fortawesome", fa::fortawesome}, + {"forumbee", fa::forumbee}, + {"forward", fa::forward}, + {"foursquare", fa::foursquare}, + {"freecodecamp", fa::freecodecamp}, + {"frowno", fa::frowno}, + {"futbolo", fa::futbolo}, + {"gamepad", fa::gamepad}, + {"gavel", fa::gavel}, + {"gbp", fa::gbp}, + {"ge", fa::ge}, + {"gear", fa::gear}, + {"gears", fa::gears}, + {"genderless", fa::genderless}, + {"getpocket", fa::getpocket}, + {"gg", fa::gg}, + {"ggcircle", fa::ggcircle}, + {"gift", fa::gift}, + {"git", fa::git}, + {"gitsquare", fa::gitsquare}, + {"github", fa::github}, + {"githubalt", fa::githubalt}, + {"githubsquare", fa::githubsquare}, + {"gitlab", fa::gitlab}, + {"gittip", fa::gittip}, + {"glass", fa::glass}, + {"glide", fa::glide}, + {"glideg", fa::glideg}, + {"globe", fa::globe}, + {"google", fa::google}, + {"googleplus", fa::googleplus}, + {"googlepluscircle", fa::googlepluscircle}, + {"googleplusofficial", fa::googleplusofficial}, + {"googleplussquare", fa::googleplussquare}, + {"googlewallet", fa::googlewallet}, + {"graduationcap", fa::graduationcap}, + {"gratipay", fa::gratipay}, + {"grav", fa::grav}, + {"group", fa::group}, + {"hsquare", fa::hsquare}, + {"hackernews", fa::hackernews}, + {"handgrabo", fa::handgrabo}, + {"handlizardo", fa::handlizardo}, + {"handodown", fa::handodown}, + {"handoleft", fa::handoleft}, + {"handoright", fa::handoright}, + {"handoup", fa::handoup}, + {"handpapero", fa::handpapero}, + {"handpeaceo", fa::handpeaceo}, + {"handpointero", fa::handpointero}, + {"handrocko", fa::handrocko}, + {"handscissorso", fa::handscissorso}, + {"handspocko", fa::handspocko}, + {"handstopo", fa::handstopo}, + {"handshakeo", fa::handshakeo}, + {"hardofhearing", fa::hardofhearing}, + {"hashtag", fa::hashtag}, + {"hddo", fa::hddo}, + {"header", fa::header}, + {"headphones", fa::headphones}, + {"heart", fa::heart}, + {"hearto", fa::hearto}, + {"heartbeat", fa::heartbeat}, + {"history", fa::history}, + {"home", fa::home}, + {"hospitalo", fa::hospitalo}, + {"hotel", fa::hotel}, + {"hourglass", fa::hourglass}, + {"hourglass1", fa::hourglass1}, + {"hourglass2", fa::hourglass2}, + {"hourglass3", fa::hourglass3}, + {"hourglassend", fa::hourglassend}, + {"hourglasshalf", fa::hourglasshalf}, + {"hourglasso", fa::hourglasso}, + {"hourglassstart", fa::hourglassstart}, + {"houzz", fa::houzz}, + {"html5", fa::html5}, + {"icursor", fa::icursor}, + {"idbadge", fa::idbadge}, + {"idcard", fa::idcard}, + {"idcardo", fa::idcardo}, + {"ils", fa::ils}, + {"image", fa::image}, + {"imdb", fa::imdb}, + {"inbox", fa::inbox}, + {"indent", fa::indent}, + {"industry", fa::industry}, + {"info", fa::info}, + {"infocircle", fa::infocircle}, + {"inr", fa::inr}, + {"instagram", fa::instagram}, + {"institution", fa::institution}, + {"internetexplorer", fa::internetexplorer}, + {"intersex", fa::intersex}, + {"ioxhost", fa::ioxhost}, + {"italic", fa::italic}, + {"joomla", fa::joomla}, + {"jpy", fa::jpy}, + {"jsfiddle", fa::jsfiddle}, + {"key", fa::key}, + {"keyboardo", fa::keyboardo}, + {"krw", fa::krw}, + {"language", fa::language}, + {"laptop", fa::laptop}, + {"lastfm", fa::lastfm}, + {"lastfmsquare", fa::lastfmsquare}, + {"leaf", fa::leaf}, + {"leanpub", fa::leanpub}, + {"legal", fa::legal}, + {"lemono", fa::lemono}, + {"leveldown", fa::leveldown}, + {"levelup", fa::levelup}, + {"lifebouy", fa::lifebouy}, + {"lifebuoy", fa::lifebuoy}, + {"lifering", fa::lifering}, + {"lifesaver", fa::lifesaver}, + {"lightbulbo", fa::lightbulbo}, + {"linechart", fa::linechart}, + {"link", fa::link}, + {"linkedin", fa::linkedin}, + {"linkedinsquare", fa::linkedinsquare}, + {"linode", fa::linode}, + {"fa_linux", fa::fa_linux}, + {"list", fa::list}, + {"listalt", fa::listalt}, + {"listol", fa::listol}, + {"listul", fa::listul}, + {"locationarrow", fa::locationarrow}, + {"lock", fa::lock}, + {"longarrowdown", fa::longarrowdown}, + {"longarrowleft", fa::longarrowleft}, + {"longarrowright", fa::longarrowright}, + {"longarrowup", fa::longarrowup}, + {"lowvision", fa::lowvision}, + {"magic", fa::magic}, + {"magnet", fa::magnet}, + {"mailforward", fa::mailforward}, + {"mailreply", fa::mailreply}, + {"mailreplyall", fa::mailreplyall}, + {"male", fa::male}, + {"map", fa::map}, + {"mapmarker", fa::mapmarker}, + {"mapo", fa::mapo}, + {"mappin", fa::mappin}, + {"mapsigns", fa::mapsigns}, + {"mars", fa::mars}, + {"marsdouble", fa::marsdouble}, + {"marsstroke", fa::marsstroke}, + {"marsstrokeh", fa::marsstrokeh}, + {"marsstrokev", fa::marsstrokev}, + {"maxcdn", fa::maxcdn}, + {"meanpath", fa::meanpath}, + {"medium", fa::medium}, + {"medkit", fa::medkit}, + {"meetup", fa::meetup}, + {"meho", fa::meho}, + {"mercury", fa::mercury}, + {"microchip", fa::microchip}, + {"microphone", fa::microphone}, + {"microphoneslash", fa::microphoneslash}, + {"minus", fa::minus}, + {"minuscircle", fa::minuscircle}, + {"minussquare", fa::minussquare}, + {"minussquareo", fa::minussquareo}, + {"mixcloud", fa::mixcloud}, + {"mobile", fa::mobile}, + {"mobilephone", fa::mobilephone}, + {"modx", fa::modx}, + {"money", fa::money}, + {"moono", fa::moono}, + {"mortarboard", fa::mortarboard}, + {"motorcycle", fa::motorcycle}, + {"mousepointer", fa::mousepointer}, + {"music", fa::music}, + {"navicon", fa::navicon}, + {"neuter", fa::neuter}, + {"newspapero", fa::newspapero}, + {"objectgroup", fa::objectgroup}, + {"objectungroup", fa::objectungroup}, + {"odnoklassniki", fa::odnoklassniki}, + {"odnoklassnikisquare", fa::odnoklassnikisquare}, + {"opencart", fa::opencart}, + {"openid", fa::openid}, + {"opera", fa::opera}, + {"optinmonster", fa::optinmonster}, + {"outdent", fa::outdent}, + {"pagelines", fa::pagelines}, + {"paintbrush", fa::paintbrush}, + {"paperplane", fa::paperplane}, + {"paperplaneo", fa::paperplaneo}, + {"paperclip", fa::paperclip}, + {"paragraph", fa::paragraph}, + {"paste", fa::paste}, + {"pause", fa::pause}, + {"pausecircle", fa::pausecircle}, + {"pausecircleo", fa::pausecircleo}, + {"paw", fa::paw}, + {"paypal", fa::paypal}, + {"pencil", fa::pencil}, + {"pencilsquare", fa::pencilsquare}, + {"pencilsquareo", fa::pencilsquareo}, + {"percent", fa::percent}, + {"phone", fa::phone}, + {"phonesquare", fa::phonesquare}, + {"photo", fa::photo}, + {"pictureo", fa::pictureo}, + {"piechart", fa::piechart}, + {"piedpiper", fa::piedpiper}, + {"piedpiperalt", fa::piedpiperalt}, + {"piedpiperpp", fa::piedpiperpp}, + {"pinterest", fa::pinterest}, + {"pinterestp", fa::pinterestp}, + {"pinterestsquare", fa::pinterestsquare}, + {"plane", fa::plane}, + {"play", fa::play}, + {"playcircle", fa::playcircle}, + {"playcircleo", fa::playcircleo}, + {"plug", fa::plug}, + {"plus", fa::plus}, + {"pluscircle", fa::pluscircle}, + {"plussquare", fa::plussquare}, + {"plussquareo", fa::plussquareo}, + {"podcast", fa::podcast}, + {"poweroff", fa::poweroff}, + {"print", fa::print}, + {"producthunt", fa::producthunt}, + {"puzzlepiece", fa::puzzlepiece}, + {"qq", fa::qq}, + {"qrcode", fa::qrcode}, + {"question", fa::question}, + {"questioncircle", fa::questioncircle}, + {"questioncircleo", fa::questioncircleo}, + {"quora", fa::quora}, + {"quoteleft", fa::quoteleft}, + {"quoteright", fa::quoteright}, + {"ra", fa::ra}, + {"random", fa::random}, + {"ravelry", fa::ravelry}, + {"rebel", fa::rebel}, + {"recycle", fa::recycle}, + {"reddit", fa::reddit}, + {"redditalien", fa::redditalien}, + {"redditsquare", fa::redditsquare}, + {"refresh", fa::refresh}, + {"registered", fa::registered}, + {"remove", fa::remove}, + {"renren", fa::renren}, + {"reorder", fa::reorder}, + {"repeat", fa::repeat}, + {"reply", fa::reply}, + {"replyall", fa::replyall}, + {"resistance", fa::resistance}, + {"retweet", fa::retweet}, + {"rmb", fa::rmb}, + {"road", fa::road}, + {"rocket", fa::rocket}, + {"rotateleft", fa::rotateleft}, + {"rotateright", fa::rotateright}, + {"rouble", fa::rouble}, + {"rss", fa::rss}, + {"rsssquare", fa::rsssquare}, + {"rub", fa::rub}, + {"ruble", fa::ruble}, + {"rupee", fa::rupee}, + {"s15", fa::s15}, + {"safari", fa::safari}, + {"save", fa::save}, + {"scissors", fa::scissors}, + {"scribd", fa::scribd}, + {"search", fa::search}, + {"searchminus", fa::searchminus}, + {"searchplus", fa::searchplus}, + {"sellsy", fa::sellsy}, + {"send", fa::send}, + {"sendo", fa::sendo}, + {"server", fa::server}, + {"share", fa::share}, + {"sharealt", fa::sharealt}, + {"sharealtsquare", fa::sharealtsquare}, + {"sharesquare", fa::sharesquare}, + {"sharesquareo", fa::sharesquareo}, + {"shekel", fa::shekel}, + {"sheqel", fa::sheqel}, + {"shield", fa::shield}, + {"ship", fa::ship}, + {"shirtsinbulk", fa::shirtsinbulk}, + {"shoppingbag", fa::shoppingbag}, + {"shoppingbasket", fa::shoppingbasket}, + {"shoppingcart", fa::shoppingcart}, + {"shower", fa::shower}, + {"signin", fa::signin}, + {"signlanguage", fa::signlanguage}, + {"signout", fa::signout}, + {"signal", fa::signal}, + {"signing", fa::signing}, + {"simplybuilt", fa::simplybuilt}, + {"sitemap", fa::sitemap}, + {"skyatlas", fa::skyatlas}, + {"skype", fa::skype}, + {"slack", fa::slack}, + {"sliders", fa::sliders}, + {"slideshare", fa::slideshare}, + {"smileo", fa::smileo}, + {"snapchat", fa::snapchat}, + {"snapchatghost", fa::snapchatghost}, + {"snapchatsquare", fa::snapchatsquare}, + {"snowflakeo", fa::snowflakeo}, + {"soccerballo", fa::soccerballo}, + {"sort", fa::sort}, + {"sortalphaasc", fa::sortalphaasc}, + {"sortalphadesc", fa::sortalphadesc}, + {"sortamountasc", fa::sortamountasc}, + {"sortamountdesc", fa::sortamountdesc}, + {"sortasc", fa::sortasc}, + {"sortdesc", fa::sortdesc}, + {"sortdown", fa::sortdown}, + {"sortnumericasc", fa::sortnumericasc}, + {"sortnumericdesc", fa::sortnumericdesc}, + {"sortup", fa::sortup}, + {"soundcloud", fa::soundcloud}, + {"spaceshuttle", fa::spaceshuttle}, + {"spinner", fa::spinner}, + {"spoon", fa::spoon}, + {"spotify", fa::spotify}, + {"square", fa::square}, + {"squareo", fa::squareo}, + {"stackexchange", fa::stackexchange}, + {"stackoverflow", fa::stackoverflow}, + {"star", fa::star}, + {"starhalf", fa::starhalf}, + {"starhalfempty", fa::starhalfempty}, + {"starhalffull", fa::starhalffull}, + {"starhalfo", fa::starhalfo}, + {"staro", fa::staro}, + {"steam", fa::steam}, + {"steamsquare", fa::steamsquare}, + {"stepbackward", fa::stepbackward}, + {"stepforward", fa::stepforward}, + {"stethoscope", fa::stethoscope}, + {"stickynote", fa::stickynote}, + {"stickynoteo", fa::stickynoteo}, + {"stop", fa::stop}, + {"stopcircle", fa::stopcircle}, + {"stopcircleo", fa::stopcircleo}, + {"streetview", fa::streetview}, + {"strikethrough", fa::strikethrough}, + {"stumbleupon", fa::stumbleupon}, + {"stumbleuponcircle", fa::stumbleuponcircle}, + {"subscript", fa::subscript}, + {"subway", fa::subway}, + {"suitcase", fa::suitcase}, + {"suno", fa::suno}, + {"superpowers", fa::superpowers}, + {"superscript", fa::superscript}, + {"support", fa::support}, + {"table", fa::table}, + {"tablet", fa::tablet}, + {"tachometer", fa::tachometer}, + {"tag", fa::tag}, + {"tags", fa::tags}, + {"tasks", fa::tasks}, + {"taxi", fa::taxi}, + {"telegram", fa::telegram}, + {"television", fa::television}, + {"tencentweibo", fa::tencentweibo}, + {"terminal", fa::terminal}, + {"textheight", fa::textheight}, + {"textwidth", fa::textwidth}, + {"th", fa::th}, + {"thlarge", fa::thlarge}, + {"thlist", fa::thlist}, + {"themeisle", fa::themeisle}, + {"thermometer", fa::thermometer}, + {"thermometer0", fa::thermometer0}, + {"thermometer1", fa::thermometer1}, + {"thermometer2", fa::thermometer2}, + {"thermometer3", fa::thermometer3}, + {"thermometer4", fa::thermometer4}, + {"thermometerempty", fa::thermometerempty}, + {"thermometerfull", fa::thermometerfull}, + {"thermometerhalf", fa::thermometerhalf}, + {"thermometerquarter", fa::thermometerquarter}, + {"thermometerthreequarters", fa::thermometerthreequarters}, + {"thumbtack", fa::thumbtack}, + {"thumbsdown", fa::thumbsdown}, + {"thumbsodown", fa::thumbsodown}, + {"thumbsoup", fa::thumbsoup}, + {"thumbsup", fa::thumbsup}, + {"ticket", fa::ticket}, + {"times", fa::times}, + {"timescircle", fa::timescircle}, + {"timescircleo", fa::timescircleo}, + {"timesrectangle", fa::timesrectangle}, + {"timesrectangleo", fa::timesrectangleo}, + {"tint", fa::tint}, + {"toggledown", fa::toggledown}, + {"toggleleft", fa::toggleleft}, + {"toggleoff", fa::toggleoff}, + {"toggleon", fa::toggleon}, + {"toggleright", fa::toggleright}, + {"toggleup", fa::toggleup}, + {"trademark", fa::trademark}, + {"train", fa::train}, + {"transgender", fa::transgender}, + {"transgenderalt", fa::transgenderalt}, + {"trash", fa::trash}, + {"trasho", fa::trasho}, + {"tree", fa::tree}, + {"trello", fa::trello}, + {"tripadvisor", fa::tripadvisor}, + {"trophy", fa::trophy}, + {"truck", fa::truck}, + {"fa_try", fa::fa_try}, + {"tty", fa::tty}, + {"tumblr", fa::tumblr}, + {"tumblrsquare", fa::tumblrsquare}, + {"turkishlira", fa::turkishlira}, + {"tv", fa::tv}, + {"twitch", fa::twitch}, + {"twitter", fa::twitter}, + {"twittersquare", fa::twittersquare}, + {"umbrella", fa::umbrella}, + {"underline", fa::underline}, + {"undo", fa::undo}, + {"universalaccess", fa::universalaccess}, + {"university", fa::university}, + {"unlink", fa::unlink}, + {"unlock", fa::unlock}, + {"unlockalt", fa::unlockalt}, + {"unsorted", fa::unsorted}, + {"upload", fa::upload}, + {"usb", fa::usb}, + {"usd", fa::usd}, + {"user", fa::user}, + {"usercircle", fa::usercircle}, + {"usercircleo", fa::usercircleo}, + {"usermd", fa::usermd}, + {"usero", fa::usero}, + {"userplus", fa::userplus}, + {"usersecret", fa::usersecret}, + {"usertimes", fa::usertimes}, + {"users", fa::users}, + {"vcard", fa::vcard}, + {"vcardo", fa::vcardo}, + {"venus", fa::venus}, + {"venusdouble", fa::venusdouble}, + {"venusmars", fa::venusmars}, + {"viacoin", fa::viacoin}, + {"viadeo", fa::viadeo}, + {"viadeosquare", fa::viadeosquare}, + {"videocamera", fa::videocamera}, + {"vimeo", fa::vimeo}, + {"vimeosquare", fa::vimeosquare}, + {"vine", fa::vine}, + {"vk", fa::vk}, + {"volumecontrolphone", fa::volumecontrolphone}, + {"volumedown", fa::volumedown}, + {"volumeoff", fa::volumeoff}, + {"volumeup", fa::volumeup}, + {"warning", fa::warning}, + {"wechat", fa::wechat}, + {"weibo", fa::weibo}, + {"weixin", fa::weixin}, + {"whatsapp", fa::whatsapp}, + {"wheelchair", fa::wheelchair}, + {"wheelchairalt", fa::wheelchairalt}, + {"wifi", fa::wifi}, + {"wikipediaw", fa::wikipediaw}, + {"windowclose", fa::windowclose}, + {"windowcloseo", fa::windowcloseo}, + {"windowmaximize", fa::windowmaximize}, + {"windowminimize", fa::windowminimize}, + {"windowrestore", fa::windowrestore}, + {"windows", fa::windows}, + {"won", fa::won}, + {"wordpress", fa::wordpress}, + {"wpbeginner", fa::wpbeginner}, + {"wpexplorer", fa::wpexplorer}, + {"wpforms", fa::wpforms}, + {"wrench", fa::wrench}, + {"xing", fa::xing}, + {"xingsquare", fa::xingsquare}, + {"ycombinator", fa::ycombinator}, + {"ycombinatorsquare", fa::ycombinatorsquare}, + {"yahoo", fa::yahoo}, + {"yc", fa::yc}, + {"ycsquare", fa::ycsquare}, + {"yelp", fa::yelp}, + {"yen", fa::yen}, + {"yoast", fa::yoast}, + {"youtube", fa::youtube}, + {"youtubeplay", fa::youtubeplay}, + {"youtubesquare", fa::youtubesquare}}; + +/// 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) { + // load the font file + QFile res(":/images/fontawesome-4.7.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_; + for (unsigned i = 0; i < sizeof(faNameIconArray) / sizeof(FANameIcon); ++i) { + m.insert(faNameIconArray[i].name, faNameIconArray[i].icon); + } + + 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); + if (!optionMap.contains("text")) optionMap.insert("text", QChar(character)); + if (!optionMap.contains("text-active")) optionMap.insert("text-active", QChar(character)); + if (!optionMap.contains("text-selected")) optionMap.insert("text-selected", QChar(character)); + if (!optionMap.contains("text-disabled")) optionMap.insert("text-disabled", QChar(character)); + if (!optionMap.contains("text-off")) optionMap.insert("text-off", QChar(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/openhantek/src/iconfont/QtAwesome.h b/openhantek/src/iconfont/QtAwesome.h new file mode 100644 index 0000000..30c3f68 --- /dev/null +++ b/openhantek/src/iconfont/QtAwesome.h @@ -0,0 +1,878 @@ +/** + * 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 "QtAwesomeAnim.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, + addressbook = 0xf2b9, + addressbooko = 0xf2ba, + addresscard = 0xf2bb, + addresscardo = 0xf2bc, + adjust = 0xf042, + adn = 0xf170, + aligncenter = 0xf037, + alignjustify = 0xf039, + alignleft = 0xf036, + alignright = 0xf038, + amazon = 0xf270, + ambulance = 0xf0f9, + americansignlanguageinterpreting = 0xf2a3, + 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, + aslinterpreting = 0xf2a3, + assistivelisteningsystems = 0xf2a2, + asterisk = 0xf069, + at = 0xf1fa, + audiodescription = 0xf29e, + automobile = 0xf1b9, + backward = 0xf04a, + balancescale = 0xf24e, + ban = 0xf05e, + bandcamp = 0xf2d5, + bank = 0xf19c, + barchart = 0xf080, + barcharto = 0xf080, + barcode = 0xf02a, + bars = 0xf0c9, + bath = 0xf2cd, + bathtub = 0xf2cd, + battery = 0xf240, + 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, + blind = 0xf29d, + bluetooth = 0xf293, + bluetoothb = 0xf294, + bold = 0xf032, + bolt = 0xf0e7, + bomb = 0xf1e2, + book = 0xf02d, + bookmark = 0xf02e, + bookmarko = 0xf097, + braille = 0xf2a1, + 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, + codiepie = 0xf284, + 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, + creditcardalt = 0xf283, + crop = 0xf125, + crosshairs = 0xf05b, + css3 = 0xf13c, + cube = 0xf1b2, + cubes = 0xf1b3, + cut = 0xf0c4, + cutlery = 0xf0f5, + dashboard = 0xf0e4, + dashcube = 0xf210, + database = 0xf1c0, + deaf = 0xf2a4, + deafness = 0xf2a4, + dedent = 0xf03b, + delicious = 0xf1a5, + desktop = 0xf108, + deviantart = 0xf1bd, + diamond = 0xf219, + digg = 0xf1a6, + dollar = 0xf155, + dotcircleo = 0xf192, + download = 0xf019, + dribbble = 0xf17d, + driverslicense = 0xf2c2, + driverslicenseo = 0xf2c3, + dropbox = 0xf16b, + drupal = 0xf1a9, + edge = 0xf282, + edit = 0xf044, + eercast = 0xf2da, + eject = 0xf052, + ellipsish = 0xf141, + ellipsisv = 0xf142, + empire = 0xf1d1, + envelope = 0xf0e0, + envelopeo = 0xf003, + envelopeopen = 0xf2b6, + envelopeopeno = 0xf2b7, + envelopesquare = 0xf199, + envira = 0xf299, + eraser = 0xf12d, + etsy = 0xf2d7, + 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, + fa = 0xf2b4, + 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, + firstorder = 0xf2b0, + flag = 0xf024, + flagcheckered = 0xf11e, + flago = 0xf11d, + flash = 0xf0e7, + flask = 0xf0c3, + flickr = 0xf16e, + floppyo = 0xf0c7, + folder = 0xf07b, + foldero = 0xf114, + folderopen = 0xf07c, + folderopeno = 0xf115, + font = 0xf031, + fontawesome = 0xf2b4, + fonticons = 0xf280, + fortawesome = 0xf286, + forumbee = 0xf211, + forward = 0xf04e, + foursquare = 0xf180, + freecodecamp = 0xf2c5, + 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, + gitlab = 0xf296, + gittip = 0xf184, + glass = 0xf000, + glide = 0xf2a5, + glideg = 0xf2a6, + globe = 0xf0ac, + google = 0xf1a0, + googleplus = 0xf0d5, + googlepluscircle = 0xf2b3, + googleplusofficial = 0xf2b3, + googleplussquare = 0xf0d4, + googlewallet = 0xf1ee, + graduationcap = 0xf19d, + gratipay = 0xf184, + grav = 0xf2d6, + 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, + handshakeo = 0xf2b5, + hardofhearing = 0xf2a4, + hashtag = 0xf292, + 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, + idbadge = 0xf2c1, + idcard = 0xf2c2, + idcardo = 0xf2c3, + ils = 0xf20b, + image = 0xf03e, + imdb = 0xf2d8, + 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, + linode = 0xf2b8, + fa_linux = 0xf17c, + list = 0xf03a, + listalt = 0xf022, + listol = 0xf0cb, + listul = 0xf0ca, + locationarrow = 0xf124, + lock = 0xf023, + longarrowdown = 0xf175, + longarrowleft = 0xf177, + longarrowright = 0xf178, + longarrowup = 0xf176, + lowvision = 0xf2a8, + 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, + meetup = 0xf2e0, + meho = 0xf11a, + mercury = 0xf223, + microchip = 0xf2db, + microphone = 0xf130, + microphoneslash = 0xf131, + minus = 0xf068, + minuscircle = 0xf056, + minussquare = 0xf146, + minussquareo = 0xf147, + mixcloud = 0xf289, + mobile = 0xf10b, + mobilephone = 0xf10b, + modx = 0xf285, + 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, + pausecircle = 0xf28b, + pausecircleo = 0xf28c, + paw = 0xf1b0, + paypal = 0xf1ed, + pencil = 0xf040, + pencilsquare = 0xf14b, + pencilsquareo = 0xf044, + percent = 0xf295, + phone = 0xf095, + phonesquare = 0xf098, + photo = 0xf03e, + pictureo = 0xf03e, + piechart = 0xf200, + piedpiper = 0xf2ae, + piedpiperalt = 0xf1a8, + piedpiperpp = 0xf1a7, + pinterest = 0xf0d2, + pinterestp = 0xf231, + pinterestsquare = 0xf0d3, + plane = 0xf072, + play = 0xf04b, + playcircle = 0xf144, + playcircleo = 0xf01d, + plug = 0xf1e6, + plus = 0xf067, + pluscircle = 0xf055, + plussquare = 0xf0fe, + plussquareo = 0xf196, + podcast = 0xf2ce, + poweroff = 0xf011, + print = 0xf02f, + producthunt = 0xf288, + puzzlepiece = 0xf12e, + qq = 0xf1d6, + qrcode = 0xf029, + question = 0xf128, + questioncircle = 0xf059, + questioncircleo = 0xf29c, + quora = 0xf2c4, + quoteleft = 0xf10d, + quoteright = 0xf10e, + ra = 0xf1d0, + random = 0xf074, + ravelry = 0xf2d9, + rebel = 0xf1d0, + recycle = 0xf1b8, + reddit = 0xf1a1, + redditalien = 0xf281, + redditsquare = 0xf1a2, + refresh = 0xf021, + registered = 0xf25d, + remove = 0xf00d, + renren = 0xf18b, + reorder = 0xf0c9, + repeat = 0xf01e, + reply = 0xf112, + replyall = 0xf122, + resistance = 0xf1d0, + retweet = 0xf079, + rmb = 0xf157, + road = 0xf018, + rocket = 0xf135, + rotateleft = 0xf0e2, + rotateright = 0xf01e, + rouble = 0xf158, + rss = 0xf09e, + rsssquare = 0xf143, + rub = 0xf158, + ruble = 0xf158, + rupee = 0xf156, + s15 = 0xf2cd, + safari = 0xf267, + save = 0xf0c7, + scissors = 0xf0c4, + scribd = 0xf28a, + 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, + shoppingbag = 0xf290, + shoppingbasket = 0xf291, + shoppingcart = 0xf07a, + shower = 0xf2cc, + signin = 0xf090, + signlanguage = 0xf2a7, + signout = 0xf08b, + signal = 0xf012, + signing = 0xf2a7, + simplybuilt = 0xf215, + sitemap = 0xf0e8, + skyatlas = 0xf216, + skype = 0xf17e, + slack = 0xf198, + sliders = 0xf1de, + slideshare = 0xf1e7, + smileo = 0xf118, + snapchat = 0xf2ab, + snapchatghost = 0xf2ac, + snapchatsquare = 0xf2ad, + snowflakeo = 0xf2dc, + 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, + stopcircle = 0xf28d, + stopcircleo = 0xf28e, + streetview = 0xf21d, + strikethrough = 0xf0cc, + stumbleupon = 0xf1a4, + stumbleuponcircle = 0xf1a3, + subscript = 0xf12c, + subway = 0xf239, + suitcase = 0xf0f2, + suno = 0xf185, + superpowers = 0xf2dd, + superscript = 0xf12b, + support = 0xf1cd, + table = 0xf0ce, + tablet = 0xf10a, + tachometer = 0xf0e4, + tag = 0xf02b, + tags = 0xf02c, + tasks = 0xf0ae, + taxi = 0xf1ba, + telegram = 0xf2c6, + television = 0xf26c, + tencentweibo = 0xf1d5, + terminal = 0xf120, + textheight = 0xf034, + textwidth = 0xf035, + th = 0xf00a, + thlarge = 0xf009, + thlist = 0xf00b, + themeisle = 0xf2b2, + thermometer = 0xf2c7, + thermometer0 = 0xf2cb, + thermometer1 = 0xf2ca, + thermometer2 = 0xf2c9, + thermometer3 = 0xf2c8, + thermometer4 = 0xf2c7, + thermometerempty = 0xf2cb, + thermometerfull = 0xf2c7, + thermometerhalf = 0xf2c9, + thermometerquarter = 0xf2ca, + thermometerthreequarters = 0xf2c8, + thumbtack = 0xf08d, + thumbsdown = 0xf165, + thumbsodown = 0xf088, + thumbsoup = 0xf087, + thumbsup = 0xf164, + ticket = 0xf145, + times = 0xf00d, + timescircle = 0xf057, + timescircleo = 0xf05c, + timesrectangle = 0xf2d3, + timesrectangleo = 0xf2d4, + 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, + universalaccess = 0xf29a, + university = 0xf19c, + unlink = 0xf127, + unlock = 0xf09c, + unlockalt = 0xf13e, + unsorted = 0xf0dc, + upload = 0xf093, + usb = 0xf287, + usd = 0xf155, + user = 0xf007, + usercircle = 0xf2bd, + usercircleo = 0xf2be, + usermd = 0xf0f0, + usero = 0xf2c0, + userplus = 0xf234, + usersecret = 0xf21b, + usertimes = 0xf235, + users = 0xf0c0, + vcard = 0xf2bb, + vcardo = 0xf2bc, + venus = 0xf221, + venusdouble = 0xf226, + venusmars = 0xf228, + viacoin = 0xf237, + viadeo = 0xf2a9, + viadeosquare = 0xf2aa, + videocamera = 0xf03d, + vimeo = 0xf27d, + vimeosquare = 0xf194, + vine = 0xf1ca, + vk = 0xf189, + volumecontrolphone = 0xf2a0, + volumedown = 0xf027, + volumeoff = 0xf026, + volumeup = 0xf028, + warning = 0xf071, + wechat = 0xf1d7, + weibo = 0xf18a, + weixin = 0xf1d7, + whatsapp = 0xf232, + wheelchair = 0xf193, + wheelchairalt = 0xf29b, + wifi = 0xf1eb, + wikipediaw = 0xf266, + windowclose = 0xf2d3, + windowcloseo = 0xf2d4, + windowmaximize = 0xf2d0, + windowminimize = 0xf2d1, + windowrestore = 0xf2d2, + windows = 0xf17a, + won = 0xf159, + wordpress = 0xf19a, + wpbeginner = 0xf297, + wpexplorer = 0xf2de, + wpforms = 0xf298, + wrench = 0xf0ad, + xing = 0xf168, + xingsquare = 0xf169, + ycombinator = 0xf23b, + ycombinatorsquare = 0xf1d4, + yahoo = 0xf19e, + yc = 0xf23b, + ycsquare = 0xf1d4, + yelp = 0xf1e9, + yen = 0xf157, + yoast = 0xf2b1, + 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: + + explicit 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; +}; + +Q_DECLARE_METATYPE(QtAwesomeAnimation*) + +extern QtAwesome* iconFont; + +#endif // QTAWESOME_H diff --git a/openhantek/src/iconfont/QtAwesomeAnim.cpp b/openhantek/src/iconfont/QtAwesomeAnim.cpp new file mode 100644 index 0000000..733df51 --- /dev/null +++ b/openhantek/src/iconfont/QtAwesomeAnim.cpp @@ -0,0 +1,34 @@ +#include "QtAwesomeAnim.h" + +#include +#include +#include +#include +#include + +QtAwesomeAnimation::QtAwesomeAnimation(QWidget *parentWidget, int interval, double step) + : parentWidgetRef_(parentWidget), timer_(0), interval_(interval), step_(step), angle_(0.0f) {} + +void QtAwesomeAnimation::setup(QPainter &painter, const QRect &rect) { + // first time set the timer + if (!timer_) { + timer_ = new QTimer(); + connect(timer_, SIGNAL(timeout()), this, SLOT(update())); + timer_->start(interval_); + } else { + QPen pen = painter.pen(); + pen.setWidth(2); + pen.setColor(QColor(Qt::gray)); + painter.setPen(pen); + double val = 1 + sin(angle_) / 2; + if (val >= 0.5) + painter.drawArc(rect, 0 * 16, 16 * (360 - (val - 0.5) * 2 * 360)); + else + painter.drawArc(rect, 0 * 16, 16 * (val * 2) * 360); + } +} + +void QtAwesomeAnimation::update() { + angle_ += step_; + parentWidgetRef_->update(); +} diff --git a/openhantek/src/iconfont/QtAwesomeAnim.h b/openhantek/src/iconfont/QtAwesomeAnim.h new file mode 100644 index 0000000..5192fc8 --- /dev/null +++ b/openhantek/src/iconfont/QtAwesomeAnim.h @@ -0,0 +1,36 @@ +#ifndef QTAWESOMEANIMATION_H +#define QTAWESOMEANIMATION_H + +#include + +class QPainter; +class QRect; +class QTimer; +class QWidget; + +/// +/// Basic Animation Support for QtAwesome (Inspired by https://github.com/spyder-ide/qtawesome) +/// +class QtAwesomeAnimation : public QObject +{ +Q_OBJECT + +public: + QtAwesomeAnimation( QWidget* parentWidget, int interval=20, double step=0.01); + + void setup( QPainter& painter, const QRect& rect ); + +public slots: + void update(); + +private: + QWidget* parentWidgetRef_; + QTimer* timer_; + int interval_; + double step_; + double angle_; + +}; + + +#endif // QTAWESOMEANIMATION_H diff --git a/openhantek/src/mainwindow.cpp b/openhantek/src/mainwindow.cpp index 0049e67..3c277a4 100644 --- a/openhantek/src/mainwindow.cpp +++ b/openhantek/src/mainwindow.cpp @@ -1,4 +1,5 @@ #include "mainwindow.h" +#include "iconfont/QtAwesome.h" #include "ui_mainwindow.h" #include "HorizontalDock.h" @@ -11,6 +12,8 @@ #include "dockwindows.h" #include "dsomodel.h" #include "dsowidget.h" +#include "exporting/exporterinterface.h" +#include "exporting/exporterregistry.h" #include "hantekdsocontrol.h" #include "usb/usbdevice.h" #include "viewconstants.h" @@ -21,20 +24,43 @@ #include #include -MainWindow::MainWindow(HantekDsoControl *dsoControl, DsoSettings *settings, QWidget *parent) - : QMainWindow(parent), ui(new Ui::MainWindow), mSettings(settings) { +MainWindow::MainWindow(HantekDsoControl *dsoControl, DsoSettings *settings, ExporterRegistry *exporterRegistry, + QWidget *parent) + : QMainWindow(parent), ui(new Ui::MainWindow), mSettings(settings), exporterRegistry(exporterRegistry) { ui->setupUi(this); + ui->actionSave->setIcon(iconFont->icon(fa::save)); + ui->actionAbout->setIcon(iconFont->icon(fa::questioncircle)); + ui->actionOpen->setIcon(iconFont->icon(fa::folderopen)); + ui->actionSampling->setIcon(iconFont->icon(fa::pause, + {std::make_pair("text-selected-off", QChar(fa::play)), + std::make_pair("text-off", QChar(fa::play)), + std::make_pair("text-active-off", QChar(fa::play))})); + ui->actionSettings->setIcon(iconFont->icon(fa::gear)); + ui->actionManualCommand->setIcon(iconFont->icon(fa::edit)); + ui->actionDigital_phosphor->setIcon(QIcon(":/images/digitalphosphor.svg")); + ui->actionZoom->setIcon(iconFont->icon(fa::crop)); // Window title setWindowIcon(QIcon(":openhantek.png")); - setWindowTitle(tr("OpenHantek - Device %1 - Renderer %2") - .arg(QString::fromStdString(dsoControl->getDevice()->getModel()->name)) - .arg(QSurfaceFormat::defaultFormat().renderableType()==QSurfaceFormat::OpenGL?"OpenGL":"OpenGL ES")); + setWindowTitle( + tr("OpenHantek - Device %1 - Renderer %2") + .arg(QString::fromStdString(dsoControl->getDevice()->getModel()->name)) + .arg(QSurfaceFormat::defaultFormat().renderableType() == QSurfaceFormat::OpenGL ? "OpenGL" : "OpenGL ES")); #if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) setDockOptions(dockOptions() | QMainWindow::GroupedDragging); #endif + for (auto *exporter : *exporterRegistry) { + QAction *action = new QAction(exporter->icon(), exporter->name(), this); + action->setCheckable(exporter->type() == ExporterInterface::Type::ContinousExport); + connect(action, &QAction::triggered, [exporter, exporterRegistry](bool checked) { + exporterRegistry->setExporterEnabled( + exporter, exporter->type() == ExporterInterface::Type::ContinousExport ? checked : true); + }); + ui->menuExport->addAction(action); + } + DsoSettingsScope *scope = &(mSettings->scope); const Dso::ControlSpecification *spec = dsoControl->getDevice()->getModel()->spec(); @@ -166,22 +192,19 @@ MainWindow::MainWindow(HantekDsoControl *dsoControl, DsoSettings *settings, QWid connect(spectrumDock, &SpectrumDock::magnitudeChanged, dsoWidget, &DsoWidget::updateSpectrumMagnitude); // Started/stopped signals from oscilloscope - connect(dsoControl, &HantekDsoControl::samplingStarted, [this, dsoControl]() { - this->ui->actionSampling->setText(tr("&Stop")); - this->ui->actionSampling->setIcon(QIcon(":actions/stop.png")); - this->ui->actionSampling->setStatusTip(tr("Stop the oscilloscope")); - - disconnect(this->ui->actionSampling, &QAction::triggered, dsoControl, &HantekDsoControl::startSampling); - connect(this->ui->actionSampling, &QAction::triggered, dsoControl, &HantekDsoControl::stopSampling); - }); - connect(dsoControl, &HantekDsoControl::samplingStopped, [this, dsoControl]() { - this->ui->actionSampling->setText(tr("&Start")); - this->ui->actionSampling->setIcon(QIcon(":actions/start.png")); - this->ui->actionSampling->setStatusTip(tr("Start the oscilloscope")); - - disconnect(this->ui->actionSampling, &QAction::triggered, dsoControl, &HantekDsoControl::stopSampling); - connect(this->ui->actionSampling, &QAction::triggered, dsoControl, &HantekDsoControl::startSampling); + connect(dsoControl, &HantekDsoControl::samplingStatusChanged, [this, dsoControl](bool enabled) { + QSignalBlocker blocker(this->ui->actionSampling); + if (enabled) { + this->ui->actionSampling->setText(tr("&Stop")); + this->ui->actionSampling->setStatusTip(tr("Stop the oscilloscope")); + } else { + this->ui->actionSampling->setText(tr("&Start")); + this->ui->actionSampling->setStatusTip(tr("Start the oscilloscope")); + } + this->ui->actionSampling->setChecked(enabled); }); + connect(this->ui->actionSampling, &QAction::triggered, dsoControl, &HantekDsoControl::enableSampling); + this->ui->actionSampling->setChecked(dsoControl->isSampling()); connect(dsoControl, &HantekDsoControl::availableRecordLengthsChanged, horizontalDock, &HorizontalDock::setAvailableRecordLengths); @@ -211,16 +234,6 @@ MainWindow::MainWindow(HantekDsoControl *dsoControl, DsoSettings *settings, QWid mSettings->save(); }); - connect(ui->actionPrint, &QAction::triggered, [this, spec]() { - this->dsoWidget->setExporterForNextFrame( - std::unique_ptr(Exporter::createPrintExporter(spec, this->mSettings))); - }); - - connect(ui->actionExport, &QAction::triggered, [this, spec]() { - this->dsoWidget->setExporterForNextFrame( - std::unique_ptr(Exporter::createSaveToFileExporter(spec, this->mSettings))); - }); - connect(ui->actionExit, &QAction::triggered, this, &QWidget::close); connect(ui->actionSettings, &QAction::triggered, [this]() { @@ -280,6 +293,12 @@ MainWindow::~MainWindow() { delete ui; } void MainWindow::showNewData(std::shared_ptr data) { dsoWidget->showNew(data); } +void MainWindow::exporterStatusChanged(const QString &exporterName, const QString &status) { + ui->statusbar->showMessage(tr("%1: %2").arg(exporterName).arg(status)); +} + +void MainWindow::exporterProgressChanged() { exporterRegistry->checkForWaitingExporters(); } + /// \brief Save the settings before exiting. /// \param event The close event that should be handled. void MainWindow::closeEvent(QCloseEvent *event) { diff --git a/openhantek/src/mainwindow.h b/openhantek/src/mainwindow.h index 5aecd02..d17b7ab 100644 --- a/openhantek/src/mainwindow.h +++ b/openhantek/src/mainwindow.h @@ -1,11 +1,12 @@ #pragma once +#include "post/ppresult.h" #include #include -#include "post/ppresult.h" class SpectrumGenerator; class HantekDsoControl; class DsoSettings; +class ExporterRegistry; class DsoWidget; class HorizontalDock; class TriggerDock; @@ -19,19 +20,22 @@ class MainWindow; /// \brief The main window of the application. /// The main window contains the classic oszilloscope-screen and the gui /// elements used to control the oszilloscope. -class MainWindow : public QMainWindow -{ +class MainWindow : public QMainWindow { Q_OBJECT -public: - explicit MainWindow(HantekDsoControl *dsoControl, DsoSettings *mSettings, QWidget *parent = 0); + public: + explicit MainWindow(HantekDsoControl *dsoControl, DsoSettings *mSettings, ExporterRegistry *exporterRegistry, + QWidget *parent = 0); ~MainWindow(); -public slots: + public slots: void showNewData(std::shared_ptr data); + void exporterStatusChanged(const QString &exporterName, const QString &status); + void exporterProgressChanged(); -protected: + protected: void closeEvent(QCloseEvent *event) override; -private: + + private: Ui::MainWindow *ui; // Central widgets @@ -39,4 +43,5 @@ private: // Settings used for the whole program DsoSettings *mSettings; + ExporterRegistry *exporterRegistry; }; diff --git a/openhantek/src/mainwindow.ui b/openhantek/src/mainwindow.ui index 2c9fab5..e9eb479 100644 --- a/openhantek/src/mainwindow.ui +++ b/openhantek/src/mainwindow.ui @@ -31,9 +31,6 @@ - - - @@ -58,7 +55,13 @@ + + + Export + + + @@ -76,73 +79,34 @@ - - - - + - - - :/actions/open.png:/actions/open.png - - Open + Open layout Ctrl+O - - - :/actions/save.png:/actions/save.png - - Save + Save layout Ctrl+S - - - :/actions/save-as.png:/actions/save-as.png - Save as ... - - - - :/actions/print.png:/actions/print.png - - - Print - - - Ctrl+P - - - - - - :/actions/export-as.png:/actions/export-as.png - - - Export as ... - - - Ctrl+E - - Exit @@ -152,10 +116,6 @@ true - - - :/actions/digitalphosphor.png:/actions/digitalphosphor.png - Digital phosphor @@ -164,10 +124,6 @@ true - - - :/actions/zoom.png:/actions/zoom.png - Zoom @@ -196,11 +152,6 @@ true - - - :/actions/stop.png - :/actions/start.png:/actions/stop.png - Sampling @@ -217,8 +168,6 @@ - - - +