update resource references to use Qt resource system

This commit is contained in:
Stephen Birarda 2014-03-06 10:41:11 -08:00
parent cc554c53f1
commit 403f91c988
28 changed files with 60 additions and 378 deletions

View file

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="36px" height="36px" viewBox="0 0 36 36" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
<title>close</title>
<description>Created with Sketch (http://www.bohemiancoding.com/sketch)</description>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
<g id="close" sketch:type="MSLayerGroup" transform="translate(2.000000, 2.000000)">
<g id="close-button">
<circle d="M14.8148148,29.6296296 C22.9968115,29.6296296 29.6296296,22.9968115 29.6296296,14.8148148 C29.6296296,6.63281812 22.9968115,0 14.8148148,0 C6.63281812,0 0,6.63281812 0,14.8148148 C0,22.9968115 6.63281812,29.6296296 14.8148148,29.6296296 Z M14.8148148,29.6296296" id="background" fill="#FFFFFF" cx="14.8148148" cy="14.8148148" r="14.8148148"></circle>
<circle d="M15.7036966,30.8654803 C24.0773189,30.8654803 30.8654803,24.0773189 30.8654803,15.7036966 C30.8654803,7.33007426 24.0773189,0.541912889 15.7036966,0.541912889 C7.33007426,0.541912889 0.541912889,7.33007426 0.541912889,15.7036966 C0.541912889,24.0773189 7.33007426,30.8654803 15.7036966,30.8654803 Z M15.7036966,30.8654803" id="circle" stroke="#000000" stroke-width="4" cx="15.7036966" cy="15.7036966" r="15.1617837"></circle>
<path d="M7.5368995,7.83319579 L23.5562405,23.8525368" id="topdown" stroke="#000000" stroke-width="4px" stroke-dasharray="0"></path>
<path d="M8.14743772,23.5562661 L23.592926,8.11077784" id="botup" stroke="#000000" stroke-width="4px" stroke-dasharray="0"></path>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -1,177 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 17.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="124px" height="400px" viewBox="-0.5 0.5 124 400" enable-background="new -0.5 0.5 124 400" xml:space="preserve">
<g>
<g>
<rect x="-0.5" y="120.382" width="62" height="40"/>
</g>
<g>
<g>
<path fill="#999999" d="M13.77,149.864c0.296,0.296,0.665,0.102,0.665,0.102s0.527-0.615,1.101-0.328
c0.811,0.405,1.315-0.113,1.315-0.113l10.611-10.611l-1.419-1.419l-1.161-1.161l-10.61,10.61c0,0-0.575,0.449-0.169,1.261
c0.287,0.573-0.384,1.045-0.384,1.045S13.474,149.569,13.77,149.864"/>
</g>
<g>
<path fill="#CCCCCC" d="M25.913,135.042l2.173-2.173c0,0,1.898-1.905,3.256-0.547c0.68,0.68,1.083,1.627-0.546,3.257
c-1.549,1.548-2.173,2.172-2.173,2.172L25.913,135.042z"/>
</g>
<g>
<rect x="22.984" y="135.651" transform="matrix(-0.7071 -0.7071 0.7071 -0.7071 -52.0828 253.0143)" fill="#CCCCCC" width="6.751" height="3.285"/>
</g>
</g>
<g>
<path fill="#FFFFFF" d="M46.482,138.915h3.697v4.617c-1.004,0.344-2.107,0.516-3.311,0.516c-1.32,0-2.341-0.383-3.062-1.148
s-1.081-1.857-1.081-3.275c0-1.383,0.395-2.459,1.184-3.229s1.895-1.154,3.316-1.154c0.539,0,1.048,0.051,1.526,0.152
s0.896,0.23,1.251,0.387l-0.732,1.816c-0.617-0.305-1.295-0.457-2.033-0.457c-0.676,0-1.198,0.22-1.567,0.659
s-0.554,1.067-0.554,1.884c0,0.801,0.167,1.411,0.501,1.831s0.815,0.63,1.444,0.63c0.344,0,0.66-0.033,0.949-0.1v-1.342h-1.529
L46.482,138.915L46.482,138.915z"/>
</g>
</g>
<g>
<g>
<rect x="-0.5" y="80.5" width="62" height="40"/>
</g>
<g>
<path fill="#FFFFFF" d="M43.84,96.434h2.988c1.164,0,2.028,0.173,2.593,0.519s0.847,0.884,0.847,1.614
c0,0.48-0.123,0.891-0.369,1.23s-0.57,0.559-0.973,0.656v0.059c0.531,0.141,0.916,0.375,1.154,0.703s0.357,0.754,0.357,1.277
c0,0.777-0.292,1.39-0.876,1.837S48.182,105,47.174,105H43.84V96.434z M46.154,99.721h0.697c0.332,0,0.589-0.068,0.771-0.205
s0.272-0.34,0.272-0.609c0-0.48-0.363-0.721-1.09-0.721h-0.65C46.154,98.186,46.154,99.721,46.154,99.721z M46.154,101.414v1.799
h0.814c0.723,0,1.084-0.305,1.084-0.914c0-0.285-0.097-0.504-0.29-0.656s-0.474-0.229-0.841-0.229
C46.921,101.414,46.154,101.414,46.154,101.414z"/>
</g>
<g>
<path fill="#FFFFFF" d="M18,106.06c-3,1-3,3-7,3c2,1,8,4,9,0C20.47,107.181,18,106.06,18,106.06z"/>
<path fill="#CCCCCC" d="M19,105.06l2,2c0,0,3.952-4.712,7-9c3.048-4.287,7.32-10.785,3-7C28.399,93.338,22.048,100.772,19,105.06z
"/>
</g>
</g>
<g>
<g>
<rect x="-0.5" y="40.5" width="62" height="40"/>
</g>
<g>
<g>
<g>
<polygon fill="#A5A5A5" points="26,58.63 39,53.893 39,67.213 26,72.394 "/>
</g>
<g>
<g>
<path fill="#333333" d="M38,54.5v12.59l-12,5.032V58.757l12.204-4.468 M39,53.63l-13,4.873v14.162l13-5.33V53.63L39,53.63z"/>
</g>
</g>
</g>
<g>
<g>
<polygon fill="#BFBFBF" points="13,67.213 13,53.893 25,58.63 25,72.394 "/>
</g>
<g>
<path fill="#BFBFBF" d="M12.887,54.289L25,58.757v13.365L13,67.09V54.5 M13,53.63v13.705l13,5.33V58.503L13,53.63L13,53.63z"/>
</g>
</g>
<g>
<g>
<polygon fill="#FFFFFF" points="13.173,53.63 25.746,48.952 38.318,53.63 25.746,58.309 "/>
</g>
<g>
<path fill="#333333" d="M25.746,49.146l12.049,4.483l-12.049,4.483L13.697,53.63L25.746,49.146 M25.746,48.758L12.65,53.63
l13.096,4.873l13.096-4.873L25.746,48.758L25.746,48.758z"/>
</g>
</g>
</g>
<g>
<path fill="#FFFFFF" d="M46.119,62.383V65.5h-2.314v-8.566h2.807c2.328,0,3.492,0.844,3.492,2.531c0,0.992-0.484,1.76-1.453,2.303
l2.495,3.732h-2.625l-1.816-3.117H46.119z M46.119,60.643h0.434c0.809,0,1.213-0.357,1.213-1.072c0-0.59-0.396-0.885-1.189-0.885
H46.12L46.119,60.643L46.119,60.643z"/>
</g>
<g>
<polygon fill="#333333" points="7,59.5 9,59.5 10,59.5 15,59.5 16,59.5 18,59.5 18,64.5 16,64.5 15,64.5 10,64.5 9,64.5 7,64.5
"/>
<g>
<g>
<rect x="8" y="60.5" fill="#FFFFFF" width="9" height="3"/>
</g>
</g>
</g>
</g>
<g>
<rect x="-0.5" y="0.5" width="62" height="40"/>
</g>
<g>
<g>
<g>
<polygon fill="#A5A5A5" points="26,18.63 39,13.893 39,27.213 26,32.394 "/>
</g>
<g>
<g>
<path fill="#333333" d="M38,14.5v12.59l-12,5.032V18.757l12.204-4.468 M39,13.63l-13,4.873v14.162l13-5.33V13.63L39,13.63z"/>
</g>
</g>
</g>
<g>
<g>
<polygon fill="#BFBFBF" points="13,27.213 13,13.893 25,18.63 25,32.394 "/>
</g>
<g>
<path fill="#BFBFBF" d="M12.887,14.289L25,18.757v13.365L13,27.09V14.5 M13,13.63v13.705l13,5.33V18.503L13,13.63L13,13.63z"/>
</g>
</g>
<g>
<g>
<polygon fill="#FFFFFF" points="13.173,13.63 25.746,8.952 38.318,13.63 25.746,18.309 "/>
</g>
<g>
<path fill="#333333" d="M25.746,9.146l12.049,4.483l-12.049,4.483L13.697,13.63L25.746,9.146 M25.746,8.758L12.65,13.63
l13.096,4.873l13.096-4.873L25.746,8.758L25.746,8.758z"/>
</g>
</g>
</g>
<g>
<path fill="#FFFFFF" d="M48.41,16.934H51L48.193,25.5h-2.725l-2.795-8.566h2.602l1.166,4.342c0.242,0.965,0.375,1.637,0.398,2.016
c0.027-0.273,0.082-0.615,0.164-1.025s0.154-0.732,0.217-0.967L48.41,16.934z"/>
</g>
<g>
<polygon fill="#333333" points="7,19.5 10,19.5 10,16.5 15,16.5 15,19.5 18,19.5 18,24.5 15,24.5 15,27.5 10,27.5 10,24.5 7,24.5
"/>
<g>
<g>
<rect x="11" y="17.5" fill="#FFFFFF" width="3" height="9"/>
</g>
<g>
<rect x="8" y="20.5" fill="#FFFFFF" width="9" height="3"/>
</g>
</g>
</g>
<g>
<g>
<rect x="-0.5" y="160.5" width="62" height="40"/>
</g>
<g>
<path fill="#FFFFFF" d="M50.379,179.205c0,1.441-0.354,2.537-1.061,3.287s-1.742,1.125-3.105,1.125
c-1.344,0-2.374-0.377-3.091-1.131s-1.075-1.852-1.075-3.293c0-1.426,0.356-2.515,1.069-3.267s1.749-1.128,3.108-1.128
c1.363,0,2.396,0.373,3.1,1.119S50.379,177.76,50.379,179.205z M44.484,179.205c0,1.656,0.576,2.484,1.729,2.484
c0.586,0,1.021-0.201,1.304-0.604s0.425-1.029,0.425-1.881c0-0.855-0.144-1.487-0.431-1.896s-0.716-0.612-1.286-0.612
C45.064,176.697,44.484,177.533,44.484,179.205z"/>
</g>
<g>
<g>
<polyline fill="none" stroke="#CCCCCC" stroke-miterlimit="10" points="19.944,187.389 19.944,188.389 19.031,187.981 "/>
<line fill="none" stroke="#CCCCCC" stroke-miterlimit="10" stroke-dasharray="1.9973,1.9973" x1="17.208" y1="187.166" x2="10.825" y2="184.315"/>
<polyline fill="none" stroke="#CCCCCC" stroke-miterlimit="10" points="9.913,183.908 9,183.5 9,182.5 "/>
<line fill="none" stroke="#CCCCCC" stroke-miterlimit="10" stroke-dasharray="2,2" x1="8.5" y1="180.5" x2="8.5" y2="173.5"/>
<polyline fill="none" stroke="#CCCCCC" stroke-miterlimit="10" points="9,172.5 9,171.5 9.927,171.876 "/>
<line fill="none" stroke="#CCCCCC" stroke-miterlimit="10" stroke-dasharray="1.9625,1.9625" x1="11.745" y1="172.615" x2="18.109" y2="175.199"/>
<polyline fill="none" stroke="#CCCCCC" stroke-miterlimit="10" points="19.018,175.568 19.944,175.944 19.944,176.944 "/>
<line fill="none" stroke="#CCCCCC" stroke-miterlimit="10" stroke-dasharray="2,2" x1="19.5" y1="179.5" x2="19.5" y2="186.5"/>
</g>
</g>
<polyline fill="none" stroke="#CCCCCC" stroke-miterlimit="10" stroke-dasharray="2,2" points="19.944,175.944 30,171.5 20,168.5
9,171.5 "/>
<polyline fill="none" stroke="#CCCCCC" stroke-miterlimit="10" stroke-dasharray="2,2" points="20.333,188.611 29.5,183.5
29.5,171.5 "/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 7.5 KiB

View file

@ -15,10 +15,8 @@
<file>icons/voxel.svg</file>
<file>images/body.png</file>
<file>images/close.png</file>
<file>images/close.svg</file>
<file>images/head.png</file>
<file>images/hifi-interface-tools-v2-pie.svg</file>
<file>images/hifi-interface-tools.svg</file>
<file>images/mic.svg</file>
<file>images/mute.svg</file>
<file>images/reset.png</file>
@ -57,7 +55,6 @@
<file>shaders/SkyFromSpace.vert</file>
<file>shaders/vertical_blur_add.frag</file>
<file>shaders/vertical_blur.frag</file>
<file>shaders/voxels.geom</file>
<file>sounds/snap.wav</file>
<file>styles/checked.svg</file>
<file>styles/import_dialog.qss</file>

View file

@ -1,77 +0,0 @@
#version 120
#extension GL_ARB_geometry_shader4 : enable
//
// VOXEL GEOMETRY SHADER
//
// Input: gl_VerticesIn/gl_PositionIn
// GL_POINTS
// Assumes vertex shader has not transformed coordinates
// Each gl_PositionIn is the corner of voxel
// varying voxelSize - which is the voxel size
//
// Note: In vertex shader doesn't do any transform. Therefore passing the 3D world coordinates xyz to us
//
// Output: GL_TRIANGLE_STRIP
//
// Issues:
// how do we need to handle lighting of these colors??
// how do we handle normals?
// check for size=0 and don't output the primitive
//
varying in float voxelSize[1];
const int VERTICES_PER_FACE = 4;
const int COORD_PER_VERTEX = 3;
const int COORD_PER_FACE = COORD_PER_VERTEX * VERTICES_PER_FACE;
void faceOfVoxel(vec4 corner, float scale, float[COORD_PER_FACE] facePoints, vec4 color, vec4 normal) {
for (int v = 0; v < VERTICES_PER_FACE; v++ ) {
vec4 vertex = corner;
for (int c = 0; c < COORD_PER_VERTEX; c++ ) {
int cIndex = c + (v * COORD_PER_VERTEX);
vertex[c] += (facePoints[cIndex] * scale);
}
gl_FrontColor = color * (gl_LightModel.ambient + gl_LightSource[0].ambient +
gl_LightSource[0].diffuse * max(0.0, dot(normal, gl_LightSource[0].position)));
gl_Position = gl_ModelViewProjectionMatrix * vertex;
EmitVertex();
}
EndPrimitive();
}
void main() {
//increment variable
int i;
vec4 corner;
float scale;
float bottomFace[COORD_PER_FACE] = float[COORD_PER_FACE]( 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1 );
float topFace[COORD_PER_FACE] = float[COORD_PER_FACE]( 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1 );
float rightFace[COORD_PER_FACE] = float[COORD_PER_FACE]( 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1 );
float leftFace[COORD_PER_FACE] = float[COORD_PER_FACE]( 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1 );
float frontFace[COORD_PER_FACE] = float[COORD_PER_FACE]( 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0 );
float backFace[COORD_PER_FACE] = float[COORD_PER_FACE]( 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1 );
vec4 bottomNormal = vec4(0.0, -1, 0.0, 0.0);
vec4 topNormal = vec4(0.0, 1, 0.0, 0.0);
vec4 rightNormal = vec4( -1, 0.0, 0.0, 0.0);
vec4 leftNormal = vec4( 1, 0.0, 0.0, 0.0);
vec4 frontNormal = vec4(0.0, 0.0, -1, 0.0);
vec4 backNormal = vec4(0.0, 0.0, 1, 0.0);
for(i = 0; i < gl_VerticesIn; i++) {
corner = gl_PositionIn[i];
scale = voxelSize[i];
faceOfVoxel(corner, scale, bottomFace, gl_FrontColorIn[i], bottomNormal);
faceOfVoxel(corner, scale, topFace, gl_FrontColorIn[i], topNormal );
faceOfVoxel(corner, scale, rightFace, gl_FrontColorIn[i], rightNormal );
faceOfVoxel(corner, scale, leftFace, gl_FrontColorIn[i], leftNormal );
faceOfVoxel(corner, scale, frontFace, gl_FrontColorIn[i], frontNormal );
faceOfVoxel(corner, scale, backFace, gl_FrontColorIn[i], backNormal );
}
}

View file

@ -63,17 +63,17 @@ QPushButton#cancelButton {
}
#backButton {
background-image: url(resources/icons/backButton.svg);
background-image: url(qrc://icons/backButton.svg);
border-radius: 0px;
}
#forwardButton {
background-image: url(resources/icons/forwardButton.svg);
background-image: url(qrc://icons/forwardButton.svg);
border-radius: 0px;
}
#toParentButton {
background-image: url(resources/icons/toParentButton.svg);
background-image: url(qrc://icons/toParentButton.svg);
border-radius: 0px;
}

