Skip to content
Snippets Groups Projects
.#main.cpp.1.4 3.52 KiB
Newer Older
/***************************************************************************
 *   Copyright (C) 2007 by Claudio Scafuri, Giacomo Strangolino   *
 *   claudio@hyo   *
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 *   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, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/


#include <TApplication>
#include <TSplashScreen>
// #include <EStyleLoader> /* see comment below */
//
#define CVSVERSION "$Name:  $"

#include "tdklambda-genesis.h"
#include <tutil.h> /* N.B.: prima degli include di X11 */
#include <X11/Xlib.h>
#include <QX11Info>
#include <elettracolors.h>

int main( int argc, char ** argv ) {

    const char *cvs_version = CVSVERSION;
    TApplication a( argc, argv );
    /* uncomment to set application color */
    a.setPalette(EPalette("fermi"));
    a.setApplicationVersion(CVSVERSION);
    a.setApplicationName("PowerSupplyTDKLambda");
    a.setProperty("author", "Giacomo");
    a.setProperty("mail", "giacomo.strangolino@elettra.trieste.it");
    a.setProperty("phone", "375-8073");
    a.setProperty("office", "T2PT025");
    a.setProperty("hwReferent", "Stefano C."); /* name of the referent that provides the device server */

    /* load the style sheet for QTango application.
     * The file is read from the "${INSTALL_ROOT}/share/qtango/stylesheets/qtango.css"
     * file. You can load a custom stylesheet by exporting the environment variable
     * "QTANGO_STYLESHEET" and setting it to a different path.
     * Moreover, you can construct EStyleLoader with a file name as argument, to ignore
     * the installed "${INSTALL_ROOT}/share/qtango/stylesheets/qtango.css" and the value
     * of the environment variable.
     * This does not work as expected in Qt version 4.4.x. So the following two lines are
     * commented. Uncomment them when upgrading to a newer Qt version.
     */
    //      EStyleLoader sLoader;
    //      a.setStyleSheet(sLoader.styleSheet());

    /* splash screen */
    TSplashScreen splash;

    TUtil::instance()->setLoggingTarget(argv[0]);
    TdkLG mw;
    QString title("pstdklambda-genesis");
    if (QApplication::arguments().size() > 1)
	    title = QApplication::arguments()[1].split('/').last(); /* solo il member */
    mw.setWindowTitle(title);
    mw.show();
    /* hide splash screen */
    splash.finish(&mw);

    /* register to window manager */
    Display *disp = QX11Info::display();
    Window root_win = (Window) mw.winId();
    XSetCommand(disp, root_win, argv, argc);

    return a.exec();
}