6 #include <QtGui/QApplication>
7 #include <BALL/CONFIG/config.h>
13 #include <QtCore/QLocale>
14 #include <QtCore/QTranslator>
16 #include <QtGui/QMessageBox>
17 #include <QtGui/QSplashScreen>
18 #include <QtOpenGL/qgl.h>
48 fprintf( stderr,
"Fatal: %s\n", msg );
51 fprintf( stderr,
"Critical: %s\n", msg );
60 #ifndef BALL_OS_WINDOWS
61 int main(
int argc,
char **argv)
64 int WINAPI WinMain(HINSTANCE, HINSTANCE, PSTR cmd_line,
int)
77 QGL::setPreferredPaintEngine(QPaintEngine::OpenGL);
79 QApplication application(argc, argv);
81 QStringList arguments = application.arguments();
82 QStringList::const_iterator arg_it;
84 bool kiosk_mode =
false;
85 for (arg_it = arguments.constBegin(); arg_it != arguments.constEnd(); ++arg_it)
87 if (arg_it->toLocal8Bit() ==
"-kiosk")
98 QPixmap splash_pm(
":BALLView-1.4-Splashscreen.png");
99 QSplashScreen* splash =
new QSplashScreen(splash_pm);
103 if (!QGLFormat::hasOpenGL())
105 QMessageBox::critical(0,
"Error while starting BALLView",
106 "Your computer has no OpenGL support, please install the correct drivers. Aborting for now...",
107 QMessageBox::Ok, Qt::NoButton, Qt::NoButton);
117 if (f.
hasEntry(
"GENERAL",
"language"))
121 if (!(str ==
"Default"))
123 QString loc =
"BALLView." + str;
128 QTranslator* translator =
new QTranslator(&application);
129 foreach(QString str, dpaths)
131 translator->load(loc, str +
"BALLView/translations");
132 if (!translator->isEmpty())
134 QCoreApplication::installTranslator(translator);
148 BALL::File out(temp_file_name, std::ios::out);
149 out <<
"test" << std::endl;
154 QMessageBox::warning(0,
"Error while starting BALLView",
155 QString(
"You dont have write access to the current working directory\n") +
156 "and BALLView can not find your home directory. This can cause\n" +
157 "unexpected behaviour. Please start BALLView from your homedir with\n" +
158 "absolute path (e.g. C:\\Programs\\BALLView\\BALLView).\n");
184 if (argument ==
"-l")
189 else if (argument ==
"-kiosk")
206 splash->finish(&mainframe);
210 return application.exec();
void setWorkingDir(const String &dir)
Set the working directory for the next file dialog and file operation to the given directory...
int main(int argc, char **argv)
static String getUserHomeDir()
Get the home directory of the current user.
BALL_EXPORT LogStream Log
bool hasEntry(const String §ion, const String &key) const
LogStream & info(int n=0)
void setMode(OperationMode new_mode)
static const char PATH_SEPARATOR
const char * c_str() const BALL_NOEXCEPT
static UIOperationMode & instance()
LogStream & warn(int n=0)
void enableLoggingToFile()
virtual void aboutToExit()
bool hasPrefix(const String &s) const
True, if the string starts with s
void logMessages(QtMsgType type, const char *msg)
virtual void registerThis()
void setIdentifier(const String &identifier)
static bool remove(String name)
static bool createTemporaryFilename(String &temporary, const String &suffix=".TMP")
String getValue(const String §ion, const String &key) const
virtual void openFile(const String &file)