Update lua versions
[ryzomcore.git] / nel / tools / misc / message_box_qt / main.cpp
blob22b72ea5a73e388a58143ca202a5dedc5a20a593
1 #include <qglobal.h>
3 #ifdef Q_COMPILER_RVALUE_REFS
4 #undef Q_COMPILER_RVALUE_REFS
5 #endif
7 #include <QApplication>
8 #include <QFile>
9 #include <QMessageBox>
11 #ifdef QT_STATICPLUGIN
13 #include <QtPlugin>
15 #if defined(Q_OS_WIN32)
16 Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
17 #elif defined(Q_OS_MAC)
18 Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin)
19 #elif defined(Q_OS_UNIX)
20 Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)
21 #endif
23 #endif
25 int main(int argc, char *argv[])
27 QApplication app(argc, argv);
29 // build command line arguments string
30 QString arguments;
31 for(int i = 1 ; i <= argc ; i++)
33 arguments += argv[i];
34 if (i < argc - 1)
35 arguments += ' ';
38 // if command line starts with -f show file content
39 if (arguments.startsWith("-f "))
41 QString fileName = arguments.remove(0, 3);
43 QFile file(fileName);
44 if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
45 app.exit(-1);
47 QString content;
49 while (!file.atEnd())
51 QByteArray line = file.readLine();
52 content.append(line);
55 QMessageBox::information(NULL, "message_box", content);
57 // else show arguments in message box content
58 else
60 QMessageBox::information(NULL, "message_box", arguments);
63 app.exit(0);