diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2bf14a2b7ee82efb1b04ee67e4156c244b41f37b..34b01f7f0000ff7f8816805ae939a4df6b10a14d 100755
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -20,7 +20,7 @@ endif(Qt5Gui_FOUND)
find_package(Qt5Qml REQUIRED)
find_package(Qt5Quick REQUIRED)
find_package(Qt5QuickControls2 REQUIRED)
-find_package(Qt5Widgets REQUIRED)
+find_package(Qt5Gui REQUIRED)
find_package(Qt5PrintSupport REQUIRED)
@@ -93,7 +93,7 @@ target_link_libraries(nootka
NootkaCore
# NootkaScore
Qt5::Core
- Qt5::Widgets
+ Qt5::Gui
Qt5::Qml
Qt5::Quick
Qt5::QuickControls2
diff --git a/src/libs/core/CMakeLists.txt b/src/libs/core/CMakeLists.txt
index 52335caf83869b8e6c64d5804d786fab505e2e8f..4dfef33c94f6f7ce68085c73ebc44744bd43e61f 100644
--- a/src/libs/core/CMakeLists.txt
+++ b/src/libs/core/CMakeLists.txt
@@ -15,7 +15,7 @@ set(LIB_NOOTKACORE_SRC
tglobals.cpp
tnoofont.cpp
tpath.cpp
- tmtr.cpp
+# tmtr.cpp
tnootkaqml.cpp
ttickcolors.cpp
@@ -55,7 +55,12 @@ set(LIB_NOOTKACORE_SRC
add_library(NootkaCore SHARED ${LIB_NOOTKACORE_SRC} )
-target_link_libraries(NootkaCore Qt5::Widgets)
+target_link_libraries(NootkaCore
+ Qt5::Gui
+ Qt5::Qml
+ Qt5::Quick
+ Qt5::QuickControls2
+ )
if(UNIX AND NOT APPLE) # Linux path for Nootka library
diff --git a/src/libs/core/music/tinstrument.cpp b/src/libs/core/music/tinstrument.cpp
index c050849b0ebfbd8b1e718b3e597739b77124d7d7..19ce64a72141b424eda33276ab736e1d093508d6 100644
--- a/src/libs/core/music/tinstrument.cpp
+++ b/src/libs/core/music/tinstrument.cpp
@@ -17,18 +17,18 @@
***************************************************************************/
#include "tinstrument.h"
-#include <QApplication>
+#include <QtGui/qguiapplication.h>
QString instrumentToText(Einstrument instr) {
if (instr == e_noInstrument)
- return QApplication::translate("Einstrument", "other instrument");
+ return QGuiApplication::translate("Einstrument", "other instrument");
if (instr == e_classicalGuitar)
- return QApplication::translate("Einstrument", "Classical Guitar");
+ return QGuiApplication::translate("Einstrument", "Classical Guitar");
if (instr == e_electricGuitar)
- return QApplication::translate("Einstrument", "Electric Guitar");
+ return QGuiApplication::translate("Einstrument", "Electric Guitar");
if (instr == e_bassGuitar)
- return QApplication::translate("Einstrument", "Bass Guitar");
+ return QGuiApplication::translate("Einstrument", "Bass Guitar");
return "";
}
diff --git a/src/libs/core/tcolor.cpp b/src/libs/core/tcolor.cpp
index 4fa82c208e8bb54d530b792dfafe336745f7257a..77201e29bb3464d14a2488ce3febcbf9c81fb817 100644
--- a/src/libs/core/tcolor.cpp
+++ b/src/libs/core/tcolor.cpp
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2014 by Tomasz Bojczuk *
+ * Copyright (C) 2014-2017 by Tomasz Bojczuk *
* seelook@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -17,6 +17,8 @@
***************************************************************************/
#include "tcolor.h"
+#include <QtGui/qpalette.h>
+
QColor Tcolor::shadow = Qt::gray;
@@ -30,3 +32,36 @@ void Tcolor::setShadow(const QPalette& pal) {
shadow = pal.shadow().color();
#endif
}
+
+
+QColor Tcolor::merge(const QColor& C1, const QColor& C2) {
+ qreal al = iV(C1.alpha()) + iV(C2.alpha() * (1 - iV(C1.alpha())));
+ return QColor(((iV(C1.red()) * iV(C1.alpha()) + iV(C2.red()) * iV(C2.alpha()) * (1 - iV(C1.alpha()))) / al) * 255,
+ ((iV(C1.green()) * iV(C1.alpha()) + iV(C2.green()) * iV(C2.alpha()) * (1 - iV(C1.alpha()))) / al) * 255,
+ ((iV(C1.blue()) * iV(C1.alpha()) + iV(C2.blue()) * iV(C2.alpha()) * (1 - iV(C1.alpha()))) / al) * 255,
+ qMin(255, (int)(255 * al)));
+}
+
+
+QColor Tcolor::invert(const QColor& color) {
+ QColor C = color;
+ if (C.isValid())
+ C.setRgb(qRgb(255 - C.red(), 255 - C.green(), 255 - C.blue()));
+ return C;
+}
+
+
+QString Tcolor::rgbaText(const QColor& color, const QString& styleTag) {
+ return QString(styleTag + "rgba(%1, %2, %3, %4);").arg(color.red()).arg(color.green()).arg(color.blue()).arg(color.alpha());
+}
+
+
+QString Tcolor::bgTag(const QColor& color) {
+ if (color != -1 && color.alpha() > 0)
+ return rgbaText(color, "background-color:");
+ else
+ return QString("background-color: transparent; ");
+}
+
+
+
diff --git a/src/libs/core/tcolor.h b/src/libs/core/tcolor.h
index a0c9941991e524f14e5079c69d8ccf31555fd052..c5996c2b831b23eb5324e71ae2fcf19ee3273872 100644
--- a/src/libs/core/tcolor.h
+++ b/src/libs/core/tcolor.h
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2014 by Tomasz Bojczuk *
+ * Copyright (C) 2014-2017 by Tomasz Bojczuk *
* seelook@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -19,9 +19,13 @@
#ifndef TCOLOR_H
#define TCOLOR_H
+
#include <nootkacoreglobal.h>
-#include <QColor>
-#include <QWidget>
+#include <QtGui/qcolor.h>
+
+
+class QPalette;
+
/**
* A set of static methods with some tweaks of color:
@@ -34,47 +38,39 @@ class NOOTKACORE_EXPORT Tcolor
{
public:
- /** Merge given colors. */
- static QColor merge(const QColor& C1, const QColor& C2) {
- qreal al = iV(C1.alpha()) + iV(C2.alpha() * (1 - iV(C1.alpha())));
- return QColor(((iV(C1.red()) * iV(C1.alpha()) + iV(C2.red()) * iV(C2.alpha()) * (1 - iV(C1.alpha()))) / al) * 255,
- ((iV(C1.green()) * iV(C1.alpha()) + iV(C2.green()) * iV(C2.alpha()) * (1 - iV(C1.alpha()))) / al) * 255,
- ((iV(C1.blue()) * iV(C1.alpha()) + iV(C2.blue()) * iV(C2.alpha()) * (1 - iV(C1.alpha()))) / al) * 255,
- qMin(255, (int)(255 * al)));
-}
-
- /** Returns inverted copy of given color */
- static QColor invert(const QColor& color) {
- QColor C = color;
- if (C.isValid())
- C.setRgb(qRgb(255 - C.red(), 255 - C.green(), 255 - C.blue()));
- return C;
- }
-
- /** Returns css style tag with rgba values of color.
- *
- * @p styleTag rgba(red, green, blue, alpha);
- */
- static QString rgbaText(const QColor& color, const QString& styleTag = "") {
- return QString(styleTag + "rgba(%1, %2, %3, %4);").
- arg(color.red()).arg(color.green()).arg(color.blue()).arg(color.alpha());
- }
-
- /** Returns
- * background-color: rgba(red, green, blue, alpha) */
- static QString bgTag(const QColor& color) {
- if (color != -1 && color.alpha() > 0)
- return rgbaText(color, "background-color:");
- else
- return QString("background-color: transparent; ");
- }
-
- /** Converts value (0 - 255) to (0.0 - 1.0) */
+
+ /**
+ * Merge given colors.
+ */
+ static QColor merge(const QColor& C1, const QColor& C2);
+
+ /**
+ * Returns inverted copy of given color
+ */
+ static QColor invert(const QColor& color);
+
+ /**
+ * Returns css style tag with rgba values of color.
+ * @p styleTag rgba(red, green, blue, alpha);
+ */
+ static QString rgbaText(const QColor& color, const QString& styleTag = QString());
+
+ /**
+ * Returns
+ * background-color: rgba(red, green, blue, alpha)
+ */
+ static QString bgTag(const QColor& color);
+
+ /**
+ * Converts value (0 - 255) to (0.0 - 1.0)
+ */
static qreal iV(int ch) { return ch / 255.0; }
static QColor shadow;
- /** Sets default shadow color of tips */
+ /**
+ * Sets default shadow color of tips
+ */
static void setShadow(const QPalette& pal);
};
diff --git a/src/libs/core/tglobals.cpp b/src/libs/core/tglobals.cpp
index 0316f7a160d62355980a6b5cd80f104552171e8c..1eab6f0ef18300938db94d64e3a6288e12fc9bfb 100755
--- a/src/libs/core/tglobals.cpp
+++ b/src/libs/core/tglobals.cpp
@@ -87,7 +87,7 @@ Tglobals::Tglobals(QObject* parent) :
new TtouchParams;
#if defined(Q_OS_WIN32) || defined(Q_OS_MAC) // I hate mess in Win registry
- config = new QSettings(QSettings::IniFormat, QSettings::UserScope, QStringLiteral("Nootka")), qApp->applicationName());
+ config = new QSettings(QSettings::IniFormat, QSettings::UserScope, QStringLiteral("Nootka"), qApp->applicationName());
#else
config = new QSettings();
#endif
diff --git a/src/libs/core/tinitcorelib.cpp b/src/libs/core/tinitcorelib.cpp
index 0b57a9bef768841c951118da81fb810561547b86..d368992c1a7b1909c74e14c1650d1272849af59b 100644
--- a/src/libs/core/tinitcorelib.cpp
+++ b/src/libs/core/tinitcorelib.cpp
@@ -22,8 +22,9 @@
#include "tcolor.h"
#include "tscoreparams.h"
#include "tpath.h"
-#include <QtWidgets/qapplication.h>
-#include <QtWidgets/qmessagebox.h>
+#include <QtGui/qguiapplication.h>
+#include <QtGui/qpalette.h>
+// #include <QtWidgets/qmessagebox.h>
#include <QtCore/qtranslator.h>
#include <QtCore/qlibraryinfo.h>
#include <QtGui/qfontdatabase.h>
@@ -75,7 +76,7 @@ bool initCoreLibrary() {
}
-void prepareTranslations(QApplication* a, QTranslator& qt, QTranslator& noo) {
+void prepareTranslations(QGuiApplication* a, QTranslator& qt, QTranslator& noo) {
if (!Tcore::gl())
return;
@@ -112,12 +113,13 @@ void prepareTranslations(QApplication* a, QTranslator& qt, QTranslator& noo) {
}
-bool loadNootkaFont(QApplication* a) {
+bool loadNootkaFont(QGuiApplication* a) {
QFontDatabase fd;
int fid = fd.addApplicationFont(Tpath::main + QLatin1String("fonts/nootka.ttf"));
int fid2 = fd.addApplicationFont(Tpath::main + QLatin1String("fonts/Scorek.otf"));
if (fid == -1 || fid2 == -1) {
- QMessageBox::critical(0, QString(), a->translate("main", "<center>Can not load a font.<br>Try to install nootka.ttf manually.</center>"));
+ qDebug() << "Can not load Nootka fonts!";
+// QMessageBox::critical(0, QString(), a->translate("main", "<center>Can not load a font.<br>Try to install nootka.ttf manually.</center>"));
return false;
}
return true;
diff --git a/src/libs/core/tinitcorelib.h b/src/libs/core/tinitcorelib.h
index 19b1e93ef23c350318977466004599058ae6daee..cda823480e713db441c3e6183d94ad0742ae4557 100755
--- a/src/libs/core/tinitcorelib.h
+++ b/src/libs/core/tinitcorelib.h
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2014-2016 by Tomasz Bojczuk *
+ * Copyright (C) 2014-2017 by Tomasz Bojczuk *
* seelook@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -24,7 +24,7 @@
class QTranslator;
-class QApplication;
+class QGuiApplication;
class QStyle;
/**
@@ -61,10 +61,10 @@ NOOTKACORE_EXPORT bool initCoreLibrary();
/** Loads translations files for appropriate language (system or user preferred)
* Translator object has to be created before. */
-NOOTKACORE_EXPORT void prepareTranslations(QApplication* a, QTranslator& qt, QTranslator& noo);
+NOOTKACORE_EXPORT void prepareTranslations(QGuiApplication* a, QTranslator& qt, QTranslator& noo);
/** Checks nootka.ttf file and loads it. Returns true if successful.
* libNootkaCore has to be initialized first by initCoreLibrary() */
-NOOTKACORE_EXPORT bool loadNootkaFont(QApplication* a);
+NOOTKACORE_EXPORT bool loadNootkaFont(QGuiApplication* a);
#endif // TINITCORELIB_H
diff --git a/src/libs/core/ttickcolors.h b/src/libs/core/ttickcolors.h
index d24f90d7713a611eb4652755cb1619d38d41371b..3b34f2ea090f9fcc8e0adb4d6a2b3bb3c4537248 100644
--- a/src/libs/core/ttickcolors.h
+++ b/src/libs/core/ttickcolors.h
@@ -20,12 +20,13 @@
#define TTICKCOLORS_H
+#include "nootkacoreglobal.h"
#include <QtCore/QObject>
#include <QtGui/QColor>
#include <QtCore/QDebug>
-class TtickColors : public QObject
+class NOOTKACORE_EXPORT TtickColors : public QObject
{
Q_OBJECT
diff --git a/src/main.cpp b/src/main.cpp
index 5dec9cee2161108367bebb3df4ae44ace6a663bc..6f9fe5d40a345a5f6f91efce5f4bc55674fc1793 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -23,7 +23,7 @@
#include <tinitcorelib.h>
#include <tpath.h>
#include <tmtr.h>
-#include <QtWidgets/qapplication.h>
+#include <QtGui/qguiapplication.h>
#include <QtGui/qicon.h>
#include <QtQml/qqmlapplicationengine.h>
#include <QtQml/qqmlcontext.h>
@@ -75,7 +75,7 @@ int main(int argc, char *argv[])
QTranslator qtTranslator;
QTranslator nooTranslator;
- QPointer<QApplication> a = 0;
+ QPointer<QGuiApplication> a = nullptr;
QQmlApplicationEngine *e = nullptr;
Tpath pathObj;
TnootkaQML nooObj;
@@ -93,8 +93,8 @@ int main(int argc, char *argv[])
}
resetConfig = false;
#endif
- a = new QApplication(argc, argv);
- Tmtr::init(a);
+ a = new QGuiApplication(argc, argv);
+// Tmtr::init(a);
gl = new Tglobals();
gl->path = Tglobals::getInstPath(qApp->applicationDirPath());