122
123
QT_TR_NOOP("Developer"),"rvm@escomposlinux.org");
124
125
static const KCmdLineOptions options[] =
125
{ {"+[file]", QT_TR_NOOP("File to open"), 0 }, KCmdLineLastOption };
127
//{ "ini-path <dir>", "path for ini file", 0 },
128
{"+[file]", QT_TR_NOOP("File to open"), 0 }, KCmdLineLastOption };
127
130
KCmdLineArgs::init(argc, argv, aboutdata);
128
131
KCmdLineArgs::addCmdLineOptions( options );
137
140
QApplication a( argc, argv );
142
qInstallMsgHandler( myMessageOutput );
145
// Get argument with full path
147
QString file_to_play="";
150
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
151
if (args->count() > 0) {
152
file_to_play = QString::fromLocal8Bit( args->arg(0) );
156
file_to_play = QString::fromLocal8Bit( a.argv()[1] );
160
144
QString app_path = a.applicationDirPath();
161
145
Helper::setAppPath(app_path);
162
146
//qDebug( "main: application path: '%s'", app_path.utf8().data());
150
QStringList files_to_play;
153
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
155
int arg_count = args->count();
157
if ( arg_count > arg_init ) {
158
for (int n=arg_init; n < arg_count; n++) {
159
QString argument = QString::fromLocal8Bit( args->arg(n) );
160
if (QFile::exists( argument )) {
161
argument = QFileInfo(argument).absFilePath();
163
files_to_play.append( argument );
170
#if QT_VERSION >= 0x040100
171
int arg_count = a.arguments().count();
173
int arg_count = a.argc();
176
if ( arg_count > arg_init ) {
177
for (int n=arg_init; n < arg_count; n++) {
178
#if QT_VERSION >= 0x040100
179
QString argument = a.arguments()[n];
181
QString argument = QString::fromLocal8Bit( a.argv()[n] );
183
if (argument == "-ini-path") {
184
//qDebug( "ini_path: %d %d", n+1, arg_count );
185
ini_path = Helper::appPath();
186
if (n+1 < arg_count) {
188
#if QT_VERSION >= 0x040100
189
ini_path = a.arguments()[n];
191
ini_path = QString::fromLocal8Bit( a.argv()[n] );
196
if (QFile::exists( argument )) {
197
argument = QFileInfo(argument).absFilePath();
199
files_to_play.append( argument );
205
global_init(ini_path);
207
qInstallMsgHandler( myMessageOutput );
210
#if QT_VERSION >= 0x040000
211
qDebug(" * ini path: '%s'", ini_path.utf8().data());
167
215
translator->load( pref->language );
168
216
a.installTranslator(translator->qtranslator());
170
qDebug("main: file_to_play: '%s'", file_to_play.utf8().data());
218
qDebug("main: files_to_play: count: %d", files_to_play.count() );
219
for (int n=0; n < files_to_play.count(); n++) {
220
qDebug("main: files_to_play[%d]: '%s'", n, files_to_play[n].utf8().data());
172
DefaultGui * w = new DefaultGui(file_to_play, 0, "gui");
223
DefaultGui * w = new DefaultGui(files_to_play, 0, "gui");
173
224
a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
175
226
int r = a.exec();