/*
    This file is part of kenvy24 KDE multimedia utility
    Copyright (c) 2007  Valentin RUSU kenvy24@rusu.info

    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) version 3 or, at the discretion of KDE e.V. (which shall
    act as a proxy as in section 14 of the GPLv3), any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/


#ifdef WITHOUT_PARTS
#include "kenvy24gui.h"
#else
#include "shellwindow.h"
#endif // WITHOUT_PARTS

#include <kaboutdata.h>
#include <kuniqueapplication.h>
#include <kapplication.h>
#include <kcmdlineargs.h>
#include <kdebug.h>
#include <klocale.h>
#include "version.h"

static const char description[] =
    I18N_NOOP("VIA Envy24 based sound cards control utility. See http://kenvy24.wiki.sourceforge.net/ for the documentation");

KAboutData aboutData( "kenvy24", 0,
    ki18n( "KEnvy24" ), VERSION,
    ki18n( "The ICE1712 based cards KDE control panel" ), KAboutData::License_GPL,
    ki18n( "(C) 2007-2008, Valentin Rusu" ),
    ki18n( "Feedback:\nkenvy24@rusu.info\n\n(Build Date: " __DATE__ ")" ),
           ( "http://kenvy24.wiki.sourceforge.net/" ) );

int main(int argc, char **argv)
{
    &::aboutData.addCredit( ki18n("Vedran Miletić"), ki18n("DMX 6Fire Card donation"), "<rivanvx@gmail.com>" );
    KCmdLineArgs::init(argc, argv, &::aboutData);
    KCmdLineOptions options;
    // TODO: eventually define command line options here
    KCmdLineArgs::addCmdLineOptions( options );

    KApplication app;

#ifdef WITHOUT_PARTS
    // TODO remove this section and related files as soon as parts system is working
    kenvy24gui *mainWin = 0;
    mainWin = new kenvy24gui();
    mainWin->show();
#else
    kDebug() << "Creating ShellWindow";
    ShellWindow *mainWin = new ShellWindow();
    mainWin->show();

    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
    if(args->count())
    {
        mainWin->load(args->url(0).url());
    }
#endif // WITHOUT_PARTS

    // mainWin has WDestructiveClose flag by default, so it will delete itself.
    return app.exec();
}

