diff --git a/CMakeLists.txt b/CMakeLists.txt index 519b159..20c16b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,13 +28,13 @@ set(QT_RES ${CMAKE_SOURCE_DIR}/resources/resources.qrc ${CMAKE_SOURCE_DIR}/gui/gui.qrc) +set(CMAKE_AUTOUIC_SEARCH_PATHS ${CMAKE_SOURCE_DIR}/ui/) + # Set Qt source files set(SRC ${QT_RES} src/papercards_qml.cpp - src/Backend.cpp - src/DocumentHandler.cpp - src/PdfHandler.cpp - src/model/Card.cpp) + src/mainwindow.cpp + src/sidepanel.cpp) # Copy version to source code add_definitions(-DMAJOR_VERSION=${PROJECT_VERSION_MAJOR}) diff --git a/Papercards.pro b/Papercards.pro index 5ae100e..7311e59 100644 --- a/Papercards.pro +++ b/Papercards.pro @@ -21,10 +21,14 @@ DEFINES += QT_DEPRECATED_WARNINGS # You can also select to disable deprecated APIs only up to a certain version of Qt. DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 -SOURCES += src/papercards_qml.cpp src/Backend.cpp src/DocumentHandler.cpp src/model/Card.cpp -HEADERS += src/Backend.h src/DocumentHandler.h src/model/Card.h +SOURCES += src/papercards_qml.cpp src/Backend.cpp src/DocumentHandler.cpp src/model/Card.cpp \ + src/mainwindow.cpp +HEADERS += src/Backend.h src/DocumentHandler.h src/model/Card.h \ + src/mainwindow.h \ + src/material_icons.h -RESOURCES += resources/resources.qrc gui/gui.qrc +RESOURCES += resources/resources.qrc gui/gui.qrc \ + ui/ui.qrc OTHER_FILES += gui/*.qml gui/components/*.qml @@ -39,3 +43,6 @@ QML_DESIGNER_IMPORT_PATH = qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target + +FORMS += \ + ui/mainwindow.ui diff --git a/Papercards.pro.qtds b/Papercards.pro.qtds new file mode 100644 index 0000000..1fa0e54 --- /dev/null +++ b/Papercards.pro.qtds @@ -0,0 +1,280 @@ + + + + + + EnvironmentId + {81b37160-b93f-423f-8322-a4aeadea61ae} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + *.md, *.MD, Makefile + false + true + + + + ProjectExplorer.Project.PluginSettings + + + + ProjectExplorer.Project.Target.0 + + Desktop + Desktop + Desktop + {8994bd34-5ed9-4c45-8c0a-94c8f33eca4a} + 0 + 0 + 0 + + true + 0 + /Users/simon/git/Github/build-Papercards-Desktop-Debug + /Users/simon/git/Github/build-Papercards-Desktop-Debug + + + true + QtProjectManager.QMakeBuildStep + + false + + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + 2 + 2 + + + true + 2 + /Users/simon/git/Github/build-Papercards-Desktop-Release + /Users/simon/git/Github/build-Papercards-Desktop-Release + + + true + QtProjectManager.QMakeBuildStep + + false + + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + 2 + + + true + 0 + /Users/simon/git/Github/build-Papercards-Desktop-Profile + /Users/simon/git/Github/build-Papercards-Desktop-Profile + + + true + QtProjectManager.QMakeBuildStep + + false + + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + 0 + + 3 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + false + false + 1000 + + true + + 2 + + + ProjectExplorer.CustomExecutableRunConfiguration + + + false + + false + true + false + false + true + + + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/frameworks/MacOSXBundleInfo.plist.in b/frameworks/MacOSXBundleInfo.plist.in index ac73fe2..e06e193 100644 --- a/frameworks/MacOSXBundleInfo.plist.in +++ b/frameworks/MacOSXBundleInfo.plist.in @@ -34,5 +34,7 @@ NSApplication NSSupportsAutomaticGraphicsSwitching + NSHighResolutionCapable + \ No newline at end of file diff --git a/gui/Test.qml b/gui/Test.qml new file mode 100644 index 0000000..339327c --- /dev/null +++ b/gui/Test.qml @@ -0,0 +1,38 @@ +import QtQuick 2.12 +import QtQuick.Layouts 1.12 +import QtQuick.Controls 2.12 + +ApplicationWindow { + + id: root + visible: true + title: "Papercards" + width: 800 + height: 600 + + ToolBar { + id: toolBar + height: 40 + position: ToolBar.Header + anchors.right: parent.right + anchors.rightMargin: 0 + anchors.left: parent.left + anchors.leftMargin: 0 + anchors.top: parent.top + anchors.topMargin: 0 + } + + Switch { + id: element + x: 228 + y: 310 + text: qsTr("Test") + } + +} + +/*##^## +Designer { + D{i:1;anchors_width:800;anchors_x:-6;anchors_y:0} +} +##^##*/ diff --git a/gui/gui.qrc b/gui/gui.qrc index 6c84c50..ed3c7b9 100644 --- a/gui/gui.qrc +++ b/gui/gui.qrc @@ -16,6 +16,7 @@ components/DefaultMenuBar.qml components/NativeMenuBar.qml DialogConfirmDiscard.qml + Test.qml qtquickcontrols2.conf diff --git a/gui/main.qml b/gui/main.qml index c699dfc..e9d3c2c 100644 --- a/gui/main.qml +++ b/gui/main.qml @@ -8,6 +8,7 @@ import io.papercards.backend 1.0 import "components" as Components ApplicationWindow { +// flags: Qt.FramelessWindowHint property real scaleFactor: statusBar.scaleFactor property var targetFunction property bool discard: false diff --git a/gui/qtquickcontrols2.conf b/gui/qtquickcontrols2.conf index 35507d2..5924471 100644 --- a/gui/qtquickcontrols2.conf +++ b/gui/qtquickcontrols2.conf @@ -1,5 +1,4 @@ [Controls] -Style=Material [Material] Theme=Dark diff --git a/resources/MaterialIcons-Regular.ttf b/resources/MaterialIcons-Regular.ttf deleted file mode 100644 index 377d924..0000000 Binary files a/resources/MaterialIcons-Regular.ttf and /dev/null differ diff --git a/resources/PapercardsIcons.ttf b/resources/PapercardsIcons.ttf deleted file mode 100644 index 2fbb085..0000000 Binary files a/resources/PapercardsIcons.ttf and /dev/null differ diff --git a/resources/WorkSans-Light.ttf b/resources/WorkSans-Light.ttf deleted file mode 100644 index 8b03227..0000000 Binary files a/resources/WorkSans-Light.ttf and /dev/null differ diff --git a/resources/WorkSans-Regular.ttf b/resources/WorkSans-Regular.ttf deleted file mode 100644 index ba11a2d..0000000 Binary files a/resources/WorkSans-Regular.ttf and /dev/null differ diff --git a/resources/feather.ttf b/resources/feather.ttf new file mode 100644 index 0000000..0b33dac Binary files /dev/null and b/resources/feather.ttf differ diff --git a/resources/logo.png b/resources/logo.png index d49f59a..22baf9c 100644 Binary files a/resources/logo.png and b/resources/logo.png differ diff --git a/resources/logo.psd b/resources/logo.psd new file mode 100644 index 0000000..a11aade Binary files /dev/null and b/resources/logo.psd differ diff --git a/resources/logo_old.png b/resources/logo_old.png new file mode 100644 index 0000000..d49f59a Binary files /dev/null and b/resources/logo_old.png differ diff --git a/resources/resources.qrc b/resources/resources.qrc index 6531bdd..6522cae 100644 --- a/resources/resources.qrc +++ b/resources/resources.qrc @@ -1,21 +1,7 @@ - WorkSans-Light.ttf - WorkSans-Regular.ttf - MaterialIcons-Regular.ttf default_deck.json logo.png - roboto/Roboto-Black.ttf - roboto/Roboto-BlackItalic.ttf - roboto/Roboto-Bold.ttf - roboto/Roboto-BoldItalic.ttf - roboto/Roboto-Italic.ttf - roboto/Roboto-Light.ttf - roboto/Roboto-LightItalic.ttf - roboto/Roboto-Medium.ttf - roboto/Roboto-MediumItalic.ttf - roboto/Roboto-Regular.ttf - roboto/Roboto-Thin.ttf - roboto/Roboto-ThinItalic.ttf + feather.ttf diff --git a/resources/roboto/Roboto-Black.ttf b/resources/roboto/Roboto-Black.ttf deleted file mode 100644 index 2d45238..0000000 Binary files a/resources/roboto/Roboto-Black.ttf and /dev/null differ diff --git a/resources/roboto/Roboto-BlackItalic.ttf b/resources/roboto/Roboto-BlackItalic.ttf deleted file mode 100644 index 29a4359..0000000 Binary files a/resources/roboto/Roboto-BlackItalic.ttf and /dev/null differ diff --git a/resources/roboto/Roboto-Bold.ttf b/resources/roboto/Roboto-Bold.ttf deleted file mode 100644 index d998cf5..0000000 Binary files a/resources/roboto/Roboto-Bold.ttf and /dev/null differ diff --git a/resources/roboto/Roboto-BoldItalic.ttf b/resources/roboto/Roboto-BoldItalic.ttf deleted file mode 100644 index b4e2210..0000000 Binary files a/resources/roboto/Roboto-BoldItalic.ttf and /dev/null differ diff --git a/resources/roboto/Roboto-Italic.ttf b/resources/roboto/Roboto-Italic.ttf deleted file mode 100644 index 5b390ff..0000000 Binary files a/resources/roboto/Roboto-Italic.ttf and /dev/null differ diff --git a/resources/roboto/Roboto-Light.ttf b/resources/roboto/Roboto-Light.ttf deleted file mode 100644 index 3526798..0000000 Binary files a/resources/roboto/Roboto-Light.ttf and /dev/null differ diff --git a/resources/roboto/Roboto-LightItalic.ttf b/resources/roboto/Roboto-LightItalic.ttf deleted file mode 100644 index 46e9bf7..0000000 Binary files a/resources/roboto/Roboto-LightItalic.ttf and /dev/null differ diff --git a/resources/roboto/Roboto-Medium.ttf b/resources/roboto/Roboto-Medium.ttf deleted file mode 100644 index f714a51..0000000 Binary files a/resources/roboto/Roboto-Medium.ttf and /dev/null differ diff --git a/resources/roboto/Roboto-MediumItalic.ttf b/resources/roboto/Roboto-MediumItalic.ttf deleted file mode 100644 index 5dc6a2d..0000000 Binary files a/resources/roboto/Roboto-MediumItalic.ttf and /dev/null differ diff --git a/resources/roboto/Roboto-Regular.ttf b/resources/roboto/Roboto-Regular.ttf deleted file mode 100644 index 2b6392f..0000000 Binary files a/resources/roboto/Roboto-Regular.ttf and /dev/null differ diff --git a/resources/roboto/Roboto-Thin.ttf b/resources/roboto/Roboto-Thin.ttf deleted file mode 100644 index 4e797cf..0000000 Binary files a/resources/roboto/Roboto-Thin.ttf and /dev/null differ diff --git a/resources/roboto/Roboto-ThinItalic.ttf b/resources/roboto/Roboto-ThinItalic.ttf deleted file mode 100644 index eea836f..0000000 Binary files a/resources/roboto/Roboto-ThinItalic.ttf and /dev/null differ diff --git a/resources/underline-solid.svg b/resources/underline-solid.svg new file mode 100755 index 0000000..6f3cc98 --- /dev/null +++ b/resources/underline-solid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp new file mode 100644 index 0000000..0019809 --- /dev/null +++ b/src/MainWindow.cpp @@ -0,0 +1,13 @@ +#include "MainWindow.h" +#include "ui_mainwindow.h" + +#include + +MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::mainWindow) { + ui->setupUi(this); + setUnifiedTitleAndToolBarOnMac(true); +} + +MainWindow::~MainWindow() { + delete ui; +} diff --git a/src/MainWindow.h b/src/MainWindow.h new file mode 100644 index 0000000..e579c91 --- /dev/null +++ b/src/MainWindow.h @@ -0,0 +1,20 @@ +#ifndef MAIN_WINDOW_H +#define MAIN_WINDOW_H + +#include + +namespace Ui { + class mainWindow; +} + +class MainWindow : public QMainWindow { + Q_OBJECT +private: + Ui::mainWindow *ui; + +public: + explicit MainWindow(QWidget *parent = nullptr); + ~MainWindow() override; +}; + +#endif // MAIN_WINDOW_H diff --git a/src/SidePanel.cpp b/src/SidePanel.cpp new file mode 100644 index 0000000..98d19db --- /dev/null +++ b/src/SidePanel.cpp @@ -0,0 +1,12 @@ +#include "SidePanel.h" +#include "ui_sidepanel.h" + +#include + +SidePanel::SidePanel(QWidget *parent) : QWidget(parent), ui(new Ui::sidePanel) { + ui->setupUi(this); +} + +SidePanel::~SidePanel() { + delete ui; +} diff --git a/src/SidePanel.h b/src/SidePanel.h new file mode 100644 index 0000000..c4fec65 --- /dev/null +++ b/src/SidePanel.h @@ -0,0 +1,20 @@ +#ifndef SIDE_PANEL_H +#define SIDE_PANEL_H + +#include "QWidget" + +namespace Ui { +class sidePanel; +} + +class SidePanel : public QWidget { + Q_OBJECT + private: + Ui::sidePanel *ui; + + public: + explicit SidePanel(QWidget *parent = nullptr); + ~SidePanel() override; +}; + +#endif //SIDE_PANEL_H diff --git a/src/Backend.cpp b/src/old/Backend.cpp similarity index 99% rename from src/Backend.cpp rename to src/old/Backend.cpp index 9e8e932..bdfbe49 100644 --- a/src/Backend.cpp +++ b/src/old/Backend.cpp @@ -268,7 +268,7 @@ void BackEnd::exportAsPdf(const QUrl &fileUrl) { QPdfWriter writer(filePath); writer.setCreator("Simon Schäfer"); writer.setPdfVersion(QPagedPaintDevice::PdfVersion_A1b); - writer.setResolution(130); + writer.setResolution(600); writer.setTitle("Tests Deck"); QPageSize page_size = QPageSize(QPageSize::A6); @@ -280,6 +280,7 @@ void BackEnd::exportAsPdf(const QUrl &fileUrl) { QPainter painter; painter.begin(&writer); + painter.scale(10,10); for (Card *card : this->cards_) { writer.newPage(); QTextDocument print_document; diff --git a/src/Backend.h b/src/old/Backend.h similarity index 100% rename from src/Backend.h rename to src/old/Backend.h diff --git a/src/CMakeLists.txt b/src/old/CMakeLists.txt similarity index 100% rename from src/CMakeLists.txt rename to src/old/CMakeLists.txt diff --git a/src/DocumentHandler.cpp b/src/old/DocumentHandler.cpp similarity index 100% rename from src/DocumentHandler.cpp rename to src/old/DocumentHandler.cpp diff --git a/src/DocumentHandler.h b/src/old/DocumentHandler.h similarity index 100% rename from src/DocumentHandler.h rename to src/old/DocumentHandler.h diff --git a/src/PdfHandler.cpp b/src/old/PdfHandler.cpp similarity index 100% rename from src/PdfHandler.cpp rename to src/old/PdfHandler.cpp diff --git a/src/PdfHandler.h b/src/old/PdfHandler.h similarity index 99% rename from src/PdfHandler.h rename to src/old/PdfHandler.h index ff2c67a..894f2ce 100644 --- a/src/PdfHandler.h +++ b/src/old/PdfHandler.h @@ -5,6 +5,7 @@ class PdfHandler : public QObject { + }; #endif //PDF_HANDLER_H diff --git a/src/old/QFontIcon.cpp b/src/old/QFontIcon.cpp new file mode 100644 index 0000000..c9de9c7 --- /dev/null +++ b/src/old/QFontIcon.cpp @@ -0,0 +1,176 @@ +/* +MIT License + +Copyright (c) 2017 Sacha Schutz + +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. +*/ + +#include "QFontIcon.h" +#include +#include +QFontIcon * QFontIcon::mInstance = Q_NULLPTR; + +bool QFontIcon::addFont(const QString &filename) +{ + int id = QFontDatabase::addApplicationFont(filename); + + if (id == -1){ + qWarning()<<"Cannot load font"; + return false; + } + + QString family = QFontDatabase::applicationFontFamilies(id).first(); + instance()->addFamily(family); + return true; +} + +QFontIcon *QFontIcon::instance() +{ + if (!mInstance) + mInstance = new QFontIcon; + + return mInstance; +} + +QIcon QFontIcon::icon(const QString &code, const QColor &baseColor, const QString &family) +{ + if (instance()->families().isEmpty()) + { + qWarning()<families().first(); + + + QFontIconEngine * engine = new QFontIconEngine; + engine->setFontFamily(useFamily); + engine->setLetter(code); + engine->setBaseColor(baseColor); + return QIcon(engine); + + +} + + +const QStringList &QFontIcon::families() const +{ + return mfamilies; +} + +void QFontIcon::addFamily(const QString &family) +{ + mfamilies.append(family); +} + +QFontIcon::QFontIcon(QObject *parent) + :QObject(parent) +{ + +} + +QFontIcon::~QFontIcon() +{ + +} + +//======================================================================================================= + + +QFontIconEngine::QFontIconEngine() + :QIconEngine() +{ + +} + +QFontIconEngine::~QFontIconEngine() +{ +} + +void QFontIconEngine::paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) +{ + Q_UNUSED(state); + QFont font = QFont(mFontFamily); + int drawSize = qRound(rect.height() * 0.8); + font.setPixelSize(28); + qDebug() << rect.height(); + font.setStyleStrategy(QFont::PreferAntialias); + + QColor penColor; + if (!mBaseColor.isValid()) + penColor = QApplication::palette("QWidget").color(QPalette::Normal,QPalette::ButtonText); + else + penColor = mBaseColor; + + if (mode == QIcon::Disabled) + penColor = QApplication::palette("QWidget").color(QPalette::Disabled,QPalette::ButtonText); + + + if (mode == QIcon::Selected) + penColor = QApplication::palette("QWidget").color(QPalette::Active,QPalette::ButtonText); + + painter->save(); + painter->setRenderHint(QPainter::Antialiasing); + painter->setRenderHint(QPainter::SmoothPixmapTransform); + painter->setRenderHint(QPainter::HighQualityAntialiasing); + painter->setRenderHint(QPainter::TextAntialiasing); + painter->setPen(QPen(penColor)); + painter->setFont(font); + painter->drawText(rect, Qt::AlignCenter|Qt::AlignVCenter, mLetter); + + painter->restore(); +} + +QPixmap QFontIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) +{ + QPixmap pix(size); + pix.fill(Qt::transparent); + + QPainter painter(&pix); + paint(&painter, QRect(QPoint(0,0),size), mode, state); + return pix; + +} + +void QFontIconEngine::setFontFamily(const QString &family) +{ + mFontFamily = family; +} + +void QFontIconEngine::setLetter(const QString &letter) +{ + mLetter = letter; +} + +void QFontIconEngine::setBaseColor(const QColor &baseColor) +{ + mBaseColor = baseColor; +} + + +QIconEngine *QFontIconEngine::clone() const +{ + QFontIconEngine * engine = new QFontIconEngine; + engine->setFontFamily(mFontFamily); + engine->setBaseColor(mBaseColor); + return engine; +} diff --git a/src/old/QFontIcon.h b/src/old/QFontIcon.h new file mode 100644 index 0000000..2eccd40 --- /dev/null +++ b/src/old/QFontIcon.h @@ -0,0 +1,85 @@ +/* +MIT License + +Copyright (c) 2017 Sacha Schutz + +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. +*/ + +#ifndef Q_FONT_ICON_H +#define Q_FONT_ICON_H + +#include +#include +#include +#include +#include +#include + +class QFontIcon; +class QFontIconEngine; +#define FIcon(code) QFontIcon::icon(code) + +class QFontIconEngine : public QIconEngine +{ + public: + QFontIconEngine(); + ~QFontIconEngine(); + virtual void paint(QPainter * painter, const QRect& rect, QIcon::Mode mode, QIcon::State state)Q_DECL_OVERRIDE ; + virtual QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state)Q_DECL_OVERRIDE; + void setFontFamily(const QString& family); + // define icon code using QChar or implicit using ushort ... + void setLetter(const QString& letter); + // You can set a base color. I don't advice. Keep system color + void setBaseColor(const QColor& baseColor); + virtual QIconEngine* clone() const; + + private: + QString mFontFamily; + QString mLetter; + QColor mBaseColor; +}; + +class QFontIcon : public QObject +{ + Q_OBJECT + + public: + // add Font. By default, the first one is used + static bool addFont(const QString& filename); + static QFontIcon * instance(); + // main methods. Return icons from code + static QIcon icon(const QString& code, const QColor& baseColor = QColor(),const QString& family = QString()); + // return added fonts + const QStringList& families() const; + + protected: + void addFamily(const QString& family); + + + private: + explicit QFontIcon(QObject *parent = 0); + ~QFontIcon(); + static QFontIcon * mInstance; + QStringList mfamilies; + + +}; + +#endif //Q_FONT_ICON_H diff --git a/src/old/material_icons.h b/src/old/material_icons.h new file mode 100644 index 0000000..e855a5a --- /dev/null +++ b/src/old/material_icons.h @@ -0,0 +1,963 @@ +#ifndef MATERIAL_ICONS_H +#define MATERIAL_ICONS_H + +#include +#include +#include + +class MaterialIcons { + private: + static const std::map icon_map_; + + public: + static std::map create_icon_map() { + return { + {"rotation_3d", "\ue84d"}, + {"ac_unit", "\ueb3b"}, + {"access_alarm", "\ue190"}, + {"access_alarms", "\ue191"}, + {"access_time", "\ue192"}, + {"accessibility", "\ue84e"}, + {"accessible", "\ue914"}, + {"account_balance", "\ue84f"}, + {"account_balance_wallet", "\ue850"}, + {"account_box", "\ue851"}, + {"account_circle", "\ue853"}, + {"adb", "\ue60e"}, + {"add", "\ue145"}, + {"add_a_photo", "\ue439"}, + {"add_alarm", "\ue193"}, + {"add_alert", "\ue003"}, + {"add_box", "\ue146"}, + {"add_circle", "\ue147"}, + {"add_circle_outline", "\ue148"}, + {"add_location", "\ue567"}, + {"add_shopping_cart", "\ue854"}, + {"add_to_photos", "\ue39d"}, + {"add_to_queue", "\ue05c"}, + {"adjust", "\ue39e"}, + {"airline_seat_flat", "\ue630"}, + {"airline_seat_flat_angled", "\ue631"}, + {"airline_seat_individual_suite", "\ue632"}, + {"airline_seat_legroom_extra", "\ue633"}, + {"airline_seat_legroom_normal", "\ue634"}, + {"airline_seat_legroom_reduced", "\ue635"}, + {"airline_seat_recline_extra", "\ue636"}, + {"airline_seat_recline_normal", "\ue637"}, + {"airplanemode_active", "\ue195"}, + {"airplanemode_inactive", "\ue194"}, + {"airplay", "\ue055"}, + {"airport_shuttle", "\ueb3c"}, + {"alarm", "\ue855"}, + {"alarm_add", "\ue856"}, + {"alarm_off", "\ue857"}, + {"alarm_on", "\ue858"}, + {"album", "\ue019"}, + {"all_inclusive", "\ueb3d"}, + {"all_out", "\ue90b"}, + {"android", "\ue859"}, + {"announcement", "\ue85a"}, + {"apps", "\ue5c3"}, + {"archive", "\ue149"}, + {"arrow_back", "\ue5c4"}, + {"arrow_downward", "\ue5db"}, + {"arrow_drop_down", "\ue5c5"}, + {"arrow_drop_down_circle", "\ue5c6"}, + {"arrow_drop_up", "\ue5c7"}, + {"arrow_forward", "\ue5c8"}, + {"arrow_upward", "\ue5d8"}, + {"art_track", "\ue060"}, + {"aspect_ratio", "\ue85b"}, + {"assessment", "\ue85c"}, + {"assignment", "\ue85d"}, + {"assignment_ind", "\ue85e"}, + {"assignment_late", "\ue85f"}, + {"assignment_return", "\ue860"}, + {"assignment_returned", "\ue861"}, + {"assignment_turned_in", "\ue862"}, + {"assistant", "\ue39f"}, + {"assistant_photo", "\ue3a0"}, + {"attach_file", "\ue226"}, + {"attach_money", "\ue227"}, + {"attachment", "\ue2bc"}, + {"audiotrack", "\ue3a1"}, + {"autorenew", "\ue863"}, + {"av_timer", "\ue01b"}, + {"backspace", "\ue14a"}, + {"backup", "\ue864"}, + {"battery_alert", "\ue19c"}, + {"battery_charging_full", "\ue1a3"}, + {"battery_full", "\ue1a4"}, + {"battery_std", "\ue1a5"}, + {"battery_unknown", "\ue1a6"}, + {"beach_access", "\ueb3e"}, + {"beenhere", "\ue52d"}, + {"block", "\ue14b"}, + {"bluetooth", "\ue1a7"}, + {"bluetooth_audio", "\ue60f"}, + {"bluetooth_connected", "\ue1a8"}, + {"bluetooth_disabled", "\ue1a9"}, + {"bluetooth_searching", "\ue1aa"}, + {"blur_circular", "\ue3a2"}, + {"blur_linear", "\ue3a3"}, + {"blur_off", "\ue3a4"}, + {"blur_on", "\ue3a5"}, + {"book", "\ue865"}, + {"bookmark", "\ue866"}, + {"bookmark_border", "\ue867"}, + {"border_all", "\ue228"}, + {"border_bottom", "\ue229"}, + {"border_clear", "\ue22a"}, + {"border_color", "\ue22b"}, + {"border_horizontal", "\ue22c"}, + {"border_inner", "\ue22d"}, + {"border_left", "\ue22e"}, + {"border_outer", "\ue22f"}, + {"border_right", "\ue230"}, + {"border_style", "\ue231"}, + {"border_top", "\ue232"}, + {"border_vertical", "\ue233"}, + {"branding_watermark", "\ue06b"}, + {"brightness_1", "\ue3a6"}, + {"brightness_2", "\ue3a7"}, + {"brightness_3", "\ue3a8"}, + {"brightness_4", "\ue3a9"}, + {"brightness_5", "\ue3aa"}, + {"brightness_6", "\ue3ab"}, + {"brightness_7", "\ue3ac"}, + {"brightness_auto", "\ue1ab"}, + {"brightness_high", "\ue1ac"}, + {"brightness_low", "\ue1ad"}, + {"brightness_medium", "\ue1ae"}, + {"broken_image", "\ue3ad"}, + {"brush", "\ue3ae"}, + {"bubble_chart", "\ue6dd"}, + {"bug_report", "\ue868"}, + {"build", "\ue869"}, + {"burst_mode", "\ue43c"}, + {"business", "\ue0af"}, + {"business_center", "\ueb3f"}, + {"cached", "\ue86a"}, + {"cake", "\ue7e9"}, + {"call", "\ue0b0"}, + {"call_end", "\ue0b1"}, + {"call_made", "\ue0b2"}, + {"call_merge", "\ue0b3"}, + {"call_missed", "\ue0b4"}, + {"call_missed_outgoing", "\ue0e4"}, + {"call_received", "\ue0b5"}, + {"call_split", "\ue0b6"}, + {"call_to_action", "\ue06c"}, + {"camera", "\ue3af"}, + {"camera_alt", "\ue3b0"}, + {"camera_enhance", "\ue8fc"}, + {"camera_front", "\ue3b1"}, + {"camera_rear", "\ue3b2"}, + {"camera_roll", "\ue3b3"}, + {"cancel", "\ue5c9"}, + {"card_giftcard", "\ue8f6"}, + {"card_membership", "\ue8f7"}, + {"card_travel", "\ue8f8"}, + {"casino", "\ueb40"}, + {"cast", "\ue307"}, + {"cast_connected", "\ue308"}, + {"center_focus_strong", "\ue3b4"}, + {"center_focus_weak", "\ue3b5"}, + {"change_history", "\ue86b"}, + {"chat", "\ue0b7"}, + {"chat_bubble", "\ue0ca"}, + {"chat_bubble_outline", "\ue0cb"}, + {"check", "\ue5ca"}, + {"check_box", "\ue834"}, + {"check_box_outline_blank", "\ue835"}, + {"check_circle", "\ue86c"}, + {"chevron_left", "\ue5cb"}, + {"chevron_right", "\ue5cc"}, + {"child_care", "\ueb41"}, + {"child_friendly", "\ueb42"}, + {"chrome_reader_mode", "\ue86d"}, + {"class", "\ue86e"}, + {"clear", "\ue14c"}, + {"clear_all", "\ue0b8"}, + {"close", "\ue5cd"}, + {"closed_caption", "\ue01c"}, + {"cloud", "\ue2bd"}, + {"cloud_circle", "\ue2be"}, + {"cloud_done", "\ue2bf"}, + {"cloud_download", "\ue2c0"}, + {"cloud_off", "\ue2c1"}, + {"cloud_queue", "\ue2c2"}, + {"cloud_upload", "\ue2c3"}, + {"code", "\ue86f"}, + {"collections", "\ue3b6"}, + {"collections_bookmark", "\ue431"}, + {"color_lens", "\ue3b7"}, + {"colorize", "\ue3b8"}, + {"comment", "\ue0b9"}, + {"compare", "\ue3b9"}, + {"compare_arrows", "\ue915"}, + {"computer", "\ue30a"}, + {"confirmation_number", "\ue638"}, + {"contact_mail", "\ue0d0"}, + {"contact_phone", "\ue0cf"}, + {"contacts", "\ue0ba"}, + {"content_copy", "\ue14d"}, + {"content_cut", "\ue14e"}, + {"content_paste", "\ue14f"}, + {"control_point", "\ue3ba"}, + {"control_point_duplicate", "\ue3bb"}, + {"copyright", "\ue90c"}, + {"create", "\ue150"}, + {"create_new_folder", "\ue2cc"}, + {"credit_card", "\ue870"}, + {"crop", "\ue3be"}, + {"crop_16_9", "\ue3bc"}, + {"crop_3_2", "\ue3bd"}, + {"crop_5_4", "\ue3bf"}, + {"crop_7_5", "\ue3c0"}, + {"crop_din", "\ue3c1"}, + {"crop_free", "\ue3c2"}, + {"crop_landscape", "\ue3c3"}, + {"crop_original", "\ue3c4"}, + {"crop_portrait", "\ue3c5"}, + {"crop_rotate", "\ue437"}, + {"crop_square", "\ue3c6"}, + {"dashboard", "\ue871"}, + {"data_usage", "\ue1af"}, + {"date_range", "\ue916"}, + {"dehaze", "\ue3c7"}, + {"delete", "\ue872"}, + {"delete_forever", "\ue92b"}, + {"delete_sweep", "\ue16c"}, + {"description", "\ue873"}, + {"desktop_mac", "\ue30b"}, + {"desktop_windows", "\ue30c"}, + {"details", "\ue3c8"}, + {"developer_board", "\ue30d"}, + {"developer_mode", "\ue1b0"}, + {"device_hub", "\ue335"}, + {"devices", "\ue1b1"}, + {"devices_other", "\ue337"}, + {"dialer_sip", "\ue0bb"}, + {"dialpad", "\ue0bc"}, + {"directions", "\ue52e"}, + {"directions_bike", "\ue52f"}, + {"directions_boat", "\ue532"}, + {"directions_bus", "\ue530"}, + {"directions_car", "\ue531"}, + {"directions_railway", "\ue534"}, + {"directions_run", "\ue566"}, + {"directions_subway", "\ue533"}, + {"directions_transit", "\ue535"}, + {"directions_walk", "\ue536"}, + {"disc_full", "\ue610"}, + {"dns", "\ue875"}, + {"do_not_disturb", "\ue612"}, + {"do_not_disturb_alt", "\ue611"}, + {"do_not_disturb_off", "\ue643"}, + {"do_not_disturb_on", "\ue644"}, + {"dock", "\ue30e"}, + {"domain", "\ue7ee"}, + {"done", "\ue876"}, + {"done_all", "\ue877"}, + {"donut_large", "\ue917"}, + {"donut_small", "\ue918"}, + {"drafts", "\ue151"}, + {"drag_handle", "\ue25d"}, + {"drive_eta", "\ue613"}, + {"dvr", "\ue1b2"}, + {"edit", "\ue3c9"}, + {"edit_location", "\ue568"}, + {"eject", "\ue8fb"}, + {"email", "\ue0be"}, + {"enhanced_encryption", "\ue63f"}, + {"equalizer", "\ue01d"}, + {"error", "\ue000"}, + {"error_outline", "\ue001"}, + {"euro_symbol", "\ue926"}, + {"ev_station", "\ue56d"}, + {"event", "\ue878"}, + {"event_available", "\ue614"}, + {"event_busy", "\ue615"}, + {"event_note", "\ue616"}, + {"event_seat", "\ue903"}, + {"exit_to_app", "\ue879"}, + {"expand_less", "\ue5ce"}, + {"expand_more", "\ue5cf"}, + {"explicit", "\ue01e"}, + {"explore", "\ue87a"}, + {"exposure", "\ue3ca"}, + {"exposure_neg_1", "\ue3cb"}, + {"exposure_neg_2", "\ue3cc"}, + {"exposure_plus_1", "\ue3cd"}, + {"exposure_plus_2", "\ue3ce"}, + {"exposure_zero", "\ue3cf"}, + {"extension", "\ue87b"}, + {"face", "\ue87c"}, + {"fast_forward", "\ue01f"}, + {"fast_rewind", "\ue020"}, + {"favorite", "\ue87d"}, + {"favorite_border", "\ue87e"}, + {"featured_play_list", "\ue06d"}, + {"featured_video", "\ue06e"}, + {"feedback", "\ue87f"}, + {"fiber_dvr", "\ue05d"}, + {"fiber_manual_record", "\ue061"}, + {"fiber_new", "\ue05e"}, + {"fiber_pin", "\ue06a"}, + {"fiber_smart_record", "\ue062"}, + {"file_download", "\ue2c4"}, + {"file_upload", "\ue2c6"}, + {"filter", "\ue3d3"}, + {"filter_1", "\ue3d0"}, + {"filter_2", "\ue3d1"}, + {"filter_3", "\ue3d2"}, + {"filter_4", "\ue3d4"}, + {"filter_5", "\ue3d5"}, + {"filter_6", "\ue3d6"}, + {"filter_7", "\ue3d7"}, + {"filter_8", "\ue3d8"}, + {"filter_9", "\ue3d9"}, + {"filter_9_plus", "\ue3da"}, + {"filter_b_and_w", "\ue3db"}, + {"filter_center_focus", "\ue3dc"}, + {"filter_drama", "\ue3dd"}, + {"filter_frames", "\ue3de"}, + {"filter_hdr", "\ue3df"}, + {"filter_list", "\ue152"}, + {"filter_none", "\ue3e0"}, + {"filter_tilt_shift", "\ue3e2"}, + {"filter_vintage", "\ue3e3"}, + {"find_in_page", "\ue880"}, + {"find_replace", "\ue881"}, + {"fingerprint", "\ue90d"}, + {"first_page", "\ue5dc"}, + {"fitness_center", "\ueb43"}, + {"flag", "\ue153"}, + {"flare", "\ue3e4"}, + {"flash_auto", "\ue3e5"}, + {"flash_off", "\ue3e6"}, + {"flash_on", "\ue3e7"}, + {"flight", "\ue539"}, + {"flight_land", "\ue904"}, + {"flight_takeoff", "\ue905"}, + {"flip", "\ue3e8"}, + {"flip_to_back", "\ue882"}, + {"flip_to_front", "\ue883"}, + {"folder", "\ue2c7"}, + {"folder_open", "\ue2c8"}, + {"folder_shared", "\ue2c9"}, + {"folder_special", "\ue617"}, + {"font_download", "\ue167"}, + {"format_align_center", "\ue234"}, + {"format_align_justify", "\ue235"}, + {"format_align_left", "\ue236"}, + {"format_align_right", "\ue237"}, + {"format_bold", "\ue238"}, + {"format_clear", "\ue239"}, + {"format_color_fill", "\ue23a"}, + {"format_color_reset", "\ue23b"}, + {"format_color_text", "\ue23c"}, + {"format_indent_decrease", "\ue23d"}, + {"format_indent_increase", "\ue23e"}, + {"format_italic", "\ue23f"}, + {"format_line_spacing", "\ue240"}, + {"format_list_bulleted", "\ue241"}, + {"format_list_numbered", "\ue242"}, + {"format_paint", "\ue243"}, + {"format_quote", "\ue244"}, + {"format_shapes", "\ue25e"}, + {"format_size", "\ue245"}, + {"format_strikethrough", "\ue246"}, + {"format_textdirection_l_to_r", "\ue247"}, + {"format_textdirection_r_to_l", "\ue248"}, + {"format_underlined", "\ue249"}, + {"forum", "\ue0bf"}, + {"forward", "\ue154"}, + {"forward_10", "\ue056"}, + {"forward_30", "\ue057"}, + {"forward_5", "\ue058"}, + {"free_breakfast", "\ueb44"}, + {"fullscreen", "\ue5d0"}, + {"fullscreen_exit", "\ue5d1"}, + {"functions", "\ue24a"}, + {"g_translate", "\ue927"}, + {"gamepad", "\ue30f"}, + {"games", "\ue021"}, + {"gavel", "\ue90e"}, + {"gesture", "\ue155"}, + {"get_app", "\ue884"}, + {"gif", "\ue908"}, + {"golf_course", "\ueb45"}, + {"gps_fixed", "\ue1b3"}, + {"gps_not_fixed", "\ue1b4"}, + {"gps_off", "\ue1b5"}, + {"grade", "\ue885"}, + {"gradient", "\ue3e9"}, + {"grain", "\ue3ea"}, + {"graphic_eq", "\ue1b8"}, + {"grid_off", "\ue3eb"}, + {"grid_on", "\ue3ec"}, + {"group", "\ue7ef"}, + {"group_add", "\ue7f0"}, + {"group_work", "\ue886"}, + {"hd", "\ue052"}, + {"hdr_off", "\ue3ed"}, + {"hdr_on", "\ue3ee"}, + {"hdr_strong", "\ue3f1"}, + {"hdr_weak", "\ue3f2"}, + {"headset", "\ue310"}, + {"headset_mic", "\ue311"}, + {"healing", "\ue3f3"}, + {"hearing", "\ue023"}, + {"help", "\ue887"}, + {"help_outline", "\ue8fd"}, + {"high_quality", "\ue024"}, + {"highlight", "\ue25f"}, + {"highlight_off", "\ue888"}, + {"history", "\ue889"}, + {"home", "\ue88a"}, + {"hot_tub", "\ueb46"}, + {"hotel", "\ue53a"}, + {"hourglass_empty", "\ue88b"}, + {"hourglass_full", "\ue88c"}, + {"http", "\ue902"}, + {"https", "\ue88d"}, + {"image", "\ue3f4"}, + {"image_aspect_ratio", "\ue3f5"}, + {"import_contacts", "\ue0e0"}, + {"import_export", "\ue0c3"}, + {"important_devices", "\ue912"}, + {"inbox", "\ue156"}, + {"indeterminate_check_box", "\ue909"}, + {"info", "\ue88e"}, + {"info_outline", "\ue88f"}, + {"input", "\ue890"}, + {"insert_chart", "\ue24b"}, + {"insert_comment", "\ue24c"}, + {"insert_drive_file", "\ue24d"}, + {"insert_emoticon", "\ue24e"}, + {"insert_invitation", "\ue24f"}, + {"insert_link", "\ue250"}, + {"insert_photo", "\ue251"}, + {"invert_colors", "\ue891"}, + {"invert_colors_off", "\ue0c4"}, + {"iso", "\ue3f6"}, + {"keyboard", "\ue312"}, + {"keyboard_arrow_down", "\ue313"}, + {"keyboard_arrow_left", "\ue314"}, + {"keyboard_arrow_right", "\ue315"}, + {"keyboard_arrow_up", "\ue316"}, + {"keyboard_backspace", "\ue317"}, + {"keyboard_capslock", "\ue318"}, + {"keyboard_hide", "\ue31a"}, + {"keyboard_return", "\ue31b"}, + {"keyboard_tab", "\ue31c"}, + {"keyboard_voice", "\ue31d"}, + {"kitchen", "\ueb47"}, + {"label", "\ue892"}, + {"label_outline", "\ue893"}, + {"landscape", "\ue3f7"}, + {"language", "\ue894"}, + {"laptop", "\ue31e"}, + {"laptop_chromebook", "\ue31f"}, + {"laptop_mac", "\ue320"}, + {"laptop_windows", "\ue321"}, + {"last_page", "\ue5dd"}, + {"launch", "\ue895"}, + {"layers", "\ue53b"}, + {"layers_clear", "\ue53c"}, + {"leak_add", "\ue3f8"}, + {"leak_remove", "\ue3f9"}, + {"lens", "\ue3fa"}, + {"library_add", "\ue02e"}, + {"library_books", "\ue02f"}, + {"library_music", "\ue030"}, + {"lightbulb_outline", "\ue90f"}, + {"line_style", "\ue919"}, + {"line_weight", "\ue91a"}, + {"linear_scale", "\ue260"}, + {"link", "\ue157"}, + {"linked_camera", "\ue438"}, + {"list", "\ue896"}, + {"live_help", "\ue0c6"}, + {"live_tv", "\ue639"}, + {"local_activity", "\ue53f"}, + {"local_airport", "\ue53d"}, + {"local_atm", "\ue53e"}, + {"local_bar", "\ue540"}, + {"local_cafe", "\ue541"}, + {"local_car_wash", "\ue542"}, + {"local_convenience_store", "\ue543"}, + {"local_dining", "\ue556"}, + {"local_drink", "\ue544"}, + {"local_florist", "\ue545"}, + {"local_gas_station", "\ue546"}, + {"local_grocery_store", "\ue547"}, + {"local_hospital", "\ue548"}, + {"local_hotel", "\ue549"}, + {"local_laundry_service", "\ue54a"}, + {"local_library", "\ue54b"}, + {"local_mall", "\ue54c"}, + {"local_movies", "\ue54d"}, + {"local_offer", "\ue54e"}, + {"local_parking", "\ue54f"}, + {"local_pharmacy", "\ue550"}, + {"local_phone", "\ue551"}, + {"local_pizza", "\ue552"}, + {"local_play", "\ue553"}, + {"local_post_office", "\ue554"}, + {"local_printshop", "\ue555"}, + {"local_see", "\ue557"}, + {"local_shipping", "\ue558"}, + {"local_taxi", "\ue559"}, + {"location_city", "\ue7f1"}, + {"location_disabled", "\ue1b6"}, + {"location_off", "\ue0c7"}, + {"location_on", "\ue0c8"}, + {"location_searching", "\ue1b7"}, + {"lock", "\ue897"}, + {"lock_open", "\ue898"}, + {"lock_outline", "\ue899"}, + {"looks", "\ue3fc"}, + {"looks_3", "\ue3fb"}, + {"looks_4", "\ue3fd"}, + {"looks_5", "\ue3fe"}, + {"looks_6", "\ue3ff"}, + {"looks_one", "\ue400"}, + {"looks_two", "\ue401"}, + {"loop", "\ue028"}, + {"loupe", "\ue402"}, + {"low_priority", "\ue16d"}, + {"loyalty", "\ue89a"}, + {"mail", "\ue158"}, + {"mail_outline", "\ue0e1"}, + {"map", "\ue55b"}, + {"markunread", "\ue159"}, + {"markunread_mailbox", "\ue89b"}, + {"memory", "\ue322"}, + {"menu", "\ue5d2"}, + {"merge_type", "\ue252"}, + {"message", "\ue0c9"}, + {"mic", "\ue029"}, + {"mic_none", "\ue02a"}, + {"mic_off", "\ue02b"}, + {"mms", "\ue618"}, + {"mode_comment", "\ue253"}, + {"mode_edit", "\ue254"}, + {"monetization_on", "\ue263"}, + {"money_off", "\ue25c"}, + {"monochrome_photos", "\ue403"}, + {"mood", "\ue7f2"}, + {"mood_bad", "\ue7f3"}, + {"more", "\ue619"}, + {"more_horiz", "\ue5d3"}, + {"more_vert", "\ue5d4"}, + {"motorcycle", "\ue91b"}, + {"mouse", "\ue323"}, + {"move_to_inbox", "\ue168"}, + {"movie", "\ue02c"}, + {"movie_creation", "\ue404"}, + {"movie_filter", "\ue43a"}, + {"multiline_chart", "\ue6df"}, + {"music_note", "\ue405"}, + {"music_video", "\ue063"}, + {"my_location", "\ue55c"}, + {"nature", "\ue406"}, + {"nature_people", "\ue407"}, + {"navigate_before", "\ue408"}, + {"navigate_next", "\ue409"}, + {"navigation", "\ue55d"}, + {"near_me", "\ue569"}, + {"network_cell", "\ue1b9"}, + {"network_check", "\ue640"}, + {"network_locked", "\ue61a"}, + {"network_wifi", "\ue1ba"}, + {"new_releases", "\ue031"}, + {"next_week", "\ue16a"}, + {"nfc", "\ue1bb"}, + {"no_encryption", "\ue641"}, + {"no_sim", "\ue0cc"}, + {"not_interested", "\ue033"}, + {"note", "\ue06f"}, + {"note_add", "\ue89c"}, + {"notifications", "\ue7f4"}, + {"notifications_active", "\ue7f7"}, + {"notifications_none", "\ue7f5"}, + {"notifications_off", "\ue7f6"}, + {"notifications_paused", "\ue7f8"}, + {"offline_pin", "\ue90a"}, + {"ondemand_video", "\ue63a"}, + {"opacity", "\ue91c"}, + {"open_in_browser", "\ue89d"}, + {"open_in_new", "\ue89e"}, + {"open_with", "\ue89f"}, + {"pages", "\ue7f9"}, + {"pageview", "\ue8a0"}, + {"palette", "\ue40a"}, + {"pan_tool", "\ue925"}, + {"panorama", "\ue40b"}, + {"panorama_fish_eye", "\ue40c"}, + {"panorama_horizontal", "\ue40d"}, + {"panorama_vertical", "\ue40e"}, + {"panorama_wide_angle", "\ue40f"}, + {"party_mode", "\ue7fa"}, + {"pause", "\ue034"}, + {"pause_circle_filled", "\ue035"}, + {"pause_circle_outline", "\ue036"}, + {"payment", "\ue8a1"}, + {"people", "\ue7fb"}, + {"people_outline", "\ue7fc"}, + {"perm_camera_mic", "\ue8a2"}, + {"perm_contact_calendar", "\ue8a3"}, + {"perm_data_setting", "\ue8a4"}, + {"perm_device_information", "\ue8a5"}, + {"perm_identity", "\ue8a6"}, + {"perm_media", "\ue8a7"}, + {"perm_phone_msg", "\ue8a8"}, + {"perm_scan_wifi", "\ue8a9"}, + {"person", "\ue7fd"}, + {"person_add", "\ue7fe"}, + {"person_outline", "\ue7ff"}, + {"person_pin", "\ue55a"}, + {"person_pin_circle", "\ue56a"}, + {"personal_video", "\ue63b"}, + {"pets", "\ue91d"}, + {"phone", "\ue0cd"}, + {"phone_android", "\ue324"}, + {"phone_bluetooth_speaker", "\ue61b"}, + {"phone_forwarded", "\ue61c"}, + {"phone_in_talk", "\ue61d"}, + {"phone_iphone", "\ue325"}, + {"phone_locked", "\ue61e"}, + {"phone_missed", "\ue61f"}, + {"phone_paused", "\ue620"}, + {"phonelink", "\ue326"}, + {"phonelink_erase", "\ue0db"}, + {"phonelink_lock", "\ue0dc"}, + {"phonelink_off", "\ue327"}, + {"phonelink_ring", "\ue0dd"}, + {"phonelink_setup", "\ue0de"}, + {"photo", "\ue410"}, + {"photo_album", "\ue411"}, + {"photo_camera", "\ue412"}, + {"photo_filter", "\ue43b"}, + {"photo_library", "\ue413"}, + {"photo_size_select_actual", "\ue432"}, + {"photo_size_select_large", "\ue433"}, + {"photo_size_select_small", "\ue434"}, + {"picture_as_pdf", "\ue415"}, + {"picture_in_picture", "\ue8aa"}, + {"picture_in_picture_alt", "\ue911"}, + {"pie_chart", "\ue6c4"}, + {"pie_chart_outlined", "\ue6c5"}, + {"pin_drop", "\ue55e"}, + {"place", "\ue55f"}, + {"play_arrow", "\ue037"}, + {"play_circle_filled", "\ue038"}, + {"play_circle_outline", "\ue039"}, + {"play_for_work", "\ue906"}, + {"playlist_add", "\ue03b"}, + {"playlist_add_check", "\ue065"}, + {"playlist_play", "\ue05f"}, + {"plus_one", "\ue800"}, + {"poll", "\ue801"}, + {"polymer", "\ue8ab"}, + {"pool", "\ueb48"}, + {"portable_wifi_off", "\ue0ce"}, + {"portrait", "\ue416"}, + {"power", "\ue63c"}, + {"power_input", "\ue336"}, + {"power_settings_new", "\ue8ac"}, + {"pregnant_woman", "\ue91e"}, + {"present_to_all", "\ue0df"}, + {"print", "\ue8ad"}, + {"priority_high", "\ue645"}, + {"public", "\ue80b"}, + {"publish", "\ue255"}, + {"query_builder", "\ue8ae"}, + {"question_answer", "\ue8af"}, + {"queue", "\ue03c"}, + {"queue_music", "\ue03d"}, + {"queue_play_next", "\ue066"}, + {"radio", "\ue03e"}, + {"radio_button_checked", "\ue837"}, + {"radio_button_unchecked", "\ue836"}, + {"rate_review", "\ue560"}, + {"receipt", "\ue8b0"}, + {"recent_actors", "\ue03f"}, + {"record_voice_over", "\ue91f"}, + {"redeem", "\ue8b1"}, + {"redo", "\ue15a"}, + {"refresh", "\ue5d5"}, + {"remove", "\ue15b"}, + {"remove_circle", "\ue15c"}, + {"remove_circle_outline", "\ue15d"}, + {"remove_from_queue", "\ue067"}, + {"remove_red_eye", "\ue417"}, + {"remove_shopping_cart", "\ue928"}, + {"reorder", "\ue8fe"}, + {"repeat", "\ue040"}, + {"repeat_one", "\ue041"}, + {"replay", "\ue042"}, + {"replay_10", "\ue059"}, + {"replay_30", "\ue05a"}, + {"replay_5", "\ue05b"}, + {"reply", "\ue15e"}, + {"reply_all", "\ue15f"}, + {"report", "\ue160"}, + {"report_problem", "\ue8b2"}, + {"restaurant", "\ue56c"}, + {"restaurant_menu", "\ue561"}, + {"restore", "\ue8b3"}, + {"restore_page", "\ue929"}, + {"ring_volume", "\ue0d1"}, + {"room", "\ue8b4"}, + {"room_service", "\ueb49"}, + {"rotate_90_degrees_ccw", "\ue418"}, + {"rotate_left", "\ue419"}, + {"rotate_right", "\ue41a"}, + {"rounded_corner", "\ue920"}, + {"router", "\ue328"}, + {"rowing", "\ue921"}, + {"rss_feed", "\ue0e5"}, + {"rv_hookup", "\ue642"}, + {"satellite", "\ue562"}, + {"save", "\ue161"}, + {"scanner", "\ue329"}, + {"schedule", "\ue8b5"}, + {"school", "\ue80c"}, + {"screen_lock_landscape", "\ue1be"}, + {"screen_lock_portrait", "\ue1bf"}, + {"screen_lock_rotation", "\ue1c0"}, + {"screen_rotation", "\ue1c1"}, + {"screen_share", "\ue0e2"}, + {"sd_card", "\ue623"}, + {"sd_storage", "\ue1c2"}, + {"search", "\ue8b6"}, + {"security", "\ue32a"}, + {"select_all", "\ue162"}, + {"send", "\ue163"}, + {"sentiment_dissatisfied", "\ue811"}, + {"sentiment_neutral", "\ue812"}, + {"sentiment_satisfied", "\ue813"}, + {"sentiment_very_dissatisfied", "\ue814"}, + {"sentiment_very_satisfied", "\ue815"}, + {"settings", "\ue8b8"}, + {"settings_applications", "\ue8b9"}, + {"settings_backup_restore", "\ue8ba"}, + {"settings_bluetooth", "\ue8bb"}, + {"settings_brightness", "\ue8bd"}, + {"settings_cell", "\ue8bc"}, + {"settings_ethernet", "\ue8be"}, + {"settings_input_antenna", "\ue8bf"}, + {"settings_input_component", "\ue8c0"}, + {"settings_input_composite", "\ue8c1"}, + {"settings_input_hdmi", "\ue8c2"}, + {"settings_input_svideo", "\ue8c3"}, + {"settings_overscan", "\ue8c4"}, + {"settings_phone", "\ue8c5"}, + {"settings_power", "\ue8c6"}, + {"settings_remote", "\ue8c7"}, + {"settings_system_daydream", "\ue1c3"}, + {"settings_voice", "\ue8c8"}, + {"share", "\ue80d"}, + {"shop", "\ue8c9"}, + {"shop_two", "\ue8ca"}, + {"shopping_basket", "\ue8cb"}, + {"shopping_cart", "\ue8cc"}, + {"short_text", "\ue261"}, + {"show_chart", "\ue6e1"}, + {"shuffle", "\ue043"}, + {"signal_cellular_4_bar", "\ue1c8"}, + {"signal_cellular_connected_no_internet_4_bar", "\ue1cd"}, + {"signal_cellular_no_sim", "\ue1ce"}, + {"signal_cellular_null", "\ue1cf"}, + {"signal_cellular_off", "\ue1d0"}, + {"signal_wifi_4_bar", "\ue1d8"}, + {"signal_wifi_4_bar_lock", "\ue1d9"}, + {"signal_wifi_off", "\ue1da"}, + {"sim_card", "\ue32b"}, + {"sim_card_alert", "\ue624"}, + {"skip_next", "\ue044"}, + {"skip_previous", "\ue045"}, + {"slideshow", "\ue41b"}, + {"slow_motion_video", "\ue068"}, + {"smartphone", "\ue32c"}, + {"smoke_free", "\ueb4a"}, + {"smoking_rooms", "\ueb4b"}, + {"sms", "\ue625"}, + {"sms_failed", "\ue626"}, + {"snooze", "\ue046"}, + {"sort", "\ue164"}, + {"sort_by_alpha", "\ue053"}, + {"spa", "\ueb4c"}, + {"space_bar", "\ue256"}, + {"speaker", "\ue32d"}, + {"speaker_group", "\ue32e"}, + {"speaker_notes", "\ue8cd"}, + {"speaker_notes_off", "\ue92a"}, + {"speaker_phone", "\ue0d2"}, + {"spellcheck", "\ue8ce"}, + {"star", "\ue838"}, + {"star_border", "\ue83a"}, + {"star_half", "\ue839"}, + {"stars", "\ue8d0"}, + {"stay_current_landscape", "\ue0d3"}, + {"stay_current_portrait", "\ue0d4"}, + {"stay_primary_landscape", "\ue0d5"}, + {"stay_primary_portrait", "\ue0d6"}, + {"stop", "\ue047"}, + {"stop_screen_share", "\ue0e3"}, + {"storage", "\ue1db"}, + {"store", "\ue8d1"}, + {"store_mall_directory", "\ue563"}, + {"straighten", "\ue41c"}, + {"streetview", "\ue56e"}, + {"strikethrough_s", "\ue257"}, + {"style", "\ue41d"}, + {"subdirectory_arrow_left", "\ue5d9"}, + {"subdirectory_arrow_right", "\ue5da"}, + {"subject", "\ue8d2"}, + {"subscriptions", "\ue064"}, + {"subtitles", "\ue048"}, + {"subway", "\ue56f"}, + {"supervisor_account", "\ue8d3"}, + {"surround_sound", "\ue049"}, + {"swap_calls", "\ue0d7"}, + {"swap_horiz", "\ue8d4"}, + {"swap_vert", "\ue8d5"}, + {"swap_vertical_circle", "\ue8d6"}, + {"switch_camera", "\ue41e"}, + {"switch_video", "\ue41f"}, + {"sync", "\ue627"}, + {"sync_disabled", "\ue628"}, + {"sync_problem", "\ue629"}, + {"system_update", "\ue62a"}, + {"system_update_alt", "\ue8d7"}, + {"tab", "\ue8d8"}, + {"tab_unselected", "\ue8d9"}, + {"tablet", "\ue32f"}, + {"tablet_android", "\ue330"}, + {"tablet_mac", "\ue331"}, + {"tag_faces", "\ue420"}, + {"tap_and_play", "\ue62b"}, + {"terrain", "\ue564"}, + {"text_fields", "\ue262"}, + {"text_format", "\ue165"}, + {"textsms", "\ue0d8"}, + {"texture", "\ue421"}, + {"theaters", "\ue8da"}, + {"thumb_down", "\ue8db"}, + {"thumb_up", "\ue8dc"}, + {"thumbs_up_down", "\ue8dd"}, + {"time_to_leave", "\ue62c"}, + {"timelapse", "\ue422"}, + {"timeline", "\ue922"}, + {"timer", "\ue425"}, + {"timer_10", "\ue423"}, + {"timer_3", "\ue424"}, + {"timer_off", "\ue426"}, + {"title", "\ue264"}, + {"toc", "\ue8de"}, + {"today", "\ue8df"}, + {"toll", "\ue8e0"}, + {"tonality", "\ue427"}, + {"touch_app", "\ue913"}, + {"toys", "\ue332"}, + {"track_changes", "\ue8e1"}, + {"traffic", "\ue565"}, + {"train", "\ue570"}, + {"tram", "\ue571"}, + {"transfer_within_a_station", "\ue572"}, + {"transform", "\ue428"}, + {"translate", "\ue8e2"}, + {"trending_down", "\ue8e3"}, + {"trending_flat", "\ue8e4"}, + {"trending_up", "\ue8e5"}, + {"tune", "\ue429"}, + {"turned_in", "\ue8e6"}, + {"turned_in_not", "\ue8e7"}, + {"tv", "\ue333"}, + {"unarchive", "\ue169"}, + {"undo", "\ue166"}, + {"unfold_less", "\ue5d6"}, + {"unfold_more", "\ue5d7"}, + {"update", "\ue923"}, + {"usb", "\ue1e0"}, + {"verified_user", "\ue8e8"}, + {"vertical_align_bottom", "\ue258"}, + {"vertical_align_center", "\ue259"}, + {"vertical_align_top", "\ue25a"}, + {"vibration", "\ue62d"}, + {"video_call", "\ue070"}, + {"video_label", "\ue071"}, + {"video_library", "\ue04a"}, + {"videocam", "\ue04b"}, + {"videocam_off", "\ue04c"}, + {"videogame_asset", "\ue338"}, + {"view_agenda", "\ue8e9"}, + {"view_array", "\ue8ea"}, + {"view_carousel", "\ue8eb"}, + {"view_column", "\ue8ec"}, + {"view_comfy", "\ue42a"}, + {"view_compact", "\ue42b"}, + {"view_day", "\ue8ed"}, + {"view_headline", "\ue8ee"}, + {"view_list", "\ue8ef"}, + {"view_module", "\ue8f0"}, + {"view_quilt", "\ue8f1"}, + {"view_stream", "\ue8f2"}, + {"view_week", "\ue8f3"}, + {"vignette", "\ue435"}, + {"visibility", "\ue8f4"}, + {"visibility_off", "\ue8f5"}, + {"voice_chat", "\ue62e"}, + {"voicemail", "\ue0d9"}, + {"volume_down", "\ue04d"}, + {"volume_mute", "\ue04e"}, + {"volume_off", "\ue04f"}, + {"volume_up", "\ue050"}, + {"vpn_key", "\ue0da"}, + {"vpn_lock", "\ue62f"}, + {"wallpaper", "\ue1bc"}, + {"warning", "\ue002"}, + {"watch", "\ue334"}, + {"watch_later", "\ue924"}, + {"wb_auto", "\ue42c"}, + {"wb_cloudy", "\ue42d"}, + {"wb_incandescent", "\ue42e"}, + {"wb_iridescent", "\ue436"}, + {"wb_sunny", "\ue430"}, + {"wc", "\ue63d"}, + {"web", "\ue051"}, + {"web_asset", "\ue069"}, + {"weekend", "\ue16b"}, + {"whatshot", "\ue80e"}, + {"widgets", "\ue1bd"}, + {"wifi", "\ue63e"}, + {"wifi_lock", "\ue1e1"}, + {"wifi_tethering", "\ue1e2"}, + {"work", "\ue8f9"}, + {"wrap_text", "\ue25b"}, + {"youtube_searched_for", "\ue8fa"}, + {"zoom_in", "\ue8ff"}, + {"zoom_out", "\ue900"}, + {"zoom_out_map", "\ue56b"}, + {"post_add", "\uea20"} + }; + }; + + static QString getIcon(const QString &icon_name) { + std::string icon_name_std = icon_name.toStdString(); + if (MaterialIcons::icon_map_.find(icon_name_std) != MaterialIcons::icon_map_.end()) { + return QString::fromStdString(MaterialIcons::icon_map_.at(icon_name_std)); + } + return ""; + } + +}; + +const std::map MaterialIcons::icon_map_ = MaterialIcons::create_icon_map(); + +#endif // MATERIAL_ICONS_H diff --git a/src/model/Card.cpp b/src/old/model/Card.cpp similarity index 100% rename from src/model/Card.cpp rename to src/old/model/Card.cpp diff --git a/src/model/Card.h b/src/old/model/Card.h similarity index 100% rename from src/model/Card.h rename to src/old/model/Card.h diff --git a/src/papercards_qml.cpp b/src/papercards_qml.cpp index 3c7630f..1dade78 100644 --- a/src/papercards_qml.cpp +++ b/src/papercards_qml.cpp @@ -8,9 +8,10 @@ #include #include #include +#include + +#include "MainWindow.h" -#include "Backend.h" -#include "DocumentHandler.h" void init_application_information(){ QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); @@ -26,28 +27,17 @@ void init_application_information(){ } void load_fonts(){ - QFontDatabase::addApplicationFont(":/resources/roboto/Roboto-BlackItalic.ttf"); - QFontDatabase::addApplicationFont(":/resources/roboto/Roboto-Black.ttf"); - QFontDatabase::addApplicationFont(":/resources/roboto/Roboto-Bold.ttf"); - QFontDatabase::addApplicationFont(":/resources/roboto/Roboto-BoldItalic.ttf"); - QFontDatabase::addApplicationFont(":/resources/roboto/Roboto-Medium.ttf"); - QFontDatabase::addApplicationFont(":/resources/roboto/Roboto-MediumItalic.ttf"); - QFontDatabase::addApplicationFont(":/resources/roboto/Roboto-Regular.ttf"); - QFontDatabase::addApplicationFont(":/resources/roboto/Roboto-Italic.ttf"); - QFontDatabase::addApplicationFont(":/resources/roboto/Roboto-Light.ttf"); - QFontDatabase::addApplicationFont(":/resources/roboto/Roboto-LightItalic.ttf"); - QFontDatabase::addApplicationFont(":/resources/roboto/Roboto-Thin.ttf"); - QFontDatabase::addApplicationFont(":/resources/roboto/Roboto-ThinItalic.ttf"); - QFontDatabase::addApplicationFont(":/resources/MaterialIcons-Regular.ttf"); - QFontDatabase::addApplicationFont(":/resources/PapercardsIcons.ttf"); - QFontDatabase::addApplicationFont(":/resources/roboto/Roboto-BlackItalic.ttf"); + const auto id = QFontDatabase::addApplicationFont(":/resources/feather.ttf"); + qDebug() << QFontDatabase::applicationFontFamilies(id).front(); } +/* void register_qml() { qmlRegisterSingletonType("io.papercards.backend", 1, 0, "BackEnd", &BackEnd::qmlInstance); qmlRegisterType("io.papercards.card", 1, 0, "Card"); qmlRegisterType("io.papercards.texteditor", 1, 0, "DocumentHandler"); } +*/ int main(int argc, char *argv[]) { qInfo("Executing Papercards, Version %i.%i.%i.", MAJOR_VERSION, MINOR_VERSION, REVISION); @@ -57,16 +47,20 @@ int main(int argc, char *argv[]) { QApplication::setWindowIcon(QIcon(":/resources/logo.png")); qInfo("Loading default card from file."); - BackEnd::instance()->newDeck(); + //BackEnd::instance()->newDeck(); qInfo("Loading fonts."); load_fonts(); + + QIcon::setThemeName( "papercards-icon-theme" ); qInfo("Executing qml and java script."); - register_qml(); - QQmlApplicationEngine engine; - engine.load(QUrl(QStringLiteral("qrc:/gui/main.qml"))); + //register_qml(); + //QQmlApplicationEngine engine; + //engine.load(QUrl(QStringLiteral("qrc:/gui/main.qml"))); + auto* window = new MainWindow; + window->show(); auto return_code = QApplication::exec(); qInfo("Terminating ."); diff --git a/ui/mainwindow.ui b/ui/mainwindow.ui new file mode 100644 index 0000000..357b366 --- /dev/null +++ b/ui/mainwindow.ui @@ -0,0 +1,314 @@ + + + mainWindow + + + + 0 + 0 + 800 + 600 + + + + MainWindow + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Horizontal + + + + + + + + + + + 0 + 0 + 800 + 22 + + + + + File + + + + + + + + + + + + Help + + + + + + Edit + + + + + + + + + + + + + + + + + + + + toolBar + + + QToolBar { + padding: 5px; +} +QToolButton { + font-family: "feather"; + font-size: 22pt; + border-radius: 5; + width: 32px; + height: 32px; +} +QToolButton:hover +{ + background: palette(base); +} +QToolButton:checked +{ + background: palette(base); +} +QToolButton:pressed +{ + background: palette(base); +} + + + false + + + + 32 + 32 + + + + Qt::ToolButtonIconOnly + + + false + + + TopToolBarArea + + + false + + + + + + + + + + + + + + + + + Quit + + + + + About + + + + + Save + + + save + + + + + Load + + + + + Export + + + + + true + + + Bold + + + + + + <html><head/><body><p>Makes text appear bold.</p></body></html> + + + Ctrl+B + + + + + true + + + Italic + + + + + + <html><head/><body><p>Make text appear italic.</p></body></html> + + + Ctrl+I + + + true + + + + + true + + + Underline + + + + + + <html><head/><body><p>Underlines the selected text.</p></body></html> + + + Ctrl+U + + + + + Decrease Indention + + + + + + <html><head/><body><p>Decreases the indentation of the bullet point list.</p></body></html> + + + + + Increse Indention + + + + + + <html><head/><body><p>Increases the indentation of the bullet point list.</p></body></html> + + + + + Text Color + + + + + + <html><head/><body><p>Change the color of the selected text.</p></body></html> + + + + + List + + + + + + <html><head/><body><p>Makes the selected text to appear in a bullet point list.</p></body></html> + + + + + Highlight Color + + + + + + <html><head/><body><p>Highlight the selected text with a marker.</p></body></html> + + + + + Add Deck + + + + + + <html><head/><body><p>Add a new card to the deck.</p></body></html> + + + + + + SidePanel + QWidget +
SidePanel.h
+ 1 +
+
+ + + + +
diff --git a/ui/sidepanel.ui b/ui/sidepanel.ui new file mode 100644 index 0000000..3fb6236 --- /dev/null +++ b/ui/sidepanel.ui @@ -0,0 +1,161 @@ + + + sidePanel + + + + 0 + 0 + 150 + 300 + + + + + 160 + 16777215 + + + + Form + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + true + + + QWidget { + background: palette(AlternateBase); +} + +QFrame{ + background: white; +} + + + QFrame::NoFrame + + + 0 + + + true + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + 0 + 0 + 152 + 300 + + + + + + + + 128 + 72 + + + + + 128 + 72 + + + + QFrame::StyledPanel + + + QFrame::Plain + + + + + + + + 128 + 72 + + + + + 128 + 72 + + + + QFrame::StyledPanel + + + QFrame::Plain + + + + + + + + 128 + 72 + + + + + 128 + 72 + + + + QFrame::StyledPanel + + + QFrame::Plain + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + diff --git a/ui/ui.qrc b/ui/ui.qrc new file mode 100644 index 0000000..3785918 --- /dev/null +++ b/ui/ui.qrc @@ -0,0 +1,6 @@ + + + mainwindow.ui + sidepanel.ui + +