summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-04-30 06:42:28 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-04-30 06:42:28 (GMT)
commit0e664dabc5b7325634e54d120eb374940497ca0f (patch)
treece0daf624d950dbda4412e1be3fd2268a08f1613 /tools
parentcc4c8562890784e1b4ca55612f8963e59f2e6bce (diff)
downloadQt-0e664dabc5b7325634e54d120eb374940497ca0f.zip
Qt-0e664dabc5b7325634e54d120eb374940497ca0f.tar.gz
Qt-0e664dabc5b7325634e54d120eb374940497ca0f.tar.bz2
Support stdin
Diffstat (limited to 'tools')
-rw-r--r--tools/qmlconv/qmlconv.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/tools/qmlconv/qmlconv.cpp b/tools/qmlconv/qmlconv.cpp
index 3ba40a4..3457a4f 100644
--- a/tools/qmlconv/qmlconv.cpp
+++ b/tools/qmlconv/qmlconv.cpp
@@ -442,24 +442,26 @@ int main(int argc, char *argv[])
QStringList args = a.arguments();
args.removeFirst();
-again:
- if (args.isEmpty()) {
- qWarning() << "Usage: qmlconf [-i] filename";
- exit(1);
- }
-
- if (args.first() == QLatin1String("-i")) {
+ if (!args.isEmpty() && args.first() == QLatin1String("-i")) {
optionInPlace = true;
args.removeFirst();
- goto again;
}
- const QString fileName = args.first();
+ if (args.isEmpty() && optionInPlace) {
+ qWarning() << "Usage: qmlconf [ [-i] filename ]";
+ exit(1);
+ }
+
+ const QString fileName = args.isEmpty() ? QString("-") : args.first();
QFile file(fileName);
- if (! file.open(QIODevice::ReadOnly)) {
- qWarning() << "qmlconv: no input file";
- exit(1);
+ if (fileName == "-") {
+ file.open(0,QIODevice::ReadOnly);
+ } else {
+ if (! file.open(QIODevice::ReadOnly)) {
+ qWarning() << "qmlconv: no input file";
+ exit(1);
+ }
}
Reader r(&file);