14#include "../../vuo.pch"
26int main(
int argc,
char *argv[])
35 qputenv(
"QT_MAC_WANTS_LAYER",
"1");
47 auto qmlDir = QFileInfo(argv[0]).absoluteDir();
49 chmod(qmlDir.absolutePath().toUtf8().data(), 0555);
50 QDirIterator qdi(qmlDir, QDirIterator::Subdirectories);
53 QFileInfo f(qdi.next());
54 if (!f.isDir() || f.fileName() ==
"." || f.fileName() ==
"..")
56 chmod(f.absoluteFilePath().toUtf8().data(), 0555);
62 Q_INIT_RESOURCE(VuoEditorApp);
64 bool doPrintHelp =
false;
65 bool doOpenRecent =
false;
66 bool doOpenRandom =
false;
67 QString doOpenTemplate;
72 char ** getoptArgV = (
char **)malloc(
sizeof(
char *) * argc);
73 for(
int i=0;i<argc;++i)
76 if (strncmp(argv[i],
"-psn_", 5) == 0)
80 if (strlen(argv[i]) >= 2
85 getoptArgV[getoptArgC++] = argv[i];
88 static struct option options[] = {
89 {
"help", no_argument, NULL, 0},
90 {
"draw-bounding-rects", no_argument, NULL, 0},
91 {
"generate-docs", required_argument, NULL, 0},
92 {
"open-recent", no_argument, NULL, 0},
93 {
"open-random", no_argument, NULL, 0},
94 {
"run", no_argument, NULL, 0},
95 {
"quit", no_argument, NULL, 0},
96 {
"template", required_argument, NULL, 0},
97 {NULL, no_argument, NULL, 0}
101 while ((ret = getopt_long(getoptArgC, getoptArgV,
"", options, &optionIndex)) != -1)
130 doOpenTemplate = optarg;
133 VUserLog(
"Error: Unknown option %d.", optionIndex);
141 printf(
"Usage: %s [options] [composition file(s)]\n"
143 " --help Display this information.\n"
144 " --draw-bounding-rects Draws red bounding rectangles around items in the composition canvas. Useful for debugging canvas interaction.\n"
145 " --generate-docs <dir> Saves the full collection of node class and node set documentation in <dir>, then exits.\n"
146 " --open-recent Reopens the most recent composition.\n"
147 " --open-random Opens a random example composition.\n"
148 " --template <template> Opens a new composition with the specified template.\n"
149 " E.g., \"--template VuoImageTransition\".\n"
150 " See Vuo.app/Contents/Frameworks/Vuo.framework/Resources/*.vuo for a full list.\n"
151 " --run Starts all open compositions running.\n"
152 " --quit Exits after optionally opening and running compositions. Useful for testing performance.\n",
164 QPixmapCache::setCacheLimit(512 * 1024);
169 v.openMostRecentFile();
174 if (!doOpenTemplate.isEmpty())
176 QAction *templateAction =
new QAction(
nullptr);
181 templateAction->setData(QVariant::fromValue(protocol));
186 templateAction->setData(doOpenTemplate);
190 QTimer::singleShot(0, templateAction, &QAction::trigger);
194 for (
int i = optind; i < getoptArgC; ++i)
206 QTimer::singleShot(0, ^{
217 QTimer::singleShot(0, &v, &QApplication::closeAllWindows);
218 QTimer::singleShot(0, &v, &QApplication::quit);