summaryrefslogtreecommitdiffstats
path: root/tools/qmlviewer
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-06-02 01:27:58 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-06-02 01:27:58 (GMT)
commit1d53f42ed958b6f7c38b47272b43701c4e8ed487 (patch)
tree3ad757b1758adc642f9a3fd66bead928cbf86787 /tools/qmlviewer
parentf15f932216870653f03e5a9a408621a1d9c3a6a7 (diff)
downloadQt-1d53f42ed958b6f7c38b47272b43701c4e8ed487.zip
Qt-1d53f42ed958b6f7c38b47272b43701c4e8ed487.tar.gz
Qt-1d53f42ed958b6f7c38b47272b43701c4e8ed487.tar.bz2
Simplify setting default graphicssystem.
Diffstat (limited to 'tools/qmlviewer')
-rw-r--r--tools/qmlviewer/main.cpp50
1 files changed, 20 insertions, 30 deletions
diff --git a/tools/qmlviewer/main.cpp b/tools/qmlviewer/main.cpp
index ca98dbf..ed700a0 100644
--- a/tools/qmlviewer/main.cpp
+++ b/tools/qmlviewer/main.cpp
@@ -50,28 +50,18 @@ void usage()
int main(int argc, char ** argv)
{
//### default to using raster graphics backend for now
- int newargc = argc + 2;
- char **newargv;
bool gsSpecified = false;
for (int i = 0; i < argc; ++i) {
- if (!qstrcmp(argv[i], "-graphicssystem")) {
+ QString arg = argv[i];
+ if (arg == "-graphicssystem") {
gsSpecified = true;
- newargc -= 2;
break;
}
}
- newargv = new char * [newargc];
- for (int i = 0; i < argc; ++i) {
- newargv[i] = argv[i];
- }
- if (!gsSpecified) {
- char system[] = "-graphicssystem";
- newargv[argc] = system;
- char raster[] = "raster";
- newargv[argc+1] = raster;
- }
+ if (!gsSpecified)
+ QApplication::setGraphicsSystem("raster");
- QApplication app(newargc, newargv);
+ QApplication app(argc, argv);
app.setApplicationName("viewer");
bool frameless = false;
@@ -90,24 +80,24 @@ int main(int argc, char ** argv)
QString testDir;
QString translationFile;
- for (int i = 1; i < newargc; ++i) {
- QString arg = newargv[i];
+ for (int i = 1; i < argc; ++i) {
+ QString arg = argv[i];
if (arg == "-frameless") {
frameless = true;
} else if (arg == "-skin") {
- skin = QString(newargv[++i]);
+ skin = QString(argv[++i]);
} else if (arg == "-cache") {
cache = true;
} else if (arg == "-recordperiod") {
- period = QString(newargv[++i]).toInt();
+ period = QString(argv[++i]).toInt();
} else if (arg == "-recordfile") {
- recordfile = QString(newargv[++i]);
+ recordfile = QString(argv[++i]);
} else if (arg == "-record") {
- recordargs << QString(newargv[++i]);
+ recordargs << QString(argv[++i]);
} else if (arg == "-recorddither") {
- dither = QString(newargv[++i]);
+ dither = QString(argv[++i]);
} else if (arg == "-autorecord") {
- QString range = QString(newargv[++i]);
+ QString range = QString(argv[++i]);
int dash = range.indexOf('-');
if (dash > 0)
autorecord_from = range.left(dash).toInt();
@@ -116,26 +106,26 @@ int main(int argc, char ** argv)
devkeys = true;
} else if (arg == "-recordtest") {
testMode = QFxTestEngine::RecordTest;
- if(i + 1 >= newargc)
+ if(i + 1 >= argc)
usage();
- testDir = newargv[i + 1];
+ testDir = argv[i + 1];
++i;
} else if (arg == "-runtest") {
testMode = QFxTestEngine::PlaybackTest;
- if(i + 1 >= newargc)
+ if(i + 1 >= argc)
usage();
- testDir = newargv[i + 1];
+ testDir = argv[i + 1];
++i;
} else if (arg == QLatin1String("-v") || arg == QLatin1String("-version")) {
fprintf(stderr, "Qt Declarative UI Viewer version %s\n", QT_VERSION_STR);
return 0;
} else if (arg == "-translation") {
- if(i + 1 >= newargc)
+ if(i + 1 >= argc)
usage();
- translationFile = newargv[i + 1];
+ translationFile = argv[i + 1];
++i;
} else if (arg == "-L") {
- libraries << QString(newargv[++i]);
+ libraries << QString(argv[++i]);
} else if (arg[0] != '-') {
fileName = arg;
} else if (1 || arg == "-help") {