Graphviz 13.0.0~dev.20250210.0415
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1
6/*************************************************************************
7 * Copyright (c) 2011 AT&T Intellectual Property
8 * All rights reserved. This program and the accompanying materials
9 * are made available under the terms of the Eclipse Public License v1.0
10 * which accompanies this distribution, and is available at
11 * https://www.eclipse.org/legal/epl-v10.html
12 *
13 * Contributors: Details at https://graphviz.org
14 *************************************************************************/
15
16#include "config.h"
17
18#ifdef _WIN32
19#include "windows.h"
20#endif
21#include "mainwindow.h"
22#include <QApplication>
23#include <QCommandLineParser>
24#include <QFile>
25#include <common/globals.h>
26#include <gvc/gvc.h>
27#include <stdio.h>
28
29QTextStream errout(stderr, QIODevice::WriteOnly);
30
31int main(int argc, char *argv[]) {
32 Q_INIT_RESOURCE(mdi);
33
34 QStringList files;
35 {
36 // Scoped QCoreApplication for when X11 DISPLAY is not available
37 QCoreApplication app(argc, argv);
38
39 QCommandLineParser parser;
40 parser.setApplicationDescription(
41 QStringLiteral("gvedit - simple graph editor and viewer"));
42 parser.addPositionalArgument(
43 QStringLiteral("files"),
44 QCoreApplication::translate("main", "files to open."),
45 QStringLiteral("[files...]"));
46
47 const QCommandLineOption helpOption(
48 {
49 QStringLiteral("?"),
50 QStringLiteral("h"),
51 QStringLiteral("help"),
52 },
53 QCoreApplication::translate("main",
54 "Displays help on commandline options."));
55 parser.addOption(helpOption);
56
57 const QCommandLineOption scaleInputBy72Option(
58 {
59 QStringLiteral("s"),
60 QStringLiteral("scale-input-by-72"),
61 },
62 QCoreApplication::translate("main", "Scale input by 72"));
63 parser.addOption(scaleInputBy72Option);
64
65 const QCommandLineOption verboseOption(
66 {
67 QStringLiteral("v"),
68 QStringLiteral("verbose"),
69 },
70 QCoreApplication::translate("main", "Verbose mode"));
71 parser.addOption(verboseOption);
72
73 if (!parser.parse(app.arguments())) {
74 parser.showHelp(1);
75 }
76
77 if (parser.isSet(helpOption)) {
78 parser.showHelp(0);
79 }
80
81 if (parser.isSet(scaleInputBy72Option)) {
83 }
84
85 if (parser.isSet(verboseOption)) {
86 Verbose = 1;
87 }
88
89 files = parser.positionalArguments();
90 }
91
92 QApplication app(argc, argv);
93
94 CMainWindow mainWin(files);
95 mainWin.show();
96 const int ret = app.exec();
97 graphviz_exit(ret);
98}
99
static NORETURN void graphviz_exit(int status)
Definition exit.h:23
#define POINTS_PER_INCH
Definition geom.h:58
double PSinputscale
Definition globals.h:56
static bool Verbose
Definition gml2gv.c:23
Graphviz context library.
QTextStream errout
int main()