6 #include <QtWidgets/QApplication>
7 #include <QtWidgets/QMessageBox>
8 #include <QtCore/QTranslator>
14 void logMessages(QtMsgType type,
const QMessageLogContext& context,
const QString& message)
21 BALL::Log.
info() << message.toStdString() <<
" " << (context.file ? context.file :
"(unknown context)")
22 <<
" " << context.line
23 <<
" " << (context.function ? context.function :
"(unknown function)") << std::endl;
26 BALL::Log.
warn() << message.toStdString() <<
" " << (context.file ? context.file :
"(unknown context)")
27 <<
" " << context.line
28 <<
" " << (context.function ? context.function :
"(unknown function)") << std::endl;
31 fprintf( stderr,
"Fatal: %s\n", message.toLatin1().constData() );
34 fprintf( stderr,
"Critical: %s\n", message.toLatin1().constData() );
45 #ifndef BALL_OS_WINDOWS
46 int main(
int argc,
char **argv)
49 int WINAPI WinMain(HINSTANCE, HINSTANCE, PSTR cmd_line,
int)
60 QApplication application(argc, argv);
62 QStringList arguments = application.arguments();
63 QStringList::const_iterator arg_it;
65 bool kiosk_mode =
false;
66 for (arg_it = arguments.constBegin(); arg_it != arguments.constEnd(); ++arg_it)
68 if (arg_it->toLocal8Bit() ==
"-kiosk")
80 if (!QGLFormat::hasOpenGL())
82 QMessageBox::critical(0,
"Error while starting BALLView",
83 "Your computer has no OpenGL support, please install the correct drivers. Aborting for now...",
84 QMessageBox::Ok, Qt::NoButton, Qt::NoButton);
94 if (f.
hasEntry(
"GENERAL",
"language"))
100 QString loc =
"BALLView-" + str;
105 QTranslator* translator =
new QTranslator(&application);
106 Q_FOREACH(QString s, dpaths)
108 translator->load(loc, s +
"BALLView/translations");
109 if (!translator->isEmpty())
111 QCoreApplication::installTranslator(translator);
125 BALL::File out(temp_file_name, std::ios::out);
126 out <<
"test" << std::endl;
131 QMessageBox::warning(0,
"Error while starting BALLView",
132 QString(
"You dont have write access to the current working directory\n") +
133 "and BALLView can not find your home directory. This can cause\n" +
134 "unexpected behaviour. Please start BALLView from your homedir with\n" +
135 "absolute path (e.g. C:\\Programs\\BALLView\\BALLView).\n");
161 if (argument ==
"-l")
166 else if (argument ==
"-kiosk")
183 return application.exec();