-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgpodder.cpp
50 lines (47 loc) · 1.22 KB
/
gpodder.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
* gPodder for Windows
* 2014-02-22 Thomas Perl <thp.io/about>
* All rights reserved.
**/
#include <QGuiApplication>
#include <QQuickView>
#include <QQmlEngine>
#include <QQmlError>
#include <QDir>
#include <QFile>
#include <QDebug>
static QUrl findResource(QString root, QString filename)
{
QDir d(root);
foreach (QString entry, d.entryList()) {
QString path = d.filePath(entry);
if (QDir(path).exists()) {
QUrl candidate = findResource(path, filename);
if (candidate.isValid()) {
return candidate;
}
} else {
if (path.endsWith("/" + filename)) {
return QUrl("qrc" + path);
}
}
}
return QUrl();
}
int main(int argc, char *argv[])
{
_putenv("PYTHONPATH=gpodder.zip");
QGuiApplication app(argc, argv);
QQuickView view;
view.setResizeMode(QQuickView::SizeRootObjectToView);
QUrl url = findResource(":/", "gpodder.qml");
qDebug() << url;
view.setSource(url);
foreach (QQmlError error, view.errors()) {
FILE *fp = fopen("errors.txt", "a");
fprintf(fp, "%s\n", qPrintable(error.toString()));
fclose(fp);
}
view.show();
return app.exec();
}