Commit 33c17d0f authored by Halla Rempt's avatar Halla Rempt

Put aboutdata and shaders in qrc files

This way they will always be found and won't clutter up the install
directory with stuff that never changes.
parent 713438a4
...@@ -166,6 +166,8 @@ qt5_add_resources(krita_SRCS krita.qrc ...@@ -166,6 +166,8 @@ qt5_add_resources(krita_SRCS krita.qrc
${CMAKE_SOURCE_DIR}/libs/flake/flake.qrc ${CMAKE_SOURCE_DIR}/libs/flake/flake.qrc
${CMAKE_SOURCE_DIR}/libs/widgets/kritawidgets.qrc ${CMAKE_SOURCE_DIR}/libs/widgets/kritawidgets.qrc
${CMAKE_SOURCE_DIR}/pics/icons.qrc ${CMAKE_SOURCE_DIR}/pics/icons.qrc
data/aboutdata/aboutdata.qrc
data/shaders/shaders.qrc
) )
add_executable(krita ${krita_SRCS}) add_executable(krita ${krita_SRCS})
......
add_subdirectory( aboutdata )
add_subdirectory( actions ) add_subdirectory( actions )
add_subdirectory( brushes ) add_subdirectory( brushes )
add_subdirectory( bundles ) add_subdirectory( bundles )
...@@ -6,7 +5,6 @@ add_subdirectory( patterns ) ...@@ -6,7 +5,6 @@ add_subdirectory( patterns )
add_subdirectory( gradients ) add_subdirectory( gradients )
add_subdirectory( profiles ) add_subdirectory( profiles )
add_subdirectory( templates ) add_subdirectory( templates )
add_subdirectory( shaders )
add_subdirectory( cursors ) add_subdirectory( cursors )
add_subdirectory( workspaces ) add_subdirectory( workspaces )
add_subdirectory( themes ) add_subdirectory( themes )
...@@ -22,8 +20,6 @@ install( FILES ...@@ -22,8 +20,6 @@ install( FILES
DESTINATION ${CONFIG_INSTALL_DIR} DESTINATION ${CONFIG_INSTALL_DIR}
) )
install( FILES install( FILES
krita.xml krita.xml
DESTINATION ${XDG_MIME_INSTALL_DIR}) DESTINATION ${XDG_MIME_INSTALL_DIR})
......
install( FILES
developers.txt
backers.txt
credits.txt
LICENSE
DESTINATION ${DATA_INSTALL_DIR}/krita/aboutdata)
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource>
<file>backers.txt</file>
<file>credits.txt</file>
<file>developers.txt</file>
<file>LICENSE</file>
</qresource>
</RCC>
install( FILES
bilinear_gradient.frag
conical_gradient.frag
conical_symetric_gradient.frag
matrix_transform.vert
matrix_transform_legacy.vert
simple_texture.frag
simple_texture_legacy.frag
highq_downscale.frag
cursor.vert
cursor.frag
linear_gradient.frag
radial_gradient.frag
square_gradient.frag
DESTINATION ${DATA_INSTALL_DIR}/krita/shaders)
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource>
<file>bilinear_gradient.frag</file>
<file>conical_gradient.frag</file>
<file>conical_symetric_gradient.frag</file>
<file>cursor.frag</file>
<file>cursor.vert</file>
<file>highq_downscale.frag</file>
<file>linear_gradient.frag</file>
<file>matrix_transform.vert</file>
<file>matrix_transform_legacy.vert</file>
<file>radial_gradient.frag</file>
<file>simple_texture.frag</file>
<file>simple_texture_legacy.frag</file>
<file>square_gradient.frag</file>
</qresource>
</RCC>
...@@ -60,7 +60,7 @@ KisAboutApplication::KisAboutApplication(QWidget *parent) ...@@ -60,7 +60,7 @@ KisAboutApplication::KisAboutApplication(QWidget *parent)
"<h1 align=\"center\">Created By</h1></p>" "<h1 align=\"center\">Created By</h1></p>"
"<p>"); "<p>");
QFile fileDevelopers(QStandardPaths::locate(QStandardPaths::AppDataLocation, "aboutdata/developers.txt")); QFile fileDevelopers(":/developers.txt");
Q_ASSERT(fileDevelopers.exists()); Q_ASSERT(fileDevelopers.exists());
fileDevelopers.open(QIODevice::ReadOnly); fileDevelopers.open(QIODevice::ReadOnly);
...@@ -82,7 +82,7 @@ KisAboutApplication::KisAboutApplication(QWidget *parent) ...@@ -82,7 +82,7 @@ KisAboutApplication::KisAboutApplication(QWidget *parent)
"<h1 align=\"center\">Backed By</h1>" "<h1 align=\"center\">Backed By</h1>"
"<p>"); "<p>");
QFile fileBackers(QStandardPaths::locate(QStandardPaths::AppDataLocation, "aboutdata/backers.txt")); QFile fileBackers(":/backers.txt");
Q_ASSERT(fileBackers.exists()); Q_ASSERT(fileBackers.exists());
fileBackers.open(QIODevice::ReadOnly); fileBackers.open(QIODevice::ReadOnly);
foreach(const QByteArray &backer, fileBackers.readAll().split('\n')) { foreach(const QByteArray &backer, fileBackers.readAll().split('\n')) {
...@@ -104,7 +104,7 @@ KisAboutApplication::KisAboutApplication(QWidget *parent) ...@@ -104,7 +104,7 @@ KisAboutApplication::KisAboutApplication(QWidget *parent)
"<h1 align=\"center\">Thanks To</h1>" "<h1 align=\"center\">Thanks To</h1>"
"<p>"); "<p>");
QFile fileCredits(QStandardPaths::locate(QStandardPaths::AppDataLocation, "aboutdata/credits.txt")); QFile fileCredits(":/credits.txt");
Q_ASSERT(fileCredits.exists()); Q_ASSERT(fileCredits.exists());
fileCredits.open(QIODevice::ReadOnly); fileCredits.open(QIODevice::ReadOnly);
...@@ -145,7 +145,7 @@ KisAboutApplication::KisAboutApplication(QWidget *parent) ...@@ -145,7 +145,7 @@ KisAboutApplication::KisAboutApplication(QWidget *parent)
"to trial or educational versions of commercial software that will forbid your work in commercial situations.</p>" "to trial or educational versions of commercial software that will forbid your work in commercial situations.</p>"
"<br/><hr/><pre>"); "<br/><hr/><pre>");
QFile licenseFile(QStandardPaths::locate(QStandardPaths::AppDataLocation, "aboutdata/LICENSE")); QFile licenseFile(":/LICENSE");
Q_ASSERT(licenseFile.exists()); Q_ASSERT(licenseFile.exists());
licenseFile.open(QIODevice::ReadOnly); licenseFile.open(QIODevice::ReadOnly);
QByteArray ba = licenseFile.readAll(); QByteArray ba = licenseFile.readAll();
......
...@@ -337,8 +337,8 @@ QOpenGLShaderProgram *KisOpenGLCanvas2::getCursorShader() ...@@ -337,8 +337,8 @@ QOpenGLShaderProgram *KisOpenGLCanvas2::getCursorShader()
{ {
if (d->cursorShader == 0) { if (d->cursorShader == 0) {
d->cursorShader = new QOpenGLShaderProgram(); d->cursorShader = new QOpenGLShaderProgram();
d->cursorShader->addShaderFromSourceFile(QOpenGLShader::Vertex, KoResourcePaths::findResource("data", "krita/shaders/cursor.vert")); d->cursorShader->addShaderFromSourceFile(QOpenGLShader::Vertex, ":/cursor.vert");
d->cursorShader->addShaderFromSourceFile(QOpenGLShader::Fragment, KoResourcePaths::findResource("data", "krita/shaders/cursor.frag")); d->cursorShader->addShaderFromSourceFile(QOpenGLShader::Fragment, ":/cursor.frag");
d->cursorShader->bindAttributeLocation("a_vertexPosition", PROGRAM_VERTEX_ATTRIBUTE); d->cursorShader->bindAttributeLocation("a_vertexPosition", PROGRAM_VERTEX_ATTRIBUTE);
if (! d->cursorShader->link()) { if (! d->cursorShader->link()) {
dbgUI << "OpenGL error" << glGetError(); dbgUI << "OpenGL error" << glGetError();
...@@ -666,11 +666,11 @@ void KisOpenGLCanvas2::initializeCheckerShader() ...@@ -666,11 +666,11 @@ void KisOpenGLCanvas2::initializeCheckerShader()
QString fragmentShaderName; QString fragmentShaderName;
if (KisOpenGL::supportsGLSL13()) { if (KisOpenGL::supportsGLSL13()) {
vertexShaderName = KoResourcePaths::findResource("data", "krita/shaders/matrix_transform.vert"); vertexShaderName = ":/matrix_transform.vert";
fragmentShaderName = KoResourcePaths::findResource("data", "krita/shaders/simple_texture.frag"); fragmentShaderName = ":/simple_texture.frag";
} else { } else {
vertexShaderName = KoResourcePaths::findResource("data", "krita/shaders/matrix_transform_legacy.vert"); vertexShaderName = ":/matrix_transform_legacy.vert";
fragmentShaderName = KoResourcePaths::findResource("data", "krita/shaders/simple_texture_legacy.frag"); fragmentShaderName = ":/simple_texture_legacy.frag";
} }
bool result; bool result;
...@@ -748,9 +748,9 @@ void KisOpenGLCanvas2::initializeDisplayShader() ...@@ -748,9 +748,9 @@ void KisOpenGLCanvas2::initializeDisplayShader()
reportShaderLinkFailedAndExit(result, "Display fragment shader", d->displayShader->log()); reportShaderLinkFailedAndExit(result, "Display fragment shader", d->displayShader->log());
if (KisOpenGL::supportsGLSL13()) { if (KisOpenGL::supportsGLSL13()) {
result = d->displayShader->addShaderFromSourceFile(QOpenGLShader::Vertex, KoResourcePaths::findResource("data", "krita/shaders/matrix_transform.vert")); result = d->displayShader->addShaderFromSourceFile(QOpenGLShader::Vertex, ":/matrix_transform.vert");
} else { } else {
result = d->displayShader->addShaderFromSourceFile(QOpenGLShader::Vertex, KoResourcePaths::findResource("data", "krita/shaders/matrix_transform_legacy.vert")); result = d->displayShader->addShaderFromSourceFile(QOpenGLShader::Vertex, ":/matrix_transform_legacy.vert");
} }
reportShaderLinkFailedAndExit(result, "Display vertex shader", d->displayShader->log()); reportShaderLinkFailedAndExit(result, "Display vertex shader", d->displayShader->log());
......
...@@ -51,7 +51,7 @@ QString getInstallationPrefix() { ...@@ -51,7 +51,7 @@ QString getInstallationPrefix() {
CFStringGetSystemEncoding()); CFStringGetSystemEncoding());
QString bundlePath = QString::fromLatin1(pathPtr); QString bundlePath = QString::fromLatin1(pathPtr);
qDebug() << "1" << bundlePath << (bundlePath + QString::fromLatin1("/Contents/MacOS/share")); // qDebug() << "1" << bundlePath << (bundlePath + QString::fromLatin1("/Contents/MacOS/share"));
if (QFile(bundlePath + QString::fromLatin1("/Contents/MacOS/share")).exists()) { if (QFile(bundlePath + QString::fromLatin1("/Contents/MacOS/share")).exists()) {
// qDebug() << "running from a deployed bundle"; // qDebug() << "running from a deployed bundle";
bundlePath += QString::fromLatin1("/Contents/MacOS/"); bundlePath += QString::fromLatin1("/Contents/MacOS/");
...@@ -291,7 +291,7 @@ QStringList KoResourcePaths::findAllResourcesInternal(const QString &type, ...@@ -291,7 +291,7 @@ QStringList KoResourcePaths::findAllResourcesInternal(const QString &type,
bool noDuplicates = options & KoResourcePaths::NoDuplicates; bool noDuplicates = options & KoResourcePaths::NoDuplicates;
bool recursive = options & KoResourcePaths::Recursive; bool recursive = options & KoResourcePaths::Recursive;
qDebug() << "findAllResources: type" << type << "filter" << _filter << "no dups" << noDuplicates << "recursive" << recursive; // qDebug() << "findAllResources: type" << type << "filter" << _filter << "no dups" << noDuplicates << "recursive" << recursive;
QStringList aliases = d->aliases(type); QStringList aliases = d->aliases(type);
QString filter = _filter; QString filter = _filter;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment