tools/linguist/linguist/main.cpp

Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
00004 **
00005 ** This file is part of the Qt Linguist of the Qt Toolkit.
00006 **
00007 ** This file may be used under the terms of the GNU General Public
00008 ** License version 2.0 as published by the Free Software Foundation
00009 ** and appearing in the file LICENSE.GPL included in the packaging of
00010 ** this file.  Please review the following information to ensure GNU
00011 ** General Public Licensing requirements will be met:
00012 ** http://www.trolltech.com/products/qt/opensource.html
00013 **
00014 ** If you are unsure which license is appropriate for your use, please
00015 ** review the following information:
00016 ** http://www.trolltech.com/products/qt/licensing.html or contact the
00017 ** sales department at sales@trolltech.com.
00018 **
00019 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00020 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00021 **
00022 ****************************************************************************/
00023 
00024 #include "trwindow.h"
00025 
00026 #include <QApplication>
00027 #include <QDesktopWidget>
00028 #include <QPixmap>
00029 #include <QTextCodec>
00030 #include <QTranslator>
00031 #include <QSettings>
00032 #include <QSplashScreen>
00033 #include <QLibraryInfo>
00034 #include <QLocale>
00035 
00036 int main(int argc, char **argv)
00037 {
00038     Q_INIT_RESOURCE(linguist);
00039 
00040     QApplication app(argc, argv);
00041     QApplication::setOverrideCursor(Qt::WaitCursor);
00042 
00043     QTranslator translator(0);
00044     translator.load(QLatin1String("linguist_") + QLocale::system().name(), ".");
00045     app.installTranslator(&translator);
00046 
00047     QTranslator qtTranslator(0);
00048     qtTranslator.load(QLatin1String("qt_") + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
00049     app.installTranslator(&qtTranslator);
00050 
00051     app.setOrganizationName("Trolltech");
00052     app.setApplicationName("Linguist");
00053     QString keybase(QString::number( (QT_VERSION >> 16) & 0xff ) +
00054                      "." + QString::number( (QT_VERSION >> 8) & 0xff ) + "/" );
00055     QSettings config;
00056 
00057     QWidget tmp;
00058     tmp.restoreGeometry(config.value(keybase + "Geometry/WindowGeometry").toByteArray());
00059     
00060     QSplashScreen *splash = 0;
00061     int screenId = QApplication::desktop()->screenNumber(tmp.geometry().center());
00062     splash = new QSplashScreen(QApplication::desktop()->screen(screenId),
00063         QPixmap(":/images/splash.png"));
00064     if (QApplication::desktop()->isVirtualDesktop()) {
00065         QRect srect(0, 0, splash->width(), splash->height());
00066         splash->move(QApplication::desktop()->availableGeometry(screenId).center() - srect.center() );
00067     }
00068     splash->setAttribute(Qt::WA_DeleteOnClose);
00069     splash->show();
00070 
00071     TrWindow tw;
00072     tw.show();
00073 
00074     splash->finish(&tw);
00075 
00076     if (app.argc() > 1)
00077         tw.openFile(QString(app.argv()[app.argc() - 1]));
00078 
00079     QApplication::restoreOverrideCursor();
00080 
00081     return app.exec();
00082 }

Generated on Thu Mar 15 11:57:32 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1