View file

@ -21,7 +21,7 @@ QLineEdit {
}
QPushButton#searchButton {
background: url(resources/styles/search.svg);
background: url(qrc://styles/search.svg);
background-repeat: none;
background-position: left center;
background-origin: content;
@ -33,7 +33,7 @@ QPushButton#searchButton {
}
QPushButton#revealLogButton {
background: url(resources/styles/txt-file.svg);
background: url(qrc://styles/txt-file.svg);
background-repeat: none;
background-position: left center;
background-origin: content;
@ -50,9 +50,9 @@ QCheckBox {
}
QCheckBox::indicator:unchecked {
image: url(resources/styles/unchecked.svg);
image: url(qrc://styles/unchecked.svg);
}
QCheckBox::indicator:checked {
image: url(resources/styles/checked.svg);
image: url(qrc://styles/checked.svg);
}

View file

@ -153,10 +153,8 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
_resetRecentMaxPacketsSoon(true),
_logger(new FileLogger(this))
{
switchToResourcesParentIfRequired();
// read the ApplicationInfo.ini file for Name/Version/Domain information
QSettings applicationInfo("resources/info/ApplicationInfo.ini", QSettings::IniFormat);
QSettings applicationInfo(":/info/ApplicationInfo.ini", QSettings::IniFormat);
// set the associated application properties
applicationInfo.beginGroup("INFO");
@ -174,7 +172,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
_applicationStartupTime = startup_time;
QFontDatabase::addApplicationFont("resources/styles/Inconsolata.otf");
QFontDatabase::addApplicationFont(":/styles/Inconsolata.otf");
_window->setWindowTitle("Interface");
qInstallMessageHandler(messageHandler);
@ -284,9 +282,6 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
restoreSizeAndPosition();
QFontDatabase fontDatabase;
fontDatabase.addApplicationFont("resources/styles/Inconsolata.otf");
_window->setVisible(true);
_glWidget->setFocusPolicy(Qt::StrongFocus);
_glWidget->setFocus();
@ -1571,7 +1566,7 @@ void Application::init() {
ScriptEngine::getParticlesScriptingInterface(),
SLOT(forwardParticleCollisionWithParticle(const ParticleID&, const ParticleID&, const glm::vec3&)));
_pieMenu.init("./resources/images/hifi-interface-tools-v2-pie.svg",
_pieMenu.init(":/images/hifi-interface-tools-v2-pie.svg",
_glWidget->width(),
_glWidget->height());
@ -3652,9 +3647,8 @@ void Application::skipVersion(QString latestVersion) {
}
void Application::takeSnapshot() {
switchToResourcesParentIfRequired();
QMediaPlayer* player = new QMediaPlayer();
QFileInfo inf = QFileInfo("resources/sounds/snap.wav");
QFileInfo inf = QFileInfo(":/sounds/snap.wav");
player->setMedia(QUrl::fromLocalFile(inf.absoluteFilePath()));
player->play();

View file

@ -88,9 +88,8 @@ Audio::Audio(Oscilloscope* scope, int16_t initialJitterBufferSamples, QObject* p
}
void Audio::init(QGLWidget *parent) {
switchToResourcesParentIfRequired();
_micTextureId = parent->bindTexture(QImage("./resources/images/mic.svg"));
_muteTextureId = parent->bindTexture(QImage("./resources/images/mute.svg"));
_micTextureId = parent->bindTexture(QImage(":/images/mic.svg"));
_muteTextureId = parent->bindTexture(QImage(":/images/mute.svg"));
}
void Audio::reset() {

View file

@ -44,7 +44,6 @@ void Environment::init() {
return;
}
switchToResourcesParentIfRequired();
_skyFromAtmosphereProgram = createSkyProgram("Atmosphere", _skyFromAtmosphereUniformLocations);
_skyFromSpaceProgram = createSkyProgram("Space", _skyFromSpaceUniformLocations);
@ -174,7 +173,7 @@ int Environment::parseData(const HifiSockAddr& senderAddress, const QByteArray&
ProgramObject* Environment::createSkyProgram(const char* from, int* locations) {
ProgramObject* program = new ProgramObject();
QByteArray prefix = QByteArray("resources/shaders/SkyFrom") + from;
QByteArray prefix = QByteArray(":/shaders/SkyFrom") + from;
program->addShaderFromSourceFile(QGLShader::Vertex, prefix + ".vert");
program->addShaderFromSourceFile(QGLShader::Fragment, prefix + ".frag");
program->link();

View file

@ -27,8 +27,6 @@ const int SECOND_INDEX_LETTER = 1;
QIcon HiFiIconProvider::icon(QFileIconProvider::IconType type) const {
switchToResourcesParentIfRequired();
// types
// Computer, Desktop, Trashcan, Network, Drive, Folder, File
QString typeString;
@ -54,30 +52,29 @@ QIcon HiFiIconProvider::icon(QFileIconProvider::IconType type) const {
break;
}
return QIcon("resources/icons/" + typeString + ".svg");
return QIcon(":/icons/" + typeString + ".svg");
}
QIcon HiFiIconProvider::icon(const QFileInfo &info) const {
switchToResourcesParentIfRequired();
const QString ext = info.suffix().toLower();
if (info.isDir()) {
if (info.absoluteFilePath() == QDir::homePath()) {
return QIcon("resources/icons/home.svg");
return QIcon(":/icons/home.svg");
} else if (info.absoluteFilePath() == QStandardPaths::writableLocation(QStandardPaths::DesktopLocation)) {
return QIcon("resources/icons/desktop.svg");
return QIcon(":/icons/desktop.svg");
} else if (info.absoluteFilePath() == QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)) {
return QIcon("resources/icons/documents.svg");
return QIcon(":/icons/documents.svg");
}
return QIcon("resources/icons/folder.svg");
return QIcon(":/icons/folder.svg");
}
QFileInfo iconFile("resources/icons/" + iconsMap[ext]);
QFileInfo iconFile(":/icons/" + iconsMap[ext]);
if (iconFile.exists() && iconFile.isFile()) {
return QIcon(iconFile.filePath());
}
return QIcon("resources/icons/file.svg");
return QIcon(":/icons/file.svg");
}
QString HiFiIconProvider::type(const QFileInfo &info) const {
@ -245,8 +242,7 @@ void ImportDialog::setLayout() {
widget = findChild<QWidget*>("treeView");
widget->setAttribute(Qt::WA_MacShowFocusRect, false);
switchToResourcesParentIfRequired();
QFile styleSheet("resources/styles/import_dialog.qss");
QFile styleSheet(":/styles/import_dialog.qss");
if (styleSheet.open(QIODevice::ReadOnly)) {
setStyleSheet(styleSheet.readAll());
}
@ -254,9 +250,7 @@ void ImportDialog::setLayout() {
}
void ImportDialog::setImportTypes() {
switchToResourcesParentIfRequired();
QFile config("resources/config/config.json");
QFile config(":/config/config.json");
config.open(QFile::ReadOnly | QFile::Text);
QJsonDocument document = QJsonDocument::fromJson(config.readAll());
if (!document.isNull() && !document.isEmpty()) {

View file

@ -18,12 +18,11 @@
#define MAX_DIALOG_HEIGHT_RATIO 0.9
InfoView::InfoView(bool forced) :
_forced(forced) {
_forced(forced)
{
setWindowFlags(Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint);
switchToResourcesParentIfRequired();
QString absPath = QFileInfo("resources/html/interface-welcome-allsvg.html").absoluteFilePath();
QString absPath = QFileInfo(":/html/interface-welcome-allsvg.html").absoluteFilePath();
QUrl url = QUrl::fromLocalFile(absPath);
load(url);

View file

@ -30,8 +30,7 @@ MetavoxelSystem::MetavoxelSystem() :
void MetavoxelSystem::init() {
if (!_program.isLinked()) {
switchToResourcesParentIfRequired();
_program.addShaderFromSourceFile(QGLShader::Vertex, "resources/shaders/metavoxel_point.vert");
_program.addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/metavoxel_point.vert");
_program.link();
_pointScaleLocation = _program.uniformLocation("pointScale");

View file

@ -25,7 +25,6 @@ PieMenu::PieMenu() :
void PieMenu::init(const char *fileName, int screenWidth, int screenHeight) {
// Load SVG
switchToResourcesParentIfRequired();
QSvgRenderer renderer((QString) QString(fileName));
// Prepare a QImage with desired characteritisc

View file

@ -496,16 +496,15 @@ void VoxelSystem::initVoxelMemory() {
// create our simple fragment shader if we're the first system to init
if (!_perlinModulateProgram.isLinked()) {
switchToResourcesParentIfRequired();
_perlinModulateProgram.addShaderFromSourceFile(QGLShader::Vertex, "resources/shaders/perlin_modulate.vert");
_perlinModulateProgram.addShaderFromSourceFile(QGLShader::Fragment, "resources/shaders/perlin_modulate.frag");
_perlinModulateProgram.addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/perlin_modulate.vert");
_perlinModulateProgram.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/perlin_modulate.frag");
_perlinModulateProgram.link();
_perlinModulateProgram.bind();
_perlinModulateProgram.setUniformValue("permutationNormalTexture", 0);
_perlinModulateProgram.release();
_shadowMapProgram.addShaderFromSourceFile(QGLShader::Fragment, "resources/shaders/shadow_map.frag");
_shadowMapProgram.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/shadow_map.frag");
_shadowMapProgram.link();
_shadowMapProgram.bind();

View file

@ -577,13 +577,13 @@ bool Avatar::findParticleCollisions(const glm::vec3& particleCenter, float parti
void Avatar::setFaceModelURL(const QUrl& faceModelURL) {
AvatarData::setFaceModelURL(faceModelURL);
const QUrl DEFAULT_FACE_MODEL_URL = QUrl::fromLocalFile("resources/meshes/defaultAvatar_head.fst");
const QUrl DEFAULT_FACE_MODEL_URL = QUrl::fromLocalFile(":/meshes/defaultAvatar_head.fst");
getHead()->getFaceModel().setURL(_faceModelURL, DEFAULT_FACE_MODEL_URL, true, !isMyAvatar());
}
void Avatar::setSkeletonModelURL(const QUrl& skeletonModelURL) {
AvatarData::setSkeletonModelURL(skeletonModelURL);
const QUrl DEFAULT_SKELETON_MODEL_URL = QUrl::fromLocalFile("resources/meshes/defaultAvatar_body.fst");
const QUrl DEFAULT_SKELETON_MODEL_URL = QUrl::fromLocalFile(":/meshes/defaultAvatar_body.fst");
_skeletonModel.setURL(_skeletonModelURL, DEFAULT_SKELETON_MODEL_URL, true, !isMyAvatar());
}

View file

@ -57,8 +57,7 @@ void OculusManager::connect() {
_hmdDevice->GetDeviceInfo(&info);
_stereoConfig.SetHMDInfo(info);
switchToResourcesParentIfRequired();
_program.addShaderFromSourceFile(QGLShader::Fragment, "resources/shaders/oculus.frag");
_program.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/oculus.frag");
_program.link();
_textureLocation = _program.uniformLocation("texture");

View file

@ -36,10 +36,9 @@ Visage::Visage() :
_estimatedEyeYaw(0.0f) {
#ifdef HAVE_VISAGE
switchToResourcesParentIfRequired();
QByteArray licensePath = "resources/visage/license.vlc";
QByteArray licensePath = ":/visage/license.vlc";
initializeLicenseManager(licensePath.data());
_tracker = new VisageTracker2("resources/visage/Facial Features Tracker - Asymmetric.cfg");
_tracker = new VisageTracker2(":/visage/Facial Features Tracker - Asymmetric.cfg");
if (_tracker->trackFromCam()) {
_data = new FaceData();

View file

@ -25,11 +25,10 @@ const int ROTATION_WIDTH = 4;
const int ROTATION_HEIGHT = 4;
void AmbientOcclusionEffect::init() {
switchToResourcesParentIfRequired();
_occlusionProgram = new ProgramObject();
_occlusionProgram->addShaderFromSourceFile(QGLShader::Vertex, "resources/shaders/ambient_occlusion.vert");
_occlusionProgram->addShaderFromSourceFile(QGLShader::Fragment, "resources/shaders/ambient_occlusion.frag");
_occlusionProgram->addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/ambient_occlusion.vert");
_occlusionProgram->addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/ambient_occlusion.frag");
_occlusionProgram->link();
// create the sample kernel: an array of spherically distributed offset vectors
@ -78,8 +77,8 @@ void AmbientOcclusionEffect::init() {
glBindTexture(GL_TEXTURE_2D, 0);
_blurProgram = new ProgramObject();
_blurProgram->addShaderFromSourceFile(QGLShader::Vertex, "resources/shaders/ambient_occlusion.vert");
_blurProgram->addShaderFromSourceFile(QGLShader::Fragment, "resources/shaders/occlusion_blur.frag");
_blurProgram->addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/ambient_occlusion.vert");
_blurProgram->addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/occlusion_blur.frag");
_blurProgram->link();
_blurProgram->bind();

View file

@ -42,7 +42,7 @@ QOpenGLFramebufferObject* GlowEffect::getFreeFramebufferObject() const {
static ProgramObject* createProgram(const QString& name) {
ProgramObject* program = new ProgramObject();
program->addShaderFromSourceFile(QGLShader::Fragment, "resources/shaders/" + name + ".frag");
program->addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/" + name + ".frag");
program->link();
program->bind();
@ -57,8 +57,6 @@ void GlowEffect::init() {
qDebug("[ERROR] GlowEffeect is already initialized.");
return;
}
switchToResourcesParentIfRequired();
_addProgram = createProgram("glow_add");
_horizontalBlurProgram = createProgram("horizontal_blur");

View file

@ -64,17 +64,16 @@ QVector<Model::JointState> Model::createJointStates(const FBXGeometry& geometry)
void Model::init() {
if (!_program.isLinked()) {
switchToResourcesParentIfRequired();
_program.addShaderFromSourceFile(QGLShader::Vertex, "resources/shaders/model.vert");
_program.addShaderFromSourceFile(QGLShader::Fragment, "resources/shaders/model.frag");
_program.addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/model.vert");
_program.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/model.frag");
_program.link();
_program.bind();
_program.setUniformValue("texture", 0);
_program.release();
_normalMapProgram.addShaderFromSourceFile(QGLShader::Vertex, "resources/shaders/model_normal_map.vert");
_normalMapProgram.addShaderFromSourceFile(QGLShader::Fragment, "resources/shaders/model_normal_map.frag");
_normalMapProgram.addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/model_normal_map.vert");
_normalMapProgram.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/model_normal_map.frag");
_normalMapProgram.link();
_normalMapProgram.bind();
@ -83,14 +82,14 @@ void Model::init() {
_normalMapTangentLocation = _normalMapProgram.attributeLocation("tangent");
_normalMapProgram.release();
_skinProgram.addShaderFromSourceFile(QGLShader::Vertex, "resources/shaders/skin_model.vert");
_skinProgram.addShaderFromSourceFile(QGLShader::Fragment, "resources/shaders/model.frag");
_skinProgram.addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/skin_model.vert");
_skinProgram.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/model.frag");
_skinProgram.link();
initSkinProgram(_skinProgram, _skinLocations);
_skinNormalMapProgram.addShaderFromSourceFile(QGLShader::Vertex, "resources/shaders/skin_model_normal_map.vert");
_skinNormalMapProgram.addShaderFromSourceFile(QGLShader::Fragment, "resources/shaders/model_normal_map.frag");
_skinNormalMapProgram.addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/skin_model_normal_map.vert");
_skinNormalMapProgram.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/model_normal_map.frag");
_skinNormalMapProgram.link();
initSkinProgram(_skinNormalMapProgram, _skinNormalMapLocations);

View file

@ -29,7 +29,7 @@ PointShader::~PointShader() {
ProgramObject* PointShader::createPointShaderProgram(const QString& name) {
ProgramObject* program = new ProgramObject();
program->addShaderFromSourceFile(QGLShader::Vertex, "resources/shaders/" + name + ".vert" );
program->addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/" + name + ".vert" );
program->link();
return program;
}
@ -39,7 +39,6 @@ void PointShader::init() {
qDebug("[ERROR] PointShader is already initialized.");
return;
}
switchToResourcesParentIfRequired();
_program = createPointShaderProgram("point_size");
_initialized = true;
}

View file

@ -106,7 +106,6 @@ GLuint TextureCache::getBlueTextureID() {
GLuint TextureCache::getFileTextureID(const QString& filename) {
GLuint id = _fileTextureIDs.value(filename);
if (id == 0) {
switchToResourcesParentIfRequired();
QImage image = QImage(filename).convertToFormat(QImage::Format_ARGB32);
glGenTextures(1, &id);

View file

@ -29,8 +29,8 @@ VoxelShader::~VoxelShader() {
ProgramObject* VoxelShader::createGeometryShaderProgram(const QString& name) {
ProgramObject* program = new ProgramObject();
program->addShaderFromSourceFile(QGLShader::Vertex, "resources/shaders/passthrough.vert" );
program->addShaderFromSourceFile(QGLShader::Geometry, "resources/shaders/" + name + ".geom" );
program->addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/passthrough.vert" );
program->addShaderFromSourceFile(QGLShader::Geometry, ":/shaders/" + name + ".geom" );
program->setGeometryInputType(GL_POINTS);
program->setGeometryOutputType(GL_TRIANGLE_STRIP);
const int VERTICES_PER_FACE = 4;
@ -46,7 +46,7 @@ void VoxelShader::init() {
qDebug("[ERROR] TestProgram is already initialized.");
return;
}
switchToResourcesParentIfRequired();
_program = createGeometryShaderProgram("voxel");
_initialized = true;
}

View file

@ -36,8 +36,7 @@ LogDialog::LogDialog(QWidget* parent, AbstractLoggerInterface* logger) : QDialog
setWindowTitle("Log");
setAttribute(Qt::WA_DeleteOnClose);
switchToResourcesParentIfRequired();
QFile styleSheet("resources/styles/log_dialog.qss");
QFile styleSheet(":/styles/log_dialog.qss");
if (styleSheet.open(QIODevice::ReadOnly)) {
setStyleSheet(styleSheet.readAll());
}

View file

@ -113,8 +113,8 @@ MetavoxelEditor::MetavoxelEditor() :
if (_gridProgram.isLinked()) {
return;
}
switchToResourcesParentIfRequired();
_gridProgram.addShaderFromSourceFile(QGLShader::Fragment, "resources/shaders/grid.frag");
_gridProgram.addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/grid.frag");
_gridProgram.link();
}

View file

@ -23,12 +23,11 @@ RearMirrorTools::RearMirrorTools(QGLWidget* parent, QRect& bounds, QSettings* se
_windowed(false),
_fullScreen(false)
{
_zoomLevel = HEAD,
switchToResourcesParentIfRequired();
_closeTextureId = _parent->bindTexture(QImage("./resources/images/close.png"));
_resetTextureId = _parent->bindTexture(QImage("./resources/images/reset.png"));
_zoomHeadTextureId = _parent->bindTexture(QImage("./resources/images/head.png"));
_zoomBodyTextureId = _parent->bindTexture(QImage("./resources/images/body.png"));
_zoomLevel = HEAD;
_closeTextureId = _parent->bindTexture(QImage(":/images/close.png"));
_resetTextureId = _parent->bindTexture(QImage(":/images/reset.png"));
_zoomHeadTextureId = _parent->bindTexture(QImage(":/images/head.png"));
_zoomBodyTextureId = _parent->bindTexture(QImage(":/images/body.png"));
_shrinkIconRect = QRect(ICON_PADDING, ICON_PADDING, ICON_SIZE, ICON_SIZE);
_closeIconRect = QRect(_bounds.left() + ICON_PADDING, _bounds.top() + ICON_PADDING, ICON_SIZE, ICON_SIZE);

View file

@ -198,21 +198,6 @@ bool isInEnvironment(const char* environment) {
}
}
void switchToResourcesParentIfRequired() {
#ifdef __APPLE__
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
char path[PATH_MAX];
if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX)) {
// error!
}
CFRelease(resourcesURL);
chdir(path);
chdir("..");
#endif
}
void loadRandomIdentifier(unsigned char* identifierBuffer, int numBytes) {
// seed the the random number generator
srand(time(NULL));

View file

@ -93,8 +93,6 @@ int getNthBit(unsigned char byte, int ordinal); /// determines the bit placement
bool isInEnvironment(const char* environment);
void switchToResourcesParentIfRequired();
void loadRandomIdentifier(unsigned char* identifierBuffer, int numBytes);
const char* getCmdOption(int argc, const char * argv[],const char* option);