diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-17 00:54:13 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-17 00:54:13 +0000 |
commit | 092be7678b67552cb3161fe162242bf8d3aeed2f (patch) | |
tree | be0693f45b101252c370e40f6e84da2cd7a52f75 /src/main.cpp | |
download | kmplayer-092be7678b67552cb3161fe162242bf8d3aeed2f.tar.gz kmplayer-092be7678b67552cb3161fe162242bf8d3aeed2f.zip |
Added old abandoned KDE3 version of kmplayer
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kmplayer@1091557 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..c10df5b --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,90 @@ +/*************************************************************************** + main.cpp - description + ------------------- +begin : Sat Dec 7 16:14:51 CET 2002 +copyright : (C) 2002 by Koos Vriezen +email : + ***************************************************************************/ + +/*************************************************************************** +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * + ***************************************************************************/ +#include <unistd.h> + +#include <config.h> +#include <kcmdlineargs.h> +#include <kaboutdata.h> +#include <klocale.h> +#include <kdemacros.h> +#include <dcopclient.h> + +#include <qguardedptr.h> +#include <qfileinfo.h> + +#include "kmplayer.h" + +static const char description[] = I18N_NOOP("KMPlayer"); + + +static KCmdLineOptions options[] = +{ + { "+[File]", I18N_NOOP("file to open"), 0 }, + KCmdLineLastOption + // INSERT YOUR COMMANDLINE OPTIONS HERE +}; + +extern "C" { + + KDE_EXPORT int kdemain (int argc, char *argv[]) + { + setsid (); + + KAboutData aboutData ("kmplayer", I18N_NOOP ("KMPlayer"), + VERSION, description, KAboutData::License_GPL, + "(c) 2002-2005, Koos Vriezen", 0, 0, ""); + aboutData.addAuthor( "Koos Vriezen",0, ""); + KCmdLineArgs::init (argc, argv, &aboutData); + KCmdLineArgs::addCmdLineOptions (options); // Add our own options. + + KMPlayer::StringPool::init(); + + KApplication app; + QGuardedPtr <KMPlayerApp> kmplayer; + + if (app.isRestored ()) { + RESTORE (KMPlayerApp); + } else { + kmplayer = new KMPlayerApp (); + kmplayer->show(); + + KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); + + KURL url; + if (args->count () == 1) + url = args->url (0); + if (args->count () > 1) + for (int i = 0; i < args->count (); i++) { + KURL url = args->url (i); + if (url.url ().find ("://") < 0) + url = KURL (QFileInfo (url.url ()).absFilePath ()); + if (url.isValid ()) + kmplayer->addURL (url); + } + kmplayer->openDocumentFile (url); + args->clear (); + } + app.dcopClient()->registerAs("kmplayer"); + int retvalue = app.exec (); + + delete kmplayer; + + KMPlayer::StringPool::reset(); + + return retvalue; + } +} |